Skip to content

Enrich public-api.json with per-symbol usage notes and gotchas (follow-up to #27) #103

Description

@mkotulac-markot

Problem

#27 shipped packages/core/dist/public-api.json as a drift-guard manifest — a names-only list of exports. GPT's alpha.7 feedback asks for a machine-readable API export that also includes short usage notes and gotchas per symbol, which is a distinct artefact: something an LLM-facing tool (or a pre-commit agent for AI-generated code) can consume to check not just "does bindPath exist" but "what's its shape and what are its common misuse patterns". This is the infrastructure version of the LLM reference card.

Evidence

  • GPT (under "What would most improve AI-assisted development"): "A machine-readable API export that also includes short usage notes and gotchas per symbol."

Claude did not raise this as a friction point. Single-reviewer, infrastructure work, clear deliverable → P3 polish.

Options

A — Enrich the existing public-api.json

Extend each export from a bare string to an object: { name, kind, signature, summary, gotchas[], since, seeAlso[] }. Populate from a source-of-truth table (probably a new packages/core/src/api-metadata.ts that the LLM reference is already generated from).

  • Pros: single manifest, stable URL, both the drift-guard and LLM-consumption use cases share the same file. The LLM reference card can itself be regenerated from it.
  • Cons: api-metadata.ts becomes a bigger surface to keep in sync than the current names-only list. Every new export now needs a metadata entry, not just an index addition.

B — Ship a second file public-api-annotated.json

Keep public-api.json as names-only (for drift-guard), add a richer sibling.

  • Pros: zero risk to existing drift-guard tooling.
  • Cons: two sources of truth for the export list. If they drift (one updated, the other missed), the value of the annotated one collapses.

C — Don't ship the artefact; expand the LLM reference card

The LLM reference card at docs/reference/for-llms.md on whisq.dev already contains much of what GPT is asking for, just in markdown form. Teach tools to consume that file instead.

  • Pros: nothing new to build.
  • Cons: markdown is hard to parse reliably; every consumer has to re-parse. The whole point of a machine-readable artefact is to skip that.

Recommendation

A, but gated behind two release cycles of real-world usage. The LLM reference is currently hand-curated (#79's output); before wiring generator tooling the team should be confident the reference's shape is stable. Meanwhile, spec the JSON schema of the enriched manifest so consumers can build against it, and close with a concrete consumer need (e.g., a pre-commit check or the MCP server at packages/mcp-server/) rather than speculatively shipping a manifest with no consumer.

Acceptance criteria

  • Written JSON-schema-style spec for the enriched manifest shape, committed under packages/core/docs/api-metadata-schema.md.
  • At least one concrete consumer identified and linked in the spec (most likely: extend @whisq/mcp-server to serve per-symbol gotchas, since it already consumes the names-only manifest).
  • Generator: a script that reads api-metadata.ts + TSDoc from source and emits the enriched manifest during build.
  • CI check: enriched manifest must include every name from the existing names-only manifest (no drift between the two).
  • Changeset documents the new consumer contract.

Context

Source: dev/feedback/latest/FRAMEWORK_FEEDBACK_GPT_v0.1.0-alpha.7.md "What would most improve AI-assisted development" #3. Related: #27 (current names-only manifest), packages/mcp-server/ (likely consumer).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3-lowLow prioritycross-repoRequires coordinated work in the docs or sibling repo to land fullyenhancementNew feature or requesttoolingBuild tooling and DX

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions