Fix collections CLI to handle API's expanded tool format
The API returns tools as objects with owner/name fields, but the CLI expected string refs. Now handles both formats correctly. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
2b927478a6
commit
ae6ec7cea1
|
|
@ -103,8 +103,15 @@ def _cmd_collections_info(args):
|
|||
print(f"Tags: {', '.join(tags)}")
|
||||
|
||||
print(f"\nTools ({len(tools)}):")
|
||||
for tool_ref in tools:
|
||||
version_constraint = pinned.get(tool_ref, "")
|
||||
for tool in tools:
|
||||
# Handle both object format (from API) and string format
|
||||
if isinstance(tool, dict):
|
||||
tool_ref = f"{tool['owner']}/{tool['name']}"
|
||||
version_constraint = tool.get('pinned_version', '')
|
||||
else:
|
||||
tool_ref = tool
|
||||
version_constraint = pinned.get(tool_ref, '')
|
||||
|
||||
if version_constraint:
|
||||
print(f" - {tool_ref} @ {version_constraint}")
|
||||
else:
|
||||
|
|
@ -156,8 +163,15 @@ def _cmd_collections_install(args):
|
|||
installed = 0
|
||||
failed = 0
|
||||
|
||||
for tool_ref in tools:
|
||||
version = pinned.get(tool_ref)
|
||||
for tool in tools:
|
||||
# Handle both object format (from API) and string format
|
||||
if isinstance(tool, dict):
|
||||
tool_ref = f"{tool['owner']}/{tool['name']}"
|
||||
version = tool.get('pinned_version') if use_pinned else None
|
||||
else:
|
||||
tool_ref = tool
|
||||
version = pinned.get(tool_ref) if use_pinned else None
|
||||
|
||||
try:
|
||||
print(f" Installing {tool_ref}...", end=" ", flush=True)
|
||||
resolved = install_from_registry(tool_ref, version)
|
||||
|
|
|
|||
Loading…
Reference in New Issue