Skip to content

Commit 85437d5

Browse files
committed
Fix: Allow marketplace update without name to update all marketplaces for CodeBuddy
The CodeBuddy CLI requires a specific marketplace name for the update command, unlike Claude which supports updating all if no name is specified. This fix handles the case when no name is provided by: 1. Getting the list of all known marketplaces 2. Updating each marketplace individually 3. Reporting success/failure status This aligns with the documented behavior: 'cam plugin marketplace update' without a name should update all marketplaces.
1 parent a9bfd2c commit 85437d5

1 file changed

Lines changed: 33 additions & 9 deletions

File tree

code_assistant_manager/plugins/codebuddy.py

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,40 @@ def marketplace_update(self, name: Optional[str] = None) -> Tuple[bool, str]:
131131
Returns:
132132
Tuple of (success, message)
133133
"""
134-
args = ["marketplace", "update"]
135134
if name:
136-
args.append(name)
137-
code, stdout, stderr = self._run_codebuddy_cli(*args)
138-
if code == 0:
139-
return True, stdout.strip() or "Marketplaces updated"
140-
return (
141-
False,
142-
stderr.strip() or stdout.strip() or "Failed to update marketplaces",
143-
)
135+
# Update specific marketplace
136+
args = ["marketplace", "update", name]
137+
code, stdout, stderr = self._run_codebuddy_cli(*args)
138+
if code == 0:
139+
return True, stdout.strip() or f"Marketplace '{name}' updated"
140+
return (
141+
False,
142+
stderr.strip()
143+
or stdout.strip()
144+
or f"Failed to update marketplace '{name}'",
145+
)
146+
else:
147+
# Update all marketplaces
148+
marketplaces = self.get_known_marketplaces()
149+
if not marketplaces:
150+
return True, "No marketplaces to update"
151+
152+
failed = []
153+
for marketplace_name in marketplaces.keys():
154+
args = ["marketplace", "update", marketplace_name]
155+
code, stdout, stderr = self._run_codebuddy_cli(*args)
156+
if code != 0:
157+
failed.append(marketplace_name)
158+
logger.warning(
159+
f"Failed to update marketplace '{marketplace_name}': {stderr}"
160+
)
161+
162+
if failed:
163+
return (
164+
False,
165+
f"Updated {len(marketplaces) - len(failed)}/{len(marketplaces)} marketplaces. Failed: {', '.join(failed)}",
166+
)
167+
return True, f"Updated all {len(marketplaces)} marketplace(s)"
144168

145169
def get_known_marketplaces(self) -> Dict[str, Any]:
146170
"""Get known marketplaces from the JSON file.

0 commit comments

Comments
 (0)