(name: string, platform: NodeJS.Platform, limits: Limits, defaultTimeoutMs: number)
| 219 | } |
| 220 | |
| 221 | function profile(name: string, platform: NodeJS.Platform, limits: Limits, defaultTimeoutMs: number) { |
| 222 | const isPowerShell = PS.has(name) |
| 223 | const chain = chainGuidance(name) |
| 224 | if (CMD.has(name)) { |
| 225 | return { |
| 226 | intro: `Executes a given ${shellDisplayName(name)} command with optional timeout, ensuring proper handling and security measures.`, |
| 227 | workdirSection: |
| 228 | "All commands run in the current working directory by default. Use the `workdir` parameter if you need to run a command in a different directory. AVOID changing directories inside the command - use `workdir` instead.", |
| 229 | commandSection: cmdCommandSection(chain, limits, defaultTimeoutMs), |
| 230 | gitCommands: "git commands", |
| 231 | gitCommandRestriction: "git commands", |
| 232 | createPrInstruction: "Create PR using a temporary body file so cmd.exe quoting stays simple.", |
| 233 | createPrExample: `(\n echo ## Summary\n echo - ^<1-3 bullet points^>\n) > pr-body.txt\ngh pr create --title "the pr title" --body-file pr-body.txt`, |
| 234 | } |
| 235 | } |
| 236 | if (isPowerShell) { |
| 237 | return { |
| 238 | intro: `Executes a given ${shellDisplayName(name)} command with optional timeout, ensuring proper handling and security measures.`, |
| 239 | workdirSection: |
| 240 | "All commands run in the current working directory by default. Use the `workdir` parameter if you need to run a command in a different directory. AVOID changing directories inside the command - use `workdir` instead.", |
| 241 | commandSection: powershellCommandSection( |
| 242 | name, |
| 243 | chain, |
| 244 | platform === "win32" ? "\\" : "/", |
| 245 | limits, |
| 246 | defaultTimeoutMs, |
| 247 | ), |
| 248 | gitCommands: "git commands", |
| 249 | gitCommandRestriction: "git commands", |
| 250 | createPrInstruction: "Create PR using gh pr create with a PowerShell here-string to pass the body correctly.", |
| 251 | createPrExample: `gh pr create --title "the pr title" --body @' |
| 252 | ## Summary |
| 253 | - <1-3 bullet points> |
| 254 | '@`, |
| 255 | } |
| 256 | } |
| 257 | return { |
| 258 | intro: |
| 259 | "Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.", |
| 260 | workdirSection: |
| 261 | "All commands run in the current working directory by default. Use the `workdir` parameter if you need to run a command in a different directory. AVOID using `cd <directory> && <command>` patterns - use `workdir` instead.", |
| 262 | commandSection: bashCommandSection(chain, limits, defaultTimeoutMs), |
| 263 | gitCommands: "bash commands", |
| 264 | gitCommandRestriction: "git bash commands", |
| 265 | createPrInstruction: |
| 266 | "Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.", |
| 267 | createPrExample: `gh pr create --title "the pr title" --body "$(cat <<'EOF' |
| 268 | ## Summary |
| 269 | <1-3 bullet points>`, |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | export function render(name: string, platform: NodeJS.Platform, limits: Limits, defaultTimeoutMs: number) { |
| 274 | const selected = profile(name, platform, limits, defaultTimeoutMs) |
no test coverage detected