code wiki / _hdl_build / nx_site_requirements.nx
nx_site_requirements.nx source
↩ module page · 32 lines · 1674 B
1// nx_site_requirements.nx -- R5b of the SITE FACTORY: the REQUIREMENTS -> CONTENT compiler (the census's
2// stage-B "requirements -> blueprint compiler" cell). A captured, line-oriented requirements brief
3// ("<archetype>|<key>|<value>": hero fields eyebrow/heropre/herograd/lede/hint/cta1/ctah2/ctap/footer +
4// per-card items "<sectionid>.<n>.t|.b") drives the R5 archetype composer, so the emitted whole-site pages
5// carry REAL copy instead of defaults -- no LLM anywhere: requirements in (data), composed site out.
6// Composes sa_req_load + sa_run from nx_site_archetype (R5); corpus-derived archetype set is unchanged --
7// the brief only FILLS pages whose structure was consumed into the corpus.
8// usage: nx_site_requirements <reqfile> <template-dir> <corpus-prefix> <docroot> <domain>
9// license_tier: ORIGINAL
10import "nx_site_archetype.nx"
11
12func main(argc: i64, argv: *i64) -> i64 {
13 if argc < 6 {
14 sa_w("usage: nx_site_requirements <reqfile> <template-dir> <corpus-prefix> <docroot> <domain>\n" as *u8)
15 return 2
16 }
17 let reqfile: *u8 = argv[1] as *u8
18 let tpldir: *u8 = argv[2] as *u8
19 let prefix: *u8 = argv[3] as *u8
20 let docroot: *u8 = argv[4] as *u8
21 let domain: *u8 = argv[5] as *u8
22 let rl: i64 = sa_req_load(reqfile)
23 if rl < 0 { sa_w("site-requirements: cannot read reqfile " as *u8); sa_w(reqfile); sa_w("\n" as *u8); return 1 }
24 sa_w("REQ-COMPILE lines=" as *u8)
25 let nb: *u8 = sys_mmap(28)
26 let ne: i64 = sa_catn(nb, 0, rl)
27 sys_write(1, nb, ne)
28 sa_w(" -> composing with real copy\n" as *u8)
29 let rc: i64 = sa_run(tpldir, prefix, docroot, domain)
30 if rc < 0 { return 1 }
31 return 0
32}