nx_team_research_fetch.nx source
↩ module page · 72 lines · 4671 B
1// nx_team_research_fetch.nx -- SOVEREIGN multi-source web-fetch to DESIGN the NISHI TEAM coordination layer
2// (the PM + the role RACI so workstreams/publishing/fixing/optimizing DON'T compete). Mirrors
3// nx_pub_research_fetch: own TLS-1.3 + Mozilla CA, saves each to knowledge/fetched/team_*.raw (compounds to
4// the Library, grep to CITE >=2-source). Idempotent have-skip. Axes -> S-class team coordination:
5// (A) the RACI / responsibility-assignment matrix + single-accountable, (B) separation of duties / accountability,
6// (C) the PM/coordination role, (D) org structure / span-of-control, (E) modern ops roles + orchestration.
7// expect_exit: 0 license_tier: ORIGINAL
8import "nx_syscalls.nx"
9import "nx_x509_trust_store.nx"
10import "nx_trust_store_load_from_certdata.nx"
11import "nx_https_fetch_follow.nx"
12const K_MAGIC_4194304: i64 = 4194304
13const K_MAGIC_8388608: i64 = 8388608
14
15func gf_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
16func gf_putn(v: i64) -> i64 {
17 if v == 0 { sys_write(1, "0" as *u8, 1); return 0 }
18 var m: i64 = v
19 if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m }
20 let d: *u8 = sys_mmap(24); var k: i64 = 0
21 while m > 0 { d[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }
22 var j: i64 = k - 1
23 while j >= 0 { sys_write(1, ((d as i64)+j) as *u8, 1); j = j - 1 }
24 return 0
25}
26func have_file(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
27func fetch_save(url: *u8, opath: *u8, store: *TrustStore, out: *u8, cap: i64) -> i64 {
28 if have_file(opath) == 1 { gf_puts(opath); gf_puts(" [have-skip]\n"); return 1 }
29 let status: *i64 = sys_mmap(8) as *i64
30 let n: i64 = nx_https_fetch_follow(url, store, out, cap, 6, status)
31 gf_puts(url); gf_puts(" status="); gf_putn(status[0]); gf_puts(" bytes="); gf_putn(n)
32 if n <= 0 { gf_puts(" FETCH-FAIL\n"); return 0 }
33 var gz: i64 = 0
34 if n >= 2 { if out[0] == 0x1f as u8 { if out[1] == 0x8b as u8 { gz = 1 } } }
35 if gz == 1 { gf_puts(" [GZIP-skip]\n"); return 0 }
36 let fd: i64 = sys_openat_wr(opath, 0x1a4)
37 if fd < 0 { gf_puts(" SAVE-FAIL\n"); return 0 }
38 sys_write(fd, out, n); sys_close(fd); gf_puts(" SAVED\n"); return 1
39}
40
41func main() -> i64 {
42 let r: i64 = nx_trust_store_load_from_certdata("data/mozilla_certdata.txt" as *u8, 512, K_MAGIC_4194304)
43 if r <= 0 { gf_puts("TEAM: certdata load failed\n"); return 1 }
44 let store: *TrustStore = r as *TrustStore
45 gf_puts("CA roots="); gf_putn(trust_store_count(store)); gf_puts("\n")
46 let cap: i64 = K_MAGIC_8388608
47 let out: *u8 = sys_mmap(cap)
48 var ok: i64 = 0
49
50 gf_puts("== A. RACI / responsibility-assignment (single accountable) ==\n")
51 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Responsibility_assignment_matrix" as *u8, "knowledge/fetched/team_a_raci.raw" as *u8, store, out, cap)
52 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Accountability" as *u8, "knowledge/fetched/team_a_accountability.raw" as *u8, store, out, cap)
53
54 gf_puts("== B. SEPARATION OF DUTIES (no role both does + admits its own work) ==\n")
55 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Separation_of_duties" as *u8, "knowledge/fetched/team_b_sod.raw" as *u8, store, out, cap)
56 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Division_of_labour" as *u8, "knowledge/fetched/team_b_division_of_labour.raw" as *u8, store, out, cap)
57
58 gf_puts("== C. THE PM / COORDINATION ROLE ==\n")
59 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Project_management" as *u8, "knowledge/fetched/team_c_project_management.raw" as *u8, store, out, cap)
60 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Project_manager" as *u8, "knowledge/fetched/team_c_project_manager.raw" as *u8, store, out, cap)
61
62 gf_puts("== D. ORG STRUCTURE / SPAN OF CONTROL ==\n")
63 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Organizational_structure" as *u8, "knowledge/fetched/team_d_org_structure.raw" as *u8, store, out, cap)
64 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Span_of_control" as *u8, "knowledge/fetched/team_d_span_of_control.raw" as *u8, store, out, cap)
65
66 gf_puts("== E. MODERN OPS ROLES + ORCHESTRATION ==\n")
67 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Site_reliability_engineering" as *u8, "knowledge/fetched/team_e_sre.raw" as *u8, store, out, cap)
68 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Orchestration_(computing)" as *u8, "knowledge/fetched/team_e_orchestration.raw" as *u8, store, out, cap)
69
70 gf_puts("READABLE SOURCES SAVED: "); gf_putn(ok); gf_puts(" / 10\n")
71 return 0
72}