Some checks failed
continuous-integration/drone/tag Build is failing
110 lines
2.1 KiB
Python
110 lines
2.1 KiB
Python
from typing import Sequence
|
|
from pathlib import Path
|
|
|
|
import click
|
|
|
|
|
|
@click.group()
|
|
def cli() -> None:
|
|
"""doc-forge command-line interface."""
|
|
|
|
|
|
@cli.command()
|
|
@click.option(
|
|
"--modules",
|
|
multiple=True,
|
|
help="Python module import paths to introspect",
|
|
)
|
|
@click.option(
|
|
"--project-name",
|
|
help="Project name (defaults to first module)",
|
|
)
|
|
def tree(
|
|
modules: Sequence[str],
|
|
project_name: str | None,
|
|
) -> None:
|
|
"""Show introspection tree."""
|
|
|
|
|
|
@cli.command()
|
|
@click.option(
|
|
"--module",
|
|
help="Python module import paths to document",
|
|
)
|
|
@click.option(
|
|
"--project-name",
|
|
help="Project name (defaults to first module)",
|
|
)
|
|
@click.option(
|
|
"--docs-dir",
|
|
type=click.Path(path_type=Path),
|
|
default=Path("docs"),
|
|
)
|
|
def generate(
|
|
module: str,
|
|
project_name: str | None,
|
|
docs_dir: Path,
|
|
) -> None:
|
|
"""Generate documentation source files using MkDocs renderer."""
|
|
|
|
@cli.command(name="generate-mcp")
|
|
@click.option(
|
|
"--module",
|
|
required=True,
|
|
help="Python module import path to document",
|
|
)
|
|
@click.option(
|
|
"--project-name",
|
|
help="Project name (defaults to first module)",
|
|
)
|
|
@click.option(
|
|
"--out-dir",
|
|
type=click.Path(path_type=Path),
|
|
default=Path("mcp_docs"),
|
|
)
|
|
def generate_mcp(
|
|
module: str,
|
|
project_name: str | None,
|
|
out_dir: Path,
|
|
) -> None:
|
|
"""
|
|
Generate MCP-compatible documentation resources for the specified module.
|
|
|
|
Args:
|
|
module: The primary module path to document.
|
|
project_name: Optional project name override.
|
|
out_dir: Directory where MCP resources will be written.
|
|
"""
|
|
|
|
@cli.command()
|
|
@click.option(
|
|
"--mkdocs-yml",
|
|
type=click.Path(path_type=Path),
|
|
default=Path("mkdocs.yml"),
|
|
)
|
|
def build(
|
|
mkdocs_yml: Path,
|
|
) -> None:
|
|
"""Build documentation using MkDocs."""
|
|
|
|
|
|
@cli.command()
|
|
@click.option(
|
|
"--mkdocs-yml",
|
|
type=click.Path(path_type=Path),
|
|
default=Path("mkdocs.yml"),
|
|
)
|
|
def serve(
|
|
mkdocs_yml: Path,
|
|
) -> None:
|
|
"""Serve documentation using MkDocs."""
|
|
|
|
|
|
@cli.command(name="serve-mcp")
|
|
def serve_mcp() -> None:
|
|
"""Serve MCP documentation."""
|
|
|
|
|
|
def main() -> None:
|
|
"""CLI entry point."""
|