Summary
Add a /commit command that analyzes staged changes and generates meaningful commit messages.
Why It's Needed
- Git Workflow: Streamline the commit process
- Better Messages: AI generates descriptive commit messages
- Consistency: Follow commit conventions automatically
- Competitor Parity: Claude Code has this feature
Usage
# In TUI
/commit # Auto-generate message from staged changes
/commit "hint about change" # Use hint to guide message generation
# CLI
codetyper commit # Same as /commit
codetyper commit --amend # Amend last commit
Workflow
1. Check for staged changes (git diff --cached)
└─ If none, offer to stage modified files
2. Analyze diff content
└─ Identify type of change (feat, fix, refactor, docs, etc.)
3. Generate commit message
└─ Follow conventional commits or repo's convention
└─ Include scope if identifiable
└─ Keep under 72 chars for subject
4. Show preview
└─ Display generated message
└─ Show files being committed
5. Confirm and execute
└─ User can edit message
└─ Execute: git commit -m "message"
6. Show result
└─ Display commit hash
└─ Show success message
Commit Message Format
<type>(<scope>): <subject>
<body>
<footer>
Types: feat, fix, docs, style, refactor, test, chore
Example Output
📝 Analyzing staged changes...
Files to commit:
M src/services/auth.ts
M src/utils/validation.ts
A src/tests/auth.test.ts
Generated commit message:
──────────────────────────────
feat(auth): add JWT token refresh mechanism
- Add automatic token refresh before expiry
- Add validation for refresh tokens
- Add unit tests for auth service
──────────────────────────────
[c]ommit [e]dit [a]bort
Acceptance Criteria
Effort Estimate
2 days
Future Enhancements
/pr command for pull request creation
- Auto-generate PR descriptions
- Link to issues
Summary
Add a
/commitcommand that analyzes staged changes and generates meaningful commit messages.Why It's Needed
Usage
Workflow
Commit Message Format
Types: feat, fix, docs, style, refactor, test, chore
Example Output
Acceptance Criteria
/commitcommand in TUIcodetyper commitCLI command--amendflagEffort Estimate
2 days
Future Enhancements
/prcommand for pull request creation