Skip to content

CLI Reference

docsgen is a single-shot CLI: it parses headers and writes MDX, then exits.

Terminal window
docsgen [-i <dir>] [-o <dir>] [-c <file>] [--hide-nested]
[--base-url <url>] [--llms-txt] [--llms-txt-output <dir>]
docsgen --version
docsgen --help
FlagArgumentDescription
-i, --inputpathInput directory of C++ headers. Required unless input: is set in config.
-o, --outputpathOutput directory for MDX. Required unless output: is set in config.
-c, --configpathExplicit config file (otherwise discovered).
--hide-nested—Hide non-top-level entities from the sidebar.
--base-urlurlPrefix for cross-links (trailing / stripped).
--llms-txt—Also emit llms.txt.
--llms-txt-outputpathDirectory for llms.txt (default: same as --output).
--version—Print <channel>/docsgen@<version> and exit.
--help—Print the option list and exit.
  • A CLI flag always overrides the corresponding config value.
  • --input / --output fall back to input: / output: in config; one of each (flag or config) is required.
  • --base-url defaults to /; if left at the default, api_base_url from config is used.
  • --llms-txt is also enabled by llms_txt.enabled: true.

See the Config Schema for discovery and path-resolution rules.

The shared --verbose flag (from the common CLI base) prints input/output paths, the resolved config name/version, the indexed symbol count, and each generated file.

CodeMeaning
0Success.
1Usage error — missing/invalid input or output, or a bad flag.
2Pipeline failure (parse error) or file-write failure.

The non-zero codes make a bare docsgen safe to gate a CI pipeline on.

Terminal window
# Explicit dirs
docsgen -i ./include -o ./docs
# Config-driven (config.docsgen.yaml discovered)
docsgen
# Into an Astro site, with link prefix and agent bundle
docsgen -o ./src/content/docs/api --base-url /api --llms-txt --llms-txt-output ./public
# Check the installed version
docsgen --version

docsgen overwrites the output directory in place and never modifies input files. Point --output at a directory you own.