Status: blocked
Waits for: VB-378
Priority: 3
Size: S
Arch: yardstick
Phase: implement
Design ref: none (code structure). docs/typescript-plan.md (P7); the survey in backlog/VB-055.md.
Goal: tools/writes.js finds each module’s dependencies by looking for VB['key'] in its syntax tree and calls a lookup inside a function a “late” one; tests/dependencies.js and tools/dependencies.js check them against the layers of src/layers.json (20 upward edges of 500, all through command dispatch or culture and the like, on 12 November). After VB-378 the edges are import declarations: read those, keep the layer rule and the rule that every cycle passes through sim/commands, and give each import a flag “used at load” or “used only in functions”. src/manifest.json stays as the list of modules (for the lint and the fixtures hash) with no order meaning; a test checks it equals the files reachable from the entry.
Acceptance criteria:
tools/writes.js, tools/dependencies.js and tests/dependencies.js read the import graph; the output of node tools/dependencies.js lists the same upward edges as before (20), and tests/dependencies.js fails on an import from a higher layer that is not through the door, on a cycle not through sim/commands, and on a cycle whose import is used at load.tools/writes.js’s other results (each field’s writers and readers) are unchanged: tests/ownership.js passes without --update.src/manifest.json: its comment or neighbour file says it is no longer an order; a test checks the list against the import graph.docs/architecture/target-v2.md, section 3.2, and modules.md: a line each on how the check reads imports.docs/typescript-plan.md, where this task is P7): waits for Kim’s answers to QUESTIONS.md, “VB-055: the move to TypeScript” (the formatter, the bundler, the hook, the width measures, when, the page and the tests, strict), which may change its criteria; the three rules common to these tasks are at the top of the plan.tools/writes.js or tests/dependencies.js.