0026 — Document the public API on declarations and enforce it with lint
Status: accepted
Problem
The package surface — src/index.ts, src/sdk.ts, src/conformance/index.ts, and src/mcp.ts — exports 78
symbols, and 71 of them had no doc comment. The generated declarations, editors, and agents therefore had to
read an implementation to learn what a public symbol does. Nothing stopped a new public symbol from landing
without a description.
Decision
- Every symbol exported from the package entry points carries a doc comment on the declaration that defines it. An entry point that re-exports a symbol leaves the comment on the declaration.
- The comment states behavior and does not repeat the name.
- A local ESLint rule,
local/public-api-docs, reads the entry points frompackage.jsonexports, follows direct exports and re-exports, and fails a missing comment or one that only restates the name. - The rule covers the public surface only. Internal exports keep the existing review expectations.
The change is documentation only. It does not alter a signature, a published schema, CLI output, or an MCP tool shape.
Consequences
npm run checkruns the rule through the existing lint step.- Adding an entry point to
package.jsonexportsextends the check to its symbols without another rule. docs/CODE_STYLE.mdrecords the convention and its enforcement.