doc changes

This commit is contained in:
2026-01-21 18:53:57 +05:30
parent bd294bea30
commit 05dbd67f36
13 changed files with 242 additions and 122 deletions

View File

@@ -43,6 +43,23 @@ def build(
) -> None:
"""
Build documentation (MkDocs site or MCP resources).
This command orchestrates the full build process:
1. Introspects the code (Griffe)
2. Renders sources (MkDocs Markdown or MCP JSON)
3. (MkDocs only) Generates config and runs the final site build.
Args:
mcp: Use the MCP documentation builder.
mkdocs: Use the MkDocs documentation builder.
module: The dotted path of the module to document.
project_name: Optional override for the project name.
site_name: (MkDocs) The site display name. Defaults to module name.
docs_dir: (MkDocs) Target directory for Markdown sources.
nav_file: (MkDocs) Path to the docforge.nav.yml specification.
template: (MkDocs) Optional custom mkdocs.yml template.
mkdocs_yml: (MkDocs) Target path for the generated mkdocs.yml.
out_dir: (MCP) Target directory for MCP JSON resources.
"""
if not mcp and not mkdocs:
raise click.UsageError("Must specify either --mcp or --mkdocs")
@@ -84,7 +101,13 @@ def serve(
out_dir: Path,
) -> None:
"""
Serve documentation.
Serve documentation (MkDocs or MCP).
Args:
mcp: Serve MCP resources via an MCP server.
mkdocs: Serve the MkDocs site using the built-in development server.
mkdocs_yml: (MkDocs) Path to the mkdocs.yml configuration.
out_dir: (MCP) Path to the mcp_docs/ directory.
"""
if mcp and mkdocs:
raise click.UsageError("Cannot specify both --mcp and --mkdocs")
@@ -113,7 +136,11 @@ def tree(
project_name: Optional[str],
) -> None:
"""
Visualize the project structure.
Visualize the project structure in the terminal.
Args:
modules: List of module import paths to recursively introspect.
project_name: Optional override for the project name shown at the root.
"""
loader = GriffeLoader()
project = loader.load_project(list(modules), project_name)
@@ -129,6 +156,10 @@ def tree(
def _print_object(obj, indent: str) -> None:
"""
Recursive helper to print doc objects and their members to the console.
Args:
obj: The DocObject instance to print.
indent: Current line indentation (e.g., '').
"""
click.echo(f"{indent}├── {obj.name}")
for member in obj.get_all_members():