code wiki / (root) / nx_formatlaw_lib.nx

nx_formatlaw_lib.nx

buildroot/runtime/nx_formatlaw_lib.nx

11830 B212 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_formatlaw_lib.nx -- THE SOURCE-LAW SCANNER (operator 2026-09-02: "these are estate wide things that need autonomous management as you keep breaking them and putting 3rd parties in build lanes and using tsvs and other old crappy formats and ignoring licenses and patents"). ONE RULER, THREE LAWS, over the STRING LITERALS of a NishiLang source (comments are skipped: a law that cannot tell code from the comment describing it flags every explanation of the defect it hunts): F1 DURABLE-LEGACY-FORMAT a path literal ending .tsv .csv .sqlite .db .xml .yaml .yml .ini .toml .jsonl anywhere, and .json under knowledge/ -- durable estate state belongs in the sovereign store plane (knowledge/store/<prefix>-, nx_store_seed_lib), never a third-party file format beside it. EXEMPT: knowledge/fetched/ (mirrored evidence is whatever the publisher shipped), /tmp/ (fixtures), sites/ web_assets/ _jobs/ (wire formats a browser or a job runner reads), and specs/ (documents). F2 THIRD-PARTY-EXEC a literal beginning /bin/ /usr/bin/ /usr/local/bin/ /sbin/ /usr/sbin/ /opt/ -- a NishiLang fork needs an absolute path, so every third-party tool in a build or serving lane carries exactly this shape; the estate's own organs live under the serving root, ./ or _offc/. F3 NO-LICENSE-TIER the source carries no `license_tier:` declaration, so its shippability and its IP posture are unknown to nx_licgate and to the review queue. IT NEVER BLOCKS. Every hit is a NAMED, LOCATED finding (class, file, line, literal, remedy) for the REVIEW QUEUE plane (knowledge/store/review-, 7-col debt grammar so the estate's board readers already read it), and the same rows print to the seat at write time through the PreToolUse hook verb. A ratchet that refuses NEW offenders in the build lane is a separate decision the operator takes after seeing the queue. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_formatlaw_lib.nx nx_formatlaw.nx nx_formatlaw_gate.nx

imports: nx_syscalls.nx

imported by: nx_formatlaw.nxnx_formatlaw_gate.nx

structs

none

consts

26const FL_F1: i64 = 1
27const FL_F1J: i64 = 2
28const FL_F2: i64 = 3
29const FL_F3: i64 = 4
30const FL_CLASSES: i64 = 5 // counts array size (index 0 unused)
31const FL_MAX_LIT: i64 = 512 // a path literal longer than this is not a path
32const FL_MAX_HITS: i64 = 256 // findings kept per file; the count keeps counting past it and the report SAYS so
33const FL_HIT_WORDS: i64 = 4 // per hit: class, line, lit_start, lit_end
34const FL_CH_QUOTE: i64 = 34
35const FL_CH_BSLASH: i64 = 92
36const FL_CH_SLASH: i64 = 47
37const FL_CH_NL: i64 = 10
38const FL_CH_DOT: i64 = 46
39const FL_LICENSE_TOKEN: *u8 = "license_tier:"
41const FL_REVIEW_PLANE: *u8 = "knowledge/store/review-"
42const FL_SEV_F1: i64 = 5
43const FL_SEV_F1J: i64 = 3
44const FL_SEV_F2: i64 = 6
45const FL_SEV_F3: i64 = 4
46const FL_FNV_OFFSET: i64 = 1469598103934665603
47const FL_FNV_PRIME: i64 = 1099511628211

functions

49func fl_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
50func fl_lower(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
called by 1: fl_ends_ci
52func fl_ends_ci(b: *u8, a: i64, e: i64, lit: *u8) -> i64
called by 1: fl_class_format calls 2: fl_slenfl_lower
59func fl_starts(b: *u8, a: i64, e: i64, lit: *u8) -> i64
66func fl_contains(b: *u8, a: i64, e: i64, lit: *u8) -> i64
80func fl_fnv(b: *u8, a: i64, e: i64, seed: i64) -> i64
88func fl_class_format(b: *u8, a: i64, e: i64) -> i64
116func fl_class_exec(b: *u8, a: i64, e: i64) -> i64
called by 1: fl_scan calls 1: fl_starts
130func fl_is_bare_ext(b: *u8, a: i64, e: i64) -> i64
called by 1: fl_class_format
136func fl_class_name(c: i64) -> *u8
called by 1: flc_report
143func fl_remedy(c: i64) -> *u8
called by 1: flc_report
150func fl_sev(c: i64) -> i64
called by 1: flc_report
162func fl_scan(b: *u8, n: i64, hits: *i64, counts: *i64) -> i64
212func fl_kept(total: i64) -> i64 { if total > FL_MAX_HITS { return FL_MAX_HITS } return total }