@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,116 @@
|
|
|
1
|
+
# Provide context with GEMINI.md files
|
|
2
|
+
|
|
3
|
+
Context files, which use the default name `GEMINI.md`, are a powerful feature
|
|
4
|
+
for providing instructional context to the Gemini model. You can use these files
|
|
5
|
+
to give project-specific instructions, define a persona, or provide coding style
|
|
6
|
+
guides to make the AI's responses more accurate and tailored to your needs.
|
|
7
|
+
|
|
8
|
+
Instead of repeating instructions in every prompt, you can define them once in a
|
|
9
|
+
context file.
|
|
10
|
+
|
|
11
|
+
## Understand the context hierarchy
|
|
12
|
+
|
|
13
|
+
The CLI uses a hierarchical system to source context. It loads various context
|
|
14
|
+
files from several locations, concatenates the contents of all found files, and
|
|
15
|
+
sends them to the model with every prompt. The CLI loads files in the following
|
|
16
|
+
order:
|
|
17
|
+
|
|
18
|
+
1. **Global context file:**
|
|
19
|
+
- **Location:** `~/.gemini/GEMINI.md` (in your user home directory).
|
|
20
|
+
- **Scope:** Provides default instructions for all your projects.
|
|
21
|
+
|
|
22
|
+
2. **Environment and workspace context files:**
|
|
23
|
+
- **Location:** The CLI searches for `GEMINI.md` files in your configured
|
|
24
|
+
workspace directories and their parent directories.
|
|
25
|
+
- **Scope:** Provides context relevant to the projects you are currently
|
|
26
|
+
working on.
|
|
27
|
+
|
|
28
|
+
3. **Just-in-time (JIT) context files:**
|
|
29
|
+
- **Location:** When a tool accesses a file or directory, the CLI
|
|
30
|
+
automatically scans for `GEMINI.md` files in that directory and its
|
|
31
|
+
ancestors up to a trusted root.
|
|
32
|
+
- **Scope:** Lets the model discover highly specific instructions for
|
|
33
|
+
particular components only when they are needed.
|
|
34
|
+
|
|
35
|
+
The CLI footer displays the number of loaded context files, which gives you a
|
|
36
|
+
quick visual cue of the active instructional context.
|
|
37
|
+
|
|
38
|
+
### Example `GEMINI.md` file
|
|
39
|
+
|
|
40
|
+
Here is an example of what you can include in a `GEMINI.md` file at the root of
|
|
41
|
+
a TypeScript project:
|
|
42
|
+
|
|
43
|
+
```markdown
|
|
44
|
+
# Project: My TypeScript Library
|
|
45
|
+
|
|
46
|
+
## General Instructions
|
|
47
|
+
|
|
48
|
+
- When you generate new TypeScript code, follow the existing coding style.
|
|
49
|
+
- Ensure all new functions and classes have JSDoc comments.
|
|
50
|
+
- Prefer functional programming paradigms where appropriate.
|
|
51
|
+
|
|
52
|
+
## Coding Style
|
|
53
|
+
|
|
54
|
+
- Use 2 spaces for indentation.
|
|
55
|
+
- Prefix interface names with `I` (for example, `IUserService`).
|
|
56
|
+
- Always use strict equality (`===` and `!==`).
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Manage context with the `/memory` command
|
|
60
|
+
|
|
61
|
+
You can interact with the loaded context files by using the `/memory` command.
|
|
62
|
+
|
|
63
|
+
- **`/memory show`**: Displays the full, concatenated content of the current
|
|
64
|
+
hierarchical memory. This lets you inspect the exact instructional context
|
|
65
|
+
being provided to the model.
|
|
66
|
+
- **`/memory refresh`**: Forces a re-scan and reload of all `GEMINI.md` files
|
|
67
|
+
from all configured locations.
|
|
68
|
+
- **`/memory add <text>`**: Appends your text to your global
|
|
69
|
+
`~/.gemini/GEMINI.md` file. This lets you add persistent memories on the fly.
|
|
70
|
+
|
|
71
|
+
## Modularize context with imports
|
|
72
|
+
|
|
73
|
+
You can break down large `GEMINI.md` files into smaller, more manageable
|
|
74
|
+
components by importing content from other files using the `@file.md` syntax.
|
|
75
|
+
This feature supports both relative and absolute paths.
|
|
76
|
+
|
|
77
|
+
**Example `GEMINI.md` with imports:**
|
|
78
|
+
|
|
79
|
+
```markdown
|
|
80
|
+
# Main GEMINI.md file
|
|
81
|
+
|
|
82
|
+
This is the main content.
|
|
83
|
+
|
|
84
|
+
@./components/instructions.md
|
|
85
|
+
|
|
86
|
+
More content here.
|
|
87
|
+
|
|
88
|
+
@../shared/style-guide.md
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
For more details, see the [Memory Import Processor](../reference/memport.md)
|
|
92
|
+
documentation.
|
|
93
|
+
|
|
94
|
+
## Customize the context file name
|
|
95
|
+
|
|
96
|
+
While `GEMINI.md` is the default filename, you can configure this in your
|
|
97
|
+
`settings.json` file. To specify a different name or a list of names, use the
|
|
98
|
+
`context.fileName` property.
|
|
99
|
+
|
|
100
|
+
**Example `settings.json`:**
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"context": {
|
|
105
|
+
"fileName": ["AGENTS.md", "CONTEXT.md", "GEMINI.md"]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Next steps
|
|
111
|
+
|
|
112
|
+
- Learn about [Ignoring files](./gemini-ignore.md) to exclude content from the
|
|
113
|
+
context system.
|
|
114
|
+
- Explore the [Memory tool](../tools/memory.md) to save persistent memories.
|
|
115
|
+
- See how to use [Custom commands](./custom-commands.md) to automate common
|
|
116
|
+
prompts.
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# Advanced Model Configuration
|
|
2
|
+
|
|
3
|
+
This guide details the Model Configuration system within the Gemini CLI.
|
|
4
|
+
Designed for researchers, AI quality engineers, and advanced users, this system
|
|
5
|
+
provides a rigorous framework for managing generative model hyperparameters and
|
|
6
|
+
behaviors.
|
|
7
|
+
|
|
8
|
+
> **Warning**: This is a power-user feature. Configuration values are passed
|
|
9
|
+
> directly to the model provider with minimal validation. Incorrect settings
|
|
10
|
+
> (e.g., incompatible parameter combinations) may result in runtime errors from
|
|
11
|
+
> the API.
|
|
12
|
+
|
|
13
|
+
## 1. System Overview
|
|
14
|
+
|
|
15
|
+
The Model Configuration system (`ModelConfigService`) enables deterministic
|
|
16
|
+
control over model generation. It decouples the requested model identifier
|
|
17
|
+
(e.g., a CLI flag or agent request) from the underlying API configuration. This
|
|
18
|
+
allows for:
|
|
19
|
+
|
|
20
|
+
- **Precise Hyperparameter Tuning**: Direct control over `temperature`, `topP`,
|
|
21
|
+
`thinkingBudget`, and other SDK-level parameters.
|
|
22
|
+
- **Environment-Specific Behavior**: Distinct configurations for different
|
|
23
|
+
operating contexts (e.g., testing vs. production).
|
|
24
|
+
- **Agent-Scoped Customization**: Applying specific settings only when a
|
|
25
|
+
particular agent is active.
|
|
26
|
+
|
|
27
|
+
The system operates on two core primitives: **Aliases** and **Overrides**.
|
|
28
|
+
|
|
29
|
+
## 2. Configuration Primitives
|
|
30
|
+
|
|
31
|
+
These settings are located under the `modelConfigs` key in your configuration
|
|
32
|
+
file.
|
|
33
|
+
|
|
34
|
+
### Aliases (`customAliases`)
|
|
35
|
+
|
|
36
|
+
Aliases are named, reusable configuration presets. Users should define their own
|
|
37
|
+
aliases (or override system defaults) in the `customAliases` map.
|
|
38
|
+
|
|
39
|
+
- **Inheritance**: An alias can `extends` another alias (including system
|
|
40
|
+
defaults like `chat-base`), inheriting its `modelConfig`. Child aliases can
|
|
41
|
+
overwrite or augment inherited settings.
|
|
42
|
+
- **Abstract Aliases**: An alias is not required to specify a concrete `model`
|
|
43
|
+
if it serves purely as a base for other aliases.
|
|
44
|
+
|
|
45
|
+
**Example Hierarchy**:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
"modelConfigs": {
|
|
49
|
+
"customAliases": {
|
|
50
|
+
"base": {
|
|
51
|
+
"modelConfig": {
|
|
52
|
+
"generateContentConfig": { "temperature": 0.0 }
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"chat-base": {
|
|
56
|
+
"extends": "base",
|
|
57
|
+
"modelConfig": {
|
|
58
|
+
"generateContentConfig": { "temperature": 0.7 }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Overrides (`overrides`)
|
|
66
|
+
|
|
67
|
+
Overrides are conditional rules that inject configuration based on the runtime
|
|
68
|
+
context. They are evaluated dynamically for each model request.
|
|
69
|
+
|
|
70
|
+
- **Match Criteria**: Overrides apply when the request context matches the
|
|
71
|
+
specified `match` properties.
|
|
72
|
+
- `model`: Matches the requested model name or alias.
|
|
73
|
+
- `overrideScope`: Matches the distinct scope of the request (typically the
|
|
74
|
+
agent name, e.g., `codebaseInvestigator`).
|
|
75
|
+
|
|
76
|
+
**Example Override**:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
"modelConfigs": {
|
|
80
|
+
"overrides": [
|
|
81
|
+
{
|
|
82
|
+
"match": {
|
|
83
|
+
"overrideScope": "codebaseInvestigator"
|
|
84
|
+
},
|
|
85
|
+
"modelConfig": {
|
|
86
|
+
"generateContentConfig": { "temperature": 0.1 }
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 3. Resolution Strategy
|
|
94
|
+
|
|
95
|
+
The `ModelConfigService` resolves the final configuration through a two-step
|
|
96
|
+
process:
|
|
97
|
+
|
|
98
|
+
### Step 1: Alias Resolution
|
|
99
|
+
|
|
100
|
+
The requested model string is looked up in the merged map of system `aliases`
|
|
101
|
+
and user `customAliases`.
|
|
102
|
+
|
|
103
|
+
1. If found, the system recursively resolves the `extends` chain.
|
|
104
|
+
2. Settings are merged from parent to child (child wins).
|
|
105
|
+
3. This results in a base `ResolvedModelConfig`.
|
|
106
|
+
4. If not found, the requested string is treated as the raw model name.
|
|
107
|
+
|
|
108
|
+
### Step 2: Override Application
|
|
109
|
+
|
|
110
|
+
The system evaluates the `overrides` list against the request context (`model`
|
|
111
|
+
and `overrideScope`).
|
|
112
|
+
|
|
113
|
+
1. **Filtering**: All matching overrides are identified.
|
|
114
|
+
2. **Sorting**: Matches are prioritized by **specificity** (the number of
|
|
115
|
+
matched keys in the `match` object).
|
|
116
|
+
- Specific matches (e.g., `model` + `overrideScope`) override broad matches
|
|
117
|
+
(e.g., `model` only).
|
|
118
|
+
- Tie-breaking: If specificity is equal, the order of definition in the
|
|
119
|
+
`overrides` array is preserved (last one wins).
|
|
120
|
+
3. **Merging**: The configurations from the sorted overrides are merged
|
|
121
|
+
sequentially onto the base configuration.
|
|
122
|
+
|
|
123
|
+
## 4. Configuration Reference
|
|
124
|
+
|
|
125
|
+
The configuration follows the `ModelConfigServiceConfig` interface.
|
|
126
|
+
|
|
127
|
+
### `ModelConfig` Object
|
|
128
|
+
|
|
129
|
+
Defines the actual parameters for the model.
|
|
130
|
+
|
|
131
|
+
| Property | Type | Description |
|
|
132
|
+
| :---------------------- | :------- | :----------------------------------------------------------------- |
|
|
133
|
+
| `model` | `string` | The identifier of the model to be called (e.g., `gemini-2.5-pro`). |
|
|
134
|
+
| `generateContentConfig` | `object` | The configuration object passed to the `@google/genai` SDK. |
|
|
135
|
+
|
|
136
|
+
### `GenerateContentConfig` (Common Parameters)
|
|
137
|
+
|
|
138
|
+
Directly maps to the SDK's `GenerateContentConfig`. Common parameters include:
|
|
139
|
+
|
|
140
|
+
- **`temperature`**: (`number`) Controls output randomness. Lower values (0.0)
|
|
141
|
+
are deterministic; higher values (>0.7) are creative.
|
|
142
|
+
- **`topP`**: (`number`) Nucleus sampling probability.
|
|
143
|
+
- **`maxOutputTokens`**: (`number`) Limit on generated response length.
|
|
144
|
+
- **`thinkingConfig`**: (`object`) Configuration for models with reasoning
|
|
145
|
+
capabilities (e.g., `thinkingBudget`, `includeThoughts`).
|
|
146
|
+
|
|
147
|
+
## 5. Practical Examples
|
|
148
|
+
|
|
149
|
+
### Defining a Deterministic Baseline
|
|
150
|
+
|
|
151
|
+
Create an alias for tasks requiring high precision, extending the standard chat
|
|
152
|
+
configuration but enforcing zero temperature.
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
"modelConfigs": {
|
|
156
|
+
"customAliases": {
|
|
157
|
+
"precise-mode": {
|
|
158
|
+
"extends": "chat-base",
|
|
159
|
+
"modelConfig": {
|
|
160
|
+
"generateContentConfig": {
|
|
161
|
+
"temperature": 0.0,
|
|
162
|
+
"topP": 1.0
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Agent-Specific Parameter Injection
|
|
171
|
+
|
|
172
|
+
Enforce extended thinking budgets for a specific agent without altering the
|
|
173
|
+
global default, e.g. for the `codebaseInvestigator`.
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
"modelConfigs": {
|
|
177
|
+
"overrides": [
|
|
178
|
+
{
|
|
179
|
+
"match": {
|
|
180
|
+
"overrideScope": "codebaseInvestigator"
|
|
181
|
+
},
|
|
182
|
+
"modelConfig": {
|
|
183
|
+
"generateContentConfig": {
|
|
184
|
+
"thinkingConfig": { "thinkingBudget": 4096 }
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Experimental Model Evaluation
|
|
193
|
+
|
|
194
|
+
Route traffic for a specific alias to a preview model for A/B testing, without
|
|
195
|
+
changing client code.
|
|
196
|
+
|
|
197
|
+
```json
|
|
198
|
+
"modelConfigs": {
|
|
199
|
+
"overrides": [
|
|
200
|
+
{
|
|
201
|
+
"match": {
|
|
202
|
+
"model": "gemini-2.5-pro"
|
|
203
|
+
},
|
|
204
|
+
"modelConfig": {
|
|
205
|
+
"model": "gemini-2.5-pro-experimental-001"
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Headless mode reference
|
|
2
|
+
|
|
3
|
+
Headless mode provides a programmatic interface to Gemini CLI, returning
|
|
4
|
+
structured text or JSON output without an interactive terminal UI.
|
|
5
|
+
|
|
6
|
+
## Technical reference
|
|
7
|
+
|
|
8
|
+
Headless mode is triggered when the CLI is run in a non-TTY environment or when
|
|
9
|
+
providing a query as a positional argument without the interactive flag.
|
|
10
|
+
|
|
11
|
+
### Output formats
|
|
12
|
+
|
|
13
|
+
You can specify the output format using the `--output-format` flag.
|
|
14
|
+
|
|
15
|
+
#### JSON output
|
|
16
|
+
|
|
17
|
+
Returns a single JSON object containing the response and usage statistics.
|
|
18
|
+
|
|
19
|
+
- **Schema:**
|
|
20
|
+
- `response`: (string) The model's final answer.
|
|
21
|
+
- `stats`: (object) Token usage and API latency metrics.
|
|
22
|
+
- `error`: (object, optional) Error details if the request failed.
|
|
23
|
+
|
|
24
|
+
#### Streaming JSON output
|
|
25
|
+
|
|
26
|
+
Returns a stream of newline-delimited JSON (JSONL) events.
|
|
27
|
+
|
|
28
|
+
- **Event types:**
|
|
29
|
+
- `init`: Session metadata (session ID, model).
|
|
30
|
+
- `message`: User and assistant message chunks.
|
|
31
|
+
- `tool_use`: Tool call requests with arguments.
|
|
32
|
+
- `tool_result`: Output from executed tools.
|
|
33
|
+
- `error`: Non-fatal warnings and system errors.
|
|
34
|
+
- `result`: Final outcome with aggregated statistics.
|
|
35
|
+
|
|
36
|
+
## Exit codes
|
|
37
|
+
|
|
38
|
+
The CLI returns standard exit codes to indicate the result of the headless
|
|
39
|
+
execution:
|
|
40
|
+
|
|
41
|
+
- `0`: Success.
|
|
42
|
+
- `1`: General error or API failure.
|
|
43
|
+
- `42`: Input error (invalid prompt or arguments).
|
|
44
|
+
- `53`: Turn limit exceeded.
|
|
45
|
+
|
|
46
|
+
## Next steps
|
|
47
|
+
|
|
48
|
+
- Follow the [Automation tutorial](./tutorials/automation.md) for practical
|
|
49
|
+
scripting examples.
|
|
50
|
+
- See the [CLI reference](./cli-reference.md) for all available flags.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Model routing
|
|
2
|
+
|
|
3
|
+
Gemini CLI includes a model routing feature that automatically switches to a
|
|
4
|
+
fallback model in case of a model failure. This feature is enabled by default
|
|
5
|
+
and provides resilience when the primary model is unavailable.
|
|
6
|
+
|
|
7
|
+
## How it works
|
|
8
|
+
|
|
9
|
+
Model routing is managed by the `ModelAvailabilityService`, which monitors model
|
|
10
|
+
health and automatically routes requests to available models based on defined
|
|
11
|
+
policies.
|
|
12
|
+
|
|
13
|
+
1. **Model failure:** If the currently selected model fails (e.g., due to quota
|
|
14
|
+
or server errors), the CLI will initiate the fallback process.
|
|
15
|
+
|
|
16
|
+
2. **User consent:** Depending on the failure and the model's policy, the CLI
|
|
17
|
+
may prompt you to switch to a fallback model (by default always prompts
|
|
18
|
+
you).
|
|
19
|
+
|
|
20
|
+
Some internal utility calls (such as prompt completion and classification)
|
|
21
|
+
use a silent fallback chain for `gemini-2.5-flash-lite` and will fall back
|
|
22
|
+
to `gemini-2.5-flash` and `gemini-2.5-pro` without prompting or changing the
|
|
23
|
+
configured model.
|
|
24
|
+
|
|
25
|
+
3. **Model switch:** If approved, or if the policy allows for silent fallback,
|
|
26
|
+
the CLI will use an available fallback model for the current turn or the
|
|
27
|
+
remainder of the session.
|
|
28
|
+
|
|
29
|
+
### Model selection precedence
|
|
30
|
+
|
|
31
|
+
The model used by Gemini CLI is determined by the following order of precedence:
|
|
32
|
+
|
|
33
|
+
1. **`--model` command-line flag:** A model specified with the `--model` flag
|
|
34
|
+
when launching the CLI will always be used.
|
|
35
|
+
2. **`GEMINI_MODEL` environment variable:** If the `--model` flag is not used,
|
|
36
|
+
the CLI will use the model specified in the `GEMINI_MODEL` environment
|
|
37
|
+
variable.
|
|
38
|
+
3. **`model.name` in `settings.json`:** If neither of the above are set, the
|
|
39
|
+
model specified in the `model.name` property of your `settings.json` file
|
|
40
|
+
will be used.
|
|
41
|
+
4. **Default model:** If none of the above are set, the default model will be
|
|
42
|
+
used. The default model is `auto`
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Gemini CLI model selection (`/model` command)
|
|
2
|
+
|
|
3
|
+
Select your Gemini CLI model. The `/model` command lets you configure the model
|
|
4
|
+
used by Gemini CLI, giving you more control over your results. Use **Pro**
|
|
5
|
+
models for complex tasks and reasoning, **Flash** models for high speed results,
|
|
6
|
+
or the (recommended) **Auto** setting to choose the best model for your tasks.
|
|
7
|
+
|
|
8
|
+
> **Note:** The `/model` command (and the `--model` flag) does not override the
|
|
9
|
+
> model used by sub-agents. Consequently, even when using the `/model` flag you
|
|
10
|
+
> may see other models used in your model usage reports.
|
|
11
|
+
|
|
12
|
+
## How to use the `/model` command
|
|
13
|
+
|
|
14
|
+
Use the following command in Gemini CLI:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
/model
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Running this command will open a dialog with your options:
|
|
21
|
+
|
|
22
|
+
| Option | Description | Models |
|
|
23
|
+
| ----------------- | -------------------------------------------------------------- | -------------------------------------------- |
|
|
24
|
+
| Auto (Gemini 3) | Let the system choose the best Gemini 3 model for your task. | gemini-3-pro-preview, gemini-3-flash-preview |
|
|
25
|
+
| Auto (Gemini 2.5) | Let the system choose the best Gemini 2.5 model for your task. | gemini-2.5-pro, gemini-2.5-flash |
|
|
26
|
+
| Manual | Select a specific model. | Any available model. |
|
|
27
|
+
|
|
28
|
+
We recommend selecting one of the above **Auto** options. However, you can
|
|
29
|
+
select **Manual** to select a specific model from those available.
|
|
30
|
+
|
|
31
|
+
You can also use the `--model` flag to specify a particular Gemini model on
|
|
32
|
+
startup. For more details, refer to the
|
|
33
|
+
[configuration documentation](../reference/configuration.md).
|
|
34
|
+
|
|
35
|
+
Changes to these settings will be applied to all subsequent interactions with
|
|
36
|
+
Gemini CLI.
|
|
37
|
+
|
|
38
|
+
## Best practices for model selection
|
|
39
|
+
|
|
40
|
+
- **Default to Auto.** For most users, the _Auto_ option model provides a
|
|
41
|
+
balance between speed and performance, automatically selecting the correct
|
|
42
|
+
model based on the complexity of the task. Example: Developing a web
|
|
43
|
+
application could include a mix of complex tasks (building architecture and
|
|
44
|
+
scaffolding the project) and simple tasks (generating CSS).
|
|
45
|
+
|
|
46
|
+
- **Switch to Pro if you aren't getting the results you want.** If you think you
|
|
47
|
+
need your model to be a little "smarter," you can manually select Pro. Pro
|
|
48
|
+
will provide you with the highest levels of reasoning and creativity. Example:
|
|
49
|
+
A complex or multi-stage debugging task.
|
|
50
|
+
|
|
51
|
+
- **Switch to Flash or Flash-Lite if you need faster results.** If you need a
|
|
52
|
+
simple response quickly, Flash or Flash-Lite is the best option. Example:
|
|
53
|
+
Converting a JSON object to a YAML string.
|