code wiki / (root) / nx_site_publish_lib.nx

nx_site_publish_lib.nx

buildroot/runtime/nx_site_publish_lib.nx

8937 B152 linesdepth 6pulls 12 transitivereach 2 importersview sourcekind librarytopic site
docsdependenciesstructsconstsfunctions

about

nx_site_publish_lib.nx -- ARTIFACT-PUBLISH, LIBRARY half (sp_main dispatcher) capability (closes the coverage BUILD-queue gap "artifact-publish"; retires the ssh-cat content lane for pages). Places a NAS-local file into the live sites docroot the SAFE way, composing the proven IO layer: publish <src-file> <site> <relpath> -> sites/<site>/<relpath> - ATOMIC placement via fsx_write (tmp+fsync+rename -- a browser never sees a torn page) - PRIOR VERSION PRESERVED: an existing target is first copied to <relpath>.prev (rename-not-delete doctrine; one-deep history -- generated artifacts, git holds sources) - DENY BY CONSTRUCTION (fsx_write_denied: secrets/device-ns/allowlist) PLUS path-traversal refusal: any ".." segment or absolute site/relpath is DENIED (an MCP caller must not escape the docroot) The organ prints the live URL; verification is the SEPARATE browser-grade organ (composition, not a built-in fallback): run nx_page_verify <url> from a WAN vantage (on-NAS bare-domain fetches hit DSM -- the documented trap). The publish->verify recipe is the contract; this organ does the placement half. - THE PUBLISH GATEWAY (F763 second half, wired 2026-07-30): for a site listed in knowledge/pub_sites.conf, a <relpath> absent from that site's publishing REGISTRY -- or carrying a non-publishable status (withdrawn/redirect/debris) -- is REFUSED. This is the half that makes "random and arbitrary" impossible instead of merely visible: nx_pub_desk stated the rule in 2026-07-19 and its own header recorded that enforcement inside the publish organ was never wired, so anything could be dropped into any docroot and become site truth. MEASURED before wiring: 54 pages served on nishifamily.com were in NO registry. Sites NOT in the site table publish UNGATED (with a warning) -- onboarding is a config row, and a control that refuses everything on day one is a control someone disables by lunchtime. exit: 0 ok | 2 usage | 3 src absent | 4 io | 5 DENIED license_tier: ORIGINAL

dependencies 2 imports · 2 importers

nx_fsops_lib.nx nx_pub_lib.nx nx_site_publish_lib.nx nx_site_publish.nx nx_site_publish_gate.nx

imports: nx_fsops_lib.nxnx_pub_lib.nx

imported by: nx_site_publish.nxnx_site_publish_gate.nx

structs

none

consts

26const PB_ARG_VERB: i64 = 1 // argv: verb ("publish")
27const PB_RC_USAGE: i64 = 2 // exit: usage
28const PB_ARG_SRC: i64 = 2 // argv: source file (NAS-local)
29const PB_ARG_SITE: i64 = 3 // argv: site dir under sites/
30const PB_ARG_REL: i64 = 4 // argv: page path under the site
31const PB_ARGC: i64 = 5 // publish src site relpath
32const PB_PATH: i64 = 1024 // destination path buffer
33const PB_CONFCAP: i64 = 65536 // site-table read buffer (the gateway)
34const PB_SPANCAP: i64 = 128 // site-table span vector
35const PB_DOT: i64 = 46 // '.'
36const PB_SLASH: i64 = 47 // '/'

functions

39func pb_traversal(s: *u8) -> i64
called by 1: sp_main
50func pb_app(out: *u8, op: *i64, s: *u8) -> i64
called by 1: sp_main
59func sp_main(argc: i64, argv: *i64) -> i64