Add commit message skill support - #58754
Conversation
|
Warning Hi, I am new to Rust and the Zed codebase. Please review extra carefully, especially on implementation design, code organization, performance, and tests. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
f9fd529 to
3449d38
Compare
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: ask4fusora.
|
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: ask4fusora.
|
This comment was marked as outdated.
This comment was marked as outdated.
|
@cla-bot check |
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: ask4fusora.
|
|
The cla-bot has been summoned, and re-checked this pull request! |
Ensure commit message skills are read asynchronously using the repository working directory path. Also update the user settings lookup to use the current `SettingsFile::User` form.
7325292 to
17b802c
Compare
Self-Review Checklist:
Related to #58345.
Release Notes:
git_commit_message_skill_name.Description
This PR introduces
git_commit_message_skill_namesetting, which can be defined in both project-level and user-levelsettings.jsonfiles. It dictates which agent skill to load whengit::GenerateCommitMessageis triggered.Motivation and context
In Zed v1.4.2, the previous rules library handling the
Commit Messagerule was removed and replaced for agent skills support. Currently, the primary workaround to provide custom commit message instructions is to place them inAGENTS.md. However, this approach pollutes the context window when interacting generally with theZed Agent.While PR #58188 attempted to address related concerns, it does not represent the ideal final architecture for this feature.
Additionally, Zed now operates as a multi-workspace editor, we need a solution that scales cleanly across multiple projects.
Proposed solution
When
git::GenerateCommitMessageis triggered for workspaceproject-a, the system follows this resolution path to find the appropriate skill:.zed/settings.jsonforgit_commit_message_skill_name.project-a/.agents/skills.settings.json.~/.agents/skills.<position>is blank..agents/skillsdirectory, it throws an error notifying the user that the skill at<position>could not be found.git_commit_message_skill_nameis blank, the generation omits the specific skill block and falls back to default behavior.Logic Diagram
For clarity, here is the resolution flow represented as a Mermaid diagram:
--- config: theme: redux layout: elk --- flowchart LR A@{ label: "Generate commit message triggered in `project-a`" } --> B@{ label: "`project-a/.zed/settings.json` has skill name set?" } B -- true --> C@{ label: "`project-a/.agents/skills` has set skill?" } C -- true --> E{"Skill content is not blank?"} E -- true --> F["Load the skill for git commit message generation"] E -- false --> G["Notify error that the skill at \<position\> is blank"] C -- false --> D["Notify error that the skill in \<position\> is not found."] B -- false --> H@{ label: "Skill name is set in user `settings.json`?" } H -- true --> I@{ label: "Skill is declared in `~/.agents/skills`?" } I -- true --> E H -- false --> J["Omit the skill block for commit message"] I -- false --> D A@{ shape: rect} B@{ shape: diamond} C@{ shape: diamond} H@{ shape: diamond} I@{ shape: diamond}