Skip to content

Commit b8f4ecd

Browse files
committed
fix: address Copilot review comments on type safety and test API
- Make is_slash_skills_agent() accept str | None to match its call sites (init_options.get("ai") can return None) - Refactor TestSlashSkillsSets to use public execute_hook() API instead of private _render_hook_invocation() method
1 parent 3e750e8 commit b8f4ecd

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/specify_cli/extensions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
EXTENSION_COMMAND_NAME_PATTERN = re.compile(r"^speckit\.([a-z0-9-]+)\.([a-z0-9-]+)$")
5353

5454

55-
def is_slash_skills_agent(selected_ai: str, ai_skills_enabled: bool) -> bool:
55+
def is_slash_skills_agent(selected_ai: str | None, ai_skills_enabled: bool) -> bool:
5656
"""Return True if *selected_ai* uses ``/speckit-<name>`` hook invocations.
5757
5858
The decision is based on the agent sets defined above:
@@ -62,6 +62,8 @@ def is_slash_skills_agent(selected_ai: str, ai_skills_enabled: bool) -> bool:
6262
*ai_skills_enabled* is ``True``.
6363
* All other agents return ``False``.
6464
"""
65+
if selected_ai is None:
66+
return False
6567
return selected_ai in ALWAYS_SLASH_AGENTS or (
6668
selected_ai in CONDITIONAL_SLASH_AGENTS and ai_skills_enabled
6769
)

tests/integrations/test_integration_zed.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ def _render_invocation(project_path, ai: str, ai_skills: bool) -> str:
125125
init_options.parent.mkdir(parents=True, exist_ok=True)
126126
init_options.write_text(json.dumps({"ai": ai, "ai_skills": ai_skills}))
127127
hook_executor = HookExecutor(project_path)
128-
return hook_executor._render_hook_invocation("speckit.plan")
128+
result = hook_executor.execute_hook(
129+
{"extension": "test-ext", "command": "speckit.plan", "optional": False}
130+
)
131+
return result.get("invocation", "")
129132

130133
@pytest.mark.parametrize(
131134
("ai", "ai_skills", "expected"),

0 commit comments

Comments
 (0)