# Contributing to agent-toolprint (Rust)
Thanks for considering a contribution. This is a small, sharp port — keep it that way and we'll merge fast.
## The one rule
This crate is a **port**, not a fork. The [TypeScript reference](https://github.com/p-vbordei/agent-toolprint) owns the SPEC and the conformance vectors. If you find a spec bug, fix it upstream first. Every code change here is either:
1. **Bringing the Rust impl in line with the SPEC and its vectors**, or
2. **Idiomatic-Rust polish** that does not change wire bytes.
If you can't say which of those your change is, do not commit.
## Setup
```bash
git clone https://github.com/p-vbordei/agent-toolprint-rs
cd agent-toolprint-rs
cargo test
```
Requires stable Rust (2021 edition).
## Day-to-day commands
```bash
cargo test # 3 tests, 15 vectors, <1s
cargo run --example quickstart # runnable demo
cargo fmt --all -- --check # format check
cargo clippy --all-targets --all-features -- -D warnings # lint
```
CI runs all of these. Pass locally → pass in CI.
## Workflow — TDD, always
1. Write a failing test that captures the new behaviour.
2. Run it — confirm it fails for the expected reason.
3. Write the smallest implementation that makes it pass.
4. Commit.
## Commit messages
```
<type>(<area>): <short summary>
```
Types: `feat`, `fix`, `test`, `chore`, `docs`, `refactor`, `ci`. Areas: `sign`, `verify`, `chain`, `types`, `canonical`, `did-key`, `envelope`, `conformance`.
## Adding a conformance vector
Vectors are **upstream**. Add the JSON to [the TS conformance suite](https://github.com/p-vbordei/agent-toolprint/tree/main/conformance/vectors), then copy it under `vectors/c<N>-<name>/<vector-name>.json` here. `tests/conformance.rs` discovers it automatically.
## Style
`rustfmt` + `clippy` handle everything. No suppressions without justification in the PR.
## Pull requests
- Branch off `main`. One feature or fix per PR.
- Include a test for any new behaviour.
- CI must be green before review.
## Reporting bugs
Open an issue with a minimal reproducer (a failing test against `main` is best). For SPEC questions, open the issue against the [TS reference](https://github.com/p-vbordei/agent-toolprint).
## Licensing
By submitting a contribution, you agree it ships under the project's [Apache 2.0](./LICENSE) license.