Files
EVOLV/tools/wiki-gen/README.md
znetsixe b01b3de741 tools: add wiki-gen — regenerates topic-contract AUTOGEN blocks
Generates the markdown table inside <!-- BEGIN AUTOGEN: topic-contract -->
blocks in nodes/<n>/wiki/Reference-Contracts.md from the canonical registry
at src/commands/index.js. Replaces the agent-written placeholders the wiki
uplift left behind.

- Accepts both labelled and unlabelled END markers; rewrites to canonical
  '<!-- END AUTOGEN: topic-contract -->' on regeneration so future runs are
  consistent.
- --check mode for CI (exit 1 if any block is out of date).
- Out of scope for now: data-model AUTOGEN block (requires instantiating
  the domain; the 9 agent-written placeholders for that block stay until
  a follow-up tool lands).

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

53 lines
1.4 KiB
Markdown

# @evolv/wiki-gen
Generate the AUTOGEN sections of per-node wikis from the source of truth
(`nodes/<n>/src/commands/index.js`).
## What it generates
Replaces content between these markers:
```markdown
<!-- BEGIN AUTOGEN: topic-contract — populate via wiki-gen tool (TODO) -->
... wiki-gen overwrites this block ...
<!-- END AUTOGEN: topic-contract -->
```
The 9 wikis uplifted in 2026-05 carry these markers in
`wiki/Reference-Contracts.md` (and some in `wiki/Home.md`); `wiki-gen`
keeps them in sync with the registry.
## Usage
```bash
# regenerate every node
node tools/wiki-gen/bin/wiki-gen.js
# one node
node tools/wiki-gen/bin/wiki-gen.js nodes/rotatingMachine
# CI check: fail if any AUTOGEN block is out of date
node tools/wiki-gen/bin/wiki-gen.js --check
```
## What it writes
For each registry descriptor:
| Column | Source |
|---|---|
| Canonical topic | `descriptor.topic` |
| Aliases | `descriptor.aliases` (deprecation candidates) |
| Payload | `descriptor.payloadSchema` |
| Unit | `descriptor.units.measure` + `descriptor.units.default` (or `—`) |
| Effect | `descriptor.description` |
## Out of scope (for now)
- The `data-model` AUTOGEN block (sample of `getOutput()`) — requires
instantiating the domain class, which depends on `generalFunctions`.
The 9 wikis carry hand-written placeholders inside those markers;
upgrading to runtime sampling is a follow-up.
Run after touching `src/commands/index.js` in any node, or as a CI gate.