draft v1 — feedback welcome

OpenAPI,
but for CLIs.

CLI Schema is a language-agnostic specification for machine-readable CLI descriptions — structured enough for AI agents, expressive enough for docs, precise enough for shell completions.

$ mytool __schema
{
  "name": "mytool",
  "version": "1.0.0",
  "commands": [
    {
      "name": "deploy",
      "description": "Deploy the app",
      "flags": [
        { "name": "env", "type": "string" }
      ]
    }
  ]
}
$

One schema.
Endless tooling.

Describe your CLI once in a structured, open format — then let every tool in the ecosystem consume it.


Simple by design.

Two ways to expose a schema. One consistent format to consume it.

01
Implement the meta-command

Add a __schema subcommand to your CLI that outputs a valid cli-schema JSON document. Discovery is instant.

02
Or ship a sidecar file

Place a mytool.cli-schema.json file next to your binary. No runtime changes required.

03
Tooling consumes it

Any tool that understands cli-schema can now generate docs, completions, type-safe wrappers, or agent interfaces — automatically.

gh.cli-schema.json — excerpt
{
  "name": "gh",
  "version": "2.40.0",
  "commands": [
    {
      "name": "pr",
      "description": "Manage pull requests",
      "commands": [
        {
          "name": "create",
          "flags": [
            {
              "name": "title",
              "short": "t",
              "type": "string",
              "required": true
            }
          ]
        }
      ]
    }
  ]
}

Built for the
whole ecosystem.

cli-schema is infrastructure. Build anything on top of it.


Start with the spec.

The specification is open, CC0 licensed, and ready for feedback.
Contributions and implementations welcome.