Repository navigation
Feat: headless paste login for bigmodel OAuth (--paste, TUI L key) - #42
Merged
Merged
Conversation
CLI: `auth login bigmodel --paste` or ZCODE_OAUTH_PASTE=1 — paste the redirected 127.0.0.1 callback URL back instead of waiting on a callback the browser can never reach inside a container (gcloud/gh-style). The normal flow prints a headless hint pointing at --paste. TUI: single OAuth Login entry as before; while a login waits, a yellow highlight row offers `L` to switch it to paste mode (Promise.race with the callback waiter, losing branch's timeout swallowed, client closed exactly once). Idle `L` starts a paste login directly. parsePastedCallbackUrl (auth/oauth.ts): query-only parsing, copy-artifact tolerant (quotes/brackets, & entities), accepts both authCode and code params, strict CSRF state check. runtime/paste-login.ts (new): banner instructions with a bracketed URL example using the real callback port (ANSI-free when piped) + readline with timeout. open-browser.ts: fix ENOENT crash on headless boxes (async spawn error had no listener). Tests: 14 new cases (parser incl. authorize↔exchange redirect_uri round-trip, IO helpers). bun test 732 pass; bun x tsc --noEmit clean. README: headless/Docker login section, TUI key table, env var table. Co-Authored-By: Claude Code <noreply@anthropic.com>
Owner
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CLI:
auth login bigmodel --pasteor ZCODE_OAUTH_PASTE=1 — paste the redirected 127.0.0.1 callback URL back instead of waiting on a callback the browser can never reach inside a container. The normal flow prints a headless hint pointing at --paste.TUI: While waiting for browser callback, press
Lto switch to paste mode (races against the callback, cleanly cleans up the losing waiter, and ensures the client closes only once).runtime/paste-login.ts (new): banner instructions with a bracketed URL example using the real callback port (ANSI-free when piped) + readline with timeout. open-browser.ts: fix ENOENT crash on headless boxes (async spawn error had no listener).
Tests: 14 new cases (parser incl. authorize↔exchange redirect_uri round-trip, IO helpers). bun test 732 pass; bun x tsc --noEmit clean. README: headless/Docker login section, TUI key table, env var table.