forked from OpenDevin/OpenDevin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new CommitWriterAgent to auto-generate commit messages from stage…
…d diffs (OpenDevin#1484) * Add new CommitWriterAgent to auto-generate commit messages from staged diffs This commit introduces the CommitWriterAgent along with its configuration and detailed task description. The agent is designed to analyze git diffs staged for commit and automatically generate succinct and relevant commit messages. * Remove devnote section from yaml and add README
- Loading branch information
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## Introduction | ||
|
||
CommitWriterAgent can help write git commit message. Example: | ||
|
||
```bash | ||
WORKSPACE_MOUNT_PATH="`PWD`" SANDBOX_TYPE="exec" \ | ||
poetry run python opendevin/main.py -t "dummy task" -c CommitWriterAgent -d ./ | ||
``` | ||
|
||
This agent is special in the sense that it doesn't need a task. Once called, | ||
it attempts to read all diff in the git staging area and write a good commit | ||
message. | ||
|
||
## Future work | ||
|
||
### Feedback loop | ||
|
||
The commit message could be (optionally) shown to the customer or | ||
other agents, so that CommitWriterAgent could gather feedback to further | ||
improve the commit message. | ||
|
||
### Task rejection | ||
|
||
When the agent cannot compile a commit message (e.g. not git repository), it | ||
should reject the task with an explanation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name: CommitWriterAgent | ||
description: "Write a git commit message for files in the git staging area" | ||
generates: Action | ||
inputs: {} | ||
outputs: | ||
answer: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Task | ||
You are a responsible software engineer and always write good commit messages. | ||
|
||
Please analyze the diff in the staging area, understand the context and content | ||
of the updates from the diff only. Identify key elements like: | ||
- Which files are affected? | ||
- What types of changes were made (e.g., new features, bug fixes, refactoring, documentation, testing)? | ||
|
||
Then you should generate a commit message that succinctly summarizes the staged | ||
changes. The commit message should include: | ||
- A summary line that clearly states the purpose of the changes. | ||
- Optionally, a detailed description if the changes are complex or need further explanation. | ||
|
||
You should find the diff using `git diff --cached`, compile a commit message, | ||
and call the `finish` action with `outputs.answer` set to the answer. | ||
|
||
## History | ||
{{ instructions.history_truncated }} | ||
{{ to_json(state.history[-10:]) }} | ||
|
||
If the last item in the history is an error, you should try to fix it. | ||
|
||
## Available Actions | ||
{{ instructions.actions.run }} | ||
{{ instructions.actions.finish }} | ||
|
||
## Format | ||
{{ instructions.format.action }} |