updated doc strings
This commit is contained in:
@@ -4,14 +4,22 @@ from docforge.loaders import GriffeLoader, discover_module_paths
|
||||
from docforge.renderers import MCPRenderer
|
||||
from docforge.servers import MCPServer
|
||||
|
||||
|
||||
def generate_resources(module: str, project_name: str | None, out_dir: Path) -> None:
|
||||
"""
|
||||
Generate MCP-compatible documentation resources.
|
||||
Generate MCP documentation resources from a Python module.
|
||||
|
||||
The function performs project introspection, builds the internal
|
||||
documentation model, and renders MCP-compatible JSON resources
|
||||
to the specified output directory.
|
||||
|
||||
Args:
|
||||
module: The dotted path of the primary module to document.
|
||||
project_name: Optional override for the project name.
|
||||
out_dir: Directory where the MCP JSON resources and nav will be written.
|
||||
module: Python module import path used as the entry point for
|
||||
documentation generation.
|
||||
project_name: Optional override for the project name used in
|
||||
generated documentation metadata.
|
||||
out_dir: Directory where MCP resources (index.json, nav.json,
|
||||
and module data) will be written.
|
||||
"""
|
||||
loader = GriffeLoader()
|
||||
discovered_paths = discover_module_paths(module)
|
||||
@@ -20,13 +28,23 @@ def generate_resources(module: str, project_name: str | None, out_dir: Path) ->
|
||||
renderer = MCPRenderer()
|
||||
renderer.generate_sources(project, out_dir)
|
||||
|
||||
|
||||
def serve(module: str, mcp_root: Path) -> None:
|
||||
"""
|
||||
Serve MCP documentation from a pre-built bundle.
|
||||
Start an MCP server for a pre-generated documentation bundle.
|
||||
|
||||
The server exposes documentation resources such as project metadata,
|
||||
navigation structure, and module documentation through MCP endpoints.
|
||||
|
||||
Args:
|
||||
module: The dotted path of the primary module to serve.
|
||||
mcp_root: Path to the directory containing index.json, nav.json, and modules/.
|
||||
module: Python module import path used to identify the served
|
||||
documentation instance.
|
||||
mcp_root: Path to the directory containing the MCP documentation
|
||||
bundle (index.json, nav.json, and modules/).
|
||||
|
||||
Raises:
|
||||
click.ClickException: If the MCP documentation bundle is missing
|
||||
required files or directories.
|
||||
"""
|
||||
if not mcp_root.exists():
|
||||
raise click.ClickException(f"mcp_docs directory not found: {mcp_root}")
|
||||
|
||||
Reference in New Issue
Block a user