Skip to main content

click-llm

A tiny package that makes Click CLIs self-describing for LLMs.

click-llm adds an llm command to your CLI so models (and humans) can discover commands, options, arguments, and command structure.

The command supports one flag:

  • --json: output machine-readable catalog JSON
  • default output: concise text catalog

Install

pip install click-llm

After install, llm is auto-enabled for Click CLIs in that Python environment.

Usage

mycli llm
mycli llm --json

Example CLI

import click


@click.group(help="Acme operations CLI.")
def acme() -> None:
    pass


@acme.group(help="Deployment workflows.")
def deploy() -> None:
    pass


@deploy.command(help="Roll out a service release.")
@click.argument("service")
@click.option(
    "--env",
    type=click.Choice(["staging", "prod"]),
    default="staging",
    show_default=True,
)
@click.option("--dry-run", is_flag=True, help="Plan only; do not execute.")
def release(service: str, env: str, dry_run: bool) -> None:
    click.echo(f"release {service} to {env} (dry_run={dry_run})")


@acme.command(help="Show system health.")
@click.option("--json", "as_json", is_flag=True, help="Machine-readable health.")
def health(as_json: bool) -> None:
    click.echo("ok")


if __name__ == "__main__":
    acme()

Example output:

$ acme llm
catalog_version: 1
root_command: acme
commands: 4

### acme deploy release
summary: Roll out a service release.
usage: acme deploy release [OPTIONS] SERVICE
params:
- option `--env`, type=choice, required=False, default="staging"
- option `--dry-run`, type=boolean, required=False, default=false, is_flag=True
- argument `service`, type=text, required=True, nargs=1, default=null
$ acme llm --json

The JSON output includes the full command tree and a flattened commands list, which is useful for prompt context, tool routing, and command planning.

Explicit integration

If you prefer explicit wiring in the host CLI:

import click
from click_llm import attach

@click.group()
def cli():
    pass

attach(cli)

Notes

Auto mode uses a .pth startup hook plus a Click monkeypatch (click.Group.get_command and click.Group.list_commands).

Metadata

Release files for click-llm 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for click-llm 0.2
File Size Uploaded
click_llm-0.2.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for click-llm 0.2
File Interpreter ABI Platform
click_llm-0.2-py3-none-any.whl Python 3 none any Details

Total release size: 16.3 kB

Release files / click_llm-0.2.tar.gz

Download URL click_llm-0.2.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0842d9d528ef7ab30f7973b5559333317b592e3af61ead2eeea9bfc50f2aa2eb
BLAKE2b-256 checksum
How to use checksums
bc6bdff793e3b4c9bfac543fe1088877140851e8bfa46e273abbdac550c7b773
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.0

Release files / click_llm-0.2-py3-none-any.whl

Download URL click_llm-0.2-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e5f10798d4e3fa8b975b6000e01030bd9de48d8c50ec7b65a2679fc392b6013
BLAKE2b-256 checksum
How to use checksums
c8568e39512f8462db8485f5c95573371c8b836fcfa30ef8a40668ffe3e5fd0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.0

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page