code wiki / _hdl_build / nx_capability_shape.nx

nx_capability_shape.nx

buildroot/runtime/_hdl_build/nx_capability_shape.nx

2862 B44 linesdepth 3pulls 3 transitivereach 4 importersview sourcekind librarytopic capability
docsdependenciesstructsconstsfunctions

about

nx_capability_shape.nx -- grade an organ on the "PERFECT OBJECT" axes (operator: "climb logically into perfect objects that arent too big or small but like linux tools exist perfectly in their spaces"). The existing lineage system grades biological seed-to-feed + sovereignty-evolution; NEITHER grades capability SIZING. This does: per organ, measure FUNCTION COUNT (proxy for single-responsibility / right-size) + REUSE (how many .nx import it = a shared building block) and grade TOO_SMALL (trivial -> merge/inline #15/#22) / PERFECT (one cohesive capability, ~3-30 funcs) / TOO_BIG (likely >1 responsibility -> split #9). Tunable heuristic, not a law -- a Linux tool `true` is tiny + `grep` is bigger; the grade is a PROMPT to review, not an auto-edit. Composes the sovereign grep (oc_grep) for reuse. READ-ONLY (never-brick). license_tier: ORIGINAL

dependencies 2 imports · 3 importers

nx_organ_callers.nx nx_syscalls.nx nx_capability_shape.nx nx_capability_genealogy.nx nx_capability_shape_audit.nx nx_capability_shape_gate.nx

imports: nx_organ_callers.nxnx_syscalls.nx

imported by: nx_capability_genealogy.nxnx_capability_shape_audit.nxnx_capability_shape_gate.nx

structs

none

consts

12const CS_TOO_SMALL: i64 = 0
13const CS_PERFECT: i64 = 1
14const CS_TOO_BIG: i64 = 2
15const CS_MIN_FUNCS: i64 = 3 // < this = trivial = merge/inline candidate
16const CS_MAX_FUNCS: i64 = 30 // > this = likely multiple responsibilities = split candidate

functions

18func cs_isident(c: i64) -> i64 { if c>=97 { if c<=122 { return 1 } } if c>=65 { if c<=90 { return 1 } } if c>=48 { if c<=57 { return 1 } } if c==95 { return 1 } return 0 }
called by 1: cs_funccount
20func cs_funccount(buf: *u8, n: i64) -> i64
called by 2: cs_funcscsa_walk calls 1: cs_isident
31func cs_funcs(path: *u8) -> i64
39func cs_grade(funcs: i64) -> i64 { if funcs < CS_MIN_FUNCS { return CS_TOO_SMALL } if funcs > CS_MAX_FUNCS { return CS_TOO_BIG } return CS_PERFECT }
40func cs_grade_name(g: i64) -> *u8 { if g==0 { return "TOO_SMALL(merge/inline)" as *u8 } if g==2 { return "TOO_BIG(split)" as *u8 } return "PERFECT" as *u8 }
called by 2: mainmain
42func cs_reuse(import_needle: *u8, hits: *u8, hitoff: *i64) -> i64
called by 2: mainmain calls 1: oc_grep