code wiki / _hdl_build / nx_tpl_parts.nx
nx_tpl_parts.nx
buildroot/runtime/_hdl_build/nx_tpl_parts.nx
about
nx_tpl_parts.nx -- R-PARTS of the SITE FACTORY (the LEGO half of "ingest parts AND complete templates"):
extract SECTION-LEVEL patterns from template HTML into the pattern corpus as reusable BRICKS. For each
content section a template uses (hero/feat/proof/price/gal/vid/faq/form/cta) we keep only the abstract
STRUCTURE: the section kind + bucketed feature metrics (links/imgs/headings/forms/buttons) + its position.
Each distinct (kind, metric-buckets) collapses to ONE content-addressed `part:<hash>` record in the SAME
seg_store corpus that holds the page-level `pat:` records -- one corpus, two granularities, so composition
can lego from bricks as well as whole-page patterns. BUDGET-GUARDED by construction (max_parts + byte
ceiling, fail-fast trap; [[feedback-substrate-generators-must-have-budget-guard]]); idempotent (in-run +
cross-run dedup). We store structure only -- never a template's assets. license_tier: ORIGINAL
usage: nx_tpl_parts <template-dir> <corpus-prefix> [max_parts]
dependencies 1 imports · 1 importers
imports: nx_tpl_ingest.nx
imported by: nx_tpl_parts_gate.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 12 | const TP_MAGIC_131072: i64 = 131072 |
| 13 | const TP_MAGIC_1024: i64 = 1024 |
| 14 | const TP_MAGIC_2000: i64 = 2000 |
| 16 | const TP_RECCAP: i64 = 1024 |
| 17 | const TP_MAXK: i64 = 12 |
functions
| 19 | func tp_bucket(v: i64) -> i64 called by 1: tp_mkkey |
| 27 | func tp_scan(h: *u8, n: i64, toks: *i64, offs: *i64) -> i64 |
| 73 | func tp_metrics(h: *u8, from: i64, to: i64, m: *i64) -> i64 |
| 85 | func tp_mkkey(kind: *u8, m: *i64, keyout: *u8) -> i64 |
| 100 | func tp_record(kind: *u8, m: *i64, pos: i64, src: *u8, out: *u8) -> i64 |
| 115 | func tp_run(tpldir: *u8, prefix: *u8, max_parts: i64, counts: *i64) -> i64 |
| 221 | func main(argc: i64, argv: *i64) -> i64 |