code wiki / (root) / nx_compare_serve.nx

nx_compare_serve.nx

buildroot/runtime/nx_compare_serve.nx

8598 B140 linesdepth 7pulls 9 transitivereach 1 importersview sourcekind servicetopic compare
docsdependenciesstructsconstsfunctions

about

nx_compare_serve.nx -- fork-exec backend for the `nishi_compare` MCP tool. v2 SINGLE-SOURCE: serves the EXACT file the public REST endpoint serves (sites/nishifamily/compare/... relative to the tools-API CWD = nishihost) -- there is NO second copy to drift (operator 2026-07-09: no frozen snapshots). Domain map: "index" -> the comparison index api.json, "openapi" -> the OpenAPI 3.1 contract, "measurement" -> the existing maturity/measurement.json resource, investment -> maturity/investment.json, else -> <domain>/api.json. Additive command: bindings <domain> returns a public-policy-checked artifact manifest. No recomputation here: nx_compare_regen, nx_sota_status and nx_tokroi own their respective reports. SECURITY: the caller-supplied domain is sanitized to [a-z]{1,40} ONLY -> no path traversal / injection. Absent file -> structured JSON error envelope. license_tier: ORIGINAL expect_exit:0

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_compare_openapi.nx nx_compare_serve.nx nx_compare_bindings_gate.nx

imports: nx_syscalls.nxnx_compare_openapi.nx

imported by: nx_compare_bindings_gate.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main streq cs_bindings err_json wc sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable nxa_dump_sizes sys_write ↻ w sys_write ↻ san_ok cs_public sys_mmap ↻ cs_complete sys_openat_rd sys_lseek sys_close sys_mmap ↻ cgo_read sys_munmap sys_munmap ↻ cg_required sys_mmap ↻ cg_eol cg_row_fields cg_sl_eq cg_slen cg_access_level cg_sl_eq ↻

structs

none

consts

12const CS_SIGNED_I64_MAX: i64 = 9223372036854775807

functions

14func 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 }
called by 1: err_json calls 1: sys_write
15func wc(fd: i64, code: i64) -> i64 { let t: *u8 = sys_mmap(2); t[0] = code as u8; sys_write(fd, t, 1); return 0 }
called by 1: err_json calls 2: sys_mmapsys_write
16func scopy(dst: *u8, doff: i64, src: *u8) -> i64 { var i: i64 = 0; while src[i] != (0 as u8) { dst[doff+i] = src[i]; i = i + 1 } return doff + i }
called by 2: cs_bindingsmain
17func 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 }
called by 2: mainmain
18func san_ok(s: *u8) -> i64
called by 3: maincs_bindingsmain
24func err_json(code: *u8, dom: *u8) -> i64
called by 2: cs_bindingsmain calls 2: wcw
33func cs_complete(path: *u8, size: *i64) -> *u8
48func cs_public(domain: *u8) -> i64
58func cs_bindings(argc: i64, argv: *i64) -> i64
102func main(argc: i64, argv: *i64) -> i64