Skip to content

feat: ship the docs as plain Markdown in docs/ again, indexed for harnesspm - #1697

Merged
tenphi merged 10 commits into
mainfrom
claude/serene-maxwell-x9jzo5
Nov 23, 2026
Merged

tenphi merged 10 commits into
mainfrom
claude/serene-maxwell-x9jzo5

Conversation

@tenphi

@tenphi tenphi commented Nov 21, 2026 •

Copy link
Copy Markdown
Member

Describe changes

#1643 shipped the docs as their Storybook sources (src/**/*.docs.mdx) and removed the docs build. That made the docs harder to use: every page starts with imports and Storybook JSX, 575 links are Storybook routes that lead nowhere in a package, and the paths are deep. This PR brings the build back, improved, and exposes its output through harnesspm.

📚 What the package ships now

Before (0.214–0.216) After
Pages src/components/actions/Button/Button.docs.mdx docs/components/actions/Button.md
Modern Form The guide and two side docs under src/ The guide is form/ModernForm.md, the migration guide sits next to it. The type-check comparison (a Cloud benchmark) no longer ships.
Guides src/stories/Usage.docs.mdx docs/Usage.md
Content Imports, <Meta>, <Story>, <Canvas> Plain Markdown. Sections that held only a story are dropped.
Links /docs/<id>--docs routes Relative links to the other pages, or GitHub/Storybook URLs for what doesn't ship
Index harnesspm lists files by path docs/llms.txt: guides, then components by category, each with a one-line description
harnesspm docs: "../src" docs: "../docs", so uikit:docs is docs/llms.txt

Same layout as before 0.214, so old docs/… paths work again. The Tasty and Glaze copies (docs/tasty, docs/glaze) do not come back: harnesspm already ships both through extends at the installed version, and Glaze 3.2.0, which this PR now pins, ships its pages as plain Markdown too.

🛠️ The build: scripts/prepare-docs.mjs

  • prepack runs node scripts/prepare-docs.mjs && harnesspm check. postpack runs --clean. So pnpm pack, npm publish (canary) and changeset publish all ship the built docs, and the working tree stays clean. Since harnesspm 0.9.1, that check reads the docs files ships, so it covers the built pages too.
  • --check builds in memory and writes nothing. pnpm check:harness runs it first, in CI's lint job, which every PR runs: a page can link to any repository file (such as a rule in docs/rules/), so a PR that moves one fails there, not at the next pack.
  • MDX → Markdown: drops imports, exports, MDX comments and component tags (also multi-line ones). It inlines the guide ModernForm.docs.mdx renders with <Markdown>. Code fences follow CommonMark, so a four-backtick fence can hold three-backtick lines.
  • Links:
    • A Storybook route leads to its page. A component with stories but no docs file gets its autodocs Storybook URL.
    • A relative link or a GitHub link to a shipped file leads to its page. Any other existing file gets a GitHub link.
    • A story route (/story/<title>--<story>) becomes the Storybook URL when a stories file has that title.
    • Links with a title, [text](url 'title'), are rewritten too.
  • The build fails, so none of these ship: a link that leads nowhere; a page without a Storybook title from its <Meta>; a page that doesn't start with its # title; Storybook markup or a route left in a page's prose; two sources that become one page.
  • cleanup-docs.mjs is now the --clean flag, with the same manifest (.docs-generated).

🏠 In this repository

  • docs/ holds only docs/rules/ until a pack (.gitignore: docs/*, !docs/rules).
  • harnesspm.json excludes uikit:docs here. Agents here read the pages in src/, and the lock no longer changes with each docs edit. Before, every .docs.mdx edit failed harnesspm sync --check until the lock was synced again. harnesspm 0.10.0 leaves out a built docs folder by itself only when git ignores the folder, and docs/ isn't ignored (docs/rules/ is tracked), so the exclude stays: without it, docs/rules/ becomes uikit:docs.
  • harnesspm/patches/uikit-usage.patch.md now also replaces the rule's Components and Typography sections, to point at src/ instead of "the UI Kit docs index".

🔗 Dead links fixed (they were dead in Storybook too)

  • blob/main/docs/modern-form-migration.md (moved by feat: ship a harness for coding agents, with uikit:colors #1643) → src/components/form/Form/modern-form-migration.md, on 4 pages.
  • /docs/generic-text--docs, /docs/tasty-base-properties--docs, /docs/overlays-tooltip-{provider,trigger}--docs → the real ids.
  • /components/ListBox, /content/Item and similar paths on Tree, IconSwitch and Toast → /docs/<id>--docs. On DisplayTransition, Modal, Popover and OverlayWrapper have no page, so they are now plain code names.
  • Toast: a four-backtick fence closed only 70 lines later, so Storybook showed "Interactive Progress State Toggle" through "Best Practices" as one code block. Now it closes after its example.

🧪 Tests

  • scripts/prepare-docs.test.mjs: the paths, titles, MDX stripping, fences, links (routes, titles, GitHub, dead ones), leftover markup, empty sections and the index, on fixed inputs, so a docs edit can't fail it. The real pages are built by pnpm check:harness on every PR.
  • package-tests/artifacts.test.tsx on the packed build: the docs layout, llms.txt lists every page once, src/ doesn't ship, and harnesspm check passes on the extracted package, the same check prepack runs in the repo.

Other changes

  • docs/rules/harness.md, docs/rules/documentation.md (links must resolve, every page has a <Meta> title; pnpm check:harness lists every problem), README.md (a line on the Markdown docs and harnesspm), the CI planner (docs-guide now matches the guide and the migration guide only), and the lint step's name ("Build the docs and validate the agent harness").
  • @tenphi/glaze 3.1.0 → 3.2.0 (feat(docs): ship the docs as plain Markdown for coding agents tenphi/glaze#121, which fixes Docs for agents: 9 of 19 published pages are site MDX, with imports of docs-site/, which doesn't ship tenphi/glaze#116, filed for this PR). Glaze's docs ship as plain Markdown in harness/docs/ with its own llms.txt, so apps on UI Kit get readable Glaze pages in glaze:docs. Its code is unchanged apart from one error message, so no color moves. Three hand-written links to Glaze's old docs/*.mdx pages (AGENTS.md, docs/rules/probe.md, docs/rules/review.md) lead to the new pages.
  • @tenphi/harnesspm devDependency ^0.8.0 → ^0.10.0. 0.9.1 (fix(check): judge docs and links by what the package ships tenphi/harnesspm#58, made for this PR): its check judges docs by what files ships, so prepack's check covers the built pages in the repo, and its private-key warning no longer fires on the PasswordInput page's PEM placeholder. 0.10.0 changes only the lock here; docs/rules/harness.md says why the uikit:docs exclude stays.
  • Changeset: minor, since src/**/*.docs.mdx no longer ships. It also says UI Kit now pins Glaze 3.2.0.

Part of CUB-8733

Checklist
  • Pipeline is passed
  • Tests are added (including unit tests and stories in the storybook)
  • Tests are passed successfully
  • Changeset(s) is(are) added
  • Commit message follows commit guidelines

Other information

Verification

  • pnpm pack:test: prepack wrote 127 files (126 pages + llms.txt), harnesspm check passed, postpack removed them all.
  • pnpm test:package: 30 tests pass, including harnesspm check on the tarball.
  • A scratch app with the packed build and harnesspm 0.8.0: harnesspm init writes Docs: node_modules/.harnesspm/pkgs/@cube-dev/ui-kit/docs/llms.txt (uikit:docs), the index's links resolve, and harnesspm doctor reports ✅ ready.
  • Storybook's MDX loader compiles all 15 edited pages.
  • pnpm test:types, oxlint, Prettier, pnpm check:harness, CI=true pnpm exec harnesspm sync --check, and the planner, harness and builder specs pass.
  • pnpm test:once: the full suite passes (220 files, 5922 tests), on the final head 4136d37c too, with all 11 checks (lint, types, both harness checks, the suite, build, the four package checks, pack and package tests).
  • With harnesspm 0.9.1 installed: a dead link planted in a built page fails the repo's harnesspm check (exit 1), the package tests print no warnings, and CI=true pnpm exec harnesspm sync --check passes.
  • Glaze 3.2.0 (52a73051) and harnesspm 0.10.0 (78e7b22e): all 11 checks pass on each commit. Glaze's dist/ differs from 3.1.0 only in comments and one error message, and its 19 shipped pages have no MDX outside code. With harnesspm 0.10.0 and no exclude, sync --check asks to add docs/rules/ as uikit:docs, so the exclude stays.

Review rounds (UI Kit's implement stage 5: two independent reviewers per round, ui-review and entropy-review, plus all 11 checks)

Round High / Medium Fixed Declined
1 1 Medium: pages link to repo files whose kinds no CI job reads, so a PR moving one could break the next pack --check in check:harness (lint, every PR); ## Component no longer dropped above ### Properties on 54 pages; story routes checked; the Cloud benchmark no longer ships —
2 1 Medium: --check warned where the spec failed, so a docs-only PR could break the next PR One rule set: a page without a <Meta> title is an error; the spec builds no real pages; a docs-route check that round 1 loosened, restored; titles only from a page's first line —
3 none (stable) Lows: titled links rewritten; leftover-markup rule moved from the package test into the build; header, docs and CI step name synced —
4 none (stable) Lows: single-quoted titles (Prettier's form); the package test's duplicate title check removed A dead route gives two error lines: cosmetic, and the second check still catches syntax the rewriter skips

Entropy: UI Kit packaging and docs authoring, Slightly Increased. It adds a build script to maintain, and two repo-only patch sections that follow the shipped rule. It also removes the lock re-sync after each docs edit, and dead links now fail the pack instead of shipping silently. For consumers' agents, plain pages, links that resolve and an index with descriptions should make docs easier to use. Cloud is unverified: no Cloud checkout here.

Follow-ups (filed while doing this)

🤖 Generated with Claude Code

https://claude.ai/code/session_01Gr8S7FAHF2ZZjma1gHg43N

…nesspm

Bring back the docs build that #1643 removed, as scripts/prepare-docs.mjs
(prepack; --clean at postpack). Each Storybook page and Modern Form guide
becomes plain Markdown at a short path in docs/, with links that work in
the package, and docs/llms.txt indexes them. harness/plugin.json points
docs at ../docs, so harnesspm gives consumers that index as uikit:docs.
A link that leads nowhere fails the build.

In this repository, harnesspm.json excludes uikit:docs, which exists only
at pack time, and patches the rule's docs pointers to src/. Fix the dead
links the build reported, and the Toast page's unclosed code fence.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7FAHF2ZZjma1gHg43N
@vercel

vercel Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cube-ui-kit Ready Ready Preview Nov 23, 2026 12:01pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 78e7b22

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cube-dev/ui-kit Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

📦 NPM canary release

Deployed canary version 0.0.0-canary-8ea8edb.

Comment thread scripts/prepare-docs.mjs Fixed
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🏋️ Size limit report

Name Size Change
All 653.85 KB +0.01% 🔺
Tree shaking (just a Button) 163.76 KB · 25% of All 0% 🟰

Compared against main at 011f71b — run 45158047555, 2026-11-23T10:39:08Z.

Third-party packages

✅ No third-party package entered or left the bundle, and none grew more than 10 KB past its approved size.


To see which modules changed, download the size-limit-statoscope-report artifact from this run and open report.html.

CodeQL flagged the RegExp built from the GITHUB constant with only dots
escaped. A literal has no escaping step to get wrong.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7FAHF2ZZjma1gHg43N
harnesspm 0.9.1 judges docs by what `files` ships, so the `harnesspm
check` that prepack runs after the docs build now checks the built pages
in the repository too. Its private-key warning no longer fires on the
PasswordInput page's PEM placeholder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7FAHF2ZZjma1gHg43N
Review round 1 of the docs build:

- `pnpm check:harness`, which the lint job runs on every PR, now builds
  the docs in memory (`--check`). A page can link to any repository file,
  such as a rule in docs/rules/, whose kind no other job reads, so a PR
  that moved one could pass and then break the next pack.
- A `---` no longer ends a section: `## Component` stays above its
  `### Properties`, as the documented page structure has it.
- A story route's stories title is checked, like a docs route.
- A page without a `#` title fails the build, and the error says problems,
  not dead links.
- Only the Modern Form migration guide ships beside the pages. The
  type-check comparison is a Cloud benchmark for contributors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7FAHF2ZZjma1gHg43N
Review round 2 of the docs build:

- A page without a Storybook title from its <Meta> is an error, as the
  documented page structure requires, not a warning. `--check` and the
  spec disagreed on it, so a docs-only PR could pass and fail the next.
- The spec no longer builds the real pages: `pnpm check:harness` does,
  in the lint job on every PR. Its cases use fixed inputs.
- A docs route without a page needs a stories file's autodocs id again,
  and a story route's title must be a stories file's, not an MDX page's.
- A page's title is the heading it starts with, never a comment in code.
- The guides list drops a filter that no longer applies.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7FAHF2ZZjma1gHg43N
Review round 3 of the docs build (no High or Medium finding; these are
the Lows):

- A link with a title, `[text](url "title")`, is rewritten like any
  other. It shipped unrewritten, and dead in the package.
- The build fails on Storybook markup or a route left in a page's prose,
  outside code. The package test had these rules, in a form that also
  forbade code samples the build allows, and only code PRs run it.
- CI's lint step says that it builds the docs, and why it runs there.
- The builder's header and documentation.md list every rule the build
  enforces, and what a story link becomes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7FAHF2ZZjma1gHg43N
Review round 4 of the docs build (no High or Medium finding; these are
the Lows):

- A link title in single quotes, the only form Prettier lets a page
  commit, is rewritten too. Round 3 handled only double quotes, so a
  titled relative link could still ship dead.
- The package test no longer re-checks the title rule the build owns.
- documentation.md: `pnpm check:harness` lists every problem, not only
  links.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7FAHF2ZZjma1gHg43N

tenphi commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

About the red Browser tests / Compiler on (2/2) on 7283b4e9: it's not this PR's.

  • What failed: ItemTable.columns.browser.test.tsx › "keeps row selection, actions and menu controls usable while windowed". onRowMenuAction had 0 calls right after the click on the "Inspect record" menu item (line 545).
  • Why it's not this PR: the PR touches neither ItemTable nor any browser spec. The job ran only because a workflow edit makes the planner run every job. The same shard passed on this PR's three earlier heads. It passed again on 4136d37c (the one re-run), and 10 of 10 local runs of that test passed under load.
  • Likely cause: the last assertion runs synchronously after realInput.click on the menu item. The earlier steps of the test wait with vi.waitFor. If the press lands while the menu popover is still opening, or the action is reported a tick later, the spy has no call yet, which only shows on a busy runner.
  • Proposed fix (not in this PR): wrap that last expectation in await vi.waitFor(() => expect(onRowMenuAction).toHaveBeenCalledWith(…)), as the selection check above it already does.

Generated by Claude Code

Resolves the harnesspm.lock.json conflict: main changed the uikit:docs
hash for #1698's docs edits, and this branch excludes uikit:docs, so the
entry goes. A fresh install and `harnesspm sync` on the merged tree
change nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7FAHF2ZZjma1gHg43N
Glaze 3.2.0 ships its docs as plain Markdown in harness/docs/, indexed
by its own llms.txt (tenphi/glaze#121, which fixes tenphi/glaze#116, the
follow-up this PR filed). Its code is unchanged apart from one error
message, so no color moves.

- `pnpm update-glaze` with 3.2.0: package.json, pnpm-lock.yaml, and
  `harnesspm sync` for the lock and AGENTS.md's harnesspm block.
- The three hand-written links to Glaze's old `docs/*.mdx` pages
  (AGENTS.md, docs/rules/probe.md, docs/rules/review.md) lead to
  `harness/docs/*.md`.
- The changeset says UI Kit now pins Glaze 3.2.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7FAHF2ZZjma1gHg43N
`harnesspm sync` with 0.10.0 changes only the lock: harnesspm's own
version, docs, config rule and two skills. AGENTS.md is the same.

0.10.0 leaves out a built docs folder of the project's own harness by
itself, but only when git ignores the folder. Here docs/ is not ignored,
because docs/rules/ is tracked, so without the exclude of uikit:docs,
docs/rules/ becomes uikit:docs (tried: sync then adds it to the lock
and AGENTS.md). The exclude stays, and docs/rules/harness.md says why.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7FAHF2ZZjma1gHg43N
@tenphi
tenphi merged commit bd28c89 into main Nov 23, 2026
33 checks passed
@tenphi
tenphi deleted the claude/serene-maxwell-x9jzo5 branch November 23, 2026 12:06
@tenphi tenphi mentioned this pull request Nov 23, 2026
tenphi pushed a commit that referenced this pull request Nov 23, 2026
Resolves the harnesspm.lock.json conflict with #1697, which excludes uikit:docs in this repository: took main's side; harnesspm sync on the merged tree changes nothing, and check:harness (now building every docs page) passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7BxbSZAimoxvP5rLFH

This branch was successfully deployed

2 active deployments
Preview — 78e7b22e Deployed Nov 23, 2026 by vercel[bot]
Chromatic staging — 78e7b22e Deployed Nov 23, 2026 by tenphi via Prepare Storybook for review & tests #4536
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.

Docs for agents: 9 of 19 published pages are site MDX, with imports of docs-site/, which doesn't ship

3 participants