-
Notifications
You must be signed in to change notification settings - Fork 3.8k
implement the includeCoAuthoredBy option #1369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
| const cfg = await Config.get() | ||
| const description = replaceCoAuthoredMessage(cfg.include_co_authored_by ?? true) | ||
| return { | ||
| description, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| function replaceCoAuthoredMessage(includeCoAuthoredBy = true) { | ||
| if (!includeCoAuthoredBy) { | ||
| return DESCRIPTION.replace("${commitCoAuthored1}", ".") | ||
| .replace("${commitCoAuthored2}", "") | ||
| .replace("${prCoAuthored}", "") | ||
| } | ||
|
|
||
| const generatedWith = "🤖 Generated with [opencode](https://opencode.ai)" | ||
| const coAuthoredBy = `${generatedWith} | ||
| Co-Authored-By: opencode <[email protected]>` | ||
|
|
||
| const commitCoAuthored1 = ` ending with:\n ${coAuthoredBy}` | ||
| const commitCoAuthored2 = `\n\n ${coAuthoredBy}` | ||
| const prCoAuthored = `\n\n${generatedWith}` | ||
|
|
||
| return DESCRIPTION.replace("${commitCoAuthored1}", commitCoAuthored1) | ||
| .replace("${commitCoAuthored2}", commitCoAuthored2) | ||
| .replace("${prCoAuthored}", prCoAuthored) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I'd prefer the replacing technique where you section the cases out in the .txt file using some line deliminters
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:
- Add relevant untracked files to the staging area.
<<with-co-author>>
- Create the commit with a message ending with:
🤖 Generated with [opencode](https://opencode.ai)
Co-Authored-By: opencode <[email protected]>
<</with-co-author>>
<<without-co-author>>
- Create the commit with a message
<</without-co-author>>
- Run git status to make sure the commit succeeded.Then some utilities can be written and tested for to keep/select/remove these sections.
Pros:
- All of the text remains in the .txt file (not in the codebase)
- Code handling these sections can be clear to understand given the utilities are defined
Cons:
- A little more complexity and abstraction, but easily managed with some utility functions.
Reference the original PR sst#1369 from sst/opencode that this implementation is based on, and remove internal implementation details from user-facing documentation.
dbirks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can confirm this works nicely, thanks!
An alternative implementation which leverages no custom templating system and instead opts in for using mustache: #1430 |
f16de3d to
cc0d460
Compare
772b621 to
eb855e1
Compare
f1dc981 to
3e15a39
Compare
f8ee907 to
6a9856d
Compare

let me know if you want to merge this. I'll resolve the conflicts
and feel free to just close this PR if you don't want this to be added.
fix #919
Add the
include_co_authored_byoption. The behavior is copied from Claude Code.When it's true (default) the prompt remains unchanged. I copied the original prompt and verified it with a temporary test:
And this is how the three places look when it's false. This should be the same as Claude Code:
1

2

3

actual usage:
true:

false:
