Contributing
Contributions are welcome: bug reports, failing test cases, fixes and new checks.
What gets a pull request merged
Every branch and pull request runs three checks. All must pass.
| Check | What it runs | Run it yourself |
|---|---|---|
| All green | cargo fmt check, the crate layering rule, the diagnostic-owner map, cargo check --no-default-features, cargo test --workspace --all-features | bash scripts/ci.sh |
| Corpus map | tsox over TypeScript's own test suite compared with the recorded map: nothing may get worse, and an improvement must update the map | cargo xtask corpus run && cargo xtask corpus verify |
| Review | The owner (@Arun-murali0) approves the pull request. |
main stays clean: only changes that passed these checks reach it, by squash merge. Branches from the owner's account are merged automatically once they pass and a staging gate (tsox against real tsc on the fixtures) agrees. A pull request from anyone else is merged by the owner after review.
AI assistance
Much of tsox is drafted with AI assistance (Claude). A person reads and checks every change, and it must pass the same checks as any other. If you use an AI assistant for a pull request, you are responsible for what you send: read it, run the tests, and say in the description that an assistant helped. The design choices are made by the maintainer and recorded in decisions.
A change, step by step
- Fork and branch
- Failing case first
- Smallest change
- scripts/ci.sh
- Corpus map
- Pull request
- Fork, branch from
main. - Write a small failing case first: a fixture in
tests/fixtures/<area>/or a test intests/. - Make the smallest change that fixes it, in the lowest crate that can hold it (project structure).
bash scripts/ci.shuntil it passes.- If you changed checker behaviour, run the corpus and update the map when results improved (the corpus map). Describe what changed in the pull request.
- Open the pull request. Say what rule you implemented and which TypeScript behaviour it follows.
Reporting a problem
The most useful report is the smallest source that shows a difference from tsc, with both outputs and tsox --version. Crashes and hangs count as much as wrong diagnostics.
Where things live
- Parser-facing code is in
crates/tsox-checker/src/bridge/; the type system is incrates/tsox-types. - Rules are registries (passes, narrowers, equality rules, call effects, repairs): adding one is adding a row to a table. See registries.
- Diagnostics have owners: diagnostic owners.
- The design notes are under Architecture.
Working on the docs
The documentation site is the docs/ folder, built with VitePress.
cd docs
npm ci
npm run dev # live preview
npm run build # the same build CI runs- Link between documents with relative
.mdpaths, such as[arena](architecture/arena.md). They work on GitHub and on the site. A broken one fails the build. - Link to source files with a full GitHub URL, such as
https://github.com/tsoxide/tsox/blob/main/scripts/ci.sh. A relative path outsidedocs/is a dead link on the site. - Write a case study, not a changelog. Say what was planned, the issue that was found, what was changed and what it gained, and check each claim against the code.
- Visual pieces are components registered in
docs/.vitepress/theme:Flowfor a row of steps,Layersfor the crate stack,Stats, and the journey and workstream pages, which readdocs/.vitepress/data/. Update the data file when a milestone or a workstream changes state. - Angle brackets and
[x]()in prose are read as HTML and as links. Put types such asArray<T>in backticks.