Skip to content

chore: type-check and run the root README examples under docgen - #210

Merged
thomasfosterau merged 1 commit into
trunkfrom
claude/root-readme-docgen
Oct 22, 2026
Merged

thomasfosterau merged 1 commit into
trunkfrom
claude/root-readme-docgen

Conversation

@thomasfosterau

Copy link
Copy Markdown
Owner

Summary

Part of #178. Extends #205's README check from the package READMEs to the root README.md, using as little new machinery as possible:

  • scripts/readme-examples.ts now takes README paths as arguments (default README.md, so the other packages behave as before). It writes one generated module per README under docs/readme/src/, named after the README's path from the workspace root (README.ts for the root README, packages.<dir>.README.ts for a package README). Errors name that path (README.md:30: …). It is split into small functions (scanReadme, renderBlock, writeReadme).
  • packageConfig gets a rootReadme?: boolean | undefined option. payments-stripe sets it because the root blocks import the core and the Stripe package, which both resolve from there through exports to dist/ via the existing build edge. Its docgen task passes README.md ../../README.md to the script, and the second docgen pass runs both modules. With the option set, the root README.md is added to that task's cache inputs as { pattern: "README.md", base: "workspace" }. I checked that editing the root README is a cache miss for payments-stripe's docgen. vp run docgen at the root already depends on payments-stripe's docgen, so it covers the root README too.
  • Root README quick start: it used to run await Effect.runPromise(...) against the live Stripe API. It now builds const createCustomer = () => Effect.runPromise(...) and never calls it, the same build-not-run shape as the package quick starts. That was its only block, and nothing else had drifted.
  • AGENTS.md's README-examples pitfall, the docgen command line, CONTRIBUTING.md and the root vite.config.ts comment now say the root README is checked too, and where.

Drift check: I renamed Customer.create to Customer.createe in the root block. vp run --no-cache docgen then failed with docs/readme/examples/6-docs-readme-src-README.ts-constant-line24-0.ts(6,26): error TS2551: Property 'createe' does not exist …. I reverted the rename afterwards.

Verification

  1. vp check: pass (0 errors, 119 warnings, all in files this PR does not touch)
  2. vp run check: pass
  3. vp run -r test:unit: pass (140 + 121 + 161 + 1368 tests)
  4. vp run -r build: pass
  5. vp run --no-cache docgen: pass (payments-stripe: 6 package README blocks + 1 root block)
  6. vp run test:coverage: pass. Then fallow audit --base origin/trunk: no issues in 7 changed files

Changeset

  • None needed: docs and tooling only. No published package's behaviour changes.

Notes

If a root README block ever imports a provider other than Stripe, the package that runs the root blocks needs that provider as a dependency, or the block has to move to that provider's README. AGENTS.md says so.


Generated by Claude Code

scripts/readme-examples.ts now takes README paths (default README.md) and
writes one generated module per README, named after its workspace path.
packageConfig gains `rootReadme`; payments-stripe sets it, so its docgen
task also runs the root README's blocks (they import the core and the
Stripe package) and the root README.md joins that task's cache inputs.

The root quick start no longer calls Stripe: it builds `createCustomer`
and stops short of invoking it, as the package quick starts do.

Part of #178.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WC1gJZL1bzFPvz66HKMe6H
@thomasfosterau
thomasfosterau merged commit 5c0264b into trunk Oct 22, 2026
1 check passed
@thomasfosterau
thomasfosterau deleted the claude/root-readme-docgen branch October 22, 2026 09:27
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.

2 participants