Skip to content

Commit cd13ce6

Browse files
puneetdixit200Puneet Dixit
authored andcommitted
test: strengthen ai alias coverage
1 parent abf4a2a commit cd13ce6

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:
@@ -458,7 +459,7 @@ def init(
458459
offline: bool = typer.Option(False, "--offline", help="Deprecated (no-op). All scaffolding now uses bundled assets.", hidden=True),
459460
preset: str = typer.Option(None, "--preset", help="Install a preset during initialization (by preset ID)"),
460461
branch_numbering: str = typer.Option(None, "--branch-numbering", help="Branch numbering strategy: 'sequential' (001, 002, …, 1000, … — expands past 999 automatically) or 'timestamp' (YYYYMMDD-HHMMSS)"),
461-
integration: str = typer.Option(None, "--integration", help="Coding agent integration to use (e.g. --integration copilot). Equivalent to --ai; mutually exclusive with --ai."),
462+
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."),
462463
integration_options: str = typer.Option(None, "--integration-options", help='Options for the integration (e.g. --integration-options="--commands-dir .myagent/cmds")'),
463464
):
464465
"""

tests/integrations/test_cli.py

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,26 @@ def test_cli_phase_label_includes_target(self):
4343
)
4444

4545

46+
def _assert_no_ai_deprecation_output(output: str) -> None:
47+
assert "Deprecation Warning" not in output
48+
assert "no longer be available" not in output
49+
assert "Commands will no longer be available" not in output
50+
assert "--ai is deprecated" not in output
51+
assert "deprecated --ai" not in output
52+
assert (
53+
re.search(r"(--ai.{0,80}deprecated|deprecated.{0,80}--ai)", output, re.IGNORECASE)
54+
is None
55+
)
56+
assert (
57+
re.search(r"(--ai.{0,120}0\.10\.0|0\.10\.0.{0,120}--ai)", output, re.IGNORECASE)
58+
is None
59+
)
60+
assert (
61+
re.search(r"(--ai.{0,120}next steps|next steps.{0,120}--ai)", output, re.IGNORECASE)
62+
is None
63+
)
64+
65+
4666
class TestInitIntegrationFlag:
4767
def test_integration_and_ai_mutually_exclusive(self, tmp_path):
4868
from typer.testing import CliRunner
@@ -160,12 +180,7 @@ def test_ai_copilot_does_not_emit_deprecation_warning(self, tmp_path):
160180

161181
normalized_output = _normalize_cli_output(result.output)
162182
assert result.exit_code == 0, result.output
163-
assert "Deprecation Warning" not in normalized_output
164-
assert "no longer be available" not in normalized_output
165-
assert "Commands will no longer be available" not in normalized_output
166-
assert "--ai is deprecated" not in normalized_output
167-
assert "deprecated --ai" not in normalized_output
168-
assert re.search(r"(--ai.{0,80}deprecated|deprecated.{0,80}--ai)", normalized_output, re.IGNORECASE) is None
183+
_assert_no_ai_deprecation_output(normalized_output)
169184
assert (project / ".github" / "agents" / "speckit.plan.agent.md").exists()
170185

171186
def test_ai_generic_alias_does_not_emit_deprecation_warning(self, tmp_path):
@@ -187,12 +202,7 @@ def test_ai_generic_alias_does_not_emit_deprecation_warning(self, tmp_path):
187202

188203
normalized_output = _normalize_cli_output(result.output)
189204
assert result.exit_code == 0, result.output
190-
assert "Deprecation Warning" not in normalized_output
191-
assert "no longer be available" not in normalized_output
192-
assert "Commands will no longer be available" not in normalized_output
193-
assert "--ai is deprecated" not in normalized_output
194-
assert "deprecated --ai" not in normalized_output
195-
assert re.search(r"(--ai.{0,80}deprecated|deprecated.{0,80}--ai)", normalized_output, re.IGNORECASE) is None
205+
_assert_no_ai_deprecation_output(normalized_output)
196206
assert ".myagent/commands" in normalized_output
197207
assert (project / ".myagent" / "commands" / "speckit.plan.md").exists()
198208

0 commit comments

Comments
 (0)