You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: use && for cmd.exe to preserve conditional execution semantics
- Update getCommandChainOperator() to return && for cmd.exe (already done)
- Update getCommandChainNote() to document && instead of & for cmd.exe
- Update JSDoc to reflect cmd.exe uses && for conditional execution
- Update tests to expect && for cmd.exe
cmd.exe supports && for conditional execution (run next command only if
previous succeeds), which provides the same semantics as Unix shells.
Copy file name to clipboardExpand all lines: src/core/prompts/sections/rules.ts
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ import { getShell } from "../../../utils/shell"
7
7
* Returns the appropriate command chaining operator based on the user's shell.
8
8
* - Unix shells (bash, zsh, etc.): `&&` (run next command only if previous succeeds)
9
9
* - PowerShell: `;` (semicolon for command separation)
10
-
* - cmd.exe: `&` (single ampersand for command chaining)
10
+
* - cmd.exe: `&&` (conditional execution, same as Unix)
11
11
* @internal Exported for testing purposes
12
12
*/
13
13
exportfunctiongetCommandChainOperator(): string{
@@ -20,7 +20,7 @@ export function getCommandChainOperator(): string {
20
20
21
21
// Check for cmd.exe
22
22
if(shell.includes("cmd.exe")){
23
-
return"&&"
23
+
return"&&"
24
24
}
25
25
26
26
// Default to Unix-style && for bash, zsh, sh, and other shells
@@ -41,7 +41,7 @@ function getCommandChainNote(): string {
41
41
42
42
// Check for cmd.exe
43
43
if(shell.includes("cmd.exe")){
44
-
return"Note: Using `&` for cmd.exe command chaining. For bash/zsh use `&&`, for PowerShell use `;`. IMPORTANT: When using cmd.exe, avoid Unix-specific utilities like `sed`, `grep`, `awk`, `cat`, `rm`, `cp`, `mv`. Use built-in commands like `type` for cat, `del` for rm, `copy` for cp, `move` for mv, `find`/`findstr` for grep, or consider using PowerShell commands instead."
44
+
return"Note: Using `&&` for cmd.exe command chaining (conditional execution). For bash/zsh use `&&`, for PowerShell use `;`. IMPORTANT: When using cmd.exe, avoid Unix-specific utilities like `sed`, `grep`, `awk`, `cat`, `rm`, `cp`, `mv`. Use built-in commands like `type` for cat, `del` for rm, `copy` for cp, `move` for mv, `find`/`findstr` for grep, or consider using PowerShell commands instead."
0 commit comments