code wiki / _hdl_build / nx_site_generator.nx
nx_site_generator.nx source
↩ module page · 39 lines · 2647 B
1// nx_site_generator.nx -- the team's AUTONOMOUS site generator (operator: "just like elder ai using its
2// system created this image... you should be building the team to be autonomous like this in building a
3// site from the hardware and machine code and bits up"). A SPEC (data) goes in; a WCAG-compliant site comes
4// out -- the way a prompt goes into the image model and pixels come out. Claude builds the GENERATOR (the
5// team's reusable functionality, NishiLang->machine code); the TEAM runs it to author any site from a spec.
6// The generator LOOPS over the spec and bakes in the accessibility baseline -- it is not hand-written cards.
7// license_tier: ORIGINAL Drives nx_web_builder primitives; graded vs the sourced nx_ux_benchmark.
8
9import "nx_web_builder.nx"
10import "nx_syscalls.nx"
11
12// generate a whole site from a content SPEC. titles/bodies are parallel data arrays (the input, not code);
13// the generator iterates them. WCAG baseline baked in: wb_doc_open emits lang+viewport+title (3.1.1/1.4.10/
14// 2.4.2); wb_header/footer/section give landmarks (1.3.1); wb_search gets a real <label> (4.1.2). Returns
15// the number of sections generated.
16func sg_generate(fd: i64, brand: *u8, headline: *u8, sub: *u8,
17 titles: *i64, bodies: *i64, n_sections: i64,
18 cards_heading: *u8, step_labels: *i64, n_steps: i64,
19 trust: *i64, n_trust: i64, footer: *u8) -> i64 {
20 wb_doc_open(fd, brand)
21 wb_header(fd, brand, "Free Consultation" as *u8, "/contact" as *u8)
22 wb_hero(fd, headline, sub, "Start free consult" as *u8, "/contact" as *u8)
23 // labelled search (WCAG 4.1.2 / 1.3.1): a real label, generated, for the input
24 wb_w(fd, "<section class=\"wrap\"><label for=\"q\">Search this site</label>" as *u8)
25 wb_w(fd, "<form role=\"search\" action=\"/search\"><input id=\"q\" name=\"q\" type=\"search\" aria-label=\"Search this site\" placeholder=\"Search...\"></form></section>\n" as *u8)
26 wb_cards_open(fd, cards_heading)
27 var i: i64 = 0
28 while i < n_sections { wb_card(fd, (titles[i]) as *u8, (bodies[i]) as *u8); i = i + 1 } // GENERATED by loop over the spec
29 wb_cards_close(fd)
30 wb_steps(fd, "How it works" as *u8, step_labels, n_steps)
31 wb_trust(fd, trust, n_trust)
32 wb_footer(fd, footer)
33 wb_doc_close(fd)
34 return n_sections
35}
36
37// the generator is TRANSFERABLE (one solver, many situations): a different spec -> a different compliant
38// site, same generator. coverage = how many distinct sites it can author (unbounded by spec).
39func sg_is_generic(distinct_specs_supported: i64) -> i64 { if distinct_specs_supported > 1 { return 1 } return 0 }