Files
EVOLV/tools/contract-verify/README.md
znetsixe 3ff75fcb09 tools: add contract-verify and flow-lint (JS native, repo-rule-aware)
- tools/contract-verify/ — diffs CONTRACT.md ## Inputs table vs
  src/commands/index.js registry. First run found 3 real drifts:
  MGC has `set.scaling` in CONTRACT (not in registry); monster + settler
  registry has `child.register` (not in CONTRACT); pumpingStation registry
  has `set.outflow` (not in CONTRACT).
- tools/flow-lint/ — lints examples/*.flow.json against the rules in
  .claude/rules/node-red-flow-layout.md. First run flagged the
  monster/basic flow (4 ui-* at 0,0 + ui-chart missing interpolation
  property) and rotatingMachine/edge.flow.json (6 ui-* at 0,0).
- Both tools are read-only, single-binary npm packages with a `--json`
  output mode for CI, exit code 1 on drift. Encode the rules so we
  don't have to re-discover the bugs that motivated them.

Per CLAUDE.md tooling doctrine: prefer these over ad-hoc grep/jq.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 09:38:53 +02:00

34 lines
1004 B
Markdown

# @evolv/contract-verify
Verify that `nodes/<n>/CONTRACT.md`'s topic table matches the canonical
registry in `nodes/<n>/src/commands/index.js`.
## Usage
```bash
# verify every node with a CONTRACT.md
node tools/contract-verify/bin/contract-verify.js
# verify one node
node tools/contract-verify/bin/contract-verify.js nodes/rotatingMachine
# CI-friendly JSON output
node tools/contract-verify/bin/contract-verify.js --json
```
Exit code `1` on any drift; `0` if every checked node agrees.
## What it checks
1. Every `topic:` in the registry appears as a canonical row in the `## Inputs` table.
2. Every canonical row in the `## Inputs` table is registered.
3. The `aliases:` array on each descriptor matches the "Aliases" column.
## What it does NOT check
- Payload schemas (registry's `payloadSchema` vs. the "Payload" column).
- The "Effect" description column.
- Output ports — see `tools/output-manifest-verify/`.
Run after touching `src/commands/index.js` or `CONTRACT.md` in any node.