iPad: render multi-step / destructive shell pipelines as a step list
The desktop CommandStepsCard breaks a shell pipeline (a rm/git chain) into a step list with the destructive delete flagged, instead of a raw blob. Rather than duplicate a parser, deliver that value by reusing the existing, tested HostCommandSummary + HostCommandBreakdown (a general command parser whose Invocation already carries a `destructive` flag for rm/rmdir) on the two paths that still showed raw text: - ToolCallCard.details: a shell tool whose command has >1 invocation or is destructive now renders the compact step breakdown (deletes glyphed/tinted in red) with the literal command under "Show command"; simple one-liners keep the plain input block. - ApprovalCardView: the parsed breakdown (with its sudo/deletes risk banner) now covers any Bash pipeline / destructive approval, not just host_exec. Demo transcript gains a destructive cleanup pipeline (rm -rf && git worktree prune && git branch -D) so the step list is exercisable offline. Verified in the iPad simulator: the pipeline expands to a step list with `rm -rf` flagged in red. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
@@ -49,10 +49,16 @@ struct ToolCallCard: View {
|
||||
|
||||
@ViewBuilder private var details: some View {
|
||||
let input = group.input.approvalDetail
|
||||
// A git commit reads as a structured commit card (subject + Markdown body), like the Mac —
|
||||
// the raw command stays one tap away under "Show command".
|
||||
// A git commit reads as a structured commit card (subject + Markdown body); a multi-step or
|
||||
// destructive shell pipeline reads as a compact step list (deletes flagged in red) — both
|
||||
// like the Mac, with the literal command one tap away under "Show command". Everything else
|
||||
// keeps the plain input block.
|
||||
if isShellTool, let commit = GitCommitSummary.parse(input) {
|
||||
GitCommitCard(commit: commit, rawCommand: input)
|
||||
} else if isShellTool, let summary = HostCommandSummary.summary(for: input),
|
||||
summary.invocations.count > 1 || summary.isDestructive {
|
||||
HostCommandBreakdown(summary: summary, showPurpose: false)
|
||||
CommandDisclosure(command: input, accent: Palette.accent)
|
||||
} else if !input.isEmpty {
|
||||
ToolBlock(label: "Input", text: input, mono: true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user