code wiki / _hdl_build / nx_capability_shape.nx
nx_capability_shape.nx
buildroot/runtime/_hdl_build/nx_capability_shape.nx
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
imports: nx_organ_callers.nxnx_syscalls.nx
imported by: nx_capability_genealogy.nxnx_capability_shape_audit.nxnx_capability_shape_gate.nx
structs
| none |
consts
| 12 | const CS_TOO_SMALL: i64 = 0 |
| 13 | const CS_PERFECT: i64 = 1 |
| 14 | const CS_TOO_BIG: i64 = 2 |
| 15 | const CS_MIN_FUNCS: i64 = 3 // < this = trivial = merge/inline candidate |
| 16 | const CS_MAX_FUNCS: i64 = 30 // > this = likely multiple responsibilities = split candidate |
functions
| 18 | func 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 |
| 20 | func cs_funccount(buf: *u8, n: i64) -> i64 |
| 31 | func cs_funcs(path: *u8) -> i64 |
| 39 | func 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 } |
| 40 | func 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 } |
| 42 | func cs_reuse(import_needle: *u8, hits: *u8, hitoff: *i64) -> i64 |