CliDoc Brings TSDoc-Style Documentation to CLIs Ben Houston released CliDoc, a Node tool that reads existing CLI command definitions from Yargs, Commander, or oclif and generates an OpenCLI JSON/YAML description, Markdown reference pages for Docusaurus and VitePress, and a `docgen` command that exposes the same description to AI agents. CliDoc implements the OpenCLI specification for Node and is already used by Houston's five command-line tools, including mtlx, node-prewarm, HDRify, git-dedup, and webgpu-bench. CliDoc Brings TSDoc-Style Documentation to CLIs CliDoc generates an OpenCLI description of your CLI from the command definitions you already wrote, then publishes reference docs to Docusaurus and VitePress, and gives AI agents the same description through a docgen command. Ben Houston https://ben3d.ca/about • • 7 min read I build a lot of command-line tools: mtlx https://github.com/bhouston/mtlx , node-prewarm https://github.com/bhouston/node-prewarm , HDRify https://github.com/bhouston/hdrify , git-dedup https://ben3d.ca/blog/git-dedup-faster-smaller-checkouts , and webgpu-bench https://ben3d.ca/blog/introducing-webgpu-bench . Each one needs reference documentation, and writing it by hand is tedious work that repeats what the command definitions already say. So I wrote CliDoc https://clidoc.dev . It reads your CLI's command definitions, produces a structured description of the whole tool, and turns that into reference documentation. All five tools above now use it. TSDoc, but for CLIs tsdoc-but-for-clis Library code solved this years ago. With TSDoc or JSDoc, the comment next to a function becomes its reference page. Web APIs have the same thing in OpenAPI Swagger : you describe an endpoint once, in code, and get a machine-readable spec, a reference site, client generators, and validators. CLIs have pieces of this. oclif can generate a README from its commands, and there are man pages and --help . But each framework uses its own format, and --help is free-form text meant for a person at a terminal. There is no portable, framework-neutral description of a CLI that other tools can build on. The OpenCLI specification https://github.com/bcdxn/opencli provides one. It defines a JSON/YAML format for describing a CLI: commands, subcommands, arguments, flags, types, defaults, choices, examples, and exit codes. CliDoc implements OpenCLI for Node. How It Works how-it-works clidoc takes your CLI definitions, builds an OpenCLI document, renders that document as Markdown pages, and publishes those pages to your docs site. The framework packages read the commands you already wrote: | Package | Reads | |---|---| | @clidoc/yargs | Yargs command modules | | @clidoc/commander | Commander command trees | | @clidoc/oclif | oclif manifests | There is no second place to describe a command. Here is the validate command from CliDoc itself: js export const command = defineCommand { command: 'validate