Skip to content

Commit dda838c

Browse files
committed
fix(plugins): fallback to Claude's known_marketplaces for browse
When browsing a marketplace not in plugin_repos.json, read the actual source URL from Claude's ~/.claude/plugins/known_marketplaces.json. This handles cases like every-marketplace where: - Marketplace name: every-marketplace - Actual repo: EveryInc/compounding-engineering-plugin - (GitHub redirects every-marketplace -> compounding-engineering-plugin)
1 parent e2d7fbb commit dda838c

1 file changed

Lines changed: 40 additions & 8 deletions

File tree

code_assistant_manager/cli/plugin_commands.py

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -495,28 +495,60 @@ def browse_marketplace(
495495
Use --query to search by name/description, --category to filter by category.
496496
"""
497497
manager = PluginManager()
498+
handler = _get_handler()
498499

499500
# Get the marketplace repo config
500501
repo = manager.get_repo(marketplace)
501-
if not repo:
502+
503+
# If not in our config, try to get URL from Claude's known_marketplaces.json
504+
repo_owner = None
505+
repo_name = None
506+
repo_branch = "main"
507+
508+
if repo and repo.repo_owner and repo.repo_name:
509+
repo_owner = repo.repo_owner
510+
repo_name = repo.repo_name
511+
repo_branch = repo.repo_branch
512+
else:
513+
# Try to extract from Claude's known marketplaces
514+
known_file = handler.known_marketplaces_file
515+
if known_file.exists():
516+
import json
517+
518+
try:
519+
with open(known_file, "r") as f:
520+
known = json.load(f)
521+
if marketplace in known:
522+
source_url = known[marketplace].get("source", {}).get("url", "")
523+
# Parse URL like https://github.com/owner/repo.git
524+
if "github.com" in source_url:
525+
from code_assistant_manager.plugins.fetch import (
526+
parse_github_url,
527+
)
528+
529+
parsed = parse_github_url(source_url)
530+
if parsed:
531+
repo_owner, repo_name, repo_branch = parsed
532+
except Exception:
533+
pass
534+
535+
if not repo_owner or not repo_name:
502536
typer.echo(
503-
f"{Colors.RED}✗ Marketplace '{marketplace}' not found.{Colors.RESET}"
537+
f"{Colors.RED}✗ Marketplace '{marketplace}' not found in config or Claude.{Colors.RESET}"
504538
)
505539
typer.echo(f"\n{Colors.CYAN}Available repos:{Colors.RESET}")
506540
for name in manager.get_all_repos():
507541
typer.echo(f" • {name}")
542+
typer.echo(f"\n{Colors.CYAN}Installed marketplaces:{Colors.RESET}")
543+
for name in handler.get_known_marketplaces():
544+
typer.echo(f" • {name}")
508545
raise typer.Exit(1)
509546

510547
typer.echo(f"{Colors.CYAN}Fetching plugins from {marketplace}...{Colors.RESET}")
511548

512-
# Fetch marketplace info
513-
if not repo.repo_owner or not repo.repo_name:
514-
typer.echo(f"{Colors.RED}✗ Repo missing owner/name info.{Colors.RESET}")
515-
raise typer.Exit(1)
516-
517549
from code_assistant_manager.plugins.fetch import fetch_repo_info
518550

519-
info = fetch_repo_info(repo.repo_owner, repo.repo_name, repo.repo_branch)
551+
info = fetch_repo_info(repo_owner, repo_name, repo_branch)
520552
if not info or not info.plugins:
521553
typer.echo(f"{Colors.RED}✗ Could not fetch plugins from repo.{Colors.RESET}")
522554
raise typer.Exit(1)

0 commit comments

Comments
 (0)