This guide helps you set up your development environment for contributing to reviewtask.
-
Go 1.21+
go version # Should show go1.21 or higher -
Git
git --version
-
GitHub CLI (gh)
gh --version
-
Claude CLI
claude --version
- Make - For using Makefile commands
- jq - For JSON processing in scripts
- golangci-lint - For code linting
# Fork on GitHub first, then:
git clone https://github.com/YOUR_USERNAME/reviewtask.git
cd reviewtask
git remote add upstream https://github.com/biwakonbu/reviewtask.gitgo mod download
go mod verify# Install pre-commit
pip install pre-commit
# Install hooks
pre-commit install# Using GitHub CLI (recommended)
gh auth login
# Or set environment variable
export GITHUB_TOKEN="your_github_token"# Install Claude CLI if not already installed
# Follow instructions at https://claude.ai/code
# Verify installation
claude --versiongo build -o reviewtask main.goVERSION=$(git describe --tags --always --dirty)
COMMIT=$(git rev-parse --short HEAD)
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
go build -ldflags "\
-X main.version=$VERSION \
-X main.commitHash=$COMMIT \
-X main.buildDate=$DATE" \
-o reviewtask main.go# Build for all platforms
./scripts/build.sh all
# Build for specific platform
./scripts/build.sh linux-amd64# Run all tests
go test ./...
# Run with coverage
go test -cover ./...
# Run specific package tests
go test ./internal/ai
# Verbose output
go test -v ./...# Run golden tests
go test ./internal/ai -run Golden
# Update golden files when needed
UPDATE_GOLDEN=1 go test ./internal/ai -run Golden# Run integration tests
go test ./test -tags integration
# With real GitHub API (requires token)
GITHUB_TOKEN=$YOUR_TOKEN go test ./test -tags integration# Generate coverage report
go test -coverprofile=coverage.out ./...
# View coverage in browser
go tool cover -html=coverage.out# Use debug commands
reviewtask debug fetch review 123
reviewtask debug fetch task 123
reviewtask debug prompt 123# Install delve
go install github.com/go-delve/delve/cmd/dlv@latest
# Debug the application
dlv debug main.go -- fetch 123
# Set breakpoints
(dlv) break internal/ai/analyzer.go:100
(dlv) continueEnable verbose mode in configuration:
{
"ai_settings": {
"verbose_mode": true
}
}# Format all Go files
go fmt ./...
# Or use gofmt directly
gofmt -w .# Install golangci-lint
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# Run linters
golangci-lint run
# Fix issues automatically
golangci-lint run --fix# Run all pre-commit hooks
pre-commit run --all-files
# Run specific hook
pre-commit run go-fmt --all-files- Create file in
cmd/directory - Implement command using Cobra
- Add to root command
- Add tests
- Update documentation
- Edit template in
prompts/directory - Test with debug command:
reviewtask debug prompt 123
- Update golden tests if needed
- Test with real PR
- Update
internal/config/config.go - Add default value
- Update
docs/user-guide/configuration.md - Add migration logic if needed
- Understand PR-specific directory structure
- Use WriteWorker for concurrent writes
- Always use mutex for file operations
- Test with multiple PRs
# Clean module cache
go clean -modcache
# Update dependencies
go get -u ./...
# Tidy modules
go mod tidy# Clean build cache
go clean -cache
# Verbose build
go build -v -o reviewtask main.go# Skip cache
go test -count=1 ./...
# Run with race detector
go test -race ./...git checkout -b feature/your-feature-name- Write code
- Add tests
- Update documentation
# Run tests
go test ./...
# Build and test binary
go build -o reviewtask main.go
./reviewtask YOUR_PR_NUMBERgit add .
git commit -m "feat: your feature description"git push origin feature/your-feature-name
gh pr createIf using the Makefile:
make build # Build binary
make test # Run tests
make test-cover # Run tests with coverage
make lint # Run linters
make fmt # Format code
make clean # Clean build artifacts# Enable debug logging
export REVIEWTASK_DEBUG=true
# Skip version check
export REVIEWTASK_SKIP_VERSION_CHECK=true
# Use specific config file
export REVIEWTASK_CONFIG=/path/to/config.json# Update golden test files
export UPDATE_GOLDEN=1
# Skip integration tests
export SKIP_INTEGRATION=1
# Use test GitHub token
export TEST_GITHUB_TOKEN=your_test_token.vscode/settings.json:
{
"go.lintTool": "golangci-lint",
"go.formatTool": "gofmt",
"go.testFlags": ["-v"],
"go.testTimeout": "30s"
}- Open project
- Configure Go SDK
- Enable Go modules
- Set up run configurations
- Check Troubleshooting Guide
- Search GitHub Issues
- Ask in Discussions
- Review Contributing Guidelines