@workm8/gait
v0.0.1
Published
**Your AI-powered Git commit message generator**
Readme
Gait 🚶♂️
Your AI-powered Git commit message generator
Gait analyzes your Git repository changes and generates professional, conventional commit messages using AI. Never struggle with writing commit messages again!
Features
✨ AI-Powered: Uses OpenAI GPT-4 to understand your code changes and generate contextual commit messages
📝 Multiple Formats: Support for conventional commits, simple, and detailed formats
🎯 Smart Analysis: Analyzes file changes, diffs, and context to create relevant messages
🛡️ Validation: Built-in validation for commit message quality and format
🔍 Interactive Mode: Review and edit messages before committing
📊 Status Overview: Visual repository status with file change summaries
Installation
npm install -g @gait/cliPrerequisites
OpenAI API Key: You'll need an OpenAI API key to use Gait
export OPENAI_API_KEY="your-api-key-here"Or create a
.envfile in your project:OPENAI_API_KEY=your-api-key-hereGit Repository: Gait works within Git repositories
Quick Start
# Generate a commit message without committing
gait generate
# Generate and commit with interactive review
gait commit --interactive
# Check repository status
gait statusCommands
gait generate (alias: gen, g)
Generate a commit message without creating a commit.
gait generate [options]
Options:
--format <type> Message format: conventional, simple, detailed (default: "conventional")
--max-length <number> Maximum message length (default: "72")Examples:
# Generate conventional commit message
gait generate
# Generate simple format message
gait generate --format simple
# Limit message length
gait generate --max-length 50gait commit (alias: c)
Generate a commit message and create a commit.
gait commit [options]
Options:
-s, --staged-only Only commit staged changes
-f, --files <files> Comma-separated list of files to commit
-n, --dry-run Show what would be committed without committing
-i, --interactive Review and edit message before committingExamples:
# Generate message and commit all changes
gait commit
# Interactive mode - review before committing
gait commit --interactive
# Commit only staged changes
gait commit --staged-only
# Commit specific files
gait commit --files "src/index.ts,README.md"
# Preview without committing
gait commit --dry-rungait status (alias: st)
Show repository status and changes.
gait status [options]
Options:
--show-diff Show diff of changesExamples:
# Show basic status
gait status
# Show status with diff
gait status --show-diffGlobal Options
Options:
-r, --repo <path> Repository path (default: ".")
-v, --verbose Enable verbose output
--version Show version number
--help Show helpCommit Message Formats
Conventional Commits (Default)
feat(auth): add JWT token validation
fix(api): resolve user authentication bug
docs: update installation instructionsSimple Format
Add JWT token validation
Fix user authentication bug
Update installation instructionsDetailed Format
Add JWT token validation
Implement comprehensive JWT validation with proper error handling
and expiration checks to enhance authentication security.How It Works
Analysis: Gait analyzes your Git repository changes, including:
- File additions, modifications, and deletions
- Code diffs and context
- Change patterns and scope
AI Generation: Uses OpenAI's GPT-4 to generate contextually appropriate commit messages following best practices
Validation: Validates the generated message against:
- Length limits
- Conventional commit format (when selected)
- Grammar and style guidelines
Commit: Optionally creates the commit with the generated message
Configuration
Gait can be configured through environment variables:
# Required: OpenAI API Key
OPENAI_API_KEY=your-api-key-here
# Optional: Default format
GAIT_DEFAULT_FORMAT=conventional
# Optional: Default max length
GAIT_DEFAULT_MAX_LENGTH=72Examples
Basic Workflow
# Make some changes to your code
echo "console.log('hello world');" >> index.js
# Generate and review a commit message
gait generate
# Output: feat: add hello world logging
# Commit with interactive review
gait commit --interactiveWorking with Staged Changes
# Stage specific files
git add src/auth.ts src/types.ts
# Commit only staged changes
gait commit --staged-onlyMultiple File Types
# After updating docs and fixing bugs
gait generate
# Output: fix(auth): resolve token expiration handling
# Check what would be committed
gait commit --dry-runBest Practices
- Stage Related Changes: Group related changes together for better commit messages
- Use Interactive Mode: Review generated messages for accuracy
- Check Status First: Use
gait statusto understand your changes - Meaningful Changes: Make atomic commits with clear purposes
Contributing
We welcome contributions! Please see our Contributing Guide for details.
License
ISC
Support
- 🐛 Issues: GitHub Issues
- 📖 Documentation: Full Documentation
- 💬 Discussions: GitHub Discussions
Made with ❤️ for developers who care about clean Git history
