Skip to content

feat(#705): fix -q/-Q flag collision, make boxed Ink TUI the default for run - #706

Merged
admarble merged 2 commits into
mainfrom
feature/705-cli-ux-fix-q-q-flag-collision-make-boxed-ink-tui-t
Jun 3, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/705-cli-ux-fix-q-q-flag-collision-make-boxed-ink-tui-t

Conversation

@admarble

@admarble admarble commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Frees -q from quiet. --quiet moves to -s (mnemonic: silent). -q is now a hidden alias for -Q, --quality-loop, ORed into qualityLoop at the top of runCommand — both -q and -Q enable the quality loop; neither enables quiet. Ends the footgun where run … -q silently enabled quiet mode instead of the quality loop.
  • Boxed Ink TUI is the default for run on a TTY: tuiEnabled = options.tui !== false && isTTY && !quiet. --no-tui opts out to the line phase-matrix renderer; non-TTY / piped output auto-degrades; --quiet/-s suppresses the renderer entirely (heartbeat-only).
  • --experimental-tui kept as a hidden no-op alias for backward compatibility.
  • ready parity (AC-6): both run and ready mount the identical renderTui(provider) (same App, same full box) — confirmed structurally identical, no gap to close.

Flag resolution extracted to src/commands/run-flags.ts (normalizeQualityLoop, resolveTuiEnabled) as pure functions, making the flag behavior directly unit-testable and keeping run.ts under its 200-LOC cap (matches the existing run-progress.ts extraction pattern).

Pre-PR AC Verification

AC Description Status Evidence
AC-1 -q and -Q both enable the quality loop; neither enables quiet ✅ run-flags.ts normalizeQualityLoop + unit tests; bin/cli.ts hidden -q alias; CLI parse tests in cli.integration.test.ts
AC-2 --quiet reachable via -s; suppresses the renderer ✅ bin/cli.ts:-s, --quiet; resolveTuiEnabled !quiet term + unit test; help-surface test
AC-3 sequant run shows boxed Ink TUI by default on a TTY ✅ resolveTuiEnabled({}, true) === true unit test; run.ts wiring
AC-4 --no-tui opts out; non-TTY auto-degrades ✅ --no-tui registered; resolveTuiEnabled unit tests (tui:false, non-TTY)
AC-5 --experimental-tui still parses (hidden no-op) ✅ addOption(new Option("--experimental-tui").hideHelp()); parse + hidden-from-help tests in run-tui.integration.test.ts
AC-6 ready renders the same full boxed TUI as run ✅ Both mount renderTui from ui/tui/index.ts (run.ts:140, ready.ts:182) — structurally identical; confirmed, no code change needed
AC-7 Help text + docs/README updated ✅ README, run-command.md, quiet-mode-heartbeat.md, run-renderer.md, experimental-tui-dashboard.md, CHANGELOG

Test plan

  • npm run build — passes
  • npm run lint — passes (0 warnings)
  • npx vitest run on all affected files (run-flags, cli.integration, run-tui.integration, run-progress, ready, heartbeat) — 69 passed
  • Manual: run --help shows -Q, -s, --quiet, --no-tui; hides -q alias + --experimental-tui
  • Manual: -q, -Q, -s, --no-tui, --experimental-tui all parse without "unknown option"

Known unrelated failure

src/commands/__tests__/prompt-wait.test.ts has one pre-existing flaky failure (a timer/filesystem race reading the relay inbox.jsonl). It fails identically on the clean base and touches the sequant prompt --wait relay system — none of which this PR modifies.

Closes #705

…for run

CLI UX fixes for the run command:

- Free `-q` from quiet: `--quiet` moves to `-s` (mnemonic: silent). `-q`
  becomes a hidden alias for `-Q, --quality-loop` (Commander 14 allows one
  short per Option), ORed into qualityLoop at the top of runCommand. Both
  `-q` and `-Q` enable the quality loop; neither enables quiet.
- Boxed Ink TUI is now the default on a TTY: tuiEnabled = options.tui !==
  false && isTTY && !quiet. `--no-tui` opts out to the line phase-matrix
  renderer; non-TTY auto-degrades. `--quiet`/`-s` suppresses the renderer
  entirely (heartbeat-only).
- `--experimental-tui` retained as a hidden no-op alias for backward compat.
- ready parity (AC-6): both run and ready mount the identical renderTui
  provider — confirmed structurally identical, no gap to close.

Flag resolvers extracted to run-flags.ts (normalizeQualityLoop,
resolveTuiEnabled) as pure functions for unit testing and to keep run.ts
under the 200-LOC cap. Reversed the #658 -q-binds-to-quiet test.

Docs: README TUI-default framing + opt-out; quiet-mode-heartbeat.md
(-q->-s, gating prose), run-command.md flag table, run-renderer.md and
experimental-tui-dashboard.md (default/opt-in framing inverted, corrected
the now-wrong --quiet+TUI interaction claim). CHANGELOG entry added.

Closes #705

Entire-Checkpoint: 04f8bb49d4f7
The #705 changes pushed run.ts to 201 lines (split-count), tripping the
run-orchestrator integration test that enforces the <=200 thin-adapter cap.
Condensed two #705 comment blocks; logic unchanged. Now 199.

Entire-Checkpoint: b6b1beb667b7
@admarble
admarble merged commit 8c565c5 into main Jun 3, 2026
4 checks passed
@admarble
admarble deleted the feature/705-cli-ux-fix-q-q-flag-collision-make-boxed-ink-tui-t branch June 3, 2026 05:36
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.

CLI UX: fix -q/-Q flag collision, make boxed Ink TUI the default for run (and confirm ready parity)

1 participant