bash.tpl

  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{{ if or (eq .Attribution.TrailerStyle "assisted-by") (eq .Attribution.TrailerStyle "co-authored-by")}} with attribution{{ end }} using HEREDOC:
 44   git commit -m "$(cat <<'EOF'
 45   Commit message here.
 46
 47{{- if .Attribution.GeneratedWith}}
 48   💘 Generated with Crush
 49{{- end}}
 50{{- if eq .Attribution.TrailerStyle "assisted-by"}}
 51
 52   Assisted-by: {{ .ModelName }} via Crush
 53{{- else if eq .Attribution.TrailerStyle "co-authored-by"}}
 54
 55   Co-Authored-By: Crush <crush@charm.land>
 56{{- end}}
 57
 58   EOF
 59   )"
 60
 615. If pre-commit hook fails, retry ONCE. If fails again, hook preventing commit. If succeeds but files modified, MUST amend.
 62
 636. Run git status to verify.
 64
 65Notes: 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.
 66</git_commits>
 67
 68<pull_requests>
 69Use gh command for ALL GitHub tasks. When user asks to create PR:
 70
 711. Single message with multiple tool_use blocks (VERY IMPORTANT for speed):
 72   - git status (untracked files)
 73   - git diff (staged/unstaged changes)
 74   - Check if branch tracks remote and is up to date
 75   - git log and 'git diff main...HEAD' (full commit history from main divergence)
 76
 772. Create new branch if needed
 783. Commit changes if needed
 794. Push to remote with -u flag if needed
 80
 815. Analyze changes in <pr_analysis> tags:
 82   - List commits since diverging from main
 83   - Summarize nature of changes
 84   - Brainstorm purpose/motivation
 85   - Assess project impact
 86   - Don't use tools beyond git context
 87   - Check for sensitive information
 88   - Draft concise (1-2 bullet points) PR summary focusing on "why"
 89   - Ensure summary reflects ALL changes since main divergence
 90   - Clear, concise language
 91   - Accurate reflection of changes and purpose
 92   - Avoid generic summaries
 93   - Review draft
 94
 956. Create PR with gh pr create using HEREDOC:
 96   gh pr create --title "title" --body "$(cat <<'EOF'
 97
 98   ## Summary
 99
100   <1-3 bullet points>
101
102   ## Test plan
103
104   [Checklist of TODOs...]
105
106{{ if .Attribution.GeneratedWith}}
107   💘 Generated with Crush
108{{ end }}
109
110   EOF
111   )"
112
113Important:
114
115- Return empty response - user sees gh output
116- Never update git config
117</pull_requests>
118
119<examples>
120Good: pytest /foo/bar/tests
121Bad: cd /foo/bar && pytest tests
122</examples>