@dgxo/mashadevcli 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +393 -0
- package/bundle/builtin/skill-creator/SKILL.md +382 -0
- package/bundle/builtin/skill-creator/scripts/init_skill.cjs +239 -0
- package/bundle/builtin/skill-creator/scripts/package_skill.cjs +131 -0
- package/bundle/builtin/skill-creator/scripts/validate_skill.cjs +131 -0
- package/bundle/docs/CONTRIBUTING.md +1 -0
- package/bundle/docs/admin/enterprise-controls.md +115 -0
- package/bundle/docs/assets/connected_devtools.png +0 -0
- package/bundle/docs/assets/gemini-screenshot.png +0 -0
- package/bundle/docs/assets/monitoring-dashboard-logs.png +0 -0
- package/bundle/docs/assets/monitoring-dashboard-metrics.png +0 -0
- package/bundle/docs/assets/monitoring-dashboard-overview.png +0 -0
- package/bundle/docs/assets/release_patch.png +0 -0
- package/bundle/docs/assets/theme-ansi-light.png +0 -0
- package/bundle/docs/assets/theme-ansi.png +0 -0
- package/bundle/docs/assets/theme-atom-one.png +0 -0
- package/bundle/docs/assets/theme-ayu-light.png +0 -0
- package/bundle/docs/assets/theme-ayu.png +0 -0
- package/bundle/docs/assets/theme-custom.png +0 -0
- package/bundle/docs/assets/theme-default-light.png +0 -0
- package/bundle/docs/assets/theme-default.png +0 -0
- package/bundle/docs/assets/theme-dracula.png +0 -0
- package/bundle/docs/assets/theme-github-light.png +0 -0
- package/bundle/docs/assets/theme-github.png +0 -0
- package/bundle/docs/assets/theme-google-light.png +0 -0
- package/bundle/docs/assets/theme-xcode-light.png +0 -0
- package/bundle/docs/changelogs/index.md +867 -0
- package/bundle/docs/changelogs/latest.md +208 -0
- package/bundle/docs/changelogs/preview.md +187 -0
- package/bundle/docs/cli/checkpointing.md +93 -0
- package/bundle/docs/cli/cli-reference.md +115 -0
- package/bundle/docs/cli/creating-skills.md +80 -0
- package/bundle/docs/cli/custom-commands.md +327 -0
- package/bundle/docs/cli/enterprise.md +604 -0
- package/bundle/docs/cli/gemini-ignore.md +71 -0
- package/bundle/docs/cli/gemini-md.md +116 -0
- package/bundle/docs/cli/generation-settings.md +210 -0
- package/bundle/docs/cli/headless.md +50 -0
- package/bundle/docs/cli/model-routing.md +42 -0
- package/bundle/docs/cli/model.md +53 -0
- package/bundle/docs/cli/plan-mode.md +375 -0
- package/bundle/docs/cli/rewind.md +51 -0
- package/bundle/docs/cli/sandbox.md +257 -0
- package/bundle/docs/cli/session-management.md +184 -0
- package/bundle/docs/cli/settings.md +165 -0
- package/bundle/docs/cli/skills.md +134 -0
- package/bundle/docs/cli/system-prompt.md +125 -0
- package/bundle/docs/cli/telemetry.md +922 -0
- package/bundle/docs/cli/themes.md +269 -0
- package/bundle/docs/cli/token-caching.md +20 -0
- package/bundle/docs/cli/trusted-folders.md +126 -0
- package/bundle/docs/cli/tutorials/automation.md +283 -0
- package/bundle/docs/cli/tutorials/file-management.md +142 -0
- package/bundle/docs/cli/tutorials/mcp-setup.md +113 -0
- package/bundle/docs/cli/tutorials/memory-management.md +126 -0
- package/bundle/docs/cli/tutorials/session-management.md +105 -0
- package/bundle/docs/cli/tutorials/shell-commands.md +107 -0
- package/bundle/docs/cli/tutorials/skills-getting-started.md +110 -0
- package/bundle/docs/cli/tutorials/task-planning.md +93 -0
- package/bundle/docs/cli/tutorials/web-tools.md +78 -0
- package/bundle/docs/core/index.md +107 -0
- package/bundle/docs/core/remote-agents.md +84 -0
- package/bundle/docs/core/subagents.md +307 -0
- package/bundle/docs/examples/proxy-script.md +83 -0
- package/bundle/docs/extensions/best-practices.md +188 -0
- package/bundle/docs/extensions/index.md +61 -0
- package/bundle/docs/extensions/reference.md +333 -0
- package/bundle/docs/extensions/releasing.md +154 -0
- package/bundle/docs/extensions/writing-extensions.md +308 -0
- package/bundle/docs/get-started/authentication.md +402 -0
- package/bundle/docs/get-started/examples.md +139 -0
- package/bundle/docs/get-started/gemini-3.md +115 -0
- package/bundle/docs/get-started/index.md +82 -0
- package/bundle/docs/get-started/installation.md +174 -0
- package/bundle/docs/hooks/best-practices.md +709 -0
- package/bundle/docs/hooks/index.md +164 -0
- package/bundle/docs/hooks/reference.md +330 -0
- package/bundle/docs/hooks/writing-hooks.md +474 -0
- package/bundle/docs/ide-integration/ide-companion-spec.md +267 -0
- package/bundle/docs/ide-integration/index.md +224 -0
- package/bundle/docs/index.md +141 -0
- package/bundle/docs/integration-tests.md +211 -0
- package/bundle/docs/issue-and-pr-automation.md +172 -0
- package/bundle/docs/local-development.md +134 -0
- package/bundle/docs/mermaid/context.mmd +103 -0
- package/bundle/docs/mermaid/render-path.mmd +64 -0
- package/bundle/docs/npm.md +62 -0
- package/bundle/docs/redirects.json +20 -0
- package/bundle/docs/reference/commands.md +526 -0
- package/bundle/docs/reference/configuration.md +1786 -0
- package/bundle/docs/reference/keyboard-shortcuts.md +164 -0
- package/bundle/docs/reference/memport.md +246 -0
- package/bundle/docs/reference/policy-engine.md +364 -0
- package/bundle/docs/reference/tools.md +106 -0
- package/bundle/docs/release-confidence.md +164 -0
- package/bundle/docs/releases.md +540 -0
- package/bundle/docs/resources/faq.md +175 -0
- package/bundle/docs/resources/quota-and-pricing.md +165 -0
- package/bundle/docs/resources/tos-privacy.md +102 -0
- package/bundle/docs/resources/troubleshooting.md +176 -0
- package/bundle/docs/resources/uninstall.md +56 -0
- package/bundle/docs/sidebar.json +233 -0
- package/bundle/docs/tools/activate-skill.md +43 -0
- package/bundle/docs/tools/ask-user.md +95 -0
- package/bundle/docs/tools/file-system.md +129 -0
- package/bundle/docs/tools/internal-docs.md +46 -0
- package/bundle/docs/tools/mcp-server.md +1150 -0
- package/bundle/docs/tools/memory.md +35 -0
- package/bundle/docs/tools/planning.md +58 -0
- package/bundle/docs/tools/shell.md +216 -0
- package/bundle/docs/tools/todos.md +35 -0
- package/bundle/docs/tools/web-fetch.md +35 -0
- package/bundle/docs/tools/web-search.md +32 -0
- package/bundle/docs/update/update-guide.md +111 -0
- package/bundle/masha.js +563471 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/client/main.js +89 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.d.ts +7 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js +9 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js.map +1 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.d.ts +48 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js +299 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js.map +1 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.d.ts +36 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js +7 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js.map +1 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/package.json +32 -0
- package/bundle/policies/conseca.toml +6 -0
- package/bundle/policies/discovered.toml +8 -0
- package/bundle/policies/plan.toml +109 -0
- package/bundle/policies/read-only.toml +53 -0
- package/bundle/policies/write.toml +80 -0
- package/bundle/policies/yolo.toml +54 -0
- package/bundle/sandbox-macos-permissive-open.sb +27 -0
- package/bundle/sandbox-macos-permissive-proxied.sb +37 -0
- package/bundle/sandbox-macos-restrictive-open.sb +96 -0
- package/bundle/sandbox-macos-restrictive-proxied.sb +98 -0
- package/bundle/sandbox-macos-strict-open.sb +131 -0
- package/bundle/sandbox-macos-strict-proxied.sb +133 -0
- package/package.json +169 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
# Policy engine
|
|
2
|
+
|
|
3
|
+
The Gemini CLI includes a powerful policy engine that provides fine-grained
|
|
4
|
+
control over tool execution. It allows users and administrators to define rules
|
|
5
|
+
that determine whether a tool call should be allowed, denied, or require user
|
|
6
|
+
confirmation.
|
|
7
|
+
|
|
8
|
+
## Quick start
|
|
9
|
+
|
|
10
|
+
To create your first policy:
|
|
11
|
+
|
|
12
|
+
1. **Create the policy directory** if it doesn't exist:
|
|
13
|
+
|
|
14
|
+
**macOS/Linux**
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
mkdir -p ~/.gemini/policies
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Windows (PowerShell)**
|
|
21
|
+
|
|
22
|
+
```powershell
|
|
23
|
+
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.gemini\policies"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
2. **Create a new policy file** (e.g., `~/.gemini/policies/my-rules.toml`). You
|
|
27
|
+
can use any filename ending in `.toml`; all such files in this directory
|
|
28
|
+
will be loaded and combined:
|
|
29
|
+
```toml
|
|
30
|
+
[[rule]]
|
|
31
|
+
toolName = "run_shell_command"
|
|
32
|
+
commandPrefix = "git status"
|
|
33
|
+
decision = "allow"
|
|
34
|
+
priority = 100
|
|
35
|
+
```
|
|
36
|
+
3. **Run a command** that triggers the policy (e.g., ask Gemini CLI to
|
|
37
|
+
`git status`). The tool will now execute automatically without prompting for
|
|
38
|
+
confirmation.
|
|
39
|
+
|
|
40
|
+
## Core concepts
|
|
41
|
+
|
|
42
|
+
The policy engine operates on a set of rules. Each rule is a combination of
|
|
43
|
+
conditions and a resulting decision. When a large language model wants to
|
|
44
|
+
execute a tool, the policy engine evaluates all rules to find the
|
|
45
|
+
highest-priority rule that matches the tool call.
|
|
46
|
+
|
|
47
|
+
A rule consists of the following main components:
|
|
48
|
+
|
|
49
|
+
- **Conditions**: Criteria that a tool call must meet for the rule to apply.
|
|
50
|
+
This can include the tool's name, the arguments provided to it, or the current
|
|
51
|
+
approval mode.
|
|
52
|
+
- **Decision**: The action to take if the rule matches (`allow`, `deny`, or
|
|
53
|
+
`ask_user`).
|
|
54
|
+
- **Priority**: A number that determines the rule's precedence. Higher numbers
|
|
55
|
+
win.
|
|
56
|
+
|
|
57
|
+
For example, this rule will ask for user confirmation before executing any `git`
|
|
58
|
+
command.
|
|
59
|
+
|
|
60
|
+
```toml
|
|
61
|
+
[[rule]]
|
|
62
|
+
toolName = "run_shell_command"
|
|
63
|
+
commandPrefix = "git "
|
|
64
|
+
decision = "ask_user"
|
|
65
|
+
priority = 100
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Conditions
|
|
69
|
+
|
|
70
|
+
Conditions are the criteria that a tool call must meet for a rule to apply. The
|
|
71
|
+
primary conditions are the tool's name and its arguments.
|
|
72
|
+
|
|
73
|
+
#### Tool Name
|
|
74
|
+
|
|
75
|
+
The `toolName` in the rule must match the name of the tool being called.
|
|
76
|
+
|
|
77
|
+
- **Wildcards**: You can use wildcards to match multiple tools.
|
|
78
|
+
- `*`: Matches **any tool** (built-in or MCP).
|
|
79
|
+
- `server__*`: Matches any tool from a specific MCP server.
|
|
80
|
+
- `*__toolName`: Matches a specific tool name across **all** MCP servers.
|
|
81
|
+
- `*__*`: Matches **any tool from any MCP server**.
|
|
82
|
+
|
|
83
|
+
#### Arguments pattern
|
|
84
|
+
|
|
85
|
+
If `argsPattern` is specified, the tool's arguments are converted to a stable
|
|
86
|
+
JSON string, which is then tested against the provided regular expression. If
|
|
87
|
+
the arguments don't match the pattern, the rule does not apply.
|
|
88
|
+
|
|
89
|
+
### Decisions
|
|
90
|
+
|
|
91
|
+
There are three possible decisions a rule can enforce:
|
|
92
|
+
|
|
93
|
+
- `allow`: The tool call is executed automatically without user interaction.
|
|
94
|
+
- `deny`: The tool call is blocked and is not executed.
|
|
95
|
+
- `ask_user`: The user is prompted to approve or deny the tool call. (In
|
|
96
|
+
non-interactive mode, this is treated as `deny`.)
|
|
97
|
+
|
|
98
|
+
### Priority system and tiers
|
|
99
|
+
|
|
100
|
+
The policy engine uses a sophisticated priority system to resolve conflicts when
|
|
101
|
+
multiple rules match a single tool call. The core principle is simple: **the
|
|
102
|
+
rule with the highest priority wins**.
|
|
103
|
+
|
|
104
|
+
To provide a clear hierarchy, policies are organized into three tiers. Each tier
|
|
105
|
+
has a designated number that forms the base of the final priority calculation.
|
|
106
|
+
|
|
107
|
+
| Tier | Base | Description |
|
|
108
|
+
| :-------- | :--- | :------------------------------------------------------------------------- |
|
|
109
|
+
| Default | 1 | Built-in policies that ship with the Gemini CLI. |
|
|
110
|
+
| Extension | 2 | Policies defined in extensions. |
|
|
111
|
+
| Workspace | 3 | Policies defined in the current workspace's configuration directory. |
|
|
112
|
+
| User | 4 | Custom policies defined by the user. |
|
|
113
|
+
| Admin | 5 | Policies managed by an administrator (e.g., in an enterprise environment). |
|
|
114
|
+
|
|
115
|
+
Within a TOML policy file, you assign a priority value from **0 to 999**. The
|
|
116
|
+
engine transforms this into a final priority using the following formula:
|
|
117
|
+
|
|
118
|
+
`final_priority = tier_base + (toml_priority / 1000)`
|
|
119
|
+
|
|
120
|
+
This system guarantees that:
|
|
121
|
+
|
|
122
|
+
- Admin policies always override User, Workspace, and Default policies.
|
|
123
|
+
- User policies override Workspace and Default policies.
|
|
124
|
+
- Workspace policies override Default policies.
|
|
125
|
+
- You can still order rules within a single tier with fine-grained control.
|
|
126
|
+
|
|
127
|
+
For example:
|
|
128
|
+
|
|
129
|
+
- A `priority: 50` rule in a Default policy file becomes `1.050`.
|
|
130
|
+
- A `priority: 10` rule in a Workspace policy policy file becomes `2.010`.
|
|
131
|
+
- A `priority: 100` rule in a User policy file becomes `3.100`.
|
|
132
|
+
- A `priority: 20` rule in an Admin policy file becomes `4.020`.
|
|
133
|
+
|
|
134
|
+
### Approval modes
|
|
135
|
+
|
|
136
|
+
Approval modes allow the policy engine to apply different sets of rules based on
|
|
137
|
+
the CLI's operational mode. A rule can be associated with one or more modes
|
|
138
|
+
(e.g., `yolo`, `autoEdit`, `plan`). The rule will only be active if the CLI is
|
|
139
|
+
running in one of its specified modes. If a rule has no modes specified, it is
|
|
140
|
+
always active.
|
|
141
|
+
|
|
142
|
+
- `default`: The standard interactive mode where most write tools require
|
|
143
|
+
confirmation.
|
|
144
|
+
- `autoEdit`: Optimized for automated code editing; some write tools may be
|
|
145
|
+
auto-approved.
|
|
146
|
+
- `plan`: A strict, read-only mode for research and design. See [Customizing
|
|
147
|
+
Plan Mode Policies].
|
|
148
|
+
- `yolo`: A mode where all tools are auto-approved (use with extreme caution).
|
|
149
|
+
|
|
150
|
+
## Rule matching
|
|
151
|
+
|
|
152
|
+
When a tool call is made, the engine checks it against all active rules,
|
|
153
|
+
starting from the highest priority. The first rule that matches determines the
|
|
154
|
+
outcome.
|
|
155
|
+
|
|
156
|
+
A rule matches a tool call if all of its conditions are met:
|
|
157
|
+
|
|
158
|
+
1. **Tool name**: The `toolName` in the rule must match the name of the tool
|
|
159
|
+
being called.
|
|
160
|
+
- **Wildcards**: You can use wildcards like `*`, `server__*`, or
|
|
161
|
+
`*__toolName` to match multiple tools. See [Tool Name](#tool-name) for
|
|
162
|
+
details.
|
|
163
|
+
2. **Arguments pattern**: If `argsPattern` is specified, the tool's arguments
|
|
164
|
+
are converted to a stable JSON string, which is then tested against the
|
|
165
|
+
provided regular expression. If the arguments don't match the pattern, the
|
|
166
|
+
rule does not apply.
|
|
167
|
+
|
|
168
|
+
## Configuration
|
|
169
|
+
|
|
170
|
+
Policies are defined in `.toml` files. The CLI loads these files from Default,
|
|
171
|
+
User, and (if configured) Admin directories.
|
|
172
|
+
|
|
173
|
+
### Policy locations
|
|
174
|
+
|
|
175
|
+
| Tier | Type | Location |
|
|
176
|
+
| :------------ | :----- | :---------------------------------------- |
|
|
177
|
+
| **User** | Custom | `~/.gemini/policies/*.toml` |
|
|
178
|
+
| **Workspace** | Custom | `$WORKSPACE_ROOT/.gemini/policies/*.toml` |
|
|
179
|
+
| **Admin** | System | _See below (OS specific)_ |
|
|
180
|
+
|
|
181
|
+
#### System-wide policies (Admin)
|
|
182
|
+
|
|
183
|
+
Administrators can enforce system-wide policies (Tier 3) that override all user
|
|
184
|
+
and default settings. These policies must be placed in specific, secure
|
|
185
|
+
directories:
|
|
186
|
+
|
|
187
|
+
| OS | Policy Directory Path |
|
|
188
|
+
| :---------- | :------------------------------------------------ |
|
|
189
|
+
| **Linux** | `/etc/gemini-cli/policies` |
|
|
190
|
+
| **macOS** | `/Library/Application Support/GeminiCli/policies` |
|
|
191
|
+
| **Windows** | `C:\ProgramData\gemini-cli\policies` |
|
|
192
|
+
|
|
193
|
+
**Security Requirements:**
|
|
194
|
+
|
|
195
|
+
To prevent privilege escalation, the CLI enforces strict security checks on
|
|
196
|
+
admin directories. If checks fail, system policies are **ignored**.
|
|
197
|
+
|
|
198
|
+
- **Linux / macOS:** Must be owned by `root` (UID 0) and NOT writable by group
|
|
199
|
+
or others (e.g., `chmod 755`).
|
|
200
|
+
- **Windows:** Must be in `C:\ProgramData`. Standard users (`Users`, `Everyone`)
|
|
201
|
+
must NOT have `Write`, `Modify`, or `Full Control` permissions. _Tip: If you
|
|
202
|
+
see a security warning, use the folder properties to remove write permissions
|
|
203
|
+
for non-admin groups. You may need to "Disable inheritance" in Advanced
|
|
204
|
+
Security Settings._
|
|
205
|
+
|
|
206
|
+
### TOML rule schema
|
|
207
|
+
|
|
208
|
+
Here is a breakdown of the fields available in a TOML policy rule:
|
|
209
|
+
|
|
210
|
+
```toml
|
|
211
|
+
[[rule]]
|
|
212
|
+
# A unique name for the tool, or an array of names.
|
|
213
|
+
toolName = "run_shell_command"
|
|
214
|
+
|
|
215
|
+
# (Optional) The name of an MCP server. Can be combined with toolName
|
|
216
|
+
# to form a composite name like "mcpName__toolName".
|
|
217
|
+
mcpName = "my-custom-server"
|
|
218
|
+
|
|
219
|
+
# (Optional) Metadata hints provided by the tool. A rule matches if all
|
|
220
|
+
# key-value pairs provided here are present in the tool's annotations.
|
|
221
|
+
toolAnnotations = { readOnlyHint = true }
|
|
222
|
+
|
|
223
|
+
# (Optional) A regex to match against the tool's arguments.
|
|
224
|
+
argsPattern = '"command":"(git|npm)'
|
|
225
|
+
|
|
226
|
+
# (Optional) A string or array of strings that a shell command must start with.
|
|
227
|
+
# This is syntactic sugar for `toolName = "run_shell_command"` and an `argsPattern`.
|
|
228
|
+
commandPrefix = "git "
|
|
229
|
+
|
|
230
|
+
# (Optional) A regex to match against the entire shell command.
|
|
231
|
+
# This is also syntactic sugar for `toolName = "run_shell_command"`.
|
|
232
|
+
# Note: This pattern is tested against the JSON representation of the arguments (e.g., `{"command":"<your_command>"}`).
|
|
233
|
+
# Because it prepends `"command":"`, it effectively matches from the start of the command.
|
|
234
|
+
# Anchors like `^` or `$` apply to the full JSON string, so `^` should usually be avoided here.
|
|
235
|
+
# You cannot use commandPrefix and commandRegex in the same rule.
|
|
236
|
+
commandRegex = "git (commit|push)"
|
|
237
|
+
|
|
238
|
+
# The decision to take. Must be "allow", "deny", or "ask_user".
|
|
239
|
+
decision = "ask_user"
|
|
240
|
+
|
|
241
|
+
# The priority of the rule, from 0 to 999.
|
|
242
|
+
priority = 10
|
|
243
|
+
|
|
244
|
+
# (Optional) A custom message to display when a tool call is denied by this rule.
|
|
245
|
+
# This message is returned to the model and user, useful for explaining *why* it was denied.
|
|
246
|
+
deny_message = "Deletion is permanent"
|
|
247
|
+
|
|
248
|
+
# (Optional) An array of approval modes where this rule is active.
|
|
249
|
+
modes = ["autoEdit"]
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Using arrays (lists)
|
|
253
|
+
|
|
254
|
+
To apply the same rule to multiple tools or command prefixes, you can provide an
|
|
255
|
+
array of strings for the `toolName` and `commandPrefix` fields.
|
|
256
|
+
|
|
257
|
+
**Example:**
|
|
258
|
+
|
|
259
|
+
This single rule will apply to both the `write_file` and `replace` tools.
|
|
260
|
+
|
|
261
|
+
```toml
|
|
262
|
+
[[rule]]
|
|
263
|
+
toolName = ["write_file", "replace"]
|
|
264
|
+
decision = "ask_user"
|
|
265
|
+
priority = 10
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Special syntax for `run_shell_command`
|
|
269
|
+
|
|
270
|
+
To simplify writing policies for `run_shell_command`, you can use
|
|
271
|
+
`commandPrefix` or `commandRegex` instead of the more complex `argsPattern`.
|
|
272
|
+
|
|
273
|
+
- `commandPrefix`: Matches if the `command` argument starts with the given
|
|
274
|
+
string.
|
|
275
|
+
- `commandRegex`: Matches if the `command` argument matches the given regular
|
|
276
|
+
expression.
|
|
277
|
+
|
|
278
|
+
**Example:**
|
|
279
|
+
|
|
280
|
+
This rule will ask for user confirmation before executing any `git` command.
|
|
281
|
+
|
|
282
|
+
```toml
|
|
283
|
+
[[rule]]
|
|
284
|
+
toolName = "run_shell_command"
|
|
285
|
+
commandPrefix = "git "
|
|
286
|
+
decision = "ask_user"
|
|
287
|
+
priority = 100
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Special syntax for MCP tools
|
|
291
|
+
|
|
292
|
+
You can create rules that target tools from Model Context Protocol (MCP) servers
|
|
293
|
+
using the `mcpName` field or composite wildcard patterns.
|
|
294
|
+
|
|
295
|
+
**1. Targeting a specific tool on a server**
|
|
296
|
+
|
|
297
|
+
Combine `mcpName` and `toolName` to target a single operation.
|
|
298
|
+
|
|
299
|
+
```toml
|
|
300
|
+
# Allows the `search` tool on the `my-jira-server` MCP
|
|
301
|
+
[[rule]]
|
|
302
|
+
mcpName = "my-jira-server"
|
|
303
|
+
toolName = "search"
|
|
304
|
+
decision = "allow"
|
|
305
|
+
priority = 200
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**2. Targeting all tools on a specific server**
|
|
309
|
+
|
|
310
|
+
Specify only the `mcpName` to apply a rule to every tool provided by that
|
|
311
|
+
server.
|
|
312
|
+
|
|
313
|
+
```toml
|
|
314
|
+
# Denies all tools from the `untrusted-server` MCP
|
|
315
|
+
[[rule]]
|
|
316
|
+
mcpName = "untrusted-server"
|
|
317
|
+
decision = "deny"
|
|
318
|
+
priority = 500
|
|
319
|
+
deny_message = "This server is not trusted by the admin."
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**3. Targeting all MCP servers**
|
|
323
|
+
|
|
324
|
+
Use `mcpName = "*"` to create a rule that applies to **all** tools from **any**
|
|
325
|
+
registered MCP server. This is useful for setting category-wide defaults.
|
|
326
|
+
|
|
327
|
+
```toml
|
|
328
|
+
# Ask user for any tool call from any MCP server
|
|
329
|
+
[[rule]]
|
|
330
|
+
mcpName = "*"
|
|
331
|
+
decision = "ask_user"
|
|
332
|
+
priority = 10
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
**4. Targeting a tool name across all servers**
|
|
336
|
+
|
|
337
|
+
Use `mcpName = "*"` with a specific `toolName` to target that operation
|
|
338
|
+
regardless of which server provides it.
|
|
339
|
+
|
|
340
|
+
```toml
|
|
341
|
+
# Allow the `search` tool across all connected MCP servers
|
|
342
|
+
[[rule]]
|
|
343
|
+
mcpName = "*"
|
|
344
|
+
toolName = "search"
|
|
345
|
+
decision = "allow"
|
|
346
|
+
priority = 50
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## Default policies
|
|
350
|
+
|
|
351
|
+
The Gemini CLI ships with a set of default policies to provide a safe
|
|
352
|
+
out-of-the-box experience.
|
|
353
|
+
|
|
354
|
+
- **Read-only tools** (like `read_file`, `glob`) are generally **allowed**.
|
|
355
|
+
- **Agent delegation** defaults to **`ask_user`** to ensure remote agents can
|
|
356
|
+
prompt for confirmation, but local sub-agent actions are executed silently and
|
|
357
|
+
checked individually.
|
|
358
|
+
- **Write tools** (like `write_file`, `run_shell_command`) default to
|
|
359
|
+
**`ask_user`**.
|
|
360
|
+
- In **`yolo`** mode, a high-priority rule allows all tools.
|
|
361
|
+
- In **`autoEdit`** mode, rules allow certain write operations to happen without
|
|
362
|
+
prompting.
|
|
363
|
+
|
|
364
|
+
[Customizing Plan Mode Policies]: /docs/cli/plan-mode.md#customizing-policies
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Tools reference
|
|
2
|
+
|
|
3
|
+
Gemini CLI uses tools to interact with your local environment, access
|
|
4
|
+
information, and perform actions on your behalf. These tools extend the model's
|
|
5
|
+
capabilities beyond text generation, letting it read files, execute commands,
|
|
6
|
+
and search the web.
|
|
7
|
+
|
|
8
|
+
## How to use Gemini CLI's tools
|
|
9
|
+
|
|
10
|
+
Tools are generally invoked automatically by Gemini CLI when it needs to perform
|
|
11
|
+
an action. However, you can also trigger specific tools manually using shorthand
|
|
12
|
+
syntax.
|
|
13
|
+
|
|
14
|
+
### Automatic execution and security
|
|
15
|
+
|
|
16
|
+
When the model wants to use a tool, Gemini CLI evaluates the request against its
|
|
17
|
+
security policies.
|
|
18
|
+
|
|
19
|
+
- **User confirmation:** You must manually approve tools that modify files or
|
|
20
|
+
execute shell commands (mutators). The CLI shows you a diff or the exact
|
|
21
|
+
command before you confirm.
|
|
22
|
+
- **Sandboxing:** You can run tool executions in secure, containerized
|
|
23
|
+
environments to isolate changes from your host system. For more details, see
|
|
24
|
+
the [Sandboxing](../cli/sandbox.md) guide.
|
|
25
|
+
- **Trusted folders:** You can configure which directories allow the model to
|
|
26
|
+
use system tools. For more details, see the
|
|
27
|
+
[Trusted folders](../cli/trusted-folders.md) guide.
|
|
28
|
+
|
|
29
|
+
Review confirmation prompts carefully before allowing a tool to execute.
|
|
30
|
+
|
|
31
|
+
### How to use manually-triggered tools
|
|
32
|
+
|
|
33
|
+
You can directly trigger key tools using special syntax in your prompt:
|
|
34
|
+
|
|
35
|
+
- **[File access](../tools/file-system.md#read_many_files) (`@`):** Use the `@`
|
|
36
|
+
symbol followed by a file or directory path to include its content in your
|
|
37
|
+
prompt. This triggers the `read_many_files` tool.
|
|
38
|
+
- **[Shell commands](../tools/shell.md) (`!`):** Use the `!` symbol followed by
|
|
39
|
+
a system command to execute it directly. This triggers the `run_shell_command`
|
|
40
|
+
tool.
|
|
41
|
+
|
|
42
|
+
## How to manage tools
|
|
43
|
+
|
|
44
|
+
Using built-in commands, you can inspect available tools and configure how they
|
|
45
|
+
behave.
|
|
46
|
+
|
|
47
|
+
### Tool discovery
|
|
48
|
+
|
|
49
|
+
Use the `/tools` command to see what tools are currently active in your session.
|
|
50
|
+
|
|
51
|
+
- **`/tools`**: Lists all registered tools with their display names.
|
|
52
|
+
- **`/tools desc`**: Lists all tools with their full descriptions.
|
|
53
|
+
|
|
54
|
+
This is especially useful for verifying that
|
|
55
|
+
[MCP servers](../tools/mcp-server.md) or custom tools are loaded correctly.
|
|
56
|
+
|
|
57
|
+
### Tool configuration
|
|
58
|
+
|
|
59
|
+
You can enable, disable, or configure specific tools in your settings. For
|
|
60
|
+
example, you can set a specific pager for shell commands or configure the
|
|
61
|
+
browser used for web searches. See the [Settings](../cli/settings.md) guide for
|
|
62
|
+
details.
|
|
63
|
+
|
|
64
|
+
## Available tools
|
|
65
|
+
|
|
66
|
+
The following table lists all available tools, categorized by their primary
|
|
67
|
+
function.
|
|
68
|
+
|
|
69
|
+
| Category | Tool | Kind | Description |
|
|
70
|
+
| :---------- | :----------------------------------------------- | :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
71
|
+
| Execution | [`run_shell_command`](../tools/shell.md) | `Execute` | Executes arbitrary shell commands. Supports interactive sessions and background processes. Requires manual confirmation.<br><br>**Parameters:** `command`, `description`, `dir_path`, `is_background` |
|
|
72
|
+
| File System | [`glob`](../tools/file-system.md) | `Search` | Finds files matching specific glob patterns across the workspace.<br><br>**Parameters:** `pattern`, `dir_path`, `case_sensitive`, `respect_git_ignore`, `respect_gemini_ignore` |
|
|
73
|
+
| File System | [`grep_search`](../tools/file-system.md) | `Search` | Searches for a regular expression pattern within file contents. Legacy alias: `search_file_content`.<br><br>**Parameters:** `pattern`, `dir_path`, `include`, `exclude_pattern`, `names_only`, `max_matches_per_file`, `total_max_matches` |
|
|
74
|
+
| File System | [`list_directory`](../tools/file-system.md) | `Read` | Lists the names of files and subdirectories within a specified path.<br><br>**Parameters:** `dir_path`, `ignore`, `file_filtering_options` |
|
|
75
|
+
| File System | [`read_file`](../tools/file-system.md) | `Read` | Reads the content of a specific file. Supports text, images, audio, and PDF.<br><br>**Parameters:** `file_path`, `start_line`, `end_line` |
|
|
76
|
+
| File System | [`read_many_files`](../tools/file-system.md) | `Read` | Reads and concatenates content from multiple files. Often triggered by the `@` symbol in your prompt.<br><br>**Parameters:** `include`, `exclude`, `recursive`, `useDefaultExcludes`, `file_filtering_options` |
|
|
77
|
+
| File System | [`replace`](../tools/file-system.md) | `Edit` | Performs precise text replacement within a file. Requires manual confirmation.<br><br>**Parameters:** `file_path`, `instruction`, `old_string`, `new_string`, `allow_multiple` |
|
|
78
|
+
| File System | [`write_file`](../tools/file-system.md) | `Edit` | Creates or overwrites a file with new content. Requires manual confirmation.<br><br>**Parameters:** `file_path`, `content` |
|
|
79
|
+
| Interaction | [`ask_user`](../tools/ask-user.md) | `Communicate` | Requests clarification or missing information via an interactive dialog.<br><br>**Parameters:** `questions` |
|
|
80
|
+
| Interaction | [`write_todos`](../tools/todos.md) | `Other` | Maintains an internal list of subtasks. The model uses this to track its own progress and display it to you.<br><br>**Parameters:** `todos` |
|
|
81
|
+
| Memory | [`activate_skill`](../tools/activate-skill.md) | `Other` | Loads specialized procedural expertise for specific tasks from the `.gemini/skills` directory.<br><br>**Parameters:** `name` |
|
|
82
|
+
| Memory | [`get_internal_docs`](../tools/internal-docs.md) | `Think` | Accesses Gemini CLI's own documentation to provide more accurate answers about its capabilities.<br><br>**Parameters:** `path` |
|
|
83
|
+
| Memory | [`save_memory`](../tools/memory.md) | `Think` | Persists specific facts and project details to your `GEMINI.md` file to retain context.<br><br>**Parameters:** `fact` |
|
|
84
|
+
| Planning | [`enter_plan_mode`](../tools/planning.md) | `Plan` | Switches the CLI to a safe, read-only "Plan Mode" for researching complex changes.<br><br>**Parameters:** `reason` |
|
|
85
|
+
| Planning | [`exit_plan_mode`](../tools/planning.md) | `Plan` | Finalizes a plan, presents it for review, and requests approval to start implementation.<br><br>**Parameters:** `plan` |
|
|
86
|
+
| System | `complete_task` | `Other` | Finalizes a subagent's mission and returns the result to the parent agent. This tool is not available to the user.<br><br>**Parameters:** `result` |
|
|
87
|
+
| Web | [`google_web_search`](../tools/web-search.md) | `Search` | Performs a Google Search to find up-to-date information.<br><br>**Parameters:** `query` |
|
|
88
|
+
| Web | [`web_fetch`](../tools/web-fetch.md) | `Fetch` | Retrieves and processes content from specific URLs. **Warning:** This tool can access local and private network addresses (e.g., localhost), which may pose a security risk if used with untrusted prompts.<br><br>**Parameters:** `prompt` |
|
|
89
|
+
|
|
90
|
+
## Under the hood
|
|
91
|
+
|
|
92
|
+
For developers, the tool system is designed to be extensible and robust. The
|
|
93
|
+
`ToolRegistry` class manages all available tools.
|
|
94
|
+
|
|
95
|
+
You can extend Gemini CLI with custom tools by configuring
|
|
96
|
+
`tools.discoveryCommand` in your settings or by connecting to MCP servers.
|
|
97
|
+
|
|
98
|
+
> **Note:** For a deep dive into the internal Tool API and how to implement your
|
|
99
|
+
> own tools in the codebase, see the `packages/core/src/tools/` directory in
|
|
100
|
+
> GitHub.
|
|
101
|
+
|
|
102
|
+
## Next steps
|
|
103
|
+
|
|
104
|
+
- Learn how to [Set up an MCP server](../tools/mcp-server.md).
|
|
105
|
+
- Explore [Agent Skills](../cli/skills.md) for specialized expertise.
|
|
106
|
+
- See the [Command reference](./commands.md) for slash commands.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Release confidence strategy
|
|
2
|
+
|
|
3
|
+
This document outlines the strategy for gaining confidence in every release of
|
|
4
|
+
the Gemini CLI. It serves as a checklist and quality gate for release manager to
|
|
5
|
+
ensure we are shipping a high-quality product.
|
|
6
|
+
|
|
7
|
+
## The goal
|
|
8
|
+
|
|
9
|
+
To answer the question, "Is this release _truly_ ready for our users?" with a
|
|
10
|
+
high degree of confidence, based on a holistic evaluation of automated signals,
|
|
11
|
+
manual verification, and data.
|
|
12
|
+
|
|
13
|
+
## Level 1: Automated gates (must pass)
|
|
14
|
+
|
|
15
|
+
These are the baseline requirements. If any of these fail, the release is a
|
|
16
|
+
no-go.
|
|
17
|
+
|
|
18
|
+
### 1. CI/CD health
|
|
19
|
+
|
|
20
|
+
All workflows in `.github/workflows/ci.yml` must pass on the `main` branch (for
|
|
21
|
+
nightly) or the release branch (for preview/stable).
|
|
22
|
+
|
|
23
|
+
- **Platforms:** Tests must pass on **Linux and macOS**.
|
|
24
|
+
- _Note:_ Windows tests currently run with `continue-on-error: true`. While a
|
|
25
|
+
failure here doesn't block the release technically, it should be
|
|
26
|
+
investigated.
|
|
27
|
+
- **Checks:**
|
|
28
|
+
- **Linting:** No linting errors (ESLint, Prettier, etc.).
|
|
29
|
+
- **Typechecking:** No TypeScript errors.
|
|
30
|
+
- **Unit Tests:** All unit tests in `packages/core` and `packages/cli` must
|
|
31
|
+
pass.
|
|
32
|
+
- **Build:** The project must build and bundle successfully.
|
|
33
|
+
|
|
34
|
+
### 2. End-to-end (E2E) tests
|
|
35
|
+
|
|
36
|
+
All workflows in `.github/workflows/chained_e2e.yml` must pass.
|
|
37
|
+
|
|
38
|
+
- **Platforms:** **Linux, macOS and Windows**.
|
|
39
|
+
- **Sandboxing:** Tests must pass with both `sandbox:none` and `sandbox:docker`
|
|
40
|
+
on Linux.
|
|
41
|
+
|
|
42
|
+
### 3. Post-deployment smoke tests
|
|
43
|
+
|
|
44
|
+
After a release is published to npm, the `smoke-test.yml` workflow runs. This
|
|
45
|
+
must pass to confirm the package is installable and the binary is executable.
|
|
46
|
+
|
|
47
|
+
- **Command:** `npx -y @dgxo/mashadevcli@<tag> --version` must return the
|
|
48
|
+
correct version without error.
|
|
49
|
+
- **Platform:** Currently runs on `ubuntu-latest`.
|
|
50
|
+
|
|
51
|
+
## Level 2: Manual verification and dogfooding
|
|
52
|
+
|
|
53
|
+
Automated tests cannot catch everything, especially UX issues.
|
|
54
|
+
|
|
55
|
+
### 1. Dogfooding via `preview` tag
|
|
56
|
+
|
|
57
|
+
The weekly release cadence promotes code from `main` -> `nightly` -> `preview`
|
|
58
|
+
-> `stable`.
|
|
59
|
+
|
|
60
|
+
- **Requirement:** The `preview` release must be used by maintainers for at
|
|
61
|
+
least **one week** before being promoted to `stable`.
|
|
62
|
+
- **Action:** Maintainers should install the preview version locally:
|
|
63
|
+
```bash
|
|
64
|
+
npm install -g @dgxo/mashadevcli@preview
|
|
65
|
+
```
|
|
66
|
+
- **Goal:** To catch regressions and UX issues in day-to-day usage before they
|
|
67
|
+
reach the broad user base.
|
|
68
|
+
|
|
69
|
+
### 2. Critical user journey (CUJ) checklist
|
|
70
|
+
|
|
71
|
+
Before promoting a `preview` release to `stable`, a release manager must
|
|
72
|
+
manually run through this checklist.
|
|
73
|
+
|
|
74
|
+
- **Setup:**
|
|
75
|
+
- [ ] Uninstall any existing global version:
|
|
76
|
+
`npm uninstall -g @dgxo/mashadevcli`
|
|
77
|
+
- [ ] Clear npx cache (optional but recommended): `npm cache clean --force`
|
|
78
|
+
- [ ] Install the preview version: `npm install -g @dgxo/mashadevcli@preview`
|
|
79
|
+
- [ ] Verify version: `gemini --version`
|
|
80
|
+
|
|
81
|
+
- **Authentication:**
|
|
82
|
+
- [ ] In interactive mode run `/auth` and verify all login flows work:
|
|
83
|
+
- [ ] Login With Google
|
|
84
|
+
- [ ] API Key
|
|
85
|
+
- [ ] Vertex AI
|
|
86
|
+
|
|
87
|
+
- **Basic prompting:**
|
|
88
|
+
- [ ] Run `gemini "Tell me a joke"` and verify a sensible response.
|
|
89
|
+
- [ ] Run in interactive mode: `gemini`. Ask a follow-up question to test
|
|
90
|
+
context.
|
|
91
|
+
|
|
92
|
+
- **Piped input:**
|
|
93
|
+
- [ ] Run `echo "Summarize this" | gemini` and verify it processes stdin.
|
|
94
|
+
|
|
95
|
+
- **Context management:**
|
|
96
|
+
- [ ] In interactive mode, use `@file` to add a local file to context. Ask a
|
|
97
|
+
question about it.
|
|
98
|
+
|
|
99
|
+
- **Settings:**
|
|
100
|
+
- [ ] In interactive mode run `/settings` and make modifications
|
|
101
|
+
- [ ] Validate that setting is changed
|
|
102
|
+
|
|
103
|
+
- **Function calling:**
|
|
104
|
+
- [ ] In interactive mode, ask gemini to "create a file named hello.md with
|
|
105
|
+
the content 'hello world'" and verify the file is created correctly.
|
|
106
|
+
|
|
107
|
+
If any of these CUJs fail, the release is a no-go until a patch is applied to
|
|
108
|
+
the `preview` channel.
|
|
109
|
+
|
|
110
|
+
### 3. Pre-Launch bug bash (tier 1 and 2 launches)
|
|
111
|
+
|
|
112
|
+
For high-impact releases, an organized bug bash is required to ensure a higher
|
|
113
|
+
level of quality and to catch issues across a wider range of environments and
|
|
114
|
+
use cases.
|
|
115
|
+
|
|
116
|
+
**Definition of tiers:**
|
|
117
|
+
|
|
118
|
+
- **Tier 1:** Industry-Moving News 🚀
|
|
119
|
+
- **Tier 2:** Important News for Our Users 📣
|
|
120
|
+
- **Tier 3:** Relevant, but Not Life-Changing 💡
|
|
121
|
+
- **Tier 4:** Bug Fixes ⚒️
|
|
122
|
+
|
|
123
|
+
**Requirement:**
|
|
124
|
+
|
|
125
|
+
A bug bash must be scheduled at least **72 hours in advance** of any Tier 1 or
|
|
126
|
+
Tier 2 launch.
|
|
127
|
+
|
|
128
|
+
**Rule of thumb:**
|
|
129
|
+
|
|
130
|
+
A bug bash should be considered for any release that involves:
|
|
131
|
+
|
|
132
|
+
- A blog post
|
|
133
|
+
- Coordinated social media announcements
|
|
134
|
+
- Media relations or press outreach
|
|
135
|
+
- A "Turbo" launch event
|
|
136
|
+
|
|
137
|
+
## Level 3: Telemetry and data review
|
|
138
|
+
|
|
139
|
+
### Dashboard health
|
|
140
|
+
|
|
141
|
+
- [ ] Go to `go/gemini-cli-dash`.
|
|
142
|
+
- [ ] Navigate to the "Tool Call" tab.
|
|
143
|
+
- [ ] Validate that there are no spikes in errors for the release you would like
|
|
144
|
+
to promote.
|
|
145
|
+
|
|
146
|
+
### Model evaluation
|
|
147
|
+
|
|
148
|
+
- [ ] Navigate to `go/gemini-cli-offline-evals-dash`.
|
|
149
|
+
- [ ] Make sure that the release you want to promote's recurring run is within
|
|
150
|
+
average eval runs.
|
|
151
|
+
|
|
152
|
+
## The "go/no-go" decision
|
|
153
|
+
|
|
154
|
+
Before triggering the `Release: Promote` workflow to move `preview` to `stable`:
|
|
155
|
+
|
|
156
|
+
1. [ ] **Level 1:** CI and E2E workflows are green for the commit corresponding
|
|
157
|
+
to the current `preview` tag.
|
|
158
|
+
2. [ ] **Level 2:** The `preview` version has been out for one week, and the
|
|
159
|
+
CUJ checklist has been completed successfully by a release manager. No
|
|
160
|
+
blocking issues have been reported.
|
|
161
|
+
3. [ ] **Level 3:** Dashboard Health and Model Evaluation checks have been
|
|
162
|
+
completed and show no regressions.
|
|
163
|
+
|
|
164
|
+
If all checks pass, proceed with the promotion.
|