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/docusaurus

v1.1.1

Published

Publish a generated CLI reference in Docusaurus from an OpenCLI document

Readme

@clidoc/docusaurus

npm version npm downloads CI Coverage Documentation Discord

Add an always-current CLI reference to your Docusaurus site. Generate pages and sidebar entries from your CLI's OpenCLI document instead of maintaining them by hand. The output is ordinary Markdown with CommonMark front matter, so CLI descriptions remain plain Markdown even when they contain JSX-like text.

Install the publisher alongside Docusaurus and its classic preset:

npm install @clidoc/docusaurus @docusaurus/core @docusaurus/preset-classic react react-dom

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 docusaurus.config.js:

const clidocPlugin = require('@clidoc/docusaurus');

module.exports = {
  title: 'My CLI',
  url: 'https://example.com',
  baseUrl: '/',
  markdown: { format: 'md' },
  presets: [['classic', { docs: { routeBasePath: '/', sidebarPath: './sidebars.js' }, blog: false }]],
  plugins: [
    [
      clidocPlugin,
      {
        input: 'cli.ocs.yaml',
        outputDir: 'docs/generated-cli',
        basePath: '/cli',
      },
    ],
  ],
};

In sidebars.js:

module.exports = { docs: [{ type: 'autogenerated', dirName: '.' }] };

Keep your handwritten pages in docs/ (for example, docs/index.md). The generated CLI pages appear beneath docs/generated-cli/ and are included by the autogenerated sidebar.

Run npx docusaurus start to preview the site.

Docusaurus 3 loads site configuration with CommonJS. The package includes a small CommonJS entrypoint that imports the ESM generator when the plugin runs. docusaurus.config.js itself is loaded through jiti, which does not support a top-level await; load the OpenCLI document from a file path via input instead of awaiting a parse at the top of the config.

Set input to a parsed OpenCLI document or a JSON/YAML path relative to the site directory. The plugin writes files during initialization, before the docs plugin scans content, so the docs plugin's autogenerated sidebar discovers the pages. title is used as each page's sidebar label. The plugin path relies on that autogenerated sidebar and does not return one of its own; for a hand-built sidebar array, call writeDocusaurus() directly from sidebars.js instead of using the plugin.

writeDocusaurus(document, {outputDir, basePath}) offers direct generation for build scripts. Generated files have readable names based on the executable and command, such as mycli.md for the landing page and mycli-validate.md for a command page. Names that contain unsafe characters, exceed the length limit, or would otherwise collide retain a readable prefix and add a deterministic digest. Page IDs and routes are defined separately in front matter and do not change with the filenames.

Regeneration removes files listed in .clidoc-generated.json. Generation stops instead of overwriting a matching filename that is not owned by that manifest. On the first run after upgrading from OpenCLI, it also removes old generated pages listed in .opencli-generated.json and deletes that legacy manifest. Other documents in the directory are preserved. Landing-page links to command pages point at the generated filenames directly, so routes resolve correctly regardless of the docs plugin's routeBasePath.

Add docs/generated-cli/ to .gitignore if generated pages should stay out of version control.

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 Docusaurus 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.