code wiki / _hdl_build / nx_pub_submit.nx
nx_pub_submit.nx source
↩ module page · 41 lines · 2023 B
1// nx_pub_submit.nx -- THE NISHI PUBLISHER intake CLI (the law-compliant front door).
2//
3// Operator law [[project-nishi-publisher-role-2026-06-20]]: NO workstream pushes to nishifamily.com
4// directly; every publish flows through pub_submit -> the durable, concurrency-safe queue. nx_publisher.nx
5// exposes pub_submit() as a FUNCTION but there was no CLI; this is the thin, reusable driver so any rung
6// (gallery UI, login, thumbnails, ...) submits a build artifact through the one front door.
7//
8// usage: nx_pub_submit <src> <dest> <site> <requester> <policy>
9// src = local artifact path (the verified build output)
10// dest = ABSOLUTE NAS path of the live target (e.g. /volume1/ai/galx/nx_gallery_serve.elf)
11// site = logical site (e.g. nishifamily)
12// requester= the submitting workstream (audit trail)
13// policy = free-form policy tag (e.g. binary-galx-serve)
14// Returns 0 on durable submit; the publisher SHIPS (nx_pub_ship) + the owning supervisor PROMOTES.
15// license_tier: ORIGINAL
16import "nx_publisher.nx"
17import "nx_syscalls.nx"
18
19func sub_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return n }
20
21func main(argc: i64, argv: *i64) -> i64 {
22 if argc < 6 {
23 sub_puts("usage: nx_pub_submit <src> <dest> <site> <requester> <policy>\n" as *u8)
24 sys_exit(2); return 2
25 }
26 pub_init()
27 let src: *u8 = argv[1] as *u8
28 let dest: *u8 = argv[2] as *u8
29 let site: *u8 = argv[3] as *u8
30 let req: *u8 = argv[4] as *u8
31 let pol: *u8 = argv[5] as *u8
32 let rc: i64 = pub_submit(src, dest, site, req, pol)
33 if rc == 1 {
34 sub_puts("PUB-SUBMIT OK (durable, sha-identified) src=" as *u8); sub_puts(src)
35 sub_puts(" -> dest=" as *u8); sub_puts(dest); sub_puts("\n" as *u8)
36 sys_exit(0); return 0
37 }
38 if rc == (0 - 9) { sub_puts("PUB-SUBMIT FAIL: src missing\n" as *u8); sys_exit(9); return 9 }
39 sub_puts("PUB-SUBMIT FAIL (queue append error)\n" as *u8)
40 sys_exit(1); return 1
41}