fix(oauth): print the e2e login URL on one copyable line

Merged
TM
14d ago
+32-3

e2e login showed the sign-in URL inside a clack.note box. A provider URL is longer than the box, so clack wrapped it and drew a │ border on every piece. Copying the link brought the borders along, and the pasted URL was broken.

  • The URL now gets a line of its own with no guide (clack.log.message(url, { withGuide: false })): selecting it, triple-clicking the line, or Cmd+clicking it all give the whole URL. clack.log never wraps; only note and box do.
  • The heading says what happens: Opening your browser. If it does not open, use this link: (... and enter the code: for device flows). The code is bold, and the provider's instructions are dimmed below.
  • Non-interactive output is unchanged.
  • packages/e2e/src/oauth/cli.ts:213

Verified

Ran it locally: yes

  • Built dist/oauth/cli.js, called runLogin('openai', {}, { isTTY: true, openUrl: () => {} }) on the real OpenAI flow and cancelled it with SIGINT once the URL was printed; output piped, so clack used 80 columns.
  • New unit test in tests/unit/oauth/cli.test.ts asserts a printed line equals the URL exactly: fails on main, passes here.
mainthis branch
URL cut into 6 pieces, each between │ bordersURL whole, on a line of its own

Full output, main:

┌  Sign in to ChatGPT
│
◇  Open this page ─────────────────────────────────────────────────────────────╮
│                                                                              │
│  https://auth.openai.com/oauth/authorize?response_type=code&client_id=app_E  │
│  MoamEEZ73f0CkXaXp7hrann&redirect_uri=http%3A%2F%2Flocalhost%3A1455%2Fauth%  │
│  2Fcallback&scope=openid+profile+email+offline_access&code_challenge=d1BboS  │
│  UcSrQoONIUkLesMlq1Z7pHIlCX6j4KOLPxRWk&code_challenge_method=S256&id_token_  │
│  add_organizations=true&codex_cli_simplified_flow=true&state=TAIxF-AiZvLi9d  │
│  rcgOyeQQLGGqFjv6bb&originator=e2e                                           │
│                                                                              │
├──────────────────────────────────────────────────────────────────────────────╯
Sign in in the browser; this terminal continues when the browser returns, or asks for the URL it landed on.
│
■  Canceled
└  the login was cancelled

This branch:

┌  Sign in to ChatGPT
│
◇  Opening your browser. If it does not open, use this link:
https://auth.openai.com/oauth/authorize?response_type=code&client_id=app_EMoamEEZ73f0CkXaXp7hrann&redirect_uri=http%3A%2F%2Flocalhost%3A1455%2Fauth%2Fcallback&scope=openid+profile+email+offline_access&code_challenge=rfprzDRMqtJCg-E3kpae4E5kY8x9hXhIIQvLv42YnVA&code_challenge_method=S256&id_token_add_organizations=true&codex_cli_simplified_flow=true&state=Bd8NxJ_CJx5GPkQ37KQLyJAWUJJ0p86l&originator=e2e
│
│  Sign in in the browser; this terminal continues when the browser returns, or asks for the URL it landed on.
│
■  Canceled
└  the login was cancelled

Not verified: the device-code flow (--device) end to end; the unit test covers its Code: line.

Before

https://github.com/user-attachments/assets/16e70dc9-3eb3-4171-b927-8b520c43eacf

After

https://github.com/user-attachments/assets/9403d47c-6eb4-43f2-bdd3-af40d4e2e57c

🤖 Generated with Claude Code