feat(attribution): interactive why viewer + tag legend#1614
Merged
Conversation
Adds an opt-in TUI for 'entire why <file>' and the readability fixes insiders asked for, built under the Agent-Safe CLI Fallbacks rules: - --tui opens a master-detail Bubble Tea viewer over the already-resolved attribution (no git/network I/O inside the TUI): file lines with [AI]/[MX]/[HU] tags on the left; the selected line's full explanation on the right (authorship sentence, commit, agent/model, session with an OSC 8 entire.io hyperlink when origin resolves, checkpoint, prompt with the session-level caveat, intent, metadata-missing reason, candidates, explain hint). n/p jump to the next/previous agent-attributed line; enter expands the full prompt; why <file>:12 --tui opens positioned at line 12. - Agent-safe: the TUI is opt-in AND TTY-gated (IsTerminalWriter) and skipped in accessible mode; non-TTY --tui falls through to the identical plain output, and --json always wins — both pinned by tests against a non-TTY writer. Nothing is TUI-only. - Tag legend on blame, the why file view, and the TUI footer: [AI] all agent, [MX] agent+human mixed, [HU] no agent, [??] uncommitted — kept within the blame table's 80-column budget; full sentences in the detail views. Model-level TUI tests cover rendering, navigation, agent-line jumps, expand, missing-metadata handling, quit keys, empty files, and tiny windows. Paging is bound to pgup/pgdn because the shared keymap claims n/p.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in, TTY-only interactive (Bubble Tea) viewer for entire why <file> while keeping agent-safe fallbacks: non-TTY and/or --json continue to use deterministic plain/JSON output with no information gated behind the TUI.
Changes:
- Add
--tuiflag toentire whywith strict TTY + non-accessible gating, and--jsonprecedence. - Introduce a new Bubble Tea master/detail TUI for browsing per-line attribution + details (including optional entire.io session links).
- Add model-level TUI tests plus agent-safe fallback tests to pin non-TTY behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/entire/cli/attribution.go | Adds --tui flag, TTY/accessibility gating, and tag legend rendering + repo name derivation for links. |
| cmd/entire/cli/attribution_tui.go | New Bubble Tea TUI implementation for interactive browsing of why output. |
| cmd/entire/cli/attribution_tui_test.go | Adds TUI model tests and non-TTY fallback/--json precedence tests. |
Comment on lines
+178
to
+195
| // Paging is bound to pgup/pgdown explicitly: the shared keymap's | ||
| // NextPage/PrevPage claim n/p, which this viewer uses for the more useful | ||
| // next/previous agent-attributed line jumps. | ||
| case msg.String() == "pgup": | ||
| return m.moveCursor(m.cursor - m.bodyHeight()), nil | ||
| case msg.String() == "pgdown": | ||
| return m.moveCursor(m.cursor + m.bodyHeight()), nil | ||
| case key.Matches(msg, keys.Home): | ||
| return m.moveCursor(0), nil | ||
| case key.Matches(msg, keys.End): | ||
| return m.moveCursor(len(m.result.Lines) - 1), nil | ||
| case key.Matches(msg, keys.Confirm): | ||
| m.expanded = !m.expanded | ||
| return m.refreshDetail(), nil | ||
| case msg.String() == "n": | ||
| return m.jumpAgentLine(1), nil | ||
| case msg.String() == "p", msg.String() == "N": | ||
| return m.jumpAgentLine(-1), nil |
The [AI]/[MX]/[HU] tags are a per-commit inference, not a per-line truth: [AI] means the commit's checkpointed work was fully agent-authored, [MX] means the commit mixed agent and human edits (any given line may be either), [HU] means no agent checkpoint. The legend now says so explicitly — 'per commit: [AI] all agent · [MX] mixed — line may be either · [HU] no agent' — instead of reading like per-line labels. [??] moved to the conditional marker legend line (shown only when uncommitted lines exist), keeping the main legend inside the blame table's 80-column budget.
Contributor
Author
|
Folded into #1613 — one PR now carries the determinism fix, the TUI, and the legend. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://entire.io/gh/entireio/cli/trails/738
Base:
fix-why-metadata-consistency(stacked on the #1551 fix — review that first).What
An interactive viewer for
entire why <file>plus the readability fixes insiders asked for — built strictly under the new Agent-Safe CLI Fallbacks rules (#1596).entire why <file> --tuiMaster-detail Bubble Tea viewer over the already-resolved attribution (no git/network I/O inside the TUI):
[AI]/[MX]/[HU]/[??]tags and~/?markers, windowed scrolling for large files.Session promptcaveat), intent, metadata-missing reason, candidate checkpoints, and thecheckpoint explainhint (suppressed when metadata is missing, matching the text view).n/pnext/previous agent-attributed line (jump straight to the interesting lines), enter expands the full prompt/candidates, pgup/pgdn, g/G, q.why <file>:12 --tuiopens positioned at line 12.Agent-safe by construction
--tui) and TTY-gated (interactive.IsTerminalWriter) and skipped in accessible mode — the exactexperts --tuipattern the guidelines cite as good.--tuifalls through to the same deterministic plain output;--jsonalways wins over--tuiso scripted callers never block. Both pinned by tests against a non-TTY writer.Insider-feedback fixes (text output)
blame, why file view, TUI footer):[AI] all agent · [MX] agent+human mixed · [HU] no agent · [??] uncommitted— wording per soph's correction (AI = 100% agent-authored checkpoint work; MX = agent + human edits; careful not to overclaim). Full sentences in the TUI detail pane.Testing
Update/View, color off): render + summary, navigation → prompt detail, start-line positioning,n/pagent-line jumps (including exhaustion + status message), expand toggle, missing-metadata reason + suppressed explain hint, quit keys, empty file, tiny window.--tuion a non-TTY writer produces the plain file summary;--tui --jsonproduces JSON.n/pfor paging — the viewer rebinds paging to pgup/pgdn son/pcan do agent-line jumps (commented).mise run lint0 issues; fullcmd/entire/clisuite green;mise run test:cigreen.Notes
entire whystays hidden/labs. The TUI addresses the insiders' "why is hard to read" feedback and pfleidi's browse-the-file/summit-linking ideas without touching the default output contract.