feat: support role-based agent prompts

This commit is contained in:
2026-06-02 17:56:38 +01:00
parent 3ccdea330a
commit 34f7364c86
4 changed files with 225 additions and 12 deletions
+63
View File
@@ -259,3 +259,66 @@ def test_extract_test_commands_no_section(tmp_path: Path) -> None:
commands = _extract_test_commands_from_claude(tmp_path)
assert commands == []
def test_generate_agent_prompt_with_role(tmp_path: Path) -> None:
(tmp_path / "TASKS.md").write_text(
"# TASKS\n\n"
"## TASK-001 — First\nStatus: Done\n\n"
"Goal: x.\n\n"
"## TASK-002 — Second\nStatus: Todo\n\n"
"Role: Architecture Agent\n"
"Goal: y.\n",
encoding="utf-8",
)
prompt = generate_agent_prompt(tmp_path)
assert "You are an architecture agent." in prompt
def test_generate_agent_prompt_default_role_when_missing(tmp_path: Path) -> None:
(tmp_path / "TASKS.md").write_text(
"# TASKS\n\n"
"## TASK-001 — First\nStatus: Done\n\n"
"Goal: x.\n\n"
"## TASK-002 — Second\nStatus: Todo\n\n"
"Goal: y.\n",
encoding="utf-8",
)
prompt = generate_agent_prompt(tmp_path)
assert "You are an implementation agent." in prompt
def test_generate_agent_prompt_with_empty_role_defaults(tmp_path: Path) -> None:
(tmp_path / "TASKS.md").write_text(
"# TASKS\n\n"
"## TASK-001 — First\nStatus: Done\n\n"
"Goal: x.\n\n"
"## TASK-002 — Second\nStatus: Todo\n\n"
"Role:\n"
"Goal: y.\n",
encoding="utf-8",
)
prompt = generate_agent_prompt(tmp_path)
assert "You are an implementation agent." in prompt
def test_generate_agent_prompt_with_custom_role(tmp_path: Path) -> None:
(tmp_path / "TASKS.md").write_text(
"# TASKS\n\n"
"## TASK-001 — First\nStatus: Done\n\n"
"Goal: x.\n\n"
"## TASK-002 — Second\nStatus: Todo\n\n"
"Role: DevOps Engineer\n"
"Goal: y.\n",
encoding="utf-8",
)
prompt = generate_agent_prompt(tmp_path)
assert "You are a devops engineer." in prompt