summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/cli/commands.md2
-rw-r--r--docs/tools/shell.md4
2 files changed, 6 insertions, 0 deletions
diff --git a/docs/cli/commands.md b/docs/cli/commands.md
index e1692ccd..f6e9451e 100644
--- a/docs/cli/commands.md
+++ b/docs/cli/commands.md
@@ -282,3 +282,5 @@ The `!` prefix lets you interact with your system's shell directly from within G
- When exited, the UI reverts to its standard appearance and normal Gemini CLI behavior resumes.
- **Caution for all `!` usage:** Commands you execute in shell mode have the same permissions and impact as if you ran them directly in your terminal.
+
+- **Environment Variable:** When a command is executed via `!` or in shell mode, the `GEMINI_CLI=1` environment variable is set in the subprocess's environment. This allows scripts or tools to detect if they are being run from within the Gemini CLI.
diff --git a/docs/tools/shell.md b/docs/tools/shell.md
index 021cede1..3e2a00e4 100644
--- a/docs/tools/shell.md
+++ b/docs/tools/shell.md
@@ -60,6 +60,10 @@ run_shell_command(command="npm run dev &", description="Start development server
- **Error handling:** Check the `Stderr`, `Error`, and `Exit Code` fields to determine if a command executed successfully.
- **Background processes:** When a command is run in the background with `&`, the tool will return immediately and the process will continue to run in the background. The `Background PIDs` field will contain the process ID of the background process.
+## Environment Variables
+
+When `run_shell_command` executes a command, it sets the `GEMINI_CLI=1` environment variable in the subprocess's environment. This allows scripts or tools to detect if they are being run from within the Gemini CLI.
+
## Command Restrictions
You can restrict the commands that can be executed by the `run_shell_command` tool by using the `coreTools` and `excludeTools` settings in your configuration file.