Contributing
Getting Started
- Fork the repository
- Clone your fork
- Create a branch for your change
git clone https://github.com/<your-username>/typewriter.git
cd typewriter
git checkout -b feature/my-feature
Development Setup
Prerequisites
- Rust stable toolchain (1.70+)
cargo-instafor snapshot testing
Build & Test
# Build all crates
cargo build --workspace
# Run all tests
cargo test --workspace
# Run tests and accept new snapshots
cargo insta test --accept --workspace
# Check formatting
cargo fmt --all -- --check
# Run clippy
cargo clippy --workspace -- -D warnings
Project Structure
typewriter/
├── typewriter-core/ # IR types, TypeMapper trait, config
├── typewriter-engine/ # Parser, emitter, drift detection
├── typewriter-macros/ # #[derive(TypeWriter)] proc macro
├── typewriter-typescript/ # TypeScript emitter
├── typewriter-python/ # Python emitter
├── typewriter-go/ # Go emitter
├── typewriter-swift/ # Swift emitter
├── typewriter-kotlin/ # Kotlin emitter
├── typewriter-graphql/ # GraphQL SDL emitter
├── typewriter-json-schema/ # JSON Schema emitter
├── typewriter-cli/ # CLI tools
├── typewriter/ # Main crate (typebridge)
└── typewriter-test/ # Snapshot tests
Adding a New Language Emitter
- Create a new crate
typewriter-<lang> - Implement the
TypeMappertrait - Add to workspace and feature flags
- Add tests and snapshots
See the main CONTRIBUTING.md for detailed instructions.
Commit Messages
Use conventional commits:
feat: add Swift emitter
fix: handle Option<Option<T>> correctly
docs: add Go emitter guide
test: add snapshot tests for enums
Pull Request Process
- Ensure all tests pass
- Format your code
- Run clippy
- Update documentation
- Add changelog entry
- Open PR with description