feat(setup): the curl|sh path can offer the browser login too — prompt via /dev/tty
Tony's ask: the installation script should let you run the OAuth login as well. It couldn't: under curl … | sh stdin is the script pipe, so the 0.0.39 login offer never fired on the curl path (and agents.sh forwards -y).
The standard installer solution (Homebrew prompts the same way):
openPromptInput()— read the Y/n answer from stdin when it's a TTY, else from/dev/tty(POSIX only; never on Windows, where the curl path doesn't exist).defaultAskdeclines instead of hanging if the terminal vanishes between the gate and the question.canPromptViaTty()feeds the LoginFlow gate. The stdout-TTY requirement inshouldOfferLoginis unchanged and load-bearing: an agent or CI piping our output is never prompted, even though its process may technically have a controlling terminal.- install.sh: keep
-yforsetup agentonly when/dev/ttydoes not answer — a human runningcurl | shgets the login offer; unattended runs (CI, cron, docker: no controlling terminal) stay fully non-interactive.
Gate: sh -n clean, typecheck clean, 480/480 tests (prompt plumbing is injected in tests as before; the pure gate stays covered). Ships in 0.0.44 with #128.
🤖 Generated with Claude Code
Summary by cubic
Enables browser OAuth login during curl|sh installs by reading the prompt from /dev/tty. Previously the login offer never appeared because stdin was the script pipe or -y forced non-interactive; now humans are prompted, unattended runs stay non-interactive, and -y is a hard non-interactive request.
- Add
makePromptSource,openPromptInput, andcanPromptViaTtyinsetup.ts;LoginFlow.stdinTtynow usescanPromptViaTty. The stdout‑TTY check inshouldOfferLoginis unchanged, so agents/CI piping stdout never prompt. - Improve robustness:
makePromptSourceprovides single‑owner fd cleanup;defaultAskdeclines instead of hanging if the terminal disappears. - Update installers and docs:
agents.shandagents-staging.shstop forwarding-y;install.shhonors-yonly when explicitly provided and never drops it; the CLI decides promptability via/dev/tty. README staging curl example drops-y. Tests add a regression formakePromptSourceand clean up temp dirs. POSIX only; Windows unaffected.