fix(login): full stdio inheritance for claude setup-token + paste prompt#25
Merged
Conversation
Live test surfaced two bugs in `maru profile login` (alpha.5/.6): 1. Claude Code's `setup-token` is a TUI app. Piping its stdout (to capture the token) made it detect a non-TTY and re-render the splash multiple times — the user saw three repetitions of "Opening browser to sign in..." with cloud-and-C ASCII art. 2. The "last non-empty line" extraction reliably grabbed the hint line `Use this token by setting: export CLAUDE_CODE_OAUTH_TOKEN=<token>` (with the literal placeholder `<token>`) rather than the actual token printed a few lines below. The saved token was therefore invalid; Claude Code silently fell back to the OAuth flow on next launch and showed the first-time onboarding instead of an authenticated session. Replace the auto-capture path with full stdio inheritance: `setup-token` runs as if invoked directly (no TUI corruption, OAuth flow + browser handoff work normally), and after it exits, maru prompts the user to paste the token they just saw printed. The `--stdin` mode is unchanged for piped/scripted use. Updates docs/limitations.md + docs/quickstart.md to describe the paste step. Workspace 240/240 tests pass. Bumps to 0.1.0-alpha.7.
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.
Summary
User report with screenshots: `maru profile login work` showed garbled output — Claude Code's splash screen ("Opening browser to sign in... Welcome to Claude Code v2.1.112" + ASCII art) repeated three times. After login, `claude` showed first-time onboarding instead of an authenticated session.
Diagnosis
Two bugs in alpha.5/alpha.6's `maru profile login`:
Fix
Replace the auto-capture with full stdio inheritance for `setup-token`. The OAuth flow runs as if invoked directly (TUI works, browser callback works, token prints normally). After `setup-token` exits, maru prompts the user to paste the printed token. They have full scrollback to copy from.
`--stdin` mode is unchanged for piped/scripted use:
```sh
claude setup-token | maru profile login work --stdin
```
Test plan
Bumps workspace to 0.1.0-alpha.7. Updates docs/limitations.md + docs/quickstart.md to describe the paste step.