From ba2cb4952e225fa84e029a1d74579cf54a7d36a1 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 3 Sep 2026 18:02:09 +0000 Subject: [PATCH] docs: add AGENTS.md with repo invariants for coding agents Short router for agent executors. Commands, the 0.1.x lock, no auto-merge of release-please, key redaction, and wasm/config contracts. Facts point at README, release-please-config.json, and tests/release_lock.rs. Closes #25 Co-authored-by: Duyet Le Co-authored-by: duyetbot --- AGENTS.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..9640edd --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,34 @@ +# AGENTS.md + +Native Rust CLI (`anyr`) for the AnyRouter gateway. One crate, lib plus bin. Stay on 0.1.x. + +## Commands + +| Task | Command | +| --- | --- | +| Test | `cargo test --locked --all-targets` | +| Clippy | `cargo clippy --locked --all-targets` | +| Format | `cargo fmt --check` | +| Size | `python scripts/bench.py measure --bin target/release/anyr --asset anyr-linux-x86_64 --kind native --out /tmp/anyr-bench.json` (stripped linux x86_64 ≤ 4.0 MiB / 4194304 bytes) | + +Version lock is also enforced in `tests/release_lock.rs`. + +## Invariants (do not break) + +- Keep `Cargo.toml`, `package.json`, and `.release-please-manifest.json` on 0.1.x. `release-please-config.json` uses `"versioning": "always-bump-patch"`, so `feat!` still bumps patch only. +- Never auto-merge release-please PRs. A human merges them. +- Do not rename fields in `~/.anyrouter/config.yaml`. The TypeScript CLI reads the same file (`relay_token`, `relay_device_id`, and the rest). +- Never print full API keys (`sk-ar-v1-…`) or relay tokens (`rk_…`). Mask with `mask_api_key`. Tests such as `upgrade_does_not_print_full_sk_ar_key` assert redaction. +- Keep wasm building with `--no-default-features`. New deps on the non-native path must compile there. + +## Conventions + +- Conventional commits. `.githooks/prepare-commit-msg` appends two Co-authored-by trailers. Opt out with `ANYR_SKIP_COAUTHORS=1`. Enable with `./scripts/install-hooks.sh`. +- Error strings are human sentences. Use `map_err` plus `format!` and name the failing subject. +- Unit tests live in `#[cfg(test)]` next to the module. Integration tests spawn `env!("CARGO_BIN_EXE_anyr")` with a fresh `ANYROUTER_HOME`. + +## Gotchas + +- `ratatui = "=0.29.0"` and `crossterm = "=0.28.1"` are exact-pinned on purpose. +- npm `@anyr/cli@latest` is still the old JS CLI. Native publishes use `--tag next` until a human retags. +- Beta prereleases come from the `ci.yml` matrix on every push to `main`.