Skip to content

Commit 98741ec

Browse files
committed
feat(config): add option to disable AI attribution in commits and PRs
Adds `disable_ai_attribution` config option that allows users to remove the "🤖 Generated with opencode" and "Co-Authored-By: opencode" lines from git commits and pull request descriptions when set to true. Addresses anomalyco#1135
1 parent 132e26d commit 98741ec

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

‎packages/opencode/src/config/config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export namespace Config {
179179
.describe("Custom provider configurations and model overrides"),
180180
mcp: z.record(z.string(), Mcp).optional().describe("MCP (Model Context Protocol) server configurations"),
181181
instructions: z.array(z.string()).optional().describe("Additional instruction files or patterns to include"),
182+
disable_ai_attribution: z.boolean().optional().describe("Disable AI attribution in commits and pull requests"),
182183
layout: Layout.optional().describe("@deprecated Always uses stretch layout."),
183184
experimental: z
184185
.object({

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ When the user asks you to create a new git commit, follow these steps carefully:
5959

6060
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:
6161
- Add relevant untracked files to the staging area.
62-
- Create the commit with a message ending with:
62+
- Create the commit with a message. If the user's config has `disable_ai_attribution` set to true, use only the commit message without any attribution. Otherwise, end the commit message with:
6363
🤖 Generated with [opencode](https://opencode.ai)
6464

6565
Co-Authored-By: opencode <[email protected]>
@@ -78,6 +78,7 @@ Important notes:
7878
- Return an empty response - the user will see the git output directly
7979
- In order to ensure good formatting, ALWAYS pass the commit message via a HEREDOC, a la this example:
8080
<example>
81+
# With attribution (default):
8182
git commit -m "$(cat <<'EOF'
8283
Commit message here.
8384

@@ -86,6 +87,12 @@ git commit -m "$(cat <<'EOF'
8687
Co-Authored-By: opencode <[email protected]>
8788
EOF
8889
)"
90+
91+
# Without attribution (when disable_ai_attribution is true):
92+
git commit -m "$(cat <<'EOF'
93+
Commit message here.
94+
EOF
95+
)"
8996
</example>
9097

9198
# Creating pull requests
@@ -119,8 +126,9 @@ IMPORTANT: When the user asks you to create a pull request, follow these steps c
119126
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:
120127
- Create new branch if needed
121128
- Push to remote with -u flag if needed
122-
- Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.
129+
- Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting. If the user's config has `disable_ai_attribution` set to true, omit the attribution line.
123130
<example>
131+
# With attribution (default):
124132
gh pr create --title "the pr title" --body "$(cat <<'EOF'
125133
## Summary
126134
<1-3 bullet points>
@@ -131,6 +139,16 @@ gh pr create --title "the pr title" --body "$(cat <<'EOF'
131139
🤖 Generated with [opencode](https://opencode.ai)
132140
EOF
133141
)"
142+
143+
# Without attribution (when disable_ai_attribution is true):
144+
gh pr create --title "the pr title" --body "$(cat <<'EOF'
145+
## Summary
146+
<1-3 bullet points>
147+
148+
## Test plan
149+
[Checklist of TODOs for testing the pull request...]
150+
EOF
151+
)"
134152
</example>
135153

136154
Important:

0 commit comments

Comments
 (0)