@google/gemini-cli-core 0.31.0 → 0.33.0-nightly.20260228.1ca5c05d0
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/dist/docs/changelogs/index.md +22 -0
- package/dist/docs/changelogs/latest.md +307 -352
- package/dist/docs/changelogs/preview.md +391 -293
- package/dist/docs/cli/cli-reference.md +12 -12
- package/dist/docs/cli/custom-commands.md +9 -0
- package/dist/docs/cli/enterprise.md +19 -0
- package/dist/docs/cli/model.md +5 -14
- package/dist/docs/cli/plan-mode.md +29 -7
- package/dist/docs/cli/sandbox.md +42 -2
- package/dist/docs/cli/settings.md +15 -6
- package/dist/docs/cli/telemetry.md +68 -11
- package/dist/docs/cli/tutorials/automation.md +101 -5
- package/dist/docs/cli/tutorials/mcp-setup.md +8 -0
- package/dist/docs/cli/tutorials/skills-getting-started.md +8 -0
- package/dist/docs/extensions/reference.md +36 -0
- package/dist/docs/extensions/writing-extensions.md +16 -0
- package/dist/docs/get-started/authentication.md +86 -5
- package/dist/docs/get-started/installation.md +2 -2
- package/dist/docs/hooks/best-practices.md +33 -1
- package/dist/docs/hooks/writing-hooks.md +24 -0
- package/dist/docs/ide-integration/index.md +8 -0
- package/dist/docs/local-development.md +49 -43
- package/dist/docs/reference/configuration.md +48 -7
- package/dist/docs/reference/keyboard-shortcuts.md +6 -6
- package/dist/docs/reference/policy-engine.md +14 -3
- package/dist/docs/resources/faq.md +21 -0
- package/dist/docs/resources/tos-privacy.md +6 -0
- package/dist/docs/resources/troubleshooting.md +4 -1
- package/dist/docs/resources/uninstall.md +1 -10
- package/dist/docs/tools/mcp-server.md +22 -0
- package/dist/google-gemini-cli-core-0.33.0-nightly.20260227.08ee13613.tgz +0 -0
- package/dist/src/agents/a2a-client-manager.d.ts +7 -6
- package/dist/src/agents/a2a-client-manager.js +8 -9
- package/dist/src/agents/a2a-client-manager.js.map +1 -1
- package/dist/src/agents/a2a-client-manager.test.js +45 -31
- package/dist/src/agents/a2a-client-manager.test.js.map +1 -1
- package/dist/src/agents/a2aUtils.d.ts +25 -7
- package/dist/src/agents/a2aUtils.js +165 -58
- package/dist/src/agents/a2aUtils.js.map +1 -1
- package/dist/src/agents/a2aUtils.test.js +170 -27
- package/dist/src/agents/a2aUtils.test.js.map +1 -1
- package/dist/src/agents/generalist-agent.js +1 -2
- package/dist/src/agents/generalist-agent.js.map +1 -1
- package/dist/src/agents/registry.test.js +4 -2
- package/dist/src/agents/registry.test.js.map +1 -1
- package/dist/src/agents/remote-invocation.d.ts +2 -1
- package/dist/src/agents/remote-invocation.js +41 -22
- package/dist/src/agents/remote-invocation.js.map +1 -1
- package/dist/src/agents/remote-invocation.test.js +196 -56
- package/dist/src/agents/remote-invocation.test.js.map +1 -1
- package/dist/src/agents/subagent-tool-wrapper.js +1 -1
- package/dist/src/agents/subagent-tool-wrapper.test.js +1 -1
- package/dist/src/agents/subagent-tool.js +15 -2
- package/dist/src/agents/subagent-tool.js.map +1 -1
- package/dist/src/agents/subagent-tool.test.js +31 -0
- package/dist/src/agents/subagent-tool.test.js.map +1 -1
- package/dist/src/billing/billing.d.ts +80 -0
- package/dist/src/billing/billing.js +127 -0
- package/dist/src/billing/billing.js.map +1 -0
- package/dist/src/billing/billing.test.d.ts +6 -0
- package/dist/src/billing/billing.test.js +182 -0
- package/dist/src/billing/billing.test.js.map +1 -0
- package/dist/src/billing/index.d.ts +6 -0
- package/dist/src/billing/index.js +7 -0
- package/dist/src/billing/index.js.map +1 -0
- package/dist/src/code_assist/codeAssist.js +1 -1
- package/dist/src/code_assist/codeAssist.js.map +1 -1
- package/dist/src/code_assist/codeAssist.test.js +2 -2
- package/dist/src/code_assist/codeAssist.test.js.map +1 -1
- package/dist/src/code_assist/converter.d.ts +9 -4
- package/dist/src/code_assist/converter.js +17 -2
- package/dist/src/code_assist/converter.js.map +1 -1
- package/dist/src/code_assist/converter.test.js.map +1 -1
- package/dist/src/code_assist/oauth2.js +6 -3
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/oauth2.test.js +1 -0
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/server.d.ts +9 -4
- package/dist/src/code_assist/server.js +86 -5
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/server.test.js +11 -0
- package/dist/src/code_assist/server.test.js.map +1 -1
- package/dist/src/code_assist/setup.d.ts +2 -1
- package/dist/src/code_assist/setup.js +15 -4
- package/dist/src/code_assist/setup.js.map +1 -1
- package/dist/src/code_assist/types.d.ts +33 -10
- package/dist/src/code_assist/types.js.map +1 -1
- package/dist/src/config/config.d.ts +50 -4
- package/dist/src/config/config.js +77 -3
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +151 -1
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/storage.d.ts +1 -0
- package/dist/src/config/storage.js +3 -0
- package/dist/src/config/storage.js.map +1 -1
- package/dist/src/core/contentGenerator.d.ts +3 -2
- package/dist/src/core/contentGenerator.js +9 -2
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/coreToolScheduler.js +2 -1
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +21 -2
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/fakeContentGenerator.d.ts +2 -1
- package/dist/src/core/fakeContentGenerator.js +1 -0
- package/dist/src/core/fakeContentGenerator.js.map +1 -1
- package/dist/src/core/geminiChat.js +6 -2
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +34 -0
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/localLiteRtLmClient.d.ts +24 -0
- package/dist/src/core/localLiteRtLmClient.js +77 -0
- package/dist/src/core/localLiteRtLmClient.js.map +1 -0
- package/dist/src/core/localLiteRtLmClient.test.d.ts +6 -0
- package/dist/src/core/localLiteRtLmClient.test.js +87 -0
- package/dist/src/core/localLiteRtLmClient.test.js.map +1 -0
- package/dist/src/core/loggingContentGenerator.d.ts +3 -1
- package/dist/src/core/loggingContentGenerator.js +65 -17
- package/dist/src/core/loggingContentGenerator.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.test.js +164 -5
- package/dist/src/core/loggingContentGenerator.test.js.map +1 -1
- package/dist/src/core/prompts.test.js +1 -1
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/fallback/handler.js +2 -0
- package/dist/src/fallback/handler.js.map +1 -1
- package/dist/src/fallback/types.d.ts +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/generated/git-commit.js.map +1 -1
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/policy/config.d.ts +18 -6
- package/dist/src/policy/config.js +50 -12
- package/dist/src/policy/config.js.map +1 -1
- package/dist/src/policy/config.test.js +26 -26
- package/dist/src/policy/config.test.js.map +1 -1
- package/dist/src/policy/policies/plan.toml +1 -1
- package/dist/src/policy/policy-engine.d.ts +8 -0
- package/dist/src/policy/policy-engine.js +12 -0
- package/dist/src/policy/policy-engine.js.map +1 -1
- package/dist/src/policy/policy-engine.test.js +93 -0
- package/dist/src/policy/policy-engine.test.js.map +1 -1
- package/dist/src/policy/toml-loader.d.ts +1 -1
- package/dist/src/policy/toml-loader.js +4 -2
- package/dist/src/policy/toml-loader.js.map +1 -1
- package/dist/src/policy/toml-loader.test.js +15 -12
- package/dist/src/policy/toml-loader.test.js.map +1 -1
- package/dist/src/policy/workspace-policy.test.js +10 -10
- package/dist/src/prompts/snippets.js +43 -27
- package/dist/src/prompts/snippets.js.map +1 -1
- package/dist/src/routing/modelRouterService.js +19 -11
- package/dist/src/routing/modelRouterService.js.map +1 -1
- package/dist/src/routing/modelRouterService.test.js +38 -1
- package/dist/src/routing/modelRouterService.test.js.map +1 -1
- package/dist/src/routing/routingStrategy.d.ts +3 -2
- package/dist/src/routing/strategies/classifierStrategy.d.ts +2 -1
- package/dist/src/routing/strategies/classifierStrategy.js +1 -1
- package/dist/src/routing/strategies/classifierStrategy.js.map +1 -1
- package/dist/src/routing/strategies/classifierStrategy.test.js +15 -13
- package/dist/src/routing/strategies/classifierStrategy.test.js.map +1 -1
- package/dist/src/routing/strategies/compositeStrategy.d.ts +2 -1
- package/dist/src/routing/strategies/compositeStrategy.js +3 -3
- package/dist/src/routing/strategies/compositeStrategy.js.map +1 -1
- package/dist/src/routing/strategies/compositeStrategy.test.js +10 -8
- package/dist/src/routing/strategies/compositeStrategy.test.js.map +1 -1
- package/dist/src/routing/strategies/defaultStrategy.d.ts +2 -1
- package/dist/src/routing/strategies/defaultStrategy.js +1 -1
- package/dist/src/routing/strategies/defaultStrategy.js.map +1 -1
- package/dist/src/routing/strategies/defaultStrategy.test.js +8 -4
- package/dist/src/routing/strategies/defaultStrategy.test.js.map +1 -1
- package/dist/src/routing/strategies/fallbackStrategy.d.ts +2 -1
- package/dist/src/routing/strategies/fallbackStrategy.js +1 -1
- package/dist/src/routing/strategies/fallbackStrategy.js.map +1 -1
- package/dist/src/routing/strategies/fallbackStrategy.test.js +6 -5
- package/dist/src/routing/strategies/fallbackStrategy.test.js.map +1 -1
- package/dist/src/routing/strategies/gemmaClassifierStrategy.d.ts +14 -0
- package/dist/src/routing/strategies/gemmaClassifierStrategy.js +182 -0
- package/dist/src/routing/strategies/gemmaClassifierStrategy.js.map +1 -0
- package/dist/src/routing/strategies/gemmaClassifierStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/gemmaClassifierStrategy.test.js +218 -0
- package/dist/src/routing/strategies/gemmaClassifierStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/numericalClassifierStrategy.d.ts +2 -1
- package/dist/src/routing/strategies/numericalClassifierStrategy.js +1 -1
- package/dist/src/routing/strategies/numericalClassifierStrategy.js.map +1 -1
- package/dist/src/routing/strategies/numericalClassifierStrategy.test.js +24 -22
- package/dist/src/routing/strategies/numericalClassifierStrategy.test.js.map +1 -1
- package/dist/src/routing/strategies/overrideStrategy.d.ts +2 -1
- package/dist/src/routing/strategies/overrideStrategy.js +1 -1
- package/dist/src/routing/strategies/overrideStrategy.js.map +1 -1
- package/dist/src/routing/strategies/overrideStrategy.test.js +5 -4
- package/dist/src/routing/strategies/overrideStrategy.test.js.map +1 -1
- package/dist/src/scheduler/scheduler.d.ts +1 -0
- package/dist/src/scheduler/scheduler.js +18 -7
- package/dist/src/scheduler/scheduler.js.map +1 -1
- package/dist/src/scheduler/scheduler.test.js +19 -1
- package/dist/src/scheduler/scheduler.test.js.map +1 -1
- package/dist/src/scheduler/scheduler_parallel.test.js +94 -3
- package/dist/src/scheduler/scheduler_parallel.test.js.map +1 -1
- package/dist/src/scheduler/tool-executor.js +21 -12
- package/dist/src/scheduler/tool-executor.js.map +1 -1
- package/dist/src/scheduler/tool-executor.test.js +54 -0
- package/dist/src/scheduler/tool-executor.test.js.map +1 -1
- package/dist/src/services/trackerService.d.ts +49 -0
- package/dist/src/services/trackerService.js +172 -0
- package/dist/src/services/trackerService.js.map +1 -0
- package/dist/src/services/trackerService.test.d.ts +6 -0
- package/dist/src/services/trackerService.test.js +117 -0
- package/dist/src/services/trackerService.test.js.map +1 -0
- package/dist/src/services/trackerTypes.d.ts +51 -0
- package/dist/src/services/trackerTypes.js +33 -0
- package/dist/src/services/trackerTypes.js.map +1 -0
- package/dist/src/telemetry/billingEvents.d.ts +75 -0
- package/dist/src/telemetry/billingEvents.js +181 -0
- package/dist/src/telemetry/billingEvents.js.map +1 -0
- package/dist/src/telemetry/billingEvents.test.d.ts +6 -0
- package/dist/src/telemetry/billingEvents.test.js +139 -0
- package/dist/src/telemetry/billingEvents.test.js.map +1 -0
- package/dist/src/telemetry/conseca-logger.test.js +1 -0
- package/dist/src/telemetry/conseca-logger.test.js.map +1 -1
- package/dist/src/telemetry/constants.d.ts +25 -0
- package/dist/src/telemetry/constants.js +29 -0
- package/dist/src/telemetry/constants.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +3 -1
- package/dist/src/telemetry/index.js +5 -1
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +2 -0
- package/dist/src/telemetry/loggers.js +10 -0
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +16 -0
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/metrics.d.ts +28 -0
- package/dist/src/telemetry/metrics.js +40 -0
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/sanitize.test.js +1 -0
- package/dist/src/telemetry/sanitize.test.js.map +1 -1
- package/dist/src/telemetry/sdk.test.js +1 -0
- package/dist/src/telemetry/sdk.test.js.map +1 -1
- package/dist/src/telemetry/telemetryAttributes.js +2 -0
- package/dist/src/telemetry/telemetryAttributes.js.map +1 -1
- package/dist/src/telemetry/trace.d.ts +2 -1
- package/dist/src/telemetry/trace.js +13 -18
- package/dist/src/telemetry/trace.js.map +1 -1
- package/dist/src/telemetry/trace.test.d.ts +6 -0
- package/dist/src/telemetry/trace.test.js +116 -0
- package/dist/src/telemetry/trace.test.js.map +1 -0
- package/dist/src/tools/confirmation-policy.test.js +1 -0
- package/dist/src/tools/confirmation-policy.test.js.map +1 -1
- package/dist/src/tools/definitions/model-family-sets/default-legacy.js +2 -2
- package/dist/src/tools/definitions/model-family-sets/default-legacy.js.map +1 -1
- package/dist/src/tools/definitions/model-family-sets/gemini-3.js +3 -3
- package/dist/src/tools/definitions/model-family-sets/gemini-3.js.map +1 -1
- package/dist/src/tools/grep-utils.d.ts +1 -1
- package/dist/src/tools/grep-utils.js +4 -4
- package/dist/src/tools/grep-utils.js.map +1 -1
- package/dist/src/tools/grep.d.ts +1 -1
- package/dist/src/tools/grep.js +9 -9
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/grep.test.js +8 -5
- package/dist/src/tools/grep.test.js.map +1 -1
- package/dist/src/tools/line-endings.test.js +3 -11
- package/dist/src/tools/line-endings.test.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.d.ts +25 -0
- package/dist/src/tools/mcp-client-manager.js +66 -3
- package/dist/src/tools/mcp-client-manager.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.test.js +47 -0
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +20 -9
- package/dist/src/tools/mcp-client.js +50 -46
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +96 -84
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +3 -3
- package/dist/src/tools/mcp-tool.js +1 -0
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/ripGrep.d.ts +1 -1
- package/dist/src/tools/ripGrep.js +7 -7
- package/dist/src/tools/ripGrep.js.map +1 -1
- package/dist/src/tools/ripGrep.test.js +10 -7
- package/dist/src/tools/ripGrep.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +1 -0
- package/dist/src/tools/tools.js +1 -0
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/write-file.js +4 -17
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-file.test.js +29 -83
- package/dist/src/tools/write-file.test.js.map +1 -1
- package/dist/src/utils/editCorrector.d.ts +1 -42
- package/dist/src/utils/editCorrector.js +9 -461
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/editCorrector.test.js +17 -421
- package/dist/src/utils/editCorrector.test.js.map +1 -1
- package/dist/src/utils/envExpansion.js.map +1 -1
- package/dist/src/utils/errors.js +7 -0
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/errors_timeout.test.d.ts +6 -0
- package/dist/src/utils/errors_timeout.test.js +40 -0
- package/dist/src/utils/errors_timeout.test.js.map +1 -0
- package/dist/src/utils/extensionLoader.js +35 -0
- package/dist/src/utils/extensionLoader.js.map +1 -1
- package/dist/src/utils/extensionLoader.test.js +36 -0
- package/dist/src/utils/extensionLoader.test.js.map +1 -1
- package/dist/src/utils/fetch.js +13 -2
- package/dist/src/utils/fetch.js.map +1 -1
- package/dist/src/utils/fileUtils.js +0 -1
- package/dist/src/utils/fileUtils.js.map +1 -1
- package/dist/src/utils/fileUtils.test.js +0 -1
- package/dist/src/utils/fileUtils.test.js.map +1 -1
- package/dist/src/utils/flashFallback.test.js +24 -0
- package/dist/src/utils/flashFallback.test.js.map +1 -1
- package/dist/src/utils/googleErrors.d.ts +2 -2
- package/dist/src/utils/googleQuotaErrors.d.ts +3 -1
- package/dist/src/utils/googleQuotaErrors.js +22 -12
- package/dist/src/utils/googleQuotaErrors.js.map +1 -1
- package/dist/src/utils/googleQuotaErrors.test.js +33 -1
- package/dist/src/utils/googleQuotaErrors.test.js.map +1 -1
- package/dist/src/utils/retry.js +4 -2
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +20 -0
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/src/utils/schemaValidator.js +0 -1
- package/dist/src/utils/schemaValidator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -5,18 +5,18 @@ and parameters.
|
|
|
5
5
|
|
|
6
6
|
## CLI commands
|
|
7
7
|
|
|
8
|
-
| Command | Description | Example
|
|
9
|
-
| ---------------------------------- | ---------------------------------- |
|
|
10
|
-
| `gemini` | Start interactive REPL | `gemini`
|
|
11
|
-
| `gemini "query"` | Query non-interactively, then exit | `gemini "explain this project"`
|
|
12
|
-
| `cat file \| gemini` | Process piped content | `cat logs.txt \| gemini`
|
|
13
|
-
| `gemini -i "query"` | Execute and continue interactively | `gemini -i "What is the purpose of this project?"`
|
|
14
|
-
| `gemini -r "latest"` | Continue most recent session | `gemini -r "latest"`
|
|
15
|
-
| `gemini -r "latest" "query"` | Continue session with a new prompt | `gemini -r "latest" "Check for type errors"`
|
|
16
|
-
| `gemini -r "<session-id>" "query"` | Resume session by ID | `gemini -r "abc123" "Finish this PR"`
|
|
17
|
-
| `gemini update` | Update to latest version | `gemini update`
|
|
18
|
-
| `gemini extensions` | Manage extensions | See [Extensions Management](#extensions-management)
|
|
19
|
-
| `gemini mcp` | Configure MCP servers | See [MCP Server Management](#mcp-server-management)
|
|
8
|
+
| Command | Description | Example |
|
|
9
|
+
| ---------------------------------- | ---------------------------------- | ------------------------------------------------------------ |
|
|
10
|
+
| `gemini` | Start interactive REPL | `gemini` |
|
|
11
|
+
| `gemini "query"` | Query non-interactively, then exit | `gemini "explain this project"` |
|
|
12
|
+
| `cat file \| gemini` | Process piped content | `cat logs.txt \| gemini`<br>`Get-Content logs.txt \| gemini` |
|
|
13
|
+
| `gemini -i "query"` | Execute and continue interactively | `gemini -i "What is the purpose of this project?"` |
|
|
14
|
+
| `gemini -r "latest"` | Continue most recent session | `gemini -r "latest"` |
|
|
15
|
+
| `gemini -r "latest" "query"` | Continue session with a new prompt | `gemini -r "latest" "Check for type errors"` |
|
|
16
|
+
| `gemini -r "<session-id>" "query"` | Resume session by ID | `gemini -r "abc123" "Finish this PR"` |
|
|
17
|
+
| `gemini update` | Update to latest version | `gemini update` |
|
|
18
|
+
| `gemini extensions` | Manage extensions | See [Extensions Management](#extensions-management) |
|
|
19
|
+
| `gemini mcp` | Configure MCP servers | See [MCP Server Management](#mcp-server-management) |
|
|
20
20
|
|
|
21
21
|
### Positional arguments
|
|
22
22
|
|
|
@@ -278,11 +278,20 @@ Let's create a global command that asks the model to refactor a piece of code.
|
|
|
278
278
|
First, ensure the user commands directory exists, then create a `refactor`
|
|
279
279
|
subdirectory for organization and the final TOML file.
|
|
280
280
|
|
|
281
|
+
**macOS/Linux**
|
|
282
|
+
|
|
281
283
|
```bash
|
|
282
284
|
mkdir -p ~/.gemini/commands/refactor
|
|
283
285
|
touch ~/.gemini/commands/refactor/pure.toml
|
|
284
286
|
```
|
|
285
287
|
|
|
288
|
+
**Windows (PowerShell)**
|
|
289
|
+
|
|
290
|
+
```powershell
|
|
291
|
+
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.gemini\commands\refactor"
|
|
292
|
+
New-Item -ItemType File -Force -Path "$env:USERPROFILE\.gemini\commands\refactor\pure.toml"
|
|
293
|
+
```
|
|
294
|
+
|
|
286
295
|
**2. Add the content to the file:**
|
|
287
296
|
|
|
288
297
|
Open `~/.gemini/commands/refactor/pure.toml` in your editor and add the
|
|
@@ -203,6 +203,15 @@ with the actual Gemini CLI process, which inherits the environment variable.
|
|
|
203
203
|
This makes it significantly more difficult for a user to bypass the enforced
|
|
204
204
|
settings.
|
|
205
205
|
|
|
206
|
+
**PowerShell Profile (Windows alternative):**
|
|
207
|
+
|
|
208
|
+
On Windows, administrators can achieve similar results by adding the environment
|
|
209
|
+
variable to the system-wide or user-specific PowerShell profile:
|
|
210
|
+
|
|
211
|
+
```powershell
|
|
212
|
+
Add-Content -Path $PROFILE -Value '$env:GEMINI_CLI_SYSTEM_SETTINGS_PATH="C:\ProgramData\gemini-cli\settings.json"'
|
|
213
|
+
```
|
|
214
|
+
|
|
206
215
|
## User isolation in shared environments
|
|
207
216
|
|
|
208
217
|
In shared compute environments (like ML experiment runners or shared build
|
|
@@ -214,12 +223,22 @@ use the `GEMINI_CLI_HOME` environment variable to point to a unique directory
|
|
|
214
223
|
for a specific user or job. The CLI will create a `.gemini` folder inside the
|
|
215
224
|
specified path.
|
|
216
225
|
|
|
226
|
+
**macOS/Linux**
|
|
227
|
+
|
|
217
228
|
```bash
|
|
218
229
|
# Isolate state for a specific job
|
|
219
230
|
export GEMINI_CLI_HOME="/tmp/gemini-job-123"
|
|
220
231
|
gemini
|
|
221
232
|
```
|
|
222
233
|
|
|
234
|
+
**Windows (PowerShell)**
|
|
235
|
+
|
|
236
|
+
```powershell
|
|
237
|
+
# Isolate state for a specific job
|
|
238
|
+
$env:GEMINI_CLI_HOME="C:\temp\gemini-job-123"
|
|
239
|
+
gemini
|
|
240
|
+
```
|
|
241
|
+
|
|
223
242
|
## Restricting tool access
|
|
224
243
|
|
|
225
244
|
You can significantly enhance security by controlling which tools the Gemini
|
package/dist/docs/cli/model.md
CHANGED
|
@@ -19,24 +19,15 @@ Use the following command in Gemini CLI:
|
|
|
19
19
|
|
|
20
20
|
Running this command will open a dialog with your options:
|
|
21
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
|
|
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.
|
|
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
27
|
|
|
28
28
|
We recommend selecting one of the above **Auto** options. However, you can
|
|
29
29
|
select **Manual** to select a specific model from those available.
|
|
30
30
|
|
|
31
|
-
### Gemini 3 and preview features
|
|
32
|
-
|
|
33
|
-
> **Note:** Gemini 3 is not currently available on all account types. To learn
|
|
34
|
-
> more about Gemini 3 access, refer to
|
|
35
|
-
> [Gemini 3 on Gemini CLI](../get-started/gemini-3.md).
|
|
36
|
-
|
|
37
|
-
To enable Gemini 3 Pro and Gemini 3 Flash (if available), enable
|
|
38
|
-
[**Preview Features** by using the `settings` command](../cli/settings.md).
|
|
39
|
-
|
|
40
31
|
You can also use the `--model` flag to specify a particular Gemini model on
|
|
41
32
|
startup. For more details, refer to the
|
|
42
33
|
[configuration documentation](../reference/configuration.md).
|
|
@@ -80,18 +80,37 @@ manually during a session.
|
|
|
80
80
|
|
|
81
81
|
### Planning Workflow
|
|
82
82
|
|
|
83
|
+
Plan Mode uses an adaptive planning workflow where the research depth, plan
|
|
84
|
+
structure, and consultation level are proportional to the task's complexity:
|
|
85
|
+
|
|
83
86
|
1. **Explore & Analyze:** Analyze requirements and use read-only tools to map
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
affected modules and identify dependencies.
|
|
88
|
+
2. **Consult:** The depth of consultation is proportional to the task's
|
|
89
|
+
complexity:
|
|
90
|
+
- **Simple Tasks:** Proceed directly to drafting.
|
|
91
|
+
- **Standard Tasks:** Present a summary of viable approaches via
|
|
92
|
+
[`ask_user`] for selection.
|
|
93
|
+
- **Complex Tasks:** Present detailed trade-offs for at least two viable
|
|
94
|
+
approaches via [`ask_user`] and obtain approval before drafting.
|
|
95
|
+
3. **Draft:** Write a detailed implementation plan to the
|
|
96
|
+
[plans directory](#custom-plan-directory-and-policies). The plan's structure
|
|
97
|
+
adapts to the task:
|
|
98
|
+
- **Simple Tasks:** Focused on specific **Changes** and **Verification**
|
|
99
|
+
steps.
|
|
100
|
+
- **Standard Tasks:** Includes an **Objective**, **Key Files & Context**,
|
|
101
|
+
**Implementation Steps**, and **Verification & Testing**.
|
|
102
|
+
- **Complex Tasks:** Comprehensive plans including **Background &
|
|
103
|
+
Motivation**, **Scope & Impact**, **Proposed Solution**, **Alternatives
|
|
104
|
+
Considered**, a phased **Implementation Plan**, **Verification**, and
|
|
105
|
+
**Migration & Rollback** strategies.
|
|
91
106
|
4. **Review & Approval:** Use the [`exit_plan_mode`] tool to present the plan
|
|
92
107
|
and formally request approval.
|
|
93
108
|
- **Approve:** Exit Plan Mode and start implementation.
|
|
94
109
|
- **Iterate:** Provide feedback to refine the plan.
|
|
110
|
+
- **Refine manually:** Press **Ctrl + X** to open the plan file in your
|
|
111
|
+
[preferred external editor]. This allows you to manually refine the plan
|
|
112
|
+
steps before approval. The CLI will automatically refresh and show the
|
|
113
|
+
updated plan after you save and close the editor.
|
|
95
114
|
|
|
96
115
|
For more complex or specialized planning tasks, you can
|
|
97
116
|
[customize the planning workflow with skills](#customizing-planning-with-skills).
|
|
@@ -119,6 +138,7 @@ These are the only allowed tools:
|
|
|
119
138
|
- **Planning (Write):** [`write_file`] and [`replace`] only allowed for `.md`
|
|
120
139
|
files in the `~/.gemini/tmp/<project>/<session-id>/plans/` directory or your
|
|
121
140
|
[custom plans directory](#custom-plan-directory-and-policies).
|
|
141
|
+
- **Memory:** [`save_memory`]
|
|
122
142
|
- **Skills:** [`activate_skill`] (allows loading specialized instructions and
|
|
123
143
|
resources in a read-only manner)
|
|
124
144
|
|
|
@@ -277,6 +297,7 @@ performance. You can disable this automatic switching in your settings:
|
|
|
277
297
|
[`google_web_search`]: /docs/tools/web-search.md
|
|
278
298
|
[`replace`]: /docs/tools/file-system.md#6-replace-edit
|
|
279
299
|
[MCP tools]: /docs/tools/mcp-server.md
|
|
300
|
+
[`save_memory`]: /docs/tools/memory.md
|
|
280
301
|
[`activate_skill`]: /docs/cli/skills.md
|
|
281
302
|
[subagents]: /docs/core/subagents.md
|
|
282
303
|
[policy engine]: /docs/reference/policy-engine.md
|
|
@@ -288,3 +309,4 @@ performance. You can disable this automatic switching in your settings:
|
|
|
288
309
|
https://github.com/google-gemini/gemini-cli/blob/main/packages/core/src/policy/policies/plan.toml
|
|
289
310
|
[auto model]: /docs/reference/configuration.md#model-settings
|
|
290
311
|
[model routing]: /docs/cli/telemetry.md#model-routing
|
|
312
|
+
[preferred external editor]: /docs/reference/configuration.md#general
|
package/dist/docs/cli/sandbox.md
CHANGED
|
@@ -55,12 +55,27 @@ from your organization's registry.
|
|
|
55
55
|
```bash
|
|
56
56
|
# Enable sandboxing with command flag
|
|
57
57
|
gemini -s -p "analyze the code structure"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Use environment variable**
|
|
61
|
+
|
|
62
|
+
**macOS/Linux**
|
|
58
63
|
|
|
59
|
-
|
|
64
|
+
```bash
|
|
60
65
|
export GEMINI_SANDBOX=true
|
|
61
66
|
gemini -p "run the test suite"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Windows (PowerShell)**
|
|
62
70
|
|
|
63
|
-
|
|
71
|
+
```powershell
|
|
72
|
+
$env:GEMINI_SANDBOX="true"
|
|
73
|
+
gemini -p "run the test suite"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Configure in settings.json**
|
|
77
|
+
|
|
78
|
+
```json
|
|
64
79
|
{
|
|
65
80
|
"tools": {
|
|
66
81
|
"sandbox": "docker"
|
|
@@ -99,26 +114,51 @@ use cases.
|
|
|
99
114
|
|
|
100
115
|
To disable SELinux labeling for volume mounts, you can set the following:
|
|
101
116
|
|
|
117
|
+
**macOS/Linux**
|
|
118
|
+
|
|
102
119
|
```bash
|
|
103
120
|
export SANDBOX_FLAGS="--security-opt label=disable"
|
|
104
121
|
```
|
|
105
122
|
|
|
123
|
+
**Windows (PowerShell)**
|
|
124
|
+
|
|
125
|
+
```powershell
|
|
126
|
+
$env:SANDBOX_FLAGS="--security-opt label=disable"
|
|
127
|
+
```
|
|
128
|
+
|
|
106
129
|
Multiple flags can be provided as a space-separated string:
|
|
107
130
|
|
|
131
|
+
**macOS/Linux**
|
|
132
|
+
|
|
108
133
|
```bash
|
|
109
134
|
export SANDBOX_FLAGS="--flag1 --flag2=value"
|
|
110
135
|
```
|
|
111
136
|
|
|
137
|
+
**Windows (PowerShell)**
|
|
138
|
+
|
|
139
|
+
```powershell
|
|
140
|
+
$env:SANDBOX_FLAGS="--flag1 --flag2=value"
|
|
141
|
+
```
|
|
142
|
+
|
|
112
143
|
## Linux UID/GID handling
|
|
113
144
|
|
|
114
145
|
The sandbox automatically handles user permissions on Linux. Override these
|
|
115
146
|
permissions with:
|
|
116
147
|
|
|
148
|
+
**macOS/Linux**
|
|
149
|
+
|
|
117
150
|
```bash
|
|
118
151
|
export SANDBOX_SET_UID_GID=true # Force host UID/GID
|
|
119
152
|
export SANDBOX_SET_UID_GID=false # Disable UID/GID mapping
|
|
120
153
|
```
|
|
121
154
|
|
|
155
|
+
**Windows (PowerShell)**
|
|
156
|
+
|
|
157
|
+
```powershell
|
|
158
|
+
$env:SANDBOX_SET_UID_GID="true" # Force host UID/GID
|
|
159
|
+
$env:SANDBOX_SET_UID_GID="false" # Disable UID/GID mapping
|
|
160
|
+
```
|
|
161
|
+
|
|
122
162
|
## Troubleshooting
|
|
123
163
|
|
|
124
164
|
### Common issues
|
|
@@ -72,6 +72,7 @@ they appear in the UI.
|
|
|
72
72
|
| Incremental Rendering | `ui.incrementalRendering` | Enable incremental rendering for the UI. This option will reduce flickering but may cause rendering artifacts. Only supported when useAlternateBuffer is enabled. | `true` |
|
|
73
73
|
| Show Spinner | `ui.showSpinner` | Show the spinner during operations. | `true` |
|
|
74
74
|
| Loading Phrases | `ui.loadingPhrases` | What to show while the model is working: tips, witty comments, both, or nothing. | `"tips"` |
|
|
75
|
+
| Error Verbosity | `ui.errorVerbosity` | Controls whether recoverable errors are hidden (low) or fully shown (full). | `"low"` |
|
|
75
76
|
| Screen Reader Mode | `ui.accessibility.screenReader` | Render output in plain-text to be more screen reader accessible | `false` |
|
|
76
77
|
|
|
77
78
|
### IDE
|
|
@@ -80,14 +81,21 @@ they appear in the UI.
|
|
|
80
81
|
| -------- | ------------- | ---------------------------- | ------- |
|
|
81
82
|
| IDE Mode | `ide.enabled` | Enable IDE integration mode. | `false` |
|
|
82
83
|
|
|
84
|
+
### Billing
|
|
85
|
+
|
|
86
|
+
| UI Label | Setting | Description | Default |
|
|
87
|
+
| ---------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
|
|
88
|
+
| Overage Strategy | `billing.overageStrategy` | How to handle quota exhaustion when AI credits are available. 'ask' prompts each time, 'always' automatically uses credits, 'never' disables credit usage. | `"ask"` |
|
|
89
|
+
|
|
83
90
|
### Model
|
|
84
91
|
|
|
85
|
-
| UI Label | Setting | Description | Default
|
|
86
|
-
| ----------------------- | ---------------------------- | -------------------------------------------------------------------------------------- |
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
92
|
+
| UI Label | Setting | Description | Default |
|
|
93
|
+
| ----------------------- | ---------------------------- | -------------------------------------------------------------------------------------- | ----------- |
|
|
94
|
+
| Model | `model.name` | The Gemini model to use for conversations. | `undefined` |
|
|
95
|
+
| Max Session Turns | `model.maxSessionTurns` | Maximum number of user/model/tool turns to keep in a session. -1 means unlimited. | `-1` |
|
|
96
|
+
| Compression Threshold | `model.compressionThreshold` | The fraction of context usage at which to trigger context compression (e.g. 0.2, 0.3). | `0.5` |
|
|
97
|
+
| Disable Loop Detection | `model.disableLoopDetection` | Disable automatic detection and prevention of infinite loops. | `false` |
|
|
98
|
+
| Skip Next Speaker Check | `model.skipNextSpeakerCheck` | Skip the next speaker check. | `true` |
|
|
91
99
|
|
|
92
100
|
### Context
|
|
93
101
|
|
|
@@ -139,6 +147,7 @@ they appear in the UI.
|
|
|
139
147
|
| Plan | `experimental.plan` | Enable planning features (Plan Mode and tools). | `false` |
|
|
140
148
|
| Model Steering | `experimental.modelSteering` | Enable model steering (user hints) to guide the model during tool execution. | `false` |
|
|
141
149
|
| Direct Web Fetch | `experimental.directWebFetch` | Enable web fetch behavior that bypasses LLM summarization. | `false` |
|
|
150
|
+
| Enable Gemma Model Router | `experimental.gemmaModelRouter.enabled` | Enable the Gemma Model Router. Requires a local endpoint serving Gemma via the Gemini API using LiteRT-LM shim. | `false` |
|
|
142
151
|
|
|
143
152
|
### Skills
|
|
144
153
|
|
|
@@ -103,23 +103,52 @@ Before using either method below, complete these steps:
|
|
|
103
103
|
|
|
104
104
|
1. Set your Google Cloud project ID:
|
|
105
105
|
- For telemetry in a separate project from inference:
|
|
106
|
+
|
|
107
|
+
**macOS/Linux**
|
|
108
|
+
|
|
106
109
|
```bash
|
|
107
110
|
export OTLP_GOOGLE_CLOUD_PROJECT="your-telemetry-project-id"
|
|
108
111
|
```
|
|
112
|
+
|
|
113
|
+
**Windows (PowerShell)**
|
|
114
|
+
|
|
115
|
+
```powershell
|
|
116
|
+
$env:OTLP_GOOGLE_CLOUD_PROJECT="your-telemetry-project-id"
|
|
117
|
+
```
|
|
118
|
+
|
|
109
119
|
- For telemetry in the same project as inference:
|
|
120
|
+
|
|
121
|
+
**macOS/Linux**
|
|
122
|
+
|
|
110
123
|
```bash
|
|
111
124
|
export GOOGLE_CLOUD_PROJECT="your-project-id"
|
|
112
125
|
```
|
|
113
126
|
|
|
127
|
+
**Windows (PowerShell)**
|
|
128
|
+
|
|
129
|
+
```powershell
|
|
130
|
+
$env:GOOGLE_CLOUD_PROJECT="your-project-id"
|
|
131
|
+
```
|
|
132
|
+
|
|
114
133
|
2. Authenticate with Google Cloud:
|
|
115
134
|
- If using a user account:
|
|
116
135
|
```bash
|
|
117
136
|
gcloud auth application-default login
|
|
118
137
|
```
|
|
119
138
|
- If using a service account:
|
|
139
|
+
|
|
140
|
+
**macOS/Linux**
|
|
141
|
+
|
|
120
142
|
```bash
|
|
121
143
|
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-account.json"
|
|
122
144
|
```
|
|
145
|
+
|
|
146
|
+
**Windows (PowerShell)**
|
|
147
|
+
|
|
148
|
+
```powershell
|
|
149
|
+
$env:GOOGLE_APPLICATION_CREDENTIALS="C:\path\to\your\service-account.json"
|
|
150
|
+
```
|
|
151
|
+
|
|
123
152
|
3. Make sure your account or service account has these IAM roles:
|
|
124
153
|
- Cloud Trace Agent
|
|
125
154
|
- Monitoring Metric Writer
|
|
@@ -176,11 +205,12 @@ Sends telemetry directly to Google Cloud services. No collector needed.
|
|
|
176
205
|
}
|
|
177
206
|
```
|
|
178
207
|
2. Run Gemini CLI and send prompts.
|
|
179
|
-
3. View logs and
|
|
208
|
+
3. View logs, metrics, and traces:
|
|
180
209
|
- Open the Google Cloud Console in your browser after sending prompts:
|
|
181
|
-
- Logs: https://console.cloud.google.com/logs/
|
|
182
|
-
- Metrics:
|
|
183
|
-
|
|
210
|
+
- Logs (Logs Explorer): https://console.cloud.google.com/logs/
|
|
211
|
+
- Metrics (Metrics Explorer):
|
|
212
|
+
https://console.cloud.google.com/monitoring/metrics-explorer
|
|
213
|
+
- Traces (Trace Explorer): https://console.cloud.google.com/traces/list
|
|
184
214
|
|
|
185
215
|
### Collector-based export (advanced)
|
|
186
216
|
|
|
@@ -208,11 +238,12 @@ forward data to Google Cloud.
|
|
|
208
238
|
- Save collector logs to `~/.gemini/tmp/<projectHash>/otel/collector-gcp.log`
|
|
209
239
|
- Stop collector on exit (e.g. `Ctrl+C`)
|
|
210
240
|
3. Run Gemini CLI and send prompts.
|
|
211
|
-
4. View logs and
|
|
241
|
+
4. View logs, metrics, and traces:
|
|
212
242
|
- Open the Google Cloud Console in your browser after sending prompts:
|
|
213
|
-
- Logs: https://console.cloud.google.com/logs/
|
|
214
|
-
- Metrics:
|
|
215
|
-
|
|
243
|
+
- Logs (Logs Explorer): https://console.cloud.google.com/logs/
|
|
244
|
+
- Metrics (Metrics Explorer):
|
|
245
|
+
https://console.cloud.google.com/monitoring/metrics-explorer
|
|
246
|
+
- Traces (Trace Explorer): https://console.cloud.google.com/traces/list
|
|
216
247
|
- Open `~/.gemini/tmp/<projectHash>/otel/collector-gcp.log` to view local
|
|
217
248
|
collector logs.
|
|
218
249
|
|
|
@@ -270,10 +301,10 @@ For local development and debugging, you can capture telemetry data locally:
|
|
|
270
301
|
3. View traces at http://localhost:16686 and logs/metrics in the collector log
|
|
271
302
|
file.
|
|
272
303
|
|
|
273
|
-
## Logs and
|
|
304
|
+
## Logs, metrics, and traces
|
|
274
305
|
|
|
275
|
-
The following section describes the structure of logs
|
|
276
|
-
Gemini CLI.
|
|
306
|
+
The following section describes the structure of logs, metrics, and traces
|
|
307
|
+
generated for Gemini CLI.
|
|
277
308
|
|
|
278
309
|
The `session.id`, `installation.id`, `active_approval_mode`, and `user.email`
|
|
279
310
|
(available only when authenticated with a Google account) are included as common
|
|
@@ -824,6 +855,32 @@ Optional performance monitoring for startup, CPU/memory, and phase timing.
|
|
|
824
855
|
- `current_value` (number)
|
|
825
856
|
- `baseline_value` (number)
|
|
826
857
|
|
|
858
|
+
### Traces
|
|
859
|
+
|
|
860
|
+
Traces offer a granular, "under-the-hood" view of every agent and backend
|
|
861
|
+
operation. By providing a high-fidelity execution map, they enable precise
|
|
862
|
+
debugging of complex tool interactions and deep performance optimization. Each
|
|
863
|
+
trace captures rich, consistent metadata via custom span attributes:
|
|
864
|
+
|
|
865
|
+
- `gen_ai.operation.name` (string): The high-level operation kind (e.g.
|
|
866
|
+
"tool_call", "llm_call").
|
|
867
|
+
- `gen_ai.agent.name` (string): The service agent identifier ("gemini-cli").
|
|
868
|
+
- `gen_ai.agent.description` (string): The service agent description.
|
|
869
|
+
- `gen_ai.input.messages` (string): Input messages or metadata specific to the
|
|
870
|
+
operation.
|
|
871
|
+
- `gen_ai.output.messages` (string): Output messages or metadata generated from
|
|
872
|
+
the operation.
|
|
873
|
+
- `gen_ai.request.model` (string): The request model name.
|
|
874
|
+
- `gen_ai.response.model` (string): The response model name.
|
|
875
|
+
- `gen_ai.system_instructions` (json string): The system instructions.
|
|
876
|
+
- `gen_ai.prompt.name` (string): The prompt name.
|
|
877
|
+
- `gen_ai.tool.name` (string): The executed tool's name.
|
|
878
|
+
- `gen_ai.tool.call_id` (string): The generated specific ID of the tool call.
|
|
879
|
+
- `gen_ai.tool.description` (string): The executed tool's description.
|
|
880
|
+
- `gen_ai.tool.definitions` (json string): The executed tool's description.
|
|
881
|
+
- `gen_ai.conversation.id` (string): The current CLI session ID.
|
|
882
|
+
- Additional user-defined Custom Attributes passed via the span's configuration.
|
|
883
|
+
|
|
827
884
|
#### GenAI semantic convention
|
|
828
885
|
|
|
829
886
|
The following metrics comply with [OpenTelemetry GenAI semantic conventions] for
|
|
@@ -37,10 +37,18 @@ output.
|
|
|
37
37
|
|
|
38
38
|
Pipe a file:
|
|
39
39
|
|
|
40
|
+
**macOS/Linux**
|
|
41
|
+
|
|
40
42
|
```bash
|
|
41
43
|
cat error.log | gemini "Explain why this failed"
|
|
42
44
|
```
|
|
43
45
|
|
|
46
|
+
**Windows (PowerShell)**
|
|
47
|
+
|
|
48
|
+
```powershell
|
|
49
|
+
Get-Content error.log | gemini "Explain why this failed"
|
|
50
|
+
```
|
|
51
|
+
|
|
44
52
|
Pipe a command:
|
|
45
53
|
|
|
46
54
|
```bash
|
|
@@ -57,7 +65,10 @@ results to a file.
|
|
|
57
65
|
You have a folder of Python scripts and want to generate a `README.md` for each
|
|
58
66
|
one.
|
|
59
67
|
|
|
60
|
-
1. Save the following code as `generate_docs.sh
|
|
68
|
+
1. Save the following code as `generate_docs.sh` (or `generate_docs.ps1` for
|
|
69
|
+
Windows):
|
|
70
|
+
|
|
71
|
+
**macOS/Linux (`generate_docs.sh`)**
|
|
61
72
|
|
|
62
73
|
```bash
|
|
63
74
|
#!/bin/bash
|
|
@@ -72,13 +83,34 @@ one.
|
|
|
72
83
|
done
|
|
73
84
|
```
|
|
74
85
|
|
|
86
|
+
**Windows PowerShell (`generate_docs.ps1`)**
|
|
87
|
+
|
|
88
|
+
```powershell
|
|
89
|
+
# Loop through all Python files
|
|
90
|
+
Get-ChildItem -Filter *.py | ForEach-Object {
|
|
91
|
+
Write-Host "Generating docs for $($_.Name)..."
|
|
92
|
+
|
|
93
|
+
$newName = $_.Name -replace '\.py$', '.md'
|
|
94
|
+
# Ask Gemini CLI to generate the documentation and print it to stdout
|
|
95
|
+
gemini "Generate a Markdown documentation summary for @$($_.Name). Print the result to standard output." | Out-File -FilePath $newName -Encoding utf8
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
75
99
|
2. Make the script executable and run it in your directory:
|
|
76
100
|
|
|
101
|
+
**macOS/Linux**
|
|
102
|
+
|
|
77
103
|
```bash
|
|
78
104
|
chmod +x generate_docs.sh
|
|
79
105
|
./generate_docs.sh
|
|
80
106
|
```
|
|
81
107
|
|
|
108
|
+
**Windows (PowerShell)**
|
|
109
|
+
|
|
110
|
+
```powershell
|
|
111
|
+
.\generate_docs.ps1
|
|
112
|
+
```
|
|
113
|
+
|
|
82
114
|
This creates a corresponding Markdown file for every Python file in the
|
|
83
115
|
folder.
|
|
84
116
|
|
|
@@ -90,7 +122,10 @@ like `jq`. To get pure JSON data from the model, combine the
|
|
|
90
122
|
|
|
91
123
|
### Scenario: Extract and return structured data
|
|
92
124
|
|
|
93
|
-
1. Save the following script as `generate_json.sh
|
|
125
|
+
1. Save the following script as `generate_json.sh` (or `generate_json.ps1` for
|
|
126
|
+
Windows):
|
|
127
|
+
|
|
128
|
+
**macOS/Linux (`generate_json.sh`)**
|
|
94
129
|
|
|
95
130
|
```bash
|
|
96
131
|
#!/bin/bash
|
|
@@ -105,13 +140,35 @@ like `jq`. To get pure JSON data from the model, combine the
|
|
|
105
140
|
gemini --output-format json "Return a raw JSON object with keys 'version' and 'deps' from @package.json" | jq -r '.response' > data.json
|
|
106
141
|
```
|
|
107
142
|
|
|
108
|
-
|
|
143
|
+
**Windows PowerShell (`generate_json.ps1`)**
|
|
144
|
+
|
|
145
|
+
```powershell
|
|
146
|
+
# Ensure we are in a project root
|
|
147
|
+
if (-not (Test-Path "package.json")) {
|
|
148
|
+
Write-Error "Error: package.json not found."
|
|
149
|
+
exit 1
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
# Extract data (requires jq installed, or you can use ConvertFrom-Json)
|
|
153
|
+
$output = gemini --output-format json "Return a raw JSON object with keys 'version' and 'deps' from @package.json" | ConvertFrom-Json
|
|
154
|
+
$output.response | Out-File -FilePath data.json -Encoding utf8
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
2. Run the script:
|
|
158
|
+
|
|
159
|
+
**macOS/Linux**
|
|
109
160
|
|
|
110
161
|
```bash
|
|
111
162
|
chmod +x generate_json.sh
|
|
112
163
|
./generate_json.sh
|
|
113
164
|
```
|
|
114
165
|
|
|
166
|
+
**Windows (PowerShell)**
|
|
167
|
+
|
|
168
|
+
```powershell
|
|
169
|
+
.\generate_json.ps1
|
|
170
|
+
```
|
|
171
|
+
|
|
115
172
|
3. Check `data.json`. The file should look like this:
|
|
116
173
|
|
|
117
174
|
```json
|
|
@@ -129,8 +186,10 @@ Use headless mode to perform custom, automated AI tasks.
|
|
|
129
186
|
|
|
130
187
|
### Scenario: Create a "Smart Commit" alias
|
|
131
188
|
|
|
132
|
-
You can add a function to your shell configuration
|
|
133
|
-
|
|
189
|
+
You can add a function to your shell configuration to create a `git commit`
|
|
190
|
+
wrapper that writes the message for you.
|
|
191
|
+
|
|
192
|
+
**macOS/Linux (Bash/Zsh)**
|
|
134
193
|
|
|
135
194
|
1. Open your `.zshrc` file (or `.bashrc` if you use Bash) in your preferred
|
|
136
195
|
text editor.
|
|
@@ -170,6 +229,43 @@ to create a `git commit` wrapper that writes the message for you.
|
|
|
170
229
|
source ~/.zshrc
|
|
171
230
|
```
|
|
172
231
|
|
|
232
|
+
**Windows (PowerShell)**
|
|
233
|
+
|
|
234
|
+
1. Open your PowerShell profile in your preferred text editor.
|
|
235
|
+
|
|
236
|
+
```powershell
|
|
237
|
+
notepad $PROFILE
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
2. Scroll to the very bottom of the file and paste this code:
|
|
241
|
+
|
|
242
|
+
```powershell
|
|
243
|
+
function gcommit {
|
|
244
|
+
# Get the diff of staged changes
|
|
245
|
+
$diff = git diff --staged
|
|
246
|
+
|
|
247
|
+
if (-not $diff) {
|
|
248
|
+
Write-Host "No staged changes to commit."
|
|
249
|
+
return
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
# Ask Gemini to write the message
|
|
253
|
+
Write-Host "Generating commit message..."
|
|
254
|
+
$msg = $diff | gemini "Write a concise Conventional Commit message for this diff. Output ONLY the message."
|
|
255
|
+
|
|
256
|
+
# Commit with the generated message
|
|
257
|
+
git commit -m "$msg"
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Save your file and exit.
|
|
262
|
+
|
|
263
|
+
3. Run this command to make the function available immediately:
|
|
264
|
+
|
|
265
|
+
```powershell
|
|
266
|
+
. $PROFILE
|
|
267
|
+
```
|
|
268
|
+
|
|
173
269
|
4. Use your new command:
|
|
174
270
|
|
|
175
271
|
```bash
|
|
@@ -20,10 +20,18 @@ Most MCP servers require authentication. For GitHub, you need a PAT.
|
|
|
20
20
|
**Read/Write** access to **Issues** and **Pull Requests**.
|
|
21
21
|
3. Store it in your environment:
|
|
22
22
|
|
|
23
|
+
**macOS/Linux**
|
|
24
|
+
|
|
23
25
|
```bash
|
|
24
26
|
export GITHUB_PERSONAL_ACCESS_TOKEN="github_pat_..."
|
|
25
27
|
```
|
|
26
28
|
|
|
29
|
+
**Windows (PowerShell)**
|
|
30
|
+
|
|
31
|
+
```powershell
|
|
32
|
+
$env:GITHUB_PERSONAL_ACCESS_TOKEN="github_pat_..."
|
|
33
|
+
```
|
|
34
|
+
|
|
27
35
|
## How to configure Gemini CLI
|
|
28
36
|
|
|
29
37
|
You tell Gemini about new servers by editing your `settings.json`.
|
|
@@ -14,10 +14,18 @@ responding correctly.
|
|
|
14
14
|
|
|
15
15
|
1. Run the following command to create the folders:
|
|
16
16
|
|
|
17
|
+
**macOS/Linux**
|
|
18
|
+
|
|
17
19
|
```bash
|
|
18
20
|
mkdir -p .gemini/skills/api-auditor/scripts
|
|
19
21
|
```
|
|
20
22
|
|
|
23
|
+
**Windows (PowerShell)**
|
|
24
|
+
|
|
25
|
+
```powershell
|
|
26
|
+
New-Item -ItemType Directory -Force -Path ".gemini\skills\api-auditor\scripts"
|
|
27
|
+
```
|
|
28
|
+
|
|
21
29
|
### Create the definition
|
|
22
30
|
|
|
23
31
|
1. Create a file at `.gemini/skills/api-auditor/SKILL.md`. This tells the agent
|