code wiki / (root) / nx_brand_research_fetch.nx

nx_brand_research_fetch.nx source

↩ module page · 103 lines · 7928 B

1// nx_brand_research_fetch.nx -- the Nishi RESEARCHER's sovereign web-fetch for THE S-CLASS BRAND / UX / CX arc. 2// Operator 2026-06-21: "our ux cx brand etc arent s class exceed at all -- we need real s class nike/coca-cola 3// brand management exceed tools. really use the nishi researcher and see where we are and where we need to go." 4// Mirrors the proven nx_fin_research_fetch / nx_pub_research_fetch pattern: own TLS-1.3 (nx_https_fetch_follow) + 5// Mozilla CA store, saves each cited source to knowledge/fetched/brand_*.raw so the research COMPOUNDS to the 6// Library and can be grepped to CITE the census yardsticks (brand-management, design systems, color, typography, 7// UX/CX, motion, DAM, accessibility, the named exemplars Nike + Coca-Cola, and incumbent tooling Material/HIG/ 8// Webflow/Figma). 100% sovereign (own TLS, nx_cc->nxasm, no curl/wget/gcc). Idempotent have-skip = re-run fills 9// gaps (also the per-fetch mmap-leak workaround -- each pass is a fresh process so memory resets). 10// COVERAGE: 28 authoritative brand/design-system topics. expect_exit: 0 license_tier: ORIGINAL 11import "nx_syscalls.nx" 12import "nx_x509_trust_store.nx" 13import "nx_trust_store_load_from_certdata.nx" 14import "nx_https_fetch_follow.nx" 15const K_MAGIC_4194304: i64 = 4194304 16const K_MAGIC_8388608: i64 = 8388608 17 18func ff_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 19func ff_putn(v: i64) -> i64 { 20 if v == 0 { sys_write(1, "0" as *u8, 1); return 0 } 21 var m: i64 = v 22 if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m } 23 let d: *u8 = sys_mmap(24); var k: i64 = 0 24 while m > 0 { d[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 25 var j: i64 = k - 1 26 while j >= 0 { sys_write(1, ((d as i64)+j) as *u8, 1); j = j - 1 } 27 return 0 28} 29func have_file(path: *u8) -> i64 { 30 let fd: i64 = sys_openat_rd(path) 31 if fd < 0 { return 0 } 32 sys_close(fd) 33 return 1 34} 35func fetch_save(url: *u8, opath: *u8, store: *TrustStore, out: *u8, cap: i64) -> i64 { 36 if have_file(opath) == 1 { ff_puts(opath); ff_puts(" [have-skip]\n" as *u8); return 1 } 37 let status: *i64 = sys_mmap(8) as *i64 38 let n: i64 = nx_https_fetch_follow(url, store, out, cap, 6, status) 39 ff_puts(url); ff_puts(" status=" as *u8); ff_putn(status[0]); ff_puts(" bytes=" as *u8); ff_putn(n) 40 if n <= 0 { ff_puts(" FETCH-FAIL\n" as *u8); return 0 } 41 var gz: i64 = 0 42 if n >= 2 { if out[0] == 0x1f as u8 { if out[1] == 0x8b as u8 { gz = 1 } } } 43 if gz == 1 { ff_puts(" [GZIP-skip]\n" as *u8); return 0 } 44 let fd: i64 = sys_openat_wr(opath, 0x1a4) 45 if fd < 0 { ff_puts(" SAVE-FAIL\n" as *u8); return 0 } 46 sys_write(fd, out, n) 47 sys_close(fd) 48 ff_puts(" SAVED\n" as *u8) 49 return 1 50} 51 52func main() -> i64 { 53 let r: i64 = nx_trust_store_load_from_certdata("data/mozilla_certdata.txt" as *u8, 512, K_MAGIC_4194304) 54 if r <= 0 { ff_puts("BRAND: certdata load failed\n" as *u8); return 1 } 55 let store: *TrustStore = r as *TrustStore 56 ff_puts("CA roots=" as *u8); ff_putn(trust_store_count(store)); ff_puts("\n" as *u8) 57 let cap: i64 = K_MAGIC_8388608 58 let out: *u8 = sys_mmap(cap) 59 var ok: i64 = 0 60 61 ff_puts("== BRAND IDENTITY: management / corporate identity / guidelines / exemplars ==\n" as *u8) 62 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Brand_management" as *u8, "knowledge/fetched/brand_b1_management.raw" as *u8, store, out, cap) 63 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Brand" as *u8, "knowledge/fetched/brand_b1_brand.raw" as *u8, store, out, cap) 64 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Corporate_identity" as *u8, "knowledge/fetched/brand_b2_corporate_identity.raw" as *u8, store, out, cap) 65 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Style_guide" as *u8, "knowledge/fetched/brand_b2_style_guide.raw" as *u8, store, out, cap) 66 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Nike,_Inc." as *u8, "knowledge/fetched/brand_b3_nike.raw" as *u8, store, out, cap) 67 ok = ok + fetch_save("https://en.wikipedia.org/wiki/The_Coca-Cola_Company" as *u8, "knowledge/fetched/brand_b3_cocacola.raw" as *u8, store, out, cap) 68 69 ff_puts("== DESIGN SYSTEMS: design language / incumbents ==\n" as *u8) 70 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Design_language" as *u8, "knowledge/fetched/brand_d1_design_language.raw" as *u8, store, out, cap) 71 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Material_Design" as *u8, "knowledge/fetched/brand_d2_material_design.raw" as *u8, store, out, cap) 72 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Human_interface_guidelines" as *u8, "knowledge/fetched/brand_d3_hig.raw" as *u8, store, out, cap) 73 74 ff_puts("== COLOR ==\n" as *u8) 75 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Color_theory" as *u8, "knowledge/fetched/brand_c1_color_theory.raw" as *u8, store, out, cap) 76 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Color_scheme" as *u8, "knowledge/fetched/brand_c2_color_scheme.raw" as *u8, store, out, cap) 77 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Web_colors" as *u8, "knowledge/fetched/brand_c3_web_colors.raw" as *u8, store, out, cap) 78 79 ff_puts("== TYPOGRAPHY ==\n" as *u8) 80 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Typography" as *u8, "knowledge/fetched/brand_t1_typography.raw" as *u8, store, out, cap) 81 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Web_typography" as *u8, "knowledge/fetched/brand_t2_web_typography.raw" as *u8, store, out, cap) 82 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Typeface" as *u8, "knowledge/fetched/brand_t3_typeface.raw" as *u8, store, out, cap) 83 84 ff_puts("== UX / CX ==\n" as *u8) 85 ok = ok + fetch_save("https://en.wikipedia.org/wiki/User_experience_design" as *u8, "knowledge/fetched/brand_u1_ux_design.raw" as *u8, store, out, cap) 86 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Customer_experience" as *u8, "knowledge/fetched/brand_u2_customer_experience.raw" as *u8, store, out, cap) 87 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Usability" as *u8, "knowledge/fetched/brand_u3_usability.raw" as *u8, store, out, cap) 88 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Interaction_design" as *u8, "knowledge/fetched/brand_u4_interaction_design.raw" as *u8, store, out, cap) 89 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Heuristic_evaluation" as *u8, "knowledge/fetched/brand_u5_heuristic_eval.raw" as *u8, store, out, cap) 90 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Emotional_design" as *u8, "knowledge/fetched/brand_u6_emotional_design.raw" as *u8, store, out, cap) 91 92 ff_puts("== MOTION / ASSETS / IMPLEMENTATION / ACCESSIBILITY / TOOLS ==\n" as *u8) 93 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Motion_graphics" as *u8, "knowledge/fetched/brand_m1_motion_graphics.raw" as *u8, store, out, cap) 94 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Digital_asset_management" as *u8, "knowledge/fetched/brand_m2_dam.raw" as *u8, store, out, cap) 95 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Cascading_Style_Sheets" as *u8, "knowledge/fetched/brand_m3_css.raw" as *u8, store, out, cap) 96 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Responsive_web_design" as *u8, "knowledge/fetched/brand_m4_responsive.raw" as *u8, store, out, cap) 97 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Web_Content_Accessibility_Guidelines" as *u8, "knowledge/fetched/brand_m5_wcag.raw" as *u8, store, out, cap) 98 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Webflow" as *u8, "knowledge/fetched/brand_m6_webflow.raw" as *u8, store, out, cap) 99 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Figma" as *u8, "knowledge/fetched/brand_m7_figma.raw" as *u8, store, out, cap) 100 101 ff_puts("READABLE SOURCES SAVED THIS PASS+HAVE: " as *u8); ff_putn(ok); ff_puts(" / 28\n" as *u8) 102 return 0 103}