mirror of
https://github.com/github/spec-kit.git
synced 2026-07-03 12:28:06 +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>
75 lines
3.0 KiB
Python
75 lines
3.0 KiB
Python
"""
|
|
Unit tests for branch numbering options (sequential vs timestamp).
|
|
|
|
Tests cover:
|
|
- Persisting branch_numbering in init-options.json
|
|
- Default value when branch_numbering is None
|
|
- Validation of branch_numbering values
|
|
"""
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
from specify_cli import save_init_options
|
|
|
|
|
|
class TestSaveBranchNumbering:
|
|
"""Tests for save_init_options with branch_numbering."""
|
|
|
|
def test_save_branch_numbering_timestamp(self, tmp_path: Path):
|
|
opts = {"branch_numbering": "timestamp", "ai": "claude"}
|
|
save_init_options(tmp_path, opts)
|
|
|
|
saved = json.loads((tmp_path / ".specify/init-options.json").read_text())
|
|
assert saved["branch_numbering"] == "timestamp"
|
|
|
|
def test_save_branch_numbering_sequential(self, tmp_path: Path):
|
|
opts = {"branch_numbering": "sequential", "ai": "claude"}
|
|
save_init_options(tmp_path, opts)
|
|
|
|
saved = json.loads((tmp_path / ".specify/init-options.json").read_text())
|
|
assert saved["branch_numbering"] == "sequential"
|
|
|
|
def test_branch_numbering_defaults_to_sequential(self, tmp_path: Path):
|
|
from typer.testing import CliRunner
|
|
from specify_cli import app
|
|
|
|
project_dir = tmp_path / "proj"
|
|
runner = CliRunner()
|
|
result = runner.invoke(app, ["init", str(project_dir), "--integration", "claude", "--ignore-agent-tools", "--no-git", "--script", "sh"])
|
|
assert result.exit_code == 0
|
|
|
|
saved = json.loads((project_dir / ".specify/init-options.json").read_text())
|
|
assert saved["branch_numbering"] == "sequential"
|
|
|
|
|
|
class TestBranchNumberingValidation:
|
|
"""Tests for branch_numbering CLI validation via CliRunner."""
|
|
|
|
def test_invalid_branch_numbering_rejected(self, tmp_path: Path):
|
|
from typer.testing import CliRunner
|
|
from specify_cli import app
|
|
|
|
runner = CliRunner()
|
|
result = runner.invoke(app, ["init", str(tmp_path / "proj"), "--integration", "claude", "--branch-numbering", "foobar", "--ignore-agent-tools"])
|
|
assert result.exit_code == 1
|
|
assert "Invalid --branch-numbering" in result.output
|
|
|
|
def test_valid_branch_numbering_sequential(self, tmp_path: Path):
|
|
from typer.testing import CliRunner
|
|
from specify_cli import app
|
|
|
|
runner = CliRunner()
|
|
result = runner.invoke(app, ["init", str(tmp_path / "proj"), "--integration", "claude", "--branch-numbering", "sequential", "--ignore-agent-tools", "--no-git", "--script", "sh"])
|
|
assert result.exit_code == 0
|
|
assert "Invalid --branch-numbering" not in (result.output or "")
|
|
|
|
def test_valid_branch_numbering_timestamp(self, tmp_path: Path):
|
|
from typer.testing import CliRunner
|
|
from specify_cli import app
|
|
|
|
runner = CliRunner()
|
|
result = runner.invoke(app, ["init", str(tmp_path / "proj"), "--integration", "claude", "--branch-numbering", "timestamp", "--ignore-agent-tools", "--no-git", "--script", "sh"])
|
|
assert result.exit_code == 0
|
|
assert "Invalid --branch-numbering" not in (result.output or "")
|