Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/specify_cli/presets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import copy
import json
import hashlib
import logging
import os
import tempfile
import shutil
Expand Down Expand Up @@ -54,6 +55,8 @@
verify_archive_sha256,
)

logger = logging.getLogger(__name__)


_CONSTITUTION_PROVENANCE_FILE = ".constitution-template.json"

Expand Down Expand Up @@ -4256,18 +4259,15 @@ def get_active_catalogs(self) -> List[PresetCatalogEntry]:
Raises:
PresetValidationError: If a catalog URL is invalid
"""
import sys

# 1. SPECKIT_PRESET_CATALOG_URL env var replaces all defaults
if env_value := os.environ.get("SPECKIT_PRESET_CATALOG_URL"):
catalog_url = env_value.strip()
self._validate_catalog_url(catalog_url)
if catalog_url != self.DEFAULT_CATALOG_URL:
if not getattr(self, "_non_default_catalog_warning_shown", False):
print(
"Warning: Using non-default preset catalog. "
logger.warning(
"Using non-default preset catalog. "
"Only use catalogs from sources you trust.",
file=sys.stderr,
)
self._non_default_catalog_warning_shown = True
return [PresetCatalogEntry(url=catalog_url, name="custom", priority=1, install_allowed=True, description="Custom catalog via SPECKIT_PRESET_CATALOG_URL")]
Expand Down