--- name: terminal-operation description: Shell 命令执行、后台进程管理和 Python 代码执行。支持超时控制和后台运行。 tools: - terminal - process - execute_code --- # Terminal Operation ## Overview Shell 命令执行、后台进程管理和 Python 代码执行。支持超时控制和后台运行。 ## When to Use - Use when the task requires Terminal Operation guidance. ## Required Tools - `terminal` - `process` - `execute_code` ## Workflow - Identify whether the user's request matches the skill's trigger conditions. - Read the relevant source guidance below and apply only the steps that fit the current task. - Use the required tools deliberately and keep tool output tied to the user's goal. ### Source Guidance ### Terminal Operation — 终端与进程管理 Shell 命令执行、后台进程管理和 Python 代码执行工具集。 #### 工具说明 ##### terminal 执行 shell 命令。 - `command` (str): 要执行的命令 - `working_dir` (str, 默认 "."): 工作目录 - `timeout` (int, 默认 60): 超时秒数(最大 600) - `background` (bool, 默认 false): 是否后台运行 - 后台运行时返回 process_id,可通过 process 工具管理 ##### process 管理后台进程。 - `action` (str): `list` | `log` | `kill` - `process_id` (str | None): 进程 ID - `list`: 列出所有后台进程 - `log`: 查看进程日志(最后 12000 字节) - `kill`: 终止进程(先 SIGTERM,5 秒后 SIGKILL) ##### execute_code 执行 Python 代码片段。 - `code` (str): Python 代码 - `language` (str, 默认 "python"): 仅支持 python - `timeout` (int, 默认 30, 最大 120): 执行超时 - `working_dir` (str, 默认 "."): 工作目录 - 适合快速验证脚本逻辑,不适合长期运行任务 #### 使用原则 1. 长期运行任务使用 `background=true` 2. 执行危险命令(rm -rf、dd、格式化等)前必须确认用户意图 3. `execute_code` 适合轻量脚本验证,重型任务用 `terminal` 4. 后台进程用完后及时 kill 清理 5. 注意命令注入风险,不要直接拼接用户输入 ## Validation - Verify the requested outcome with the most direct available check. - Report any skipped step, unavailable dependency, or remaining uncertainty explicitly. ## Boundaries - Do not broaden the task beyond the user's request. - Do not use tools that are not listed or clearly available in the current runtime. ## Anti-Patterns - Do not summarize the skill instead of applying it. - Do not claim completion without validation evidence.