- Add MCPRenderer to generate MCP-native JSON bundles (index.json, nav.json, modules/*.json) - Expose MCPRenderer via public API and CLI (`generate-mcp` command) - Replace Markdown-based MCP output with structured JSON resources - Update MCP renderer type stubs to match new JSON-based implementation - Refactor MCP tests to validate JSON content, bundle structure, and navigation - Fix MCP module coverage test to use explicit project_root for reliable discovery
24 lines
646 B
Python
24 lines
646 B
Python
from pathlib import Path
|
|
|
|
from docforge import MCPRenderer
|
|
from docforge.models import Project, Module
|
|
|
|
|
|
def test_mcp_directory_structure(tmp_path: Path):
|
|
project = Project("testpkg")
|
|
project.add_module(Module("testpkg"))
|
|
project.add_module(Module("testpkg.sub"))
|
|
|
|
out_dir = tmp_path / "mcp"
|
|
renderer = MCPRenderer()
|
|
|
|
renderer.generate_sources(project, out_dir)
|
|
|
|
# Bundle-level files
|
|
assert (out_dir / "index.json").exists()
|
|
assert (out_dir / "nav.json").exists()
|
|
|
|
# Module resources
|
|
assert (out_dir / "modules" / "testpkg.json").exists()
|
|
assert (out_dir / "modules" / "testpkg.sub.json").exists()
|