nx_compare_unified.nx source
↩ module page · 359 lines · 26721 B
1// nx_compare_unified.nx -- THE UNIFIED /compare view (operator 2026-07-10: "too many formats -> consolidate to
2// ONE state-of-the-art comparison view, high-level to granular, usable by workstreams to document their dev arcs
3// iteratively + REUSE the nishi team to avoid churn/duplicate rebuilds"). ONE format subsumes matrix + frontier
4// radar + hub summary + api, and ADDS the development-arc log + reuse catalog. Grounded (banked 2026-07-10) in
5// Backstage (software catalog + techdocs + scorecards), CMMI (maturity levels), OpenSSF Scorecard (per-check
6// measured + remediation), ThoughtWorks Tech Radar (adopt/trial/assess/hold rings). Reads knowledge/compare/
7// <domain>.matrix (existing axis rows) PLUS backward-compatible enrichment directives:
8// @summary <one line> -- executive summary
9// @rung DONE|NOW|NEXT|HOLD | <label> | <evidence gate/URL> | <one line> -- the development arc (repeatable)
10// axis rows may append a trailing | reuse: <organ to reuse instead of rebuilding>
11// FOUR LEVELS: (L0) executive maturity band + verdict vs the named bar; (L1) the CLIMB arc (rungs);
12// (L2) capability MATRIX (measured, drill-down); (L3) granular EVIDENCE + REUSE pointer per axis. Plus a JSON
13// superset for workstreams/tools. LIAR-KILL: Nishi cells MEASURED by symbol-on-disk (no self-grading); the
14// maturity band is COMPUTED from coverage, never asserted. Modes: html | json | (no-arg gate). Colors via rgb()
15// (nx_cc: no '#' in string literals). usage: nx_compare_unified <domain> [html|json] license_tier: ORIGINAL expect_exit:0
16import "nx_syscalls.nx"
17import "nx_matrix_sym_lib.nx"
18import "nx_estate_path.nx"
19const K_MAGIC_262144: i64 = 262144
20const K_MAGIC_65536: i64 = 65536
21const K_MAGIC_1024: i64 = 1024
22const K_MAGIC_2048: i64 = 2048
23const K_MAGIC_131072: i64 = 131072
24const K_MAGIC_20480: i64 = 20480
25const K_MAGIC_20479: i64 = 20479
26
27func w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
28func wc(fd: i64, code: i64) -> i64 { let t: *u8=sys_mmap(2); t[0]=code as u8; sys_write(fd,t,1); return 0 }
29func wn(fd: i64, v: i64) -> i64 { var m: i64=v; if m<0{w(fd,"-" as *u8);m=0-m} let t: *u8=sys_mmap(24); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} let o: *u8=sys_mmap(24); var i: i64=0; while i<k{o[i]=t[k-1-i];i=i+1} sys_write(fd,o,k); return 0 }
30func streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8){ if a[i]!=b[i]{return 0} i=i+1 } if b[i]!=(0 as u8){return 0} return 1 }
31func starts(s: *u8, p: *u8) -> i64 { var i: i64=0; while p[i]!=(0 as u8){ if s[i]!=p[i]{return 0} i=i+1 } return 1 }
32// RESOLVES, rather than opening bare. Matrix rows name organs BUILDROOT-relative ("runtime/nx_gen.nx")
33// while this organ runs from the serving root, so EVERY symbol probe missed and the domain reported
34// "axes=25 present=0 absent=25 coverage=0/1000" -- and still printed UNIFIED-GATE GREEN.
35// THE LIAR-KILL THIS ORGAN ADVERTISES ("Nishi cells MEASURED by symbol-on-disk, no self-grading") WAS
36// INOPERATIVE: measuring every cell as absent is not measuring, and a GREEN beside it is a verdict on
37// a measurement that never happened. Identical root cause to nx_swarm_maturity's 0/1000, found the
38// same day -- ★ONE RESOLUTION BUG PRODUCES A CONFIDENT ZERO IN EVERY ORGAN THAT COPIES IT.
39// ep_open_rd is a strict SUPERSET of the old behaviour: the caller's own CWD is still probed FIRST
40// (so a hermetic fixture cannot be shadowed), then ../, then the two estate roots -- which means the
41// matrix read that already worked keeps working, and only the reads that were failing start finding.
42func cread(path: *u8, buf: *u8, cap: i64) -> i64 { let fd: i64=ep_open_rd(path); if fd<0{return 0-1} var t: i64=0; while t<cap { let r: i64=sys_read(fd,(buf as i64+t) as *u8,cap-t); if r<=0{break} t=t+r } sys_close(fd); return t }
43func fexists(path: *u8) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0{return 0} sys_close(fd); return 1 }
44// does knowledge/compare/<dom><sfx> exist? (data-driven compare-capability inventory)
45func cap_exists(dom: *u8, sfx: *u8) -> i64 {
46 let p: *u8=sys_mmap(512); var o: i64=0; var i: i64=0
47 let pfx: *u8="knowledge/compare/" as *u8
48 while pfx[i]!=(0 as u8){p[o]=pfx[i];o=o+1;i=i+1}
49 i=0; while dom[i]!=(0 as u8){p[o]=dom[i];o=o+1;i=i+1}
50 i=0; while sfx[i]!=(0 as u8){p[o]=sfx[i];o=o+1;i=i+1}
51 p[o]=0 as u8
52 return fexists(p)
53}
54// symbol present in organ file?
55// ONE reader of the symbol format (nx_matrix_sym_lib). The bare-form-only test that stood here handed
56// the WHOLE literal "_ABSENT_:<future_symbol>" to the search below -- a string that can never occur in
57// an organ -- so a WATCH CONTRACT that had ALREADY LANDED read as absent.
58// This organ is currently SOURCE-ONLY (no shipped binary), so the defect was INERT here. Fixed anyway,
59// because an inert copy of a live bug is a live bug the day somebody builds it, and this was the LAST
60// of five private re-derivations of the same format.
61func file_has(path: *u8, sym: *u8, buf: *u8, cap: i64) -> i64 {
62 if msym_is_bare_absent_z(sym)==1 { return 0 }
63 // For a watch contract this is the symbol PAST the "_ABSENT_:" prefix; for anything else it is sym
64 // unchanged, so every non-watch row behaves exactly as before.
65 let real: *u8 = msym_real_z(sym)
66 let n: i64=cread(path,buf,cap); if n<=0{return 0}
67 var sl: i64=0; while real[sl]!=(0 as u8){sl=sl+1}
68 if sl==0 { return 0 }
69 var i: i64=0
70 while i+sl<=n { var j: i64=0; var ok: i64=1; while j<sl{ if buf[i+j]!=real[j]{ok=0;j=sl}else{j=j+1} } if ok==1{return 1} i=i+1 }
71 return 0
72}
73// copy field k (0-based, '|'-split) of line[ls,le) into out (cap 1024); return len
74func field(buf: *u8, ls: i64, le: i64, k: i64, out: *u8) -> i64 {
75 var fi: i64=0; var o: i64=0; var q: i64=ls
76 while q<le {
77 if buf[q]==(124 as u8) { if fi==k { out[o]=0 as u8; return o } fi=fi+1; o=0 } else { if fi==k { if o<1023 { out[o]=buf[q]; o=o+1 } } }
78 q=q+1
79 }
80 out[o]=0 as u8
81 if fi==k { return o }
82 return 0-1
83}
84// maturity band from coverage permille (CMMI-inspired); writes label
85func band(fd: i64, cov: i64) -> i64 {
86 if cov>=900 { w(fd,"Leading" as *u8); return 0 }
87 if cov>=750 { w(fd,"Advanced" as *u8); return 0 }
88 if cov>=500 { w(fd,"Established" as *u8); return 0 }
89 if cov>=250 { w(fd,"Emerging" as *u8); return 0 }
90 w(fd,"Initial" as *u8); return 0
91}
92func bandcls(cov: i64) -> *u8 {
93 if cov>=750 { return "b-adv" as *u8 }
94 if cov>=500 { return "b-est" as *u8 }
95 if cov>=250 { return "b-emg" as *u8 }
96 return "b-ini" as *u8
97}
98// ring class + label for a rung status
99func ringcls(st: *u8) -> *u8 { if streq(st,"DONE" as *u8)==1{return "r-done" as *u8} if streq(st,"NOW" as *u8)==1{return "r-now" as *u8} if streq(st,"HOLD" as *u8)==1{return "r-hold" as *u8} return "r-next" as *u8 }
100// Nishi cell text
101func celltxt(fd: i64, code: i64) -> i64 { if code==2{w(fd,"Best" as *u8)} else { if code==1{w(fd,"Yes" as *u8)} else { if code==3{w(fd,"Part" as *u8)} else {w(fd,"No" as *u8)} } } return 0 }
102func cellcls(code: i64) -> *u8 { if code==2{return "c-best" as *u8} if code==1{return "c-yes" as *u8} if code==3{return "c-part" as *u8} return "c-no" as *u8 }
103
104func main(argc: i64, argv: *i64) -> i64 {
105 if argc < 2 { w(1,"usage: nx_compare_unified <domain> [html|json]\n" as *u8); return 2 }
106 let dom: *u8 = argv[1] as *u8
107 var mode: i64 = 0 // 0=gate 1=html 2=json
108 if argc>=3 { if streq(argv[2] as *u8,"html" as *u8)==1{mode=1} if streq(argv[2] as *u8,"json" as *u8)==1{mode=2} }
109
110 let cap: i64=K_MAGIC_262144
111 let buf: *u8=sys_mmap(cap)
112 let ob: *u8=sys_mmap(K_MAGIC_65536) // organ-read scratch
113 let path: *u8=sys_mmap(512)
114 var o: i64=0; var i: i64=0
115 let pfx: *u8="knowledge/compare/" as *u8
116 while pfx[i]!=(0 as u8){path[o]=pfx[i];o=o+1;i=i+1}
117 i=0; while dom[i]!=(0 as u8){path[o]=dom[i];o=o+1;i=i+1}
118 let sfx: *u8=".matrix" as *u8
119 i=0; while sfx[i]!=(0 as u8){path[o]=sfx[i];o=o+1;i=i+1}
120 path[o]=0 as u8
121 let n: i64=cread(path,buf,cap)
122 if n<=0 { w(2,"no .matrix for domain\n" as *u8); return 3 }
123
124 // pass 1: parse directives + axis rows into arrays
125 let title: *u8=sys_mmap(K_MAGIC_1024); title[0]=0 as u8
126 let summ: *u8=sys_mmap(K_MAGIC_2048); summ[0]=0 as u8
127 let cols: *u8=sys_mmap(K_MAGIC_2048); cols[0]=0 as u8
128 // axes: store line spans; rungs: store line spans
129 let axls: *i64=sys_mmap(8*512) as *i64
130 let axle: *i64=sys_mmap(8*512) as *i64
131 var axn: i64=0
132 let rgls: *i64=sys_mmap(8*128) as *i64
133 let rgle: *i64=sys_mmap(8*128) as *i64
134 var rgn: i64=0
135 var p: i64=0
136 while p<n {
137 var e: i64=p
138 while e<n { if buf[e]==(10 as u8){break} e=e+1 }
139 if e>p { if buf[p]!=(35 as u8) {
140 let ln: *u8=(buf as i64 + p) as *u8
141 if starts(ln,"@title " as *u8)==1 { var q: i64=p+7; var k: i64=0; while q<e{title[k]=buf[q];k=k+1;q=q+1} title[k]=0 as u8 }
142 else { if starts(ln,"@sub " as *u8)==1 { if summ[0]==(0 as u8){ var q: i64=p+5; var k: i64=0; while q<e{summ[k]=buf[q];k=k+1;q=q+1} summ[k]=0 as u8 } }
143 else { if starts(ln,"@summary " as *u8)==1 { var q: i64=p+9; var k: i64=0; while q<e{summ[k]=buf[q];k=k+1;q=q+1} summ[k]=0 as u8 }
144 else { if starts(ln,"@cols " as *u8)==1 { var q: i64=p+6; var k: i64=0; while q<e{cols[k]=buf[q];k=k+1;q=q+1} cols[k]=0 as u8 }
145 else { if starts(ln,"@rung " as *u8)==1 { if rgn<128 { rgls[rgn]=p+6; rgle[rgn]=e; rgn=rgn+1 } }
146 else { if starts(ln,"@" as *u8)==0 { if axn<512 { axls[axn]=p; axle[axn]=e; axn=axn+1 } } } } } } }
147 } }
148 p=e+1
149 }
150
151 // measure axes -> nishi codes + coverage. Separate buffers (organ must NOT alias the reused fbuf).
152 let fbuf: *u8=sys_mmap(K_MAGIC_2048)
153 let obuf: *u8=sys_mmap(K_MAGIC_1024) // organ path
154 let sbuf: *u8=sys_mmap(K_MAGIC_1024) // symbol
155 let ob2: *u8=sys_mmap(K_MAGIC_131072) // organ-file read scratch
156 var present: i64=0; var exceeds: i64=0; var absent: i64=0
157 let nish: *i64=sys_mmap(8*512) as *i64
158 var a: i64=0
159 while a<axn {
160 field(buf,axls[a],axle[a],1,obuf) // organ path
161 field(buf,axls[a],axle[a],2,sbuf) // symbol
162 field(buf,axls[a],axle[a],3,fbuf) // exceed flag
163 let exc: i64=(fbuf[0]==(49 as u8)) as i64
164 let has: i64=file_has(obuf,sbuf,ob2,K_MAGIC_131072)
165 var code: i64=0
166 if has==1 { if exc==1 { code=2 } else { code=1 } } else { code=0 }
167 nish[a]=code
168 if code==2{exceeds=exceeds+1} else { if code==1{present=present+1} else {absent=absent+1} }
169 a=a+1
170 }
171 var cov: i64=0
172 if axn>0 { cov=((present+exceeds)*1000)/axn }
173 // ★HONEST MATURITY floor (anti-navel-gazing): each present axis = L1 of L5 -> /(axn*5). Gate-only
174 // unless a <domain>.maturity declares live/mcp evidence. The gap vs coverage IS the navel-gazing.
175 var mat: i64=0
176 if axn>0 { mat=((present+exceeds)*1000)/(axn*5) }
177 // ★COMPARE-CAPABILITY inventory (data-driven from artifacts on disk): every measurement capability
178 // this domain has, so the unified view ACCOUNTS FOR all of them consistently on every page.
179 let cap_frontier: i64=cap_exists(dom,".axes" as *u8) // frontier radar (gapmap over axes)
180 let cap_corpus: i64=cap_exists(dom,".q" as *u8) // researcher corpus (fetched sources)
181 let cap_maturity: i64=cap_exists(dom,".maturity" as *u8) // honest maturity ladder
182 let cap_dims: i64=cap_exists(dom,".dimensions" as *u8) // production dimensions (security/...)
183 let cap_api: i64=cap_exists(dom,"-api.json" as *u8) // machine-readable API
184
185 // ---- GATE mode ----
186 if mode==0 {
187 w(1,"=== nx_compare_unified [gate] domain=" as *u8); w(1,dom); w(1," ===\n" as *u8)
188 w(1," title=" as *u8); w(1,title); w(1,"\n axes=" as *u8); wn(1,axn); w(1," rungs=" as *u8); wn(1,rgn)
189 w(1," coverage=" as *u8); wn(1,cov); w(1,"/1000 band=" as *u8); band(1,cov); w(1," (exceeds=" as *u8); wn(1,exceeds); w(1," present=" as *u8); wn(1,present); w(1," absent=" as *u8); wn(1,absent); w(1,")\n" as *u8)
190 w(1," ★honest maturity=" as *u8); wn(1,mat); w(1,"/1000 (feature-gap=" as *u8); wn(1,cov-mat); w(1," = navel-gazing) · capabilities: matrix frontier=" as *u8); wn(1,cap_frontier); w(1," corpus=" as *u8); wn(1,cap_corpus); w(1," maturity=" as *u8); wn(1,cap_maturity); w(1," dims=" as *u8); wn(1,cap_dims); w(1," api=" as *u8); wn(1,cap_api); w(1,"\n" as *u8)
191 // liar-kill: coverage COMPUTED; a domain claiming all-exceed with 0 organs would show absent
192 var ok: i64=1
193 if axn<3 { ok=0; w(1," RED: <3 axes\n" as *u8) }
194 if exceeds>axn { ok=0 }
195 if ok==1 { w(1,"UNIFIED-GATE GREEN (measured, computed band, liar-kill armed)\n" as *u8); return 0 }
196 w(1,"UNIFIED-GATE RED\n" as *u8); return 1
197 }
198
199 // ---- JSON mode (the superset for workstreams/tools) ----
200 if mode==2 {
201 wc(1,123)
202 w(1,"\"v\":2,\"api\":\"nishi-compare-unified\",\"domain\":\"" as *u8); w(1,dom); w(1,"\"," as *u8)
203 w(1,"\"title\":\"" as *u8); w(1,title); w(1,"\",\"summary\":\"" as *u8); w(1,summ); w(1,"\"," as *u8)
204 w(1,"\"coverage\":" as *u8); wn(1,cov); w(1,",\"band\":\"" as *u8); band(1,cov); w(1,"\","as *u8)
205 w(1,"\"maturity\":" as *u8); wn(1,mat); w(1,",\"capabilities\":{\"matrix\":1,\"frontier\":" as *u8); wn(1,cap_frontier); w(1,",\"corpus\":" as *u8); wn(1,cap_corpus); w(1,",\"maturity_ladder\":" as *u8); wn(1,cap_maturity); w(1,",\"dimensions\":" as *u8); wn(1,cap_dims); w(1,",\"api\":" as *u8); wn(1,cap_api); w(1,"}," as *u8)
206 w(1,"\"exceeds\":" as *u8); wn(1,exceeds); w(1,",\"present\":" as *u8); wn(1,present); w(1,",\"absent\":" as *u8); wn(1,absent); w(1,",\"total\":" as *u8); wn(1,axn); w(1,"," as *u8)
207 // arc
208 w(1,"\"arc\":[" as *u8)
209 var r: i64=0
210 while r<rgn {
211 if r>0 { wc(1,44) }
212 wc(1,123)
213 field(buf,rgls[r],rgle[r],0,fbuf); w(1,"\"status\":\"" as *u8); w(1,fbuf); w(1,"\"," as *u8)
214 field(buf,rgls[r],rgle[r],1,fbuf); w(1,"\"label\":\"" as *u8); w(1,fbuf); w(1,"\"," as *u8)
215 field(buf,rgls[r],rgle[r],2,fbuf); w(1,"\"evidence\":\"" as *u8); w(1,fbuf); w(1,"\"" as *u8)
216 wc(1,125)
217 r=r+1
218 }
219 w(1,"],\"axes\":[" as *u8)
220 a=0
221 while a<axn {
222 if a>0 { wc(1,44) }
223 wc(1,123)
224 field(buf,axls[a],axle[a],0,fbuf); w(1,"\"label\":\"" as *u8); w(1,fbuf); w(1,"\"," as *u8)
225 w(1,"\"nishi\":" as *u8); wn(1,nish[a]); w(1,"," as *u8)
226 field(buf,axls[a],axle[a],1,fbuf); w(1,"\"organ\":\"" as *u8); w(1,fbuf); w(1,"\"," as *u8)
227 field(buf,axls[a],axle[a],8,fbuf); w(1,"\"note\":\"" as *u8); w(1,fbuf); w(1,"\"," as *u8)
228 let hasreuse: i64=field(buf,axls[a],axle[a],9,fbuf)
229 w(1,"\"reuse\":\"" as *u8); if hasreuse>0 { w(1,fbuf) } w(1,"\"" as *u8)
230 wc(1,125)
231 a=a+1
232 }
233 w(1,"]}\n" as *u8)
234 return 0
235 }
236
237 // ---- HTML mode: the unified view ----
238 w(1,"<" as *u8); wc(1,33); w(1,"doctype html><html lang='en'><head><meta charset='utf-8'><meta name='viewport' content='width=device-width,initial-scale=1'>\n" as *u8)
239 w(1,"<title>Nishi Compare -- " as *u8); w(1,title); w(1,"</title><style>\n" as *u8)
240 w(1,":root{--bg:rgb(247,249,252);--pan:rgb(255,255,255);--ink:rgb(20,26,36);--dim:rgb(90,104,124);--line:rgb(214,223,235);--ac:rgb(21,101,192);--best:rgb(21,128,74);--yes:rgb(46,125,50);--part:rgb(176,120,20);--no:rgb(150,40,40)}\n" as *u8)
241 w(1,"@media(prefers-color-scheme:dark){:root{--bg:rgb(11,13,18);--pan:rgb(19,23,32);--ink:rgb(226,234,246);--dim:rgb(143,163,191);--line:rgb(35,44,63);--ac:rgb(127,212,255);--best:rgb(87,208,138);--yes:rgb(120,200,140);--part:rgb(230,168,106);--no:rgb(233,120,120)}}\n" as *u8)
242 w(1,"*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font-family:'Segoe UI',system-ui,sans-serif;line-height:1.55}\n" as *u8)
243 w(1,".wrap{max-width:940px;margin:0 auto;padding:0 20px 80px}a{color:var(--ac);text-decoration:none}a:hover{text-decoration:underline}\n" as *u8)
244 w(1,".crumb{font-size:.82rem;color:var(--dim);padding:18px 0 4px}\n" as *u8)
245 w(1,".exec{background:var(--pan);border:1px solid var(--line);border-radius:16px;padding:22px 24px;margin:10px 0 8px;display:flex;gap:24px;align-items:center;flex-wrap:wrap}\n" as *u8)
246 w(1,".gauge{flex:none;text-align:center}.gnum{font-size:44px;font-weight:800;line-height:1;font-variant-numeric:tabular-nums}.gpm{font-size:13px;color:var(--dim)}\n" as *u8)
247 w(1,".band{display:inline-block;margin-top:8px;font-size:11px;font-weight:700;letter-spacing:.08em;padding:3px 10px;border-radius:20px}\n" as *u8)
248 w(1,".b-adv{background:rgba(21,128,74,.16);color:var(--best)}.b-est{background:rgba(21,101,192,.16);color:var(--ac)}.b-emg{background:rgba(176,120,20,.16);color:var(--part)}.b-ini{background:rgba(150,40,40,.16);color:var(--no)}\n" as *u8)
249 w(1,".xinfo{flex:1;min-width:260px}.xinfo h1{margin:0 0 4px;font-size:23px}.xinfo .sum{color:var(--dim);font-size:.96rem;margin:0 0 8px}.bar{font-size:.82rem;color:var(--dim)}.bar b{color:var(--ink)}\n" as *u8)
250 w(1,".gauge.mat .gnum{color:var(--part)}.band.bmat{background:rgba(176,120,20,.16);color:var(--part)}\n" as *u8)
251 w(1,".caps{font-size:.76rem;color:var(--dim);margin-top:8px}.cap{display:inline-block;margin:2px 5px 2px 0;padding:2px 8px;border-radius:12px;font-weight:600}.cap.on{background:rgba(21,128,74,.14);color:var(--best)}.cap.off{background:rgba(150,40,40,.10);color:var(--dim);text-decoration:line-through}\n" as *u8)
252 w(1,"h2{font-size:12px;letter-spacing:.12em;text-transform:uppercase;color:var(--ac);margin:34px 0 12px;border-bottom:1px solid var(--line);padding-bottom:7px}\n" as *u8)
253 w(1,".arc{display:flex;flex-direction:column;gap:2px}.rung{display:flex;gap:12px;align-items:flex-start;padding:9px 12px;border-left:2px solid var(--line);margin-left:6px}\n" as *u8)
254 w(1,".dot{flex:none;width:11px;height:11px;border-radius:50%;margin-top:5px;margin-left:-18px;border:2px solid var(--bg)}\n" as *u8)
255 w(1,".r-done .dot{background:var(--best)}.r-now .dot{background:var(--ac)}.r-next .dot{background:var(--part)}.r-hold .dot{background:var(--dim)}\n" as *u8)
256 w(1,".rstat{flex:none;font-size:10px;font-weight:700;letter-spacing:.06em;width:44px;color:var(--dim);margin-top:3px}\n" as *u8)
257 w(1,".rlab{font-weight:600}.rev{font-size:.8rem;color:var(--dim);font-family:Consolas,monospace}.rnote{font-size:.86rem;color:var(--dim)}\n" as *u8)
258 w(1,"table{width:100%;border-collapse:collapse;font-size:.86rem;background:var(--pan);border:1px solid var(--line);border-radius:12px;overflow:hidden}\n" as *u8)
259 w(1,"th{text-align:left;font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--dim);padding:9px 11px;background:var(--bg);border-bottom:1px solid var(--line)}\n" as *u8)
260 w(1,"td{padding:8px 11px;border-bottom:1px solid var(--line);vertical-align:top}tr:last-child td{border-bottom:none}th.n,td.n{text-align:center}\n" as *u8)
261 w(1,".cell{font-size:11px;font-weight:700;padding:2px 8px;border-radius:6px}.c-best{background:rgba(21,128,74,.18);color:var(--best)}.c-yes{background:rgba(46,125,50,.14);color:var(--yes)}.c-part{background:rgba(176,120,20,.16);color:var(--part)}.c-no{background:rgba(150,40,40,.12);color:var(--no)}\n" as *u8)
262 w(1,".tally{margin:14px 0;font-size:.9rem;color:var(--dim)}.tally b{color:var(--ink)}\n" as *u8)
263 w(1,"details{background:var(--pan);border:1px solid var(--line);border-radius:10px;margin:8px 0;padding:2px 14px}summary{cursor:pointer;font-weight:600;padding:9px 0}\n" as *u8)
264 w(1,".ev{font-size:.84rem;color:var(--dim);padding:2px 0 12px}.ev code{background:var(--bg);padding:1px 6px;border-radius:5px;color:var(--ink)}.reuse{color:var(--best);font-weight:600}\n" as *u8)
265 w(1,".foot{margin-top:34px;color:var(--dim);font-size:.78rem;border-top:1px solid var(--line);padding-top:14px}\n" as *u8)
266 let uhd: *u8=sys_mmap(K_MAGIC_20480); var uhn: i64=cread("knowledge/site/chrome_header.html" as *u8, uhd, K_MAGIC_20479); if uhn<0{uhn=0} uhd[uhn]=0 as u8
267 let uft: *u8=sys_mmap(K_MAGIC_20480); var uftn: i64=cread("knowledge/site/chrome_footer.html" as *u8, uft, K_MAGIC_20479); if uftn<0{uftn=0} uft[uftn]=0 as u8
268 w(1,"</style></head><body>\n" as *u8)
269 if uhn>0 { w(1,uhd) }
270 w(1,"<div class='wrap'>\n" as *u8)
271 w(1,"<p class='crumb'><a href='/'>Nishi Family</a> › <a href='/compare'>Compare</a> › " as *u8); w(1,title); w(1,"</p>\n" as *u8)
272
273 // L0 EXECUTIVE
274 w(1,"<div class='exec'><div class='gauge'><div class='gnum'>" as *u8); wn(1,cov); w(1,"</div><div class='gpm'>/1000 features</div><div class='band " as *u8); w(1,bandcls(cov)); w(1,"'>" as *u8); band(1,cov); w(1,"</div></div>\n" as *u8)
275 // ★HONEST MATURITY gauge -- shown NEXT TO features so the gap (navel-gazing) is public on every page
276 w(1,"<div class='gauge mat'><div class='gnum'>" as *u8); wn(1,mat); w(1,"</div><div class='gpm'>/1000 maturity</div><div class='band bmat'>EARNED</div></div>\n" as *u8)
277 w(1,"<div class='xinfo'><h1>" as *u8); w(1,title); w(1,"</h1><p class='sum'>" as *u8)
278 if summ[0]!=(0 as u8) { w(1,summ) } else { w(1,"Nishi vs the field — measured, liar-killed, sovereign." as *u8) }
279 w(1,"</p><div class='bar'><b>" as *u8); wn(1,exceeds); w(1,"</b> sovereign exceeds · <b>" as *u8); wn(1,present+exceeds); w(1,"</b>/" as *u8); wn(1,axn); w(1," capabilities present · bar: <b>" as *u8); w(1,cols); w(1,"</b></div>\n" as *u8)
280 // ★COMPARE-CAPABILITY inventory strip -- every measurement capability, consistent on every page
281 w(1,"<div class='caps'>compare capabilities: <span class='cap on'>matrix</span>" as *u8)
282 if cap_frontier==1 { w(1,"<span class='cap on'>frontier radar</span>" as *u8) } else { w(1,"<span class='cap off'>frontier radar</span>" as *u8) }
283 if cap_corpus==1 { w(1,"<span class='cap on'>corpus</span>" as *u8) } else { w(1,"<span class='cap off'>corpus</span>" as *u8) }
284 if cap_maturity==1 { w(1,"<span class='cap on'>maturity ladder</span>" as *u8) } else { w(1,"<span class='cap off'>maturity floor</span>" as *u8) }
285 if cap_dims==1 { w(1,"<span class='cap on'>dimensions</span>" as *u8) } else { w(1,"<span class='cap off'>dimensions</span>" as *u8) }
286 if cap_api==1 { w(1,"<span class='cap on'>api</span>" as *u8) } else { w(1,"<span class='cap off'>api</span>" as *u8) }
287 w(1,"</div></div></div>\n" as *u8)
288
289 // L1 THE CLIMB (arc / dev-log)
290 if rgn>0 {
291 w(1,"<h2>The climb — development arc</h2><div class='arc'>\n" as *u8)
292 var r: i64=0
293 while r<rgn {
294 field(buf,rgls[r],rgle[r],0,fbuf)
295 w(1,"<div class='rung " as *u8); w(1,ringcls(fbuf)); w(1,"'><span class='dot'></span><span class='rstat'>" as *u8); w(1,fbuf); w(1,"</span><div><div class='rlab'>" as *u8)
296 field(buf,rgls[r],rgle[r],1,fbuf); w(1,fbuf); w(1,"</div><div class='rev'>" as *u8)
297 field(buf,rgls[r],rgle[r],2,fbuf); w(1,fbuf); w(1,"</div><div class='rnote'>" as *u8)
298 field(buf,rgls[r],rgle[r],3,fbuf); w(1,fbuf); w(1,"</div></div></div>\n" as *u8)
299 r=r+1
300 }
301 w(1,"</div>\n" as *u8)
302 }
303
304 // L2 CAPABILITY MATRIX
305 w(1,"<h2>Capabilities — measured vs the field</h2><table><thead><tr><th>Capability</th><th class='n'>Nishi</th>\n" as *u8)
306 // competitor headers from @cols (split by |)
307 var ci: i64=0
308 while ci<4 {
309 var kk: i64=field(cols,0,0,ci,fbuf)
310 // field() on a nul-terminated string: use a helper span [0, len]
311 var cl: i64=0; while cols[cl]!=(0 as u8){cl=cl+1}
312 field(cols,0,cl,ci,fbuf)
313 if fbuf[0]!=(0 as u8) { w(1,"<th class='n'>" as *u8); w(1,fbuf); w(1,"</th>" as *u8) }
314 ci=ci+1
315 }
316 w(1,"</tr></thead><tbody>\n" as *u8)
317 a=0
318 while a<axn {
319 w(1,"<tr><td>" as *u8); field(buf,axls[a],axle[a],0,fbuf); w(1,fbuf)
320 w(1,"</td><td class='n'><span class='cell " as *u8); w(1,cellcls(nish[a])); w(1,"'>" as *u8); celltxt(1,nish[a]); w(1,"</span></td>" as *u8)
321 var cc: i64=0
322 while cc<4 {
323 var cl2: i64=0; while cols[cl2]!=(0 as u8){cl2=cl2+1}
324 field(cols,0,cl2,cc,fbuf)
325 if fbuf[0]!=(0 as u8) {
326 field(buf,axls[a],axle[a],4+cc,fbuf)
327 var code: i64=0
328 if fbuf[0]==(49 as u8){code=1} if fbuf[0]==(50 as u8){code=2} if fbuf[0]==(51 as u8){code=3}
329 w(1,"<td class='n'><span class='cell " as *u8); w(1,cellcls(code)); w(1,"'>" as *u8); celltxt(1,code); w(1,"</span></td>" as *u8)
330 }
331 cc=cc+1
332 }
333 w(1,"</tr>\n" as *u8)
334 a=a+1
335 }
336 w(1,"</tbody></table>\n" as *u8)
337 w(1,"<div class='tally'>coverage <b>" as *u8); wn(1,cov); w(1,"/1000</b> · Best <b>" as *u8); wn(1,exceeds); w(1,"</b> · Yes <b>" as *u8); wn(1,present); w(1,"</b> · No <b>" as *u8); wn(1,absent); w(1,"</b> · every Nishi cell measured by implementing-symbol on disk (no self-grading)</div>\n" as *u8)
338
339 // L3 GRANULAR EVIDENCE + REUSE
340 w(1,"<h2>Evidence & reuse — so workstreams build on, not rebuild</h2>\n" as *u8)
341 a=0
342 while a<axn {
343 w(1,"<details><summary>" as *u8); field(buf,axls[a],axle[a],0,fbuf); w(1,fbuf)
344 w(1," — <span class='cell " as *u8); w(1,cellcls(nish[a])); w(1,"'>" as *u8); celltxt(1,nish[a]); w(1,"</span></summary><div class='ev'>" as *u8)
345 field(buf,axls[a],axle[a],8,fbuf); w(1,fbuf); w(1,"<br>organ: <code>" as *u8)
346 field(buf,axls[a],axle[a],1,fbuf); w(1,fbuf); w(1,"</code> · verified-symbol: <code>" as *u8)
347 field(buf,axls[a],axle[a],2,fbuf); w(1,fbuf); w(1,"</code>" as *u8)
348 let hr: i64=field(buf,axls[a],axle[a],9,fbuf)
349 if hr>0 { w(1,"<br><span class='reuse'>REUSE:</span> " as *u8); w(1,fbuf) }
350 w(1,"</div></details>\n" as *u8)
351 a=a+1
352 }
353
354 w(1,"<p class='foot'>ONE unified view (executive → arc → capabilities → evidence/reuse) generated by nx_compare_unified from knowledge/compare/" as *u8); w(1,dom); w(1,".matrix — consolidating the matrix, frontier, hub and API formats. Machine-readable superset: <a href='/compare/" as *u8); w(1,dom); w(1,"/unified.json'>unified.json</a>. Sovereign, zero JS logic, zero trackers.</p>\n" as *u8)
355 w(1,"</div>\n" as *u8)
356 if uftn>0 { w(1,uft) }
357 w(1,"</body></html>\n" as *u8)
358 return 0
359}