bash.gotmpl

  1Executes bash commands in persistent shell session with timeout and security measures.
  2
  3<cross_platform>
  4Uses mvdan/sh interpreter (Bash-compatible on all platforms including Windows).
  5Use forward slashes for paths: "ls C:/foo/bar" not "ls C:\foo\bar".
  6Common shell builtins and core utils available on Windows.
  7</cross_platform>
  8
  9<execution_steps>
 101. Directory Verification: If creating directories/files, use LS tool to verify parent exists
 112. Security Check: Banned commands ({{ .BannedCommands }}) return error - explain to user. Safe read-only commands execute without prompts
 123. Command Execution: Execute with proper quoting, capture output
 134. Output Processing: Truncate if exceeds {{ .MaxOutputLength }} characters
 145. Return Result: Include errors, metadata with <cwd></cwd> tags
 15</execution_steps>
 16
 17<usage_notes>
 18- Command required, timeout optional (max 600000ms/10min, default 30min if unspecified)
 19- IMPORTANT: Use Grep/Glob/Agent tools instead of 'find'/'grep'. Use View/LS tools instead of 'cat'/'head'/'tail'/'ls'
 20- Chain with ';' or '&&', avoid newlines except in quoted strings
 21- Shell state persists (env vars, virtual envs, cwd, etc.)
 22- Prefer absolute paths over 'cd' (use 'cd' only if user explicitly requests)
 23</usage_notes>
 24
 25<git_commits>
 26When user asks to create git commit:
 27
 281. Single message with three tool_use blocks (IMPORTANT for speed):
 29   - git status (untracked files)
 30   - git diff (staged/unstaged changes)
 31   - git log (recent commit message style)
 32
 332. Add relevant untracked files to staging. Don't commit files already modified at conversation start unless relevant.
 34
 353. Analyze staged changes in <commit_analysis> tags:
 36   - List changed/added files, summarize nature (feature/enhancement/bug fix/refactoring/test/docs)
 37   - Brainstorm purpose/motivation, assess project impact, check for sensitive info
 38   - Don't use tools beyond git context
 39   - Draft concise (1-2 sentences) message focusing on "why" not "what"
 40   - Use clear language, accurate reflection ("add"=new feature, "update"=enhancement, "fix"=bug fix)
 41   - Avoid generic messages, review draft
 42
 434. Create commit with Crush signature using HEREDOC:
 44   git commit -m "$(cat <<'EOF'
 45   Commit message here.
 46{{ if .Attribution.GeneratedWith}}
 47   💘 Generated with Crush
 48{{ end }}
 49{{ if .Attribution.CoAuthoredBy}}
 50   Co-Authored-By: Crush <crush@charm.land>
 51{{ end }}
 52   EOF
 53   )"
 54
 555. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.
 56
 576. Run git status to verify.
 58
 59Notes: Use "git commit -am" when possible, don't stage unrelated files, NEVER update config, don't push, no -i flags, no empty commits, return empty response.
 60</git_commits>
 61
 62<pull_requests>
 63Use gh command for ALL GitHub tasks. When user asks to create PR:
 64
 651. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):
 66   - git status (untracked files)
 67   - git diff (staged/unstaged changes)
 68   - Check if branch tracks remote and is up to date
 69   - git log and 'git diff main...HEAD' (full commit history from main divergence)
 70
 712. Create new branch if needed
 723. Commit changes if needed
 734. Push to remote with -u flag if needed
 74
 755. Analyze changes in <pr_analysis> tags:
 76   - List commits since diverging from main
 77   - Summarize nature of changes
 78   - Brainstorm purpose/motivation
 79   - Assess project impact
 80   - Don't use tools beyond git context
 81   - Check for sensitive information
 82   - Draft concise (1-2 bullet points) PR summary focusing on "why"
 83   - Ensure summary reflects ALL changes since main divergence
 84   - Clear, concise language
 85   - Accurate reflection of changes and purpose
 86   - Avoid generic summaries
 87   - Review draft
 88
 896. Create PR with gh pr create using HEREDOC:
 90   gh pr create --title "title" --body "$(cat <<'EOF'
 91
 92   ## Summary
 93
 94   <1-3 bullet points>
 95
 96   ## Test plan
 97
 98   [Checklist of TODOs...]
 99
100{{ if .Attribution.GeneratedWith}}
101   💘 Generated with Crush
102{{ end }}
103
104   EOF
105   )"
106
107Important:
108
109- Return empty response - user sees gh output
110- Never update git config
111  </pull_requests>
112
113<examples>
114Good: pytest /foo/bar/tests
115Bad: cd /foo/bar && pytest tests
116</examples>