Skip to content

fix(cli): never prompt in webcmd setup when stdin is not a TTY - #369

Merged
ankitranjan7 merged 1 commit into
mainfrom
fix/setup-non-tty
Aug 19, 2026
Merged

fix(cli): never prompt in webcmd setup when stdin is not a TTY#369
ankitranjan7 merged 1 commit into
mainfrom
fix/setup-non-tty

Conversation

@ankitranjan7

Copy link
Copy Markdown
Contributor

webcmd setup with stdin detached printed Use hosted Webcmd Cloud or local Webcmd? and then crashed with exit 13 (unsettled top-level await). Agents cannot answer a prompt.

After

$ webcmd setup < /dev/null
# stderr, exit 2
ok: false
error:
  code: ARGUMENT
  message: setup requires --mode when stdin is not a TTY.
  help: |
    usage: webcmd setup --mode <local|hosted> [--api-key <key>]
    example: webcmd setup --mode local
$ webcmd setup --mode local
Webcmd is now configured for local mode.
$ webcmd setup --mode hosted --api-key <key>
Webcmd is now configured for hosted mode.

TTY without flags still prompts. Flags skip prompts on a TTY too. Readline is not created unless a prompt is actually needed.

Hosted impact

Hosted impact: A — no hosted impact
Trigger: none
Why: local mode-boundary command (`src/hosted/setup.ts`, `src/main.ts`). Cloud does not consume setup; it is not a /v1 route or package export.
Sequencing: none

Verification

  • npx tsc --noEmit — clean
  • npx vitest run --project unit src/hosted/setup.test.ts — 10 passed, including a stdin-detached hang test (8s bound)

Non-interactive setup now requires --mode, and hosted mode also requires
--api-key. Detached stdin exits 2 instead of printing a prompt and hanging.
@github-actions

Copy link
Copy Markdown
Contributor

🟠 Maintainer review suggested — low confidence

The automated review could not reach a fully supported conclusion.

This review is advisory and does not block merging.

@ankitranjan7
ankitranjan7 merged commit 51eb2d1 into main Aug 19, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant