CLI prompt modules (convention)
For Inquirer scope, --json, CI, and utils debt, see the canonical page: Prompts & CLI boundaries.
Per-command prompts
Commands that need interactive flows specific to that command keep a local module:
- Example:
packages/cli/src/commands/generate/prompts.ts— language selection, meta prompts, banners only forgenerate.
Naming: commands/<command>/prompts.ts (or a prompts/ folder if the command grows many flows).
Shared prompts for key-affecting commands
Destructive or high-impact commands that confirm per key or per batch use core/ask/:
canAsk(gate.ts) — TTY / JSON / CI gating.promptApprovedRemovalKeys/groupKeysByTopSegment(removal.ts) — shared cleanup-style confirmations.
Shipped: cleanup --ask / --ask-per-key (see interactive key confirmation).
Conventions:
- Messages stay parameterized via
PromptRemovalKeysOptionsand future typed builders for other commands. - Global
--yesoverrides--ask. - No prompts when
--jsonis the contract for machine-readable stdout (see JSON output (--json)).
Precedence
Where both apply: global --yes wins over --ask — non-interactive automation must not block on per-key prompts.
See also
- JSON output (
--json) — when--jsonis set, stdout is the machine-readable contract (no interactive prompts). - ADR 006 — Command orchestrator boundary — commands orchestrate; core owns logic.
- Command orchestration boundary — file layout inside
commands/<name>/.