diff --git a/CLAUDE.md b/CLAUDE.md index 70c7fb2..6aae1b3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -29,6 +29,7 @@ npm run dev # Account management npm run accounts # Interactive account management npm run accounts:add # Add a new Google account via OAuth +npm run accounts:add -- --no-browser # Add account on headless server (manual code input) npm run accounts:list # List configured accounts npm run accounts:verify # Verify account tokens are valid @@ -43,6 +44,7 @@ npm run test:interleaved # Interleaved thinking npm run test:images # Image processing npm run test:caching # Prompt caching npm run test:crossmodel # Cross-model thinking signatures +npm run test:oauth # OAuth no-browser mode ``` ## Architecture diff --git a/README.md b/README.md index e5aea5d..863d3b4 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,21 @@ npm run accounts:add This opens your browser for Google OAuth. Sign in and authorize access. Repeat for multiple accounts. +**Headless Servers (Docker, SSH, no desktop):** + +```bash +# Use --no-browser mode for servers without a browser +antigravity-claude-proxy accounts add --no-browser + +# Or with npx +npx antigravity-claude-proxy accounts add -- --no-browser + +# Or if cloned locally +npm run accounts:add -- --no-browser +``` + +This displays an OAuth URL you can open on another device (phone/laptop). After signing in, copy the redirect URL or authorization code and paste it back into the terminal. + Manage accounts: ```bash diff --git a/package.json b/package.json index 365945e..432dcfd 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "test:interleaved": "node tests/test-interleaved-thinking.cjs", "test:images": "node tests/test-images.cjs", "test:caching": "node tests/test-caching-streaming.cjs", - "test:crossmodel": "node tests/test-cross-model-thinking.cjs" + "test:crossmodel": "node tests/test-cross-model-thinking.cjs", + "test:oauth": "node tests/test-oauth-no-browser.cjs" }, "keywords": [ "claude", diff --git a/src/cli/accounts.js b/src/cli/accounts.js index 533aec8..7cb000e 100644 --- a/src/cli/accounts.js +++ b/src/cli/accounts.js @@ -248,7 +248,7 @@ async function addAccountNoBrowser(existingAccounts, rl) { const input = await rl.question('Paste the callback URL or authorization code: '); try { - const { code, extractedState } = extractCodeFromInput(input); + const { code, state: extractedState } = extractCodeFromInput(input); // Validate state if present if (extractedState && extractedState !== state) { @@ -460,6 +460,7 @@ async function main() { console.log('╔════════════════════════════════════════╗'); console.log('║ Antigravity Proxy Account Manager ║'); + console.log('║ Use --no-browser for headless mode ║'); console.log('╚════════════════════════════════════════╝'); const rl = createRL(); diff --git a/tests/run-all.cjs b/tests/run-all.cjs index 709a2ac..07fa56a 100644 --- a/tests/run-all.cjs +++ b/tests/run-all.cjs @@ -14,7 +14,8 @@ const tests = [ { name: 'Multi-turn Tools (Streaming)', file: 'test-multiturn-thinking-tools-streaming.cjs' }, { name: 'Interleaved Thinking', file: 'test-interleaved-thinking.cjs' }, { name: 'Image Support', file: 'test-images.cjs' }, - { name: 'Prompt Caching', file: 'test-caching-streaming.cjs' } + { name: 'Prompt Caching', file: 'test-caching-streaming.cjs' }, + { name: 'OAuth No-Browser Mode', file: 'test-oauth-no-browser.cjs' } ]; async function runTest(test) {