Skip to content

feat(tui): upgrade sequant ready to the boxed Ink TUI + harden TUI (#699) - #700

Merged
admarble merged 5 commits into
mainfrom
feature/699-feat-tui-upgrade-sequant-ready-to-the-boxed-ink-tu
Jun 2, 2026
Merged

admarble merged 5 commits into
mainfrom
feature/699-feat-tui-upgrade-sequant-ready-to-the-boxed-ink-tu

Conversation

@admarble

@admarble admarble commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements #699: upgrade sequant ready to the experimental boxed Ink TUI (Part A) and harden that TUI for large batches so it can eventually become the sequant run default (Part B).

  • Part A — On a TTY (non---json), sequant ready <issue> now renders the boxed Ink dashboard (single per-issue box, 10 Hz spinner + phase row). --json and non-TTY fall back to the static report exactly as feat(cli): sequant ready — wire live phase-matrix renderer (parity with sequant run) #697 established.
  • Part B — The Ink TUI gains the hardening the plain renderer already had: a row cap + frame-height clamp and a durable teardown summary.
  • Divider polish — In-box dividers drop the ├/┤ end-caps for a plain full-width gray rule.

⚠️ Stacked on #698 (read before merging)

#699's Part A reuses the onProgress hook added in PR #698 (feature/697-…), which is not on main yet. Per the #699 /spec, this branch is built on the spec-sanctioned option (b): #698's branch was merged into this one (clean, no conflicts) so the wiring is present. Commit d7acf18 is that merge.

Merge order: merge #698 first, then this PR. Once #698 lands on main, those commits dedupe and this PR's net diff is just the #699 work (the git diff --stat below).

What changed (net #699 diff)

Area Change
src/commands/ready-tui-adapter.ts (new) Single-issue snapshot adapter: bridges the gate's push-based onProgress to the TUI's pull-based getSnapshot(); models qa → loop → qa as the phase row with a coarse nowLine.
src/ui/tui/index.ts renderTui relaxed to a structural SnapshotProvider ({ getSnapshot(): RunSnapshot }); emits the durable teardown summary on unmount.
src/ui/tui/row-cap.ts (new) selectVisibleIssues / effectiveTuiRowCap — row cap + frame-height clamp, parity with run-renderer #624 (rolls older done into ✔ N done).
src/ui/tui/teardown.ts (new) composeTeardownSummary — per-issue ✔/✘ transcript.
src/ui/tui/App.tsx Consumes the row cap; renders the rollup line.
src/ui/tui/IssueBox.tsx Divider polish (no ├/┤ caps).
src/commands/ready.ts TTY → mount Ink TUI; non-TTY/--json → existing #697 path; teardown before report, on all exit paths.

Acceptance Criteria

AC Status Evidence
AC-1 — TTY renders the boxed TUI; --json/non-TTY → static report ✅ ready.ts useTui gate; ready.test.ts "#699 Ink TUI wiring"
AC-2 — Divider polish (no ├/┤ caps) ✅ IssueBox.tsx Divider; IssueBox.test.tsx asserts caps absent
AC-3 — Final report prints to clean scrollback after teardown ✅ ready.ts awaits tuiHandle.done before console.log(report); test "flips snapshot to done and prints report after teardown"
AC-4 — Row cap + frame-height clamp (parity with #624) ✅ row-cap.ts; row-cap.test.ts + App.test.tsx rollup render
AC-5 — Durable teardown summary (per-issue ✔/✘) ✅ teardown.ts emitted in index.ts; teardown.test.ts
AC-6 — Smoke-tested under tmux + ≤80-col terminal ⏳ Human-verified Manual (per spec); narrow-render covered by IssueBox/App tests at width 80

Test plan

  • npm run build — clean (tsc)
  • npm run lint — clean (0 warnings)
  • npx vitest run src/ui/tui/ src/commands/ready*.test.ts — 59 passed
  • Full suite — 3542 passed; 2 pre-existing env failures unrelated to this PR (relay-hook fails only because SEQUANT_RELAY=true leaks from the orchestrated session — passes when unset; prompt-wait is a relay-inbox timing race). Neither touches TUI/ready code.
  • Manual (AC-6): sequant ready <issue> under tmux and a ≤80-col terminal

Closes #699

admarble added 3 commits June 1, 2026 22:58
`sequant ready` previously printed a static header, ran the full-weight
qa → loop → qa gate in silence, then printed the final report — no live
feedback while a multi-minute gate ran. Reuse `run`'s shared RunRenderer
(#618) via `buildProgressWiring` so `ready` shows the same in-place phase
cells + spinner as `sequant run`.

- `--json`-safe: the renderer is only built on the non-JSON path, so piped
  JSON output is never corrupted.
- Dynamic phase streaming (no fixed seed): the gate's pipeline length is
  1–N qa/loop passes, so a seeded plan would leave a stuck-pending `loop`
  cell when the gate stops after the first qa.
- ready-gate emits optional `onProgress` (start/complete/failed) around each
  phase, carrying the 1-based QA-pass iteration so the renderer shows
  `loop N/M`. Optional — injected unit tests are unaffected.
- Clean teardown on every exit path (happy / error / before report print),
  plus a SIGINT handler mirroring run.ts.
- `--verbose` streaming pauses/resumes the live zone via the renderer as
  PhasePauseHandle instead of double-rendering.

Entire-Checkpoint: 4d40a837b383
#699's TTY path supersedes #698's plain-renderer wiring in ready.ts.
Bringing in the onProgress hook (RunReadyGateOptions.onProgress) that
ready.ts/ready-gate.ts need before swapping the plain RunRenderer for the Ink TUI.
…699)

Part A — `sequant ready` uses the boxed Ink TUI:
- New single-issue snapshot adapter (`ready-tui-adapter.ts`) bridges the gate's
  push-based `onProgress` (#697) to the TUI's pull-based `getSnapshot()` poll.
  Models the `qa → loop → qa` passes as the phase row with a coarse `nowLine`.
- `renderTui` relaxed to accept any `{ getSnapshot(): RunSnapshot }`
  (`SnapshotProvider`); `RunOrchestrator` already satisfies it.
- `ready.ts`: TTY ∧ !json → mount the Ink TUI; --json / non-TTY → existing
  #697 static path unchanged. TUI torn down before the report prints (clean
  scrollback) and on every exit path (success, gate error, SIGINT).

Part B — TUI hardening (parity for the eventual `run` default):
- Row cap + frame-height clamp (`selectVisibleIssues`, mirrors run-renderer
  #624): keep active rows, fill with most-recent done, roll older done into
  `✔ N done`; sized for ~11-line Ink boxes. Consumed by `App.tsx`.
- Durable teardown summary (per-issue `✔/✘`) emitted on unmount in `index.ts`
  so both `run` and `ready` leave a transcript in scrollback.

Divider polish: drop the `├`/`┤` end-caps for a plain full-width gray rule.

Tests: adapter transitions, row-cap (unit + App rollup render), teardown
summary, ready TTY-vs-non-TTY gating + teardown-before-report ordering.
AC-6 (tmux + ≤80-col smoke) is human-verified.

Entire-Checkpoint: 827a77665e79
admarble added 2 commits June 2, 2026 09:05
…upgrade-sequant-ready-to-the-boxed-ink-tu

# Conflicts:
#	CHANGELOG.md
#	src/commands/ready.test.ts
#	src/commands/ready.ts
@admarble
admarble merged commit 3c21bfa into main Jun 2, 2026
4 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.

feat(tui): upgrade sequant ready to the boxed Ink TUI + harden TUI for large batches

1 participant