GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — prompt update to prevent searching via bash tool · ideabrian/opencode@281ce4c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/opencode/src/tool
    • bash.txt
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/opencode/src/tool/bash.txt‎

Copy file name to clipboardExpand all lines: packages/opencode/src/tool/bash.txt
+68-110Lines changed: 68 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -2,156 +2,114 @@ Executes a given bash command in a persistent shell session with optional timeou
22

33
All commands run in ${directory} by default. Use the `workdir` parameter if you need to run a command in a different directory.
44

5+
IMPORTANT: This tool is for terminal operations like git, npm, docker, etc. DO NOT use it for file operations (reading, writing, editing, searching, finding files) - use the specialized tools for this instead.
6+
57
Before executing the command, please follow these steps:
68

79
1. Directory Verification:
8-
- If the command will create new directories or files, first use the List tool to verify the parent directory exists and is the correct location
9-
- For example, before running "mkdir foo/bar", first use List to check that "foo" exists and is the intended parent directory
10+
- If the command will create new directories or files, first use `ls` to verify the parent directory exists and is the correct location
11+
- For example, before running "mkdir foo/bar", first use `ls foo` to check that "foo" exists and is the intended parent directory
1012

1113
2. Command Execution:
12-
- Always quote file paths that contain spaces with double quotes (e.g., rm "path with spaces/file.txt")
14+
- Always quote file paths that contain spaces with double quotes (e.g., cd "path with spaces/file.txt")
1315
- Examples of proper quoting:
14-
- mkdir "/Users/name/My Documents" (correct)
15-
- mkdir /Users/name/My Documents (incorrect - will fail)
16+
- cd "/Users/name/My Documents" (correct)
17+
- cd /Users/name/My Documents (incorrect - will fail)
1618
- python "/path/with spaces/script.py" (correct)
1719
- python /path/with spaces/script.py (incorrect - will fail)
1820
- After ensuring proper quoting, execute the command.
1921
- Capture the output of the command.
2022

2123
Usage notes:
22-
- The command argument is required.
23-
- You can specify an optional timeout in milliseconds (up to 600000ms / 10 minutes).
24-
If not specified, commands will timeout after 120000ms (2 minutes).
25-
- The description argument is required. You must write a clear, concise description of what this command does in 5-10 words.
26-
- If the output exceeds 30000 characters, output will be truncated before being
27-
returned to you.
28-
- Avoid using Bash with the `find`, `grep`, `cat`, `head`, `tail`, `sed`, `awk`, or
29-
`echo` commands, unless explicitly instructed or when these commands are truly necessary
30-
for the task. Instead, always prefer using the dedicated tools for these commands:
31-
- File search: Use Glob (NOT find or ls)
32-
- Content search: Use Grep (NOT grep or rg)
33-
- Read files: Use Read (NOT cat/head/tail)
34-
- Edit files: Use Edit (NOT sed/awk)
35-
- Write files: Use Write (NOT echo >/cat <<EOF)
36-
- Communication: Output text directly (NOT echo/printf)
37-
- When issuing multiple commands:
38-
- If the commands are independent and can run in parallel, make multiple Bash tool
39-
calls in a single message. For example, if you need to run "git status" and "git diff",
40-
send a single message with two Bash tool calls in parallel.
41-
- If the commands depend on each other and must run sequentially, use a single Bash
42-
call with '&&' to chain them together (e.g., `git add . && git commit -m "message" &&
43-
git push`). For instance, if one operation must complete before another starts (like
44-
mkdir before cp, Write before Bash for git operations, or git add before git commit),
45-
run these operations sequentially instead.
46-
- Use ';' only when you need to run commands sequentially but don't care if earlier
47-
commands fail
48-
- DO NOT use newlines to separate commands (newlines are ok in quoted strings)
49-
- Try to maintain your current working directory throughout the session by using
50-
absolute paths and avoiding usage of `cd`. You may use `cd` if the User explicitly
51-
requests it.
52-
<good-example>
53-
pytest /foo/bar/tests
54-
</good-example>
55-
<bad-example>
56-
cd /foo/bar && pytest tests
57-
</bad-example>
58-
59-
# Working Directory
60-
61-
The `workdir` parameter sets the working directory for command execution. Prefer using `workdir` over `cd <dir> &&` command chains when you simply need to run a command in a different directory.
62-
63-
<good-example>
64-
workdir="/foo/bar", command="pytest tests"
65-
</good-example>
66-
<good-example>
67-
command="pytest /foo/bar/tests"
68-
</good-example>
69-
<bad-example>
70-
command="cd /foo/bar && pytest tests"
71-
</bad-example>
24+
- The command argument is required.
25+
- You can specify an optional timeout in milliseconds (up to 600000ms / 10 minutes). If not specified, commands will timeout after 120000ms (2 minutes).
26+
- It is very helpful if you write a clear, concise description of what this command does in 5-10 words.
27+
- If the output exceeds 30000 characters, output will be truncated before being returned to you.
28+
- You can use the `run_in_background` parameter to run the command in the background, which allows you to continue working while the command runs. You can monitor the output using the Bash tool as it becomes available. You do not need to use '&' at the end of the command when using this parameter.
29+
30+
- Avoid using Bash with the `find`, `grep`, `cat`, `head`, `tail`, `sed`, `awk`, or `echo` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated tools for these commands:
31+
- File search: Use Glob (NOT find or ls)
32+
- Content search: Use Grep (NOT grep or rg)
33+
- Read files: Use Read (NOT cat/head/tail)
34+
- Edit files: Use Edit (NOT sed/awk)
35+
- Write files: Use Write (NOT echo >/cat <<EOF)
36+
- Communication: Output text directly (NOT echo/printf)
37+
- When issuing multiple commands:
38+
- If the commands are independent and can run in parallel, make multiple Bash tool calls in a single message. For example, if you need to run "git status" and "git diff", send a single message with two Bash tool calls in parallel.
39+
- 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.
40+
- Use ';' only when you need to run commands sequentially but don't care if earlier commands fail
41+
- DO NOT use newlines to separate commands (newlines are ok in quoted strings)
42+
- Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of `cd`. You may use `cd` if the User explicitly requests it.
43+
<good-example>
44+
pytest /foo/bar/tests
45+
</good-example>
46+
<bad-example>
47+
cd /foo/bar && pytest tests
48+
</bad-example>
7249

7350
# Committing changes with git
7451

75-
IMPORTANT: ONLY COMMIT IF THE USER ASKS YOU TO.
76-
77-
If and only if the user asks you to create a new git commit, follow these steps carefully:
78-
79-
1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel, each using the Bash tool:
80-
- Run a git status command to see all untracked files.
81-
- Run a git diff command to see both staged and unstaged changes that will be committed.
82-
- Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.
83-
84-
2. Analyze all staged changes (both previously staged and newly added) and draft a commit message. When analyzing:
85-
86-
- List the files that have been changed or added
87-
- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)
88-
- Brainstorm the purpose or motivation behind these changes
89-
- Assess the impact of these changes on the overall project
90-
- Check for any sensitive information that shouldn't be committed
91-
- Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what"
92-
- Ensure your language is clear, concise, and to the point
93-
- Ensure the message accurately reflects the changes and their purpose (i.e. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.)
94-
- Ensure the message is not generic (avoid words like "Update" or "Fix" without context)
95-
- Review the draft message to ensure it accurately reflects the changes and their purpose
52+
Only create commits when requested by the user. If unclear, ask first. When the user asks you to create a new git commit, follow these steps carefully:
9653

97-
3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:
54+
Git Safety Protocol:
55+
- NEVER update the git config
56+
- NEVER run destructive/irreversible git commands (like push --force, hard reset, etc) unless the user explicitly requests them
57+
- NEVER skip hooks (--no-verify, --no-gpg-sign, etc) unless the user explicitly requests it
58+
- NEVER run force push to main/master, warn the user if they request it
59+
- Avoid git commit --amend. ONLY use --amend when ALL conditions are met:
60+
(1) User explicitly requested amend, OR commit SUCCEEDED but pre-commit hook auto-modified files that need including
61+
(2) HEAD commit was created by you in this conversation (verify: git log -1 --format='%an %ae')
62+
(3) Commit has NOT been pushed to remote (verify: git status shows "Your branch is ahead")
63+
- CRITICAL: If commit FAILED or was REJECTED by hook, NEVER amend - fix the issue and create a NEW commit
64+
- CRITICAL: If you already pushed to remote, NEVER amend unless user explicitly requests it (requires force push)
65+
- NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.
66+
67+
1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following bash commands in parallel, each using the Bash tool:
68+
- Run a git status command to see all untracked files.
69+
- Run a git diff command to see both staged and unstaged changes that will be committed.
70+
- Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.
71+
2. Analyze all staged changes (both previously staged and newly added) and draft a commit message:
72+
- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.). Ensure the message accurately reflects the changes and their purpose (i.e. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.).
73+
- Do not commit files that likely contain secrets (.env, credentials.json, etc). Warn the user if they specifically request to commit those files
74+
- Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what"
75+
- Ensure it accurately reflects the changes and their purpose
76+
3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands:
9877
- Add relevant untracked files to the staging area.
99-
- Run git status to make sure the commit succeeded.
100-
101-
4. If the commit fails due to pre-commit hook changes, retry the commit ONCE to include these automated changes. If it fails again, it usually means a pre-commit hook is preventing the commit. If the commit succeeds but you notice that files were modified by the pre-commit hook, you MUST amend your commit to include them.
78+
- Create the commit with a message
79+
- Run git status after the commit completes to verify success.
80+
Note: git status depends on the commit completing, so run it sequentially after the commit.
81+
4. If the commit fails due to pre-commit hook, fix the issue and create a NEW commit (see amend rules above)
10282

10383
Important notes:
104-
- Use the git context at the start of this conversation to determine which files are relevant to your commit. Be careful not to stage and commit files (e.g. with `git add .`) that aren't relevant to your commit.
105-
- NEVER update the git config
106-
- DO NOT run additional commands to read or explore code, beyond what is available in the git context
107-
- DO NOT push to the remote repository
84+
- NEVER run additional commands to read or explore code, besides git bash commands
85+
- NEVER use the TodoWrite or Task tools
86+
- DO NOT push to the remote repository unless the user explicitly asks you to do so
10887
- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.
10988
- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit
110-
- Ensure your commit message is meaningful and concise. It should explain the purpose of the changes, not just describe them.
111-
- Return an empty response - the user will see the git output directly
11289

11390
# Creating pull requests
11491
Use the gh command via the Bash tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a Github URL use the gh command to get the information needed.
11592

11693
IMPORTANT: When the user asks you to create a pull request, follow these steps carefully:
11794

118-
1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from the main branch:
95+
1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from the main branch:
11996
- Run a git status command to see all untracked files
12097
- Run a git diff command to see both staged and unstaged changes that will be committed
12198
- Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote
122-
- Run a git log command and `git diff main...HEAD` to understand the full commit history for the current branch (from the time it diverged from the `main` branch)
123-
124-
2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary. Wrap your analysis process in <pr_analysis> tags:
125-
126-
<pr_analysis>
127-
- List the commits since diverging from the main branch
128-
- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)
129-
- Brainstorm the purpose or motivation behind these changes
130-
- Assess the impact of these changes on the overall project
131-
- Do not use tools to explore code, beyond what is available in the git context
132-
- Check for any sensitive information that shouldn't be committed
133-
- Draft a concise (1-2 bullet points) pull request summary that focuses on the "why" rather than the "what"
134-
- Ensure the summary accurately reflects all changes since diverging from the main branch
135-
- Ensure your language is clear, concise, and to the point
136-
- Ensure the summary accurately reflects the changes and their purpose (ie. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.)
137-
- Ensure the summary is not generic (avoid words like "Update" or "Fix" without context)
138-
- Review the draft summary to ensure it accurately reflects the changes and their purpose
139-
</pr_analysis>
140-
141-
3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:
99+
- Run a git log command and `git diff [base-branch]...HEAD` to understand the full commit history for the current branch (from the time it diverged from the base branch)
100+
2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary
101+
3. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following commands in parallel:
142102
- Create new branch if needed
143103
- Push to remote with -u flag if needed
144104
- Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.
145105
<example>
146106
gh pr create --title "the pr title" --body "$(cat <<'EOF'
147107
## Summary
148108
<1-3 bullet points>
149-
EOF
150-
)"
151109
</example>
152110

153111
Important:
154-
- NEVER update the git config
112+
- DO NOT use the TodoWrite or Task tools
155113
- Return the PR URL when you're done, so the user can see it
156114

157115
# Other common operations

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.