@@ -15,6 +15,7 @@ import { cn } from "@src/lib/utils"
1515import { Button } from "@src/components/ui"
1616import CodeBlock from "../common/CodeBlock"
1717import { CommandPatternSelector } from "./CommandPatternSelector"
18+ import { parseCommand } from "../../utils/command-validation"
1819import { extractPatternsFromCommand } from "../../utils/command-parser"
1920
2021interface CommandPattern {
@@ -53,8 +54,26 @@ export const CommandExecution = ({ executionId, text, icon, title }: CommandExec
5354
5455 // Extract command patterns from the actual command that was executed
5556 const commandPatterns = useMemo < CommandPattern [ ] > ( ( ) => {
56- const extractedPatterns = extractPatternsFromCommand ( command )
57- return extractedPatterns . map ( ( pattern ) => ( {
57+ // First get all individual commands (including subshell commands) using parseCommand
58+ const allCommands = parseCommand ( command )
59+
60+ // Then extract patterns from each command using the existing pattern extraction logic
61+ const allPatterns = new Set < string > ( )
62+
63+ // Add all individual commands first
64+ allCommands . forEach ( ( cmd ) => {
65+ if ( cmd . trim ( ) ) {
66+ allPatterns . add ( cmd . trim ( ) )
67+ }
68+ } )
69+
70+ // Then add extracted patterns for each command
71+ allCommands . forEach ( ( cmd ) => {
72+ const patterns = extractPatternsFromCommand ( cmd )
73+ patterns . forEach ( ( pattern ) => allPatterns . add ( pattern ) )
74+ } )
75+
76+ return Array . from ( allPatterns ) . map ( ( pattern ) => ( {
5877 pattern,
5978 } ) )
6079 } , [ command ] )
0 commit comments