This document contains development-specific information for contributors and maintainers of AI Rebaser.
The project includes comprehensive unit and integration tests:
# Run all tests (unit tests only, no API calls)
go test ./...
# Run tests with verbose output
go test ./... -v
# Run tests with coverage
go test ./... -cover
# Run specific test suite
go test ./internal/notify -v
go test ./internal/config -v
go test ./internal/git -vIntegration tests demonstrate real-world scenarios with actual OpenAI API calls:
# Set required environment variable
export OPENAI_API_KEY="sk-your-api-key-here"
# Run integration tests (makes real API calls, costs ~$0.10-0.50)
go test ./test/integration -v -timeout 10m
# Run specific integration test scenarios
go test ./test/integration -v -run "TestRealWorldRebaseWorkflow"
go test ./test/integration -v -run "TestConflictScenarios"
go test ./test/integration -v -run "TestEndToEndWorkflow"
# Run error handling tests (no API calls required)
go test ./test/integration -v -run "TestErrorHandling"Note: Integration tests require a valid OpenAI API key and will make real API calls. Estimated cost per full test run is $0.10-0.50.
-
Unit Tests: Fast, isolated tests using mocks
cmd/ai-rebaser/main_test.go- Core orchestration logicinternal/config/config_test.go- Configuration loading
-
Integration Tests: End-to-end workflow demonstrations
cmd/ai-rebaser/integration_test.go- Full workflow testing
-
Mocks: Complete service mocks for testing
internal/mocks/- All service interface mocks
# Format code
go fmt ./...
# Run linting (if golangci-lint is installed)
golangci-lint run
# Tidy dependencies
go mod tidy
# Verify dependencies
go mod verify# Build for current platform
go build -o ai-rebaser ./cmd/ai-rebaser
# Build for Linux
GOOS=linux GOARCH=amd64 go build -o ai-rebaser-linux ./cmd/ai-rebaser
# Build for Windows
GOOS=windows GOARCH=amd64 go build -o ai-rebaser.exe ./cmd/ai-rebaser
# Build for macOS
GOOS=darwin GOARCH=amd64 go build -o ai-rebaser-mac ./cmd/ai-rebaserThis project uses Conventional Commits format:
feat:for new featuresfix:for bug fixesdocs:for documentation changesstyle:for code style changesrefactor:for code refactoringtest:for adding testschore:for maintenance tasks
Examples:
feat: add AI conflict resolution service
fix: resolve git rebase merge conflicts
docs: update installation instructions- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Write tests for your changes
- Implement your feature
- Run tests:
go test ./... - Commit with conventional format:
git commit -s -m "feat: add your feature" - Push and create PR:
git push origin feature/your-feature
- Follow Go best practices and idioms
- Write comprehensive tests for new functionality
- Use structured logging with logrus
- Implement proper error handling
- Document public APIs
- Use dependency injection for testability
- Core orchestration logic and workflow - Six-phase rebase process
- Configuration management - YAML-based with environment variable overrides
- Service interface definitions - Clean architecture with dependency injection
- Git operations - Hybrid go-git/command approach for comprehensive Git support
- OpenAI API integration - Real AI conflict resolution, commit messages, and PR descriptions
- GitHub API integration - Full PR management with rebase-based merging
- Slack webhook notifications - Rich notifications with attachments and error handling
- Comprehensive testing - Unit tests, integration tests, and real-world scenarios
- Mock-based testing framework - Complete service mocks for isolated testing
- CLI interface with Kong - User-friendly command-line interface
- Environment variable support - Secure configuration through environment variables
- Project structure and documentation - Production-ready codebase organization
- Configuration-driven test commands
- Enhanced retry logic and error handling
- Advanced conflict resolution strategies
- Metrics and monitoring integration
- Docker containerization
- Kubernetes deployment manifests
- CI/CD pipeline examples
- Performance optimizations
- Multi-repository support