Requires Nix with flakes enabled.
direnv allow # or: nix developcargo build --workspace
cargo test --workspace
cargo clippy --workspace -- -D warnings
cargo fmt --checkbuild # alias: bazel build //...
check # alias: bazel test //...Every module must produce identical results across all bindings. The tests/parity/ suite generates a golden.json from stdbr-core and validates Rust, Node.js, Python, FFI-C, and WASM against it.
bazel test //tests/parity/...When adding a new function to core, add the corresponding test cases to tools/parity_gen/src/main.rs and update every test_parity.* file.
- Create
bindings/<target>/withCargo.tomland source - Expose the same API surface as existing bindings (parse, validate, format, generate)
- Add
test_parity.*that readsgolden.jsonand validates all cases - Add build + test rules in
tests/parity/BUILD.bazel - Register the Cargo manifest in
MODULE.bazel
- Implement in
core/src/<module>.rs(no_std+alloc) - Export from
core/src/lib.rs - Add bindings in all targets:
ffi-c,nodejs,python,wasm - Add golden test cases in
tools/parity_gen/src/main.rs - Update all
test_parity.*files to cover the new module - If the module needs external data (like municipio uses IBGE), add a sync workflow in
.github/workflows/
stdbr/
core/ # stdbr-core (no_std Rust library)
bindings/
ffi-c/ # C/C++ FFI (staticlib + cbindgen)
nodejs/ # Node.js via napi-rs
python/ # Python via PyO3 + maturin
wasm/ # WebAssembly via wasm-bindgen
tools/
parity_gen/ # Golden test data generator
rules_rust_extras/ # Bazel custom rules (cbindgen)
tests/parity/ # Cross-binding parity tests
.github/workflows/ # CI + IBGE sync
flake.nix # Nix dev environment
MODULE.bazel # Bazel module config
This project uses Conventional Commits and release-please to automate versioning and changelogs.
Use the following prefixes in your commit or squash-merge messages:
| Prefix | Effect on version | Example |
|---|---|---|
fix: |
patch bump | fix(cpf): reject invalid check digits |
feat: |
minor bump | feat(cep): add state lookup |
feat!: / BREAKING CHANGE: |
major bump | feat!: change Cnpj API surface |
chore:, docs:, test: |
no release | chore(deps): update napi-rs |
Always squash-merge pull requests and make sure the final commit message follows the convention.
- Merges to
maintriggerrelease-please, which opens a release PR. - The release PR bumps
Cargo.toml,package.json,pyproject.toml, and updatesCHANGELOG.md. - Merging the release PR creates a git tag and GitHub Release.
- The
publish.ymlworkflow then publishes to crates.io, npm, PyPI, and attaches C/C++ artifacts to the GitHub Release.
For pre-releases, push changes to alpha, beta, or next branches.