nx_pm_discover.nx source
↩ module page · 25 lines · 1025 B
1// nx_pm_discover.nx -- the Nishi PM's project-discovery TOOL (standalone).
2//
3// Runs the live Gitea discovery + meta-project organization (reusing
4// nx_wiki_projects_handle) and emits the rendered /wiki/projects page to
5// stdout. Decoupled from the sites daemon (whose graph + the HTTP client
6// hang the compiler), so it compiles fast like the probe. The daemon serves
7// the emitted page from a file; this tool refreshes it (cron/gate/on-demand)
8// -- sovereign auto-discovery, no curation.
9//
10// Status: V1. 2026-05-31.
11import "nx_syscalls.nx"
12import "wiki/nx_wiki_projects.nx"
13const K_MAGIC_262144: i64 = 262144
14
15func main() -> i64 {
16 let buf: *u8 = sys_mmap(K_MAGIC_262144)
17 let nb: *i64 = (sys_mmap(8)) as *i64
18 nb[0] = 0
19 let rc: i64 = nx_wiki_projects_handle(buf, K_MAGIC_262144, nb)
20 if rc != NX_PJ_OK { sys_write(1, "DISCOVER_FAILED\n" as *u8, 16); return 1 }
21 let n: i64 = nb[0]
22 // Emit the full HTTP response (headers + rendered page) to stdout.
23 sys_write(1, buf, n)
24 return 0
25}