Repository navigation
Description
Summary
SPECKIT_INTEGRATION_CATALOG_URL is documented as replacing the configured catalog stack: IntegrationCatalog.get_active_catalogs returns only the environment source, and specify integration catalog list prints that source under "Active catalog source from environment (non-removable here)" together with "Project/user catalog sources are not active while the env override is set." specify integration catalog remove does not apply the same rule. It reads .specify/integration-catalogs.yml directly, so remove 0 deletes the highest-priority project source even though no index was shown for it and the active stack never contained it. A user who removes the one entry they can see in the list destroys a different, hidden entry.
Environment
Spec Kit CLI 1.2.2.dev0 at commit 1c799bda6c13 (the same code is on main at a4d5712), Python 3.12, Linux aarch64. A project containing .specify/integration-catalogs.yml with two project sources, and SPECKIT_INTEGRATION_CATALOG_URL set to a custom catalog URL.
Expected behavior
While the environment override is active, catalog remove should refuse to modify the project layer, matching catalog list: either remove only an entry of the active stack (and the environment source is non-removable) or exit with an error saying that the project sources are inactive and the override must be unset first. The project YAML should be left untouched.
Actual behavior
$ SPECKIT_INTEGRATION_CATALOG_URL=https://env.example.com/catalog.json specify integration catalog list
Integration Catalog Sources:
SPECKIT_INTEGRATION_CATALOG_URL is set; it supersedes configured catalog files.
Project/user catalog sources are not active while the env override is set.
Active catalog source from environment (non-removable here):
- custom — install allowed
https://env.example.com/catalog.json
Custom catalog via SPECKIT_INTEGRATION_CATALOG_URL
$ cat .specify/integration-catalogs.yml
catalogs:
- name: project-team
url: https://project.example.com/catalog.json
priority: 7
install_allowed: false
- name: project-other
url: https://other.example.com/catalog.json
priority: 9
install_allowed: false
$ SPECKIT_INTEGRATION_CATALOG_URL=https://env.example.com/catalog.json specify integration catalog remove 0
✓ Catalog source 'project-team' removed
$ cat .specify/integration-catalogs.yml
catalogs:
- name: project-other
url: https://other.example.com/catalog.json
priority: 9
install_allowed: false
The environment source is still listed as the only active source, and the project source that was never displayed is gone.
Root cause
src/specify_cli/integrations/catalog/command_remove.py calls IntegrationCatalog.remove_catalog(index) without looking at SPECKIT_INTEGRATION_CATALOG_URL. IntegrationCatalog.remove_catalog (src/specify_cli/integrations/__init__.py:682) opens self.project_root / ".specify" / "integration-catalogs.yml" and indexes the project entries by their display order; it never calls get_active_catalogs. command_list.py does check the variable and branches on it, so the two commands disagree about which layer is active. The docstring of remove_catalog says the index is "the same display order shown by integration catalog list", which is false while the override is set.
Suggested fix
In command_remove.py, read os.environ.get("SPECKIT_INTEGRATION_CATALOG_URL", "").strip() the way command_list.py does, and when it is non-empty print an error such as "SPECKIT_INTEGRATION_CATALOG_URL is set; project and user catalog sources are not active and cannot be removed" and exit 1. Alternatively, give remove_catalog the resolved active stack and index into that. Add a regression test next to the other contract tests: with a two-entry project config and the environment variable set, remove_catalog(0) must raise IntegrationValidationError and the YAML must be unchanged, while the same call with the variable unset still removes the first entry.
Activity
media-ctrl commentedon Nov 23, 2026
remove_catalog's own docstring states the invariant this breaks (src/specify_cli/integrations/__init__.py:695): the index a user sees incatalog listis the index they pass toremove. The env branch ofget_active_catalogs(:267) makes that false.catalog listrenders the env entry at index 0, whileremove_catalogre-sorts the project YAML and deletes its highest-priority entry, which the user was never shown.catalog addhas the same shape and has not been reported.add_catalog(:571) writes.specify/integration-catalogs.ymlwith no env check, so under the override it appends a source the active stack will never read, then prints success. Both writers want one pre-check: if the override is set, refuse and name it.On tests, every catalog test clears the variable first (
test_command_add.py:17,test_command_list.py:29,test_command_remove.py:52,test_catalog.py:148callmonkeypatch.delenv), so the combination has no coverage at all. The regression that would have caught this isremove 0with the override set, asserting the YAML is unchanged byte for byte and the exit code non-zero.