Quickstart
Install Git, Node.js 20 or later with npm, and Rust via rustup. Run in Bash on Linux or macOS.
git clone https://github.com/pmdroid/rulecheck.gitcd rulechecknpm ci --ignore-scriptscargo build --lockedbash docs/examples/run.shThe script uses the debug evaluator from cargo build --locked. To run it against a release build instead, set RULECHECK_BIN=target/release/rulecheck. It runs the actual builder and evaluator in a temporary Git repository. It checks expected exit codes and output for all cookbook recipes and an invalid policy. It removes the temporary repository on exit.
Install the rulecheck command
Section titled “Install the rulecheck command”Install once from a clone that stays in place. The command uses the builder, pinned TypeScript, and release evaluator from that clone, never from the repository it checks.
git clone https://github.com/pmdroid/rulecheck.git ~/.local/share/rulecheckcd ~/.local/share/rulechecknpm ci --ignore-scriptscargo build --locked --releasemkdir -p ~/.local/binln -sf "$PWD/bin/rulecheck.mjs" ~/.local/bin/rulecheckexport PATH="$HOME/.local/bin:$PATH" # add this line to your shell profile tooCheck your repository
Section titled “Check your repository”Put rules in .rulecheck/rules/**/*.rule.ts, stage new candidate files, and run one command from the checkout root:
git add -Arulecheck test # run rule fixturesrulecheck check # 0 clean, 1 findings, 2 cannot judgeA text rule whose paths match no tracked file makes check exit 2 with empty text scope, so stage the files the rule covers before the first check. To type-check rules against the SDK, see Authoring rules.
From another directory, use rulecheck check --root /path/to/checkout. The policy goes straight from the builder to the evaluator through a pipe. No policy.json is written, and nothing from the checked repository is imported or run, including its package scripts and node_modules.
rulecheck check reads the working-tree contents of tracked regular files. Pass a full --commit SHA to inspect committed blobs instead.