Skip to content

Document the TUI as a usage surface - #60

Merged
SPIKESPIGEL404 merged 3 commits into
mainfrom
claude/tui-docs-structure-fb9f7b
Aug 6, 2026
Merged

Document the TUI as a usage surface#60
SPIKESPIGEL404 merged 3 commits into
mainfrom
claude/tui-docs-structure-fb9f7b

Conversation

@SPIKESPIGEL404

Copy link
Copy Markdown
Contributor

Adds usage/tui.mdx, and fixes a docs-contract trap found while writing it.

The TUI page

bitrouter tui shipped in v1.0.0-alpha.27 but has no page. Worse, it's half-promised: cli-overlays/harnesses.md already carries a ## @tui block and generate-cli.mjs lists tui in the group, but the generated page renders only launch and spawn.cli-snapshot.json is still alpha.26, which predates the command. So the page titled "launch, spawn & tui" silently ships two of three.

This adds the concept page as a sibling of usage/mcp.mdx — the same split that page already has with the generated CLI reference. usage/ now reads as the three ways to drive BitRouter: CLI, MCP, TUI.

Structure follows the console's model, not a keybind dump. opencode's TUI page was the starting reference, but most of it doesn't transfer: its page is ordered input-first (@ file refs, ! bash, 17 slash commands) because its TUI is a text box. Ours has no composer anywhere — subagent panes are read-only by design. So the page leads with the ownership rule (sessions take your input, subagents never do), because no key makes sense before it. Its verb table carries a Reached from column rather than flattening three tiers — inline, leader, palette — into one list.

Facts come from apps/bitrouter/src/tui/, not TUI_SPEC_V3.md, which has drifted:

  • the roster is a right-hand rail; the spec draws a single left rail
  • Ctrl-C has three behaviours by pane kind and ownership, and never quits the console
  • : reaches the palette only from a monitor pane — a session swallows it
  • the fleet socket is #[cfg(unix)], so delegation degrades on Windows

The harness matrix is two independent columns: pi and openclaw are routed but get no fleet MCP tools; grok and agy get neither. A harness without those tools can host the orchestrator pane but can never spawn a subagent — the rail just stays empty, which is the failure that table predicts.

The lint fix

The authoring contract told writers to prefer > [!NOTE] blockquotes. That doesn't work here — source.config.ts registers only remarkGfm + rehypeSlug, so alerts render as a plain blockquote with a literal [!NOTE] visible. Nothing under content/ used the syntax, so nothing was broken in production; the contract just invited it, and lint:docs stayed green either way. The trap is that alerts do render in repo Markdown like CONTRIBUTING.md, because GitHub renders those itself.

Made <Callout> the only documented form and added a lint rule. Fenced examples still pass, so docs can document the form they forbid.

Two gaps closed while verifying:

  • usage/ was excluded from linting outright. The exclusion exists for the generated usage/cli/ pages, but it was a level too coarse — hand-authored usage/mcp.mdx and usage/tui.mdx were never checked, so the new rule wouldn't have covered the page that surfaced this. Now lints usage/ and skips only the generated subtree.
  • Line numbers were body-relative. splitFrontmatter drops the frontmatter and the blank run after it, so an alert on line 8 reported as :3. Pre-existing for the import/export check too; both now point at the real line.

Verification

  • pnpm lint:docs — OK, 47 docs across 6 sections (was 45/5)
  • pnpm test — 83/83
  • Lint rule proven both directions: bare alert fails with exit 1 and a message naming the fix; fenced alert passes. Line numbers checked against known positions (:8, :7).
  • Page rendered on the dev server: correct sidebar slot under Usage, full TOC, prev/next wires MCP Server → TUI → Model Fallbacks. ASCII diagram fits desktop and scrolls inside its own container at 375px with no page-level horizontal scroll. No console errors from the page.

Follow-up (not in this PR)

The bitrouter tui flag reference this page links to still doesn't exist. It appears with no further authoring once the snapshot is re-captured from an alpha.27+ binary — that needs a local upgrade and rewrites two committed generated files, so I left it out:

brew upgrade bitrouter && pnpm snapshot:cli && pnpm generate:cli

🤖 Generated with Claude Code

`bitrouter tui` shipped in v1.0.0-alpha.27 but had no page: the CLI
overlay's `## @tui` block is silently dropped because .cli-snapshot.json
is still alpha.26, so `usage/cli/harnesses` promises three commands and
renders two.

Add `usage/tui.mdx` as the concept page, sibling to `usage/mcp.mdx` —
the same split that page already has with the generated CLI reference.
Usage now reads as the three ways to drive BitRouter: CLI, MCP, TUI.

Structured around the console's own model rather than a keybind dump,
since none of the keys make sense before the ownership rule does:
sessions take your input, subagents never do. Facts are taken from
apps/bitrouter/src/tui/ rather than TUI_SPEC_V3, which has drifted —
the roster is a right-hand rail (not the spec's left), `Ctrl-C` has
three distinct behaviours by pane kind and ownership, and `:` reaches
the palette only from a monitor pane.

Includes the harness matrix, which is two independent columns: pi and
openclaw are routed but get no fleet MCP tools, and grok/agy get
neither. A harness without those tools can host the orchestrator pane
but can never spawn a subagent — the rail just stays empty, which is
the failure this table predicts.

The `bitrouter tui` flag reference it links to appears once the CLI
snapshot is re-captured from an alpha.27+ binary.
The authoring contract told writers to prefer `> [!NOTE]` blockquotes,
but the site registers only remarkGfm + rehypeSlug — no alerts plugin —
so those render as a plain blockquote with a literal `[!NOTE]` in the
body. Nothing under content/ used the syntax, so nothing was broken;
the contract just invited it, and lint:docs stayed green either way.

The trap is that alerts DO render in repo Markdown like CONTRIBUTING.md,
because GitHub renders those itself. Say so, make <Callout> the only
documented form, and fail the lint on the syntax so it can't come back
silently. Fenced examples still pass, so docs can document the form
they forbid.

Also close two gaps found while checking the fix:

- `usage/` was excluded from linting outright. The exclusion exists for
  the generated `usage/cli/` pages, but it was a level too coarse:
  hand-authored `usage/mcp.mdx` and `usage/tui.mdx` were never checked,
  so the new rule would not have covered the page that surfaced this.
  Lint `usage/` and skip only the generated subtree — 45 → 47 docs.
- Reported line numbers were body-relative, because splitFrontmatter
  drops the frontmatter and the blank run after it, so an alert on line
  8 reported as :3. Pre-existing for the import/export check too. Both
  now point at the real line.
Main's #59 collapsed the ten generated `usage/cli/` pages into one
`usage/cli.mdx`, moved Integrations and Guides out of the `(guide)`
group into their own tabs, and dissolved AI Resources into `usage/`.
Three resolutions:

- `usage/meta.json`: main made Usage cli + mcp + skills. Insert `tui`
  after `cli` — those two are the binary's human-facing surfaces, and
  mcp/skills are how agents drive it.

- `scripts/check-docs.mjs`: main independently closed the same `usage/`
  lint gap this branch did, and did it better for the new layout —
  section paths are now `(guide)/`-prefixed since Integrations and
  Guides are top-level, and GENERATED is an exact-path Set because the
  CLI reference is one file rather than a subtree. Took main's version
  wholesale and re-applied only what it doesn't have: the alert rule and
  the frontmatter line-number offset.

- `usage/tui.mdx` See also: the CLI subpages it linked to no longer
  exist. Repointed at the single page's anchors. Main also folded the
  `tui` blurb into the Harnesses section intro and noted it has no
  generated subsection (it is absent from the alpha.26 snapshot's
  `--help`), so the section link now lands on real prose.

Also lists `tui.mdx` in CONTRIBUTING's `usage/` inventory.

Verified: lint 48 docs / 6 sections; the alert rule still fails a bare
alert at the right line and passes a fenced one; 83/83 tests;
`generate:cli` reproduces the committed page byte-for-byte; every
outbound link on the TUI page returns 200 and all three CLI anchors
resolve.
@SPIKESPIGEL404
SPIKESPIGEL404 merged commit b387357 into main Aug 6, 2026
1 check passed
SPIKESPIGEL404 added a commit that referenced this pull request Aug 6, 2026
Both PRs added a page to `usage/`, so the section list and CONTRIBUTING's
inventory conflicted. Both resolutions are additive — neither side was
replacing the other.

Nav order is cli · tui · configuration · mcp · skills: the two surfaces
you run, then the file they read, then the two agent-facing ones.

Verified after merging: lint 49 docs / 6 sections, now including the
GitHub-alert rule main gained in #60 — the configuration page uses
<Callout> throughout and passes it; 83/83 tests; all five Usage pages
plus the two edited pages return 200.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant