| name | description |
|---|---|
commit-message |
Generate a conventional commit message by analyzing staged git changes. Use when the user wants to create, write, or generate a git commit message from their current staged diff. |
Generate a conventional commit message from staged git changes following a structured prompt pipeline.
If there are modified files from the current session that haven't been staged yet, run git add on those files first to include them in the staged changes.
Then get the staged diff:
git diff --stagedIf the diff is empty after this, inform the user that there are no staged changes and stop.
Produce a bullet-point summary of the changes. Follow these rules:
- A line starting with
+means it was added,-means deleted. Lines with neither are context. - Write every summary comment as a bullet point starting with
-. - Do not include file names as part of the comment.
- Do not use
[or]characters in the summary. - Do not include comments copied from the code.
- Write only the most important comments. When in doubt, write fewer comments.
- Readability is top priority.
Example summary comments for reference (do not copy verbatim):
- Increase the number of returned recordings from 10 to 100
- Correct a typo in the GitHub Action name
- Relocate the octokit initialization to a separate file
- Implement an OpenAI API endpoint for completions
From the summary, write a single-line commit title:
- Use imperative tense following the kernel git commit style guide.
- Write a high-level title that captures a single specific theme.
- Do not repeat the file summaries or list individual changes.
- No more than 60 characters.
- Lowercase the first character.
- Remove any trailing period.
Prefix — choose exactly one label based on the summary:
build: Changes that affect the build system or external dependencieschore: Updating libraries, copyrights, or other repo settings, includes updating dependenciesci: Changes to CI configuration files and scriptsdocs: Non-code changes, such as fixing typos or adding new documentationfeat: Introduces a new feature to the codebasefix: Patches a bug in the codebaseperf: A code change that improves performancerefactor: A code change that neither fixes a bug nor adds a featurestyle: Changes that do not affect the meaning of the code (white-space, formatting, etc.)test: Adding missing tests or correcting existing tests
Scope — identify the module or package scope from the changed files:
- Look at the file paths in the diff to determine which module, package, or component is affected.
- If all changes are within a single module/package/directory, use that as the scope (e.g.,
model,git,prompt,cmd,provider). - Use the most specific common directory or package name. For example, changes only in
provider/openai/should useopenai, notprovider. - If changes span multiple modules, pick the one most central to the change's purpose.
- Scope is required — always include one.
- Keep the scope short — a single lowercase word.
Format the commit message as:
<prefix>(<scope>): <title>
<summary>
Show the formatted message to the user and ask for confirmation before running git commit.