feat(tui): lean detail + artifact into OpenTUI rich components (#192)#462
Merged
Conversation
Add onDetailSectionNext/onDetailSectionPrev to KeyboardActions and insert a detail-view guard before the generic within-panel j/k navigation block so that pressing j/k while the detail overlay is open moves the focused section instead of calling cursorDown/cursorUp.
Use React.createElement (member access) for <diff>/<scrollbox>/<markdown>/<code> intrinsics so a process-wide leaked mock.module(@opentui/react) that exports createElement:()=>null can no longer collapse the subtree to null under the full bun test run. Resolve useTimeline once at module load with a no-op chainable fallback for mocks that omit it. Flush the artifact diff test until the <diff> node settles. Remove the #192 probe.
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.
Closes #192.
Leans
detail.tsxandartifact-preview.tsxinto OpenTUI's richer components, per the issue's "audit and upgrade high-value surfaces" scope. Focused first cycle — these two surfaces only; other surfaces (terminal, dag, dashboard, lists) are out of scope and tracked as follow-ups.What changed
<scrollbox>with focus-aware sections:j/kmove a highlighted section (accent border +>marker), the scrollbox scrolls it into view, and all silent.slice()truncations were removed (full description / summaries / context are now reachable by scroll instead of being cut). Focus resets to the first section when you open a different contribution.<diff>intrinsic (syntax-aware) instead of an uncolored hand-rolled<text>blob.[d]toggles diff on/off,[s]toggles split ↔ inline (view: "split" | "unified"). Diff input is capped at 2000 lines (OOM guard, visible truncation marker).useAccentPulsehook. Degrades gracefully to a static accent where the timeline engine is unavailable.Acceptance criteria (#192)
>marker + pulse ✅<scrollbox>/<diff>/useTimeline✅OpenTUI API note
A probe (and adversarial verification) established the real
<diff>API isdiff(a unified-diff string) +view: "unified" | "split"+filetype— there is nomode/oldContent/newContent.computeUnifiedDiffis kept (its output is thediffstring) and now emits a valid@@ -1,m +1,n @@hunk header so the intrinsic'sparsePatchaccepts it. The design spec was updated to the as-shipped behavior.Verification
tsc --noEmit: 0 errors (run directly — note the repotypecheckscript&&-chains the ask-user sub-build, which can mask the maintscin a fresh worktree beforebun install).biome check: 0 errors.bun test: 8332 pass / 0 fail across 541 files.j/kwas dead in production — the resolved keymap dispatchedcursor_down/upbefore the detail handler; now gated insideexecuteKeymapActionand confirmed under the real default keymap.parsePatchrequires an@@header; verified fixed against three parsers including OpenTUI's own bundledparsePatch(allhunks=1, incl. adversarial content shapes).tscfailure (deadartifact_diff_modecase) and an incomplete test stub, both fixed.Remaining before merge
j/kthrough sections; open an artifact with a parent,dthens. Recommended as a human visual pass.Follow-ups (pre-existing, out of scope)
src/tui/components/split-diff.tsxpasses nonexistentoldContent/newContent/modeprops to<diff>→compare-view.tsxdiffs render empty/error. (Filing separately.)intervalMsis a dead prop on both views (documented "kept for caller-stability").