1
0
Fork 0
Code Issues Pull requests Projects Releases 2 Packages Wiki Activity Actions Pages

feat: add deterministic preview rendering

This commit is contained in:
Andraxion 2026-07-22 03:32:05 -04:00
parent 8c75f4f44d
commit 411f417670
23 changed files with 1413 additions and 142 deletions

View file

@ -1,4 +1,4 @@
"""Deterministic JSON command-line interface for DocForge project inspection."""
"""Deterministic JSON CLI for inspection and explicit derived-output integration."""
from __future__ import annotations
@ -11,6 +11,7 @@ from .context import compile_context
from .errors import DocForgeError
from .index import ProjectIndex
from .project import Project, project_root_fingerprint
from .rendering import RenderService
def _parser() -> argparse.ArgumentParser:
@ -43,6 +44,13 @@ def _parser() -> argparse.ArgumentParser:
context = commands.add_parser("context")
context.add_argument("profile")
context.add_argument("--budget", type=int)
render = commands.add_parser("render")
render.add_argument("view_id")
render_status = commands.add_parser("render-status")
render_status.add_argument("view_id", nargs="?")
preview = commands.add_parser("preview")
preview.add_argument("changeset_id")
preview.add_argument("view_id")
return parser
@ -100,6 +108,12 @@ def _run(arguments: argparse.Namespace) -> dict[str, object]:
return index.impact(arguments.node_id, depth=arguments.depth)
if arguments.command == "context":
return compile_context(index, arguments.profile, arguments.budget)
if arguments.command == "render":
return RenderService(project).render(arguments.view_id)
if arguments.command == "render-status":
return RenderService(project).status(arguments.view_id)
if arguments.command == "preview":
return RenderService(project).preview(arguments.changeset_id, arguments.view_id)
raise DocForgeError("invalid_command", "Unknown command")