Skip to content

ogs.reports

Generator

Generate all requested reports and write them to output_dir.

Creates a subdirectory named after the pattern (slugified) and puts all reports in that subdirectory for organized storage.

Parameters:

Name Type Description Default
pattern PatternIR

The pattern to generate reports for.

required
output_dir Path

Base directory to write reports into. A subdirectory for the pattern will be created here.

required
report_types list[str] | None

List of report types to generate. Defaults to all. Options: "overview", "contracts", "schema", "state_machine", "checklist", "verification"

None
verification_report VerificationReport | None

Optional pre-computed verification report.

None

Returns:

Type Description
list[Path]

List of paths to generated report files.

Source code in packages/gds-games/ogs/reports/generator.py
def generate_reports(
    pattern: PatternIR,
    output_dir: Path,
    report_types: list[str] | None = None,
    verification_report: VerificationReport | None = None,
) -> list[Path]:
    """Generate all requested reports and write them to output_dir.

    Creates a subdirectory named after the pattern (slugified) and puts
    all reports in that subdirectory for organized storage.

    Args:
        pattern: The pattern to generate reports for.
        output_dir: Base directory to write reports into. A subdirectory
            for the pattern will be created here.
        report_types: List of report types to generate. Defaults to all.
            Options: "overview", "contracts", "schema", "state_machine",
            "checklist", "verification"
        verification_report: Optional pre-computed verification report.

    Returns:
        List of paths to generated report files.
    """
    all_types = [
        "overview",
        "contracts",
        "schema",
        "state_machine",
        "checklist",
        "verification",
        "domain_analysis",
    ]
    if report_types is None:
        report_types = all_types

    needs_verification = any(t in report_types for t in ("overview", "verification"))
    if verification_report is None and needs_verification:
        verification_report = verify(pattern)

    # Create pattern-specific subdirectory
    slug = pattern.name.lower().replace(" ", "_")
    pattern_dir = output_dir / slug
    pattern_dir.mkdir(parents=True, exist_ok=True)
    written: list[Path] = []

    if "overview" in report_types:
        content = generate_system_overview(pattern, verification_report)
        path = pattern_dir / f"{slug}_system_overview.md"
        path.write_text(content)
        written.append(path)

    if "contracts" in report_types:
        content = generate_interface_contracts(pattern)
        path = pattern_dir / f"{slug}_interface_contracts.md"
        path.write_text(content)
        written.append(path)

    if "schema" in report_types:
        content = generate_schema_catalog(pattern)
        path = pattern_dir / f"{slug}_schema_catalog.md"
        path.write_text(content)
        written.append(path)

    if "state_machine" in report_types:
        content = generate_state_machine(pattern)
        path = pattern_dir / f"{slug}_state_machine.md"
        path.write_text(content)
        written.append(path)

    if "checklist" in report_types:
        content = generate_implementation_checklist(pattern)
        path = pattern_dir / f"{slug}_implementation_checklist.md"
        path.write_text(content)
        written.append(path)

    if "verification" in report_types:
        content = generate_verification_summary(pattern, verification_report)
        path = pattern_dir / f"{slug}_verification_summary.md"
        path.write_text(content)
        written.append(path)

    if "domain_analysis" in report_types:
        content = generate_domain_analysis(pattern)
        path = pattern_dir / f"{slug}_domain_analysis.md"
        path.write_text(content)
        written.append(path)

    return written

Domain Analysis

Domain analysis report generator with advanced tag-based insights.

generate_domain_analysis(pattern, tag_key='domain')

Generate a domain analysis report with tag-based insights.

Source code in packages/gds-games/ogs/reports/domain_analysis.py
def generate_domain_analysis(pattern: PatternIR, tag_key: str = "domain") -> str:
    """Generate a domain analysis report with tag-based insights."""
    env = _get_jinja_env()
    template = env.get_template("domain_analysis.md.j2")

    analysis = _analyze_domains(pattern, tag_key)

    return template.render(
        pattern=pattern,
        tag_key=tag_key,
        **analysis,
    )