Thanks for contributing! This guide covers everything you need.
git clone https://github.com/GrayCodeAI/tok.git && cd tok
go mod download
make test # verify setup
make build # build binaryBrowse open issues and look for:
good first issue— great for newcomershelp wanted— we'd love your helpbug— fix something brokenenhancement— add new features
Comment on the issue to claim it before starting work.
git checkout -b feat/my-feature # new feature
git checkout -b fix/my-bug-fix # bug fix
git checkout -b docs/my-docs # documentationCode style:
- Run
make lintbefore committing - Follow
gofmtformatting (enforced by CI) - Write tests for new functionality
- Keep functions focused and under 50 lines when possible
Commit messages:
- Use Conventional Commits
- Format:
type(scope): description - Types:
feat,fix,docs,refactor,test,chore
feat(filter): add semantic chunk compression layer
fix(commands): handle nil args in compress command
docs(readme): update installation instructionsmake test # all tests
make test-race # race detector
make test-cover # coverage report
make lint # golangci-lint
make typecheck # go vetPush your branch and open a pull request at github.com/GrayCodeAI/tok/pulls.
PR checklist:
- Tests pass (
make test) - Lint clean (
make lint) - Commit messages follow Conventional Commits
- Documentation updated (README, docs, etc.)
- CHANGELOG.md updated (for user-facing changes)
tok/
├── cmd/tok/ # CLI entry point
├── internal/
│ ├── commands/ # Command implementations (cobra)
│ │ ├── core/ # Primary commands
│ │ ├── system/ # System utilities
│ │ ├── filtercmd/ # Filter pipeline
│ │ └── ... # 17 more categories
│ ├── compressor/ # Input compression
│ ├── filter/ # Output filtering (31 layers)
│ └── output/ # Output abstraction layer
├── agents/ # AI agent rules
├── hooks/ # Shell scripts
└── config/ # TOML configs + filters
- Create a file in the appropriate
internal/commands/<category>/directory - Register it with the command registry:
package mycategory
import (
"github.com/spf13/cobra"
"github.com/GrayCodeAI/tok/internal/commands/registry"
)
func init() {
registry.Register(&cobra.Command{
Use: "my-command",
Short: "Brief description",
RunE: runMyCommand,
})
}
func runMyCommand(cmd *cobra.Command, args []string) error {
// Your implementation
return nil
}- Add tests in
mycommand_test.go - Update docs if needed
New compression layers go in internal/filter/. See docs/LAYERS.md for the layer architecture and internal/filter/AGENTS.md for implementation guidelines.
# Run all tests
make test
# Run specific package
go test ./internal/filter/... -v
# Run with coverage
go test ./... -coverprofile=coverage.out
go tool cover -html=coverage.out
# Run fuzz tests
go test ./internal/filter/... -fuzz=FuzzPipelineProcess
go test ./internal/toml/... -fuzz=FuzzTOMLFilterParse- Create a tag:
git tag v0.XX.0 - Push tag:
git push origin v0.XX.0 - GitHub Actions builds binaries, generates SBOM, and creates release
- Homebrew tap updates automatically
See CODE_OF_CONDUCT.md. Be respectful and constructive.
- Open a discussion
- File an issue
- Read the docs