Thank you for your interest in contributing to Canon! This document provides guidelines and instructions for contributing.
- Go 1.22 or later
- Node.js 18+ (for running generated TypeScript)
- npm (for TypeScript dependencies)
# Clone the repository
git clone https://github.com/WarforgeTech/canon.git
cd canon
# Build the CLI
make build
# Run tests
make test
# Verify everything works
./bin/canon build examples/hello/hello.canon.json- Check if the bug has already been reported in Issues
- If not, create a new issue using the bug report template
- Include steps to reproduce, expected behavior, and actual behavior
- Check existing issues and discussions for similar ideas
- Create a new issue using the feature request template
- Describe the use case and why this feature would be valuable
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
make test) - Commit your changes with a clear message
- Push to your fork
- Open a Pull Request
- Follow standard Go conventions
- Run
go fmtbefore committing - Add tests for new functionality
- Keep functions focused and well-documented
- Use TypeScript strict mode
- Document public APIs with JSDoc comments
# Run all Go tests
make test
# Run tests with verbose output
go test -v ./...
# Run a specific test
go test -v ./pkg/validate -run TestTypechecking- Add unit tests for new functions in
*_test.gofiles - Add integration tests for CLI commands in
cmd/canon/integration_test.go - For Canon programs, add golden tests in the
.canon.jsonfile
- Keep PRs focused on a single change
- Update documentation if needed
- Ensure all tests pass
- Add tests for new functionality
- Reference related issues in the PR description
canon/
├── cmd/canon/ # CLI commands
├── pkg/
│ ├── ir/ # Intermediate representation types
│ ├── validate/ # Validation (schema, types, effects)
│ ├── codegen/ # Code generation (TypeScript)
│ ├── policy/ # OPA/Rego policy engine
│ └── testing/ # Test runner
├── runtime-ts/ # TypeScript runtime library
├── schemas/ # JSON Schema definitions
├── policies/ # Default Rego policies
└── examples/ # Example Canon programs
- Open a Discussion for questions
- Check the documentation for detailed specifications
By contributing, you agree that your contributions will be licensed under the MIT License.