Skip to content

docs: Document the entire public API with JSDoc - #961

Open
razor-x wants to merge 5 commits into
mainfrom
claude/public-api-docstrings-28gizu
Open

docs: Document the entire public API with JSDoc#961
razor-x wants to merge 5 commits into
mainfrom
claude/public-api-docstrings-28gizu

Conversation

@razor-x

@razor-x razor-x commented Aug 13, 2026

Copy link
Copy Markdown
Member

Documents every top-level export reachable from the package entrypoint and adds lint enforcement so coverage cannot regress.

Doc policy: a docstring is required on every exported class, function, and type — but not on class members or properties, and never where it would only restate the name or signature. Member docs exist only where they carry real information (e.g., requestId is what you give Seam support, SeamHttpRequest.execute vs fetchResponse semantics, waitForActionAttempt, polling option units).

Commits by concern:

  1. feat: Require JSDoc on the public API surface — Adds eslint-plugin-jsdoc with jsdoc/require-jsdoc scoped to the export closure of src/index.ts (explicit file list in eslint.config.ts). Internal modules (client.ts, parse-options.ts, api-error-types.ts, version.ts, request-parameters.ts) are excluded by file scope, so no @internal tags were needed. At this commit the rule flagged 86 handwritten and 1,149 generated undocumented exports, proving it works.

  2. docs: Document the handwritten public API — JSDoc for all handwritten public exports: every SeamHttpOptions* variant and type guard (including their throwing behavior), the error classes, SeamHttpRequest (its thenable/waitForActionAttempt behavior), SeamPaginator, the token predicates, and getOpenapiSchema.

  3. docs: Generate JSDoc for all public exports — Template-level docs for the generated route classes, static factory methods, sub-route getters (mapping property → API route), and a fallback description for resources with no blueprint description (DeviceProvider, SeamEvent).

  4. Merge origin/main — Template conflicts resolved by keeping both the docs and the new request parameter validation, then regenerating.

  5. docs: Remove docstrings that restate their signatures — Applies the doc policy above: drops the generated per-endpoint *Parameters/*Response/*Request/*Options and path-type docs and all tautological member docs (e.g., statusCode: 401), and relaxes the lint rule to top-level exports only. Generated route files additionally do not require docs on exported types, since those are self-describing.

⚠️ One small API addition to review: ResolveActionAttemptOptions, SucceededActionAttempt, and FailedActionAttempt are now re-exported from the entrypoint. They already appear in public type signatures (waitForActionAttempt and SeamActionAttemptFailedError) but were not exported, which left TypeDoc unable to link them. Happy to drop this if unwanted.

Verification: npm run lint, npm run typecheck, npm test (104 passed), and npm run docs:build (0 errors) all pass. npm run generate is idempotent against these templates.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XQyDWeGYQyCDEJ1rZ8J1iB

claude added 3 commits August 13, 2026 07:57
Add eslint-plugin-jsdoc scoped to the export closure of src/index.ts.
The jsdoc/require-jsdoc rule now flags every undocumented public export:
86 errors in handwritten modules and 1149 in generated code, to be
resolved in subsequent commits. Internal modules (client, parse-options,
api-error-types, version) are excluded by file scope rather than
@internal tags.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XQyDWeGYQyCDEJ1rZ8J1iB
Add JSDoc to every public export reachable from the package entrypoint:
options and their type guards, error classes and their properties,
SeamHttpRequest, SeamPaginator, token predicates, and getOpenapiSchema.

Also export ResolveActionAttemptOptions, SucceededActionAttempt, and
FailedActionAttempt, which already appear in public type signatures
(waitForActionAttempt and SeamActionAttemptFailedError) but were not
re-exported, leaving TypeDoc unable to link them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XQyDWeGYQyCDEJ1rZ8J1iB
Update the codegen templates to document every generated export:
route class declarations, the client and defaults properties, static
factory methods, sub-route getters, per-endpoint Parameters, Response,
Request, and Options types, and the endpoint path types. Add a fallback
description for resource types missing a description in the blueprint
(DeviceProvider and SeamEvent). Expose routePath in the route and
subroute layout contexts so templates can name the route they document.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XQyDWeGYQyCDEJ1rZ8J1iB
Resolve template conflicts by keeping both the JSDoc additions and the
new request parameter validation from main, then regenerate all
generated files with npm run generate.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XQyDWeGYQyCDEJ1rZ8J1iB
Require JSDoc only on top-level exports, not class members or
properties. Remove the generated docs on the endpoint Parameters,
Response, Request, Options, and path types, and drop handwritten and
template member docs that only repeat the member name or type, e.g.,
statusCode: 401. Member docs that carry real information remain, e.g.,
requestId, waitForActionAttempt, and the polling options.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XQyDWeGYQyCDEJ1rZ8J1iB
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