CLI reference

CLI reference Eleven commands: oku init, build, clean, pack, spec, vendor, verify, migrate, check, serve, preview. Designed so you mostly forget the CLI exists. oku init / build / clean / pack / spec / vendor / verify / migrate / check / serve / preview — what each does. Reference > [!TLDR] > init scaffolds the cwd as a docs root: _oku symlink + index.html entry stub. build emits two single-purpose trees — dist/standalone/ and dist/site/ (with manifest + llms.txt + Pagefind). clean wipes dist/. migrate converts page-JSON sources to v3 markdown. check lints every page. serve runs a local HTTP server and synthesizes the manifest, llms.txt and kit.json in memory — source dirs stay clean apart from the one entry stub. preview renders one page for an editor's preview panel. > > - init treats cwd as the docs root. Run it from wherever you want pages to live (typically cd into your docs/ subdir first). > - Source dirs hold MD (or legacy JSON) plus a single index.html entry stub so IDE-served workflows work without the dev server running. > - build is idempotent; safe to re-run. dist/standalone/ and dist/site/ are wiped each time. > - clean removes dist/ entirely — no-op if it's already absent. > - serve synthesizes the manifest fresh on each request — no source writes. > - jsonschema is a required dependency (page validation); pagefind is the opt-in `oku[search]` extra (search index). ## oku init {#init} One-time per docs root. Creates a _oku symlink so pages can reference _oku/chrome.js etc., and an index.html entry stub that IDE-served workflows open directly (IntelliJ's built-in HTTP server, Live Server, etc.). Both land in cwd — there is no implicit docs/ subdir. The index.html is the tree's front door. With an index.md beside it, it shows that page; without one, it lists every page of the tree with its summary. The list is titled with kit.json's name (else the word the site tree's label uses), led by its description, and written in the tree's language: kit.json's defaultLanguage, else the language most of the pages are in. Every page's site tree leads back to it. init writes the shell in that language, and oku serve and oku build hand it over with the current page list, so a shell written before the tree grew still lists every page. ```bash cd ~/path/to/your-project/docs oku init # ✓ Linked /path/to/your-project/docs/_oku -> /path/to/oku/kit # ✓ Created /path/to/your-project/docs/index.html # # Author pages as .md next to index.html (JSON still works). # Open index.html in your IDE, or run `oku serve` from the # project root for a live-reloading dev server. ``` > [!NEUTRAL] Idempotent + self-healing > Re-running init is safe. If the symlink already resolves to the kit, it prints "already linked". If it points to a stale target (e.g. the kit repo moved), init transparently refreshes it. The installed tool links through one stable path, `~/.local/share/oku/kit` (or `$XDG_DATA_HOME/oku/kit`), and re-points that path at its own files every time it runs — so reinstalling the tool, even under another Python, does not strand a project's link. A checkout run through `uv run` or [`bin/oku`](#f/bin/oku) links its own `kit/` directly and leaves the stable path alone. A non-symlink file at _oku is treated as user data and refused. An existing index.html is left untouched so your edits survive. ## oku build {#build} Walks the current directory, produces every dist artifact. Run before deploying dist/site/, before sharing dist/standalone/ files, or any time a search index needs to refresh. Source dir is never written to. ```bash cd ~/path/to/your-project oku build # ✓ Doctree check: 6 page(s) clean # ✓ Wrote dist/site/site-manifest.json (6 JSON page(s)) # ✓ Wrote dist/site/llms.txt # ✓ Synthesized 6 stub(s) for pages without on-disk .html # ✓ Pagefind index built: dist/site/pagefind/ # ✓ Built 6 HTML file(s): # # standalone (inline, send-as-file): # file:///.../dist/standalone/docs/index.html # ... # # site (shared assets, multi-page): # site root: file:///.../dist/site # ... ``` > [!WARN] build stops on a check error > The doctree check runs first, and an error ends the build with exit code 1 — a schema error names a payload the renderer will draw wrong or not at all, so shipping it puts the broken page in front of the reader. The errors print either way. `--allow-errors` builds anyway, for a tree with a legacy page you are not ready to fix; it says on the console that it took that path. > [!NEUTRAL] build replaces its dist trees, it does not empty them first > Every page is written into `dist/.build- /` and moved into place at the end, so a build that fails partway costs the new pages and nothing else — the previous dist/standalone/ and dist/site/ are still there, whole, and the error says so instead of raising a traceback. The swap is also where stale trees go: dist/markdown/ from an older version, and dist/_search/, the serve-time Pagefind index that nothing else removed — a stale one keeps answering for pages the source no longer has. Anything else you have parked under dist/ is left alone, by build and by oku clean alike. ### How do I know the page I am reading is current? {#build-provenance} You cannot tell by looking at the content, which is how a fixed bug gets reported a second time from an old file. So every built page carries its own provenance in the sidebar footer, under the site tree: ``` oku v0.6.5 · kit 2026-08-14-r37 built 3 days ago [Rebuild] ``` `kit` is the same field `oku --version` prints, spelled the same way, so the footer and the terminal compare directly. The stamp carries its own date — that is what lets one number answer "how old is this file" without knowing what the current one is. **Rebuild copies a command. It does not run one, and it cannot.** A page opened from a `file://` URL or off a static host has no channel to a shell. The one surface with a live server is `oku serve`, and there `_oku/` points at the installed kit, so a served page is never the stale one — a real rebuild button would work only where nothing needs it. Clicking reveals the command and copies it: ```bash cd ~/code/notes && oku build ``` The `cd` is there because an artifact says nothing about where its source sits, and you are reading it from somewhere else. The path collapses to `~` under your home directory, and it is written only into `dist/` and the standalone files — never into the committed `index.html` stub. **A page written to leave the machine can drop the command.** `~/code/notes` names a layout rather than an account, but a layout is still something the page hands to everyone it reaches. Set `"rebuild_command": false` in kit.json and the command goes, and the button with it — there is no disabled state, because the footer draws nothing when the field is absent: ```json {"name": "notes", "rebuild_command": false} ``` Everything that is about the artifact rather than about where it was made stays: the version, the kit stamp, the build age, and the drift warning. On by default, because the failure this section exists for is a page that could not say how old it was — a page that should not say where it came from is the exception, and an exception is a thing a project asks for. What the page cannot tell you is how far behind the installed kit it is. Learning that means asking the network, and a document should not call home because a colleague opened it. `oku build` prints that comparison instead, at the one moment it holds both numbers: ``` ✓ Built 12 HTML file(s): kit 2026-08-11-r33 → 2026-08-14-r37 ``` ### What `oku --version` answers {#version-line} The other end of the same question: not "how old is this page" but "does the tool that built it have the fix I am reading about". ``` oku 0.6.5 · kit 2026-08-23-r67 · src sha256:014095589d4b · as of 2026-08-23 09:15 · assets /Users/you/.local/share/uv/tools/oku/... ``` | Field | Reads | Answers | |---|---|---| | `oku` | the package version | which release | | `kit` | the hand-bumped stamp in chrome.js | did the *kit* change | | `src` | a sha256 over every file the wheel ships | is this build byte-identical to another one | | `as of` | the newest mtime among those same files | is this build older or newer than a given date | | `assets` | where the installed kit lives | which copy of the kit is being read | `src` compares; it does not order. Two builds either match or they do not, and a digest cannot say which came first — printed as twelve bare hex characters it also reads as an abbreviated git commit, which is how a reader ended up running `git cat-file` on one and getting "Not a valid object name". The `sha256:` prefix is part of the value for that reason, and `as of` is the field that orders: a fix that landed on the 22nd at 16:38 is not in a build dated 11:53 the same day. `uv tool install` writes every file at the moment it installs, so `as of` is the install time for an installed tool and the last edit for a checkout. Both are "the code as of", which is what the field is called. ## oku clean {#clean} Remove the trees the build writes under dist/ — standalone/, site/, _search/ and a markdown/ left by an older build — and nothing else. Idempotent, and dist/ itself goes only when those were all it held. Source files and the _oku symlink are untouched. ```bash oku clean # ✓ Removed /path/to/your-project/dist # With something of your own parked in there: oku clean # ✓ Removed dist/standalone, dist/site # Kept 2 entries oku did not write: NOTES.md, keepme # Second run, nothing left: oku clean # ✓ Nothing to clean — /path/to/your-project/dist does not exist. ``` - Useful before publishing a release artifact, switching branches, or just to ensure a fresh build. - Safe to chain: oku clean && oku build. - Doesn't touch source pages, the _oku symlink, or kit.json. Only generated output. - dist/ is a conventional name, not one this tool owns. It used to remove the whole directory, so a deploy script or a data file parked beside the build went with it; now the survivors are named in the output. ## oku pack {#pack} Write one directory that holds the pages you name and nothing else from their tree. A page shared out of a whole build took the tree along: the site manifest, llms.txt and the search index named every page beside it, and a carried notes file kept the absolute paths it was written with. A pack holds the named pages, every page their prose `.md` links reach, and every local file any of them references, each as a real file: images, `#f/` files including PDFs, `.md` notes, scripts. ```bash oku pack raporlar/evrad.md --out ~/share/evrad # ✓ Packed 1 page(s), 85 file(s) into /Users/you/share/evrad # entry: raporlar/evrad.html ``` The directory is a dist/site tree with only those pages in it, relative URLs throughout, so it works served from any path prefix. The kit travels inside it, mermaid, Prism and the fonts included, so nothing loads from a CDN. index.html forwards to the first page named, with no script. There is no search index and no rebuild command. A PDF chip opens the PDF in the browser's own viewer, in a new tab. `_pack.json` describes the package for whoever hosts it: the entry page, its title and summary from the front matter, every page with its plain text (headings, paragraphs, list items, table cells), and every file with its size, SHA-256 and type. Before anything is written to `--out`, the built package is checked. Any of these stops the pack with exit 1 and leaves `--out` as it was: | Finding | What it means | |---|---| | `home-path` | A path into a home directory (`/Users/ /`, `/home/ /`) in any file of the package. Reported against the file you edit: the notes file that carried it, at its line. | | `outside-package` | A local reference that does not land on a file in the package: a file past the project, a root-absolute path, a link to a page that does not exist. | | `external-load` | A script, stylesheet, image, font, frame or fetch from another origin. Plain links to other sites are allowed and listed as notes. | | `check` | An error `oku check` reports for a packed page. | | `kit-incomplete` | The kit's vendored copy is incomplete, so the pages would reach a CDN. | There is no flag to skip the check. Fix the source and pack again. Exit 2 is a usage error: a page that is missing or not `.md`, or an `--out` that holds something other than an earlier pack. ### One kit for many packages {#pack-kit-url} A host that serves many packages does not need a copy of the kit in each one. `--kit` names the kit [`oku kit export`](#kit-export) wrote, and `--kit-url` the address where the host serves it: ```bash oku kit export --out ~/share/k oku pack raporlar/evrad.md --out ~/share/evrad --kit ~/share/k --kit-url /k/ # ✓ Packed 1 page(s), 12 file(s) into /Users/you/share/evrad # entry: raporlar/evrad.html # kit: /k/ + core-4d4187a0638cdba1, fonts-9a373fac28ff9efd, mermaid-02511f5f0d243ec1, prism-5dbf9d52ebfeaf7b (not carried; serve the export there) ``` The package then has no `_oku/` directory. Every reference a page makes to the kit goes to the layer that holds it: the scripts and the stylesheet in each page, to the core layer, with no `?v=` stamp because the layer's name already changes with its content; the fonts, through the stylesheet, to the fonts layer; and what a page loads later, which is mermaid and Prism with its grammars from their own layers, and the translation table of a page not in English and the glossary and link registries `kit.json` names from the core. Each page also names the package root relative to itself, so the package still works under any path prefix. `_pack.json` gains `"kit": {"url": "/k/", "layers": [...]}`, which tells the host which layers the pages expect there. `--kit` and `--kit-url` go together. The URL is a root-relative path that ends in `/`; anything else is exit 2: a relative path, a scheme or a host, a query, an empty or a dot segment. An export written by another oku is exit 2 as well, since its renderer would run this oku's pages. The check runs as it does without the flags, except that a reference under the kit URL is held to the files of the export instead of to the package. Without them, nothing changes. ## oku kit export {#kit-export} Write the kit a page loads at runtime, for a host to serve once to every package packed against it with [`--kit`](#pack-kit-url). ```bash oku kit export --out ~/share/k # ✓ Exported kit 2026-10-18-r130: 4 layers, 321 file(s), 5.3 MB into /Users/you/share/k # core-4d4187a0638cdba1 16 file(s), 0.8 MB # fonts-9a373fac28ff9efd 8 file(s), 0.6 MB # mermaid-02511f5f0d243ec1 1 file(s), 3.3 MB # prism-5dbf9d52ebfeaf7b 296 file(s), 0.6 MB ``` Each layer is a directory named for its content: the 16 hex digits are the start of the SHA-256 of its sorted `path sha256` lines, paths inside the layer. The core holds chrome.css, chrome.js, chrome-boot.js and renderer.js, minified as every build ships them, with the `i18n/`, `glossary/` and `extrefs/` tables. The other three hold the vendored copies, each under the path it has in `vendor/`. `schema/` is left out: no page loads a schema or `examples.json`. Those serve `oku check` and `oku spec`. The layers are what let a new oku cost a reader little. A release that changes only oku's own code changes only the core's name; mermaid, the fonts and the grammars keep theirs, so a host that keeps every address for good serves readers the new core and nothing else, and stores nothing else. New fonts change the core too, because its stylesheet names the fonts layer. The same installed oku writes the same bytes on every run, with no timestamps in them. That is why the prism layer carries every grammar of the pinned Prism release (293 files, fetched once into `~/.cache/oku/`) and not the grammars this machine's builds happened to fetch. Those grow, and each new one would rename the layer. `--out` holds this oku's layers only: an earlier export there is replaced. A host that serves the directory itself, rather than storing each layer by its name as pano does, keeps earlier layers by copying each new export in beside them; two layers never share a name. Exit 1 when the vendored copy is incomplete or a grammar cannot be fetched; nothing is written. Exit 2 when `--out` holds anything that is not a layer. ## oku spec {#spec} Print a ready-to-paste payload for any block kind or chart type. The kit has 14 block kinds, 53 chart types and 3 inline kinds, and the shape of each is the one thing an author cannot infer from the page they are writing. ```bash oku spec # every name, grouped oku spec sankey # the fence, ready to paste oku spec table --json # the payload alone, no fence oku spec filepath # an inline kind: the syntax, and when to use it oku spec front-matter # every page-level key, with what it does oku spec kit # every kit.json key, with what it does ``` The three inline kinds — [filepath](reference.md#filepath), [glossary-term](reference.md#glossary-term) and [ext-ref](reference.md#ext-ref) — are written as a link inside a sentence rather than as a fence, which is why they were listed nowhere until they were listed here. Each prints its syntax and a note saying *when* to reach for it; the syntax alone answers how, and an author deciding between a code span and a chip is asking when. Two names in that list are not block kinds. `front-matter` prints every page-level key; `kit` prints every key of the tree's `kit.json`. Both read the schema they document rather than a list written beside it, so neither can fall behind the tool — which is exactly how `kit.json` came to carry five keys the tool read and its own schema refused. `name` — A block kind (`table`, `kpi-grid`, …), a chart type (`sankey`, `gantt`, …) or one of the two topics, `front-matter` and `kit`. Omit it to list every name. An unknown name exits 1 and suggests the nearest matches. `--json` off Print the bare payload instead of the fence that wraps it. Useful when composing a payload programmatically. The examples ship inside the wheel, so this works from any project that installed the tool — unlike [the reference page](reference.md), which lives in the kit's own docs tree. Every example is asserted valid against both the schema and the structural checks, so what it prints passes `oku check` unchanged. ## oku verify {#verify} Open the built pages in a headless browser and report what a source check cannot see. `oku check` reads the source; this reads the result. ```bash oku build && oku verify # ✓ 38 page(s) render clean: 19 standalone at 1440px and 360px, 19 in dist/site at 1440px ``` Diagrams drew The source parses; the renderer is what fails, and only in a browser. No figure is an empty box A wrong-but-valid payload validates and renders nothing. This is the failure the schema cannot reach by construction. No sideways scroll at 1440px or 360px Overflow is geometry. It has no representation in the source. No console or page errors An island's script throwing is invisible to every static check. Needs a browser: the `oku[verify]` extra carries playwright, and `./ctl deploy` in the oku repository installs the tool with it and fetches the chromium that playwright expects. Without it the command says so and exits 2 rather than reporting a pass it did not get. A failing request to a remote origin is ignored — that is the network's state, not the page's, and a check that fails for reasons the author cannot fix stops being believed. Local files missing IS reported. ## oku vendor {#vendor} Fetch the shared runtime files once so built pages work with no network. mermaid draws the diagrams, Prism colours the code, and four variable woff2 files carry the two typefaces the layout is measured in — all of which used to arrive from a third party on every page view. ```bash oku vendor # fetch what is missing oku vendor --update # re-fetch (a new upstream release) ``` `--update` off Re-fetch even when a copy is present. Use after pinning a new upstream version. (none) — Fetch only what is missing. `oku build` does this automatically the first time, so most projects never run the command. The files land in the installed kit's `vendor/` directory, so they are fetched once per machine and shared by every project. `oku build` copies one `_oku/vendor/` beside the output; every page reads that copy and falls back to the CDN if it is not there. Prism grammars are the one part that is not a fixed list. The kit carries a baseline, and beyond it a tree gets what it writes: `oku build` reads the code fences on its pages and fetches the grammars they name, with their dependencies, before it builds — so a page with an `hcl` block highlights without anyone naming hcl anywhere. Run inside a doc tree, `oku vendor` does the same. The fallback is one-directional here: once Prism is served from the vendored copy the autoloader points at that directory and cannot reach the CDN for a single grammar, which is why the kit asks only for what the directory declares it carries, and why `oku check` says `code-lang-missing` for a grammar that is still not there. A fence naming something that is not a Prism grammar at all — `text`, `console` — costs nothing and is not reported. The fonts have no CDN behind them, deliberately. A page that fetches a typeface tells a third party who is reading it, which is the reason they were vendored; without the vendored copy a page renders in the system stack instead, and the build ships no `@font-face` rule at all rather than a URL pointing at a file it did not carry. Both Latin subsets are fetched: `ş` and `ğ` live in latin-ext, so shipping only latin changes typeface in the middle of a Turkish word. They are **not** inlined into each page. mermaid is 3.3 MB against a 1.1 MB standalone page, so a tree would carry one copy per page that draws anything. Offline does not require a single file — it requires the bytes to be reachable. ## oku migrate {#migrate} Convert page-JSON sources (v1 or v2) to v3 markdown. Each `foo.json` becomes `foo.md` next to it and the JSON is removed. Migration is optional — the renderer accepts v1/v2 pages indefinitely — so run it when you want the on-disk source in the current authoring format. ```bash cd ~/path/to/your-project/docs oku migrate # migrated architecture.json → architecture.md # # Migrated 1 page(s). # Nothing left to convert: oku migrate # ✓ No page-JSON files found under /path/to/your-project/docs ``` `path` `.` File or directory to migrate. A directory is walked recursively; kit.json, site-manifest.json, package.json and tsconfig.json are skipped, as is anything that is not a page. `--dry-run` off Print the files that would change and write nothing. Still exits 0. `--keep-json` off Leave the source .json in place beside the emitted .md. The walkers prefer the .json, so a kept file shadows the .md until you remove it. Two guards make the deletion safe. A page whose `.md` already exists is skipped rather than overwritten, and every conversion is round-tripped in memory before the JSON is unlinked — the emitted markdown is parsed back and fingerprinted against the source. A page that does not round-trip losslessly is skipped with its source kept and a message asking you to report it. Exit code is 1 only when the input path does not exist; a run that migrates nothing still exits 0. ## oku check {#check} Lint every page in the project — `.md` sources and page-JSON alike. Schema validation plus structural / content checks. Fast — runs in milliseconds. Designed as the oku skill's auto-verify step. ```bash oku check # ✓ 11 page(s) clean (schema + structural + content) # # oku check --strict # exit 1 on warnings too # oku check --json # machine-parseable output # oku check --verbose # also surface info-level nudges # oku check --errors-only # suppress warnings in the report # oku check --fix # rewrite what can be fixed mechanically, then re-check ``` Issues land at three severities. Exit code is 1 if any error is present (or any warning under --strict); 0 otherwise. Info notes are suggestions, so the report prints them only with `--verbose` — but it always says how many there are and which codes they carry, because a note nothing ever mentions is one nobody knows to ask for. `--fix` applies the findings it can apply — today that is `path-in-code-span`, rewritten in prose, in GFM cells and inside `oku-*` payloads — then re-checks the tree as rewritten, so the report you read is the state of your files now. **error** `schema`, `deprecated-kind`, `unknown-kind`, `invalid-block`, `duplicate-anchor`, `chart-*`, `stray-demo`, `no-title`, `front-matter-malformed`, `shadowed-source` Page shape problems, removed primitives still in use, a body entry that is neither a markdown string nor a typed object, duplicate section / heading IDs, malformed chart payloads, demo pages outside docs/reference.md, a page without a title, a .json shadowing the source you edit. A page whose front-matter opened with `---` and hit a line that is not `key: value` — the block is being read as body text. **error** · markdown `fence-not-lifted`, `setext-heading`, `island-unclosed`, `fence-unclosed` An `oku-*` fence whose body is not a single JSON object of a known kind, so it stayed a code block instead of becoming a typed block. A setext (`===` underline) heading — the strict-GFM subset takes ATX `#` headings only. An HTML island whose tag never closes: everything after it is written inside it, so it takes the rest of the section — reported at the page end and at every `##`, because a section boundary ends the run of blocks the renderer emits in one pass. A code fence that never meets its closing run: legal CommonMark, where the block simply runs to the end of the document, and almost always a stray ``` at the start of a line in prose — every heading, paragraph and figure after it is inside a code block, and the ids they carried are not on the page any more. A run in the MIDDLE of a line opens nothing and is not judged. **warning** `process-breadcrumb`, `placeholder-text`, `unresolved-glossary`, `unresolved-extref`, `unresolved-link`, `unresolved-anchor`, `filepath-missing`, `filepath-outside`, `filepath-line`, `path-in-code-span`, `image-outside`, `unknown-meta-key`, `accent-unknown`, `translation-anchor-drift`, `kit-invalid`, `json-parse-failed`, `source-not-utf8` Prose containing process/history references (round-N, vN-review, fixed-in-round; the kit documents current behaviour only) — in a paragraph, in a typed payload and inside an HTML island alike, since an island is markup the reader sees through. A page whose SUBJECT is a history — a report citing the round it corrects, an audit, a changelog — declares `documents_history: true` in its front-matter and is exempt from this one rule; every other check still applies to it. Prose still carrying a placeholder (`TODO`, `TBD`, `FIXME`, `XXX`, `lorem ipsum`, or an unfilled `{{ }}` template) — in a paragraph, in a typed payload and inside an HTML island alike, since a step body, a card and the text between a ` `'s tags are all prose an author writes. A ` ` or ` ` body is not: that is code, and `// TODO: implement` in a sample is the sample. One inside a code span is the token being NAMED rather than left behind, so it is not flagged; this row spells its own four that way. Glossary terms and ext-refs that do not resolve against the domains the project's `kit.json` activates — the central registry files for those domains plus the project's own additions in `kit.json`, which is the set the runtime searches. A term from a domain the project does not activate, or from any registry at all when no `domains` are declared, is reported with the domain to add rather than a respelling of a reference that is spelled right. The element form inside an HTML island — ` `, the way a qualified reference is written — is read too, at its own line, and an `in` naming a domain the project neither activates nor adds entries to is reported as that rather than as a term not found. A link or image pointing at a file that does not exist relative to the page, or at a `#fragment` that is not a heading id on the page it names. A `#f/` file reference with no file at that path, or one resolving outside the project root — a page carries the bytes of the files it previews, so a reference reaching past the project would publish them, and that chip renders as a path to copy and nothing else. A `#f/path:120` or `#f/path:120-140` reference whose line is past the end of the file, whose range ends before it starts, or which names a line in a file that has none (an image) — the chip opens the file without marking a line. A code span naming a file that is really there — the reader has to leave the page and go and find it, where a `#f/` chip previews on hover, opens on click and copies the path; only a span holding a SEPARATOR is judged, so a bare `kit.json` — the file a sentence tells the READER to create — is left alone, and `oku check --fix` rewrites every one of them. A front-matter key the kit does not know, with the nearest one it does. An `accent:` that is a bare word and is neither one of the seven the kit tunes nor a CSS colour name — the browser cannot parse it, so the page keeps the default accent; only bare words are judged, since a hex or an `rgb(...)` is the browser's to read. A heading id present on one language of a page and not on its translation — the language switch carries the reader's fragment across, so it drops them at the top of a page they were deep inside. An image, ` ` or `srcset` candidate resolving to a real file outside the project root — a standalone page carries the bytes of everything it shows, so that reference would hand a file from outside the project to whoever the page is sent to, and neither build tree carries it. A `kit.json` key the kit does not read, named with the nearest one it does, or a value whose shape the schema refuses. Every setting in that file is read with a default behind it, so `personalisation` for `personalization` is not an error anywhere — it is every reader placeholder in the tree silently going unfilled, in the CLI, in the browser console and under `--strict` alike. `oku spec kit` prints the keys. A `.json` that will not parse. A file that will not parse cannot be shape-tested, and shape is what decides whether a `.json` is a page — so this is a warning unless one of two things is known: the file is `kit.json`, where the NAME is the contract and a malformed one silently reverts the accent, the domains, the languages and the reader placeholders for the whole tree; or an `.html` stub of the same stem sits beside it, which is the authoring pairing the kit documents, so the file IS a page and the page is missing from the build. `oku build` runs the same scan — before, it did not, and a broken legacy page vanished from the site, the nav, the manifest and the search index while the build printed a clean tick. A page source that is not UTF-8: it cannot be read, so the page is missing from the build — before, the decoding error escaped every reader and ended the check or build with a traceback. **warning** · markdown `ambiguous-hr`, `heading-level-skip`, `indented-code`, `lazy-continuation`, `undefined-footnote`, `undefined-link-reference`, `code-lang-missing` A `---` directly under a text line: a setext heading in CommonMark, a thematic break in the kit — insert a blank line before it. A heading that jumps a level (`##` straight to `####`), which breaks the outline for screen readers and the on-page TOC. A four-space-indented block after a blank line, which CommonMark reads as a code block and the kit reads as a paragraph. A blockquote line continued without its `>`. A `[^id]` or `[label]` reference with no definition on the page — it renders as literal text with nothing else to signal it. A fence naming a Prism grammar the kit does not carry: the autoloader points at the vendored components and cannot fall back to the CDN for one language, so the block renders as plain text. `oku build` and `oku vendor` fetch the grammars a tree uses, which leaves this for the case where neither could — no network, or a tree checked before it was built. A name that is no grammar at all (```text) is not reported: the kit stopped asking for those, so they cost nothing. **warning** · presentation `redundant-meta`, `prose-only-section`, `island-hand-styled`, `diagram-unknown-token`, `diagram-syntax`, `group-of-one`, `figure-restates-headings` A field that repeats another (`subtitle` verbatim from `summary`, `updated` from `date`). A section of three or more paragraphs with nothing for the eye — no table, chart, diagram, card grid or code block; a callout does not count. An HTML island carrying hardcoded colours or its own ` ` instead of building on the kit's classes and CSS variables. A mermaid style line naming a `var(--token)` this kit does not define — the kit leaves an unresolvable token as written, so Mermaid meets `var(` and the whole figure becomes a parse-error card; the usual cause is a page written against a newer kit than the installed tool carries. A mermaid line the vendored mermaid cannot read as written, in three shapes each measured in a browser: a flowchart label opening with a slash, as a route does (`G[/giris]` — `[/` opens a slanted shape that must close with `/]`; quote it, `G["/giris"]`); a `;` in sequence-diagram or timeline text, which ends the statement (write `,` or `#59;`); and a bare `#` in the same text, where mermaid stops the text without an error and the reader sees only what came before it (write `#35;`). The first two draw nothing; `oku check` cannot run mermaid, so before this the only thing that saw them was `oku verify`, after the build. A compare-grid / step flow / KPI grid / chart grid holding one member, where the primitive's whole job is the relationship between members. A diagram whose node labels are the page's own section titles. **info** `code-no-language`, `no-summary`, `html-island`, `empty-table`, `hand-set-derivable`, `accent-divergence`, `filepath-not-carried` Code blocks with no declared language. Pages with no meta.summary. HTML islands (they render in the kit, external markdown viewers strip them). A table with headers and no rows. A field set by hand where the build derives it. Three or more pages in one directory picking different accents with no default in kit.json. A `#f/` file too large to travel inside the page, so the chip names it and copies its path with no preview. > [!TIP] Adding to the oku skill flow > Run oku check --strict before declaring an HTML artifact done. Use --json to surface findings programmatically. The linter is the fastest verification step in the auto-verify loop — no browser required. > > The presentation rules exist so the briefing does not have to carry them as prose. A style rule written in a guide decays, because nothing fails when it is ignored; a rule the linter applies does not. Only the decidable half lives here — whether the diagram carries the point is still a question for a reader. ## oku serve {#serve} Local HTTP server in the project root. Synthesizes per-page .html stubs, site-manifest.json, and llms.txt in memory on each request — source dir stays clean. Picks the first free port from 9876. ```bash oku serve # ✓ Serving /path/to/your-project on http://localhost:9876 # Stop with Ctrl-C. # # HTML files: # http://localhost:9876/docs/index.html # http://localhost:9876/docs/reference.html # ... ``` - Walks up from cwd to find the directory containing docs/_oku; serves from there. Run from anywhere inside the project. - First free port from 9876–9900. Caps at 9900 (if all taken, errors out). `--port N` serves on exactly N instead, and exits 75 if something else holds it. - Synthesizes / / .html stubs from sibling .json or .md files on the fly; same for site-manifest.json and llms.txt. No filesystem writes. - Pagefind is not built by serve. Run oku build first if you need full-text search; serve falls back to in-page anchor search otherwise. - Opens the first HTML it finds in the default browser. Ctrl-C to stop. > [!TIP] Why HTTP, not file:// > Browsers apply different rules to local files than HTTP — symlink resolution, fetch, and ES module imports fail silently or behave inconsistently on file://. The local HTTP server sidesteps that. On macOS, opening a file:// URL also disables some same-origin policies that matter for the iframe sandbox in . Always serve. > [!NOTE] Optional flags > --no-watch disables the filesystem watcher + live-reload (serve static only). --no-search skips the background Pagefind index generation at startup. Both default to on so the dev loop is rich; opt out if you want a leaner serve. --no-open leaves the browser alone: by default serve opens the page nearest where it was started, which is wrong for a server started in the background or by a tool. --host is the address to bind, and it is 127.0.0.1 — this machine only. The server hands out the project root, working copy and all, so --host 0.0.0.0 (to open the preview on a phone) makes every file under the root readable to anyone who can route to your machine, with no password. The startup line prints the address actually bound. --port names the one port to serve on. Without it serve takes the first free port from 9876; with it, a busy port exits 75 rather than moving up, because whoever named the port — a dev board probing it, a second project kept off the first one's port — is looking there. ## oku preview {#preview} Renders one page for an editor's preview panel and prints, as JSON, where it went. The page goes through the same standalone build as oku build, so the panel shows what the build ships. The markdown can come from stdin, because an editor's buffer is usually ahead of the file on disk. [The IntelliJ plugin](#f/ide/intellij/README.md) runs this command. ```bash oku preview docs/guide.md --out /tmp/oku-preview --theme dark # {"protocol": 6, "html": "/tmp/oku-preview/3f2a9c1b7d4e/guide.html", # "page": "/tmp/oku-preview/3f2a9c1b7d4e/guide.json", "shell": "9c41e07a2b5d3f18", # "root": "/path/to/project/docs", "out": "/tmp/oku-preview/3f2a9c1b7d4e", # "ms": {"convert": 47, "manifest": 60, "standalone": 21}, "notes": []} ``` - The page's tree is the directory of the nearest kit.json between the page and its project root (the nearest .git), else the page's own directory. Every page of one tree is written to one subdirectory of --out, so the site tree's links reach pages rendered from the same tree. - The path may also be an .html shell — the index.html oku init writes, or a page's own stub. A shell previews the page beside it (index.md for index.html), as saved. An index.html with no page beside it is the tree's front door: the list of the tree's pages the runtime draws from the manifest, which is what oku build ships there. A front door has no page JSON, so page is null and an editor reloads it. - --stdin reads the markdown from stdin instead of the file. The path still decides the kit.json in force, the page's language, git's date and where #f/ references resolve. - --theme light or dark is the first paint's theme; without it the reader's system setting applies. The page keeps its scroll position across a reload. - page is the page JSON the HTML inlines, written beside it. It also says where each block starts in the source, which is how the page follows the editor beside it ([OkuRenderer.scrollToLine](reference.md#source-lines)); a built page does not carry that. shell fingerprints everything else the HTML carries: the kit, the manifest, the kit.json bundle, the string table, the linked .md files, the theme, the title. Two renders with the same html and shell differ only in the page, so an editor showing the first can hand the second's page to [OkuRenderer.update](reference.md#update-in-place), which keeps every block the edit did not touch and the reader's place; a different shell needs a reload. - The manifest carries the tree's absolute path, as oku serve does while bound to this machine, so the file viewer shows full paths. A preview is written for an editor on this machine; do not hand its directory to anyone. - notes holds what the build could not carry (an image over the inline cap, a file outside the project). Exit 1 with the reason on stderr when the page cannot be rendered at all: neither a .md nor an .html shell, a shell with no page beside it, missing, or not UTF-8. > [!NOTE] Long-running: --serve > --serve keeps one process for a whole editing session: one JSON request per stdin line, one JSON response per stdout line, until stdin closes. The first line out is a greeting, {"protocol": 6, "oku": …, "kit": …, "fences": {…}, "inline": {…}, "snippets": […], "front_matter": …, "admonitions": {…}} , so an editor can refuse an oku it does not speak to; fences maps every oku-* fence to a JSON schema for its body, written under --out, so an editor can complete and validate a fence while it is typed, inline names the link prefixes that are not heading anchors ( #f/ , #g/ , #x/ ), and snippets lists every component an editor can insert — one per fence kind and one per chart type, {tag, type, body} , the body being the payload oku spec prints, laid out a key per line and a record per line. front_matter is a JSON schema for a page's front-matter, with the keys and words oku spec front-matter prints, and admonitions maps each > [!TYPE] alert the renderer draws to what it is for. A request is {"id", "path", "text"?, "theme"?} (no text reads the file); the answer is the one-page result with the same id , or {"id", "error"} , and a bad request does not end the session. A request with "check": true lints instead of rendering and answers {"id", "issues", "ms"} : what oku check would report for the page if it held that text, each issue {severity, code, where, message, line?} . The rest of the tree is read from disk, because some of a page's findings are about other pages — an anchor a link expects, a translation's original — and only the page itself is validated against the schema, which is most of what a check costs. A request with "registry": true answers {"id", "glossary", "extrefs"} : every term the page can name with #g/ and every reference it can name with #x/ , each {term, domain, def} with the definition in the page's language — the slice oku check resolves the page's links against, so an editor offering these offers only what the check accepts; pages beside them lists what the page's parent: can name, {id, title} . A request with "fix": true answers {"id", "text", "moved"} : the text as oku check --fix would leave it — the buffer is checked inside its tree first, and only what the check reports is rewritten. A request with "anchor": "setup" answers {"id", "line"} : the source line of the heading whose id that is, or null — for an editor following a link to other.md#setup , which should land on the heading, not the top of the file. The ids are the ones oku check judges a link's #fragment by; of two headings with one id, the first. The tree's manifest is kept between requests and computed again when a file in the tree changes — a save that changes nothing a reader of the tree sees keeps it, so a save does not change shell — and every render after the first costs the page and not the tree: about 25 ms on this repository's docs, against about 200 ms for a one-shot run, most of which is starting Python. ## Dependencies {#optional-deps} One required, one opt-in. ## Install + run {#future} Worth noting because they're frequently asked. Two ways to invoke the CLI. ### Installed via uv ```bash ./ctl deploy # from the oku repository # Now `oku` is on PATH globally: oku serve ``` Installs oku as a console script. The wheel packs chrome.{css,js}, schema/, glossary/, extrefs/ inside oku/assets/ and ships starter templates under oku/templates/, so init/build find everything without a git layout. ### In-tree without install ```bash uv run bin/oku serve # Or plain python3 — both work: python3 bin/oku serve ``` [`bin/oku`](#f/bin/oku) is a thin shim that adds `src/` to sys.path and runs `oku.cli.main()`. PEP 723 inline metadata pulls jsonschema into an ephemeral venv when invoked via uv.