4.4 KiB
4.4 KiB
name, description, argument-hint
| name | description | argument-hint |
|---|---|---|
| commit | Create a git commit with AI identification via Git trailers (no visible signature in message) | [message] |
Create a git commit following repository conventions with AI identification through Git trailers instead of visible signatures in the commit message body.
Commit Process
Step 1: Gather Context
Run these commands in parallel to understand the current state:
# Check staged and unstaged changes
git status
# View staged changes
git diff --cached
# View recent commits for style reference
git log --oneline -10
Step 2: Analyze Changes
Based on the diff output:
- Identify the type of change: feat, fix, chore, docs, refactor, test, style, perf, ci, build
- Determine the scope (optional): component or area affected
- Summarize the "why": Focus on purpose, not just what changed
Step 3: Draft Commit Message
Follow the repository's existing commit style. If Conventional Commits is used:
<type>(<scope>): <subject>
<body - optional>
Guidelines:
- Subject line: max 50 characters, imperative mood ("add" not "added")
- Body: wrap at 72 characters, explain motivation/context
- DO NOT include emoji signatures, "Generated by AI", or Co-Authored-By in the message body
Step 4: Create Commit with Trailers
Use Git's --trailer parameter for AI identification. This keeps trailers separate from the message and follows Git's native trailer handling:
git commit \
-m "<type>(<scope>): <subject>" \
-m "<body if needed>" \
--trailer "Generated-by: Claude" \
--trailer "AI-Model: claude-opus-4-5-20251101"
Available Trailers:
--trailer "Generated-by: Claude"- Identifies AI assistance--trailer "AI-Model: <model-id>"- Specific model used--trailer "AI-Session: <id>"- Session identifier (optional)--trailer "Reviewed-by: <name>"- If human reviewed before commit
Step 5: Verify Commit
After committing, verify with:
git log -1 --format=full
git status
Examples
Simple Feature
git commit \
-m "feat(auth): add OAuth2 refresh token support" \
-m "Implements automatic token refresh when access token expires, preventing session interruptions for long-running operations." \
--trailer "Generated-by: Claude" \
--trailer "AI-Model: claude-opus-4-5-20251101"
Bug Fix
git commit \
-m "fix(api): handle null response in user endpoint" \
--trailer "Generated-by: Claude" \
--trailer "AI-Model: claude-opus-4-5-20251101"
Chore/Refactor
git commit \
-m "chore: update dependencies to latest versions" \
--trailer "Generated-by: Claude" \
--trailer "AI-Model: claude-opus-4-5-20251101"
Trailer Query Commands
Trailers can be queried programmatically:
# Find all AI-generated commits
git log --all --grep="Generated-by: Claude"
# Show trailers for a commit
git log -1 --format="%(trailers)"
# Filter by specific trailer
git log --all --format="%H %s" | while read hash msg; do
git log -1 --format="%(trailers:key=Generated-by)" $hash | grep -q Claude && echo "$hash $msg"
done
Important Notes
- No visible AI signature - The message body stays clean and professional
- Trailers are standard - Git trailers are a recognized convention (like Signed-off-by)
- Machine-readable - Easy to filter/query AI-generated commits
- Transparent - AI assistance is documented, just not prominently displayed
- Do not use --no-verify - Always run pre-commit hooks unless user explicitly requests
When User Provides Message
If the user provides a commit message as argument:
- Use their message as the subject/body
- Ensure proper formatting (50 char subject, etc.)
- Append the trailers via
--trailerparameter
# User says: /ring-default:commit "fix login bug"
git commit \
-m "fix: fix login bug" \
--trailer "Generated-by: Claude" \
--trailer "AI-Model: claude-opus-4-5-20251101"
Step 6: Offer Push (Optional)
After successful commit, ask the user if they want to push:
AskUserQuestion({
questions: [{
question: "Push commit to remote?",
header: "Push",
multiSelect: false,
options: [
{ label: "Yes", description: "Push to current branch" },
{ label: "No", description: "Keep local only" }
]
}]
});
If user selects "Yes":
git push
If branch has no upstream, use:
git push -u origin <current-branch>