nx_image_grade_cli.nx
buildroot/runtime/nx_image_grade_cli.nx
about
nx_image_grade_cli.nx -- substrate's image-grading CLI binary.
CAPABILITY_COMPLETENESS: PARTIAL
MISSING_CAPABILITIES:
- argv-driven file-path input: substrate's `main()` has no
argv access in the current bootstrap convention; v1 reads
image bytes from STDIN. Calling pattern:
cat image.jpg | nishi-image-grade (or)
nishi-image-grade < image.jpg
- structured output: v1 emits one human-readable line per
axis; v2 (queued) emits canonical JSONL via
nx_jsonl_writer so callers can compose against the
ledger.
- exit-code mapping per failure tier: v1 returns 0 on
decode success, 1 on decoder error.
COVERED:
- stdin -> bytes (up to 16 MiB cap)
- format auto-detect via nx_image_grade_v2
- PNG / JPEG decode + skin mask + segmenter + landmark
labeler + 8 axes invoked on real pixel data
- per-axis line emitted to stdout: "axis_id status verdict
score phrase"
- stderr message on decode error
Usage:
nxc2 --target x86_64 nx_image_grade_cli.nx > cli.s
nx_assembler cli.s -> cli.elf
cat image.jpg | ./cli.elf
genealogy_id: substrate_image_grade_cli_2026_05_16
lineage_id: nx_image_grade_cli_v1
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_runtime.nxnx_tier.nxnx_image_grade_v2.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 38 | const NX_MAGIC_65536: i64 = 65536 |
| 40 | const NX_CLI_MAX_IMAGE_BYTES: nx_int = 16777216 // 16 MiB |
| 41 | const NX_CLI_READ_CHUNK: nx_int = 65536 // 64 KiB read chunks |
| 42 | const NX_CLI_LINE_BUF: nx_int = 256 |
functions
| 48 | func _cli_slurp_stdin(buf: *u8, max: nx_int) -> nx_int |
| 75 | func _cli_write_int(buf: *u8, off: nx_int, v: nx_int) -> nx_int |
| 109 | func _cli_write_cstr(buf: *u8, off: nx_int, src: *u8, cap: nx_int) -> nx_int |
| 127 | func _cli_write_lit(buf: *u8, off: nx_int, lit: *u8) -> nx_int |
| 133 | func _cli_status_label(status: nx_int) -> *u8 called by 1: _cli_emit_axis |
| 151 | func _cli_emit_axis(ax: *NxIgv2AxisVerdict) -> nx_int called by 1: main calls 6: sys_mmap_cli_write_lit_cli_write_int_cli_write_cstr_cli_status_labelsys_write |
| 176 | func _cli_emit_header(r: *NxIgv2Report) -> nx_int |
| 201 | func main() -> nx_int |