feat(cli): run a repeatable IFC delivery check from a saved recipe
Merged
PE
3mo ago+1372+1372+0123456789012345678901234567890123456789-0-0-0123456789
Summary
Closes #3931.
- Add
ifc-lite delivery <recipe.json> [--json] [--out F] [--html F]: a repeatable, reviewable model-delivery check that packages the existing structural validation (ifc-lite validate) and IDS validation (ifc-lite ids) into one saved, versioned recipe. - Recipe shape:
{"models": ["model.ifc"], "structural": true, "ids": ["rules.ids"]}. Everymodels/idspath resolves relative to the recipe file's own directory. A recipe declaring zero applicable checks is a fatal error — it can never produce a meaningful delivery verdict. - Every check reports
pass/fail/error— never folded together.errorcovers an unreadable/empty/corrupt model, an unreadable or unparsable IDS file, or an IDS document declaring zero specifications; none of those count as a pass. - The overall verdict is
passonly when every declared check on every declared model passed, so an unreadable model or an empty ruleset can never read as a successful delivery (the issue's explicit boundary). - The consolidated report is a flat array of checks (never keyed by model/type/source), so two checks can never collide/overwrite each other in the output — the defect class behind two shipped bugs in
ifc-lite schedule. Running the same recipe twice against unchanged files produces byte-identical--jsonoutput. --html <file>renders an additional standalone HTML report.- A committed worked example lives at
packages/cli/examples/delivery/(a passing model, a structurally-broken model, an unreadable model, and an IDS specification that fails) and is exercised bydelivery-example.test.ts.
Assumptions (stated per the issue's ambiguity guidance)
- Modeled the command on
ifc-lite schedule's--spec/--savesaved-definition pattern (path-resolution-relative-to-file,fatal(...)on any malformed field) and onifc-lite gym's reuse ofcomputeValidationIssues/IDSNamespacefor running the underlying checks without a second implementation. - A recipe applies the same
structural/idsselection to every listed model (no per-model check overrides) — the simplest reading consistent with "one documented CLI invocation." - An IDS document whose specifications are ALL "not applicable" (matched no entities) counts as
error, notpass— nothing was actually evaluated, so a green check would rest on zero evidence. - Duplicate
models/idsentries in a recipe are a fatal error rather than silently deduplicated.
Test plan
- RED: wrote
delivery.test.ts/delivery-example.test.tsfirst; failing assertions confirmed the not-yet-implemented behavior before writingdelivery.ts/delivery-checks.ts/delivery-recipe.ts/delivery-report.ts. - Mutation testing (each confirmed to break a test): (1) silently dropping checks for an unreadable model, (2) computing the verdict from
failcount only (ignoringerror), (3) folding an IDS-file read failure intopass, (4) disabling the zero-checks-in-recipe fatal. -
pnpm turbo test --filter @ifc-lite/cli: 68 test files, 774 passed, 8 skipped, 0 failed (includes 14 new delivery tests). -
pnpm turbo typecheck --filter @ifc-lite/cli: OK. -
node scripts/check-module-size.mjs,check-test-wiring.mjs,check-source-text-assertions.mjs: all OK. - Manual smoke test of the built binary against the committed example recipe: correct pass/fail/error mix,
--htmlreport renders, and two--jsonruns are byte-identical (diffclean). -
docs/guide/cli.mdupdated with adeliverysection and the generated command table refreshed (pnpm docs:generate). - Changeset added (
.changeset/delivery-check-recipe.md), no license header.
https://claude.ai/code/session_01QPHChk3Ve9N519A4kY7436
Summary by CodeRabbit
-
New Features
- Added the
ifc-lite deliverycommand for repeatable structural and IDS checks across multiple IFC models. - Supports recipe-based configuration, consolidated JSON results, deterministic SHA-256 model fingerprints, and optional standalone HTML reports.
- Reports pass, fail, and error outcomes, including missing or invalid model and rule files.
- Added example delivery recipes, IFC models, and IDS requirements.
- Added the
-
Documentation
- Added CLI usage guidance, recipe format details, report behavior, and command reference information.