Generate typed nodes
/object_info → snapshot → cwf codegen → typed specscwf codegen --from object_info.json -o src/nodes/gen
cwf codegen --url http://127.0.0.1:8188 -o comfy-nodes --exact-combosCLI codegen imports helpers from "@stepupgaming/comfy-workflows" so the output directory can live anywhere in your app.
What gets written
| File | Role |
|---|---|
<category>.ts | Specs grouped by /object_info category |
registry.ts | specs map + named re-exports |
defs.json | Parsed defs used by compile |
catalog.json / NODES.md | Searchable catalog |
identifiers.json | classType → export name |
Header comment:
// GENERATED by comfy-workflows codegen — do not edit.
// objectInfoHash: …
// Regenerate with: cwf codegenWhy environment-specific
A VHS node exists only if that pack is installed. A combo of checkpoint filenames is that machine's disk. Default codegen widens file-backed combos to string[] so the types stay portable. --exact-combos emits literal unions. Those fail on another server's options. Use exact combos only when you regenerate per instance.
Built-in vs custom
The published @stepupgaming/comfy-workflows/nodes registry is the bundled core snapshot (Checkpoint, KSampler, VAE, LoadImage, …). It is not your custom nodes.
After codegen:
import { VHS_LoadVideo, VHS_VideoCombine } from "./comfy-nodes/registry";Those names come from the snapshot. Do not invent them. If the class is absent from /object_info, codegen will not emit it. Use rawNode only then.
Regeneration and drift
Install a pack, restart Comfy, recapture /object_info, rerun codegen, commit. If generated types are stale, g.add will not know the new class, or compile will fail E_UNKNOWN_NODE_TYPE against live defs.
CI pattern: Drift gates.
What codegen cannot express
Dynamic / autogrow inputs, nodes whose /object_info is a lie, and classes that are missing entirely. Those are rawNode or unsafe. Prefer fixing the snapshot over spreading escape hatches.
Node catalog is the bundled core list, not a universal catalog.