spec.md holds the GRC-20 specification, docs/ contains design rationale and requirements, and data/ stores sample datasets. The Rust workspace lives under rust/ with crates for the core library (crates/grc-20), benchmarks (crates/grc-20-bench), comparison tooling (crates/grc-20-compare), and a protobuf baseline (crates/grc-20-proto-bench). The TypeScript implementation is under typescript/ with src/ split into builder/, codec/, types/, genesis/, and util/, plus examples/ and scripts/.
cd rust && cargo build --releasebuilds all Rust crates.cd rust && cargo testruns Rust unit/integration tests in the workspace.cd rust/crates/grc-20-compare && cargo run --releaseruns the format comparison benchmark.cd typescript && npm installinstalls Node.js dependencies.cd typescript && npm run buildcompiles TypeScript todist/.cd typescript && npm testruns Vitest in Node;npm run test:browserruns the browser suite;npm run test:allruns both.cd typescript && npm run benchmarkruns the JS benchmark;npm run demoservesexamples/viahttp://localhost:3000/examples/browser-demo.html.
Rust uses edition 2024; follow standard Rust naming (snake_case functions/modules, CamelCase types) and rustfmt defaults. TypeScript uses 2-space indentation, camelCase for values, PascalCase for types, and kebab-case filenames (e.g., update-relation.ts). Keep exports grouped and commented in typescript/src/index.ts to match existing sections.
TypeScript tests use Vitest and live in typescript/src/test/*.test.ts. Rust tests should be colocated in crates with #[cfg(test)] or in tests/ for integration coverage. For codec changes, add encode/decode round-trip coverage and run npm run test:all plus cargo test.
Commit messages are short, imperative sentences without scope prefixes (e.g., “Update Rust implementation to latest spec”). PRs should describe behavior changes, mention spec updates (spec.md) when relevant, and list test commands run. Include benchmarks or demo screenshots only when performance or UI behavior changes.
When writing complex features or significant refactors, use an ExecPlan (as described in .agent/PLANS.md) from design to implementation.
The TypeScript codec lazily loads zstd WASM; call preloadCompression() when you need predictable startup. Treat data/ as large sample datasets; avoid modifying it unless the change is intentional.