Skip to content

Commit 6e7f850

Browse files
committed
feat(chat): Split commands by additonal operators
1 parent b2daa78 commit 6e7f850

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/core/src/codewhispererChat/tools/executeBash.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export enum CommandCategory {
1616
Destructive,
1717
}
1818

19-
export const dangerousPatterns = new Set(['<(', '$(', '`', '>', '&&', '||'])
19+
export const dangerousPatterns = new Set(['<(', '$(', '`'])
20+
export const splitOperators = new Set(['|', '&&', '||', '>'])
2021
export const commandCategories = new Map<string, CommandCategory>([
2122
// ReadOnly commands
2223
['ls', CommandCategory.ReadOnly],
@@ -163,12 +164,12 @@ export class ExecuteBash {
163164
return { requiresAcceptance: true }
164165
}
165166

166-
// Split commands by pipe and process each segment
167+
// Split commands by operators and process each segment
167168
let currentCmd: string[] = []
168169
const allCommands: string[][] = []
169170

170171
for (const arg of args) {
171-
if (arg === '|') {
172+
if (splitOperators.has(arg)) {
172173
if (currentCmd.length > 0) {
173174
allCommands.push(currentCmd)
174175
}

0 commit comments

Comments
 (0)