commit-sense-cli
v1.1.0
Published
CommitSense helps developers write accurate, meaningful, and semantically correct Conventional Commits by analyzing diffs and suggesting the appropriate commit type and scope.
Downloads
181
Readme
CommitSense
CommitSense helps developers write accurate, meaningful, and semantically correct Conventional Commits by analyzing diffs and suggesting the appropriate commit type and scope.
Features
- Fast & Local: Runs entirely on your machine.
- Smart Suggestions: Analyzes staged files to suggest commit types (feat, fix, chore, etc.).
- Advanced Analysis :
- Dependency Checks: Detects
choreforpackage.jsonupdates. - Code Aware: Detects
featfor new exports andrefactorfor removed exports. - Scope Detection: Intelligent scope suggestion based on directory structure (prioritizing feature folders over utility folders).
- Dependency Checks: Detects
- Zero Config: Works out of the box for most projects.
Installation
npm install -g commit-sense-cliUsage
Stage your changes:
git add .Run CommitSense instead of git commit:
commit-sense-cliFollow the interactive prompts to confirm or edit the commit message.
Development
- Clone the repo
- Install dependencies:
npm install - Build:
npm run build - Run locally:
npm run dev(ornode bin/commitsense.js)
Optional: Enforce Commit Convention
You can use commit-sense-cli to validate commit messages with git hooks (e.g., using Husky).
- Install Husky:
npm install --save-dev husky
npx husky init- Add a
commit-msghook:
echo "npx commit-sense-cli validate \$1" > .husky/commit-msgNow, if you try to commit with an invalid message (e.g., git commit -m "bad message"), it will be rejected.
