npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@clidoc/vitepress

v1.1.1

Published

Publish a generated CLI reference in VitePress from an OpenCLI document

Readme

@clidoc/vitepress

npm version npm downloads CI Coverage Documentation Discord

Add an always-current CLI reference to your VitePress site. Generate pages and sidebar entries from your CLI's OpenCLI document instead of maintaining them by hand.

Install the publisher, parser, and VitePress:

npm install -D @clidoc/vitepress @clidoc/core vitepress

Export an OpenCLI document from your CLI, for example with mycli docgen --format yaml --output cli.ocs.yaml, using the docgen command from @clidoc/yargs, @clidoc/commander or @clidoc/oclif.

In docs/.vitepress/config.mts, with cli.ocs.yaml at the project root:

import { defineConfig } from 'vitepress';
import { parse } from '@clidoc/core';
import { writeVitePress } from '@clidoc/vitepress';
import { readFile } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';

const document = parse(await readFile(new URL('../../cli.ocs.yaml', import.meta.url), 'utf8'));
const cliSidebar = await writeVitePress(document, {
  outputDir: fileURLToPath(new URL('..', import.meta.url)),
  basePath: '/cli',
});
export default defineConfig({
  themeConfig: { sidebar: [{ text: 'CLI', items: cliSidebar }] },
});

Keep handwritten pages in docs/. With basePath: '/cli', add only the generated paths to .gitignore:

docs/cli.md
docs/cli/commands/
docs/.clidoc-generated.json

Run npx vitepress dev docs to preview the site.

The output contains ordinary Markdown. VitePress's v-pre custom container keeps CLI-authored Vue expressions literal while still rendering headings, links, tables, and fenced code. basePath determines both routes and file locations below outputDir. Regeneration removes only files recorded in .clidoc-generated.json, leaving hand-written pages intact. On the first run after upgrading from OpenCLI, it also removes stale pages listed in .opencli-generated.json and deletes that legacy manifest.

< and > outside fenced code blocks and inline code spans are escaped to entities, since v-pre stops Vue mustache interpolation but not its SFC parser's tag scanning; as a result, HTML written in a description renders as literal text rather than as markup on VitePress.

Command pages use the synopsis generated by @clidoc/core. Required values use <value>, optional elements use [element], and repeatable elements use .... The synopsis includes visible command flags and inherited global flags, and its angle-bracket placeholders remain literal inside the fenced code block.

Generated command page filenames and sidebar links are stable and based on the shared command routes. An ordinary binary-prefixed command such as mycli deploy produces cli/commands/deploy.md and links to /cli/commands/deploy when basePath is /cli. Names outside the readable route form use a normalized prefix plus a deterministic hash suffix. This keeps their URLs stable when unrelated commands are added while avoiding collisions.

Why / compared to alternatives

  • Hand-written CLI reference pages go stale. These pages are regenerated from your CLI's own definitions (via a framework package), and your hand-written pages stay alongside them.
  • Pasting --help output gives one unstructured block per command. Here each command gets its own page, usage synopsis, argument and flag tables, and a sidebar entry.
  • oclif readme updates a README for oclif projects only. This publishes into a VitePress site from any CLI that can produce an OpenCLI document (Yargs, Commander, oclif).

Related packages

License

MIT. See LICENSE.

Author

Ben Houston, Sponsored by Land of Assets.