Skip to content

feat(docs): add docs_gen module for auto-generating option tables#159

Merged
basnijholt merged 26 commits intomainfrom
feat/docs-gen
Jan 3, 2026
Merged

feat(docs): add docs_gen module for auto-generating option tables#159
basnijholt merged 26 commits intomainfrom
feat/docs-gen

Conversation

@basnijholt
Copy link
Copy Markdown
Owner

@basnijholt basnijholt commented Jan 3, 2026

Summary

  • Add new agent_cli.docs_gen module that introspects Typer commands and generates Markdown documentation tables
  • Integrates with markdown-code-runner to keep documentation in sync with code automatically
  • Update docs/commands/transcribe.md as an example of the new auto-generation approach

Key Functions

Function Purpose
all_options_for_docs(cmd) Main function - generates complete options tables grouped by panel
options_table(cmd, panel) Generate table for a specific command/panel
options_by_panel(cmd) Generate all options grouped by rich_help_panel
list_commands() List all available commands (e.g., ["transcribe", "memory.proxy"])
env_vars_table() Generate table of all environment variables
provider_matrix() Generate local vs cloud provider comparison
config_example(cmd) Generate example TOML config for a command

Usage in docs

## Options

<!-- CODE:START -->
<!-- from agent_cli.docs_gen import all_options_for_docs -->
<!-- print(all_options_for_docs("transcribe")) -->
<!-- CODE:END -->
<!-- OUTPUT:START -->
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
### Provider Selection

| Option | Default | Description |
|--------|---------|-------------|
| `--asr-provider` | `wyoming` | The ASR provider to use... |
...
<!-- OUTPUT:END -->

Benefits

  • Single source of truth: opts.py → docs auto-generated
  • No drift: Change option in code, run markdown-code-runner, docs update
  • CI integration: Can add markdown-code-runner --check to fail if docs are stale
  • Structured output: Clean Markdown tables instead of raw --help text

Test plan

  • Verify docs_gen.py passes linting (ruff check, ruff format, mypy)
  • Test all key functions work correctly
  • Verify markdown-code-runner successfully processes the updated transcribe.md
  • Review generated tables match expected format

basnijholt and others added 26 commits January 3, 2026 00:25
Add a new `agent_cli.docs_gen` module that introspects Typer commands
and generates Markdown documentation tables. This integrates with
markdown-code-runner to keep documentation in sync with code.

Key functions:
- `all_options_for_docs(cmd)`: Generate complete options tables grouped by panel
- `options_table(cmd, panel)`: Generate table for specific command/panel
- `env_vars_table()`: Generate environment variables documentation
- `provider_matrix()`: Generate provider comparison table
- `config_example(cmd)`: Generate example TOML configuration

Benefits:
- Single source of truth: opts.py definitions auto-generate docs
- No drift between CLI help and documentation
- CI-friendly: can validate docs match code

Also updates docs/commands/transcribe.md as an example of the new
auto-generation approach using markdown-code-runner hidden code blocks.
Simplify verbose panel names:
- "ASR (Audio) Configuration" → "Audio Input"
- "TTS (Text-to-Speech) Configuration" → "Audio Output"
- "LLM Configuration: Ollama (local)" → "LLM: Ollama"
- "Process Management Options" → "Process Management"
- "Wake Word Options" → "Wake Word"

Also group --extra-instructions with --llm under "LLM Configuration"
panel for better logical organization.

Regenerate docs/commands/transcribe.md with cleaner section headers.
- Rename internal functions to private: get_command_options, options_table,
  options_by_panel, list_commands → _prefixed versions
- Add comprehensive test suite with 36 tests covering all public and
  private functions
Replace hand-written options tables with markdown-code-runner
auto-generation using docs_gen.all_options_for_docs().
Replace hand-written options tables with markdown-code-runner
auto-generation using docs_gen.all_options_for_docs().
Replace hand-written options tables with markdown-code-runner
auto-generation using docs_gen.all_options_for_docs().
Replace hand-written options tables with markdown-code-runner
auto-generation using docs_gen.all_options_for_docs().
Replace hand-written options tables with markdown-code-runner
auto-generation using all_options_for_docs() function.
Replace hand-written options tables with markdown-code-runner
auto-generation using all_options_for_docs() function.
Replace hand-written options tables with markdown-code-runner
auto-generation using all_options_for_docs() function for both
memory.proxy and memory.add subcommands.
Replace hand-written options tables with markdown-code-runner
auto-generation using all_options_for_docs() function.
Replace hand-written options tables with markdown-code-runner
auto-generation using all_options_for_docs() function.
Replace hand-written options tables with markdown-code-runner
auto-generation using all_options_for_docs() function.
Finds all markdown files with CODE:START markers and runs
markdown-code-runner on them.
Renamed update-readme.yml to update-docs.yml and now runs the
update_docs.py script which updates all files with CODE:START markers.
- Regenerate README.md CLI output with OpenAI-compatible panel names
- Update update_docs.py to also detect CODE:BASH:START markers
@basnijholt basnijholt merged commit 6e0548b into main Jan 3, 2026
1 check passed
@basnijholt basnijholt deleted the feat/docs-gen branch January 3, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant