Skip to content

Commit 9fd2a05

Browse files
committed
Merge remote-tracking branch 'benma/agent'
2 parents c7e4bdd + da65182 commit 9fd2a05

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

‎AGENTS.md‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Repository Guidelines
2+
3+
This repo contains both a Rust library and a NPM library.
4+
5+
## Versioning
6+
- The Rust client version is in Cargo.toml. The changelog is in CHANGELOG-rust.md. The readme is in README-rust.md
7+
- The NPM client version is in NPM_VERSION. The changelog is in CHANGELOG-npm.md. The readme is in README-npm.md.
8+
9+
## Project Structure & Module Organization
10+
- `src/`: core Rust library (transport, protocol, coin-specific modules).
11+
- `tests/`: integration tests; prefer adding new end-to-end flows here.
12+
- `examples/`: runnable usage samples (`cargo run --example …`) for common flows.
13+
- `messages/`: protobuf definitions; regenerated via `make build-protos`.
14+
- `sandbox/`: browser demo for the WASM/JS API, used with WebHID.
15+
- `scripts/`: build utilities (for example, protocol buffer generation).
16+
17+
## Build, Test, and Development Commands
18+
- `cargo build` – build the Rust crate.
19+
- `cargo test` – run unit and integration tests.
20+
- `cargo fmt` – format Rust code using the repo’s `rustfmt` settings.
21+
- `make build-protos` – regenerate Rust code from `messages/*.proto`.
22+
- `make wasm` – build the WASM/JS package (`pkg/`) via `wasm-pack`.
23+
- `make build-sandbox` - build the WebHID sandbox in `sandbox/`.
24+
- `make run-sandbox` – start the WebHID sandbox in `sandbox/` for manual testing.
25+
26+
## Coding Style & Naming Conventions
27+
- Rust edition 2021; rely on `cargo fmt` for formatting (4-space indents, standard rustfmt defaults).
28+
- Modules and files: `snake_case`; types and traits: `PascalCase`; functions and methods: `snake_case`.
29+
- Prefer explicit, typed errors using `thiserror`; avoid `unwrap`/`expect` in library code.
30+
31+
## Testing Guidelines
32+
- Place integration tests in `tests/` and unit tests next to the code in `src/`.
33+
- Name tests after the behavior under test (for example, `sign_psbt_roundtrip`).
34+
- Run `cargo test` before opening a PR; for deeper changes, consider `cargo tarpaulin --features=simulator,tokio --out Html`.
35+
- Check README-rust.md for how to run simulator tests.
36+
- Check ./ci/ci.sh for how to run tests
37+
- `cargo test` will output a lot of warnings, that is normal without the right features selected (see ci.sh). Don't attempt to fix them if not prompted to do so.
38+
39+
## Commit & Pull Request Guidelines
40+
- Use short, focused commits; prefix with area when useful (for example, `btc: …`, `npm: …`, `tests: …`).
41+
- Write commit subjects in imperative mood (for example, `add OP_RETURN example`).
42+
- PRs should describe motivation, key changes, and any API or protocol impacts; link related issues and mention how it was tested (commands, examples, or sandbox runs).
43+

0 commit comments

Comments
 (0)