MCPcopy Create free account
hub / github.com/anomalyco/opencode / chainGuidance

Function chainGuidance

packages/opencode/src/tool/shell/prompt.ts:65–76  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

63}
64
65function chainGuidance(name: string) {
66 if (name === "powershell") {
67 return "If the commands depend on each other and must run sequentially, avoid '&&' in this shell because Windows PowerShell (5.1) does not support it. Use PowerShell conditionals such as `cmd1; if ($?) { cmd2 }` when later commands must depend on earlier success."
68 }
69 if (PS.has(name)) {
70 return "If the commands depend on each other and must run sequentially, use a single bash tool call with '&&' to chain them together (e.g., `git add . && git commit -m \"message\" && git push`). For instance, if one operation must complete before another starts (like New-Item before Copy-Item, Write before bash for git operations, or git add before git commit), run these operations sequentially instead."
71 }
72 if (CMD.has(name)) {
73 return "If the commands depend on each other and must run sequentially, use a single bash tool call with `&&` to chain them together (e.g., `mkdir out && dir out`). For instance, if one operation must complete before another starts, run these operations sequentially instead."
74 }
75 return "If the commands depend on each other and must run sequentially, use a single Bash call with '&&' to chain them together (e.g., `git add . && git commit -m \"message\" && git push`). For instance, if one operation must complete before another starts (like mkdir before cp, Write before Bash for git operations, or git add before git commit), run these operations sequentially instead."
76}
77
78function bashCommandSection(chain: string, limits: Limits, defaultTimeoutMs: number) {
79 return `Before executing the command, please follow these steps:

Callers 1

profileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected