nx_wiki_content_loader.nx
buildroot/runtime/wiki/nx_wiki_content_loader.nx
about
nx_wiki_content_loader.nx -- materialize charters into per-site wiki.
V-WIKI-CONTENT-LOAD-1 per NISHI_WIKI_CONTENT_INDEX v1.0 §5 +
operator cardinal 2026-05-27 *"make sure all this information gets
into the wiki"*.
At daemon startup, for each canonical charter listed in §1 of
NISHI_WIKI_CONTENT_INDEX.md:
1. sys_read_file(<silicon_repo>/<charter_path>) -> bytes
2. nx_wiki_index_builder_add(builder, title, "/wiki/<slug>",
body, body_n)
Result: each charter becomes a searchable + readable wiki page at
nishifamily.com/wiki/<slug>.
COMPOSES (per "avoid duplicate primitives" cardinal):
wiki/nx_wiki_index_builder doc_store + builder for indexing
nx_syscalls sys_read_file for charter content
COMPOSED BY:
wiki/nx_wiki_https_daemon_mv setup_site calls this after init
SCOPE LIMIT (per M6 anti-pretend-stub):
V1 ships a HARDCODED charter list per NISHI_WIKI_CONTENT_INDEX
§1. V+1 reads the index .md file at startup + parses §1 tables
to discover charters dynamically (sys_getdents queued per
project-wiki-v1-complete-2026-05-27 honest gap). Hardcoded list
below MUST be kept in sync with NISHI_WIKI_CONTENT_INDEX §1
per its §6 update discipline.
Operator-side: daemon must run where the silicon repo is
readable. Default path /mnt/c/Users/elder/nishi-silicon on WSL;
override via NX_WCL_SILICON_ROOT env var (V+1).
dependencies 2 imports · 6 importers
imports: nx_syscalls.nxnx_wiki_index_builder.nx
imported by: _wiki_discovery_gate.nx_wiki_engine_gate.nx_wiki_frontend_gate.nxnx_teacher_wiki_proof.nxnx_wiki_https_daemon_mv.nxnx_wiki_main.nx
structs
| none |
consts
| 38 | const NX_WCL_OK: i64 = 0 |
| 39 | const NX_WCL_BAD_INPUT: i64 = 1380 |
| 40 | const NX_WCL_FILE_NOT_FOUND: i64 = 1381 // silicon repo missing or path wrong |
| 41 | const NX_WCL_INDEX_ADD_FAILED: i64 = 1382 |
| 42 | const NX_WCL_DIR_OPEN_FAILED: i64 = 1383 // V+1 auto-discover: content dir not openable |
| 51 | const NX_WCL_DIRBUF_BYTES: i64 = 262144 // getdents64 batch buffer (256 KiB) |
| 52 | const NX_WCL_MAX_DISCOVER: i64 = 1000 // hard ceiling on pages discovered (JPL rule 2) |
| 53 | const NX_WCL_MAX_NAME_LEN: i64 = 255 // single dir-entry name cap |
| 54 | const NX_WCL_MAX_SLUG_LEN: i64 = 256 // derived slug cap |
| 55 | const NX_WCL_MAX_URL_LEN: i64 = 512 // "/wiki/<slug>" cap |
| 56 | const NX_WCL_FALLBACK_TITLE: *u8 = "(untitled)" as *u8 |
| 57 | const NX_WCL_FALLBACK_TITLE_N: i64 = 10 |
| 74 | const NX_WCL_SILICON_ROOT: *u8 = "/volume1/homes/elderwesto/nishihost/wiki-content/" as *u8 |
| 75 | const NX_WCL_SILICON_ROOT_N: i64 = 49 // length of NX_WCL_SILICON_ROOT |
| 76 | const NX_WCL_MAX_PATH_LEN: i64 = 512 |
| 77 | const NX_WCL_MAX_CHARTER_BYTES: i64 = 524288 // 512KB; charters cap |
| 384 | const NX_WCL_MAX_DIRS: i64 = 4096 // pending-dir stack ceiling |
| 385 | const NX_WCL_ITER_CAP: i64 = 100000 // hard dir-pop ceiling (symlink-loop guard) |
| 386 | const NX_WCL_DIR_ARENA: i64 = 4194304 // 4 MiB of dir-path bytes for the stack |
| 387 | const NX_WCL_CHILD_CAP: i64 = 8192 // assembled child-path scratch |
functions
| 83 | func _wcl_join_path(out: *u8, out_cap: i64, called by 1: nx_wcl_load_one |
| 115 | func nx_wcl_load_one( |
| 182 | func nx_wcl_lc(c: i64) -> i64 |
| 189 | func nx_wcl_is_md(name: *u8) -> i64 |
| 207 | func nx_wcl_slug_from_name(name: *u8, name_n: i64, out: *u8) -> i64 |
| 229 | func nx_wcl_discover_one( |
| 303 | func nx_wcl_discover_dir(builder: *NxWikiIndexBuilder, dir_z: *u8) -> i64 |
| 396 | func nx_wcl_slug_from_relpath(path: *u8, path_n: i64, root_len: i64, out: *u8) -> i64 |
| 425 | func nx_wcl_discover_one_path( |
| 484 | func nx_wcl_discover_tree(builder: *NxWikiIndexBuilder, dir_z: *u8) -> i64 |
| 617 | func nx_wcl_load_full_manifest(builder: *NxWikiIndexBuilder) -> i64 |
| 788 | func nx_wcl_load_full_manifest_or_discover(builder: *NxWikiIndexBuilder) -> i64 |
| 806 | func nx_wcl_load_discover_tree(builder: *NxWikiIndexBuilder) -> i64 |
| 819 | func nx_wcl_load_jasonewest_portfolio(builder: *NxWikiIndexBuilder) -> i64 |