A Go-based detection system for analyzing project dependencies and vulnerabilities.
- Dependency Analysis: Scans and analyzes project dependencies across multiple languages and package managers
- AI-Powered Git Commit Messages: Automatically generates meaningful commit messages using OpenAI
- Multi-language Support: Handles Go, Ruby, Node.js, Python, and other ecosystems
- Fast Detection: Efficient scanning with minimal overhead
This project includes an intelligent git hook that automatically generates commit messages using OpenAI's GPT models.
-
Set your OpenAI API key:
export OPENAI_API_KEY="your-api-key-here"
-
The hook is already installed in
.git/hooks/commit-msg
(Go binary)
The hook supports two modes:
For fast commit message generation based on file list only:
git commit -m ".."
- ✅ Fast and cost-effective
- ✅ Good for simple changes
- ✅ Lists modified files without showing content
For detailed commit message generation based on actual code changes:
git commit -m "..."
- ✅ Analyzes actual code differences
- ✅ More accurate commit messages
- ✅ Better for complex changes
# Quick mode - generates message from file list
git add . && git commit -m ".."
# → "Update Go modules and add new test files"
# Detailed mode - analyzes actual changes
git add . && git commit -m "..."
# → "Add error handling and fix nil pointer dereference"
- Static File Detection: Automatically identifies CSS, HTML, images, etc.
- Smart Diff Analysis: Excludes binary files and focuses on code changes
- Error Handling: Graceful fallback if API is unavailable
- Debug Logging: Detailed logs in
.git/commit-msg-debug.log
- No Dependencies: Single Go binary, no Ruby gems required
You can modify the hook behavior by editing commit-msg.go
and recompiling:
go build -o .git/hooks/commit-msg commit-msg.go
chmod +x .git/hooks/commit-msg
- Go 1.19+
- OpenAI API key for commit message generation
go build -o sitedog-detection main.go
go test ./...
github.com/sashabaranov/go-openai
- OpenAI API client
├── main.go # Main detection logic
├── commit-msg.go # AI commit message generator
├── integration_test.go # Integration tests
├── main_test.go # Unit tests
├── data/ # Detection data and patterns
├── testdata/ # Test fixtures
└── .git/hooks/ # Git hooks (includes compiled commit-msg)
make uncommit # Soft reset last commit (useful for re-generating messages)
make push # Push to origin
make pull # Pull from origin
make trunk # Switch to main/master branch
This project is licensed under the MIT License.