Skip to content

Polished terminal report - #7

Merged
kixelated merged 6 commits into
mainfrom
quest/m0/cli
Nov 7, 2026
Merged

kixelated merged 6 commits into
mainfrom
quest/m0/cli

Conversation

@kixelated

@kixelated kixelated commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

The CLI now puts actionable setting changes first, with current/suggested values, profile and owner, separate baselines, window/monthly estimates, and explicit evidence labels. A wrapping flow keeps complete names and money readable on narrow terminals. --details exposes all check evidence without an interactive UI; JSON uses the same analysis and retains schema version 1.

Interactive phase progress stays on stderr. Pipes, --plain, NO_COLOR, JSON, empty histories, empty windows, offline prices, failures and cancellation have deliberate output. SIGINT/SIGTERM abort local scanning and pricing with exit 2 and no success report. Metadata controls and direction overrides are escaped before terminal rendering. No settings or transcript content are edited or printed.

Design choices

  • Keep presentation in src/report.ts; reuse the landed analyzer without recomputing settings, coverage or savings. Order changes, advisories and keeps without a top-N cutoff or combined savings total.
  • Keep the default report concise; put complete assumptions, uncertainty, pricing components, sources, attempt sensitivities and cache witnesses in --details. JSON remains the complete automation interface.
  • Wrap plain text before styling, using string-width 8.3.0 for terminal cells and Intl.Segmenter for graphemes. Preserve Unicode spelling; redirected fields stay unwrapped and copyable. Color only reinforces text labels; Unicode decorations require a UTF-8 locale, and phase lines need no timers or cursor hiding.
  • Apply AbortSignal cooperatively during discovery, transcript scanning and price I/O; a repeated signal forces exit if I/O stalls. Yield once after synchronous analysis/rendering so queued cancellation can prevent the single success write.
  • Show every discovered root's selection in details/JSON and synthetic first-use examples in the README. No npm publication, packaging, version bump, new analyzer, T3 integration or SSH integration is included.
  • Complete and remove quest/m0/cli.md and its parent link. Merge landed kixelated/token-max#6, base e778e8a9bfe88be4d912fbaa8de792cb8f878eb6, and render both actual check variants. Compaction cards retain the TTL-conditional baseline, each candidate, extra summary/resumed-prefix costs and provenance, sensitivities and break-evens. No compaction calculations are duplicated.

Public API and wire impact

Adds --details and --plain. Human text changes from the minimal renderer to a wrapping report. --help documents profile selection, evidence, pricing, cancellation and exit codes. JSON schema version 1, output fields, decision logic and exit 0/1/2 remain unchanged. Discovery, scan and price options accept an optional AbortSignal. The internal renderer moves from src/cli.ts to src/report.ts.

Validation

  • Targeted synthetic tests pass under Bun, including the built JavaScript CLI, narrow/multiple-profile reports, guidance/unknowns, all evidence without cutoffs, terminal controls, plain/color/NO_COLOR/JSON, offline/empty/all-clear/failure output, and real SIGINT/SIGTERM while pricing is pending.
  • nix develop -c quest gate just check: passed formatting, TypeScript, JavaScript build, all 104 synthetic tests under Bun and Node 24, and quest validation. quest check --base origin/main and git diff --check passed. The independent exact-head review is recorded below.
  • Manually inspected the built CLI with an isolated synthetic profile and local synthetic prices. README dollars describe synthetic usage only. No full-host audit or old host savings are claimed.
  • Terminal conventions checked against the Command Line Interface Guidelines.

Caused by

  • kixelated/token-max#3 caught price-file I/O errors as JSON parse errors, so a missing offline cache misleadingly said the catalog was invalid. The built CLI regression case exposed it; parsing errors now remain separate from file/fetch errors. The remaining changes implement the CLI quest.

Models

Size: M
Implementer: Codex, gpt-6.1-sol, xhigh effort

Review

Rewritten by quest review after each round.

  • Reviewer: Claude Code, claude-opus-5-5, medium effort
  • Session: 4c0dea29-b208-48a4-982c-2f841f5124f4, round 2
  • Head: 46c6ddd
  • Base: origin/main at e778e8a
  • Score: 9/10, All five earlier findings are fixed at the head and the new code adds no problems, so it can land as is.
  • Findings: none
  • The last round's findings, at 08a80b6:
    • Fixed: medium, src/cli.ts:54: A second signal calls process.exit(2) and skips the cleanup that removes the price temp file; loadPrices now registers a synchronous `process.on("exit", discard)` that calls rmSync on its own UUID temp file (src/prices.ts:131-138), and removes that listener in the finally block (src/prices.ts:169-174), so the forced `process.exit(2)` at src/cli.ts:55 no longer leaves the partial file behind.
    • Fixed: low, src/cli.ts:184: Non-cancel diagnostics repeat 'no report produced' and 'use --help'; The generic 'No report produced. Use --help...' suffix is gone, and the non-JSON diagnostic is now a single specific line (src/cli.ts:191).
    • Fixed: low, src/cli.ts:21: Option descriptions in --help do not line up; Every option row's description now starts at column 26; for example, ` --details` is padded out to 26 like ` --since YYYY-MM-DD|ISO ` (src/cli.ts:18-27).
    • Fixed: low, src/terminal.ts:13: Wrapped help lines go back to the option-name column, not the description column; wrapText accepts a `continuation` column and uses it for every row after the first (src/terminal.ts:19-31); help passes each option row's label-plus-separator length as that column (src/cli.ts:85-90).
    • Fixed: low, src/report.ts:100: The earliest request time is found with a reduce over requests that are already sorted; The header now uses `requests[0]?.time ?? null` (src/report.ts:100), which relies on the sort in reader.ts.

(Written by GPT-6.1 Sol with xhigh)

kixelated and others added 2 commits November 7, 2026 10:35
Quest-Claim: 7e894e3f55a14754
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Design change: Layout now wraps plain text before styling, using string-width for terminal cells and Intl.Segmenter for grapheme boundaries. The earlier wrap-ansi dependency NFC-normalized file names. This smaller path preserves Unicode spelling, keeps redirected fields unwrapped and copyable, and shares indentation handling with help. The next review starts a new session for this layout change and receives responses to all eight findings from the prior session.

(Written by GPT-6.1 Sol with xhigh)

kixelated and others added 3 commits November 7, 2026 10:53
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Responses to the eight findings in session b65c3db7-8a3a-482d-b26c-f8542ca4b414, round 1. The layout now wraps plain text before styling with string-width and Intl.Segmenter; the Design change comment explains the new review session. The branch also merges main e778e8a and renders its actual TTL/compaction-window union, without changing the calculations.

  1. Fixed: wrapText preserves leading help indentation and repeats it on wrapped lines. Built CLI tests check both option/example indentation and the 40-column constraint.
  2. Fixed: a second SIGINT/SIGTERM exits 2 immediately. A real child-process regression test uses IPC to deliver the first signal during fetch, verifies that the mock I/O ignores abort, and sends a second signal; exit is 2 with no report. The first signal remains cooperative and aborts price I/O with a safe text/JSON diagnostic.
  3. Fixed: the CLI passes a wrap width only for TTY stdout. Redirected fields are unbounded. The built CLI test verifies an entire long Owner path remains on one line.
  4. Fixed: removed wrap-ansi. The wrapper uses original grapheme strings with string-width only for measurement, preserving NFD filenames. Narrow rendering tests include a decomposed e + combining accent, CJK and an emoji sequence, verify cell widths, and verify the original Unicode spelling survives.
  5. Fixed: terminalText also escapes U+200E, U+200F and U+061C. Synthetic hostile-metadata tests verify all three are absent as raw controls while JSON retains the original metadata.
  6. Fixed: Unicode decorations require UTF-8 in LC_ALL, LC_CTYPE or LANG with standard precedence. Built tests verify UTF-8 arrows and ASCII fallback with LC_ALL=C overriding UTF-8 LC_CTYPE.
  7. Fixed: removed the per-record abort check. Cooperative cancellation remains at the existing 64KB read boundaries and discovery boundaries.
  8. Fixed: removed the duplicate detail caveat. A synthetic unknown-fixed-cost report verifies exactly one caveat per applicable TTL result.

Validation: the full repository check gate covers the built command and both real analyzer result variants, including a priced compaction recommendation from a synthetic transcript, every candidate and geometry witness, guidance and unknowns, cancellation, errors, pipes, plain and JSON.

(Written by GPT-6.1 Sol with xhigh)

Co-Authored-By: GPT-6.1 Sol <noreply@openai.com>
@kixelated
kixelated marked this pull request as ready for review November 7, 2026 19:09
@kixelated
kixelated merged commit 1b8d74b into main Nov 7, 2026
2 of 3 checks passed
@kixelated
kixelated deleted the quest/m0/cli branch November 7, 2026 19:11
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