code wiki / _hdl_build / nx_pub_todos.nx

nx_pub_todos.nx source

↩ module page · 111 lines · 6984 B

1// nx_pub_todos.nx -- the NISHI PUBLISHER's PIPELINE / TO-DO board: expose, on nishifamily.com, every site that is 2// BUILT + STAGED but not yet live -- and exactly what it needs to move forward (operator: "sites without domains 3// ... the publisher should expose on nishifamily.com as to-dos and what we need to move forward on"). DATA-DRIVEN: 4// the per-site to-dos come from a HAND-EDITABLE web_assets/publish_todos.data (site|name|status|needs|next), and 5// the live "pages staged + held" count is DERIVED from the real publisher staging queue. Sovereign ZERO-JS. Then 6// it STAGES ITSELF (held, outward) for nishifamily.com so the operator approves it to go live. license_tier: ORIGINAL 7// run: /tmp/nx_pub_todos.sov.elf -> web_assets/site_nishifamily/pipeline.html (+ staged held) 8import "nx_syscalls.nx" 9import "nx_meet_lib.nx" 10import "nx_web_builder.nx" 11import "nx_brand_tokens.nx" 12import "nx_publisher.nx" 13const K_MAGIC_1024: i64 = 1024 14const K_MAGIC_2048: i64 = 2048 15const K_MAGIC_4096: i64 = 4096 16 17func fdnum(fd: i64, v0: i64) -> i64 { var v: i64=v0; if v<0{sys_write(fd,"-" as *u8,1);v=0-v} let b: *u8=sys_mmap(28); var k: i64=0; if v==0{b[0]=48 as u8;k=1} while v>0{b[k]=(48+(v%10)) as u8;v=v/10;k=k+1} let o: *u8=sys_mmap(28); var j: i64=0; while j<k{o[j]=b[k-1-j];j=j+1} sys_write(fd,o,k); return 0 } 18// non-overlapping occurrence count of needle in hay[0..n). 19func pt_count(hay: *u8, n: i64, needle: *u8) -> i64 { 20 let nl: i64 = mlen(needle); if nl == 0 { return 0 } 21 var c: i64 = 0; var i: i64 = 0 22 while i + nl <= n { var k: i64=0; var hit: i64=1; while k<nl { if hay[i+k]!=needle[k]{hit=0;k=nl}else{k=k+1} } if hit==1 {c=c+1; i=i+nl} else {i=i+1} } 23 return c 24} 25 26func todos_default() -> *u8 { 27 return "site|Community Meet (recruiter / meet platform)|Built + staged, HELD|A domain + a real brand (now the demo placeholder); operator approval to deploy|Pick a domain + brand, re-stage, then approve the content sha -- the publisher deploys + signs a receipt\nsite|andelinwest.com|LIVE|Nothing blocking|Close the CMS exceed-depth backlog; wire the live scheduler POST route\nsite|This pipeline board|Staged for nishifamily.com|Operator approval to expose it live|Approve to publish this to-do board on nishifamily.com\n" as *u8 28} 29 30func main() -> i64 { 31 // DERIVED live state: pages staged + held in the publisher's meet staging queue 32 let qlp: *i64 = sys_mmap(16) as *i64; qlp[0] = 0 33 var qd: *u8 = sys_read_file("knowledge/publish/meet_stage_queue.tsv" as *u8, qlp) 34 var qn: i64 = qlp[0] 35 if (qd as i64) == 0 { qn = 0 } 36 let staged: i64 = pt_count(qd, qn, "PENDING" as *u8) 37 38 // editable to-do data (seed default if absent) 39 let dpath: *u8 = "web_assets/publish_todos.data" as *u8 40 let dlp: *i64 = sys_mmap(16) as *i64; dlp[0] = 0 41 var dd: *u8 = sys_read_file(dpath, dlp) 42 var dn: i64 = dlp[0] 43 if (dd as i64) == 0 { dn = 0 } 44 if dn <= 0 { 45 let def: *u8 = todos_default() 46 let sfd: i64 = sys_openat_wr(dpath, 0x1a4) 47 if sfd >= 0 { sys_write(sfd, def, mlen(def)); sys_close(sfd) } 48 dd = def; dn = mlen(def) 49 } 50 51 let sdir: *u8 = "web_assets/site_nishifamily" as *u8 52 meet_mkdir(sdir) 53 let opath: *u8 = "web_assets/site_nishifamily/pipeline.html" as *u8 54 let brandtok: *u8 = bt_default_brand() 55 56 let fd: i64 = sys_openat_wr(opath, 0x1a4) 57 if fd < 0 { mputs("nx_pub_todos: FAIL open output\n" as *u8); sys_exit(1); return 1 } 58 wb_doc_open_branded(fd, "Nishi Publishing Pipeline -- To-Dos" as *u8, brandtok, bt_len(brandtok)) 59 meet_nav_css(fd) 60 wb_w(fd, "<header><div class=\"wrap\"><span class=\"brand\">Nishi Family</span><nav class=\"nav\" aria-label=\"Primary\"><a href=\"/\">Home</a></nav></div></header>\n" as *u8) 61 wb_hero(fd, "Publishing pipeline -- what we need to move forward" as *u8, "Sites built and staged in the Nishi publisher. A site does not need a domain to be built and staged here -- it waits, held, until it has a domain and your approval to deploy." as *u8, "How approval works" as *u8, "#how" as *u8) 62 63 wb_w(fd, "<div class=\"wrap\"><div class=\"trust\">Pipeline: " as *u8); fdnum(fd, staged); wb_w(fd, " pages staged and HELD (outward policy = fail-closed; nothing deploys without operator approval of the content sha)</div></div>\n" as *u8) 64 65 wb_cards_open(fd, "Sites &amp; to-dos" as *u8) 66 let ename: *u8 = sys_mmap(K_MAGIC_1024) 67 let estat: *u8 = sys_mmap(K_MAGIC_1024) 68 let eneed: *u8 = sys_mmap(K_MAGIC_2048) 69 let enext: *u8 = sys_mmap(K_MAGIC_4096) 70 let rawb: *u8 = sys_mmap(K_MAGIC_4096) 71 var sites: i64 = 0 72 var i: i64 = 0 73 while i < dn { 74 var le: i64 = i 75 while le < dn { if dd[le] == (10 as u8) { break } le = le + 1 } 76 var p0: i64 = 0 - 1 77 var k: i64 = i 78 while k < le { if dd[k] == (124 as u8) { if p0 < 0 { p0 = k } } k = k + 1 } 79 if p0 >= 0 { 80 if meet_seq(dd, i, p0, "site" as *u8, 4) == 1 { 81 mfield(dd, i, le, 1, rawb, K_MAGIC_4096); mesc(ename, 0, rawb) 82 mfield(dd, i, le, 2, rawb, K_MAGIC_4096); mesc(estat, 0, rawb) 83 mfield(dd, i, le, 3, rawb, K_MAGIC_4096); mesc(eneed, 0, rawb) 84 mfield(dd, i, le, 4, rawb, K_MAGIC_4096); mesc(enext, 0, rawb) 85 wb_w(fd, "<div class=\"card\"><h3>" as *u8); wb_w(fd, ename) 86 wb_w(fd, "</h3><p><b>Status:</b> " as *u8); wb_w(fd, estat) 87 wb_w(fd, "</p><p><b>Needs:</b> " as *u8); wb_w(fd, eneed) 88 wb_w(fd, "</p><p><b>Next:</b> " as *u8); wb_w(fd, enext); wb_w(fd, "</p></div>\n" as *u8) 89 sites = sites + 1 90 } 91 } 92 i = le + 1 93 } 94 wb_cards_close(fd) 95 96 wb_w(fd, "<section class=\"wrap\" id=\"how\"><h2>How a site goes live</h2><p>1. Build + stage (done by the team, held). 2. Give it a domain + brand. 3. The operator approves the exact content sha (pub_approve). 4. The publisher promotes it to the NAS (stage -> verify-sha -> atomic-promote) and signs an Ed25519 receipt.</p></section>\n" as *u8) 97 wb_footer(fd, "Nishi Family -- sovereign publishing pipeline (this board is itself staged, held, for nishifamily.com)" as *u8) 98 wb_doc_close(fd) 99 sys_close(fd) 100 101 // STAGE this board (held, outward) for nishifamily.com so the operator approves it to expose it live 102 pub_init() 103 let TQ: *u8 = "knowledge/publish/site_todos_queue.tsv" as *u8 104 let tfd: i64 = sys_openat_wr(TQ, 0x1a4); if tfd >= 0 { sys_close(tfd) } // clean re-stage 105 let rc: i64 = pub_submit_to(TQ, opath, "/volume1/homes/elderwesto/nishihost/sites/nishifamily/pipeline.html" as *u8, "nishifamily" as *u8, "meet-platform-ws" as *u8, "outward" as *u8) 106 107 mputs("nx_pub_todos: -> " as *u8); mputs(opath); mputs(" sites=" as *u8); mnum(sites); mputs(" derived_staged=" as *u8); mnum(staged) 108 mputs(" staged_for_nishifamily=" as *u8); mnum(rc); mputs(" (held, outward; awaiting operator approval)\n" as *u8) 109 sys_exit(0) 110 return 0 111}