An interactive CI/CD simulator and lightweight pre-push code reviewer using Gemini AI
npm install codeflow-hookbash
npm install -g codeflow-hook
`
$3
`bash
npm install --save-dev codeflow-hook
`
⚙️ Quick Start
$3
Choose your AI provider and configure with your API key:
`bash
Gemini (default, recommended)
codeflow-hook config -p gemini -k YOUR_GEMINI_API_KEY
OpenAI
codeflow-hook config -p openai -k YOUR_OPENAI_API_KEY
Claude/Anthropic
codeflow-hook config -p claude -k YOUR_CLAUDE_API_KEY
`
$3
`bash
codeflow-hook install
`
$3
`bash
Analyze your current changes
git diff | codeflow-hook analyze-diff
Or let the hooks run automatically on commit/push
git add .
git commit -m "feat: add new feature"
`
🛠️ Commands
$3
`bash
codeflow-hook config # Configure AI provider settings
codeflow-hook install # Install git hooks
codeflow-hook analyze-diff # Analyze code changes
codeflow-hook index # Build local knowledge base
codeflow-hook status # Check installation status
`
$3
`bash
Configure with Gemini (default)
codeflow-hook config -p gemini -k your-api-key
Install hooks in current project
codeflow-hook install
Analyze staged changes
git diff --staged | codeflow-hook analyze-diff
Build project knowledge base
codeflow-hook index
Check everything is working
codeflow-hook status
`
🔧 Configuration
Configuration is stored in ~/.codeflow-hook/config.json:
`json
{
"provider": "gemini",
"apiKey": "your-api-key",
"model": "gemini-1.5-pro-latest"
}
`
$3
- Gemini: provider: "gemini" - Google AI (recommended)
- OpenAI: provider: "openai" - GPT models
- Claude: provider: "claude" - Anthropic models
📋 Requirements
- Node.js 16+
- Git repository
- AI API key (Gemini, OpenAI, or Claude)
🔒 Security & Privacy
- Local Processing: All code analysis happens on your machine
- API Keys Stored Locally: Keys are stored in ~/.codeflow-hook/config.json
- No Data Collection: Code diffs are only sent to your configured AI provider
- No Telemetry: No usage data is collected or transmitted
🐛 Troubleshooting
$3
"No configuration found"
`bash
codeflow-hook config -k YOUR_API_KEY
`
Hooks not running
`bash
codeflow-hook install
On Windows, ensure hooks are executable
`
API errors
- Verify your API key is valid and has quota remaining
- Check your internet connection
- Try a different AI provider
$3
If automatic installation fails:
1. Create .git/hooks/pre-commit:
`bash
#!/bin/sh
codeflow-hook analyze-diff
`
2. Make it executable:
`bash
chmod +x .git/hooks/pre-commit
`
📄 License
MIT License
🤝 Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Test thoroughly
5. Submit a pull request
---
🚀 Enhance your development workflow with AI-powered code analysis!
``bash