bash.tpl

 1Run shell commands. Use dedicated tools when available (view, grep, glob, ls).
 2
 3<when_to_use>
 4Use Bash when:
 5- Running build/test commands (go build, npm test, pytest)
 6- Git operations (git status, git commit, git push)
 7- Installing dependencies
 8- Running project scripts
 9- Commands that don't have dedicated tools
10
11Do NOT use Bash when:
12- Reading files → use `view`
13- Searching file contents → use `grep`
14- Finding files → use `glob`
15- Listing directories → use `ls`
16- Fetching URLs → use `fetch`
17</when_to_use>
18
19<execution>
20- Each command runs in independent shell (no state between calls)
21- Use absolute paths rather than cd
22- Commands >1 minute auto-convert to background
23- Output truncated at {{ .MaxOutputLength }} chars
24</execution>
25
26<background_jobs>
27For servers, watchers, or long-running processes:
28- Set `run_in_background=true` - do NOT use `&`
29- Returns shell_id for management
30- Use `job_output` to check output
31- Use `job_kill` to stop
32
33**Run in background:**
34- npm start, npm run dev
35- python -m http.server
36- go run main.go (servers)
37- tail -f, watch commands
38
39**Do NOT run in background:**
40- npm run build, go build
41- npm test, pytest, go test
42- git commands
43- One-time scripts
44</background_jobs>
45
46<banned_commands>
47These commands are blocked for security:
48{{ .BannedCommands }}
49</banned_commands>
50
51<git_commits>
52When creating a commit:
531. Run git status, git diff, git log (parallel calls for speed)
542. Stage relevant files (don't stage unrelated changes)
553. Write clear commit message focusing on "why"
564. Use HEREDOC for multi-line messages:
57```bash
58git commit -m "$(cat <<'EOF'
59Commit message here
60{{ if .Attribution.GeneratedWith }}
61💘 Generated with Crush
62{{ end }}
63{{if eq .Attribution.TrailerStyle "assisted-by" }}
64Assisted-by: {{ .ModelName }} via Crush <crush@charm.land>
65{{ else if eq .Attribution.TrailerStyle "co-authored-by" }}
66Co-Authored-By: Crush <crush@charm.land>
67{{ end }}
68EOF
69)"
70```
71
72Notes:
73- Use `git commit -am` when possible
74- Don't commit unrelated files
75- Don't amend unless asked
76- Don't push unless asked
77</git_commits>
78
79<pull_requests>
80Use gh CLI for GitHub operations. When creating PR:
811. Check git status, diff, log (parallel)
822. Create branch if needed
833. Commit and push
844. Create PR with gh pr create
85
86Keep PR descriptions focused on "why" not "what".
87</pull_requests>
88
89<tips>
90- Combine related commands: `git status && git diff`
91- Use absolute paths: `pytest /project/tests` not `cd /project && pytest tests`
92- Chain with `&&` for dependent commands
93- Avoid interactive commands (use -y flags)
94</tips>