Skip to main content

Built upon the OpenCLI specification

CLI documentation from the source

Generate a CLI document from yargs, Commander.js, or oclif, then publish it with Docusaurus or VitePress.

Built for your CLI framework

Use built-in integrations for yargs, Commander.js, and oclif to generate an OpenCLI document from the command definitions you already maintain.

Explore the frameworks →
import { Command } from 'commander';
import { createDocgenCommand, fromCommander } from '@clidoc/commander';
import { infoFromPackageJson } from '@clidoc/core';

const info = infoFromPackageJson(pkg);
const program = new Command(info.binary);
// ...register your commands...

const document = () => fromCommander(program, info);
program.addCommand(createDocgenCommand(document));
program.parse();

Publish where your docs live

Publishing plugins generate command pages for Docusaurus and VitePress. You can also render Markdown for other documentation sites.

Explore publishing plugins →
// docusaurus.config.js
const clidocPlugin = require('@clidoc/docusaurus');

module.exports = {
  plugins: [[clidocPlugin, { input: 'cli.json', outputDir: 'docs/generated-cli', basePath: '/cli' }]],
};

Generate from your own CLI

Give your CLI a docgen command with a framework integration, then validate its OpenCLI document with clidoc.

Read the CLI guide →
$ npm install -g @clidoc/cli
$ mycli docgen --output cli.json
$ clidoc validate cli.json

An open specification

Meet the document behind your docs

OpenCLI describes your CLI’s commands, arguments, and flags in JSON or YAML. This is an excerpt from clidoc’s own generated OpenCLI document, including its validate command.

That shared format connects clidoc to a wider ecosystem of documentation, validation, and code generation tools.

clidoc.json · excerpt
{
"opencliVersion": "1.0.0-alpha.14",
"info": {
"title": "clidoc",
"binary": "clidoc",
"version": "1.1.2",
"summary": "Generate, validate, and publish CLI documentation through OpenCLI."
},
"commands": {
"clidoc validate": {
"summary": "Validate an OpenCLI JSON or YAML document",
"args": [
{
"name": "input",
"required": true,
"type": "string",
"summary": "OpenCLI document filename"
}
]
}
}
}

Describe

Turn real command definitions into an OpenCLI document with a framework integration.

Learn more →

Check

Validate a JSON or YAML document against the OpenCLI specification.

Learn more →

Publish

Generate command pages for Docusaurus, VitePress, or Markdown.

Learn more →