"""
Export context packs as a generic system prompt.

This is the universal fallback — works with any LLM by producing
a clean markdown-formatted system prompt fragment.
"""

from __future__ import annotations

from aura.schema import SCHEMA_VERSION, ContextPack


def export_system_prompt(packs: list[ContextPack], include_header: bool = True) -> str:
    """
    Export one or more context packs as a combined system prompt.

    Args:
        packs: List of context packs to include
        include_header: Whether to add the aura header comment

    Returns:
        A markdown-formatted system prompt string
    """
    sections: list[str] = []

    if include_header:
        sections.append(
            f"<!-- Generated by aura v{SCHEMA_VERSION} — https://github.com/WozGeek/BettaAura -->"
        )
        sections.append("")
        sections.append("# User Context")
        sections.append(
            "The following describes the user's preferences, skills, and instructions."
        )
        sections.append(
            "Respect these unless the user explicitly overrides them in conversation."
        )

    for pack in packs:
        sections.append("")
        sections.append(pack.to_system_prompt())

    return "\n".join(sections) + "\n"
