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:
Irvan Fauziansyah
2026-01-29 16:31:14 +07:00
parent b64809277c
commit f786e3b3c6
4 changed files with 28 additions and 14 deletions

View File

@@ -1,9 +1,30 @@
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
import path from 'path';
/**
* Shared Utility Functions
*
* 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
* @param {number} ms - Duration in milliseconds