Repository navigation
feat(tui): collapse tool details behind a clickable header - #62437
kylekahraman wants to merge 1 commit into
Conversation
Add session.tool_details with show and collapse. In collapse mode, write, edit, patch, and shell blocks render their header only; clicking the header reveals the detail and clicking again hides it. Combined with session.verbosity low, expanding an activity summary shows one compact row per tool instead of the full detail view.
There was a problem hiding this comment.
The setting works as described in the rendered-frame test: summary → compact header → click → diff. That test and the config, group-view and verbosity tests pass, and tsc -b is clean in packages/tui. I couldn't capture the live TUI from here. Could you add before/after screenshots or a short recording of a collapsed group, with a shell block and a multi-file patch?
Public API: adds the optional session.tool_details key ("show" default, "collapse") to the TUI config schema and settings dialog. This is backwards compatible: existing configs are unaffected.
There are two issues, noted inline:
- Collapsing also hides
Diagnosticsfor Write and Edit, so errors an edit introduces are hidden until you click. ApplyPatchuses one expanded state for all of its file blocks, so clicking one file expands every file in the patch.
Also, open #60741 changes the same Write/Edit/apply_patch rendering in a different way (a 10-row preview, no setting). The two will conflict, so maintainers may want to settle on one direction.
Related: #40096
| /> | ||
| </line_number> | ||
| <Diagnostics diagnostics={props.metadata.diagnostics} filePath={stringValue(props.input.path) ?? ""} /> | ||
| <Show when={!collapsed() || expanded()}> |
There was a problem hiding this comment.
<Diagnostics> is inside this Show (here and in Edit below), so with collapse any LSP errors the write or edit introduced are hidden behind the click too. Those are exactly what you'd want to see without expanding. Could the diagnostics stay outside the collapsed part, so only the code/diff is hidden?
| const theme = useTheme() | ||
| const { currentSyntax: syntax } = useThemes() | ||
| const pathFormatter = usePathFormatter() | ||
| const [expanded, setExpanded] = createSignal(false) |
There was a problem hiding this comment.
This single expanded signal is shared by every BlockTool the <For> renders for the patch's files. Clicking one file's header expands (or collapses) all of them, which goes against the "click a row: the diff" model in the description. Keeping the expanded state per file (e.g. a small component per file block, or a set keyed by path) would fix it.
Issue for this PR
Relates to #40096. Revives #42552, which the stale bot closed before review.
Type of change
What does this PR do?
Adds
session.tool_detailswith valuesshow(default) andcollapse. Incollapsemode, write, edit, patch, and shell blocks render their header only. Clicking the header reveals the detail; clicking again hides it.With
session.verbosity: "low", this gives three levels:90 commands, 54 edits, ...).← Edit src/a.ts,$ npm test, ...).The setting is in Settings → Session → Tool details and in the schema. The default
showkeeps the current behavior.How did you verify your code works?
bun run typecheckinpackages/tui.bun test test/config-v2.test.tsx test/cli/tui/group-view.test.tsx test/cli/tui/session-verbosity.test.ts.tool details stay collapsed behind a second clicktotest/session-activity-anchor.test.tsx. It mounts a real edit in a low activity group and checks summary → header (no diff) → click header → diff.packages/tuisuite: 1650 pass, 2 skip, 1 unrelated failure intest/component/go-upsell-art.test.tsx(animation frame timing; these files are not touched).Screenshots / recordings
I could not capture a clean TUI frame from this environment. The new test asserts the rendered frames.
Checklist
Added by the opencode bot (AI-generated).
Related: #40096
Public API: adds the optional
session.tool_detailsTUI config key (show|collapse, defaultshow; backwards compatible)