-
Notifications
You must be signed in to change notification settings - Fork 10.5k
fix(core): use platform-specific shell commands in system prompt #16152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -130,6 +130,12 @@ export function getCoreSystemPrompt( | |||||||||
|
|
||||||||||
| const interactiveMode = config.isInteractive(); | ||||||||||
|
|
||||||||||
| const isWindows = process.platform === 'win32'; | ||||||||||
| const commandSeparator = isWindows ? ';' : '&&'; | ||||||||||
| const grepCommand = isWindows ? 'Select-String' : 'grep'; | ||||||||||
| const tailCommand = isWindows ? 'Get-Content -Tail 10' : 'tail'; | ||||||||||
| const headCommand = isWindows ? 'Get-Content -TotalCount 10' : 'head'; | ||||||||||
|
Comment on lines
+136
to
+137
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoding the line count to 10 for
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 10 is the default for tail and head so I think this is fine |
||||||||||
|
|
||||||||||
| const skills = config.getSkillManager().getSkills(); | ||||||||||
| let skillsPrompt = ''; | ||||||||||
| if (skills.length > 0) { | ||||||||||
|
|
@@ -260,7 +266,7 @@ IT IS CRITICAL TO FOLLOW THESE GUIDELINES TO AVOID EXCESSIVE TOKEN CONSUMPTION. | |||||||||
| - If a command is expected to produce a lot of output, use quiet or silent flags where available and appropriate. | ||||||||||
| - Always consider the trade-off between output verbosity and the need for information. If a command's full output is essential for understanding the result, avoid overly aggressive quieting that might obscure important details. | ||||||||||
| - If a command does not have quiet/silent flags or for commands with potentially long output that may not be useful, redirect stdout and stderr to temp files in the project's temporary directory. For example: 'command > <temp_dir>/out.log 2> <temp_dir>/err.log'. | ||||||||||
| - After the command runs, inspect the temp files (e.g. '<temp_dir>/out.log' and '<temp_dir>/err.log') using commands like 'grep', 'tail', 'head', ... (or platform equivalents). Remove the temp files when done. | ||||||||||
| - After the command runs, inspect the temp files (e.g. '<temp_dir>/out.log' and '<temp_dir>/err.log') using commands like '${grepCommand}', '${tailCommand}', '${headCommand}', ... (or platform equivalents). Remove the temp files when done. | ||||||||||
| `; | ||||||||||
| } | ||||||||||
| return ''; | ||||||||||
|
|
@@ -337,7 +343,7 @@ ${(function () { | |||||||||
| - \`git diff HEAD\` to review all changes (including unstaged changes) to tracked files in work tree since last commit. | ||||||||||
| - \`git diff --staged\` to review only staged changes when a partial commit makes sense or was requested by the user. | ||||||||||
| - \`git log -n 3\` to review recent commit messages and match their style (verbosity, formatting, signature line, etc.) | ||||||||||
| - Combine shell commands whenever possible to save time/steps, e.g. \`git status && git diff HEAD && git log -n 3\`. | ||||||||||
| - Combine shell commands whenever possible to save time/steps, e.g. \`git status ${commandSeparator} git diff HEAD ${commandSeparator} git log -n 3\`. | ||||||||||
| - Always propose a draft commit message. Never just ask the user to give you the full commit message. | ||||||||||
| - Prefer commit messages that are clear, concise, and focused more on "why" and less on "what".${ | ||||||||||
| interactiveMode | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To align with the suggested change in
prompts.ts, this test should check for the command and parameter without the hardcoded line count.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above