Execute the cmd command.
(self, **kwargs: Any)
| 99 | return True |
| 100 | |
| 101 | async def execute(self, **kwargs: Any) -> CommandResult: |
| 102 | """Execute the cmd command.""" |
| 103 | tool_manager = kwargs.get("tool_manager") |
| 104 | |
| 105 | tool = kwargs.get("tool") |
| 106 | tool_args = kwargs.get("tool_args") |
| 107 | input_file = kwargs.get("input_file") |
| 108 | output_file = kwargs.get("output_file") |
| 109 | prompt = kwargs.get("prompt") |
| 110 | system_prompt = kwargs.get("system_prompt") |
| 111 | raw = kwargs.get("raw", False) |
| 112 | single_turn = kwargs.get("single_turn", False) |
| 113 | max_turns = kwargs.get("max_turns", 100) |
| 114 | |
| 115 | # Branch 1: Tool direct execution |
| 116 | if tool: |
| 117 | return await self._execute_tool_direct( |
| 118 | tool_manager=tool_manager, |
| 119 | tool_name=tool, |
| 120 | tool_args_json=tool_args, |
| 121 | output_file=output_file, |
| 122 | raw=raw, |
| 123 | ) |
| 124 | |
| 125 | # Branch 2: Prompt / LLM mode |
| 126 | if prompt or input_file: |
| 127 | return await self._execute_prompt_mode( |
| 128 | tool_manager=tool_manager, |
| 129 | model_manager=kwargs.get("model_manager"), |
| 130 | input_file=input_file, |
| 131 | output_file=output_file, |
| 132 | prompt=prompt, |
| 133 | system_prompt=system_prompt, |
| 134 | raw=raw, |
| 135 | single_turn=single_turn, |
| 136 | max_turns=max_turns, |
| 137 | ) |
| 138 | |
| 139 | # Branch 3: No operation specified |
| 140 | return CommandResult( |
| 141 | success=False, |
| 142 | error="No operation specified. Use --tool or --prompt/--input", |
| 143 | ) |
| 144 | |
| 145 | # ── tool direct execution ──────────────────────────────────────── |
| 146 |
nothing calls this directly
no test coverage detected