Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 0 additions & 5 deletions docs/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -589,11 +589,6 @@ section.collapsed .grid {
border-color: #d1d5db;
}

.pack-eval-badge.is-federated {
color: #1e40af;
background: #dbeafe;
border-color: #60a5fa;
}

.pack-eval-divider {
width: 100%;
Expand Down
26 changes: 13 additions & 13 deletions scripts/generate_pack_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ def detect_repo_license(repo_root: Path, pack_path: str = ".") -> str:
return "Unknown"


def load_federated_packs() -> List[Dict[str, Any]]:
def load_repository_packs() -> List[Dict[str, Any]]:
"""Clone each marketplace module and return it as a standalone pack entry."""
import shutil
import subprocess
import tempfile

modules = pack_registry.load_federated_modules()
modules = pack_registry.load_repository_modules()
if not modules:
return []

repo_root = Path(__file__).resolve().parent.parent
packs: List[Dict[str, Any]] = []
tmp = Path(tempfile.mkdtemp(prefix="federated-build-"))
tmp = Path(tempfile.mkdtemp(prefix="repository-build-"))

try:
for mod in modules:
Expand All @@ -120,12 +120,12 @@ def load_federated_packs() -> List[Dict[str, Any]]:
pack_path = mod.get("path", ".")

if not repository:
print(f" Warning: federated module '{name}' missing repository, skipping")
print(f" Warning: repository module '{name}' missing repository, skipping")
continue

ref_err = pack_registry.federation_ref_error(ref)
ref_err = pack_registry.repository_ref_error(ref)
if ref_err:
print(f" Warning: federated module '{name}' invalid ref: {ref_err}")
print(f" Warning: repository module '{name}' invalid ref: {ref_err}")
continue

clone_dest = tmp / name
Expand All @@ -135,7 +135,7 @@ def load_federated_packs() -> List[Dict[str, Any]]:
check=True, capture_output=True, text=True, timeout=120,
)
subprocess.run(
["git", "checkout", "--quiet", pack_registry.normalize_federation_ref(ref)],
["git", "checkout", "--quiet", pack_registry.normalize_repository_ref(ref)],
check=True, capture_output=True, text=True, cwd=clone_dest, timeout=30,
)
except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as exc:
Expand All @@ -146,7 +146,7 @@ def load_federated_packs() -> List[Dict[str, Any]]:
license_id = detect_repo_license(clone_dest, pack_path)
skills = parse_skills(str(pack_dir))

# Read catalog from the cloned source repo (not from a local federation/ mirror)
# Read catalog from the cloned source repo
cat_bundle, cat_warns = bundle_catalog_for_site(pack_path, clone_dest)
for w in cat_warns:
print(f" ⚠️ {w}")
Expand All @@ -169,7 +169,7 @@ def load_federated_packs() -> List[Dict[str, Any]]:
"name": name,
"path": repository,
"repository": repository,
"ref": pack_registry.normalize_federation_ref(ref)[:12],
"ref": pack_registry.normalize_repository_ref(ref)[:12],
"icon": mod.get("icon", ""),
"plugin": {
"name": name,
Expand Down Expand Up @@ -210,10 +210,10 @@ def generate_pack_data() -> List[Dict[str, Any]]:
"""
packs = []

federated = load_federated_packs()
if federated:
packs.extend(federated)
print(f"✓ Added {len(federated)} marketplace pack(s)")
repository_packs = load_repository_packs()
if repository_packs:
packs.extend(repository_packs)
print(f"✓ Added {len(repository_packs)} marketplace pack(s)")

return packs

Expand Down
18 changes: 9 additions & 9 deletions scripts/pack_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,40 +66,40 @@ def load_marketplace_module_by_path(
return None


FEDERATION_REF_SHA_RE = re.compile(r"^[0-9a-f]{40}$", re.IGNORECASE)
REPOSITORY_REF_SHA_RE = re.compile(r"^[0-9a-f]{40}$", re.IGNORECASE)


def federation_ref_error(ref: Any) -> Optional[str]:
def repository_ref_error(ref: Any) -> Optional[str]:
"""Return an error message when *ref* is set but not a 40-character commit SHA."""
if ref is None or not str(ref).strip():
return None # absent ref → defaults to main branch
value = str(ref).strip()
if not FEDERATION_REF_SHA_RE.fullmatch(value):
if not REPOSITORY_REF_SHA_RE.fullmatch(value):
return (
f"ref must be a 40-character commit SHA, not a branch or tag (got {value!r})"
)
return None


def normalize_federation_ref(ref: Any) -> str:
def normalize_repository_ref(ref: Any) -> str:
"""Return a lowercase 40-character commit SHA, or 'main' when ref is absent."""
err = federation_ref_error(ref)
err = repository_ref_error(ref)
if err:
raise ValueError(err)
value = str(ref).strip() if ref is not None else ""
return value.lower() if value else "main"


def validate_federated_module_entry(module: Dict[str, Any]) -> List[str]:
"""Return validation errors for a federated marketplace module entry."""
def validate_repository_module_entry(module: Dict[str, Any]) -> List[str]:
"""Return validation errors for a repository marketplace module entry."""
name = module.get("name") or "<unknown>"
err = federation_ref_error(module.get("ref"))
err = repository_ref_error(module.get("ref"))
if err:
return [f"{name}: {err}"]
return []


def load_federated_modules(
def load_repository_modules(
marketplace_path: Optional[Path] = None,
) -> List[Dict[str, Any]]:
"""Return all marketplace modules that have an external repository."""
Expand Down
Loading