mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 09:17:53 +00:00
rename shell tool more intuitively as run_shell_command (from historical name of execute_bash_command inherited from terminal tool) (#869)
This commit is contained in:
@@ -44,7 +44,7 @@ A typical interaction with the Gemini CLI follows this general flow:
|
||||
5. **Tool Execution (if applicable):**
|
||||
- If the Gemini API requests a tool, the Core package prepares to execute it.
|
||||
- **User Confirmation for Potentially Impactful Tools:** If the requested tool can modify the file system (e.g., file edits, writes) or execute shell commands, the CLI (`packages/cli`) displays a confirmation prompt to the user. This prompt details the tool and its arguments, and the user must approve the execution. Read-only operations (e.g., reading files, listing directories) may not always require this explicit confirmation step.
|
||||
- If confirmed (or if confirmation is not required for the specific tool), the Core package identifies and executes the relevant tool (e.g., `read_file`, `execute_bash_command`).
|
||||
- If confirmed (or if confirmation is not required for the specific tool), the Core package identifies and executes the relevant tool (e.g., `read_file`, `run_shell_command`).
|
||||
- The tool performs its action (e.g., reads a file from the disk).
|
||||
- The result of the tool execution is sent back to the Gemini API by the Core.
|
||||
- The Gemini API processes the tool result and generates a final response.
|
||||
|
||||
@@ -114,6 +114,6 @@ The `!` prefix provides a powerful way to interact with your system's shell dire
|
||||
- Type your shell commands (e.g., `cd my_project`, `npm run dev`, `cat file.txt`).
|
||||
- Type `!` and press Enter again to exit Shell Mode.
|
||||
|
||||
- **Caution for all `!` usage:** Be mindful of the commands you execute, as they have the same permissions and impact as if you ran them directly in your terminal. The Shell Mode feature does not inherently add extra sandboxing beyond what's already configured for the underlying `execute_bash_command` tool.
|
||||
- **Caution for all `!` usage:** Be mindful of the commands you execute, as they have the same permissions and impact as if you ran them directly in your terminal. The Shell Mode feature does not inherently add extra sandboxing beyond what's already configured for the underlying `run_shell_command` tool.
|
||||
|
||||
This integrated shell capability allows for seamless switching between AI-assisted tasks and direct system interaction.
|
||||
|
||||
@@ -70,7 +70,7 @@ When you create a `.gemini/settings.json` file for project-specific settings, or
|
||||
- **Default:** `false` (users will be prompted for most tool calls).
|
||||
- **Behavior:**
|
||||
- If set to `true`, the CLI will bypass the confirmation prompt for tools deemed safe. An indicator may be shown in the UI when auto-accept is active.
|
||||
- Potentially destructive or system-modifying tools (like `execute_bash_command` or `write_file`) will likely still require confirmation regardless of this setting.
|
||||
- Potentially destructive or system-modifying tools (like `run_shell_command` or `write_file`) will likely still require confirmation regardless of this setting.
|
||||
- **Example:** `"autoAccept": true`
|
||||
|
||||
- **`theme`** (string):
|
||||
|
||||
@@ -47,7 +47,7 @@ The CLI and Core typically communicate over a local interface (e.g., standard in
|
||||
The core plays a vital role in security:
|
||||
|
||||
- **API Key Management:** It handles the `GEMINI_API_KEY` and ensures it is used securely when communicating with the Gemini API.
|
||||
- **Tool Execution:** When tools interact with the local system (e.g., `execute_bash_command`), the core (and its underlying tool implementations) must do so with appropriate caution, often involving sandboxing mechanisms to prevent unintended side effects.
|
||||
- **Tool Execution:** When tools interact with the local system (e.g., `run_shell_command`), the core (and its underlying tool implementations) must do so with appropriate caution, often involving sandboxing mechanisms to prevent unintended side effects.
|
||||
|
||||
## Chat History Compression
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ This documentation is organized into the following sections:
|
||||
- **Tools:**
|
||||
- **[Tools Overview](./tools/index.md):** A general look at the available tools.
|
||||
- **[File System Tools](./tools/file-system.md):** Documentation for tools like `read_file`, `write_file`, etc.
|
||||
- **[Shell Tool](./tools/shell.md):** Using the `execute_bash_command` tool.
|
||||
- **[Shell Tool](./tools/shell.md):** Using the `run_shell_command` tool.
|
||||
- **[Web Fetch Tool](./tools/web-fetch.md):** Using the `web_fetch` tool.
|
||||
- **[Web Search Tool](./tools/web-search.md):** Using the `google_web_search` tool.
|
||||
- **[Multi-File Read Tool](./tools/multi-file.md):** Using the `read_many_files` tool.
|
||||
|
||||
@@ -11,7 +11,7 @@ The core component (`packages/core`) manages these tools, presents their definit
|
||||
## Why are Tools Important?
|
||||
|
||||
- **Access to Local Information:** Tools allow Gemini to access your local file system, read file contents, list directories, etc.
|
||||
- **Execution of Commands:** With tools like `execute_bash_command`, Gemini can run shell commands (with appropriate safety measures and user confirmation).
|
||||
- **Execution of Commands:** With tools like `run_shell_command`, Gemini can run shell commands (with appropriate safety measures and user confirmation).
|
||||
- **Interaction with the Web:** Tools can fetch content from URLs.
|
||||
- **Action Taking:** Tools can modify files, write new files, or perform other actions on your system (again, typically with safeguards).
|
||||
- **Grounding Responses:** By using tools to fetch real-time or specific local data, Gemini's responses can be more accurate, relevant, and grounded in your actual context.
|
||||
@@ -30,7 +30,7 @@ You will typically see messages in the CLI indicating when a tool is being calle
|
||||
|
||||
## Security and Confirmation
|
||||
|
||||
Many tools, especially those that can modify your file system or execute commands (`write_file`, `edit`, `execute_bash_command`), are designed with safety in mind. The Gemini CLI will typically:
|
||||
Many tools, especially those that can modify your file system or execute commands (`write_file`, `edit`, `run_shell_command`), are designed with safety in mind. The Gemini CLI will typically:
|
||||
|
||||
- **Require Confirmation:** Prompt you before executing potentially sensitive operations, showing you what action is about to be taken.
|
||||
- **Utilize Sandboxing:** All tools are subject to restrictions enforced by sandboxing (see [README](../../README.md#sandboxing)).
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This document provides details on the shell tool.
|
||||
|
||||
## `execute_bash_command`
|
||||
## `run_shell_command`
|
||||
|
||||
- **Purpose:** Executes a given shell command using `bash -c <command>`. This tool is essential for interacting with the underlying operating system, running scripts, or performing command-line operations.
|
||||
- **Arguments:**
|
||||
@@ -24,15 +24,15 @@ This document provides details on the shell tool.
|
||||
- **Examples:**
|
||||
- Listing files in the current directory:
|
||||
```
|
||||
execute_bash_command(command="ls -la")
|
||||
run_shell_command(command="ls -la")
|
||||
```
|
||||
- Running a script in a specific directory:
|
||||
```
|
||||
execute_bash_command(command="./my_script.sh", directory="scripts", description="Run my custom script")
|
||||
run_shell_command(command="./my_script.sh", directory="scripts", description="Run my custom script")
|
||||
```
|
||||
- Starting a background server:
|
||||
```
|
||||
execute_bash_command(command="npm run dev &", description="Start development server in background")
|
||||
run_shell_command(command="npm run dev &", description="Start development server in background")
|
||||
```
|
||||
- **Important Notes:**
|
||||
- **Security:** Be cautious when executing commands, especially those constructed from user input, to prevent security vulnerabilities.
|
||||
|
||||
@@ -59,7 +59,7 @@ This guide provides solutions to common issues and debugging tips.
|
||||
- **Tool Issues:**
|
||||
|
||||
- If a specific tool is failing, try to isolate the issue by running the simplest possible version of the command or operation the tool performs.
|
||||
- For `execute_bash_command`, ensure the command works directly in your shell first.
|
||||
- For `run_shell_command`, ensure the command works directly in your shell first.
|
||||
- For file system tools, double-check paths and permissions.
|
||||
|
||||
- **Pre-flight Checks:**
|
||||
|
||||
Reference in New Issue
Block a user