@vizij/node-graph-authoring 0.0.2 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,6 +8,39 @@ Authoring-time helpers for constructing Vizij graph specifications. The package
8
8
  - The expression parser understands comparison and boolean operators (`>`, `<`, `==`, `!=`, `&&`, `||`, `!`) and maps them through shared metadata to the appropriate logic nodes.
9
9
  - Graph summaries surface the slot `valueType`, making it easier to audit vector wiring in generated specs.
10
10
 
11
+ ## IR Inspection
12
+
13
+ Use the bundled `vizij-ir-report` CLI whenever you need to peek at or diff the metadata-annotated IR graph for a set of bindings—no GraphSpec export required. The tool rebuilds the IR via `buildRigGraphSpec`, emits a normalized machine-readable dump (including registry annotations under `irGraph.nodes[].annotations.registry`), and can compare dumps for CI/regression guards.
14
+
15
+ ```bash
16
+ # From either vizij-web or vizij-rs worktrees
17
+ pnpm --filter @vizij/node-graph-authoring exec vizij-ir-report \
18
+ --input path/to/buildGraphOptions.json \
19
+ --dump ./artifacts/robot-face.ir.json
20
+
21
+ # Compare against a baseline dump and surface structured differences
22
+ pnpm --filter @vizij/node-graph-authoring exec vizij-ir-report \
23
+ --input path/to/buildGraphOptions.json \
24
+ --diff ./artifacts/baseline.ir.json \
25
+ --diff-limit 200
26
+ ```
27
+
28
+ Input files follow the `BuildGraphOptions` shape (face id, component definitions, binding map, `inputs`, and optional `inputMetadata`). The CLI accepts `--dump -`/`--diff -` for piping reports between tools, and exits with `1` when a diff finds mismatches—perfect for vizij-web parity tests or vizij-rs metadata checks.
29
+
30
+ Need the inspection data inside your own scripts? Import the new helpers directly:
31
+
32
+ ```ts
33
+ import {
34
+ buildMachineReport,
35
+ diffMachineReports,
36
+ } from "@vizij/node-graph-authoring";
37
+
38
+ const report = buildMachineReport(buildRigGraphSpec(options));
39
+ const result = diffMachineReports(report, baselineReport);
40
+ ```
41
+
42
+ The normalized report mirrors the CLI output, so the same metadata-rich payloads can back snapshots, drift detection, or custom dashboards.
43
+
11
44
  ## Development
12
45
 
13
46
  ```bash
@@ -15,7 +48,47 @@ pnpm install
15
48
  pnpm --filter @vizij/node-graph-authoring test
16
49
  ```
17
50
 
18
- > ℹ️ Vitest 3.2 has a known bug in `startVitest('run')` that throws `TypeError: filters.map is not a function` in some workspace environments. If the test task fails with that message, upgrade Vitest or run the suite via a manual `startVitest` wrapper until the upstream fix lands.
51
+ > ℹ️ Always run the suite through the CLI (`pnpm --filter @vizij/node-graph-authoring test` or `pnpm test` from this package). Vitest 3.2.x currently crashes with `TypeError: filters.map is not a function` when invoked via `startVitest('run', …)` or other direct programmatic hooks, so avoid those entry points until the upstream fix lands.
52
+
53
+ ### Updating IR parity fixtures
54
+
55
+ Whenever `buildRigGraphSpec` changes the emitted GraphSpec shape, refresh the frozen fixtures that drive `src/__tests__/irParity.test.ts`:
56
+
57
+ 1. Build the package so the script can import the latest graph builder:
58
+
59
+ ```bash
60
+ pnpm --filter @vizij/node-graph-authoring build
61
+ ```
62
+
63
+ 2. Generate the updated fixture blobs (derived inputs, reserved-variable binding, vector bindings). The easiest way is to run a small Node snippet from the monorepo root and paste the resulting JSON back into `src/__tests__/__fixtures__/graphSpecParity.ts`:
64
+
65
+ ```bash
66
+ node <<'NODE'
67
+ import {
68
+ buildRigGraphSpec,
69
+ createDefaultBinding,
70
+ createDefaultParentBinding,
71
+ createDefaultRemap,
72
+ addBindingSlot,
73
+ bindingTargetFromInput,
74
+ updateBindingWithInput,
75
+ updateBindingExpression,
76
+ } from "./packages/@vizij/node-graph-authoring/dist/index.js";
77
+ import { SELF_BINDING_ID } from "@vizij/utils";
78
+ // ...construct bindings/tests exactly as in irParity.test.ts...
79
+ // console.log(JSON for each fixture)
80
+ NODE
81
+ ```
82
+
83
+ (Copy the constructor logic directly from `irParity.test.ts` so the fixture inputs stay in sync; the snippet can simply `console.log(JSON.stringify({derived, reserved, vector}, null, 2))` and you can paste the values back into the fixture file.)
84
+
85
+ 3. Update the inline snapshot in the “stacked operators” test if it changes:
86
+
87
+ ```bash
88
+ pnpm --filter @vizij/node-graph-authoring vitest run src/__tests__/irParity.test.ts --update
89
+ ```
90
+
91
+ These three steps keep `graphSpecParity.ts` and the inline snapshot matched to the canonical GraphSpec layout, preventing future regressions from slipping through unnoticed.
19
92
 
20
93
  ## Build
21
94