Skip to content

docs: sync package JSDoc with docs content and add verification script - #1770

Merged
dinwwwh merged 4 commits into
middleapi:mainfrom
dinwwwh:claude/sync-packages-jsdocs-content-fc60d9
Aug 3, 2026
Merged

docs: sync package JSDoc with docs content and add verification script#1770
dinwwwh merged 4 commits into
middleapi:mainfrom
dinwwwh:claude/sync-packages-jsdocs-content-fc60d9

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Aug 3, 2026

Copy link
Copy Markdown
Member

Every @orpc/* API mentioned in the docs content now carries JSDoc with a backlink to orpc.dev, and a new verification script keeps the two in sync. The script runs in CI, so docs and JSDoc can no longer drift.

JSDoc sweep

  • ~124 source files across all packages now follow one template: 1-3 sentence summary, optional @remarks with **Warning**:/**Note**:, and @see {@link https://orpc.dev/docs/... | Page Title} as the last tag (titles taken from the real page titles, or "Page Title - Heading" for anchored links).
  • Previously undocumented flagship APIs are covered: os, oc, createORPCClient, every RPCHandler/RPCLink/OpenAPIHandler adapter, OpenAPIGenerator, all plugins, schema converters, publisher/ratelimit backends, and the previously zero-coverage packages (bun, cloudflare, nest, next, pino, opentelemetry, evlog, arktype, valibot).
  • Legacy forms are gone repo-wide: @info/@warning tags became @remarks notes, space-form {@link url Title Docs} links became pipe form, {@see} misuses and a stray @return are fixed, and two broken @example fences are closed.
  • Third-party re-exports (getEventMeta, withEventMeta, HibernationAsyncIteratorClass) are documented on their re-export specifiers.

Verification script

pnpm docs:check-jsdoc (scripts/verify-docs-jsdoc.ts, no new dependencies) extracts every import { X } from '@orpc/...' in docs code fences, resolves each identifier to its declaration through the TypeScript compiler API (including export * from chains and aliases), and fails CI when a declaration lacks JSDoc, lacks an orpc.dev backlink, links a nonexistent page, or uses an anchor that matches no heading, or titles a link with anything but the real page title (+ heading for anchors). It also warns when a linked page never mentions the symbol (--strict promotes this to an error). It also validates every https://orpc.dev/... URL anywhere in package sources (markdown links in prose, member-level docs; docs, blog, and homepage paths all resolve against apps/content) for page and anchor existence. Supports --filter, --list for incremental work. Added to the lint_and_typecheck job.

Docs bugs the script caught (fixed here)

  • integrations/next.md imported four helpers from the wrong specifier (@orpc/next/hooks instead of @orpc/next / @orpc/client).
  • adapters/fetch-api.md and openapi/scalar.md imported the deprecated CORSPlugin while instantiating CORSHandlerPlugin.
  • helpers/publisher.md redis example referenced an undefined redis variable and carried a copy-pasted ratelimit comment.
  • Several stale anchors in existing JSDoc (e.g. #using-createsafeclient) now point at real headings.

Testing

  • pnpm docs:check-jsdoc: 0 errors, 0 warnings across 196 docs-mentioned symbols (also clean with --strict).
  • pnpm lint, pnpm type:check, and pnpm --filter @orpc/bun type:check all pass (cloudflare/nest type-check as part of the recursive run).
  • All changes to package sources are comment-only.

CONTRIBUTING.md documents the convention in a new "JSDoc & Documentation Links" section.

Every @orpc/* API mentioned in apps/content/docs now carries JSDoc with an
orpc.dev backlink, following one repo-wide template (@remarks with
**Warning**/**Note**, pipe-form @see links titled by sidebar label, no
@example). Legacy @info/@warning tags, space-form links, {@see} misuses and
broken @example fences are normalized away.

scripts/verify-docs-jsdoc.ts (pnpm docs:check-jsdoc, wired into CI) extracts
docs-mentioned imports, resolves them to declarations via the TypeScript
compiler API, and validates JSDoc presence, backlink URLs, and anchors
against the content pages. It also caught several docs bugs (wrong import
specifiers in next.md, deprecated CORSPlugin imports, a broken redis
publisher example) which are fixed here.
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
orpc Ready Ready Preview Aug 3, 2026 11:49am

@pkg-pr-new

pkg-pr-new Bot commented Aug 3, 2026

Copy link
Copy Markdown
More templates

@orpc/ai-sdk

npm i https://pkg.pr.new/middleapi/orpc/@orpc/ai-sdk@1770

@orpc/arktype

npm i https://pkg.pr.new/middleapi/orpc/@orpc/arktype@1770

@orpc/bun

npm i https://pkg.pr.new/middleapi/orpc/@orpc/bun@1770

@orpc/client

npm i https://pkg.pr.new/middleapi/orpc/@orpc/client@1770

@orpc/cloudflare

npm i https://pkg.pr.new/middleapi/orpc/@orpc/cloudflare@1770

@orpc/contract

npm i https://pkg.pr.new/middleapi/orpc/@orpc/contract@1770

@orpc/experimental-effect

npm i https://pkg.pr.new/middleapi/orpc/@orpc/experimental-effect@1770

@orpc/evlog

npm i https://pkg.pr.new/middleapi/orpc/@orpc/evlog@1770

@orpc/hibernation

npm i https://pkg.pr.new/middleapi/orpc/@orpc/hibernation@1770

@orpc/json-schema

npm i https://pkg.pr.new/middleapi/orpc/@orpc/json-schema@1770

@orpc/nest

npm i https://pkg.pr.new/middleapi/orpc/@orpc/nest@1770

@orpc/next

npm i https://pkg.pr.new/middleapi/orpc/@orpc/next@1770

@orpc/openapi

npm i https://pkg.pr.new/middleapi/orpc/@orpc/openapi@1770

@orpc/opentelemetry

npm i https://pkg.pr.new/middleapi/orpc/@orpc/opentelemetry@1770

@orpc/pinia-colada

npm i https://pkg.pr.new/middleapi/orpc/@orpc/pinia-colada@1770

@orpc/pino

npm i https://pkg.pr.new/middleapi/orpc/@orpc/pino@1770

@orpc/publisher

npm i https://pkg.pr.new/middleapi/orpc/@orpc/publisher@1770

@orpc/ratelimit

npm i https://pkg.pr.new/middleapi/orpc/@orpc/ratelimit@1770

@orpc/server

npm i https://pkg.pr.new/middleapi/orpc/@orpc/server@1770

@orpc/shared

npm i https://pkg.pr.new/middleapi/orpc/@orpc/shared@1770

@orpc/swr

npm i https://pkg.pr.new/middleapi/orpc/@orpc/swr@1770

@orpc/tanstack-query

npm i https://pkg.pr.new/middleapi/orpc/@orpc/tanstack-query@1770

@orpc/trpc

npm i https://pkg.pr.new/middleapi/orpc/@orpc/trpc@1770

@orpc/valibot

npm i https://pkg.pr.new/middleapi/orpc/@orpc/valibot@1770

@orpc/zod

npm i https://pkg.pr.new/middleapi/orpc/@orpc/zod@1770

commit: a1d5e65

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 10.18%

❌ 1 regressed benchmark
✅ 24 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
octet stream 819.6 µs 912.4 µs -10.18%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing dinwwwh:claude/sync-packages-jsdocs-content-fc60d9 (a1d5e65) with main (28ca4d1)

Open in CodSpeed

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes: ~124 source files across all 30+ packages received JSDoc with @see backlinks, alongside a TypeScript-compiler-API-based verification script in CI, docs fixes in 4 pages, and a CONTRIBUTING.md convention section.

  • JSDoc sweep — every docs-mentioned symbol now carries a 1-3 sentence summary, optional @remarks block, and a pipe-form @see {@link https://orpc.dev/docs/... | Title} tag. Legacy @info/@warning tags are converted repo-wide to @remarks with **Note**:/**Warning**:, stale anchors are fixed, and broken @example fences are closed. Even third-party re-exports (getEventMeta, withEventMeta, HibernationAsyncIteratorClass) are documented on their re-export specifiers.
  • Verification script (scripts/verify-docs-jsdoc.ts) — extracts imports from docs code fences, resolves declarations through the TS compiler API (including export * from chains and aliases), and enforces that every mentioned symbol has JSDoc with a valid orpc.dev backlink whose page exists and whose optional anchor matches a real heading. Reports warnings when the linked page never mentions the symbol (--strict promotes to error). Passes cleanly: 0 errors, 0 warnings (also clean with --strict).
  • CI hookpnpm docs:check-jsdoc added to the lint_and_typecheck job.
  • Docs fixes caught by the script — 3 pages had incorrect imports (CORSPluginCORSHandlerPlugin, next hooks import path errors, publisher Redis variable reference), plus a copy-pasted ratelimit comment fixed.
  • CONTRIBUTING.md — replaces the old Structure section with a new "JSDoc & Documentation Links" section documenting the convention and template.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Link titles now come from the docs pages themselves: the page's first
heading for page-level links, and 'Page Title - Heading' for anchored
links. The verify script enforces this (new E6 check) and its heading
slugifier now matches VitePress' real algorithm (special characters
become dashes instead of being stripped), which also un-broke anchors
like #query-mutation-key.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — second commit (c6630aa) brings link-title accuracy and a tighter verification baseline:

  • Updated @see link titles to real page titles — ~150 JSDoc @see links across all packages now carry the page's actual first heading as their title, with Page Title - Heading format when the link targets an anchor. For example | AI SDK became | AI SDK Integration - Tool Implementer, and | Ratelimit became | Rate Limit Helpers - Adapters.
  • E6 enforcement in the verification script — the script now validates that @see link titles match the real page title (or Page Title - Heading for anchors), rejecting incorrect or missing titles. Page titles and heading text are extracted from the docs markdown source, and the slugify() function was tightened to match VitePress's @mdit-vue/shared slugification (control character stripping, smart-quote handling, leading-digit _ prefix).
  • CONTRIBUTING.md — JSDoc convention updated to document the title format rule.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

The verify script now scans every packages/*/src file for
https://orpc.dev/docs/... URLs anywhere in JSDoc or comments - inline
markdown links and member-level docs included, not just @see tags on
docs-mentioned symbols - and fails when the page or #anchor does not
exist in apps/content. Existence only; title enforcement stays on @see.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed changes — third commit (afbc47d) extends the verification script to validate orpc.dev links in package source files:

  • scanSourceLinks function — scans every https://orpc.dev/docs/... URL in package .ts/.tsx sources (JSDoc prose, inline markdown, member-level doc comments) and validates page existence and anchor correctness. Only checks existence — title validation (E6) is reserved for @see tags.
  • Issue type decoupled from Mentionmention: Mention replaced with group: string, label: string, and note?: string, so link-scan reports don't need a synthetic Mention object. All existing per-mention checks (E1–E6, W1, W2) and their output formatting are preserved identically.
  • Output formatting refactoredbySpecifierbyGroup, and the summary line now reads ... docs-mentioned symbols and N orpc.dev links.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

The source-link scan now validates every https://orpc.dev/... URL, not
just /docs/ ones: blog, learn-and-contribute, and the homepage resolve
against apps/content (index.md maps to the site root, nested index.md
to its directory path, trailing slashes ignored).

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — fourth commit (a1d5e65) extends the verification script to cover the entire content site, not just /docs/:

  • Generalized page collectioncollectDocs() now scans all markdown files in apps/content (homepage, blog, etc.) and keys the homepage as '' matching its root URL. Only docs/ pages contribute to @orpc/* import tracking.
  • Expanded link scanningscanSourceLinks() now validates every https://orpc.dev... URL in package sources (previously only /docs/...), with path normalization so root URLs resolve to the index page.
  • Directory skippingfindFiles() now ignores node_modules, .vitepress, public, and dist during file traversal.
  • CONTRIBUTING.md updated to document the expanded validation scope.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@dinwwwh
dinwwwh merged commit fec4b62 into middleapi:main Aug 3, 2026
11 of 12 checks passed
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