git_ui: Add setting for custom commit message instructions (#58188)
There's currently no way to customize AI-generated commit messages on a
per-commit basis. You can put instructions in AGENTS.md or a project
rules file, but those get fed into every agent interaction, not just
commit generation. The built-in "Commit message" prompt used to be
editable in the Rules Library, but that was replaced by Skills, which
aren't used when generating commit messages.
This PR adds an `agent.commit_message_instructions` setting. Its
contents are added to the commit message prompt in their own section,
alongside any project rules, so you can ask for a specific format
(Conventional Commits, a ticket prefix, etc.) without changing how the
agent behaves elsewhere:
```json
{
"agent": {
"commit_message_instructions": "Use the Conventional Commits format: <type>(<scope>): <description>."
}
}
```
Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Addresses #26503
Release Notes:
- Added an `agent.commit_message_instructions` setting to customize
AI-generated git commit messages.
---------
Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
This commit is contained in:
1 parent
83c52e3878
commit
6d605b393c
7 files changed
+65
-1
No files matched your search
@@ -293,6 +293,18 @@ See [Feature-specific models](./ai/agent-settings.md#feature-specific-models) fo
|
||||
|
||||
To add custom commit instructions for the model, use the global `AGENTS.md` file located `~/.config/zed/AGENTS.md` on macOS and Linux, `%APPDATA%\Zed\AGENTS.md` on Windows.
|
||||
|
||||
To add custom instructions that apply only to commit message generation, use the `commit_message_instructions` field in your agent settings:
|
||||
|
||||
```json [settings]
|
||||
{
|
||||
"agent": {
|
||||
"commit_message_instructions": "Use the Conventional Commits format: <type>(<scope>): <description>."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
These instructions are sent to the model in addition to any project rules files (such as `.rules` or `AGENTS.md`). To add instructions that apply to both commit messages and the agent more broadly, use the global `AGENTS.md` file located `~/.config/zed/AGENTS.md` on macOS and Linux, `%APPDATA%\Zed\AGENTS.md` on Windows.
|
||||
|
||||
> Before Zed v1.4.0, this was done through the Rules Library, which has been removed.
|
||||
> See [the "Migrating to Skills" docs](./ai/rules.md#migrating-to-skills) in the Rules page for more information.
|
||||
|
||||
|
||||
Reference in new issue
Block a user