mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 04:18:05 +00:00
fix(doctor): use actual installed clipproxy version instead of hardcoded
This commit is contained in:
@@ -900,4 +900,20 @@ export function getCLIProxyPath(): string {
|
||||
return manager.getBinaryPath();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get installed CLIProxyAPI version from .version file
|
||||
* Returns the fallback version if not installed or version file missing
|
||||
*/
|
||||
export function getInstalledCliproxyVersion(): string {
|
||||
const versionFile = path.join(getBinDir(), '.version');
|
||||
if (fs.existsSync(versionFile)) {
|
||||
try {
|
||||
return fs.readFileSync(versionFile, 'utf8').trim();
|
||||
} catch {
|
||||
return CLIPROXY_FALLBACK_VERSION;
|
||||
}
|
||||
}
|
||||
return CLIPROXY_FALLBACK_VERSION;
|
||||
}
|
||||
|
||||
export default BinaryManager;
|
||||
|
||||
@@ -40,6 +40,7 @@ export {
|
||||
ensureCLIProxyBinary,
|
||||
isCLIProxyInstalled,
|
||||
getCLIProxyPath,
|
||||
getInstalledCliproxyVersion,
|
||||
} from './binary-manager';
|
||||
|
||||
// Config generation
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
isPortAvailable,
|
||||
getAllAuthStatus,
|
||||
getConfigPath,
|
||||
CLIPROXY_VERSION,
|
||||
getInstalledCliproxyVersion,
|
||||
CLIPROXY_DEFAULT_PORT,
|
||||
} from '../cliproxy';
|
||||
|
||||
@@ -775,11 +775,12 @@ class Doctor {
|
||||
|
||||
if (isCLIProxyInstalled()) {
|
||||
const binaryPath = getCLIProxyPath();
|
||||
const installedVersion = getInstalledCliproxyVersion();
|
||||
binarySpinner.succeed();
|
||||
console.log(` ${ok('CLIProxy Binary'.padEnd(22))} v${CLIPROXY_VERSION}`);
|
||||
console.log(` ${ok('CLIProxy Binary'.padEnd(22))} v${installedVersion}`);
|
||||
this.results.addCheck('CLIProxy Binary', 'success', undefined, undefined, {
|
||||
status: 'OK',
|
||||
info: `v${CLIPROXY_VERSION} (${binaryPath})`,
|
||||
info: `v${installedVersion} (${binaryPath})`,
|
||||
});
|
||||
} else {
|
||||
binarySpinner.info();
|
||||
|
||||
Reference in New Issue
Block a user