code wiki / (root) / nx_formatlaw.nx

nx_formatlaw.nx

buildroot/runtime/nx_formatlaw.nx

13616 B245 linesdepth 5pulls 8 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_formatlaw.nx -- the SOURCE-LAW CLI over nx_formatlaw_lib: scan sources for durable legacy-format literals (F1/F1J), third-party executable paths (F2) and a missing license_tier (F3); print every finding NAMED and LOCATED; optionally file each one into the REVIEW QUEUE plane. Never blocks, never refuses a build. nx_formatlaw scan <file.nx>... findings per file + a FORMATLAW summary line per file, exit 0 clean / 1 flagged nx_formatlaw tree <dir> [<dir>...] every .nx directly under each dir (the two source roots), same output nx_formatlaw review <actor> <file.nx>... scan AND append one 7-col row per finding to knowledge/store/review- (id=fl_<fnv>, dedupe by id so a re-run files nothing twice) nx_formatlaw hook PreToolUse/Write pre-flight: reads the hook JSON on stdin, scans the `content` about to be written when `file_path` ends .nx, prints the findings as advisories, ALWAYS exits 0 license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_formatlaw_lib.nx nx_json_lib.nx nx_store_seed_lib.nx nx_formatlaw.nx

imports: nx_syscalls.nxnx_formatlaw_lib.nxnx_json_lib.nxnx_store_seed_lib.nx

imported by: nobody (leaf or entry point)

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

main 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 sys_write ↻ nxa_dump_sizes sys_write ↻ sys_write ↻ sys_exit ↻ fl_starts fl_slen flc_slen sys_read jx_get_str jx_len sys_mmap ↻ jx_find jx_len ↻ jx_skip_ws jx_copy_str jx_copy_str_ctl jx_hex4 jx_hexdig jx_emit_utf8 jx_utf8_scalar_width flc_ends flc_slen ↻ jx_get_str_raw jx_len ↻ sys_mmap ↻ jx_find ↻

structs

none

consts

18const FLC_OUT: i64 = 262144
19const FLC_IN: i64 = 4194304 // the hook payload (a whole source file inside JSON): sized from the largest emitter (~340 KB) x 12 headroom
20const FLC_PATH: i64 = 4096
21const FLC_LIT_SHOW: i64 = 120 // a literal is shown to this many bytes; the count is never trimmed
22const FLC_DENTS: i64 = 65536
23const FLC_ROW: i64 = 2048
24const FLC_CH_NL: i64 = 10
25const FLC_CH_TAB: i64 = 9
26const FLC_CH_DOT: i64 = 46
27const FLC_CH_SLASH: i64 = 47
28const FLC_REVIEW_STATUS: *u8 = "open"
29const FLC_REVIEW_SCOPE_PFX: *u8 = "formatlaw/"

functions

31func flc_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
32func flc_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } return p }
33func flc_catn(d: *u8, o: i64, s: *u8, a: i64, e: i64) -> i64 { var p: i64 = o; var i: i64 = a; while i < e { d[p] = s[i]; p = p + 1; i = i + 1 } return p }
called by 1: flc_report
34func flc_num(d: *u8, o: i64, v: i64) -> i64
called by 2: flc_reportmain calls 2: sys_mmapsys_munmap
47func flc_hex(d: *u8, o: i64, v: i64) -> i64
called by 1: flc_report
53func flc_ends(s: *u8, lit: *u8) -> i64
called by 1: main calls 1: flc_slen
63func flc_report(label: *u8, b: *u8, n: i64, out: *u8, hits: *i64, counts: *i64, plane: *u8, actor: *u8, filed: *i64) -> i64
146func flc_scan_path(path: *u8, out: *u8, hits: *i64, counts: *i64, plane: *u8, actor: *u8, filed: *i64) -> i64
157func main(argc: i64, argv: *i64) -> i64