nx_formatlaw_lib.nx
buildroot/runtime/nx_formatlaw_lib.nx
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
imports: nx_syscalls.nx
imported by: nx_formatlaw.nxnx_formatlaw_gate.nx
structs
| none |
consts
| 26 | const FL_F1: i64 = 1 |
| 27 | const FL_F1J: i64 = 2 |
| 28 | const FL_F2: i64 = 3 |
| 29 | const FL_F3: i64 = 4 |
| 30 | const FL_CLASSES: i64 = 5 // counts array size (index 0 unused) |
| 31 | const FL_MAX_LIT: i64 = 512 // a path literal longer than this is not a path |
| 32 | const FL_MAX_HITS: i64 = 256 // findings kept per file; the count keeps counting past it and the report SAYS so |
| 33 | const FL_HIT_WORDS: i64 = 4 // per hit: class, line, lit_start, lit_end |
| 34 | const FL_CH_QUOTE: i64 = 34 |
| 35 | const FL_CH_BSLASH: i64 = 92 |
| 36 | const FL_CH_SLASH: i64 = 47 |
| 37 | const FL_CH_NL: i64 = 10 |
| 38 | const FL_CH_DOT: i64 = 46 |
| 39 | const FL_LICENSE_TOKEN: *u8 = "license_tier:" |
| 41 | const FL_REVIEW_PLANE: *u8 = "knowledge/store/review-" |
| 42 | const FL_SEV_F1: i64 = 5 |
| 43 | const FL_SEV_F1J: i64 = 3 |
| 44 | const FL_SEV_F2: i64 = 6 |
| 45 | const FL_SEV_F3: i64 = 4 |
| 46 | const FL_FNV_OFFSET: i64 = 1469598103934665603 |
| 47 | const FL_FNV_PRIME: i64 = 1099511628211 |
functions
| 49 | func fl_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 50 | func fl_lower(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c } called by 1: fl_ends_ci |
| 52 | func fl_ends_ci(b: *u8, a: i64, e: i64, lit: *u8) -> i64 |
| 59 | func fl_starts(b: *u8, a: i64, e: i64, lit: *u8) -> i64 |
| 66 | func fl_contains(b: *u8, a: i64, e: i64, lit: *u8) -> i64 |
| 80 | func fl_fnv(b: *u8, a: i64, e: i64, seed: i64) -> i64 |
| 88 | func fl_class_format(b: *u8, a: i64, e: i64) -> i64 |
| 116 | func fl_class_exec(b: *u8, a: i64, e: i64) -> i64 |
| 130 | func fl_is_bare_ext(b: *u8, a: i64, e: i64) -> i64 called by 1: fl_class_format |
| 136 | func fl_class_name(c: i64) -> *u8 called by 1: flc_report |
| 143 | func fl_remedy(c: i64) -> *u8 called by 1: flc_report |
| 150 | func fl_sev(c: i64) -> i64 called by 1: flc_report |
| 162 | func fl_scan(b: *u8, n: i64, hits: *i64, counts: *i64) -> i64 |
| 212 | func fl_kept(total: i64) -> i64 { if total > FL_MAX_HITS { return FL_MAX_HITS } return total } |