Skip to content

fix(frontend): show the full shell command in the expanded tool card / 终端工具卡展开后显示完整指令 - #9860

Open
Linearl wants to merge 1 commit into
esengine:main-v2from
Linearl:fix/shell-card-command-display
Open

fix(frontend): show the full shell command in the expanded tool card / 终端工具卡展开后显示完整指令#9860
Linearl wants to merge 1 commit into
esengine:main-v2from
Linearl:fix/shell-card-command-display

Conversation

@Linearl

@Linearl Linearl commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Summary / 摘要

Long bash commands are truncated to a one-line ellipsis in the tool card header, and the expanded body renders only the command output — the full command is visible nowhere, so users cannot audit what the agent actually ran. Non-shell tools already render pretty(effectiveArgs) when expanded; the shell card's output branch simply never shows the command.

bash 工具卡片头部对长指令单行 ellipsis 截断,展开后的 body 只渲染命令输出——完整指令在任何状态下都不可见,用户无法确认 agent 实际执行了什么。非 shell 工具展开后有完整 args JSON,唯独 bash 卡缺命令展示。

Fixes #9858.

Changes / 改动

  • ToolCard.tsx: render a Command section at the top of the shell card body (before the output CodeViewer), fed by the same subjectOf command the header uses — long/multi-line commands render wrapped and selectable. / shell 卡 body 顶部(输出之前)新增 Command 小节(CodeViewer、bash 高亮),数据源与头部一致的完整 command,长/多行指令完整可选中。
  • locales: add tool.command (en "Command" / zh "命令" / zh-TW "命令"). / 三语言新增标签。
  • styles.css: .tool__command / .tool__command-label sections. / 新增小节样式。
  • check-bundle-budget.mjs: ratchet the initial budgets for the added section (458.2 → 458.3 gzip, 2454.8 → 2455.2 raw) per the in-file convention. / 按文件内棘轮约定上调两通道预算。

The collapsed header keeps its one-line ellipsis (glanceable row unchanged); the collapsed body stays hidden via useCollapseAnimation, so nothing new shows until the user expands. / 折叠态头部速览不变;折叠 body 仍由既有折叠动画隐藏,展开才显示新增小节。

Verification / 验证

  • pnpm build — full chain PASS (eslint / waapi / scroll-writer / css-syntax / z-index / theme-token / tsc --noEmit / vite build / bundle budgets 8 channels, e.g. 458.2/458.3 and 2455.1/2455.2).
  • npx tsx src/__tests__/tool-card-shell-execution.test.tsx38 passed, 0 failed, including the new command-section assertions: section rendered after expand, full command tail (LONG_COMMAND_TAIL_MARKER_DONE) visible, label rendered, header subject row retained.
  • npx tsx src/__tests__/tool-card-error-details.test.tsx — 5 passed, 0 failed.
  • git diff upstream/main-v2...HEAD --stat — only the 7 files above / 仅含上述文件。

Issues Fixes / 关联修复

Fixes #9858
Refs: #1496 (old TUI-era adjacent)

Guard / 影响面

Cache-impact: none- desktop UI-only change (ToolCard.tsx + locales + styles.css + bundle budgets); no prompt, tool schema, or provider request payload changed.
Cache-guard: none- not required. Changed files are outside the provider-visible cache construction; no cache key inputs altered.
Documentation-impact: none- no docs/*.md changed; user-facing behavior is the tool card rendering itself.
System-prompt-review: @SivanCola — no system-prompt bytes change (frontend rendering only); explicit maintainer review requested for the locale additions.

@Linearl
Linearl requested a review from SivanCola as a code owner September 6, 2026 12:52
Copilot AI lite review requested due to automatic review settings September 6, 2026 12:52
@Linearl
Linearl requested a review from esengine as a code owner September 6, 2026 12:52
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) labels Sep 6, 2026

Copilot AI 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.

🟡 Changes recommended

The new “Command” section uses the standard code block styling (white-space: pre) so long commands won’t wrap as described/required, reducing the usability of the fix for the reported issue.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds an expanded-body “Command” section for shell (bash) tool cards so users can review the full executed command (not just truncated header text and output), aligning shell cards with other tools’ expanded argument visibility and improving auditability.

Changes:

  • Render a “Command” block in ToolCard for shell cards, showing the full subjectOf("bash", args) command above the output viewer.
  • Add tool.command i18n strings (en/zh/zh-TW) and minimal styling for the new section.
  • Ratchet bundle budget thresholds to account for the added UI.
File summaries
File Description
desktop/frontend/src/components/ToolCard.tsx Adds expanded shell-card “Command” section rendered via subject.
desktop/frontend/src/styles.css Adds .tool__command and .tool__command-label styling for the new section.
desktop/frontend/src/locales/en.ts Adds tool.command label (“Command”).
desktop/frontend/src/locales/zh.ts Adds tool.command label (“命令”).
desktop/frontend/src/locales/zh-TW.ts Adds tool.command label (“命令”).
desktop/frontend/src/tests/tool-card-shell-execution.test.tsx Adds test coverage asserting the command section appears after expand and includes full command tail.
desktop/frontend/scripts/check-bundle-budget.mjs Updates initial bundle budgets to the next ratchet step.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +5054 to +5064
.tool__command {
display: flex;
flex-direction: column;
gap: 4px;
}

.tool__command-label {
color: var(--fg-faint);
font-size: var(--text-sm);
}

…sengine#9858)

Long bash commands are truncated to a one-line ellipsis in the tool card
header, and the expanded body renders only the command output — the full
command is visible nowhere, so users cannot audit what the agent actually
ran. Non-shell tools already render pretty(effectiveArgs) when expanded;
the shell card's output branch simply never shows the command.

- render a Command section (CodeViewer, bash-highlighted) at the top of
  the shell card body, fed by the same subjectOf command the header uses
- add tool.command labels (en/zh/zh-TW) and .tool__command styles
- ratchet the bundle budgets for the added section (458.3 gzip initial,
  2455.2 raw initial) per the in-file convention

Fixes esengine#9858
@Linearl
Linearl force-pushed the fix/shell-card-command-display branch from e40a568 to 38b49e0 Compare September 6, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Long shell commands truncated and invisible after expanding the tool card / 终端工具长指令被截断,展开后仍无法查看完整指令

2 participants