nx_doc_xref_real_audit_test.nx source
↩ module page · 29 lines · 863 B
1// nx_doc_xref_real_audit_test.nx -- substrate-wide broken-ref audit.
2//
3// Two-pass walk of nxc2/docs/: builds names_blob from .md filenames,
4// then scans each doc for [[X]] refs + validates each against the
5// blob. Emits broken-ref lines + aggregate verdict to stdout.
6
7import "nx_syscalls.nx"
8import "nx_string_ops.nx"
9import "nx_dir.nx"
10import "nx_doc_xref.nx"
11
12func main() -> i64 {
13 let path: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/docs"
14 let path_len: i64 = 39
15
16 let counts_buf: *u8 = sys_mmap(64)
17 let counts: *NxDocXrefCounts = counts_buf as *NxDocXrefCounts
18 nx_doc_xref_counts_init(counts)
19
20 let rc: i64 = nx_doc_xref_walk_dir(path, path_len, counts)
21 if rc != 0 { return 10 }
22
23 nx_doc_xref_report_stdout(counts)
24
25 if counts.n_docs_scanned < 1 { return 1 }
26 if counts.n_names_indexed < 1 { return 2 }
27
28 return 0
29}