Skip to content

Commit cda1475

Browse files
test: strengthen ai alias coverage
1 parent cfb1b2e commit cda1475

2 files changed

Lines changed: 25 additions & 14 deletions

File tree

src/specify_cli/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ def _build_ai_assistant_help() -> str:
123123
non_generic_agents = sorted(agent for agent in AGENT_CONFIG if agent != "generic")
124124
base_help = (
125125
f"Short alias for --integration. Choose: {', '.join(non_generic_agents)}, "
126-
"or generic (requires --ai-commands-dir). Mutually exclusive with --integration."
126+
"or generic (requires --ai-commands-dir). Equivalent to --integration; "
127+
"do not combine them."
127128
)
128129

129130
if not AI_ASSISTANT_ALIASES:
@@ -429,7 +430,7 @@ def init(
429430
offline: bool = typer.Option(False, "--offline", help="Deprecated (no-op). All scaffolding now uses bundled assets.", hidden=True),
430431
preset: str = typer.Option(None, "--preset", help="Install a preset during initialization (by preset ID)"),
431432
branch_numbering: str = typer.Option(None, "--branch-numbering", help="Branch numbering strategy: 'sequential' (001, 002, …, 1000, … — expands past 999 automatically) or 'timestamp' (YYYYMMDD-HHMMSS)"),
432-
integration: str = typer.Option(None, "--integration", help="Coding agent integration to use (e.g. --integration copilot). Equivalent to --ai; mutually exclusive with --ai."),
433+
integration: str = typer.Option(None, "--integration", help="Coding agent integration to use (e.g. --integration copilot). --ai is a short alias for this option; do not combine them."),
433434
integration_options: str = typer.Option(None, "--integration-options", help='Options for the integration (e.g. --integration-options="--commands-dir .myagent/cmds")'),
434435
):
435436
"""

tests/integrations/test_cli.py

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,26 @@ def _normalize_cli_output(output: str) -> str:
2323
return output.strip()
2424

2525

26+
def _assert_no_ai_deprecation_output(output: str) -> None:
27+
assert "Deprecation Warning" not in output
28+
assert "no longer be available" not in output
29+
assert "Commands will no longer be available" not in output
30+
assert "--ai is deprecated" not in output
31+
assert "deprecated --ai" not in output
32+
assert (
33+
re.search(r"(--ai.{0,80}deprecated|deprecated.{0,80}--ai)", output, re.IGNORECASE)
34+
is None
35+
)
36+
assert (
37+
re.search(r"(--ai.{0,120}0\.10\.0|0\.10\.0.{0,120}--ai)", output, re.IGNORECASE)
38+
is None
39+
)
40+
assert (
41+
re.search(r"(--ai.{0,120}next steps|next steps.{0,120}--ai)", output, re.IGNORECASE)
42+
is None
43+
)
44+
45+
2646
class TestInitIntegrationFlag:
2747
def test_integration_and_ai_mutually_exclusive(self, tmp_path):
2848
from typer.testing import CliRunner
@@ -140,12 +160,7 @@ def test_ai_copilot_does_not_emit_deprecation_warning(self, tmp_path):
140160

141161
normalized_output = _normalize_cli_output(result.output)
142162
assert result.exit_code == 0, result.output
143-
assert "Deprecation Warning" not in normalized_output
144-
assert "no longer be available" not in normalized_output
145-
assert "Commands will no longer be available" not in normalized_output
146-
assert "--ai is deprecated" not in normalized_output
147-
assert "deprecated --ai" not in normalized_output
148-
assert re.search(r"(--ai.{0,80}deprecated|deprecated.{0,80}--ai)", normalized_output, re.IGNORECASE) is None
163+
_assert_no_ai_deprecation_output(normalized_output)
149164
assert (project / ".github" / "agents" / "speckit.plan.agent.md").exists()
150165

151166
def test_ai_generic_alias_does_not_emit_deprecation_warning(self, tmp_path):
@@ -167,12 +182,7 @@ def test_ai_generic_alias_does_not_emit_deprecation_warning(self, tmp_path):
167182

168183
normalized_output = _normalize_cli_output(result.output)
169184
assert result.exit_code == 0, result.output
170-
assert "Deprecation Warning" not in normalized_output
171-
assert "no longer be available" not in normalized_output
172-
assert "Commands will no longer be available" not in normalized_output
173-
assert "--ai is deprecated" not in normalized_output
174-
assert "deprecated --ai" not in normalized_output
175-
assert re.search(r"(--ai.{0,80}deprecated|deprecated.{0,80}--ai)", normalized_output, re.IGNORECASE) is None
185+
_assert_no_ai_deprecation_output(normalized_output)
176186
assert ".myagent/commands" in normalized_output
177187
assert (project / ".myagent" / "commands" / "speckit.plan.md").exists()
178188

0 commit comments

Comments
 (0)