Files
bare-operating-system/packages/bare-os-coreutils
2026-04-03 19:34:11 -04:00
..
2026-04-03 19:01:57 -04:00
2026-04-03 19:13:20 -04:00
2026-04-03 17:56:46 -04:00
2026-04-03 19:34:11 -04:00
2026-04-03 05:55:25 -04:00
2026-04-02 22:35:09 -04:00
2026-04-03 17:56:46 -04:00

bare-os-coreutils

Build step, not a runtime library: validates and merges man/pages/*.json into kernel/share/man/man.json (see scripts/build-man-db.mjs), then concatenates lib/runtime.js, optional lib/*-engine.js or lib/man-render.js chunks (see preamble in build.mjssed, awk, man), then each src/<command>.js, and writes standalone scripts to:

  • kernel/bin/<command> — staged into the system Hyperdrive as /bin/*
  • packages/bare-os-seeder/kernel/bin/<command>vendored copy for Pear bundles (seeder has no sibling bare-os-coreutils at runtime)

Command contract

Each src/*.js file must define:

async function run(ctx, argv) {
  /* ... */
}

No top-level import — commands are loaded by the booter via AsyncFunction for Bare/Pear compatibility. Use ctx.vfs, ctx.console, ctx.b4a, ctx.drive, bareStdin(ctx) from the prelude where needed.

Build

From the monorepo root:

npm run build -w bare-os-coreutils

Or node packages/bare-os-coreutils/build.mjs.

CI / tests: root pretest runs this build so kernel/bin exists before workspace tests.

Commands (authoritative list)

Source of truth: lib/commands.mjsCOREUTILS_COMMANDS (imported by build.mjs and scripts/build-man-db.mjs). Each name must have man/pages/<name>.json.

awk, basename, cat, chgrp, chmod, chown, cksum, clear, cp, crontab, cut, date, dirname, du, echo, env, exit, false, find, getconf, grep, head, hdms, help, hostname, id, ln, login, logout, logname, ls, man, mkdir, mkfifo, mv, nl, od, pathchk, printenv, printf, pwd, readlink, rm, rmdir, savevault, sed, seq, sleep, sort, stat, tail, tee, test, time, touch, tr, true, tty, uname, wc, which, whoami, xargs

grep uses JavaScript RegExp (and -F fixed strings); POSIX/GNU-like subset.

sed / awk use large interpreters in lib/sed-engine.js and lib/awk-engine.js — capable, but not guaranteed to match every POSIX or GNU edge case.

Stubs (chown, chgrp, mkfifo) print a clear error and exit non-zero. getconf and xargs implement a documented Bare-specific subset (see src/getconf.js, src/xargs.js).

See handbook §6 — Kernel and /bin, handbook §9 — POSIX alignment, and handbook §10 — man and online help.

See also