mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 10:16:49 +00:00
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:
@@ -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]}`);
|
||||
}
|
||||
|
||||
@@ -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`);
|
||||
|
||||
@@ -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}`,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user