Add streamlined commit workflow that analyzes staged changes and generates conventional commit messages (feat:, fix:, etc.) with user approval before committing. Closes #18 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2.3 KiB
2.3 KiB
description, argument-hint
| description | argument-hint |
|---|---|
| Create a commit with an auto-generated conventional commit message. Analyzes staged changes and proposes a message for approval. |
Commit Changes
Process
-
Check for staged changes:
git diff --staged --statIf no staged changes, inform the user and suggest staging files first:
- Show unstaged changes with
git status - Ask if they want to stage all changes (
git add -A) or specific files
- Show unstaged changes with
-
Analyze staged changes:
git diff --stagedExamine the diff to understand:
- What files were changed, added, or deleted
- The nature of the changes (new feature, bug fix, refactor, docs, etc.)
- Key details worth mentioning
-
Generate commit message:
Create a conventional commit message following this format:
<type>(<scope>): <description> [optional body with more details] Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>Types:
feat: New feature or capabilityfix: Bug fixrefactor: Code restructuring without behavior changedocs: Documentation changesstyle: Formatting, whitespace (no code change)test: Adding or updating testschore: Maintenance tasks, dependencies, config
Scope: The component or area affected (optional, use when helpful)
Description:
- Imperative mood ("add" not "added")
- Lowercase first letter
- No period at the end
- Focus on the "why" when the "what" is obvious
-
Present message for approval:
Show the proposed message and ask the user to:
- Approve: Use the message as-is
- Edit: Let them modify the message
- Regenerate: Create a new message with different focus
-
Create the commit:
Once approved, execute:
git commit -m "$(cat <<'EOF' <approved message> EOF )" -
Confirm success:
Show the commit result and suggest next steps:
- Push to remote:
git push - Continue working and commit more changes
- Push to remote:
Guidelines
- Only commits what's staged (respects partial staging)
- Never auto-commits without user approval
- Keep descriptions concise (50 chars or less for first line)
- Include body for non-obvious changes
- Always include Co-Authored-By attribution