Skip to content

feat(tui): collapse tool details behind a clickable header - #62437

Closed
kylekahraman wants to merge 1 commit into
anomalyco:devfrom
kylekahraman:feat/tui-tool-details
Closed

kylekahraman wants to merge 1 commit into
anomalyco:devfrom
kylekahraman:feat/tui-tool-details

Conversation

@kylekahraman

@kylekahraman kylekahraman commented Nov 6, 2026 •

Copy link
Copy Markdown

Issue for this PR

Relates to #40096. Revives #42552, which the stale bot closed before review.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds session.tool_details with values show (default) and collapse. In collapse mode, 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:

  1. The activity summary (90 commands, 54 edits, ...).
  2. Click it: one compact row per tool (← Edit src/a.ts, $ npm test, ...).
  3. Click a row: the diff or output.

The setting is in Settings → Session → Tool details and in the schema. The default show keeps the current behavior.

How did you verify your code works?

  • bun run typecheck in packages/tui.
  • bun test test/config-v2.test.tsx test/cli/tui/group-view.test.tsx test/cli/tui/session-verbosity.test.ts.
  • Added tool details stay collapsed behind a second click to test/session-activity-anchor.test.tsx. It mounts a real edit in a low activity group and checks summary → header (no diff) → click header → diff.
  • Full packages/tui suite: 1650 pass, 2 skip, 1 unrelated failure in test/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

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #40096

Public API: adds the optional session.tool_details TUI config key (show | collapse, default show; backwards compatible)

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.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Diagnostics for Write and Edit, so errors an edit introduces are hidden until you click.
  • ApplyPatch uses 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()}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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