code wiki / _hdl_build / nx_train_triage_cli.nx
nx_train_triage_cli.nx source
↩ module page · 25 lines · 1249 B
1// nx_train_triage_cli.nx -- the Doctor's front door: nx_train_triage_cli <report-file>
2// prints the named verdict + gate-proven fix and appends a durable row to
3// knowledge/status/train_triage.log. Exit 0 = diagnosis produced (verdict is the DATA);
4// exit 2 = broken report (the emitting lane is the defect). license_tier: ORIGINAL
5import "nx_train_triage.nx"
6
7func main(argc: i64, argv: *i64) -> i64 {
8 if argc < 2 { tt_w(1, "usage: nx_train_triage_cli <report-file>\n" as *u8); sys_exit(2); return 2 }
9 let path: *u8 = argv[1] as *u8
10 let id: i64 = tt_diagnose(path)
11 tt_w(1, "TRIAGE report=" as *u8); tt_w(1, path)
12 tt_w(1, " verdict=" as *u8); tt_w(1, tt_name(id))
13 tt_w(1, " fix=" as *u8); tt_w(1, tt_fix(id)); tt_w(1, "\n" as *u8)
14 let lfd: i64 = sys_openat_append("knowledge/status/train_triage.log" as *u8, 0x1a4)
15 if lfd >= 0 {
16 tt_w(lfd, "TRIAGE epoch=" as *u8); tt_wn(lfd, sys_now_realtime_sec())
17 tt_w(lfd, " report=" as *u8); tt_w(lfd, path)
18 tt_w(lfd, " verdict=" as *u8); tt_w(lfd, tt_name(id))
19 tt_w(lfd, " fix=" as *u8); tt_w(lfd, tt_fix(id)); tt_w(lfd, "\n" as *u8)
20 sys_close(lfd)
21 }
22 if id == TT_BROKEN { sys_exit(2); return 2 }
23 sys_exit(0)
24 return 0
25}