Skip to content

docs: ship version-matched API docs and llms.txt in the npm package - #20

Merged
bntvllnt merged 2 commits into
mainfrom
docs/ship-agent-docs
Nov 27, 2026
Merged

bntvllnt merged 2 commits into
mainfrom
docs/ship-agent-docs

Conversation

@bntvllnt

Copy link
Copy Markdown
Contributor

Ship version-matched Markdown docs inside the npm tarball, so coding agents read node_modules/@vllnt/logger/ instead of guessing from memory. The pattern is ported from vllnt/convex-buckets and adapted to this package, which is not a Convex component.

What changes

  • New docs/API.md: every public export of the 4 entry points, with signature, behaviour and one example each. It was checked against src/ and the built tarball.
  • package.json files: now dist, src, docs/API.md, CHANGELOG.md and llms.txt. src/ ships because it is about 440 readable lines with TSDoc, and the tests live in tests/. The PR also sets homepage to https://oss.vllnt.com/packages/logger and adds 8 keywords.
  • llms.txt (maintained by hand, no generator):
    • links to shipped files are relative (./docs/API.md, ./README.md, ./CHANGELOG.md, ./LICENSE)
    • files that do not ship use GitHub URLs
    • new "For coding agents" note and one "Ecosystem" line linking https://oss.vllnt.com/llms.txt
  • README: a "For coding agents" note, a link to the API reference, "Related packages" and a "Part of vllnt oss" footer.
  • Related packages: only @vllnt/analytics and @vllnt/convex-events, each with when to use it instead. No published @vllnt package depends on @vllnt/logger today. @vllnt/convex-helpers only lists a planned tracing subpath that would use it, so it is left out.
  • CHANGELOG.md: an "Added" entry under [0.1.3] - Unreleased. The version is unchanged.
  • publish.yml: path filters now include docs/**, README.md, CHANGELOG.md, llms.txt and LICENSE, so a docs-only change still publishes a canary. This is the only workflow change.
  • CANARY_ENABLED gate: git grep -i canary_enabled finds nothing, so the gate check is not applicable and nothing changed.
  • AGENTS.md and CONTRIBUTING.md: small updates so the contributor instructions match the new shipped files. Neither file ships.
  • New tests/package.test.ts (runs in pnpm test, so it runs in CI). It fails when:
    • a required file is missing from the npm pack list
    • a contributor, test or internal file ships
    • a relative link in llms.txt or README does not resolve inside the tarball
    • an entry point's exports do not match its docs/API.md section, either missing or stale

Verification

  • pnpm lint, check-types, build and test pass (65 tests). scripts/check-package-contents.sh and scripts/privacy-denylist.sh are clean.
  • Red/green: the package test with main's package.json (files: ["dist"]) fails 10 of 19. Each of these also fails it on its own:
    • deleting an export's section
    • adding a stale heading
    • breaking a README link
    • pointing an llms.txt link at an unshipped file
  • Without dist/, which is publish.yml's test-before-build order: 18 pass and 1 is skipped (the exports-target check), so the canary quality job cannot break. check-package-contents.sh still runs after the build there.
  • Tarball (pnpm pack, 22 files): CHANGELOG.md, LICENSE, README.md, dist/*, docs/API.md, llms.txt, package.json and src/*.ts. No AGENTS.md, tests, specs or scripts.
  • Temp consumer install: I installed the packed tarball in a temp project. node_modules/@vllnt/logger/{docs/API.md,llms.txt,CHANGELOG.md,src/} are present, every relative llms.txt link resolves, all 4 entry points import, and the documented behaviours checked out at runtime.

Independent review (Claude Opus 5.5, effort high, review-only subagents)

  • (a) Docs accuracy vs exports and tarball: CHANGES NEEDED on the first pass.
    • The docs were accurate.
    • The findings were test gaps: the API.md check could match the entry-point table, and README links were not checked.
    • It also asked for a posthog-node note, a note on placeholders and a fuller changelog.
    • All of these were fixed in test: check API.md per entry point and README links.
    • Not changed: the dist-only check is skipped in publish.yml's pre-build test, because fixing that needs a workflow change that is out of scope.
  • (b) Scope, simplicity, privacy, "Do not" list: CLEAN.
    • The only finding acted on: drop the unverified "in the browser" claim about @vllnt/analytics. Done.
  • Fresh re-review of the fix commit: CLEAN.
    • The reviewer confirmed each fix by mutation.
    • Optional nits not taken: client and distinctId are not in the placeholder list; the entry-point table is not tested; README links with an #anchor would fail the link test.

Add docs/API.md covering every public export, ship it with llms.txt,
CHANGELOG.md and src/ so agents read node_modules/@vllnt/logger/ instead
of guessing. llms.txt links shipped files relatively and adds an
Ecosystem line. README gains a coding-agents note, Related packages and
the vllnt oss footer. package.json sets homepage and keywords.

tests/package.test.ts fails when a required file is missing from the
npm pack list, an internal file ships, an llms.txt relative link does
not resolve, or an export is missing from docs/API.md. publish.yml path
filters include the shipped docs so docs-only changes reach canary.
Require each export to have its own heading or type line in its
entry-point section of docs/API.md, and fail on documented names that
are no longer exported. Check README relative links as well as llms.txt.
Document the posthog-node capture wrapper and example placeholders, and
complete the changelog entry.
@bntvllnt
bntvllnt merged commit 4a30380 into main Nov 27, 2026
8 checks passed
@bntvllnt
bntvllnt deleted the docs/ship-agent-docs branch November 27, 2026 00:44
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