Execute the /attach command.
(self, **kwargs: Any)
| 69 | ] |
| 70 | |
| 71 | async def execute(self, **kwargs: Any) -> CommandResult: |
| 72 | """Execute the /attach command.""" |
| 73 | chat_context = kwargs.get("chat_context") |
| 74 | if not chat_context: |
| 75 | return CommandResult( |
| 76 | success=False, |
| 77 | error="Attach command requires chat context.", |
| 78 | ) |
| 79 | |
| 80 | # Parse arguments |
| 81 | args_val = kwargs.get("args", "") |
| 82 | if isinstance(args_val, list): |
| 83 | args_str = " ".join(str(a) for a in args_val) |
| 84 | else: |
| 85 | args_str = str(args_val).strip() if args_val else "" |
| 86 | |
| 87 | if not args_str: |
| 88 | return self._show_usage() |
| 89 | |
| 90 | parts = args_str.split() |
| 91 | action = parts[0].lower() |
| 92 | |
| 93 | # Subcommands |
| 94 | if action == "list": |
| 95 | return self._list_staged(chat_context) |
| 96 | if action == "clear": |
| 97 | return self._clear_staged(chat_context) |
| 98 | |
| 99 | # Treat all parts as file paths to stage |
| 100 | return self._stage_files(chat_context, parts) |
| 101 | |
| 102 | # ── Subcommand handlers ────────────────────────────────────────────── |
| 103 |
nothing calls this directly
no test coverage detected