Contributing to Phoenix TUI Framework
November 3, 2025 ยท View on GitHub
Thank you for your interest in contributing to Phoenix!
๐ Quick Start
Prerequisites
- Go 1.25+ - Install Go
- Task - Install Task (recommended)
- golangci-lint - Install golangci-lint
Setup Development Environment
# Clone repository
git clone https://github.com/phoenix-tui/phoenix.git
cd phoenix
# Install Task (choose your platform)
# macOS/Linux:
brew install go-task
# Windows (Scoop):
scoop install task
# Windows (Chocolatey):
choco install go-task
# Or download from https://taskfile.dev/installation/
# Verify installation
task --version
# Show available tasks
task
๐ ๏ธ Development Workflow
Running Tests
# Run all tests with coverage
task test
# Run tests for specific package
task test:core
# Generate HTML coverage report
task test:coverage
# Opens coverage.html in browser
# Watch mode (requires entr or fswatch)
task test:watch
Code Quality
# Run linter
task lint
# Run linter and auto-fix issues
task lint:fix
# Format code
task fmt
# Run all quality checks
task check # fmt + vet + lint + test
# Pre-commit checks (recommended before git commit)
task dev # fmt + vet + lint:fix + test
Building
# Build all packages
task build
# Build example applications
task build:examples
# Creates bin/basic.exe, bin/unicode.exe
# Run examples
task run:basic
task run:unicode
Benchmarks
# Run all benchmarks
task bench
# Run core benchmarks only
task bench:core
# Run Unicode benchmarks (Week 4)
task bench:unicode
# Compare benchmarks
task bench:compare
Dependencies
# Download and tidy dependencies
task deps
# Update all dependencies
task deps:update
# Verify dependencies
task deps:verify
Cleaning
# Remove build artifacts and coverage files
task clean
๐ Before Submitting PR
Run the development check:
task dev
This will:
- โ
Format code (
gofmt) - โ Run go vet
- โ Auto-fix linter issues
- โ Run all tests
If all checks pass, you're ready to commit!
๐ฟ Git-Flow Branching
Phoenix uses Git-Flow with main and develop branches:
# Main branches
main # Production releases (v0.1.0-beta.1, v0.1.0, etc.)
develop # Active development (default branch for PRs)
# Supporting branches
feature/* # New features (branch from develop)
release/* # Release preparation (branch from develop)
hotfix/* # Critical fixes (branch from main)
Creating a Feature Branch
# Start from develop
git checkout develop
git pull origin develop
# Create feature branch
git checkout -b feature/my-new-feature
# Work on your changes
# ... make commits ...
# Push to your fork
git push origin feature/my-new-feature
# Create Pull Request to develop branch
See WORKFLOW.md for complete git-flow documentation.
๐ Pull Request Process
1. Before Creating PR
- โ
Run
task dev(all checks must pass) - โ Update tests (coverage must not decrease)
- โ Update documentation if needed
- โ Follow commit message format (Conventional Commits)
- โ
Rebase on latest
develop
2. Creating PR
- Push your feature branch to your fork
- Open PR from your fork to
phoenix-tui/phoenix:develop - Fill out PR template (if provided)
- Add clear description of changes
- Link related issues (if any)
3. PR Requirements
Your PR must:
- โ Pass all CI checks (tests, lint, format)
- โ Maintain or improve test coverage (90%+ minimum)
- โ Have at least 1 approval from maintainer
- โ
No merge conflicts with
develop - โ Follow project code style
4. Code Review
- Maintainers will review within 1-3 business days
- Address feedback by pushing new commits
- Once approved, maintainer will merge (usually squash merge)
5. After Merge
- Your changes appear in next release
- Delete your feature branch
- Pull latest
develop
๐ฆ CI/CD Requirements
All PRs must pass these automated checks:
1. Tests
go test -v -race -cover ./...
- All tests must pass
- No race conditions
- Coverage must not decrease below current (93.5%)
2. Linter
golangci-lint run --config .golangci.yml ./...
- Zero linter issues (enforced)
- See
.golangci.ymlfor enabled linters
3. Format
gofmt -l .
- All code must be formatted with
gofmt - Zero unformatted files
4. Go Vet
go vet ./...
- Must pass with zero suspicious constructs
5. Build
go build ./...
- All packages must compile successfully
- Works on Linux, macOS, Windows
CI Pipeline: Automated via GitHub Actions on every push/PR
๐ง Alternative: Without Task
If you prefer not to use Task, here are the raw commands:
# Run tests
go test -v -race -cover ./...
# Run linter
golangci-lint run --config .golangci.yml ./...
# Format code
go fmt ./...
# Run vet
go vet ./...
# Build
go build ./...
# Run benchmarks
go test -bench=. -benchmem ./...
# Coverage report
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
๐ฆ Project Structure
phoenix/
โโโ core/ # Foundation library (terminal, Unicode, capabilities)
โโโ style/ # Styling library (colors, borders, padding)
โโโ tea/ # Event loop (Elm Architecture)
โโโ layout/ # Layout system (flexbox, grid)
โโโ render/ # High-performance renderer
โโโ components/ # UI components (input, list, table, etc.)
โโโ mouse/ # Mouse events
โโโ clipboard/ # Clipboard operations
โโโ examples/ # Example applications
โโโ docs/ # Documentation
โโโ benchmarks/ # Performance benchmarks
โโโ Taskfile.yml # Task automation
โโโ .golangci.yml # Linter configuration
๐งช Testing Standards
Phoenix has strict testing requirements:
- Domain Layer: 95%+ coverage (pure business logic)
- Application Layer: 90%+ coverage (use cases)
- Infrastructure Layer: 80%+ coverage (integration tests)
- API Layer: 85%+ coverage (example-based tests)
- Overall Project: 90%+ minimum
Current coverage: 93.5% average โ
Coverage by library:
- core: 98.4% | style: 90%+ | tea: 95.7% | layout: 97.9%
- components: 94.5% | render: 91.7% | mouse: 99.7% | clipboard: 82.0%
Quality: 36,000 lines of test code, 4,340+ test cases, 3 critical bugs found and fixed
๐ Commit Message Format
Follow Conventional Commits:
<type>(<scope>): <description>
[optional body]
[optional footer]
Types:
feat- New featurefix- Bug fixdocs- Documentation changesstyle- Code style changes (formatting, not styling library)refactor- Code refactoringtest- Adding or updating testschore- Maintenance tasks
Examples:
feat(core): add Unicode width calculation
fix(style): resolve emoji rendering bug
docs(api): update terminal API examples
test(core): add property-based tests for Cell
chore: add golangci-lint configuration
๐ฏ Code Style
- Language: All code comments and documentation in English
- Formatting: Use
gofmt(enforced by CI) - Linting: Pass
golangci-lintchecks (see.golangci.yml) - Naming: Follow Go conventions (PascalCase for exported, camelCase for unexported)
- Comments:
- Package comments required (revive)
- Exported functions must have comments
- Comments should end with period (godot)
๐ซ What NOT to Commit
*.exe- Build artifactscoverage.out,coverage.html- Coverage reports.claude/settings.local.json- Personal AI settingsbin/- Build output directorynul- Windows temp files
See .gitignore for full list.
๐ค Getting Help
- API Documentation: pkg.go.dev/github.com/phoenix-tui/phoenix
- Roadmap: See ROADMAP.md for project timeline
- Issues: GitHub Issues (when repo is public)
- Discussions: GitHub Discussions (when repo is public)
Last updated: 2025-11-03 | Status: PRODUCTION READY