nx_app_publish.nx source
↩ module page · 33 lines · 1937 B
1// nx_app_publish.nx -- the ONE native command to publish an app into the Nishi
2// ecosystem: registers it in the sovereign app store (nx_app_store / seg_store).
3// Once registered, `nx_family_hub` auto-adds its card and `nx_app_monitor` auto-
4// watches it -- no direct-linking, no hunting, nothing lost or unmonitored.
5// nx_app_publish <name> <path> <title> <blurb> <category> <marker>
6// (category: make|play|home ; marker: a string that must appear in the served body)
7// Additive: re-publishing a name records a new version; the registry view shows latest.
8// license_tier: ORIGINAL
9import "nx_syscalls.nx"
10import "nx_app_store.nx"
11const K_MAGIC_8192: i64 = 8192
12
13func pw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
14func pcat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ dst[off+i]=s[i]; i=i+1 } return off+i }
15
16func main(argc: i64, argv: *i64) -> i64 {
17 if argc < 7 {
18 pw("usage: nx_app_publish <name> <path> <title> <blurb> <category> <marker>\n" as *u8)
19 sys_exit(2); return 2
20 }
21 let name: *u8 = argv[1] as *u8
22 let rec: *u8 = sys_mmap(K_MAGIC_8192)
23 var o: i64 = pcat(rec, 0, argv[2] as *u8); rec[o]=9 as u8; o=o+1 // path
24 o = pcat(rec, o, argv[3] as *u8); rec[o]=9 as u8; o=o+1 // title
25 o = pcat(rec, o, argv[4] as *u8); rec[o]=9 as u8; o=o+1 // blurb
26 o = pcat(rec, o, argv[5] as *u8); rec[o]=9 as u8; o=o+1 // category
27 o = pcat(rec, o, argv[6] as *u8) // marker
28 let rc: i64 = nx_app_store_put(name, rec, o)
29 if rc != 0 { pw("APP-PUBLISH-FAIL store rc!=0\n" as *u8); sys_exit(1); return 1 }
30 pw("APP-PUBLISH-OK registered '" as *u8); pw(name); pw("' in the sovereign app store.\n" as *u8)
31 pw(" next: nx_family_hub (auto-adds the card) + nx_aw_push (deploy) + nx_app_monitor (watch)\n" as *u8)
32 sys_exit(0); return 0
33}