fix(cliproxy): use backend-aware labels in error messages and API

- Use checkCliproxyUpdate() in checkLatestVersion() for correct repo
- Dynamic error messages based on backend in service-manager
- Dynamic error messages based on backend in cliproxy-executor
- Generic "CLIProxy" message in oauth-process (no backend context)
This commit is contained in:
kaitranntt
2026-01-23 15:37:40 -05:00
parent 2794a548a5
commit f0c845c32e
4 changed files with 16 additions and 5 deletions
+1 -1
View File
@@ -271,7 +271,7 @@ async function handleTokenNotFound(
/** Handle process exit with error */
function handleProcessError(code: number | null, state: ProcessState, headless: boolean): void {
console.log('');
console.log(fail(`CLIProxy Plus auth exited with code ${code}`));
console.log(fail(`CLIProxy auth exited with code ${code}`));
if (state.stderrData && !state.urlDisplayed) {
console.log(` ${state.stderrData.trim().split('\n')[0]}`);
}
+3 -2
View File
@@ -724,12 +724,13 @@ export async function execClaudeWithCLIProxy(
await waitForProxyReady(cfg.port, cfg.timeout, cfg.pollInterval);
readySpinner.succeed(`CLIProxy ready on port ${cfg.port}`);
} catch (error) {
readySpinner.fail('CLIProxy Plus startup failed');
const backendLabel = backend === 'plus' ? 'CLIProxy Plus' : 'CLIProxy';
readySpinner.fail(`${backendLabel} startup failed`);
proxy.kill('SIGTERM');
const err = error as Error;
console.error('');
console.error(fail('CLIProxy Plus failed to start'));
console.error(fail(`${backendLabel} failed to start`));
console.error('');
console.error('Possible causes:');
console.error(` 1. Port ${cfg.port} already in use`);
+8 -1
View File
@@ -281,11 +281,18 @@ export async function ensureCliproxyService(
proxyProcess = null;
}
// Get backend label for error message
const { loadOrCreateUnifiedConfig } = await import('../config/unified-config-loader');
const { DEFAULT_BACKEND } = await import('./platform-detector');
const config = loadOrCreateUnifiedConfig();
const backendLabel =
(config.cliproxy?.backend ?? DEFAULT_BACKEND) === 'plus' ? 'CLIProxy Plus' : 'CLIProxy';
return {
started: false,
alreadyRunning: false,
port,
error: `CLIProxy Plus failed to start within 5s on port ${port}`,
error: `${backendLabel} failed to start within 5s on port ${port}`,
};
}
+4 -1
View File
@@ -75,7 +75,10 @@ export async function checkLatestVersion(backend?: CLIProxyBackend): Promise<Lat
backend ?? loadOrCreateUnifiedConfig().cliproxy?.backend ?? DEFAULT_BACKEND;
try {
const latestVersion = await fetchLatestCliproxyVersion();
// Use checkCliproxyUpdate which is backend-aware (uses correct GitHub repo)
const { checkCliproxyUpdate } = await import('../binary-manager');
const updateResult = await checkCliproxyUpdate();
const latestVersion = updateResult.latestVersion;
const currentVersion = getInstalledCliproxyVersion(effectiveBackend);
const updateAvailable = latestVersion !== currentVersion;