Thank you for your interest in contributing to wtp! This document provides guidelines and information for contributors.
This project adheres to a code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.
Before creating an issue, please:
- Check if the issue already exists in the issue tracker
- Use the search function to avoid duplicates
- Provide clear reproduction steps and expected vs actual behavior
- Include your environment details (OS, Go version, git version)
We welcome feature suggestions! Please:
- Check existing issues and discussions first
- Clearly describe the use case and benefits
- Consider implementation complexity and maintenance burden
- Be open to discussion and alternative approaches
# Clone the repository
git clone https://github.com/satococoa/wtp.git
cd wtp
# Install dependencies
go mod download
# Build the project
make build
# Run tests
make test
# Run linting
make lint
# Install locally for testing
make install- Fork the repository on GitHub
- Create a feature branch from
main:git checkout -b feature/your-feature-name
- Make your changes following our coding standards
- Write tests for new functionality
- Run the test suite to ensure nothing is broken
- Commit your changes with clear commit messages
- Push to your fork and create a pull request
- Follow standard Go formatting (
gofmt) - Use meaningful variable and function names
- Add comments for exported functions and complex logic
- Keep functions focused and reasonably sized
- Handle errors properly - don't ignore them
Follow conventional commit format:
type(scope): description
[optional body]
[optional footer]
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Examples:
feat(add): implement branch resolution from remotes
fix(remove): handle worktrees with uncommitted changes
docs: update installation instructions
# Run all tests
make test
# Run tests with coverage
make test-coverage
# Run integration tests
make test-integration
# Run specific test
go test ./internal/git -v- Write unit tests for all new functionality
- Use table-driven tests for multiple test cases
- Mock external dependencies (git commands, file system)
- Test both success and error scenarios
- Integration tests should use temporary git repositories
Example test structure:
func TestBranchResolution(t *testing.T) {
tests := []struct {
name string
branch string
expected string
wantErr bool
}{
{
name: "local branch exists",
branch: "feature/test",
expected: "feature/test",
wantErr: false,
},
// ... more test cases
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Test implementation
})
}
}- Tests pass locally
- Code is properly formatted (
make fmt) - Linting passes (
make lint) - Documentation is updated if needed
- CHANGELOG.md is updated for user-facing changes
Include:
- What: Brief description of changes
- Why: Motivation and context
- How: Implementation approach if complex
- Testing: How you tested the changes
- Breaking Changes: If any, with migration guide
- Automated checks must pass (CI/CD)
- At least one maintainer review required
- Address feedback promptly
- Keep discussions focused and constructive
- Squash commits before merge if requested
wtp/
├── cmd/ # Command implementations
│ ├── add.go
│ ├── remove.go
│ ├── list.go
│ └── init.go
├── internal/ # Internal packages
│ ├── git/ # Git operations
│ ├── config/ # Configuration handling
│ └── hooks/ # Hook execution
├── pkg/ # Public packages (if any)
├── testdata/ # Test fixtures
├── docs/ # Documentation
├── scripts/ # Build and utility scripts
└── Makefile # Build automation
- Simplicity: Prefer simple, readable solutions
- Reliability: Handle errors gracefully, fail safely
- Performance: Efficient git operations, minimal overhead
- Compatibility: Support multiple git versions and platforms
- Extensibility: Design for future enhancements
- Keep README.md up to date
- Document new features and configuration options
- Include examples for complex functionality
- Update AGENTS.md (CLAUDE.md is a symlink for backward compatibility) for design decisions
- Add inline comments for complex logic
Releases are handled by maintainers:
- Version bump in relevant files
- Update CHANGELOG.md
- Create git tag
- GitHub Actions builds and publishes binaries
- Update Homebrew formula if needed
- Open an issue for bugs or feature requests
- Start a discussion for questions or ideas
- Check existing documentation and issues first
- Be patient and respectful in communications
- Go: Latest stable version
- Git: 2.25+ recommended
- Make: For build automation
- golangci-lint: For linting
- VS Code with Go extension (optional but recommended)
make help # Show available targets
make build # Build binary
make test # Run tests
make test-coverage # Run tests with coverage
make lint # Run linter
make fmt # Format code
make clean # Clean build artifacts
make install # Install locallyThank you for contributing to wtp! Your efforts help make Git worktree management better for everyone.