Skip to content

usage generate json-schema

Generate a JSON Schema for a CLI's config file from its usage spec

Built from the spec's config block: each prop becomes a property with its type, default, and help, so an editor can complete and validate the file the CLI reads. A spec whose settings cannot live in a file is an error rather than an empty schema.

Flags

  • -f --file <FILE> — A usage spec file, or a script with a usage shebang; "-" reads stdin

  • --out-file <OUT_FILE> — Write the schema here instead of to stdout

    Effect: modifies state

  • --spec <SPEC> — The spec itself, as a string, instead of a file

  • --title <TITLE> — The schema's title, shown by editors

  • --url <URL> — Where the schema is published, for its $id

  • -h --help — Print help

MIT LicenseCopyright © 2026jdx.dev