updated docs strings and added README.md
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
"""
|
||||
# Summary
|
||||
|
||||
Command definitions for the doc-forge CLI.
|
||||
|
||||
Provides the CLI structure using Click, including build, serve, and tree commands.
|
||||
"""
|
||||
|
||||
import click
|
||||
from pathlib import Path
|
||||
from typing import Sequence, Optional
|
||||
@@ -58,22 +66,42 @@ def build(
|
||||
- MCP structured documentation resources
|
||||
|
||||
Args:
|
||||
mcp: Enable MCP documentation generation.
|
||||
mkdocs: Enable MkDocs documentation generation.
|
||||
module_is_source: Treat the specified module directory as the
|
||||
project root.
|
||||
module: Python module import path to document.
|
||||
project_name: Optional override for the project name.
|
||||
site_name: Display name for the MkDocs site.
|
||||
docs_dir: Directory where Markdown documentation sources
|
||||
will be generated.
|
||||
nav_file: Path to the navigation specification file.
|
||||
template: Optional custom MkDocs configuration template.
|
||||
mkdocs_yml: Output path for the generated MkDocs configuration.
|
||||
out_dir: Output directory for generated MCP resources.
|
||||
mcp (bool):
|
||||
Enable MCP documentation generation.
|
||||
|
||||
mkdocs (bool):
|
||||
Enable MkDocs documentation generation.
|
||||
|
||||
module_is_source (bool):
|
||||
Treat the specified module directory as the project root.
|
||||
|
||||
module (Optional[str]):
|
||||
Python module import path to document.
|
||||
|
||||
project_name (Optional[str]):
|
||||
Optional override for the project name.
|
||||
|
||||
site_name (Optional[str]):
|
||||
Display name for the MkDocs site.
|
||||
|
||||
docs_dir (Path):
|
||||
Directory where Markdown documentation sources will be generated.
|
||||
|
||||
nav_file (Path):
|
||||
Path to the navigation specification file.
|
||||
|
||||
template (Optional[Path]):
|
||||
Optional custom MkDocs configuration template.
|
||||
|
||||
mkdocs_yml (Path):
|
||||
Output path for the generated MkDocs configuration.
|
||||
|
||||
out_dir (Path):
|
||||
Output directory for generated MCP resources.
|
||||
|
||||
Raises:
|
||||
click.UsageError: If required options are missing or conflicting.
|
||||
click.UsageError:
|
||||
If required options are missing or conflicting.
|
||||
"""
|
||||
if not mcp and not mkdocs:
|
||||
raise click.UsageError("Must specify either --mcp or --mkdocs")
|
||||
@@ -130,14 +158,24 @@ def serve(
|
||||
- An MCP server exposing structured documentation resources
|
||||
|
||||
Args:
|
||||
mcp: Serve documentation using the MCP server.
|
||||
mkdocs: Serve the MkDocs development site.
|
||||
module: Python module import path to serve via MCP.
|
||||
mkdocs_yml: Path to the MkDocs configuration file.
|
||||
out_dir: Root directory containing MCP documentation resources.
|
||||
mcp (bool):
|
||||
Serve documentation using the MCP server.
|
||||
|
||||
mkdocs (bool):
|
||||
Serve the MkDocs development site.
|
||||
|
||||
module (Optional[str]):
|
||||
Python module import path to serve via MCP.
|
||||
|
||||
mkdocs_yml (Path):
|
||||
Path to the MkDocs configuration file.
|
||||
|
||||
out_dir (Path):
|
||||
Root directory containing MCP documentation resources.
|
||||
|
||||
Raises:
|
||||
click.UsageError: If invalid or conflicting options are provided.
|
||||
click.UsageError:
|
||||
If invalid or conflicting options are provided.
|
||||
"""
|
||||
if mcp and mkdocs:
|
||||
raise click.UsageError("Cannot specify both --mcp and --mkdocs")
|
||||
@@ -174,8 +212,11 @@ def tree(
|
||||
objects, including modules, classes, functions, and members.
|
||||
|
||||
Args:
|
||||
module: Python module import path to introspect.
|
||||
project_name: Optional name to display as the project root.
|
||||
module (str):
|
||||
Python module import path to introspect.
|
||||
|
||||
project_name (Optional[str]):
|
||||
Optional name to display as the project root.
|
||||
"""
|
||||
loader = GriffeLoader()
|
||||
project = loader.load_project([module], project_name)
|
||||
@@ -196,8 +237,11 @@ def _print_object(obj, indent: str) -> None:
|
||||
and prints each object with indentation to represent hierarchy.
|
||||
|
||||
Args:
|
||||
obj: Documentation object to print.
|
||||
indent: Current indentation prefix used for nested members.
|
||||
obj:
|
||||
Documentation object to print.
|
||||
|
||||
indent (str):
|
||||
Current indentation prefix used for nested members.
|
||||
"""
|
||||
click.echo(f"{indent}├── {obj.name}")
|
||||
for member in obj.get_all_members():
|
||||
|
||||
Reference in New Issue
Block a user