Skip to content

Commit 1ebf2cf

Browse files
test(consistency): add Goose consistency checks for config, registrar, and scripts
Signed-off-by: Furkan Köykıran <furkankoykiran@gmail.com>
1 parent 6f1a5c1 commit 1ebf2cf

1 file changed

Lines changed: 81 additions & 16 deletions

File tree

tests/test_agent_config_consistency.py

Lines changed: 81 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,25 @@ def test_init_ai_help_includes_roo_and_kiro_alias(self):
5050

5151
def test_devcontainer_kiro_installer_uses_pinned_checksum(self):
5252
"""Devcontainer installer should always verify Kiro installer via pinned SHA256."""
53-
post_create_text = (REPO_ROOT / ".devcontainer" / "post-create.sh").read_text(encoding="utf-8")
54-
55-
assert 'KIRO_INSTALLER_SHA256="7487a65cf310b7fb59b357c4b5e6e3f3259d383f4394ecedb39acf70f307cffb"' in post_create_text
53+
post_create_text = (REPO_ROOT / ".devcontainer" / "post-create.sh").read_text(
54+
encoding="utf-8"
55+
)
56+
57+
assert (
58+
'KIRO_INSTALLER_SHA256="7487a65cf310b7fb59b357c4b5e6e3f3259d383f4394ecedb39acf70f307cffb"'
59+
in post_create_text
60+
)
5661
assert "sha256sum -c -" in post_create_text
5762
assert "KIRO_SKIP_KIRO_INSTALLER_VERIFY" not in post_create_text
5863

5964
def test_agent_context_scripts_use_kiro_cli(self):
6065
"""Agent context scripts should advertise kiro-cli and not legacy q agent key."""
61-
bash_text = (REPO_ROOT / "scripts" / "bash" / "update-agent-context.sh").read_text(encoding="utf-8")
62-
pwsh_text = (REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1").read_text(encoding="utf-8")
66+
bash_text = (
67+
REPO_ROOT / "scripts" / "bash" / "update-agent-context.sh"
68+
).read_text(encoding="utf-8")
69+
pwsh_text = (
70+
REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1"
71+
).read_text(encoding="utf-8")
6372

6473
assert "kiro-cli" in bash_text
6574
assert "kiro-cli" in pwsh_text
@@ -89,8 +98,12 @@ def test_extension_registrar_includes_tabnine(self):
8998

9099
def test_agent_context_scripts_include_tabnine(self):
91100
"""Agent context scripts should support tabnine agent type."""
92-
bash_text = (REPO_ROOT / "scripts" / "bash" / "update-agent-context.sh").read_text(encoding="utf-8")
93-
pwsh_text = (REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1").read_text(encoding="utf-8")
101+
bash_text = (
102+
REPO_ROOT / "scripts" / "bash" / "update-agent-context.sh"
103+
).read_text(encoding="utf-8")
104+
pwsh_text = (
105+
REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1"
106+
).read_text(encoding="utf-8")
94107

95108
assert "tabnine" in bash_text
96109
assert "TABNINE_FILE" in bash_text
@@ -121,7 +134,9 @@ def test_kimi_in_extension_registrar(self):
121134

122135
def test_kimi_in_powershell_validate_set(self):
123136
"""PowerShell update-agent-context script should include 'kimi' in ValidateSet."""
124-
ps_text = (REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1").read_text(encoding="utf-8")
137+
ps_text = (
138+
REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1"
139+
).read_text(encoding="utf-8")
125140

126141
validate_set_match = re.search(r"\[ValidateSet\(([^)]*)\)\]", ps_text)
127142
assert validate_set_match is not None
@@ -155,8 +170,12 @@ def test_trae_in_extension_registrar(self):
155170

156171
def test_trae_in_agent_context_scripts(self):
157172
"""Agent context scripts should support trae agent type."""
158-
bash_text = (REPO_ROOT / "scripts" / "bash" / "update-agent-context.sh").read_text(encoding="utf-8")
159-
pwsh_text = (REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1").read_text(encoding="utf-8")
173+
bash_text = (
174+
REPO_ROOT / "scripts" / "bash" / "update-agent-context.sh"
175+
).read_text(encoding="utf-8")
176+
pwsh_text = (
177+
REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1"
178+
).read_text(encoding="utf-8")
160179

161180
assert "trae" in bash_text
162181
assert "TRAE_FILE" in bash_text
@@ -165,7 +184,9 @@ def test_trae_in_agent_context_scripts(self):
165184

166185
def test_trae_in_powershell_validate_set(self):
167186
"""PowerShell update-agent-context script should include 'trae' in ValidateSet."""
168-
ps_text = (REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1").read_text(encoding="utf-8")
187+
ps_text = (
188+
REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1"
189+
).read_text(encoding="utf-8")
169190

170191
validate_set_match = re.search(r"\[ValidateSet\(([^)]*)\)\]", ps_text)
171192
assert validate_set_match is not None
@@ -200,7 +221,9 @@ def test_pi_in_extension_registrar(self):
200221

201222
def test_pi_in_powershell_validate_set(self):
202223
"""PowerShell update-agent-context script should include 'pi' in ValidateSet."""
203-
ps_text = (REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1").read_text(encoding="utf-8")
224+
ps_text = (
225+
REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1"
226+
).read_text(encoding="utf-8")
204227

205228
validate_set_match = re.search(r"\[ValidateSet\(([^)]*)\)\]", ps_text)
206229
assert validate_set_match is not None
@@ -210,8 +233,12 @@ def test_pi_in_powershell_validate_set(self):
210233

211234
def test_agent_context_scripts_include_pi(self):
212235
"""Agent context scripts should support pi agent type."""
213-
bash_text = (REPO_ROOT / "scripts" / "bash" / "update-agent-context.sh").read_text(encoding="utf-8")
214-
pwsh_text = (REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1").read_text(encoding="utf-8")
236+
bash_text = (
237+
REPO_ROOT / "scripts" / "bash" / "update-agent-context.sh"
238+
).read_text(encoding="utf-8")
239+
pwsh_text = (
240+
REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1"
241+
).read_text(encoding="utf-8")
215242

216243
assert "pi" in bash_text
217244
assert "Pi Coding Agent" in bash_text
@@ -242,8 +269,12 @@ def test_iflow_in_extension_registrar(self):
242269

243270
def test_iflow_in_agent_context_scripts(self):
244271
"""Agent context scripts should support iflow agent type."""
245-
bash_text = (REPO_ROOT / "scripts" / "bash" / "update-agent-context.sh").read_text(encoding="utf-8")
246-
pwsh_text = (REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1").read_text(encoding="utf-8")
272+
bash_text = (
273+
REPO_ROOT / "scripts" / "bash" / "update-agent-context.sh"
274+
).read_text(encoding="utf-8")
275+
pwsh_text = (
276+
REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1"
277+
).read_text(encoding="utf-8")
247278

248279
assert "iflow" in bash_text
249280
assert "IFLOW_FILE" in bash_text
@@ -253,3 +284,37 @@ def test_iflow_in_agent_context_scripts(self):
253284
def test_ai_help_includes_iflow(self):
254285
"""CLI help text for --ai should include iflow."""
255286
assert "iflow" in AI_ASSISTANT_HELP
287+
288+
# --- Goose consistency checks ---
289+
290+
def test_goose_in_agent_config(self):
291+
"""AGENT_CONFIG should include goose with correct folder and commands_subdir."""
292+
assert "goose" in AGENT_CONFIG
293+
assert AGENT_CONFIG["goose"]["folder"] == ".goose/"
294+
assert AGENT_CONFIG["goose"]["commands_subdir"] == "recipes"
295+
assert AGENT_CONFIG["goose"]["requires_cli"] is True
296+
297+
def test_goose_in_extension_registrar(self):
298+
"""Extension command registrar should include goose targeting .goose/recipes."""
299+
cfg = CommandRegistrar.AGENT_CONFIGS
300+
301+
assert "goose" in cfg
302+
assert cfg["goose"]["dir"] == ".goose/recipes"
303+
assert cfg["goose"]["format"] == "yaml"
304+
assert cfg["goose"]["args"] == "{{args}}"
305+
306+
def test_goose_in_agent_context_scripts(self):
307+
"""Agent context scripts should support goose agent type."""
308+
bash_text = (
309+
REPO_ROOT / "scripts" / "bash" / "update-agent-context.sh"
310+
).read_text(encoding="utf-8")
311+
pwsh_text = (
312+
REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1"
313+
).read_text(encoding="utf-8")
314+
315+
assert "goose" in bash_text
316+
assert "goose" in pwsh_text
317+
318+
def test_ai_help_includes_goose(self):
319+
"""CLI help text for --ai should include goose."""
320+
assert "goose" in AI_ASSISTANT_HELP

0 commit comments

Comments
 (0)