code wiki / (root) / nx_compare_unified.nx

nx_compare_unified.nx source

↩ module page · 339 lines · 24966 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" 17const K_MAGIC_262144: i64 = 262144 18const K_MAGIC_65536: i64 = 65536 19const K_MAGIC_1024: i64 = 1024 20const K_MAGIC_2048: i64 = 2048 21const K_MAGIC_131072: i64 = 131072 22const K_MAGIC_20480: i64 = 20480 23const K_MAGIC_20479: i64 = 20479 24 25func 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 } 26func wc(fd: i64, code: i64) -> i64 { let t: *u8=sys_mmap(2); t[0]=code as u8; sys_write(fd,t,1); return 0 } 27func 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 } 28func 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 } 29func 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 } 30func cread(path: *u8, buf: *u8, cap: i64) -> i64 { let fd: i64=sys_openat_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 } 31func fexists(path: *u8) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0{return 0} sys_close(fd); return 1 } 32// does knowledge/compare/<dom><sfx> exist? (data-driven compare-capability inventory) 33func cap_exists(dom: *u8, sfx: *u8) -> i64 { 34 let p: *u8=sys_mmap(512); var o: i64=0; var i: i64=0 35 let pfx: *u8="knowledge/compare/" as *u8 36 while pfx[i]!=(0 as u8){p[o]=pfx[i];o=o+1;i=i+1} 37 i=0; while dom[i]!=(0 as u8){p[o]=dom[i];o=o+1;i=i+1} 38 i=0; while sfx[i]!=(0 as u8){p[o]=sfx[i];o=o+1;i=i+1} 39 p[o]=0 as u8 40 return fexists(p) 41} 42// symbol present in organ file? 43func file_has(path: *u8, sym: *u8, buf: *u8, cap: i64) -> i64 { 44 if streq(sym, "_ABSENT_" as *u8)==1 { return 0 } 45 let n: i64=cread(path,buf,cap); if n<=0{return 0} 46 let m: i64=(streq(sym, "" as *u8)==1) as i64 47 var sl: i64=0; while sym[sl]!=(0 as u8){sl=sl+1} 48 if sl==0 { return 0 } 49 var i: i64=0 50 while i+sl<=n { var j: i64=0; var ok: i64=1; while j<sl{ if buf[i+j]!=sym[j]{ok=0;j=sl}else{j=j+1} } if ok==1{return 1} i=i+1 } 51 return 0 52} 53// copy field k (0-based, '|'-split) of line[ls,le) into out (cap 1024); return len 54func field(buf: *u8, ls: i64, le: i64, k: i64, out: *u8) -> i64 { 55 var fi: i64=0; var o: i64=0; var q: i64=ls 56 while q<le { 57 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 } } } 58 q=q+1 59 } 60 out[o]=0 as u8 61 if fi==k { return o } 62 return 0-1 63} 64// maturity band from coverage permille (CMMI-inspired); writes label 65func band(fd: i64, cov: i64) -> i64 { 66 if cov>=900 { w(fd,"Leading" as *u8); return 0 } 67 if cov>=750 { w(fd,"Advanced" as *u8); return 0 } 68 if cov>=500 { w(fd,"Established" as *u8); return 0 } 69 if cov>=250 { w(fd,"Emerging" as *u8); return 0 } 70 w(fd,"Initial" as *u8); return 0 71} 72func bandcls(cov: i64) -> *u8 { 73 if cov>=750 { return "b-adv" as *u8 } 74 if cov>=500 { return "b-est" as *u8 } 75 if cov>=250 { return "b-emg" as *u8 } 76 return "b-ini" as *u8 77} 78// ring class + label for a rung status 79func 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 } 80// Nishi cell text 81func 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 } 82func 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 } 83 84func main(argc: i64, argv: *i64) -> i64 { 85 if argc < 2 { w(1,"usage: nx_compare_unified <domain> [html|json]\n" as *u8); return 2 } 86 let dom: *u8 = argv[1] as *u8 87 var mode: i64 = 0 // 0=gate 1=html 2=json 88 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} } 89 90 let cap: i64=K_MAGIC_262144 91 let buf: *u8=sys_mmap(cap) 92 let ob: *u8=sys_mmap(K_MAGIC_65536) // organ-read scratch 93 let path: *u8=sys_mmap(512) 94 var o: i64=0; var i: i64=0 95 let pfx: *u8="knowledge/compare/" as *u8 96 while pfx[i]!=(0 as u8){path[o]=pfx[i];o=o+1;i=i+1} 97 i=0; while dom[i]!=(0 as u8){path[o]=dom[i];o=o+1;i=i+1} 98 let sfx: *u8=".matrix" as *u8 99 i=0; while sfx[i]!=(0 as u8){path[o]=sfx[i];o=o+1;i=i+1} 100 path[o]=0 as u8 101 let n: i64=cread(path,buf,cap) 102 if n<=0 { w(2,"no .matrix for domain\n" as *u8); return 3 } 103 104 // pass 1: parse directives + axis rows into arrays 105 let title: *u8=sys_mmap(K_MAGIC_1024); title[0]=0 as u8 106 let summ: *u8=sys_mmap(K_MAGIC_2048); summ[0]=0 as u8 107 let cols: *u8=sys_mmap(K_MAGIC_2048); cols[0]=0 as u8 108 // axes: store line spans; rungs: store line spans 109 let axls: *i64=sys_mmap(8*512) as *i64 110 let axle: *i64=sys_mmap(8*512) as *i64 111 var axn: i64=0 112 let rgls: *i64=sys_mmap(8*128) as *i64 113 let rgle: *i64=sys_mmap(8*128) as *i64 114 var rgn: i64=0 115 var p: i64=0 116 while p<n { 117 var e: i64=p 118 while e<n { if buf[e]==(10 as u8){break} e=e+1 } 119 if e>p { if buf[p]!=(35 as u8) { 120 let ln: *u8=(buf as i64 + p) as *u8 121 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 } 122 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 } } 123 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 } 124 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 } 125 else { if starts(ln,"@rung " as *u8)==1 { if rgn<128 { rgls[rgn]=p+6; rgle[rgn]=e; rgn=rgn+1 } } 126 else { if starts(ln,"@" as *u8)==0 { if axn<512 { axls[axn]=p; axle[axn]=e; axn=axn+1 } } } } } } } 127 } } 128 p=e+1 129 } 130 131 // measure axes -> nishi codes + coverage. Separate buffers (organ must NOT alias the reused fbuf). 132 let fbuf: *u8=sys_mmap(K_MAGIC_2048) 133 let obuf: *u8=sys_mmap(K_MAGIC_1024) // organ path 134 let sbuf: *u8=sys_mmap(K_MAGIC_1024) // symbol 135 let ob2: *u8=sys_mmap(K_MAGIC_131072) // organ-file read scratch 136 var present: i64=0; var exceeds: i64=0; var absent: i64=0 137 let nish: *i64=sys_mmap(8*512) as *i64 138 var a: i64=0 139 while a<axn { 140 field(buf,axls[a],axle[a],1,obuf) // organ path 141 field(buf,axls[a],axle[a],2,sbuf) // symbol 142 field(buf,axls[a],axle[a],3,fbuf) // exceed flag 143 let exc: i64=(fbuf[0]==(49 as u8)) as i64 144 let has: i64=file_has(obuf,sbuf,ob2,K_MAGIC_131072) 145 var code: i64=0 146 if has==1 { if exc==1 { code=2 } else { code=1 } } else { code=0 } 147 nish[a]=code 148 if code==2{exceeds=exceeds+1} else { if code==1{present=present+1} else {absent=absent+1} } 149 a=a+1 150 } 151 var cov: i64=0 152 if axn>0 { cov=((present+exceeds)*1000)/axn } 153 // ★HONEST MATURITY floor (anti-navel-gazing): each present axis = L1 of L5 -> /(axn*5). Gate-only 154 // unless a <domain>.maturity declares live/mcp evidence. The gap vs coverage IS the navel-gazing. 155 var mat: i64=0 156 if axn>0 { mat=((present+exceeds)*1000)/(axn*5) } 157 // ★COMPARE-CAPABILITY inventory (data-driven from artifacts on disk): every measurement capability 158 // this domain has, so the unified view ACCOUNTS FOR all of them consistently on every page. 159 let cap_frontier: i64=cap_exists(dom,".axes" as *u8) // frontier radar (gapmap over axes) 160 let cap_corpus: i64=cap_exists(dom,".q" as *u8) // researcher corpus (fetched sources) 161 let cap_maturity: i64=cap_exists(dom,".maturity" as *u8) // honest maturity ladder 162 let cap_dims: i64=cap_exists(dom,".dimensions" as *u8) // production dimensions (security/...) 163 let cap_api: i64=cap_exists(dom,"-api.json" as *u8) // machine-readable API 164 165 // ---- GATE mode ---- 166 if mode==0 { 167 w(1,"=== nx_compare_unified [gate] domain=" as *u8); w(1,dom); w(1," ===\n" as *u8) 168 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) 169 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) 170 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) 171 // liar-kill: coverage COMPUTED; a domain claiming all-exceed with 0 organs would show absent 172 var ok: i64=1 173 if axn<3 { ok=0; w(1," RED: <3 axes\n" as *u8) } 174 if exceeds>axn { ok=0 } 175 if ok==1 { w(1,"UNIFIED-GATE GREEN (measured, computed band, liar-kill armed)\n" as *u8); return 0 } 176 w(1,"UNIFIED-GATE RED\n" as *u8); return 1 177 } 178 179 // ---- JSON mode (the superset for workstreams/tools) ---- 180 if mode==2 { 181 wc(1,123) 182 w(1,"\"v\":2,\"api\":\"nishi-compare-unified\",\"domain\":\"" as *u8); w(1,dom); w(1,"\"," as *u8) 183 w(1,"\"title\":\"" as *u8); w(1,title); w(1,"\",\"summary\":\"" as *u8); w(1,summ); w(1,"\"," as *u8) 184 w(1,"\"coverage\":" as *u8); wn(1,cov); w(1,",\"band\":\"" as *u8); band(1,cov); w(1,"\","as *u8) 185 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) 186 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) 187 // arc 188 w(1,"\"arc\":[" as *u8) 189 var r: i64=0 190 while r<rgn { 191 if r>0 { wc(1,44) } 192 wc(1,123) 193 field(buf,rgls[r],rgle[r],0,fbuf); w(1,"\"status\":\"" as *u8); w(1,fbuf); w(1,"\"," as *u8) 194 field(buf,rgls[r],rgle[r],1,fbuf); w(1,"\"label\":\"" as *u8); w(1,fbuf); w(1,"\"," as *u8) 195 field(buf,rgls[r],rgle[r],2,fbuf); w(1,"\"evidence\":\"" as *u8); w(1,fbuf); w(1,"\"" as *u8) 196 wc(1,125) 197 r=r+1 198 } 199 w(1,"],\"axes\":[" as *u8) 200 a=0 201 while a<axn { 202 if a>0 { wc(1,44) } 203 wc(1,123) 204 field(buf,axls[a],axle[a],0,fbuf); w(1,"\"label\":\"" as *u8); w(1,fbuf); w(1,"\"," as *u8) 205 w(1,"\"nishi\":" as *u8); wn(1,nish[a]); w(1,"," as *u8) 206 field(buf,axls[a],axle[a],1,fbuf); w(1,"\"organ\":\"" as *u8); w(1,fbuf); w(1,"\"," as *u8) 207 field(buf,axls[a],axle[a],8,fbuf); w(1,"\"note\":\"" as *u8); w(1,fbuf); w(1,"\"," as *u8) 208 let hasreuse: i64=field(buf,axls[a],axle[a],9,fbuf) 209 w(1,"\"reuse\":\"" as *u8); if hasreuse>0 { w(1,fbuf) } w(1,"\"" as *u8) 210 wc(1,125) 211 a=a+1 212 } 213 w(1,"]}\n" as *u8) 214 return 0 215 } 216 217 // ---- HTML mode: the unified view ---- 218 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) 219 w(1,"<title>Nishi Compare -- " as *u8); w(1,title); w(1,"</title><style>\n" as *u8) 220 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) 221 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) 222 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) 223 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) 224 w(1,".crumb{font-size:.82rem;color:var(--dim);padding:18px 0 4px}\n" as *u8) 225 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) 226 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) 227 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) 228 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) 229 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) 230 w(1,".gauge.mat .gnum{color:var(--part)}.band.bmat{background:rgba(176,120,20,.16);color:var(--part)}\n" as *u8) 231 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) 232 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) 233 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) 234 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) 235 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) 236 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) 237 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) 238 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) 239 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) 240 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) 241 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) 242 w(1,".tally{margin:14px 0;font-size:.9rem;color:var(--dim)}.tally b{color:var(--ink)}\n" as *u8) 243 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) 244 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) 245 w(1,".foot{margin-top:34px;color:var(--dim);font-size:.78rem;border-top:1px solid var(--line);padding-top:14px}\n" as *u8) 246 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 247 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 248 w(1,"</style></head><body>\n" as *u8) 249 if uhn>0 { w(1,uhd) } 250 w(1,"<div class='wrap'>\n" as *u8) 251 w(1,"<p class='crumb'><a href='/'>Nishi Family</a> &rsaquo; <a href='/compare'>Compare</a> &rsaquo; " as *u8); w(1,title); w(1,"</p>\n" as *u8) 252 253 // L0 EXECUTIVE 254 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) 255 // ★HONEST MATURITY gauge -- shown NEXT TO features so the gap (navel-gazing) is public on every page 256 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) 257 w(1,"<div class='xinfo'><h1>" as *u8); w(1,title); w(1,"</h1><p class='sum'>" as *u8) 258 if summ[0]!=(0 as u8) { w(1,summ) } else { w(1,"Nishi vs the field &mdash; measured, liar-killed, sovereign." as *u8) } 259 w(1,"</p><div class='bar'><b>" as *u8); wn(1,exceeds); w(1,"</b> sovereign exceeds &middot; <b>" as *u8); wn(1,present+exceeds); w(1,"</b>/" as *u8); wn(1,axn); w(1," capabilities present &middot; bar: <b>" as *u8); w(1,cols); w(1,"</b></div>\n" as *u8) 260 // ★COMPARE-CAPABILITY inventory strip -- every measurement capability, consistent on every page 261 w(1,"<div class='caps'>compare capabilities: <span class='cap on'>matrix</span>" as *u8) 262 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) } 263 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) } 264 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) } 265 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) } 266 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) } 267 w(1,"</div></div></div>\n" as *u8) 268 269 // L1 THE CLIMB (arc / dev-log) 270 if rgn>0 { 271 w(1,"<h2>The climb &mdash; development arc</h2><div class='arc'>\n" as *u8) 272 var r: i64=0 273 while r<rgn { 274 field(buf,rgls[r],rgle[r],0,fbuf) 275 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) 276 field(buf,rgls[r],rgle[r],1,fbuf); w(1,fbuf); w(1,"</div><div class='rev'>" as *u8) 277 field(buf,rgls[r],rgle[r],2,fbuf); w(1,fbuf); w(1,"</div><div class='rnote'>" as *u8) 278 field(buf,rgls[r],rgle[r],3,fbuf); w(1,fbuf); w(1,"</div></div></div>\n" as *u8) 279 r=r+1 280 } 281 w(1,"</div>\n" as *u8) 282 } 283 284 // L2 CAPABILITY MATRIX 285 w(1,"<h2>Capabilities &mdash; measured vs the field</h2><table><thead><tr><th>Capability</th><th class='n'>Nishi</th>\n" as *u8) 286 // competitor headers from @cols (split by |) 287 var ci: i64=0 288 while ci<4 { 289 var kk: i64=field(cols,0,0,ci,fbuf) 290 // field() on a nul-terminated string: use a helper span [0, len] 291 var cl: i64=0; while cols[cl]!=(0 as u8){cl=cl+1} 292 field(cols,0,cl,ci,fbuf) 293 if fbuf[0]!=(0 as u8) { w(1,"<th class='n'>" as *u8); w(1,fbuf); w(1,"</th>" as *u8) } 294 ci=ci+1 295 } 296 w(1,"</tr></thead><tbody>\n" as *u8) 297 a=0 298 while a<axn { 299 w(1,"<tr><td>" as *u8); field(buf,axls[a],axle[a],0,fbuf); w(1,fbuf) 300 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) 301 var cc: i64=0 302 while cc<4 { 303 var cl2: i64=0; while cols[cl2]!=(0 as u8){cl2=cl2+1} 304 field(cols,0,cl2,cc,fbuf) 305 if fbuf[0]!=(0 as u8) { 306 field(buf,axls[a],axle[a],4+cc,fbuf) 307 var code: i64=0 308 if fbuf[0]==(49 as u8){code=1} if fbuf[0]==(50 as u8){code=2} if fbuf[0]==(51 as u8){code=3} 309 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) 310 } 311 cc=cc+1 312 } 313 w(1,"</tr>\n" as *u8) 314 a=a+1 315 } 316 w(1,"</tbody></table>\n" as *u8) 317 w(1,"<div class='tally'>coverage <b>" as *u8); wn(1,cov); w(1,"/1000</b> &middot; Best <b>" as *u8); wn(1,exceeds); w(1,"</b> &middot; Yes <b>" as *u8); wn(1,present); w(1,"</b> &middot; No <b>" as *u8); wn(1,absent); w(1,"</b> &middot; every Nishi cell measured by implementing-symbol on disk (no self-grading)</div>\n" as *u8) 318 319 // L3 GRANULAR EVIDENCE + REUSE 320 w(1,"<h2>Evidence &amp; reuse &mdash; so workstreams build on, not rebuild</h2>\n" as *u8) 321 a=0 322 while a<axn { 323 w(1,"<details><summary>" as *u8); field(buf,axls[a],axle[a],0,fbuf); w(1,fbuf) 324 w(1," &mdash; <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) 325 field(buf,axls[a],axle[a],8,fbuf); w(1,fbuf); w(1,"<br>organ: <code>" as *u8) 326 field(buf,axls[a],axle[a],1,fbuf); w(1,fbuf); w(1,"</code> &middot; verified-symbol: <code>" as *u8) 327 field(buf,axls[a],axle[a],2,fbuf); w(1,fbuf); w(1,"</code>" as *u8) 328 let hr: i64=field(buf,axls[a],axle[a],9,fbuf) 329 if hr>0 { w(1,"<br><span class='reuse'>REUSE:</span> " as *u8); w(1,fbuf) } 330 w(1,"</div></details>\n" as *u8) 331 a=a+1 332 } 333 334 w(1,"<p class='foot'>ONE unified view (executive &rarr; arc &rarr; capabilities &rarr; evidence/reuse) generated by nx_compare_unified from knowledge/compare/" as *u8); w(1,dom); w(1,".matrix &mdash; 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) 335 w(1,"</div>\n" as *u8) 336 if uftn>0 { w(1,uft) } 337 w(1,"</body></html>\n" as *u8) 338 return 0 339}