MD Formatting fixes
This commit is contained in:
@@ -11,7 +11,7 @@ Each command source under **`packages/bare-os-coreutils/src/<name>.js`** must:
|
||||
- Define **`async function run(ctx, argv)`**.
|
||||
- Contain **no top-level `import` or `export`**—the file is concatenated into a single script string for `AsyncFunction` loading.
|
||||
|
||||
Shared helpers live in **`packages/bare-os-coreutils/lib/`** and are **prepended** at build time, not imported. **`bare-os-lscolors`** lives in **`packages/bare-os-lscolors/`** as a small workspace package so **`bare-os-booter`** can `import` it under Pear (cross-package paths into **`bare-os-coreutils`** resolve to unsupported **`pear://dev/...`** URLs).
|
||||
Shared helpers live in **`packages/bare-os-coreutils/lib/**` and are **prepended** at build time, not imported. `**bare-os-lscolors**` lives in `**packages/bare-os-lscolors/**` as a small workspace package so `**bare-os-booter`** can `import` it under Pear (cross-package paths into **`bare-os-coreutils**` resolve to unsupported `**pear://dev/...`** URLs).
|
||||
|
||||
---
|
||||
|
||||
@@ -21,7 +21,7 @@ Shared helpers live in **`packages/bare-os-coreutils/lib/`** and are **prepended
|
||||
2. **Register** the name in **`packages/bare-os-coreutils/lib/commands.mjs`** (`COREUTILS_COMMANDS`—keep sorted).
|
||||
3. **Add a man page** `packages/bare-os-coreutils/man/pages/foo.json` (build fails if missing).
|
||||
4. **Optional:** seed examples via **`scripts/seed-man-pages.mjs`** or edit JSON directly.
|
||||
5. **Optional preamble:** if `foo` needs a large engine file (or several helpers, like **`edit`** / **`nano`** with **`lib/edit-*.js`**), add to **`preamble`** in [`build.mjs`](../packages/bare-os-coreutils/build.mjs):
|
||||
5. **Optional preamble:** if `foo` needs a large engine file (or several helpers, like **`edit**` / `**nano**` with `**lib/edit-*.js**`), add to `**preamble`** in [`build.mjs`](../packages/bare-os-coreutils/build.mjs):
|
||||
|
||||
```js
|
||||
const preamble = {
|
||||
@@ -40,7 +40,7 @@ const preamble = {
|
||||
npm run build -w bare-os-coreutils
|
||||
```
|
||||
|
||||
This runs **`build-man-db.mjs`** (manual database) and writes **`kernel/bin/foo`** plus the seeder mirror.
|
||||
This runs **`build-man-db.mjs**` (manual database) and writes `**kernel/bin/foo`** plus the seeder mirror.
|
||||
|
||||
7. **Re-seed / replicate** so peers get the new `/bin/foo`.
|
||||
|
||||
@@ -54,21 +54,21 @@ From [`build.mjs`](../packages/bare-os-coreutils/build.mjs):
|
||||
runtime.js + [preamble files...] + src/foo.js → kernel/bin/foo
|
||||
```
|
||||
|
||||
**`runtime.js`** begins with a **`BARE_OS_BIN_API`** version comment (e.g. **`/* BARE_OS_BIN_API 1.0.0 */`**). Staged **`kernel/bin/*`** must contain that string so **[`scripts/verify-kernel-seeder-parity.mjs`](../../scripts/verify-kernel-seeder-parity.mjs)** can catch drift; hand-written stubs (**`systemctl`**, **`journalctl`**) carry the same pragma.
|
||||
**`runtime.js**` begins with a `**BARE_OS_BIN_API**` version comment (e.g. `**/* BARE_OS_BIN_API 1.0.0 */**`). Staged `**kernel/bin/*`** must contain that string so **[`scripts/verify-kernel-seeder-parity.mjs`](../../scripts/verify-kernel-seeder-parity.mjs)** can catch drift; hand-written stubs (**`systemctl**`, `**journalctl`**) carry the same pragma.
|
||||
|
||||
**`runtime.js`** defines helpers like **`bareStdin`**, listing time formatting, etc.—read it before reimplementing utilities.
|
||||
**`runtime.js**` defines helpers like `**bareStdin`**, listing time formatting, etc.—read it before reimplementing utilities.
|
||||
|
||||
---
|
||||
|
||||
## Exit status
|
||||
|
||||
POSIX-ish utilities set **`ctx.exitCode`** (number) when they want a non-zero status. The **shell** uses **`ctx.exitCode`** for **`&&`**, **`||`**, and **`;`** lists; utilities such as **`grep`** and **`test`** set it for conditions.
|
||||
POSIX-ish utilities set **`ctx.exitCode**` (number) when they want a non-zero status. The **shell** uses `**ctx.exitCode**` for `**&&**`, `**||**`, and `**;**` lists; utilities such as `**grep**` and `**test`** set it for conditions.
|
||||
|
||||
---
|
||||
|
||||
## Tests
|
||||
|
||||
Add or extend tests under **`packages/bare-os-booter/test.js`** using **`runBinCommand`** with a Hyperdrive that has the built `/bin/foo` bytes—follow existing **`grep`**, **`ls`**, **`cat`** patterns.
|
||||
Add or extend tests under **`packages/bare-os-booter/test.js**` using `**runBinCommand`** with a Hyperdrive that has the built `/bin/foo` bytes—follow existing **`grep**`, `**ls**`, `**cat`** patterns.
|
||||
|
||||
---
|
||||
|
||||
@@ -76,16 +76,16 @@ Add or extend tests under **`packages/bare-os-booter/test.js`** using **`runBinC
|
||||
|
||||
- Update **man page** JSON (required by build).
|
||||
- Optional: handbook chapter 9 cross-links for POSIX alignment.
|
||||
- Optional: TypeScript shapes in [`packages/bare-os-booter/lib/bare-os-ctx.d.ts`](../packages/bare-os-booter/lib/bare-os-ctx.d.ts) (**`BareOsKernelContext`**, **`BareOsBinRun`**) for host-side editors.
|
||||
- Optional: TypeScript shapes in [`packages/bare-os-booter/lib/bare-os-ctx.d.ts`](../packages/bare-os-booter/lib/bare-os-ctx.d.ts) (**`BareOsKernelContext**`, `**BareOsBinRun`**) for host-side editors.
|
||||
|
||||
Large multi-file preambles (**`edit`** / **`nano`**, **`baretop`**, **`agent`**, **`chat`**, …) are defined in [`build.mjs`](../packages/bare-os-coreutils/build.mjs) **`preamble`** — copy that pattern when a command needs many **`lib/*.js`** chunks; for **`agent`**-sized features prefer editing [`packages/bare-os-coreutils/lib/agent-*.js`](../packages/bare-os-coreutils/lib/) and **`man agent`** rather than growing unrelated commands’ preambles.
|
||||
Large multi-file preambles (**`edit**` / `**nano**`, `**baretop**`, `**agent**`, `**chat`**, …) are defined in [`build.mjs`](../packages/bare-os-coreutils/build.mjs) **`preamble**` — copy that pattern when a command needs many `**lib/*.js**` chunks; for `**agent`**-sized features prefer editing [`packages/bare-os-coreutils/lib/agent-*.js`](../packages/bare-os-coreutils/lib/) and **`man agent`** rather than growing unrelated commands’ preambles.
|
||||
|
||||
## See also
|
||||
|
||||
- [Chapter 5 — Modules](05-modules-and-imports.md)
|
||||
- [Chapter 8 — Testing](08-testing-and-debugging.md)
|
||||
- [kernel/README.md](../kernel/README.md)
|
||||
- **`agent`** / **`chat`** — large preamble examples: [`build.mjs`](../packages/bare-os-coreutils/build.mjs), [`packages/bare-os-coreutils/README.md`](../packages/bare-os-coreutils/README.md)
|
||||
- **`agent**` / `**chat`** — large preamble examples: [`build.mjs`](../packages/bare-os-coreutils/build.mjs), [`packages/bare-os-coreutils/README.md`](../packages/bare-os-coreutils/README.md)
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user