mirror of
https://github.com/github/spec-kit.git
synced 2026-07-07 06:35:06 +08:00
feat: add catalog discovery CLI commands (#2360)
* feat: add catalog discovery CLI commands * fix: address second Copilot review * fix: address third Copilot review * fix: align catalog remove with displayed order * fix: route local catalog config errors to local guidance * fix: address integration catalog review feedback * fix: accept numeric string catalog priorities * fix: align catalog remove with visible entries * fix: preserve invalid catalog root validation * fix: include invalid catalog priority value * fix: preserve falsy catalog root validation * fix: clarify integration catalog guidance * fix: align integration catalog list and remove * fix: align integration catalog edge cases * fix: clarify catalog error guidance tests * fix: clarify integration catalog edge cases * fix: harden integration catalog removal * fix: validate integration state before catalog search * fix: reject empty integration catalog URL * fix: allow catalog remove to clean non-string URLs * fix: address catalog env and priority review * fix: align catalog source display names * fix: align catalog fallback names
This commit is contained in:
committed by
GitHub
parent
9cf3151a72
commit
1049e17a43
@@ -628,3 +628,550 @@ class TestSharedInfraCommandRefs:
|
||||
assert "/speckit-plan" in content, "Copilot --skills should use /speckit-plan"
|
||||
assert "/speckit.plan" not in content, "dot-notation leaked into Copilot skills page template"
|
||||
assert "__SPECKIT_COMMAND_" not in content
|
||||
|
||||
|
||||
class TestIntegrationCatalogDiscoveryCLI:
|
||||
"""End-to-end CLI tests for `integration search`, `info`, and `catalog …`.
|
||||
|
||||
All tests patch `IntegrationCatalog._get_merged_integrations` so no network
|
||||
or on-disk cache is touched. Adds #2344 coverage without affecting any
|
||||
existing integration install/switch/uninstall/upgrade behavior.
|
||||
"""
|
||||
|
||||
FAKE_INTEGRATIONS = [
|
||||
{
|
||||
"id": "acme-coder",
|
||||
"name": "Acme Coder",
|
||||
"version": "2.0.0",
|
||||
"description": "Community integration for Acme Coder",
|
||||
"author": "acme-org",
|
||||
"tags": ["cli", "acme"],
|
||||
"_catalog_name": "community",
|
||||
"_install_allowed": False,
|
||||
},
|
||||
{
|
||||
"id": "stellar-agent",
|
||||
"name": "Stellar Agent",
|
||||
"version": "1.3.0",
|
||||
"description": "First-party Stellar agent integration",
|
||||
"author": "stellar-labs",
|
||||
"tags": ["ide"],
|
||||
"_catalog_name": "default",
|
||||
"_install_allowed": True,
|
||||
},
|
||||
]
|
||||
|
||||
def _make_project(self, tmp_path):
|
||||
project = tmp_path / "proj"
|
||||
project.mkdir()
|
||||
(project / ".specify").mkdir()
|
||||
return project
|
||||
|
||||
def _patch_catalog(self, monkeypatch, integrations=None):
|
||||
"""Return a stubbed `_get_merged_integrations` that yields *integrations*."""
|
||||
from specify_cli.integrations.catalog import IntegrationCatalog
|
||||
|
||||
data = list(integrations if integrations is not None else self.FAKE_INTEGRATIONS)
|
||||
|
||||
def fake_merged(self, force_refresh=False):
|
||||
return data
|
||||
|
||||
monkeypatch.setattr(IntegrationCatalog, "_get_merged_integrations", fake_merged)
|
||||
|
||||
def _invoke(self, argv, cwd):
|
||||
from typer.testing import CliRunner
|
||||
from specify_cli import app
|
||||
|
||||
runner = CliRunner()
|
||||
old = os.getcwd()
|
||||
try:
|
||||
os.chdir(cwd)
|
||||
return runner.invoke(app, argv, catch_exceptions=False)
|
||||
finally:
|
||||
os.chdir(old)
|
||||
|
||||
# -- Project guard -----------------------------------------------------
|
||||
|
||||
def test_search_requires_specify_project(self, tmp_path):
|
||||
project = tmp_path / "bare"
|
||||
project.mkdir()
|
||||
result = self._invoke(["integration", "search"], project)
|
||||
assert result.exit_code == 1
|
||||
assert "Not a spec-kit project" in result.output
|
||||
|
||||
def test_catalog_list_requires_specify_project(self, tmp_path):
|
||||
project = tmp_path / "bare"
|
||||
project.mkdir()
|
||||
result = self._invoke(["integration", "catalog", "list"], project)
|
||||
assert result.exit_code == 1
|
||||
assert "Not a spec-kit project" in result.output
|
||||
|
||||
# -- search ------------------------------------------------------------
|
||||
|
||||
def test_search_lists_all(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
self._patch_catalog(monkeypatch)
|
||||
result = self._invoke(["integration", "search"], project)
|
||||
normalized_output = _normalize_cli_output(result.output)
|
||||
assert result.exit_code == 0, result.output
|
||||
assert "Found 2 integration(s)" in result.output
|
||||
assert "acme-coder" in result.output
|
||||
assert "stellar-agent" in result.output
|
||||
assert "specify integration install stellar-agent" not in normalized_output
|
||||
assert "Only built-in integration IDs can be installed" in normalized_output
|
||||
|
||||
def test_search_validates_integration_json_before_catalog_lookup(
|
||||
self, tmp_path, monkeypatch
|
||||
):
|
||||
project = self._make_project(tmp_path)
|
||||
(project / ".specify" / "integration.json").write_text(
|
||||
"{bad json\n", encoding="utf-8"
|
||||
)
|
||||
|
||||
from specify_cli.integrations.catalog import IntegrationCatalog
|
||||
|
||||
def fail_search(self, **kwargs):
|
||||
raise AssertionError("catalog search should not be called")
|
||||
|
||||
monkeypatch.setattr(IntegrationCatalog, "search", fail_search)
|
||||
|
||||
result = self._invoke(["integration", "search"], project)
|
||||
normalized_output = _normalize_cli_output(result.output)
|
||||
assert result.exit_code == 1
|
||||
assert "contains invalid JSON" in normalized_output
|
||||
assert "integration.json" in normalized_output
|
||||
|
||||
def test_search_filters_by_tag(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
self._patch_catalog(monkeypatch)
|
||||
result = self._invoke(["integration", "search", "--tag", "acme"], project)
|
||||
assert result.exit_code == 0, result.output
|
||||
assert "Found 1 integration(s)" in result.output
|
||||
assert "acme-coder" in result.output
|
||||
assert "stellar-agent" not in result.output
|
||||
|
||||
def test_search_filters_by_author(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
self._patch_catalog(monkeypatch)
|
||||
result = self._invoke(
|
||||
["integration", "search", "--author", "stellar-labs"], project
|
||||
)
|
||||
assert result.exit_code == 0, result.output
|
||||
assert "Found 1 integration(s)" in result.output
|
||||
assert "stellar-agent" in result.output
|
||||
|
||||
def test_search_no_match_hint(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
self._patch_catalog(monkeypatch)
|
||||
result = self._invoke(
|
||||
["integration", "search", "--tag", "nope"], project
|
||||
)
|
||||
assert result.exit_code == 0, result.output
|
||||
assert "No integrations found" in result.output
|
||||
assert "specify integration search" in result.output
|
||||
|
||||
def test_search_marks_discovery_only_entry(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
self._patch_catalog(monkeypatch)
|
||||
result = self._invoke(["integration", "search", "acme"], project)
|
||||
assert result.exit_code == 0, result.output
|
||||
# acme-coder is flagged _install_allowed=False, so we should warn
|
||||
assert "Not directly installable" in result.output
|
||||
|
||||
# -- info --------------------------------------------------------------
|
||||
|
||||
def test_info_found(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
self._patch_catalog(monkeypatch)
|
||||
result = self._invoke(
|
||||
["integration", "info", "stellar-agent"], project
|
||||
)
|
||||
assert result.exit_code == 0, result.output
|
||||
assert "Stellar Agent" in result.output
|
||||
assert "stellar-agent" in result.output
|
||||
assert "v1.3.0" in result.output
|
||||
|
||||
def test_info_not_found(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
self._patch_catalog(monkeypatch)
|
||||
result = self._invoke(
|
||||
["integration", "info", "does-not-exist"], project
|
||||
)
|
||||
assert result.exit_code == 1
|
||||
assert "not found" in result.output
|
||||
|
||||
def test_info_builtin_not_in_catalog(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
# Empty catalog, but copilot is a registered built-in.
|
||||
self._patch_catalog(monkeypatch, integrations=[])
|
||||
result = self._invoke(["integration", "info", "copilot"], project)
|
||||
assert result.exit_code == 0, result.output
|
||||
assert "Built-in integration" in result.output
|
||||
|
||||
# -- validation vs network guidance ------------------------------------
|
||||
|
||||
def test_search_local_config_error_shows_local_config_tip(
|
||||
self, tmp_path, monkeypatch
|
||||
):
|
||||
"""`integration search` must point at .specify/integration-catalogs.yml
|
||||
for local-config errors (not the generic 'temporarily unavailable')."""
|
||||
project = self._make_project(tmp_path)
|
||||
monkeypatch.setenv("HOME", str(tmp_path))
|
||||
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
||||
monkeypatch.delenv("SPECKIT_INTEGRATION_CATALOG_URL", raising=False)
|
||||
# Corrupt YAML to drive _load_catalog_config -> IntegrationValidationError.
|
||||
cfg = project / ".specify" / "integration-catalogs.yml"
|
||||
invalid_yaml = "catalogs:\n - [bad\n"
|
||||
cfg.write_text(invalid_yaml, encoding="utf-8")
|
||||
|
||||
result = self._invoke(["integration", "search"], project)
|
||||
normalized_output = _normalize_cli_output(result.output)
|
||||
assert result.exit_code == 1, result.output
|
||||
assert "configuration file path shown above" in normalized_output
|
||||
assert ".specify/integration-catalogs.yml" in normalized_output
|
||||
assert "~/.specify/integration-catalogs.yml" in normalized_output
|
||||
assert "temporarily unavailable" not in normalized_output
|
||||
|
||||
def test_search_invalid_env_catalog_url_shows_env_tip(
|
||||
self, tmp_path, monkeypatch
|
||||
):
|
||||
project = self._make_project(tmp_path)
|
||||
monkeypatch.setenv(
|
||||
"SPECKIT_INTEGRATION_CATALOG_URL",
|
||||
"http://insecure.example.com/catalog.json",
|
||||
)
|
||||
|
||||
result = self._invoke(["integration", "search"], project)
|
||||
normalized_output = _normalize_cli_output(result.output)
|
||||
assert result.exit_code == 1, result.output
|
||||
assert "SPECKIT_INTEGRATION_CATALOG_URL environment variable" in normalized_output
|
||||
assert "unset it to use the configured catalog files" in normalized_output
|
||||
assert ".specify/integration-catalogs.yml" in normalized_output
|
||||
assert "~/.specify/integration-catalogs.yml" in normalized_output
|
||||
assert "temporarily unavailable" not in normalized_output
|
||||
|
||||
def test_search_whitespace_env_catalog_url_uses_generic_catalog_tip(
|
||||
self, tmp_path, monkeypatch
|
||||
):
|
||||
project = self._make_project(tmp_path)
|
||||
monkeypatch.setenv("SPECKIT_INTEGRATION_CATALOG_URL", " ")
|
||||
|
||||
from specify_cli.integrations.catalog import (
|
||||
IntegrationCatalog,
|
||||
IntegrationCatalogError,
|
||||
)
|
||||
|
||||
def fail_search(self, **kwargs):
|
||||
raise IntegrationCatalogError("catalog offline")
|
||||
|
||||
monkeypatch.setattr(IntegrationCatalog, "search", fail_search)
|
||||
|
||||
result = self._invoke(["integration", "search"], project)
|
||||
normalized_output = _normalize_cli_output(result.output)
|
||||
assert result.exit_code == 1, result.output
|
||||
assert "temporarily unavailable" in normalized_output
|
||||
assert (
|
||||
"SPECKIT_INTEGRATION_CATALOG_URL environment variable"
|
||||
not in normalized_output
|
||||
)
|
||||
|
||||
def test_info_unknown_with_local_config_error_shows_local_config_tip(
|
||||
self, tmp_path, monkeypatch
|
||||
):
|
||||
"""`integration info <unknown>` falls back to the catalog-error branch
|
||||
and must show local-config guidance, not 'Try again when online'."""
|
||||
project = self._make_project(tmp_path)
|
||||
monkeypatch.setenv("HOME", str(tmp_path))
|
||||
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
||||
monkeypatch.delenv("SPECKIT_INTEGRATION_CATALOG_URL", raising=False)
|
||||
cfg = project / ".specify" / "integration-catalogs.yml"
|
||||
invalid_yaml = "catalogs:\n - [bad\n"
|
||||
cfg.write_text(invalid_yaml, encoding="utf-8")
|
||||
|
||||
result = self._invoke(
|
||||
["integration", "info", "definitely-not-real"], project
|
||||
)
|
||||
normalized_output = _normalize_cli_output(result.output)
|
||||
assert result.exit_code == 1, result.output
|
||||
assert "configuration file path shown above" in normalized_output
|
||||
assert ".specify/integration-catalogs.yml" in normalized_output
|
||||
assert "~/.specify/integration-catalogs.yml" in normalized_output
|
||||
assert "Try again when online" not in normalized_output
|
||||
|
||||
def test_info_unknown_with_invalid_env_catalog_url_shows_env_tip(
|
||||
self, tmp_path, monkeypatch
|
||||
):
|
||||
project = self._make_project(tmp_path)
|
||||
monkeypatch.setenv(
|
||||
"SPECKIT_INTEGRATION_CATALOG_URL",
|
||||
"http://insecure.example.com/catalog.json",
|
||||
)
|
||||
|
||||
result = self._invoke(
|
||||
["integration", "info", "definitely-not-real"], project
|
||||
)
|
||||
normalized_output = _normalize_cli_output(result.output)
|
||||
assert result.exit_code == 1, result.output
|
||||
assert "SPECKIT_INTEGRATION_CATALOG_URL" in normalized_output
|
||||
assert "unset it to use the configured catalog files" in normalized_output
|
||||
assert "Try again when online" not in normalized_output
|
||||
|
||||
# -- catalog list / add / remove ---------------------------------------
|
||||
|
||||
def test_catalog_list_shows_builtin_defaults(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
monkeypatch.setenv("HOME", str(tmp_path))
|
||||
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
||||
monkeypatch.delenv("SPECKIT_INTEGRATION_CATALOG_URL", raising=False)
|
||||
result = self._invoke(["integration", "catalog", "list"], project)
|
||||
assert result.exit_code == 0, result.output
|
||||
assert "Integration Catalog Sources" in result.output
|
||||
assert "No project-level catalog sources configured" in result.output
|
||||
assert "Active catalog sources" in result.output
|
||||
assert "non-removable" in result.output
|
||||
assert "default" in result.output
|
||||
assert "community" in result.output
|
||||
# Built-in defaults are active, but not removable project entries.
|
||||
assert "[0]" not in result.output
|
||||
assert "[1]" not in result.output
|
||||
|
||||
def test_catalog_add_then_remove_roundtrip(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
monkeypatch.setenv("HOME", str(tmp_path))
|
||||
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
||||
monkeypatch.delenv("SPECKIT_INTEGRATION_CATALOG_URL", raising=False)
|
||||
|
||||
add_result = self._invoke(
|
||||
[
|
||||
"integration",
|
||||
"catalog",
|
||||
"add",
|
||||
"https://new.example.com/catalog.json",
|
||||
"--name",
|
||||
"mine",
|
||||
],
|
||||
project,
|
||||
)
|
||||
assert add_result.exit_code == 0, add_result.output
|
||||
assert "Catalog source added" in add_result.output
|
||||
|
||||
cfg_path = project / ".specify" / "integration-catalogs.yml"
|
||||
assert cfg_path.exists()
|
||||
|
||||
list_result = self._invoke(["integration", "catalog", "list"], project)
|
||||
assert list_result.exit_code == 0, list_result.output
|
||||
assert "Project catalog sources" in list_result.output
|
||||
assert "[0]" in list_result.output
|
||||
assert "mine" in list_result.output
|
||||
assert "default" not in list_result.output
|
||||
assert "community" not in list_result.output
|
||||
|
||||
remove_result = self._invoke(
|
||||
["integration", "catalog", "remove", "0"], project
|
||||
)
|
||||
assert remove_result.exit_code == 0, remove_result.output
|
||||
assert "'mine' removed" in remove_result.output
|
||||
|
||||
def test_catalog_list_normalizes_blank_project_catalog_names(
|
||||
self, tmp_path, monkeypatch
|
||||
):
|
||||
project = self._make_project(tmp_path)
|
||||
monkeypatch.setenv("HOME", str(tmp_path))
|
||||
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
||||
monkeypatch.delenv("SPECKIT_INTEGRATION_CATALOG_URL", raising=False)
|
||||
cfg_path = project / ".specify" / "integration-catalogs.yml"
|
||||
cfg_path.write_text(
|
||||
yaml.dump(
|
||||
{
|
||||
"catalogs": [
|
||||
{
|
||||
"url": "https://null-name.example.com/catalog.json",
|
||||
"name": None,
|
||||
},
|
||||
{
|
||||
"url": "https://blank-name.example.com/catalog.json",
|
||||
"name": " ",
|
||||
},
|
||||
]
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
result = self._invoke(["integration", "catalog", "list"], project)
|
||||
normalized_output = _normalize_cli_output(result.output)
|
||||
|
||||
assert result.exit_code == 0, result.output
|
||||
assert "[0] catalog-1" in normalized_output
|
||||
assert "[1] catalog-2" in normalized_output
|
||||
assert "None" not in normalized_output
|
||||
|
||||
def test_catalog_list_env_override_supersedes_project_config(
|
||||
self, tmp_path, monkeypatch
|
||||
):
|
||||
project = self._make_project(tmp_path)
|
||||
monkeypatch.setenv("HOME", str(tmp_path))
|
||||
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
||||
monkeypatch.setenv(
|
||||
"SPECKIT_INTEGRATION_CATALOG_URL",
|
||||
"https://env.example.com/catalog.json",
|
||||
)
|
||||
cfg_path = project / ".specify" / "integration-catalogs.yml"
|
||||
cfg_path.write_text(
|
||||
yaml.dump(
|
||||
{
|
||||
"catalogs": [
|
||||
{
|
||||
"url": "https://project.example.com/catalog.json",
|
||||
"name": "project",
|
||||
"priority": 1,
|
||||
}
|
||||
]
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
result = self._invoke(["integration", "catalog", "list"], project)
|
||||
normalized_output = _normalize_cli_output(result.output)
|
||||
assert result.exit_code == 0, result.output
|
||||
assert "SPECKIT_INTEGRATION_CATALOG_URL is set" in normalized_output
|
||||
assert "supersedes configured catalog files" in normalized_output
|
||||
assert "non-removable" in normalized_output
|
||||
assert "https://env.example.com/catalog.json" in normalized_output
|
||||
assert "https://project.example.com/catalog.json" not in normalized_output
|
||||
assert "[0]" not in normalized_output
|
||||
|
||||
def test_catalog_add_strips_whitespace_in_success_output_and_storage(
|
||||
self, tmp_path, monkeypatch
|
||||
):
|
||||
"""Surrounding whitespace in the URL must not appear in the success
|
||||
message or be persisted to the YAML config."""
|
||||
project = self._make_project(tmp_path)
|
||||
monkeypatch.setenv("HOME", str(tmp_path))
|
||||
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
||||
monkeypatch.delenv("SPECKIT_INTEGRATION_CATALOG_URL", raising=False)
|
||||
|
||||
padded_url = " https://padded.example.com/catalog.json "
|
||||
clean_url = "https://padded.example.com/catalog.json"
|
||||
|
||||
add_result = self._invoke(
|
||||
[
|
||||
"integration",
|
||||
"catalog",
|
||||
"add",
|
||||
padded_url,
|
||||
"--name",
|
||||
"padded",
|
||||
],
|
||||
project,
|
||||
)
|
||||
assert add_result.exit_code == 0, add_result.output
|
||||
assert clean_url in add_result.output
|
||||
assert padded_url not in add_result.output
|
||||
|
||||
cfg_path = project / ".specify" / "integration-catalogs.yml"
|
||||
import yaml as _yaml
|
||||
data = _yaml.safe_load(cfg_path.read_text(encoding="utf-8"))
|
||||
urls = [c["url"] for c in data["catalogs"]]
|
||||
assert clean_url in urls
|
||||
assert padded_url not in urls
|
||||
|
||||
def test_catalog_add_rejects_invalid_url(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
result = self._invoke(
|
||||
[
|
||||
"integration",
|
||||
"catalog",
|
||||
"add",
|
||||
"http://insecure.example.com/catalog.json",
|
||||
],
|
||||
project,
|
||||
)
|
||||
assert result.exit_code == 1
|
||||
assert "HTTPS" in result.output
|
||||
|
||||
def test_catalog_add_rejects_duplicate(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
url = "https://dup.example.com/catalog.json"
|
||||
first = self._invoke(
|
||||
["integration", "catalog", "add", url], project
|
||||
)
|
||||
assert first.exit_code == 0, first.output
|
||||
second = self._invoke(
|
||||
["integration", "catalog", "add", url], project
|
||||
)
|
||||
assert second.exit_code == 1
|
||||
assert "already configured" in second.output
|
||||
|
||||
def test_catalog_remove_out_of_range(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
# Need a config file for remove to attempt an index lookup
|
||||
self._invoke(
|
||||
[
|
||||
"integration",
|
||||
"catalog",
|
||||
"add",
|
||||
"https://only.example.com/catalog.json",
|
||||
],
|
||||
project,
|
||||
)
|
||||
result = self._invoke(
|
||||
["integration", "catalog", "remove", "9"], project
|
||||
)
|
||||
assert result.exit_code == 1
|
||||
assert "out of range" in result.output
|
||||
|
||||
def test_catalog_remove_without_config(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
result = self._invoke(
|
||||
["integration", "catalog", "remove", "0"], project
|
||||
)
|
||||
assert result.exit_code == 1
|
||||
assert "No catalog config" in result.output
|
||||
|
||||
def test_catalog_remove_final_entry_restores_defaults(
|
||||
self, tmp_path, monkeypatch
|
||||
):
|
||||
"""End-to-end: add → remove-last-entry → list should not error.
|
||||
|
||||
Regression for the flow where a user adds a catalog, removes it, then
|
||||
runs any follow-up integration command. Without the fix the config
|
||||
file would be left as `catalogs: []` and every subsequent
|
||||
`integration` call would fail with "contains no 'catalogs' entries".
|
||||
"""
|
||||
project = self._make_project(tmp_path)
|
||||
monkeypatch.setenv("HOME", str(tmp_path))
|
||||
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
||||
monkeypatch.delenv("SPECKIT_INTEGRATION_CATALOG_URL", raising=False)
|
||||
|
||||
add = self._invoke(
|
||||
[
|
||||
"integration",
|
||||
"catalog",
|
||||
"add",
|
||||
"https://only.example.com/catalog.json",
|
||||
"--name",
|
||||
"only",
|
||||
],
|
||||
project,
|
||||
)
|
||||
assert add.exit_code == 0, add.output
|
||||
|
||||
remove = self._invoke(
|
||||
["integration", "catalog", "remove", "0"], project
|
||||
)
|
||||
assert remove.exit_code == 0, remove.output
|
||||
assert "'only' removed" in remove.output
|
||||
|
||||
cfg_path = project / ".specify" / "integration-catalogs.yml"
|
||||
assert not cfg_path.exists(), (
|
||||
"config file should be deleted when the final catalog is removed"
|
||||
)
|
||||
|
||||
# Follow-up command must succeed and show the built-in defaults,
|
||||
# not error out on "contains no 'catalogs' entries".
|
||||
listing = self._invoke(["integration", "catalog", "list"], project)
|
||||
assert listing.exit_code == 0, listing.output
|
||||
assert "default" in listing.output
|
||||
assert "community" in listing.output
|
||||
|
||||
Reference in New Issue
Block a user