From b49ecfc3e711706e74b45e40964e588f50b77519 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 3 Jun 2026 21:56:02 +0000 Subject: [PATCH] fix(proxy): don't misread --mode/--port flags as legacy url/key start-proxy.js treated argv[2]/argv[3] as the legacy positionals before checking for flags, so 'node start-proxy.js --mode deepseek --port 3200' crashed with new URL('--mode'). Standalone flag mode was unreachable. Now ignores leading flags; legacy mode (real url+key) is unchanged. (Same fix already applied in the hydra deepclaude.) https://claude.ai/code/session_01QudvzQk8mSQd3xrQwmX93D --- proxy/start-proxy.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/proxy/start-proxy.js b/proxy/start-proxy.js index 5847076..8ad77e4 100644 --- a/proxy/start-proxy.js +++ b/proxy/start-proxy.js @@ -7,9 +7,13 @@ const BACKEND_DEFS = { fireworks: { url: 'https://api.fireworks.ai/inference/v1', keyEnv: 'FIREWORKS_API_KEY' }, }; -// Legacy mode: start-proxy.js (used by deepclaude.sh/ps1) -const targetUrl = process.argv[2] || process.env.CHEAPCLAUDE_TARGET_URL; -const apiKey = process.argv[3] || process.env.CHEAPCLAUDE_API_KEY; +// Legacy mode: start-proxy.js (used by deepclaude.sh/ps1). +// Only treat the first two args as url/key when they are NOT flags, so standalone +// flag usage (--mode/--port) isn't misread as legacy mode and crashed by +// `new URL('--mode')`. +const isFlag = (s) => typeof s === 'string' && s.startsWith('-'); +const targetUrl = (!isFlag(process.argv[2]) && process.argv[2]) || process.env.CHEAPCLAUDE_TARGET_URL; +const apiKey = (!isFlag(process.argv[3]) && process.argv[3]) || process.env.CHEAPCLAUDE_API_KEY; if (targetUrl && apiKey) { // Legacy single-backend mode