@openpkg-ts/cli
v0.11.3
Published
CLI for OpenPkg - extract TypeScript API specs and generate docs
Maintainers
Readme
@openpkg-ts/cli
Extract OpenPkg documents and generate docs from the command line. The CLI of openpkg-ts, the TypeScript reference implementation of the OpenPkg standard. Thin wrapper over @openpkg-ts/sdk.
Usage
# Extract an OpenPkg spec
bunx @openpkg-ts/cli spec src/index.ts -o openpkg.json
# Generate markdown docs (from source or an existing spec)
bunx @openpkg-ts/cli docs src/index.ts -o docs/api.md
bunx @openpkg-ts/cli docs openpkg.json -f html -o docs/api.html
# List exports
bunx @openpkg-ts/cli list src/index.ts
# Diff two specs, get a semver recommendation
bunx @openpkg-ts/cli diff old.json new.jsonCommands
| Command | Description |
|---------|-------------|
| spec <entry.ts> | Extract an OpenPkg spec from a TypeScript entry point |
| docs <entry.ts \| spec.json> | Generate docs (-f md\|html\|json) |
| list <entry.ts> | List exports with kind and location (--json) |
| diff <old.json> <new.json> | Compare specs; exits 2 if breaking changes |
-o, --output writes to a file instead of stdout.
For programmatic use, richer options, and framework integrations (search indexes, nav trees), use @openpkg-ts/sdk directly.
Agent-assisted docs generation
The package ships an agent skill that scaffolds framework-ready API reference pages (Fumadocs, Docusaurus, or plain Markdown) — framework detection, page-per-export MDX with navigation, search indexes, and output verification. Copy it into your project's skills directory:
cp -r node_modules/@openpkg-ts/cli/skills/generate-docs .claude/skills/Then ask your agent to "generate API docs" (or run /generate-docs in Claude Code).
Versions ≤ 0.6.4 are broken (unresolvable dependency) and deprecated. Use 0.7.0+.
License
MIT
