feat: add version display to CLI banner and WebUI
- Add getPackageVersion() utility function in src/utils/helpers.js - Display version in CLI startup banner (e.g., "v2.4.2") - Display version in WebUI navbar next to "CLAUDE PROXY SYSTEM" - Refactor WebUI to use shared getPackageVersion() utility - Update footer with GitHub icon and link
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "antigravity-claude-proxy",
|
"name": "antigravity-claude-proxy",
|
||||||
"version": "1.2.6",
|
"version": "2.4.2",
|
||||||
"description": "Proxy server to use Antigravity's Claude models with Claude Code CLI",
|
"description": "Proxy server to use Antigravity's Claude models with Claude Code CLI",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -8,9 +8,12 @@ import { DEFAULT_PORT } from './constants.js';
|
|||||||
import { logger } from './utils/logger.js';
|
import { logger } from './utils/logger.js';
|
||||||
import { config } from './config.js';
|
import { config } from './config.js';
|
||||||
import { getStrategyLabel, STRATEGY_NAMES, DEFAULT_STRATEGY } from './account-manager/strategies/index.js';
|
import { getStrategyLabel, STRATEGY_NAMES, DEFAULT_STRATEGY } from './account-manager/strategies/index.js';
|
||||||
|
import { getPackageVersion } from './utils/helpers.js';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
|
const packageVersion = getPackageVersion();
|
||||||
|
|
||||||
// Parse command line arguments
|
// Parse command line arguments
|
||||||
const args = process.argv.slice(2);
|
const args = process.argv.slice(2);
|
||||||
const isDebug = args.includes('--debug') || process.env.DEBUG === 'true';
|
const isDebug = args.includes('--debug') || process.env.DEBUG === 'true';
|
||||||
@@ -90,7 +93,7 @@ const server = app.listen(PORT, () => {
|
|||||||
|
|
||||||
logger.log(`
|
logger.log(`
|
||||||
╔══════════════════════════════════════════════════════════════╗
|
╔══════════════════════════════════════════════════════════════╗
|
||||||
║ Antigravity Claude Proxy Server ║
|
║ Antigravity Claude Proxy Server v${packageVersion} ║
|
||||||
╠══════════════════════════════════════════════════════════════╣
|
╠══════════════════════════════════════════════════════════════╣
|
||||||
║ ║
|
║ ║
|
||||||
${border} ${align(`Server and WebUI running at: http://localhost:${PORT}`)}${border}
|
${border} ${align(`Server and WebUI running at: http://localhost:${PORT}`)}${border}
|
||||||
|
|||||||
@@ -1,9 +1,30 @@
|
|||||||
|
import { readFileSync } from 'fs';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shared Utility Functions
|
* Shared Utility Functions
|
||||||
*
|
*
|
||||||
* General-purpose helper functions used across multiple modules.
|
* General-purpose helper functions used across multiple modules.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the package version from package.json
|
||||||
|
* @param {string} [defaultVersion='1.0.0'] - Default version if package.json cannot be read
|
||||||
|
* @returns {string} The package version
|
||||||
|
*/
|
||||||
|
export function getPackageVersion(defaultVersion = '1.0.0') {
|
||||||
|
try {
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
const packageJsonPath = path.join(__dirname, '../../package.json');
|
||||||
|
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
||||||
|
return packageJson.version || defaultVersion;
|
||||||
|
} catch {
|
||||||
|
return defaultVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format duration in milliseconds to human-readable string
|
* Format duration in milliseconds to human-readable string
|
||||||
* @param {number} ms - Duration in milliseconds
|
* @param {number} ms - Duration in milliseconds
|
||||||
|
|||||||
@@ -13,8 +13,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { readFileSync } from 'fs';
|
|
||||||
import { fileURLToPath } from 'url';
|
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import { getPublicConfig, saveConfig, config } from '../config.js';
|
import { getPublicConfig, saveConfig, config } from '../config.js';
|
||||||
import { DEFAULT_PORT, ACCOUNT_CONFIG_PATH, MAX_ACCOUNTS } from '../constants.js';
|
import { DEFAULT_PORT, ACCOUNT_CONFIG_PATH, MAX_ACCOUNTS } from '../constants.js';
|
||||||
@@ -22,18 +20,10 @@ import { readClaudeConfig, updateClaudeConfig, replaceClaudeConfig, getClaudeCon
|
|||||||
import { logger } from '../utils/logger.js';
|
import { logger } from '../utils/logger.js';
|
||||||
import { getAuthorizationUrl, completeOAuthFlow, startCallbackServer } from '../auth/oauth.js';
|
import { getAuthorizationUrl, completeOAuthFlow, startCallbackServer } from '../auth/oauth.js';
|
||||||
import { loadAccounts, saveAccounts } from '../account-manager/storage.js';
|
import { loadAccounts, saveAccounts } from '../account-manager/storage.js';
|
||||||
|
import { getPackageVersion } from '../utils/helpers.js';
|
||||||
|
|
||||||
// Get package version
|
// Get package version
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const packageVersion = getPackageVersion();
|
||||||
const __dirname = path.dirname(__filename);
|
|
||||||
let packageVersion = '1.0.0';
|
|
||||||
try {
|
|
||||||
const packageJsonPath = path.join(__dirname, '../../package.json');
|
|
||||||
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
||||||
packageVersion = packageJson.version;
|
|
||||||
} catch (error) {
|
|
||||||
logger.warn('[WebUI] Could not read package.json version, using default');
|
|
||||||
}
|
|
||||||
|
|
||||||
// OAuth state storage (state -> { server, verifier, state, timestamp })
|
// OAuth state storage (state -> { server, verifier, state, timestamp })
|
||||||
// Maps state ID to active OAuth flow data
|
// Maps state ID to active OAuth flow data
|
||||||
|
|||||||
Reference in New Issue
Block a user