fix(doctor): use actual installed clipproxy version instead of hardcoded

This commit is contained in:
kaitranntt
2025-12-04 03:19:01 -05:00
parent 5d5d62fac9
commit e3edcf613e
3 changed files with 21 additions and 3 deletions
+16
View File
@@ -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;
+1
View File
@@ -40,6 +40,7 @@ export {
ensureCLIProxyBinary,
isCLIProxyInstalled,
getCLIProxyPath,
getInstalledCliproxyVersion,
} from './binary-manager';
// Config generation
+4 -3
View File
@@ -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();