@codeflyai/codefly 0.24.1 → 0.24.2
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/bundle/builtin/skill-creator/SKILL.md +382 -0
- package/bundle/builtin/skill-creator/scripts/init_skill.cjs +235 -0
- package/bundle/builtin/skill-creator/scripts/package_skill.cjs +102 -0
- package/bundle/builtin/skill-creator/scripts/validate_skill.cjs +127 -0
- package/bundle/codefly.js +296592 -296367
- package/bundle/docs/architecture.md +3 -3
- 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/changelogs/index.md +134 -0
- package/bundle/docs/changelogs/latest.md +355 -210
- package/bundle/docs/changelogs/preview.md +318 -115
- package/bundle/docs/cli/commands.md +21 -0
- package/bundle/docs/cli/custom-commands.md +9 -9
- package/bundle/docs/cli/index.md +6 -2
- package/bundle/docs/cli/keyboard-shortcuts.md +61 -78
- package/bundle/docs/cli/model-routing.md +7 -2
- package/bundle/docs/cli/model.md +1 -1
- package/bundle/docs/cli/openspec.md +164 -0
- package/bundle/docs/cli/sandbox.md +1 -1
- package/bundle/docs/cli/settings.md +80 -60
- package/bundle/docs/cli/skills.md +188 -0
- package/bundle/docs/cli/system-prompt.md +32 -0
- package/bundle/docs/cli/telemetry.md +38 -3
- package/bundle/docs/cli/themes.md +0 -2
- package/bundle/docs/cli/tutorials/skills-getting-started.md +124 -0
- package/bundle/docs/cli/tutorials.md +4 -0
- package/bundle/docs/core/index.md +4 -0
- package/bundle/docs/core/memport.md +2 -0
- package/bundle/docs/core/policy-engine.md +3 -2
- package/bundle/docs/extensions/getting-started-extensions.md +39 -2
- package/bundle/docs/get-started/configuration.md +130 -74
- package/bundle/docs/get-started/gemini-3.md +2 -17
- package/bundle/docs/hooks/reference.md +245 -116
- package/bundle/docs/index.md +2 -0
- package/bundle/docs/local-development.md +1 -1
- package/bundle/docs/releases.md +1 -1
- package/bundle/docs/sidebar.json +5 -5
- package/bundle/docs/tools/index.md +3 -0
- package/bundle/docs/tools/mcp-server.md +26 -2
- package/bundle/docs/tools/shell.md +1 -1
- package/bundle/docs/troubleshooting.md +23 -5
- package/bundle/policies/agent.toml +1 -1
- package/bundle/policies/plan.toml +70 -0
- package/bundle/policies/read-only.toml +0 -5
- package/bundle/policies/yolo.toml +1 -0
- package/package.json +10 -5
- package/bundle/docs/get-started/deployment.md +0 -143
|
@@ -1,168 +1,297 @@
|
|
|
1
|
-
# Hooks
|
|
1
|
+
# Hooks reference
|
|
2
2
|
|
|
3
3
|
This document provides the technical specification for Gemini CLI hooks,
|
|
4
|
-
including
|
|
5
|
-
stable model API.
|
|
4
|
+
including JSON schemas and API details.
|
|
6
5
|
|
|
7
|
-
##
|
|
6
|
+
## Global hook mechanics
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
- **Communication**: `stdin` for Input (JSON), `stdout` for Output (JSON), and
|
|
9
|
+
`stderr` for logs and feedback.
|
|
10
|
+
- **Exit codes**:
|
|
11
|
+
- `0`: Success. `stdout` is parsed as JSON. **Preferred for all logic.**
|
|
12
|
+
- `2`: System Block. The action is blocked; `stderr` is used as the rejection
|
|
13
|
+
reason.
|
|
14
|
+
- `Other`: Warning. A non-fatal failure occurred; the CLI continues with a
|
|
15
|
+
warning.
|
|
16
|
+
- **Silence is Mandatory**: Your script **must not** print any plain text to
|
|
17
|
+
`stdout` other than the final JSON.
|
|
10
18
|
|
|
11
|
-
|
|
12
|
-
- **Output**: The hook sends a JSON object (or plain text) to `stdout`.
|
|
13
|
-
- **Exit Codes**: Used to signal success or blocking errors.
|
|
19
|
+
---
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
## Base input schema
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
All hooks receive these common fields via `stdin`:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
{
|
|
27
|
+
"session_id": string, // Unique ID for the current session
|
|
28
|
+
"transcript_path": string, // Absolute path to session transcript JSON
|
|
29
|
+
"cwd": string, // Current working directory
|
|
30
|
+
"hook_event_name": string, // The firing event (e.g. "BeforeTool")
|
|
31
|
+
"timestamp": string // ISO 8601 execution time
|
|
32
|
+
}
|
|
33
|
+
```
|
|
22
34
|
|
|
23
35
|
---
|
|
24
36
|
|
|
25
|
-
##
|
|
37
|
+
## Common output fields
|
|
38
|
+
|
|
39
|
+
Most hooks support these fields in their `stdout` JSON:
|
|
40
|
+
|
|
41
|
+
| Field | Type | Description |
|
|
42
|
+
| :--------------- | :-------- | :----------------------------------------------------------------------------- |
|
|
43
|
+
| `systemMessage` | `string` | Displayed immediately to the user in the terminal. |
|
|
44
|
+
| `suppressOutput` | `boolean` | If `true`, hides internal hook metadata from logs/telemetry. |
|
|
45
|
+
| `continue` | `boolean` | If `false`, stops the entire agent loop immediately. |
|
|
46
|
+
| `stopReason` | `string` | Displayed to the user when `continue` is `false`. |
|
|
47
|
+
| `decision` | `string` | `"allow"` or `"deny"` (alias `"block"`). Specific impact depends on the event. |
|
|
48
|
+
| `reason` | `string` | The feedback/error message provided when a `decision` is `"deny"`. |
|
|
49
|
+
|
|
50
|
+
---
|
|
26
51
|
|
|
27
|
-
|
|
28
|
-
|
|
52
|
+
## Tool hooks
|
|
53
|
+
|
|
54
|
+
### Matchers and tool names
|
|
55
|
+
|
|
56
|
+
For `BeforeTool` and `AfterTool` events, the `matcher` field in your settings is
|
|
57
|
+
compared against the name of the tool being executed.
|
|
58
|
+
|
|
59
|
+
- **Built-in Tools**: You can match any built-in tool (e.g., `read_file`,
|
|
60
|
+
`run_shell_command`). See the [Tools Reference](/docs/tools) for a full list
|
|
61
|
+
of available tool names.
|
|
62
|
+
- **MCP Tools**: Tools from MCP servers follow the naming pattern
|
|
63
|
+
`mcp__<server_name>__<tool_name>`.
|
|
64
|
+
- **Regex Support**: Matchers support regular expressions (e.g.,
|
|
65
|
+
`matcher: "read_.*"` matches all file reading tools).
|
|
66
|
+
|
|
67
|
+
### `BeforeTool`
|
|
68
|
+
|
|
69
|
+
Fires before a tool is invoked. Used for argument validation, security checks,
|
|
70
|
+
and parameter rewriting.
|
|
71
|
+
|
|
72
|
+
- **Input Fields**:
|
|
73
|
+
- `tool_name`: (`string`) The name of the tool being called.
|
|
74
|
+
- `tool_input`: (`object`) The raw arguments generated by the model.
|
|
75
|
+
- `mcp_context`: (`object`) Optional metadata for MCP-based tools.
|
|
76
|
+
- **Relevant Output Fields**:
|
|
77
|
+
- `decision`: Set to `"deny"` (or `"block"`) to prevent the tool from
|
|
78
|
+
executing.
|
|
79
|
+
- `reason`: Required if denied. This text is sent **to the agent** as a tool
|
|
80
|
+
error, allowing it to respond or retry.
|
|
81
|
+
- `hookSpecificOutput.tool_input`: An object that **merges with and
|
|
82
|
+
overrides** the model's arguments before execution.
|
|
83
|
+
- `continue`: Set to `false` to **kill the entire agent loop** immediately.
|
|
84
|
+
- **Exit Code 2 (Block Tool)**: Prevents execution. Uses `stderr` as the
|
|
85
|
+
`reason` sent to the agent. **The turn continues.**
|
|
86
|
+
|
|
87
|
+
### `AfterTool`
|
|
88
|
+
|
|
89
|
+
Fires after a tool executes. Used for result auditing, context injection, or
|
|
90
|
+
hiding sensitive output from the agent.
|
|
91
|
+
|
|
92
|
+
- **Input Fields**:
|
|
93
|
+
- `tool_name`: (`string`)
|
|
94
|
+
- `tool_input`: (`object`) The original arguments.
|
|
95
|
+
- `tool_response`: (`object`) The result containing `llmContent`,
|
|
96
|
+
`returnDisplay`, and optional `error`.
|
|
97
|
+
- `mcp_context`: (`object`)
|
|
98
|
+
- **Relevant Output Fields**:
|
|
99
|
+
- `decision`: Set to `"deny"` to hide the real tool output from the agent.
|
|
100
|
+
- `reason`: Required if denied. This text **replaces** the tool result sent
|
|
101
|
+
back to the model.
|
|
102
|
+
- `hookSpecificOutput.additionalContext`: Text that is **appended** to the
|
|
103
|
+
tool result for the agent.
|
|
104
|
+
- `continue`: Set to `false` to **kill the entire agent loop** immediately.
|
|
105
|
+
- **Exit Code 2 (Block Result)**: Hides the tool result. Uses `stderr` as the
|
|
106
|
+
replacement content sent to the agent. **The turn continues.**
|
|
29
107
|
|
|
30
|
-
|
|
108
|
+
---
|
|
31
109
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
110
|
+
## Agent hooks
|
|
111
|
+
|
|
112
|
+
### `BeforeAgent`
|
|
113
|
+
|
|
114
|
+
Fires after a user submits a prompt, but before the agent begins planning. Used
|
|
115
|
+
for prompt validation or injecting dynamic context.
|
|
116
|
+
|
|
117
|
+
- **Input Fields**:
|
|
118
|
+
- `prompt`: (`string`) The original text submitted by the user.
|
|
119
|
+
- **Relevant Output Fields**:
|
|
120
|
+
- `hookSpecificOutput.additionalContext`: Text that is **appended** to the
|
|
121
|
+
prompt for this turn only.
|
|
122
|
+
- `decision`: Set to `"deny"` to block the turn and **discard the user's
|
|
123
|
+
message** (it will not appear in history).
|
|
124
|
+
- `continue`: Set to `false` to block the turn but **save the message to
|
|
125
|
+
history**.
|
|
126
|
+
- `reason`: Required if denied or stopped.
|
|
127
|
+
- **Exit Code 2 (Block Turn)**: Aborts the turn and erases the prompt from
|
|
128
|
+
context. Same as `decision: "deny"`.
|
|
129
|
+
|
|
130
|
+
### `AfterAgent`
|
|
131
|
+
|
|
132
|
+
Fires once per turn after the model generates its final response. Primary use
|
|
133
|
+
case is response validation and automatic retries.
|
|
134
|
+
|
|
135
|
+
- **Input Fields**:
|
|
136
|
+
- `prompt`: (`string`) The user's original request.
|
|
137
|
+
- `prompt_response`: (`string`) The final text generated by the agent.
|
|
138
|
+
- `stop_hook_active`: (`boolean`) Indicates if this hook is already running as
|
|
139
|
+
part of a retry sequence.
|
|
140
|
+
- **Relevant Output Fields**:
|
|
141
|
+
- `decision`: Set to `"deny"` to **reject the response** and force a retry.
|
|
142
|
+
- `reason`: Required if denied. This text is sent **to the agent as a new
|
|
143
|
+
prompt** to request a correction.
|
|
144
|
+
- `continue`: Set to `false` to **stop the session** without retrying.
|
|
145
|
+
- `clearContext`: If `true`, clears conversation history (LLM memory) while
|
|
146
|
+
preserving UI display.
|
|
147
|
+
- **Exit Code 2 (Retry)**: Rejects the response and triggers an automatic retry
|
|
148
|
+
turn using `stderr` as the feedback prompt.
|
|
39
149
|
|
|
40
|
-
|
|
150
|
+
---
|
|
41
151
|
|
|
42
|
-
|
|
152
|
+
## Model hooks
|
|
153
|
+
|
|
154
|
+
### `BeforeModel`
|
|
155
|
+
|
|
156
|
+
Fires before sending a request to the LLM. Operates on a stable, SDK-agnostic
|
|
157
|
+
request format.
|
|
158
|
+
|
|
159
|
+
- **Input Fields**:
|
|
160
|
+
- `llm_request`: (`object`) Contains `model`, `messages`, and `config`
|
|
161
|
+
(generation params).
|
|
162
|
+
- **Relevant Output Fields**:
|
|
163
|
+
- `hookSpecificOutput.llm_request`: An object that **overrides** parts of the
|
|
164
|
+
outgoing request (e.g., changing models or temperature).
|
|
165
|
+
- `hookSpecificOutput.llm_response`: A **Synthetic Response** object. If
|
|
166
|
+
provided, the CLI skips the LLM call entirely and uses this as the response.
|
|
167
|
+
- `decision`: Set to `"deny"` to block the request and abort the turn.
|
|
168
|
+
- **Exit Code 2 (Block Turn)**: Aborts the turn and skips the LLM call. Uses
|
|
169
|
+
`stderr` as the error message.
|
|
170
|
+
|
|
171
|
+
### `BeforeToolSelection`
|
|
172
|
+
|
|
173
|
+
Fires before the LLM decides which tools to call. Used to filter the available
|
|
174
|
+
toolset or force specific tool modes.
|
|
175
|
+
|
|
176
|
+
- **Input Fields**:
|
|
177
|
+
- `llm_request`: (`object`) Same format as `BeforeModel`.
|
|
178
|
+
- **Relevant Output Fields**:
|
|
179
|
+
- `hookSpecificOutput.toolConfig.mode`: (`"AUTO" | "ANY" | "NONE"`)
|
|
180
|
+
- `"NONE"`: Disables all tools (Wins over other hooks).
|
|
181
|
+
- `"ANY"`: Forces at least one tool call.
|
|
182
|
+
- `hookSpecificOutput.toolConfig.allowedFunctionNames`: (`string[]`) Whitelist
|
|
183
|
+
of tool names.
|
|
184
|
+
- **Union Strategy**: Multiple hooks' whitelists are **combined**.
|
|
185
|
+
- **Limitations**: Does **not** support `decision`, `continue`, or
|
|
186
|
+
`systemMessage`.
|
|
187
|
+
|
|
188
|
+
### `AfterModel`
|
|
189
|
+
|
|
190
|
+
Fires immediately after an LLM response chunk is received. Used for real-time
|
|
191
|
+
redaction or PII filtering.
|
|
192
|
+
|
|
193
|
+
- **Input Fields**:
|
|
194
|
+
- `llm_request`: (`object`) The original request.
|
|
195
|
+
- `llm_response`: (`object`) The model's response (or a single chunk during
|
|
196
|
+
streaming).
|
|
197
|
+
- **Relevant Output Fields**:
|
|
198
|
+
- `hookSpecificOutput.llm_response`: An object that **replaces** the model's
|
|
199
|
+
response chunk.
|
|
200
|
+
- `decision`: Set to `"deny"` to discard the response chunk and block the
|
|
201
|
+
turn.
|
|
202
|
+
- `continue`: Set to `false` to **kill the entire agent loop** immediately.
|
|
203
|
+
- **Note on Streaming**: Fired for **every chunk** generated by the model.
|
|
204
|
+
Modifying the response only affects the current chunk.
|
|
205
|
+
- **Exit Code 2 (Block Response)**: Aborts the turn and discards the model's
|
|
206
|
+
output. Uses `stderr` as the error message.
|
|
43
207
|
|
|
44
|
-
|
|
45
|
-
`run_shell_command`).
|
|
46
|
-
- `tool_input`: (`object`) The arguments passed to the tool.
|
|
47
|
-
- `tool_response`: (`object`, **AfterTool only**) The raw output from the tool
|
|
48
|
-
execution.
|
|
208
|
+
---
|
|
49
209
|
|
|
50
|
-
|
|
210
|
+
## Lifecycle & system hooks
|
|
51
211
|
|
|
52
|
-
|
|
53
|
-
- `prompt_response`: (`string`, **AfterAgent only**) The final response text
|
|
54
|
-
from the model.
|
|
55
|
-
- `stop_hook_active`: (`boolean`, **AfterAgent only**) Indicates if a stop hook
|
|
56
|
-
is already handling a continuation.
|
|
212
|
+
### `SessionStart`
|
|
57
213
|
|
|
58
|
-
|
|
214
|
+
Fires on application startup, resuming a session, or after a `/clear` command.
|
|
215
|
+
Used for loading initial context.
|
|
59
216
|
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
|
|
217
|
+
- **Input fields**:
|
|
218
|
+
- `source`: (`"startup" | "resume" | "clear"`)
|
|
219
|
+
- **Relevant output fields**:
|
|
220
|
+
- `hookSpecificOutput.additionalContext`: (`string`)
|
|
221
|
+
- **Interactive**: Injected as the first turn in history.
|
|
222
|
+
- **Non-interactive**: Prepended to the user's prompt.
|
|
223
|
+
- `systemMessage`: Shown at the start of the session.
|
|
224
|
+
- **Advisory only**: `continue` and `decision` fields are **ignored**. Startup
|
|
225
|
+
is never blocked.
|
|
64
226
|
|
|
65
|
-
|
|
227
|
+
### `SessionEnd`
|
|
66
228
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
- `reason`: (`exit` | `clear` | `logout` | `prompt_input_exit` | `other`,
|
|
70
|
-
**SessionEnd only**) The reason for session end.
|
|
71
|
-
- `trigger`: (`manual` | `auto`, **PreCompress only**) What triggered the
|
|
72
|
-
compression event.
|
|
73
|
-
- `notification_type`: (`ToolPermission`, **Notification only**) The type of
|
|
74
|
-
notification being fired.
|
|
75
|
-
- `message`: (`string`, **Notification only**) The notification message.
|
|
76
|
-
- `details`: (`object`, **Notification only**) Payload-specific details for the
|
|
77
|
-
notification.
|
|
229
|
+
Fires when the CLI exits or a session is cleared. Used for cleanup or final
|
|
230
|
+
telemetry.
|
|
78
231
|
|
|
79
|
-
|
|
232
|
+
- **Input Fields**:
|
|
233
|
+
- `reason`: (`"exit" | "clear" | "logout" | "prompt_input_exit" | "other"`)
|
|
234
|
+
- **Relevant Output Fields**:
|
|
235
|
+
- `systemMessage`: Displayed to the user during shutdown.
|
|
236
|
+
- **Best Effort**: The CLI **will not wait** for this hook to complete and
|
|
237
|
+
ignores all flow-control fields (`continue`, `decision`).
|
|
80
238
|
|
|
81
|
-
|
|
239
|
+
### `Notification`
|
|
82
240
|
|
|
83
|
-
|
|
241
|
+
Fires when the CLI emits a system alert (e.g., Tool Permissions). Used for
|
|
242
|
+
external logging or cross-platform alerts.
|
|
84
243
|
|
|
85
|
-
|
|
244
|
+
- **Input Fields**:
|
|
245
|
+
- `notification_type`: (`"ToolPermission"`)
|
|
246
|
+
- `message`: Summary of the alert.
|
|
247
|
+
- `details`: JSON object with alert-specific metadata (e.g., tool name, file
|
|
248
|
+
path).
|
|
249
|
+
- **Relevant Output Fields**:
|
|
250
|
+
- `systemMessage`: Displayed alongside the system alert.
|
|
251
|
+
- **Observability Only**: This hook **cannot** block alerts or grant permissions
|
|
252
|
+
automatically. Flow-control fields are ignored.
|
|
86
253
|
|
|
87
|
-
|
|
88
|
-
| :------------------- | :-------- | :----------------------------------------------------------------------- |
|
|
89
|
-
| `decision` | `string` | One of: `allow`, `deny`, `block`, `ask`, `approve`. |
|
|
90
|
-
| `reason` | `string` | Explanation shown to the **agent** when a decision is `deny` or `block`. |
|
|
91
|
-
| `systemMessage` | `string` | Message displayed to the **user** in the CLI terminal. |
|
|
92
|
-
| `continue` | `boolean` | If `false`, immediately terminates the agent loop for this turn. |
|
|
93
|
-
| `stopReason` | `string` | Message shown to the user when `continue` is `false`. |
|
|
94
|
-
| `suppressOutput` | `boolean` | If `true`, the hook execution is hidden from the CLI transcript. |
|
|
95
|
-
| `hookSpecificOutput` | `object` | Container for event-specific data (see below). |
|
|
254
|
+
### `PreCompress`
|
|
96
255
|
|
|
97
|
-
|
|
256
|
+
Fires before the CLI summarizes history to save tokens. Used for logging or
|
|
257
|
+
state saving.
|
|
98
258
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
| `toolConfig` | `BeforeToolSelection` | Object containing `mode` (`AUTO`/`ANY`/`NONE`) and `allowedFunctionNames`. |
|
|
259
|
+
- **Input Fields**:
|
|
260
|
+
- `trigger`: (`"auto" | "manual"`)
|
|
261
|
+
- **Relevant Output Fields**:
|
|
262
|
+
- `systemMessage`: Displayed to the user before compression.
|
|
263
|
+
- **Advisory Only**: Fired asynchronously. It **cannot** block or modify the
|
|
264
|
+
compression process. Flow-control fields are ignored.
|
|
106
265
|
|
|
107
266
|
---
|
|
108
267
|
|
|
109
268
|
## Stable Model API
|
|
110
269
|
|
|
111
|
-
Gemini CLI uses
|
|
112
|
-
stable even if the underlying Gemini SDK changes.
|
|
270
|
+
Gemini CLI uses these structures to ensure hooks don't break across SDK updates.
|
|
113
271
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
Used in `BeforeModel` and `BeforeToolSelection`.
|
|
117
|
-
|
|
118
|
-
> 💡 **Note**: In v1, model hooks are primarily text-focused. Non-text parts
|
|
119
|
-
> (like images or function calls) provided in the `content` array will be
|
|
120
|
-
> simplified to their string representation by the translator.
|
|
272
|
+
**LLMRequest**:
|
|
121
273
|
|
|
122
274
|
```typescript
|
|
123
275
|
{
|
|
124
276
|
"model": string,
|
|
125
277
|
"messages": Array<{
|
|
126
278
|
"role": "user" | "model" | "system",
|
|
127
|
-
"content": string
|
|
279
|
+
"content": string // Non-text parts are filtered out for hooks
|
|
128
280
|
}>,
|
|
129
|
-
"config"
|
|
130
|
-
|
|
131
|
-
"maxOutputTokens"?: number,
|
|
132
|
-
"topP"?: number,
|
|
133
|
-
"topK"?: number
|
|
134
|
-
},
|
|
135
|
-
"toolConfig"?: {
|
|
136
|
-
"mode"?: "AUTO" | "ANY" | "NONE",
|
|
137
|
-
"allowedFunctionNames"?: string[]
|
|
138
|
-
}
|
|
281
|
+
"config": { "temperature": number, ... },
|
|
282
|
+
"toolConfig": { "mode": string, "allowedFunctionNames": string[] }
|
|
139
283
|
}
|
|
140
|
-
```
|
|
141
284
|
|
|
142
|
-
|
|
285
|
+
```
|
|
143
286
|
|
|
144
|
-
|
|
287
|
+
**LLMResponse**:
|
|
145
288
|
|
|
146
289
|
```typescript
|
|
147
290
|
{
|
|
148
|
-
"text"?: string,
|
|
149
291
|
"candidates": Array<{
|
|
150
|
-
"content": {
|
|
151
|
-
|
|
152
|
-
"parts": string[]
|
|
153
|
-
},
|
|
154
|
-
"finishReason"?: "STOP" | "MAX_TOKENS" | "SAFETY" | "RECITATION" | "OTHER",
|
|
155
|
-
"index"?: number,
|
|
156
|
-
"safetyRatings"?: Array<{
|
|
157
|
-
"category": string,
|
|
158
|
-
"probability": string,
|
|
159
|
-
"blocked"?: boolean
|
|
160
|
-
}>
|
|
292
|
+
"content": { "role": "model", "parts": string[] },
|
|
293
|
+
"finishReason": string
|
|
161
294
|
}>,
|
|
162
|
-
"usageMetadata"
|
|
163
|
-
"promptTokenCount"?: number,
|
|
164
|
-
"candidatesTokenCount"?: number,
|
|
165
|
-
"totalTokenCount"?: number
|
|
166
|
-
}
|
|
295
|
+
"usageMetadata": { "totalTokenCount": number }
|
|
167
296
|
}
|
|
168
297
|
```
|
package/bundle/docs/index.md
CHANGED
|
@@ -56,6 +56,8 @@ This documentation is organized into the following sections:
|
|
|
56
56
|
commands with `/model`.
|
|
57
57
|
- **[Sandbox](./cli/sandbox.md):** Isolate tool execution in a secure,
|
|
58
58
|
containerized environment.
|
|
59
|
+
- **[Agent Skills](./cli/skills.md):** (Experimental) Extend the CLI with
|
|
60
|
+
specialized expertise and procedural workflows.
|
|
59
61
|
- **[Settings](./cli/settings.md):** Configure various aspects of the CLI's
|
|
60
62
|
behavior and appearance with `/settings`.
|
|
61
63
|
- **[Telemetry](./cli/telemetry.md):** Overview of telemetry in the CLI.
|
|
@@ -10,7 +10,7 @@ debug your code by instrumenting interesting events like model calls, tool
|
|
|
10
10
|
scheduler, tool calls, etc.
|
|
11
11
|
|
|
12
12
|
Dev traces are verbose and are specifically meant for understanding agent
|
|
13
|
-
|
|
13
|
+
behavior and debugging issues. They are disabled by default.
|
|
14
14
|
|
|
15
15
|
To enable dev traces, set the `GEMINI_DEV_TRACING=true` environment variable
|
|
16
16
|
when running Gemini CLI.
|
package/bundle/docs/releases.md
CHANGED
|
@@ -12,7 +12,7 @@ Dressing Room, which is Google's system for managing NPM packages in the
|
|
|
12
12
|
`@google/**` namespace. The packages are all named `@google/**`.
|
|
13
13
|
|
|
14
14
|
More information can be found about these systems in the
|
|
15
|
-
[
|
|
15
|
+
[NPM Package Overview](npm.md)
|
|
16
16
|
|
|
17
17
|
### Package scopes
|
|
18
18
|
|
package/bundle/docs/sidebar.json
CHANGED
|
@@ -88,6 +88,10 @@
|
|
|
88
88
|
"label": "Session Management",
|
|
89
89
|
"slug": "docs/cli/session-management"
|
|
90
90
|
},
|
|
91
|
+
{
|
|
92
|
+
"label": "Agent Skills",
|
|
93
|
+
"slug": "docs/cli/skills"
|
|
94
|
+
},
|
|
91
95
|
{
|
|
92
96
|
"label": "Settings",
|
|
93
97
|
"slug": "docs/cli/settings"
|
|
@@ -198,7 +202,7 @@
|
|
|
198
202
|
]
|
|
199
203
|
},
|
|
200
204
|
{
|
|
201
|
-
"label": "Hooks",
|
|
205
|
+
"label": "Hooks (experimental)",
|
|
202
206
|
"items": [
|
|
203
207
|
{
|
|
204
208
|
"label": "Introduction",
|
|
@@ -266,10 +270,6 @@
|
|
|
266
270
|
{
|
|
267
271
|
"label": "Preview release",
|
|
268
272
|
"slug": "docs/changelogs/preview"
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
"label": "Changelog",
|
|
272
|
-
"slug": "docs/changelogs/releases"
|
|
273
273
|
}
|
|
274
274
|
]
|
|
275
275
|
},
|
|
@@ -95,5 +95,8 @@ Additionally, these tools incorporate:
|
|
|
95
95
|
|
|
96
96
|
- **[MCP servers](./mcp-server.md)**: MCP servers act as a bridge between the
|
|
97
97
|
Gemini model and your local environment or other services like APIs.
|
|
98
|
+
- **[Agent Skills](../cli/skills.md)**: (Experimental) On-demand expertise
|
|
99
|
+
packages that are activated via the `activate_skill` tool to provide
|
|
100
|
+
specialized guidance and resources.
|
|
98
101
|
- **[Sandboxing](../cli/sandbox.md)**: Sandboxing isolates the model and its
|
|
99
102
|
changes from your environment to reduce potential risk.
|
|
@@ -722,7 +722,8 @@ The MCP integration tracks several states:
|
|
|
722
722
|
|
|
723
723
|
### Debugging tips
|
|
724
724
|
|
|
725
|
-
1. **Enable debug mode:** Run the CLI with `--debug` for verbose output
|
|
725
|
+
1. **Enable debug mode:** Run the CLI with `--debug` for verbose output (use F12
|
|
726
|
+
to open debug console in interactive mode)
|
|
726
727
|
2. **Check stderr:** MCP server stderr is captured and logged (INFO messages
|
|
727
728
|
filtered)
|
|
728
729
|
3. **Test isolation:** Test your MCP server independently before integrating
|
|
@@ -732,7 +733,7 @@ The MCP integration tracks several states:
|
|
|
732
733
|
|
|
733
734
|
## Important notes
|
|
734
735
|
|
|
735
|
-
### Security
|
|
736
|
+
### Security considerations
|
|
736
737
|
|
|
737
738
|
- **Trust settings:** The `trust` option bypasses all confirmation dialogs. Use
|
|
738
739
|
cautiously and only for servers you completely control
|
|
@@ -1037,6 +1038,29 @@ gemini mcp remove my-server
|
|
|
1037
1038
|
This will find and delete the "my-server" entry from the `mcpServers` object in
|
|
1038
1039
|
the appropriate `settings.json` file based on the scope (`-s, --scope`).
|
|
1039
1040
|
|
|
1041
|
+
### Enabling/disabling a server (`gemini mcp enable`, `gemini mcp disable`)
|
|
1042
|
+
|
|
1043
|
+
Temporarily disable an MCP server without removing its configuration, or
|
|
1044
|
+
re-enable a previously disabled server.
|
|
1045
|
+
|
|
1046
|
+
**Commands:**
|
|
1047
|
+
|
|
1048
|
+
```bash
|
|
1049
|
+
gemini mcp enable <name> [--session]
|
|
1050
|
+
gemini mcp disable <name> [--session]
|
|
1051
|
+
```
|
|
1052
|
+
|
|
1053
|
+
**Options (flags):**
|
|
1054
|
+
|
|
1055
|
+
- `--session`: Apply change only for this session (not persisted to file).
|
|
1056
|
+
|
|
1057
|
+
Disabled servers appear in `/mcp` status as "Disabled" but won't connect or
|
|
1058
|
+
provide tools. Enablement state is stored in
|
|
1059
|
+
`~/.gemini/mcp-server-enablement.json`.
|
|
1060
|
+
|
|
1061
|
+
The same commands are available as slash commands during an active session:
|
|
1062
|
+
`/mcp enable <name>` and `/mcp disable <name>`.
|
|
1063
|
+
|
|
1040
1064
|
## Instructions
|
|
1041
1065
|
|
|
1042
1066
|
Gemini CLI supports
|
|
@@ -135,7 +135,7 @@ user input, such as text editors (`vim`, `nano`), terminal-based UIs (`htop`),
|
|
|
135
135
|
and interactive version control operations (`git rebase -i`).
|
|
136
136
|
|
|
137
137
|
When an interactive command is running, you can send input to it from the Gemini
|
|
138
|
-
CLI. To focus on the interactive shell, press `
|
|
138
|
+
CLI. To focus on the interactive shell, press `Tab`. The terminal output,
|
|
139
139
|
including complex TUIs, will be rendered correctly.
|
|
140
140
|
|
|
141
141
|
## Important notes
|
|
@@ -28,6 +28,16 @@ topics on:
|
|
|
28
28
|
- **Organizational Users:** Contact your Google Cloud administrator to be
|
|
29
29
|
added to your organization's Gemini Code Assist subscription.
|
|
30
30
|
|
|
31
|
+
- **Error:
|
|
32
|
+
`Failed to login. Message: Your current account is not eligible... because it is not currently available in your location.`**
|
|
33
|
+
- **Cause:** Gemini CLI does not currently support your location. For a full
|
|
34
|
+
list of supported locations, see the following pages:
|
|
35
|
+
- Gemini Code Assist for individuals:
|
|
36
|
+
[Available locations](https://developers.google.com/gemini-code-assist/resources/available-locations#americas)
|
|
37
|
+
- Google AI Pro and Ultra where Gemini Code Assist (and Gemini CLI) is also
|
|
38
|
+
available:
|
|
39
|
+
[Available locations](https://developers.google.com/gemini-code-assist/resources/locations-pro-ultra)
|
|
40
|
+
|
|
31
41
|
- **Error: `Failed to login. Message: Request contains an invalid argument`**
|
|
32
42
|
- **Cause:** Users with Google Workspace accounts or Google Cloud accounts
|
|
33
43
|
associated with their Gmail accounts may not be able to activate the free
|
|
@@ -43,9 +53,15 @@ topics on:
|
|
|
43
53
|
- **Cause:** You may be on a corporate network with a firewall that intercepts
|
|
44
54
|
and inspects SSL/TLS traffic. This often requires a custom root CA
|
|
45
55
|
certificate to be trusted by Node.js.
|
|
46
|
-
- **Solution:**
|
|
47
|
-
|
|
48
|
-
-
|
|
56
|
+
- **Solution:** First try setting `NODE_USE_SYSTEM_CA`; if that does not
|
|
57
|
+
resolve the issue, set `NODE_EXTRA_CA_CERTS`.
|
|
58
|
+
- Set the `NODE_USE_SYSTEM_CA=1` environment variable to tell Node.js to use
|
|
59
|
+
the operating system's native certificate store (where corporate
|
|
60
|
+
certificates are typically already installed).
|
|
61
|
+
- Example: `export NODE_USE_SYSTEM_CA=1`
|
|
62
|
+
- Set the `NODE_EXTRA_CA_CERTS` environment variable to the absolute path of
|
|
63
|
+
your corporate root CA certificate file.
|
|
64
|
+
- Example: `export NODE_EXTRA_CA_CERTS=/path/to/your/corporate-ca.crt`
|
|
49
65
|
|
|
50
66
|
## Common error messages and solutions
|
|
51
67
|
|
|
@@ -124,13 +140,15 @@ This is especially useful for scripting and automation.
|
|
|
124
140
|
## Debugging tips
|
|
125
141
|
|
|
126
142
|
- **CLI debugging:**
|
|
127
|
-
- Use the `--debug` flag for more detailed output.
|
|
143
|
+
- Use the `--debug` flag for more detailed output. In interactive mode, press
|
|
144
|
+
F12 to view the debug console.
|
|
128
145
|
- Check the CLI logs, often found in a user-specific configuration or cache
|
|
129
146
|
directory.
|
|
130
147
|
|
|
131
148
|
- **Core debugging:**
|
|
132
149
|
- Check the server console output for error messages or stack traces.
|
|
133
|
-
- Increase log verbosity if configurable.
|
|
150
|
+
- Increase log verbosity if configurable. For example, set the `DEBUG_MODE`
|
|
151
|
+
environment variable to `true` or `1`.
|
|
134
152
|
- Use Node.js debugging tools (e.g., `node --inspect`) if you need to step
|
|
135
153
|
through server-side code.
|
|
136
154
|
|