forge — 4-tier code generation engine for the tsx Framework Protocol.
Overview
forge is built on Tera and extends it with:
- 4-tier template hierarchy —
Atom → Molecule → Layout → Feature(classified automatically from template paths) - Import hoisting — templates call
{{ "import x from 'x'" | collect_import }}and{{ render_imports() }}at the top of the file to emit a deduplicated import block. - Token-budget metadata — knowledge
.mdfiles carrytoken_estimatein frontmatter so agents can request exactly as much context as they need. - Framework package loading — load templates from disk, embedded bytes, or npm packages.
Quick Start
use ;
let mut engine = new;
engine.add_raw.unwrap;
let ctx = new.insert;
let out = engine.render.unwrap;
assert_eq!;