Skip to content

feat(tui): add session.tool_details option to collapse write/edit/patch content - #42552

Closed
kahlos wants to merge 1 commit into
anomalyco:v2from
kahlos:feat/tui-tool-details-collapse
Closed

kahlos wants to merge 1 commit into
anomalyco:v2from
kahlos:feat/tui-tool-details-collapse

Conversation

@kahlos

@kahlos kahlos commented Aug 14, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #19074

Type of change

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

What does this PR do?

Adds a session.tool_details TUI setting (default "show") with a second value, "collapse". When collapsed, the write, edit, and patch tool blocks render as their existing clickable headers only — the file content and diff hunks stay out of the transcript until you click the header to expand them. Clicking again collapses. This mirrors the session.thinking setting and reuses the click-to-toggle pattern Shell and GenericTool already use, so there is no new UI surface, just a config field, a /settings entry, and Show-wrapped content in the three renderers.

How did you verify your code works?

  • bun run typecheck in packages/tui passes
  • bun test in packages/tui passes: 698 pass, 0 fail
  • Added a regression test in test/config-v2.test.tsx covering schema validation of the new field and its settings default

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

None attached yet — I couldn't capture a clean TUI frame from this environment. The behavior is identical to the existing collapsed Shell/GenericTool blocks (header + click to expand); happy to add a recording if helpful.

Checklist

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

…ch content

Adds a session.tool_details setting (default "show") that collapses the
write, edit, and patch tool blocks to a clickable header by default, hiding
the file content and diffs from the transcript. Clicking the header expands
or collapses the content again.

- Config: new session.tool_details field ("show" | "collapse") in the V2
  TUI config schema
- Settings: new "Tool details" entry in the /settings dialog
- Rendering: Write, Edit, and ApplyPatch wrap their content in a Show block
  and toggle expansion through BlockTool's onClick, matching the existing
  Shell and GenericTool collapse pattern
- Tests: schema validation and settings default coverage
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Aug 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@Enough1122

Copy link
Copy Markdown

AI code review — automated review for reference; please use your judgment.

Scope: new TUI setting session.tool_details (show | collapse): when collapsed, write/edit/patch tool blocks render only their header; clicking toggles per-item expansion. Default show preserves current behavior.

  • Clean plumbing: schema literal + settings-dialog entry + context memo follow the existing thinking/markdown patterns exactly, and the config test was updated to match.
  • UX detail worth a look: when collapsed, the <Show> also hides Diagnostics for the tool — probably desirable (header-only really means header-only), but users who rely on inline diagnostics will need to expand each block; consider surfacing a diagnostics count on the header later.
  • Per-item expanded signals start at false and aren't persisted. If the transcript virtualizes/remounts rows on scroll (common in OpenTUI lists), expanded blocks may snap back to collapsed mid-session. Worth verifying scroll behavior; if it remounts, hoisting expansion state into the part-keyed store would fix it.
  • The click-to-toggle only binds when collapsed() is true, so in default show mode headers behave exactly as before — good backward compatibility.
  • Nit: Edit reads ctx from an earlier use() while Write adds its own const ctx = use() in this diff — consistent enough, just keep an eye on the growing prop-drilling via context as more display modes land.

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants