Repository navigation
Backlog
Backlog
Copy link
Labels
Milestone
Description
Goal
In the chat action card, a command that chains several independent commands is shown one command per line, with a toggle back to the original single line, so the user can review AI-proposed commands (from the chat and from MCP clients) at a glance.
Context
apps/smart-ssh-community/frontend/src/components/chat/ActionCard.tsxrenders the command as one<code>block ($prefix,whitespace-pre-wrap, strike-through when rejected/expired/blocked), fromdescribeAction(components/chat/chatItem.ts).- The blocking issue adds the IPC command
command_display_layout(command)→nullor lines{ text, operator }(see the epic's shared decisions). ActionCardalso hosts the command editor for "edit then approve" (initialCommand), which keeps the raw text.- No spec describes the action card's command block yet (related: 0026/0029 risk badges, 0027 cancel, 0028 MCP).
Requirements
- For every action card with a shell command (pending, auto-executed, executed, rejected, expired, blocked; chat and MCP sessions), call
command_display_layoutonce per command (cache by command text) and, when it returns lines, render them one per line: each line its text followed by its operator (;,&&,||,&) at the end; the$prompt only before the first line; long lines still wrap. - Toggle (decided by maintainer) next to the command, icon button with an accessible name ("Show original" / "Show formatted") and
aria-pressed; default: formatted. The choice is global and remembered across cards and app restarts (frontend preference, same mechanism as other remembered UI choices). The toggle is shown only when the layout has more than one line. - Pipes are never broken (comes from the core layout).
- When the layout is
nullor the IPC call fails, the card shows the original single line exactly as today, without a toggle. - Strike-through and colour states apply to all lines.
- Selecting and copying the command text yields the original command (e.g. a copy handler or a hidden original), never the reformatted text.
- The "edit then approve" editor keeps the original raw text.
- Labels in all app locales.
Acceptance Criteria
-
echo a; echo b && rm -f xshows three lines with;and&&at the line ends;cat f | grep x; lsshows two lines with the pipeline intact. - The toggle switches to the original single line and back; the choice persists for other cards and after reload.
- No toggle for a single command or for a command the layout returns
nullfor (e.g. a here-doc); such commands render exactly as before. - Copying from a formatted card puts the original command on the clipboard.
- Rejected/expired cards show the strike-through on every line.
- Works for MCP-originated action cards as well as chat ones.
- Unit tests in a new test file for the command block component; a Playwright e2e test for the formatted view and the toggle; axe checks pass.
- New spec describing the command display in the action card.
- Relevant automated tests pass.
Technical Notes
- Put the rendering in its own component (e.g.
components/chat/CommandBlock.tsx+CommandBlock.test.tsx) and use it fromActionCard.tsx. - Display-only: what is confirmed and executed is unchanged; the IPC result is never sent back to the backend.
Files: apps/smart-ssh-community/frontend/src/components/chat/ (new CommandBlock component and test, ActionCard.tsx), apps/smart-ssh-community/frontend/src/api/api.ts, apps/smart-ssh-community/frontend/src/locales/, apps/smart-ssh-community/frontend/e2e/tests/, docs/specs/ (new spec)
Spec impact: new
Open questions
- None.
Related Work
- Part of the epic (linked as parent); blocked by the core display-layout issue.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
P2 - Normal
Activity