feat: initial commit
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
"""Kontekst APM jest konfiguracją sieci agentowej - musi się ładować i walidować."""
|
||||
|
||||
import pytest
|
||||
|
||||
from agentic_codemod.apm.loader import load_apm_context
|
||||
from agentic_codemod.apm.primitives import parse_frontmatter
|
||||
|
||||
|
||||
def test_kontekst_zawiera_wszystkie_role_agentow(repo_root):
|
||||
ctx = load_apm_context(repo_root)
|
||||
assert {"scout", "planner", "coder", "reviewer", "scribe"} <= set(ctx.agents)
|
||||
assert {"repo-recon", "sdk-version-upgrade", "safe-code-edit", "merge-request-authoring"} <= set(ctx.skills)
|
||||
assert {"security-guardrails", "python-conventions"} <= set(ctx.instructions)
|
||||
|
||||
|
||||
def test_definicja_agenta_wskazuje_istniejace_skille_i_instrukcje(repo_root):
|
||||
ctx = load_apm_context(repo_root)
|
||||
for name, definition in ctx.agents.items():
|
||||
assert ctx.skill_paths(definition.skill_names) or not definition.skill_names, name
|
||||
assert ctx.instruction_bodies(definition.instruction_names) or not definition.instruction_names, name
|
||||
|
||||
|
||||
def test_skille_sa_zgodne_ze_specyfikacja_agent_skills(repo_root):
|
||||
"""agno waliduje katalogi skilli - niepoprawny skill musi wysadzić przebieg na starcie."""
|
||||
from agno.skills import LocalSkills
|
||||
|
||||
ctx = load_apm_context(repo_root)
|
||||
for ref in ctx.skills.values():
|
||||
assert LocalSkills(str(ref.path), validate=True).load()
|
||||
|
||||
|
||||
def test_prompt_renderuje_sie_z_wymaganymi_wejsciami(repo_root):
|
||||
ctx = load_apm_context(repo_root)
|
||||
prompt = ctx.prompt("sdk-upgrade")
|
||||
rendered = prompt.render({"package": "acme-sdk", "to_version": "2.1.0", "repo": "/tmp/x"})
|
||||
assert "acme-sdk" in rendered and "2.1.0" in rendered
|
||||
assert "{{" not in rendered
|
||||
|
||||
|
||||
def test_brak_wymaganego_wejscia_to_blad_konfiguracji_nie_zgadywanie(repo_root):
|
||||
ctx = load_apm_context(repo_root)
|
||||
with pytest.raises(ValueError, match="brak wymaganych wejść"):
|
||||
ctx.prompt("sdk-upgrade").render({"package": "acme-sdk"})
|
||||
|
||||
|
||||
def test_brakujacy_skill_konczy_sie_czytelnym_bledem(repo_root):
|
||||
ctx = load_apm_context(repo_root)
|
||||
with pytest.raises(KeyError, match="apm install"):
|
||||
ctx.skill_paths(["nie-istnieje"])
|
||||
|
||||
|
||||
def test_parsowanie_frontmattera_bez_naglowka():
|
||||
meta, body = parse_frontmatter("zwykły tekst")
|
||||
assert meta == {} and body == "zwykły tekst"
|
||||
Reference in New Issue
Block a user