32 lines
904 B
Python
32 lines
904 B
Python
from pathlib import Path
|
|
from typing import Iterable
|
|
|
|
from docforge.models import Project, Module, DocObject
|
|
|
|
|
|
class MCPRenderer:
|
|
"""
|
|
Renderer that emits MCP-compatible documentation resources.
|
|
"""
|
|
|
|
name: str
|
|
|
|
def generate_sources(self, project: Project, out_dir: Path) -> None:
|
|
"""Generate MCP resources for the given project."""
|
|
|
|
def _write_module(self, module: Module, out_dir: Path) -> None:
|
|
"""Write a single module as an MCP resource."""
|
|
|
|
def _render_module(self, module: Module) -> str:
|
|
"""Render a module and its contents into a text document."""
|
|
|
|
def _render_object(
|
|
self,
|
|
obj: DocObject,
|
|
level: int,
|
|
) -> Iterable[str]:
|
|
"""Recursively render a documented object and its members."""
|
|
|
|
def _module_resource_path(self, module: Module) -> Path:
|
|
"""Compute the MCP resource path for a module."""
|