Skip to content

feat(terminal): add default command output collapse setting - #2042

Open
bigyao25 wants to merge 5 commits into
Zoo-Code-Org:mainfrom
bigyao25:feat/collapse-command-output-by-default
Open

bigyao25 wants to merge 5 commits into
Zoo-Code-Org:mainfrom
bigyao25:feat/collapse-command-output-by-default

Conversation

@bigyao25

@bigyao25 bigyao25 commented Oct 13, 2026 •

Copy link
Copy Markdown

Related GitHub Issue

Related to #605.

The author has posted Claiming on the issue. Maintainer assignment is pending.

Description

Verbose Inline Terminal output can fill the chat. Add an independent Collapse command output by default setting under Terminal.

  • Keep the setting off by default to preserve existing behavior.
  • When enabled, start command output collapsed in both terminal modes. Keep manual expand and collapse controls.
  • Respect the preference during shell integration fallback. Preserve output that the user has manually expanded.
  • Buffer edits until Save. Persist the value through ContextProxy and return it to the webview.
  • Add an optional boolean schema, shared default, and import/export support.
  • Add labels and descriptions for all 18 supported languages.

This supports Enhanced User Experience. Command execution, output collection, and the selected terminal backend stay unchanged.

This PR implements the independent preference requested in #605. It does not add a last-lines preview or a new exit-code summary.

Test Procedure

Passed locally:

  • Shared setting schema suite: 10 tests.
  • Extension persistence and webview state suites: 293 tests.
  • Command output and SettingsView suites: 80 tests.
  • Full workspace type checks through the push hook.
  • Full workspace lint through the commit hook, focused lint, formatting, and git diff --check.
  • Translation completeness check for all supported locales.
  • Four TerminalSettings visual comparisons in the repository-pinned Playwright Docker image.

Repeat the focused tests:

pnpm --dir packages/types exec vitest run src/__tests__/global-settings.test.ts
pnpm --dir src exec vitest run core/webview/__tests__/ClineProvider.spec.ts core/webview/__tests__/webviewMessageHandler.spec.ts
pnpm --dir webview-ui exec vitest run src/components/chat/__tests__/CommandExecution.collapse.spec.tsx src/components/chat/__tests__/CommandExecution.spec.tsx src/components/settings/__tests__/SettingsView.spec.tsx

Manual review:

  1. Keep Use Inline Terminal enabled.
  2. Enable Collapse command output by default and click Save.
  3. Run a command with verbose output. Verify the output starts collapsed and can be expanded manually.
  4. Reopen settings. Verify the saved preference remains enabled.
  5. Disable the preference and save. Verify a new inline command starts expanded.

Local tools: macOS, Node 24.21.0, pnpm 10.8.1. The repository requests Node 22.23.1.

Pre-Submission Checklist

  • Issue Linked: Maintainer approval and assignment are pending for [ENHANCEMENT] Collapsible command output #605.
  • Scope: One independent command output display preference.
  • Self-Review: Automated implementation review completed. Human review is pending.
  • Writing Style: Short sentences and plain words.
  • Testing: Focused regression tests cover the complete setting round trip.
  • Visual Snapshot: Gallery test and four container-generated theme baselines are included.
  • Documentation Impact: The setting description explains behavior and compatibility.
  • Contribution Guidelines: Read the repository contribution and agent guidance.

Visual Snapshots

TerminalSettings.visual.tsx covers the production settings screen in dark, light, high-contrast, and high-contrast-light themes.
The four baselines were generated and compared in the repository-pinned Playwright Docker image.
The temporary container path contains Corepack pnpm shims. Lockfile dependencies include Linux native packages for the container run.
No repository dependency files changed.

Documentation Updates

The setting contains translated help text. No separate documentation change is required for this PR.

Additional Notes

Codex helped implement and test this change. Human review and maintainer assignment are required before marking this draft ready.
The PR keeps existing users on the current display behavior until they enable the preference.

Keep terminal execution independent from output visibility. Preserve existing behavior until users enable the setting.

Refs Zoo-Code-Org#605
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: Zoo-Code-Org/Zoo-Code/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 0e4d6707-c041-4630-b972-d96821adf7eb
📥 Commits

Reviewing files that changed from the base of the PR and between b69989b and 46e328c.

⛔ Files ignored due to path filters: 4
  • webview-ui/src/components/settings/__tests__/__screenshots__/terminal-settings-dark.png is excluded by !**/*.png, !webview-ui/**/__screenshots__/**
  • webview-ui/src/components/settings/__tests__/__screenshots__/terminal-settings-high-contrast-light.png is excluded by !**/*.png, !webview-ui/**/__screenshots__/**
  • webview-ui/src/components/settings/__tests__/__screenshots__/terminal-settings-high-contrast.png is excluded by !**/*.png, !webview-ui/**/__screenshots__/**
  • webview-ui/src/components/settings/__tests__/__screenshots__/terminal-settings-light.png is excluded by !**/*.png, !webview-ui/**/__screenshots__/**
📒 Files selected for processing: 31
  • packages/types/src/__tests__/global-settings.test.ts
  • packages/types/src/global-settings.ts
  • packages/types/src/vscode-extension-host.ts
  • src/core/webview/ClineProvider.ts
  • src/core/webview/__tests__/ClineProvider.spec.ts
  • src/core/webview/__tests__/webviewMessageHandler.spec.ts
  • webview-ui/playwright/gallery/stories.tsx
  • webview-ui/src/components/chat/CommandExecution.tsx
  • webview-ui/src/components/chat/__tests__/CommandExecution.collapse.spec.tsx
  • webview-ui/src/components/settings/SettingsView.tsx
  • webview-ui/src/components/settings/TerminalSettings.tsx
  • webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx
  • webview-ui/src/components/settings/__tests__/TerminalSettings.visual.tsx
  • webview-ui/src/i18n/locales/ca/settings.json
  • webview-ui/src/i18n/locales/de/settings.json
  • webview-ui/src/i18n/locales/en/settings.json
  • webview-ui/src/i18n/locales/es/settings.json
  • webview-ui/src/i18n/locales/fr/settings.json
  • webview-ui/src/i18n/locales/hi/settings.json
  • webview-ui/src/i18n/locales/id/settings.json
  • webview-ui/src/i18n/locales/it/settings.json
  • webview-ui/src/i18n/locales/ja/settings.json
  • webview-ui/src/i18n/locales/ko/settings.json
  • webview-ui/src/i18n/locales/nl/settings.json
  • webview-ui/src/i18n/locales/pl/settings.json
  • webview-ui/src/i18n/locales/pt-BR/settings.json
  • webview-ui/src/i18n/locales/ru/settings.json
  • webview-ui/src/i18n/locales/tr/settings.json
  • webview-ui/src/i18n/locales/vi/settings.json
  • webview-ui/src/i18n/locales/zh-CN/settings.json
  • webview-ui/src/i18n/locales/zh-TW/settings.json

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📜 Recent review details
🧰 Additional context used
📚 Code guidelines: 2
AGENTS.md — auto-discovered
webview-ui/AGENTS.md — auto-discovered
📓 Path-based instructions: 10
For persisted settings, verify the complete schema/storage/runtime/webview round trip, shared default semantics, and focused true plus false/unset tests.

⚙️ CodeRabbit configuration file

Files:

  • packages/types/src/vscode-extension-host.ts
  • webview-ui/src/components/settings/__tests__/TerminalSettings.visual.tsx
  • webview-ui/src/components/settings/SettingsView.tsx
  • src/core/webview/__tests__/ClineProvider.spec.ts
  • src/core/webview/__tests__/webviewMessageHandler.spec.ts
  • packages/types/src/__tests__/global-settings.test.ts
  • webview-ui/src/components/settings/TerminalSettings.tsx
  • packages/types/src/global-settings.ts
  • webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx
  • src/core/webview/ClineProvider.ts
Require regression coverage at the lowest valid harness with behavior-focused assertions, including relevant negative, error, false/unset, and boundary cases.

⚙️ CodeRabbit configuration file

Files:

  • webview-ui/src/components/settings/__tests__/TerminalSettings.visual.tsx
  • src/core/webview/__tests__/ClineProvider.spec.ts
  • src/core/webview/__tests__/webviewMessageHandler.spec.ts
  • packages/types/src/__tests__/global-settings.test.ts
  • webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx
  • webview-ui/src/components/chat/__tests__/CommandExecution.collapse.spec.tsx
Check strict typing and exhaustive behavior across normal, boundary, error, cancellation, retry, and compatibility paths.

⚙️ CodeRabbit configuration file

Files:

  • packages/types/src/vscode-extension-host.ts
  • webview-ui/src/components/settings/__tests__/TerminalSettings.visual.tsx
  • webview-ui/src/components/settings/SettingsView.tsx
  • src/core/webview/__tests__/ClineProvider.spec.ts
  • webview-ui/playwright/gallery/stories.tsx
  • src/core/webview/__tests__/webviewMessageHandler.spec.ts
  • packages/types/src/__tests__/global-settings.test.ts
  • webview-ui/src/components/settings/TerminalSettings.tsx
  • packages/types/src/global-settings.ts
  • webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx
  • webview-ui/src/components/chat/CommandExecution.tsx
  • src/core/webview/ClineProvider.ts
  • webview-ui/src/components/chat/__tests__/CommandExecution.collapse.spec.tsx
Check React state and effect dependencies, cleanup, accessibility, i18n, and light/dark theme behavior.

⚙️ CodeRabbit configuration file

Files:

  • webview-ui/src/i18n/locales/hi/settings.json
  • webview-ui/src/i18n/locales/pt-BR/settings.json
  • webview-ui/src/components/settings/__tests__/TerminalSettings.visual.tsx
  • webview-ui/src/i18n/locales/ca/settings.json
  • webview-ui/src/i18n/locales/zh-CN/settings.json
  • webview-ui/src/components/settings/SettingsView.tsx
  • webview-ui/src/i18n/locales/nl/settings.json
  • webview-ui/src/i18n/locales/ja/settings.json
  • webview-ui/src/i18n/locales/zh-TW/settings.json
  • webview-ui/src/i18n/locales/id/settings.json
  • webview-ui/src/i18n/locales/it/settings.json
  • webview-ui/src/i18n/locales/fr/settings.json
  • webview-ui/src/i18n/locales/en/settings.json
  • webview-ui/playwright/gallery/stories.tsx
  • webview-ui/src/i18n/locales/ru/settings.json
  • webview-ui/src/i18n/locales/ko/settings.json
  • webview-ui/src/i18n/locales/es/settings.json
  • webview-ui/src/i18n/locales/vi/settings.json
  • webview-ui/src/i18n/locales/pl/settings.json
  • webview-ui/src/i18n/locales/de/settings.json
  • webview-ui/src/i18n/locales/tr/settings.json
  • webview-ui/src/components/settings/TerminalSettings.tsx
  • webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx
  • webview-ui/src/components/chat/CommandExecution.tsx
  • webview-ui/src/components/chat/__tests__/CommandExecution.collapse.spec.tsx
Verify extension/webview contracts, cancellation and error propagation, VS Code lifecycle correctness, and behavior under retries and partial failure.

⚙️ CodeRabbit configuration file

Files:

  • src/core/webview/__tests__/ClineProvider.spec.ts
  • src/core/webview/__tests__/webviewMessageHandler.spec.ts
  • src/core/webview/ClineProvider.ts
Act as an adversarial second-opinion reviewer.

⚙️ CodeRabbit configuration file

Files:

  • packages/types/src/vscode-extension-host.ts
  • webview-ui/src/i18n/locales/hi/settings.json
  • webview-ui/src/i18n/locales/pt-BR/settings.json
  • webview-ui/src/components/settings/__tests__/TerminalSettings.visual.tsx
  • webview-ui/src/i18n/locales/ca/settings.json
  • webview-ui/src/i18n/locales/zh-CN/settings.json
  • webview-ui/src/components/settings/SettingsView.tsx
  • src/core/webview/__tests__/ClineProvider.spec.ts
  • webview-ui/src/i18n/locales/nl/settings.json
  • webview-ui/src/i18n/locales/ja/settings.json
  • webview-ui/src/i18n/locales/zh-TW/settings.json
  • webview-ui/src/i18n/locales/id/settings.json
  • webview-ui/src/i18n/locales/it/settings.json
  • webview-ui/src/i18n/locales/fr/settings.json
  • webview-ui/src/i18n/locales/en/settings.json
  • webview-ui/playwright/gallery/stories.tsx
  • webview-ui/src/i18n/locales/ru/settings.json
  • webview-ui/src/i18n/locales/ko/settings.json
  • webview-ui/src/i18n/locales/es/settings.json
  • webview-ui/src/i18n/locales/vi/settings.json
  • src/core/webview/__tests__/webviewMessageHandler.spec.ts
  • webview-ui/src/i18n/locales/pl/settings.json
  • webview-ui/src/i18n/locales/de/settings.json
  • webview-ui/src/i18n/locales/tr/settings.json
  • packages/types/src/__tests__/global-settings.test.ts
  • webview-ui/src/components/settings/TerminalSettings.tsx
  • packages/types/src/global-settings.ts
  • webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx
  • webview-ui/src/components/chat/CommandExecution.tsx
  • src/core/webview/ClineProvider.ts
  • webview-ui/src/components/chat/__tests__/CommandExecution.collapse.spec.tsx
Source excerpt: [ ] If the webview uses the setting, include it in `ExtensionState` in `packages/types/src/vscode-extension-host.ts` and any relevant message types.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • packages/types/src/vscode-extension-host.ts
Source excerpt: Register browser-owned stories in `playwright/gallery/stories.tsx` under a stable, descriptive ID and mount them with `mount(storyId, props)`.

📄 CodeRabbit inference engine (webview-ui/AGENTS.md)

Files:

  • webview-ui/playwright/gallery/stories.tsx
Source excerpt: [ ] Define the setting, validation, and optionality in `packages/types/src/global-settings.ts` (or the appropriate provider/settings schema).

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • packages/types/src/global-settings.ts
Source excerpt: Keep behavioral assertions in Vitest.

📄 CodeRabbit inference engine (webview-ui/AGENTS.md)

Files:

  • webview-ui/src/components/settings/__tests__/TerminalSettings.visual.tsx
🪛 GitHub Check: mutation-diff
webview-ui/src/components/settings/TerminalSettings.tsx

[warning] 177-177: Mutation test advisory
webview-ui/src/components/settings/TerminalSettings.tsx:177: Survived StringLiteral mutant (replacement: ""). See the job summary for the complete list and resolution guidance.

[warning] 174-174: Mutation test advisory
webview-ui/src/components/settings/TerminalSettings.tsx:174: Survived StringLiteral mutant (replacement: ""). See the job summary for the complete list and resolution guidance.

[warning] 164-164: Mutation test advisory
webview-ui/src/components/settings/TerminalSettings.tsx:164: Survived StringLiteral mutant (replacement: ""). See the job summary for the complete list and resolution guidance.

packages/types/src/global-settings.ts

[warning] 53-53: Mutation test advisory
packages/types/src/global-settings.ts:53: Survived BooleanLiteral mutant (replacement: true). See the job summary for the complete list and resolution guidance.

webview-ui/src/components/chat/CommandExecution.tsx

[warning] 181-181: Mutation test advisory
webview-ui/src/components/chat/CommandExecution.tsx:181: Survived ArrayDeclaration mutant (replacement: []). See the job summary for the complete list and resolution guidance.

📝 Summary

Summary by CodeRabbit

  • New Features
    • Added a terminal setting to collapse command output by default. It applies to inline terminal output as well, and collapsed output can still be expanded manually. Commands run as before.
    • The setting is off by default and is available in multiple languages.

The change adds a boolean setting that controls whether command output starts collapsed. The setting is saved through terminal settings, included in webview state, and used to set command output’s initial and fallback expansion state. Localized setting text and tests are also added.

Changes: Command Output Preference

Layer / File(s) Summary
Setting contract and state propagation
packages/types/src/global-settings.ts, packages/types/src/__tests__/global-settings.test.ts, packages/types/src/vscode-extension-host.ts, src/core/webview/ClineProvider.ts, src/core/webview/__tests__/*
Adds the optional boolean setting with a default of false. Extension and webview state include the setting. Tests cover schema parsing, state projection, and persistence handling.
Terminal settings interface
webview-ui/src/components/settings/TerminalSettings.tsx, webview-ui/src/components/settings/SettingsView.tsx, webview-ui/src/components/settings/__tests__/*, webview-ui/playwright/gallery/stories.tsx, webview-ui/src/i18n/locales/*/settings.json
Adds a searchable checkbox and includes its value in the settings payload on Save. Tests cover buffering and saving the value. A gallery story and localized setting text are added.
Command output display behavior
webview-ui/src/components/chat/CommandExecution.tsx, webview-ui/src/components/chat/__tests__/CommandExecution.collapse.spec.tsx
Uses the preference to determine whether output starts expanded and whether fallback status expands it. Tests cover both shell integration modes, streaming and completed output, and manual expansion.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant TerminalSettings
  participant SettingsView
  participant webviewMessageHandler
  participant ClineProvider
  participant CommandExecution
  User->>TerminalSettings: Toggle collapse preference
  TerminalSettings->>SettingsView: Update cached setting
  User->>SettingsView: Save settings
  SettingsView->>webviewMessageHandler: Send updateSettings payload
  webviewMessageHandler->>webviewMessageHandler: Persist setting
  ClineProvider->>CommandExecution: Provide setting in webview state
  CommandExecution->>CommandExecution: Set output expansion state
Loading
Merge Risk: ⚪ Minimal · up to 46e32

The setting preserves existing behavior when off, and no actionable merge-blocking issue remains after normal checks.

Pre-merge checks: Passed 7 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description covers the implementation, behavior, tests, visual snapshots, documentation impact, and pending review status. However, the required approved issue link is incomplete: it uses “Related… Link the pull request to an approved GitHub issue using the required format, such as “Closes: #605”, and update the Issue Linked checklist item after approval and assignment are complete.
Passed Passed checks: 7 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Regression Evidence Passed Focused coverage is present for the changed behavior. Schema tests cover true, false, undefined, and non-boolean input. ClineProvider and updateSettings tests cover state defaults, persistence, and te…
Security Boundaries Passed No changed path meets the security failure conditions. The new setting is an optional boolean in globalSettingsSchema (packages/types/src/global-settings.ts:242) and is projected through state. `C…
Persistence Integrity Passed No changed persistence defect found. The settings save path sends collapseCommandOutputByDefault through the existing updateSettings loop, which awaits contextProxy.setValue before posting updat…
Lifecycle Resource Cleanup Passed The changed paths add only setting state propagation and collapse-state logic. CommandExecution still registers its existing message listener through useEvent; the PR only adds the preference to…
Title check Passed The title clearly identifies the main change: adding a terminal setting that collapses command output by default.
Full details: Regression Evidence

Explanation

Focused coverage is present for the changed behavior. Schema tests cover true, false, undefined, and non-boolean input. ClineProvider and updateSettings tests cover state defaults, persistence, and terminal-mode isolation. CommandExecution tests cover both terminal modes, all preference values, fallback, streaming, completed output, and manual expand/collapse. SettingsView tests cover buffered edits, Save, and live refresh behavior. The visible TerminalSettings change has a Playwright component snapshot for all four themes.

Full details: Security Boundaries

Explanation

No changed path meets the security failure conditions. The new setting is an optional boolean in globalSettingsSchema (packages/types/src/global-settings.ts:242) and is projected through state. CommandExecution only changes output visibility (webview-ui/src/components/chat/CommandExecution.tsx:61,163-169); command pattern allow/deny controls and terminal operations remain unchanged (:238-264). The settings handler persists the value but does not execute it or alter approval and allowlist enforcement (src/core/webview/webviewMessageHandler.ts:760-873). No changed code exposes secrets or PII.

Full details: Persistence Integrity

Explanation

No changed persistence defect found. The settings save path sends collapseCommandOutputByDefault through the existing updateSettings loop, which awaits contextProxy.setValue before posting updated state (src/core/webview/webviewMessageHandler.ts:760-873). ContextProxy.setValue awaits the existing global-state update path (src/core/config/ContextProxy.ts:538-542), and this PR does not change the existing bulk setValues implementation. The new optional schema key is included in global settings, and both ClineProvider webview-state projections apply DEFAULT_COLLAPSE_COMMAND_OUTPUT_BY_DEFAULT; CommandExecution consumes that propagated value.

Full details: Lifecycle Resource Cleanup

Explanation

The changed paths add only setting state propagation and collapse-state logic. CommandExecution still registers its existing message listener through useEvent; the PR only adds the preference to the callback dependency list, with no new listener, timer, watcher, task, or provider. No changed lifecycle path can leak a resource or duplicate work after disposal or restart.

Full details: Description check

Explanation

The description covers the implementation, behavior, tests, visual snapshots, documentation impact, and pending review status. However, the required approved issue link is incomplete: it uses “Related to #605” instead of the required closing link, and the checklist confirms maintainer approval and assignment are still pending.

Resolution

Link the pull request to an approved GitHub issue using the required format, such as “Closes: #605”, and update the Issue Linked checklist item after approval and assignment are complete.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Generate and compare all four VS Code theme snapshots in the pinned Playwright container.

Refs Zoo-Code-Org#605
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review status

Thanks for contributing. This comment tracks the review sequence and the next action.

Current step: Awaiting fresh human maintainer or CODEOWNER approval.

Automated review is complete for the latest commit but does not replace human approval.

Review-state labels are managed by this workflow; do not edit them manually. community-approved is managed the same way — do not add or remove it manually. It signals a fresh community code approval for the current head as an advisory priority only; maintainer review is still required.

@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot added the has-conflicts PR has merge conflicts with the base branch label Oct 18, 2026
@github-actions github-actions Bot removed the has-conflicts PR has merge conflicts with the base branch label Oct 18, 2026
@bigyao25
bigyao25 marked this pull request as ready for review October 18, 2026 14:49
@github-actions github-actions Bot added coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Oct 18, 2026
@github-actions github-actions Bot added awaiting-maintainer CodeRabbit approved; waiting for a human maintainer and removed coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Oct 18, 2026

This branch has not been deployed

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

Labels

awaiting-maintainer CodeRabbit approved; waiting for a human maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant