Skip to content

Commit 56f5446

Browse files
committed
chore: update workspace
1 parent c20403c commit 56f5446

File tree

1 file changed

+68
-64
lines changed

1 file changed

+68
-64
lines changed

code_assistant_manager/cli/agents_commands.py

Lines changed: 68 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -232,28 +232,25 @@ def install_agent(
232232
"claude",
233233
"--app",
234234
"-a",
235-
help="App type to install to (claude, codex, gemini, droid, codebuddy)",
235+
help="App type(s) to install to (claude, codex, gemini, droid, codebuddy, all). Comma-separated.",
236236
),
237237
):
238-
"""Install an agent to an app's agents directory."""
239-
# Validate app type
240-
if app_type not in VALID_APP_TYPES:
241-
typer.echo(
242-
f"{Colors.RED}✗ Invalid value '{app_type}' for --app. "
243-
f"Valid: {', '.join(VALID_APP_TYPES)}{Colors.RESET}"
244-
)
245-
raise typer.Exit(1)
238+
"""Install an agent to one or more app's agents directories."""
239+
target_apps = resolve_app_targets(app_type, VALID_APP_TYPES, default="claude")
246240

247241
manager = _get_agent_manager()
248242

249-
try:
250-
handler = manager.get_handler(app_type)
251-
dest_path = manager.install(agent_key, app_type)
252-
typer.echo(f"{Colors.GREEN}✓ Agent installed: {agent_key}{Colors.RESET}")
253-
typer.echo(f" {Colors.CYAN}Location:{Colors.RESET} {handler.agents_dir}")
254-
except ValueError as e:
255-
typer.echo(f"{Colors.RED}✗ Error: {e}{Colors.RESET}")
256-
raise typer.Exit(1)
243+
for app in target_apps:
244+
try:
245+
handler = manager.get_handler(app)
246+
dest_path = manager.install(agent_key, app)
247+
typer.echo(
248+
f"{Colors.GREEN}✓ Agent installed to {app}: {agent_key}{Colors.RESET}"
249+
)
250+
typer.echo(f" {Colors.CYAN}Location:{Colors.RESET} {handler.agents_dir}")
251+
except ValueError as e:
252+
typer.echo(f"{Colors.RED}✗ Error installing to {app}: {e}{Colors.RESET}")
253+
raise typer.Exit(1)
257254

258255

259256
@agent_app.command("uninstall")
@@ -263,18 +260,12 @@ def uninstall_agent(
263260
"claude",
264261
"--app",
265262
"-a",
266-
help="App type to uninstall from (claude, codex, gemini, droid, codebuddy)",
263+
help="App type(s) to uninstall from (claude, codex, gemini, droid, codebuddy, all). Comma-separated.",
267264
),
268265
force: bool = typer.Option(False, "--force", "-f", help="Skip confirmation"),
269266
):
270-
"""Uninstall an agent from an app's agents directory."""
271-
# Validate app type
272-
if app_type not in VALID_APP_TYPES:
273-
typer.echo(
274-
f"{Colors.RED}✗ Invalid value '{app_type}' for --app. "
275-
f"Valid: {', '.join(VALID_APP_TYPES)}{Colors.RESET}"
276-
)
277-
raise typer.Exit(1)
267+
"""Uninstall an agent from one or more app's agents directories."""
268+
target_apps = resolve_app_targets(app_type, VALID_APP_TYPES, default="claude")
278269

279270
manager = _get_agent_manager()
280271
agent = manager.get(agent_key)
@@ -286,12 +277,17 @@ def uninstall_agent(
286277
if not force:
287278
typer.confirm(f"Uninstall agent '{agent.name}' ({agent_key})?", abort=True)
288279

289-
try:
290-
manager.uninstall(agent_key, app_type)
291-
typer.echo(f"{Colors.GREEN}✓ Agent uninstalled: {agent_key}{Colors.RESET}")
292-
except ValueError as e:
293-
typer.echo(f"{Colors.RED}✗ Error: {e}{Colors.RESET}")
294-
raise typer.Exit(1)
280+
for app in target_apps:
281+
try:
282+
manager.uninstall(agent_key, app)
283+
typer.echo(
284+
f"{Colors.GREEN}✓ Agent uninstalled from {app}: {agent_key}{Colors.RESET}"
285+
)
286+
except ValueError as e:
287+
typer.echo(
288+
f"{Colors.RED}✗ Error uninstalling from {app}: {e}{Colors.RESET}"
289+
)
290+
raise typer.Exit(1)
295291

296292

297293
@agent_app.command("repos")
@@ -425,50 +421,58 @@ def list_installed_agents(
425421
@agent_app.command("uninstall-all")
426422
def uninstall_all_agents(
427423
app_type: str = typer.Option(
428-
"claude",
424+
...,
429425
"--app",
430426
"-a",
431-
help="App type to uninstall all agents from",
427+
help="App type(s) to uninstall all agents from (claude, codex, gemini, droid, codebuddy, all). Comma-separated.",
432428
),
433429
force: bool = typer.Option(False, "--force", "-f", help="Skip confirmation"),
434430
):
435-
"""Uninstall all agents."""
431+
"""Uninstall all agents from one or more apps."""
432+
target_apps = resolve_app_targets(app_type, VALID_APP_TYPES)
436433
manager = _get_agent_manager()
437434

438-
try:
439-
handler = manager.get_handler(app_type)
440-
except ValueError as e:
441-
typer.echo(f"{Colors.RED}✗ Error: {e}{Colors.RESET}")
442-
raise typer.Exit(1)
443-
444-
agents_dir = handler.agents_dir
445-
if not agents_dir.exists():
446-
typer.echo(f"{Colors.YELLOW}No agents directory found{Colors.RESET}")
447-
return
435+
for app in target_apps:
436+
try:
437+
handler = manager.get_handler(app)
438+
except ValueError as e:
439+
typer.echo(f"{Colors.RED}✗ Error: {e}{Colors.RESET}")
440+
continue
448441

449-
agent_files = list(agents_dir.glob("*.md"))
450-
if not agent_files:
451-
typer.echo(f"{Colors.YELLOW}No agents installed{Colors.RESET}")
452-
return
442+
agents_dir = handler.agents_dir
443+
if not agents_dir.exists():
444+
typer.echo(
445+
f"{Colors.YELLOW}No agents directory found for {app}{Colors.RESET}"
446+
)
447+
continue
453448

454-
if not force:
455-
typer.confirm(
456-
f"Uninstall all {len(agent_files)} agents from {app_type}?", abort=True
457-
)
449+
agent_files = list(agents_dir.glob("*.md"))
450+
if not agent_files:
451+
typer.echo(f"{Colors.YELLOW}No agents installed for {app}{Colors.RESET}")
452+
continue
458453

459-
removed_count = 0
460-
for agent_file in agent_files:
461-
try:
462-
agent_file.unlink()
463-
typer.echo(f" {Colors.GREEN}{Colors.RESET} Removed: {agent_file.name}")
464-
removed_count += 1
465-
except Exception as e:
466-
typer.echo(
467-
f" {Colors.RED}{Colors.RESET} Failed to remove {agent_file.name}: {e}"
454+
if not force:
455+
typer.confirm(
456+
f"Uninstall all {len(agent_files)} agents from {app}?", abort=True
468457
)
469458

470-
manager.sync_installed_status(app_type)
471-
typer.echo(f"\n{Colors.GREEN}✓ Removed {removed_count} agents{Colors.RESET}")
459+
removed_count = 0
460+
for agent_file in agent_files:
461+
try:
462+
agent_file.unlink()
463+
typer.echo(
464+
f" {Colors.GREEN}{Colors.RESET} Removed: {agent_file.name}"
465+
)
466+
removed_count += 1
467+
except Exception as e:
468+
typer.echo(
469+
f" {Colors.RED}{Colors.RESET} Failed to remove {agent_file.name}: {e}"
470+
)
471+
472+
manager.sync_installed_status(app)
473+
typer.echo(
474+
f"\n{Colors.GREEN}✓ Removed {removed_count} agents from {app}{Colors.RESET}"
475+
)
472476

473477

474478
# Add list shorthand

0 commit comments

Comments
 (0)