acceptance matrix and workflow generation

This commit is contained in:
tegwick 2026-05-14 16:01:32 +02:00
parent 4026f34174
commit 55405d8a5a
11 changed files with 1051 additions and 14 deletions

View file

@ -6,6 +6,7 @@ from typing import Any
from markitect_tool import Heading, Section, parse_markdown_file
from markitect_tool.contract import check_markdown_file
from markitect_tool.template import render_template
from .errors import InfospaceError
from .lifecycle import load_infospace
@ -91,6 +92,27 @@ class ArtifactValidationResult:
}
@dataclass(frozen=True)
class RenderedMarkdownTemplate:
markdown: str
variables: list[str]
missing_variables: list[str]
strict: bool = True
@property
def complete(self) -> bool:
return not self.missing_variables
def to_dict(self) -> dict[str, Any]:
return {
"markdown": self.markdown,
"variables": self.variables,
"missing_variables": self.missing_variables,
"strict": self.strict,
"complete": self.complete,
}
def parse_markdown_artifact(path: str | Path) -> ParsedMarkdownArtifact:
artifact_path = Path(path)
document = parse_markdown_file(artifact_path)
@ -102,6 +124,21 @@ def parse_markdown_artifact(path: str | Path) -> ParsedMarkdownArtifact:
)
def render_markdown_template(
template_text: str,
data: dict[str, Any],
*,
strict: bool = True,
) -> RenderedMarkdownTemplate:
rendered = render_template(template_text, data, strict=strict)
return RenderedMarkdownTemplate(
markdown=rendered.markdown,
variables=rendered.variables,
missing_variables=rendered.missing_variables,
strict=rendered.strict,
)
def extract_section_text(
parsed: ParsedMarkdownArtifact,
heading: str,