Add docs command to generate Markdown documentation#1
Merged
Conversation
Agents can call `kuleuven docs` once to get Markdown documentation for every command and subcommand instead of walking `--help` group by group. The Markdown is produced by Typer's own get_docs_for_click generator, so it shares the --help rendering path and never drifts from the real CLI. Output stays a single JSON object: the Markdown is returned under `docs`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016EMDepiyjwBrKj1SP6Nux1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new top-level
docscommand that generates complete Markdown documentation for the entire command tree in a single call, enabling agents to read the full CLI surface without walking--helpgroup by group.Changes
docscommand (src/kuleuven/cli/docs.py): Uses Typer's built-inget_docs_for_clickto recursively render all commands, subcommands, arguments, options, and environment variable bindings as Markdown. Requires no session and makes no network calls.src/kuleuven/cli/__init__.py): Registers thedocscommand at the top level of the app.README.md): Added a new "Docs" section describing the command, its output format, and usage examples.tests/test_cli.py): Added two test cases verifying that the command emits valid Markdown with the correct structure and that help text, environment variable bindings, and positional arguments are preserved.Implementation details
The
docscommand leverages Typer's own recursive Markdown generator (the same one behindtyper utils docs), ensuring the output never drifts from the real CLI. It renders through the same code path as--help, so all help text, arguments, and options are guaranteed to be accurate. A throwaway Click context is created to satisfy the generator's requirements; the session callback never runs because no actual command is executed.The output is a single JSON object with
status: "ok",format: "markdown", and adocskey containing the stripped Markdown string, consistent with the CLI's output contract.https://claude.ai/code/session_016EMDepiyjwBrKj1SP6Nux1