Contributing
Open issues, propose language changes, improve docs, or build examples around real rules. Pull requests are welcome.
Setup
git clone https://github.com/lemma/lemma
cd lemma
cargo nextest run --workspace
Optional tools
For WASM development:
cargo install wasm-pack
For fuzzing (requires nightly Rust):
rustup install nightly
cargo install cargo-fuzz
For security audits:
cargo install cargo-deny
cargo deny check --config .cargo/deny.toml
Making changes
-
Write a test first
-
Make your changes
-
Run before submitting (from repo root):
cargo precommitSame pipeline as CI: versions-verify, fmt, clippy (
--all-features),cargo check -p lemma-engine --no-default-features, nextest (including ignored benches), WASM npm build+test, cargo-deny,cargo coverage all --check. Requirescargo-nextest,cargo-deny, Node.js, andwasm-pack. Regenerate coverage withcargo coverage allwhen engine/cli sources change (cargo-llvm-covrequired).
Release version (maintainers)
The workspace release is [workspace.package] version in the root Cargo.toml. The same number must appear in path-dep pins, Hex mix.exs, engine/README.md, and the VS Code extension package.json (see xtask/src/versions.rs module tracked).
cargo bump <semver>: update all locations, then refreshCargo.lock(cargo generate-lockfile), Hexmix.lock(mix deps.get), and VS Codepackage-lock.json(npm install --package-lock-only).cargo verify: confirm everything matches; CI runs this in the lint job.
Do not hand-edit those copies unless you keep them in sync.
Pull requests
Automated checks that must pass:
- Tests (stable + beta Rust), including WASM npm
build.js+test.js - Clippy linting
- Formatting (rustfmt)
- Security audit (cargo-deny)
- Quick fuzz tests (30s)
- Coverage reports up to date (
cargo coverage all --check)
Project structure
cli/: CLI application (HTTP server, MCP server, interactive mode, formatter)engine/: core parser, planner, and evaluatorengine/fuzz/: fuzz testing targetsopenapi/: Lemma-to-OpenAPI generation
Testing
Unit and integration tests
cargo nextest run --workspace
Hex NIF (ExUnit):
cd engine/packages/hex && mix test
See engine/tests/README.md (catalog + semantics audit) and cli/tests/README.md.
Fuzz testing
Requires nightly Rust:
cd engine/fuzz
cargo +nightly fuzz list
cargo +nightly fuzz run fuzz_parser -- -max_total_time=60
WASM build and test
cargo precommit runs these from engine/packages/npm automatically. To run manually:
cd engine/packages/npm
node build.js # wasm-pack → lemma.bindings.js; copies entrypoints and lsp-client
node test.js