5.7 KiB
5.7 KiB
bare-os-coreutils, tests, and seeder build hook
Former DOCUMENTATION.md §§12.10–12.12. Reference index →
12.10 Package bare-os-coreutils
- packages/bare-os-coreutils/lib/commands.mjs —
COREUTILS_COMMANDS: authoritative sorted/binnames forbuild.mjsand the manual database builder (keeps the image andmancoverage in sync). - packages/bare-os-coreutils/build.mjs —
export async function build(): runsscripts/build-man-db.mjs(validatesman/pages/*.json, writeskernel/share/man/man.jsonand the same path underpackages/bare-os-seeder/kernel/share/man/); then for each command concatenateslib/runtime.js, optionalpreamblelibs (md5sum→lib/md5.js,sed→lib/sed-engine.js,awk→lib/awk-engine.js,jq→lib/jq-engine.js,man→lib/man-render.js,ls/dircolors→ lscolors helpers,edit/nano→lib/edit-*.js+ shared TUI), thensrc/<name>.js(nanoreusessrc/edit.js); writes to**kernel/bin/<name>**and**packages/bare-os-seeder/kernel/bin/<name>**. CLI:node build.mjswhen executed as main. - Manual pages — Authoring:
packages/bare-os-coreutils/man/pages/<name>.json; schema:man/schema.json. Optionalexamples(cheat.sh-style) anddescriptionMode:preservefor preformatted text.scripts/ingest-handbook-for-man.mjsmerges everyhandbook/*.mdasman(7)at build time (man handbook,man handbook-01-introduction, …). Regenerate JSON stubs withnode packages/bare-os-coreutils/scripts/seed-man-pages.mjs. Runtime:/bin/manreads/share/man/man.json. Handbook: handbook/10-manpages-and-online-help.md. - POSIX utility index (optional image file) —
kernel/etc/bare-os/posix_utilities.jsoncarries machine-readable per-command notes when staged; the booter echoesutilitiesIndexPathin/proc/bare_os_featuresand coalescedmetrics_live(see handbook ch.9). - Commands — The authoritative sorted list is
COREUTILS_COMMANDSincommands.mjs(count and names change with releases; do not paste the full inventory into prose here). Each Tier-1 name hassrc/<name>.js(or a mapped source such asnano→src/edit.js) and a matching**man/pages/<name>.json**. Notable large preambles (seepreambleinbuild.mjs):edit/nano(shared TUI stack),baretop/btop,agent(OpenAI-compatible assistant +web_fetchand relatedlib/agent-*.js),chat(swarm chat TUI +lib/chat-tui.js),irc(Libera TLS TUI),summon(text HTML/CSS browser +lib/summon-*.js),md5sum,sed,awk,jq,man,ls/dircolors.agentusesctx.httpFetchlike delegatedcurl/wget(HTTP: curl and wget). The interactive TTY editor isedit;nanois the same built script under/bin/nano, and the default shell maps**nano→edit**(seedefaultShellAliasesinshell.js). Each built script begins withBARE_OS_BIN_APIin the concatenated prelude; rootpretestrunsscripts/verify-kernel-seeder-parity.mjsto keepkernel/bin/*andpackages/bare-os-seeder/kernel/bin/*in sync and to require that pragma on every staged binary. Scripts are plainasync function run(ctx, argv)usingctx.vfs,ctx.drive,ctx.b4a,ctx.console, optionalbareStdin(ctx), optionalctx.runBinCommand— no ESMimportinsrc/(Bare-safeAsyncFunctionload).dir/vdirdelegate tols -C/ls -l. Booter-delegated (stubs underkernel/bin/, logic inpackages/bare-os-booter/lib/):systemctl,journalctl(bare-initd control;bare-initctlalias; see handbook/04-the-booter-runtime.md). Narrative reference: handbook/09-posix-utilities-shell-and-vfs.md. Package overview: bare-os-coreutils README.
12.11 packages/bare-os-booter/test.js and test.identity.js
scripts.test—brittle-bare test.identity.jsthenbrittle-node test.js(bare-crypto’s native addon runs under Bare only; the main suite still uses Node for Hyperdrive +node:fs).
test.js — testCorestoreDir(name) under __dirname/.test-data/.
Tests: runKernelFromSource, runBinCommand, createStreamLineReader, Hyperdrive roundtrip, createVfs, shell tokenizer/exec, tier-1 cat. Uses node:fs, node:path, node:url.
test.identity.js — identity account v2 codec roundtrip and wrong-passphrase failure (bare-crypto).
12.12 Seeder: coreutils build hook
- packages/bare-os-seeder/index.js — when not on Pear (
import.meta.urlisfile:), dynamicimport('../bare-os-coreutils/build.mjs')thenawait build(). Pear has no siblingbare-os-coreutilsin the bundle; use pre-built files under vendoredkernel/bin/.