mirror of
https://github.com/github/spec-kit.git
synced 2026-07-03 20:36:23 +08:00
* Initial plan * feat!: remove legacy --ai, --ai-commands-dir, and --ai-skills flags at 0.10.0 * refactor(tests): rename stale test_ai_help_* methods to test_agent_config_* * fix: address review — derive agent folder for generic integration and remove redundant test - Security notice now falls back to integration_parsed_options['commands_dir'] when AGENT_CONFIG folder is None (generic integration). - Remove test_agent_config_includes_kiro_cli which duplicates the assertion in test_runtime_config_uses_kiro_cli_and_removes_q. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: scrub all remaining --ai flag references from source and tests - Remove dead AI_ASSISTANT_ALIASES, AI_ASSISTANT_HELP, and _build_ai_assistant_help() from _agent_config.py - Update comments/docstrings in extensions.py, presets.py, and integration subpackages to reference 'skills mode' or '--integration' instead of the removed flags - Fix catalog.json generic integration description - Update test docstrings/comments in test_extension_skills.py, test_extensions.py, and test_presets.py Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test: remove legacy --ai flag rejection tests The flags are fully removed from the CLI; typer handles unknown options generically. No custom rejection logic exists to test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * revert: remove manual CHANGELOG.md entry CHANGELOG is generated automatically; manual edits should not be made. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: make generic catalog description self-explanatory Include the required --commands-dir sub-option in the description so readers don't need to look up integration docs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(tests): rename duplicate test classes to avoid shadowing The rename from Test*AutoPromote to Test*Integration collided with the existing Test*Integration(SkillsIntegrationTests) base classes, causing the shared test suites to be silently overwritten. Rename the CLI init flow classes to Test*InitFlow instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Manfred Riem <mnriem@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
136 lines
5.7 KiB
Python
136 lines
5.7 KiB
Python
"""Tests for AgyIntegration (Antigravity)."""
|
|
|
|
from specify_cli.integrations import get_integration
|
|
|
|
from .test_integration_base_skills import SkillsIntegrationTests
|
|
|
|
|
|
class TestAgyIntegration(SkillsIntegrationTests):
|
|
KEY = "agy"
|
|
FOLDER = ".agents/"
|
|
COMMANDS_SUBDIR = "skills"
|
|
REGISTRAR_DIR = ".agents/skills"
|
|
CONTEXT_FILE = "AGENTS.md"
|
|
|
|
def test_options_include_skills_flag(self):
|
|
"""Override inherited test: AgyIntegration should not expose a --skills flag because .agents/ is its only layout."""
|
|
i = get_integration(self.KEY)
|
|
skills_opts = [o for o in i.options() if o.name == "--skills"]
|
|
assert len(skills_opts) == 0
|
|
|
|
def test_requires_cli_is_true(self):
|
|
"""agy is a CLI tool; requires_cli must be True."""
|
|
i = get_integration(self.KEY)
|
|
assert i.config["requires_cli"] is True
|
|
|
|
def test_install_url_is_set(self):
|
|
"""install_url must point to the official installation page."""
|
|
i = get_integration(self.KEY)
|
|
assert i.config["install_url"] == "https://antigravity.google/"
|
|
|
|
|
|
class TestAgyInitFlow:
|
|
"""--integration agy creates expected files."""
|
|
|
|
def test_integration_agy_creates_skills(self, tmp_path):
|
|
"""--integration agy should create skills directory."""
|
|
from typer.testing import CliRunner
|
|
from specify_cli import app
|
|
|
|
runner = CliRunner()
|
|
target = tmp_path / "test-proj"
|
|
result = runner.invoke(app, ["init", str(target), "--integration", "agy", "--no-git", "--script", "sh", "--ignore-agent-tools"])
|
|
|
|
assert result.exit_code == 0, f"init --integration agy failed: {result.output}"
|
|
assert (target / ".agents" / "skills" / "speckit-plan" / "SKILL.md").exists()
|
|
|
|
def test_agy_setup_warning(self, tmp_path):
|
|
"""Agy integration should print a warning about v1.20.5 requirement during setup."""
|
|
from typer.testing import CliRunner
|
|
from specify_cli import app
|
|
|
|
# Click >= 8.2 separates stdout and stderr natively
|
|
runner = CliRunner()
|
|
target = tmp_path / "test-proj2"
|
|
result = runner.invoke(app, ["init", str(target), "--integration", "agy", "--no-git", "--script", "sh", "--ignore-agent-tools"])
|
|
|
|
assert result.exit_code == 0
|
|
assert "Warning: The .agents/ layout requires Antigravity v1.20.5 or newer" in result.stderr
|
|
|
|
|
|
class TestAgyBuildExecArgs:
|
|
"""agy non-interactive execution argument building."""
|
|
|
|
def test_build_exec_args_returns_print_command(self):
|
|
"""build_exec_args should return ['agy', '--print', prompt]."""
|
|
from specify_cli.integrations import get_integration
|
|
i = get_integration("agy")
|
|
result = i.build_exec_args("describe my feature")
|
|
assert result == ["agy", "--print", "describe my feature"]
|
|
|
|
def test_build_exec_args_ignores_model(self):
|
|
"""agy does not support --model; model param must be ignored."""
|
|
from specify_cli.integrations import get_integration
|
|
i = get_integration("agy")
|
|
result = i.build_exec_args("my prompt", model="gemini-pro")
|
|
assert result == ["agy", "--print", "my prompt"]
|
|
|
|
def test_build_exec_args_ignores_output_json(self):
|
|
"""agy does not support JSON output; output_json param must be ignored."""
|
|
from specify_cli.integrations import get_integration
|
|
i = get_integration("agy")
|
|
result = i.build_exec_args("my prompt", output_json=False)
|
|
assert result == ["agy", "--print", "my prompt"]
|
|
|
|
|
|
class TestAgyHookCommandNote:
|
|
"""Verify dot-to-hyphen normalization note is injected into hook sections."""
|
|
|
|
def test_hook_note_injected_in_skills_with_hooks(self, tmp_path):
|
|
"""Skills with hook sections should contain the normalization note."""
|
|
from specify_cli.integrations import get_integration
|
|
from specify_cli.integrations.manifest import IntegrationManifest
|
|
|
|
i = get_integration("agy")
|
|
m = IntegrationManifest("agy", tmp_path)
|
|
i.setup(tmp_path, m, script_type="sh")
|
|
specify_skill = tmp_path / ".agents/skills/speckit-specify/SKILL.md"
|
|
assert specify_skill.exists()
|
|
content = specify_skill.read_text(encoding="utf-8")
|
|
assert "replace dots" in content, (
|
|
"speckit-specify should have dot-to-hyphen hook note"
|
|
)
|
|
|
|
def test_hook_note_not_in_skills_without_hooks(self):
|
|
"""Skills without hook sections should not get the note."""
|
|
from specify_cli.integrations.agy import AgyIntegration
|
|
|
|
content = "---\nname: test\ndescription: test\n---\n\nNo hooks here.\n"
|
|
result = AgyIntegration._inject_hook_command_note(content)
|
|
assert "replace dots" not in result
|
|
|
|
def test_hook_note_idempotent(self):
|
|
"""Injecting the note twice must not duplicate it."""
|
|
from specify_cli.integrations.agy import AgyIntegration
|
|
|
|
content = (
|
|
"---\nname: test\n---\n\n"
|
|
"- For each executable hook, output the following based on its flag:\n"
|
|
)
|
|
once = AgyIntegration._inject_hook_command_note(content)
|
|
twice = AgyIntegration._inject_hook_command_note(once)
|
|
assert once == twice, "Hook note injection should be idempotent"
|
|
|
|
def test_hook_note_preserves_indentation(self):
|
|
"""The injected note must match the indentation of the target line."""
|
|
from specify_cli.integrations.agy import AgyIntegration
|
|
|
|
content = (
|
|
"---\nname: test\n---\n\n"
|
|
" - For each executable hook, output the following\n"
|
|
)
|
|
result = AgyIntegration._inject_hook_command_note(content)
|
|
lines = result.splitlines()
|
|
note_line = [ln for ln in lines if "replace dots" in ln][0]
|
|
assert note_line.startswith(" "), "Note should preserve indentation"
|