@google/gemini-cli-core 0.22.0-preview.3 → 0.23.0-preview.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/dist/docs/CONTRIBUTING.md +546 -0
- package/dist/docs/architecture.md +80 -0
- package/dist/docs/assets/connected_devtools.png +0 -0
- package/dist/docs/assets/gemini-screenshot.png +0 -0
- package/dist/docs/assets/release_patch.png +0 -0
- package/dist/docs/assets/theme-ansi-light.png +0 -0
- package/dist/docs/assets/theme-ansi.png +0 -0
- package/dist/docs/assets/theme-atom-one.png +0 -0
- package/dist/docs/assets/theme-ayu-light.png +0 -0
- package/dist/docs/assets/theme-ayu.png +0 -0
- package/dist/docs/assets/theme-custom.png +0 -0
- package/dist/docs/assets/theme-default-light.png +0 -0
- package/dist/docs/assets/theme-default.png +0 -0
- package/dist/docs/assets/theme-dracula.png +0 -0
- package/dist/docs/assets/theme-github-light.png +0 -0
- package/dist/docs/assets/theme-github.png +0 -0
- package/dist/docs/assets/theme-google-light.png +0 -0
- package/dist/docs/assets/theme-xcode-light.png +0 -0
- package/dist/docs/changelogs/index.md +592 -0
- package/dist/docs/changelogs/latest.md +225 -0
- package/dist/docs/changelogs/preview.md +129 -0
- package/dist/docs/changelogs/releases.md +896 -0
- package/dist/docs/cli/authentication.md +3 -0
- package/dist/docs/cli/checkpointing.md +94 -0
- package/dist/docs/cli/commands.md +354 -0
- package/dist/docs/cli/configuration.md +780 -0
- package/dist/docs/cli/custom-commands.md +315 -0
- package/dist/docs/cli/enterprise.md +565 -0
- package/dist/docs/cli/gemini-ignore.md +71 -0
- package/dist/docs/cli/gemini-md.md +108 -0
- package/dist/docs/cli/generation-settings.md +210 -0
- package/dist/docs/cli/headless.md +388 -0
- package/dist/docs/cli/index.md +63 -0
- package/dist/docs/cli/keyboard-shortcuts.md +143 -0
- package/dist/docs/cli/model-routing.md +37 -0
- package/dist/docs/cli/model.md +62 -0
- package/dist/docs/cli/sandbox.md +171 -0
- package/dist/docs/cli/session-management.md +158 -0
- package/dist/docs/cli/settings.md +112 -0
- package/dist/docs/cli/system-prompt.md +93 -0
- package/dist/docs/cli/telemetry.md +791 -0
- package/dist/docs/cli/themes.md +237 -0
- package/dist/docs/cli/token-caching.md +20 -0
- package/dist/docs/cli/trusted-folders.md +95 -0
- package/dist/docs/cli/tutorials.md +83 -0
- package/dist/docs/cli/uninstall.md +47 -0
- package/dist/docs/core/index.md +101 -0
- package/dist/docs/core/memport.md +244 -0
- package/dist/docs/core/policy-engine.md +267 -0
- package/dist/docs/core/tools-api.md +131 -0
- package/dist/docs/examples/proxy-script.md +83 -0
- package/dist/docs/extensions/extension-releasing.md +183 -0
- package/dist/docs/extensions/getting-started-extensions.md +245 -0
- package/dist/docs/extensions/index.md +293 -0
- package/dist/docs/faq.md +154 -0
- package/dist/docs/get-started/authentication.md +321 -0
- package/dist/docs/get-started/configuration-v1.md +888 -0
- package/dist/docs/get-started/configuration.md +1444 -0
- package/dist/docs/get-started/deployment.md +143 -0
- package/dist/docs/get-started/examples.md +219 -0
- package/dist/docs/get-started/gemini-3.md +116 -0
- package/dist/docs/get-started/index.md +71 -0
- package/dist/docs/get-started/installation.md +141 -0
- package/dist/docs/hooks/best-practices.md +806 -0
- package/dist/docs/hooks/index.md +665 -0
- package/dist/docs/hooks/reference.md +168 -0
- package/dist/docs/hooks/writing-hooks.md +1026 -0
- package/dist/docs/ide-integration/ide-companion-spec.md +267 -0
- package/dist/docs/ide-integration/index.md +202 -0
- package/dist/docs/index.md +147 -0
- package/dist/docs/integration-tests.md +211 -0
- package/dist/docs/issue-and-pr-automation.md +134 -0
- package/dist/docs/local-development.md +128 -0
- package/dist/docs/mermaid/context.mmd +103 -0
- package/dist/docs/mermaid/render-path.mmd +64 -0
- package/dist/docs/npm.md +62 -0
- package/dist/docs/quota-and-pricing.md +158 -0
- package/dist/docs/release-confidence.md +164 -0
- package/dist/docs/releases.md +540 -0
- package/dist/docs/sidebar.json +297 -0
- package/dist/docs/tools/file-system.md +217 -0
- package/dist/docs/tools/index.md +95 -0
- package/dist/docs/tools/mcp-server.md +1044 -0
- package/dist/docs/tools/memory.md +54 -0
- package/dist/docs/tools/shell.md +260 -0
- package/dist/docs/tools/todos.md +57 -0
- package/dist/docs/tools/web-fetch.md +59 -0
- package/dist/docs/tools/web-search.md +42 -0
- package/dist/docs/tos-privacy.md +96 -0
- package/dist/docs/troubleshooting.md +158 -0
- package/dist/src/agents/codebase-investigator.d.ts +2 -2
- package/dist/src/agents/codebase-investigator.js +4 -3
- package/dist/src/agents/codebase-investigator.js.map +1 -1
- package/dist/src/agents/delegate-to-agent-tool.js +8 -4
- package/dist/src/agents/delegate-to-agent-tool.js.map +1 -1
- package/dist/src/agents/delegate-to-agent-tool.test.js +6 -4
- package/dist/src/agents/delegate-to-agent-tool.test.js.map +1 -1
- package/dist/src/agents/introspection-agent.d.ts +23 -0
- package/dist/src/agents/introspection-agent.js +72 -0
- package/dist/src/agents/introspection-agent.js.map +1 -0
- package/dist/src/agents/introspection-agent.test.js +47 -0
- package/dist/src/agents/introspection-agent.test.js.map +1 -0
- package/dist/src/agents/{executor.d.ts → local-executor.d.ts} +5 -11
- package/dist/src/agents/{executor.js → local-executor.js} +79 -53
- package/dist/src/agents/local-executor.js.map +1 -0
- package/dist/src/agents/{executor.test.js → local-executor.test.js} +64 -45
- package/dist/src/agents/local-executor.test.js.map +1 -0
- package/dist/src/agents/{invocation.d.ts → local-invocation.d.ts} +5 -6
- package/dist/src/agents/{invocation.js → local-invocation.js} +8 -9
- package/dist/src/agents/local-invocation.js.map +1 -0
- package/dist/src/agents/local-invocation.test.d.ts +6 -0
- package/dist/src/agents/{invocation.test.js → local-invocation.test.js} +18 -17
- package/dist/src/agents/local-invocation.test.js.map +1 -0
- package/dist/src/agents/registry.d.ts +1 -0
- package/dist/src/agents/registry.js +68 -20
- package/dist/src/agents/registry.js.map +1 -1
- package/dist/src/agents/registry.test.js +113 -1
- package/dist/src/agents/registry.test.js.map +1 -1
- package/dist/src/agents/remote-invocation.d.ts +21 -0
- package/dist/src/agents/remote-invocation.js +31 -0
- package/dist/src/agents/remote-invocation.js.map +1 -0
- package/dist/src/agents/remote-invocation.test.d.ts +6 -0
- package/dist/src/agents/remote-invocation.test.js +35 -0
- package/dist/src/agents/remote-invocation.test.js.map +1 -0
- package/dist/src/agents/subagent-tool-wrapper.js +7 -3
- package/dist/src/agents/subagent-tool-wrapper.js.map +1 -1
- package/dist/src/agents/subagent-tool-wrapper.test.js +10 -9
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -1
- package/dist/src/agents/toml-loader.d.ts +65 -0
- package/dist/src/agents/toml-loader.js +176 -0
- package/dist/src/agents/toml-loader.js.map +1 -0
- package/dist/src/agents/toml-loader.test.d.ts +6 -0
- package/dist/src/agents/toml-loader.test.js +190 -0
- package/dist/src/agents/toml-loader.test.js.map +1 -0
- package/dist/src/agents/types.d.ts +12 -4
- package/dist/src/availability/modelAvailabilityService.d.ts +2 -1
- package/dist/src/availability/policyHelpers.d.ts +4 -3
- package/dist/src/availability/policyHelpers.js +13 -20
- package/dist/src/availability/policyHelpers.js.map +1 -1
- package/dist/src/availability/policyHelpers.test.js +28 -18
- package/dist/src/availability/policyHelpers.test.js.map +1 -1
- package/dist/src/code_assist/oauth2.js +1 -1
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/oauth2.test.js +6 -8
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/server.d.ts +4 -1
- package/dist/src/code_assist/server.js +50 -7
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/server.test.js +177 -27
- package/dist/src/code_assist/server.test.js.map +1 -1
- package/dist/src/code_assist/telemetry.d.ts +14 -0
- package/dist/src/code_assist/telemetry.js +156 -0
- package/dist/src/code_assist/telemetry.js.map +1 -0
- package/dist/src/code_assist/telemetry.test.d.ts +6 -0
- package/dist/src/code_assist/telemetry.test.js +300 -0
- package/dist/src/code_assist/telemetry.test.js.map +1 -0
- package/dist/src/code_assist/types.d.ts +52 -1
- package/dist/src/code_assist/types.js +21 -0
- package/dist/src/code_assist/types.js.map +1 -1
- package/dist/src/config/config.d.ts +10 -13
- package/dist/src/config/config.js +32 -32
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +72 -19
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/flashFallback.test.js +0 -37
- package/dist/src/config/flashFallback.test.js.map +1 -1
- package/dist/src/config/storage.d.ts +2 -0
- package/dist/src/config/storage.js +6 -0
- package/dist/src/config/storage.js.map +1 -1
- package/dist/src/config/storage.test.js +8 -0
- package/dist/src/config/storage.test.js.map +1 -1
- package/dist/src/core/baseLlmClient.js +44 -43
- package/dist/src/core/baseLlmClient.js.map +1 -1
- package/dist/src/core/baseLlmClient.test.js +12 -19
- package/dist/src/core/baseLlmClient.test.js.map +1 -1
- package/dist/src/core/client.js +23 -35
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +32 -65
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/clientHookTriggers.js +2 -2
- package/dist/src/core/clientHookTriggers.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +0 -6
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/coreToolHookTriggers.js +3 -3
- package/dist/src/core/coreToolHookTriggers.js.map +1 -1
- package/dist/src/core/geminiChat.js +21 -71
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +16 -92
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/geminiChatHookTriggers.js +3 -3
- package/dist/src/core/geminiChatHookTriggers.js.map +1 -1
- package/dist/src/core/geminiChat_network_retry.test.js +4 -6
- package/dist/src/core/geminiChat_network_retry.test.js.map +1 -1
- package/dist/src/core/prompts.test.js +0 -2
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/core/sessionHookTriggers.js +3 -3
- package/dist/src/core/sessionHookTriggers.js.map +1 -1
- package/dist/src/core/turn.d.ts +1 -0
- package/dist/src/core/turn.js +4 -12
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/core/turn.test.js +0 -5
- package/dist/src/core/turn.test.js.map +1 -1
- package/dist/src/fallback/handler.test.js +0 -21
- package/dist/src/fallback/handler.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/hooks/hookEventHandler.js +10 -4
- package/dist/src/hooks/hookEventHandler.js.map +1 -1
- package/dist/src/hooks/hookEventHandler.test.js +47 -0
- package/dist/src/hooks/hookEventHandler.test.js.map +1 -1
- package/dist/src/hooks/hookPlanner.js +3 -1
- package/dist/src/hooks/hookPlanner.js.map +1 -1
- package/dist/src/hooks/hookPlanner.test.js +61 -0
- package/dist/src/hooks/hookPlanner.test.js.map +1 -1
- package/dist/src/hooks/hookRegistry.d.ts +1 -1
- package/dist/src/hooks/hookRegistry.js +2 -2
- package/dist/src/hooks/hookRegistry.js.map +1 -1
- package/dist/src/hooks/hookRegistry.test.js +73 -0
- package/dist/src/hooks/hookRegistry.test.js.map +1 -1
- package/dist/src/hooks/hookRunner.js +14 -10
- package/dist/src/hooks/hookRunner.js.map +1 -1
- package/dist/src/hooks/hookRunner.test.js +81 -33
- package/dist/src/hooks/hookRunner.test.js.map +1 -1
- package/dist/src/hooks/types.d.ts +2 -0
- package/dist/src/hooks/types.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/oauth-provider.js +6 -2
- package/dist/src/mcp/oauth-provider.js.map +1 -1
- package/dist/src/mcp/oauth-provider.test.js +4 -1
- package/dist/src/mcp/oauth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-utils.d.ts +8 -1
- package/dist/src/mcp/oauth-utils.js +30 -1
- package/dist/src/mcp/oauth-utils.js.map +1 -1
- package/dist/src/mcp/oauth-utils.test.js +42 -0
- package/dist/src/mcp/oauth-utils.test.js.map +1 -1
- package/dist/src/routing/strategies/fallbackStrategy.js +0 -3
- package/dist/src/routing/strategies/fallbackStrategy.js.map +1 -1
- package/dist/src/routing/strategies/fallbackStrategy.test.js +0 -6
- package/dist/src/routing/strategies/fallbackStrategy.test.js.map +1 -1
- package/dist/src/services/contextManager.d.ts +5 -11
- package/dist/src/services/contextManager.js +20 -17
- package/dist/src/services/contextManager.js.map +1 -1
- package/dist/src/services/contextManager.test.js +40 -41
- package/dist/src/services/contextManager.test.js.map +1 -1
- package/dist/src/services/loopDetectionService.js +2 -1
- package/dist/src/services/loopDetectionService.js.map +1 -1
- package/dist/src/services/loopDetectionService.test.js +14 -8
- package/dist/src/services/loopDetectionService.test.js.map +1 -1
- package/dist/src/services/modelConfig.integration.test.js +1 -1
- package/dist/src/services/modelConfig.integration.test.js.map +1 -1
- package/dist/src/services/shellExecutionService.js +18 -2
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +4 -2
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +25 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +32 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +5 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +12 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/loggers.js +1 -0
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +37 -2
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/sdk.js +2 -2
- package/dist/src/telemetry/sdk.js.map +1 -1
- package/dist/src/tools/confirmation-policy.test.d.ts +6 -0
- package/dist/src/tools/confirmation-policy.test.js +152 -0
- package/dist/src/tools/confirmation-policy.test.js.map +1 -0
- package/dist/src/tools/edit.js +5 -1
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/get-internal-docs.d.ts +27 -0
- package/dist/src/tools/get-internal-docs.js +129 -0
- package/dist/src/tools/get-internal-docs.js.map +1 -0
- package/dist/src/tools/get-internal-docs.test.d.ts +6 -0
- package/dist/src/tools/get-internal-docs.test.js +56 -0
- package/dist/src/tools/get-internal-docs.test.js.map +1 -0
- package/dist/src/tools/ripGrep.d.ts +1 -0
- package/dist/src/tools/ripGrep.js +16 -4
- package/dist/src/tools/ripGrep.js.map +1 -1
- package/dist/src/tools/ripGrep.test.js +55 -0
- package/dist/src/tools/ripGrep.test.js.map +1 -1
- package/dist/src/tools/smart-edit.js +5 -1
- package/dist/src/tools/smart-edit.js.map +1 -1
- package/dist/src/tools/tool-names.d.ts +14 -0
- package/dist/src/tools/tool-names.js +55 -0
- package/dist/src/tools/tool-names.js.map +1 -1
- package/dist/src/tools/tool-names.test.d.ts +6 -0
- package/dist/src/tools/tool-names.test.js +43 -0
- package/dist/src/tools/tool-names.test.js.map +1 -0
- package/dist/src/tools/tool-registry.d.ts +0 -1
- package/dist/src/tools/tool-registry.js +1 -1
- package/dist/src/tools/tool-registry.js.map +1 -1
- package/dist/src/tools/tool-registry.test.js +2 -1
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/web-fetch.js +5 -1
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/write-file.js +5 -1
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/utils/checkpointUtils.js +1 -1
- package/dist/src/utils/checkpointUtils.js.map +1 -1
- package/dist/src/utils/checkpointUtils.test.js +1 -1
- package/dist/src/utils/checkpointUtils.test.js.map +1 -1
- package/dist/src/utils/editCorrector.js +1 -1
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/editCorrector.test.js +2 -2
- package/dist/src/utils/editCorrector.test.js.map +1 -1
- package/dist/src/utils/environmentContext.d.ts +1 -0
- package/dist/src/utils/environmentContext.js +4 -0
- package/dist/src/utils/environmentContext.js.map +1 -1
- package/dist/src/utils/environmentContext.test.js +2 -0
- package/dist/src/utils/environmentContext.test.js.map +1 -1
- package/dist/src/utils/events.d.ts +3 -18
- package/dist/src/utils/events.js +0 -9
- package/dist/src/utils/events.js.map +1 -1
- package/dist/src/utils/geminiIgnoreParser.d.ts +11 -0
- package/dist/src/utils/geminiIgnoreParser.js +20 -0
- package/dist/src/utils/geminiIgnoreParser.js.map +1 -1
- package/dist/src/utils/geminiIgnoreParser.test.js +48 -0
- package/dist/src/utils/geminiIgnoreParser.test.js.map +1 -1
- package/dist/src/utils/generateContentResponseUtilities.d.ts +1 -0
- package/dist/src/utils/generateContentResponseUtilities.js +10 -0
- package/dist/src/utils/generateContentResponseUtilities.js.map +1 -1
- package/dist/src/utils/generateContentResponseUtilities.test.js +59 -2
- package/dist/src/utils/generateContentResponseUtilities.test.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.js +1 -1
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +3 -1
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/shell-utils.js +25 -4
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -6
- package/dist/google-gemini-cli-core-0.22.0-preview.2.tgz +0 -0
- package/dist/src/agents/executor.js.map +0 -1
- package/dist/src/agents/executor.test.js.map +0 -1
- package/dist/src/agents/invocation.js.map +0 -1
- package/dist/src/agents/invocation.test.js.map +0 -1
- /package/dist/src/agents/{executor.test.d.ts → introspection-agent.test.d.ts} +0 -0
- /package/dist/src/agents/{invocation.test.d.ts → local-executor.test.d.ts} +0 -0
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
# How to contribute
|
|
2
|
+
|
|
3
|
+
We would love to accept your patches and contributions to this project. This
|
|
4
|
+
document includes:
|
|
5
|
+
|
|
6
|
+
- **[Before you begin](#before-you-begin):** Essential steps to take before
|
|
7
|
+
becoming a Gemini CLI contributor.
|
|
8
|
+
- **[Code contribution process](#code-contribution-process):** How to contribute
|
|
9
|
+
code to Gemini CLI.
|
|
10
|
+
- **[Development setup and workflow](#development-setup-and-workflow):** How to
|
|
11
|
+
set up your development environment and workflow.
|
|
12
|
+
- **[Documentation contribution process](#documentation-contribution-process):**
|
|
13
|
+
How to contribute documentation to Gemini CLI.
|
|
14
|
+
|
|
15
|
+
We're looking forward to seeing your contributions!
|
|
16
|
+
|
|
17
|
+
## Before you begin
|
|
18
|
+
|
|
19
|
+
### Sign our Contributor License Agreement
|
|
20
|
+
|
|
21
|
+
Contributions to this project must be accompanied by a
|
|
22
|
+
[Contributor License Agreement](https://cla.developers.google.com/about) (CLA).
|
|
23
|
+
You (or your employer) retain the copyright to your contribution; this simply
|
|
24
|
+
gives us permission to use and redistribute your contributions as part of the
|
|
25
|
+
project.
|
|
26
|
+
|
|
27
|
+
If you or your current employer have already signed the Google CLA (even if it
|
|
28
|
+
was for a different project), you probably don't need to do it again.
|
|
29
|
+
|
|
30
|
+
Visit <https://cla.developers.google.com/> to see your current agreements or to
|
|
31
|
+
sign a new one.
|
|
32
|
+
|
|
33
|
+
### Review our Community Guidelines
|
|
34
|
+
|
|
35
|
+
This project follows
|
|
36
|
+
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
|
|
37
|
+
|
|
38
|
+
## Code contribution process
|
|
39
|
+
|
|
40
|
+
### Get started
|
|
41
|
+
|
|
42
|
+
The process for contributing code is as follows:
|
|
43
|
+
|
|
44
|
+
1. **Find an issue** that you want to work on. If an issue is tagged as
|
|
45
|
+
"🔒Maintainers only", this means it is reserved for project maintainers. We
|
|
46
|
+
will not accept pull requests related to these issues.
|
|
47
|
+
2. **Fork the repository** and create a new branch.
|
|
48
|
+
3. **Make your changes** in the `packages/` directory.
|
|
49
|
+
4. **Ensure all checks pass** by running `npm run preflight`.
|
|
50
|
+
5. **Open a pull request** with your changes.
|
|
51
|
+
|
|
52
|
+
### Code reviews
|
|
53
|
+
|
|
54
|
+
All submissions, including submissions by project members, require review. We
|
|
55
|
+
use [GitHub pull requests](https://docs.github.com/articles/about-pull-requests)
|
|
56
|
+
for this purpose.
|
|
57
|
+
|
|
58
|
+
If your pull request involves changes to `packages/cli` (the frontend), we
|
|
59
|
+
recommend running our automated frontend review tool. **Note: This tool is
|
|
60
|
+
currently experimental.** It helps detect common React anti-patterns, testing
|
|
61
|
+
issues, and other frontend-specific best practices that are easy to miss.
|
|
62
|
+
|
|
63
|
+
To run the review tool, enter the following command from within Gemini CLI:
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
/review-frontend <PR_NUMBER>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Replace `<PR_NUMBER>` with your pull request number. Authors are encouraged to
|
|
70
|
+
run this on their own PRs for self-review, and reviewers should use it to
|
|
71
|
+
augment their manual review process.
|
|
72
|
+
|
|
73
|
+
### Self assigning issues
|
|
74
|
+
|
|
75
|
+
To assign an issue to yourself, simply add a comment with the text `/assign`.
|
|
76
|
+
The comment must contain only that text and nothing else. This command will
|
|
77
|
+
assign the issue to you, provided it is not already assigned.
|
|
78
|
+
|
|
79
|
+
Please note that you can have a maximum of 3 issues assigned to you at any given
|
|
80
|
+
time.
|
|
81
|
+
|
|
82
|
+
### Pull request guidelines
|
|
83
|
+
|
|
84
|
+
To help us review and merge your PRs quickly, please follow these guidelines.
|
|
85
|
+
PRs that do not meet these standards may be closed.
|
|
86
|
+
|
|
87
|
+
#### 1. Link to an existing issue
|
|
88
|
+
|
|
89
|
+
All PRs should be linked to an existing issue in our tracker. This ensures that
|
|
90
|
+
every change has been discussed and is aligned with the project's goals before
|
|
91
|
+
any code is written.
|
|
92
|
+
|
|
93
|
+
- **For bug fixes:** The PR should be linked to the bug report issue.
|
|
94
|
+
- **For features:** The PR should be linked to the feature request or proposal
|
|
95
|
+
issue that has been approved by a maintainer.
|
|
96
|
+
|
|
97
|
+
If an issue for your change doesn't exist, please **open one first** and wait
|
|
98
|
+
for feedback before you start coding.
|
|
99
|
+
|
|
100
|
+
#### 2. Keep it small and focused
|
|
101
|
+
|
|
102
|
+
We favor small, atomic PRs that address a single issue or add a single,
|
|
103
|
+
self-contained feature.
|
|
104
|
+
|
|
105
|
+
- **Do:** Create a PR that fixes one specific bug or adds one specific feature.
|
|
106
|
+
- **Don't:** Bundle multiple unrelated changes (e.g., a bug fix, a new feature,
|
|
107
|
+
and a refactor) into a single PR.
|
|
108
|
+
|
|
109
|
+
Large changes should be broken down into a series of smaller, logical PRs that
|
|
110
|
+
can be reviewed and merged independently.
|
|
111
|
+
|
|
112
|
+
#### 3. Use draft PRs for work in progress
|
|
113
|
+
|
|
114
|
+
If you'd like to get early feedback on your work, please use GitHub's **Draft
|
|
115
|
+
Pull Request** feature. This signals to the maintainers that the PR is not yet
|
|
116
|
+
ready for a formal review but is open for discussion and initial feedback.
|
|
117
|
+
|
|
118
|
+
#### 4. Ensure all checks pass
|
|
119
|
+
|
|
120
|
+
Before submitting your PR, ensure that all automated checks are passing by
|
|
121
|
+
running `npm run preflight`. This command runs all tests, linting, and other
|
|
122
|
+
style checks.
|
|
123
|
+
|
|
124
|
+
#### 5. Update documentation
|
|
125
|
+
|
|
126
|
+
If your PR introduces a user-facing change (e.g., a new command, a modified
|
|
127
|
+
flag, or a change in behavior), you must also update the relevant documentation
|
|
128
|
+
in the `/docs` directory.
|
|
129
|
+
|
|
130
|
+
See more about writing documentation:
|
|
131
|
+
[Documentation contribution process](#documentation-contribution-process).
|
|
132
|
+
|
|
133
|
+
#### 6. Write clear commit messages and a good PR description
|
|
134
|
+
|
|
135
|
+
Your PR should have a clear, descriptive title and a detailed description of the
|
|
136
|
+
changes. Follow the [Conventional Commits](https://www.conventionalcommits.org/)
|
|
137
|
+
standard for your commit messages.
|
|
138
|
+
|
|
139
|
+
- **Good PR title:** `feat(cli): Add --json flag to 'config get' command`
|
|
140
|
+
- **Bad PR title:** `Made some changes`
|
|
141
|
+
|
|
142
|
+
In the PR description, explain the "why" behind your changes and link to the
|
|
143
|
+
relevant issue (e.g., `Fixes #123`).
|
|
144
|
+
|
|
145
|
+
### Forking
|
|
146
|
+
|
|
147
|
+
If you are forking the repository you will be able to run the Build, Test and
|
|
148
|
+
Integration test workflows. However in order to make the integration tests run
|
|
149
|
+
you'll need to add a
|
|
150
|
+
[GitHub Repository Secret](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository)
|
|
151
|
+
with a value of `GEMINI_API_KEY` and set that to a valid API key that you have
|
|
152
|
+
available. Your key and secret are private to your repo; no one without access
|
|
153
|
+
can see your key and you cannot see any secrets related to this repo.
|
|
154
|
+
|
|
155
|
+
Additionally you will need to click on the `Actions` tab and enable workflows
|
|
156
|
+
for your repository, you'll find it's the large blue button in the center of the
|
|
157
|
+
screen.
|
|
158
|
+
|
|
159
|
+
### Development setup and workflow
|
|
160
|
+
|
|
161
|
+
This section guides contributors on how to build, modify, and understand the
|
|
162
|
+
development setup of this project.
|
|
163
|
+
|
|
164
|
+
### Setting up the development environment
|
|
165
|
+
|
|
166
|
+
**Prerequisites:**
|
|
167
|
+
|
|
168
|
+
1. **Node.js**:
|
|
169
|
+
- **Development:** Please use Node.js `~20.19.0`. This specific version is
|
|
170
|
+
required due to an upstream development dependency issue. You can use a
|
|
171
|
+
tool like [nvm](https://github.com/nvm-sh/nvm) to manage Node.js versions.
|
|
172
|
+
- **Production:** For running the CLI in a production environment, any
|
|
173
|
+
version of Node.js `>=20` is acceptable.
|
|
174
|
+
2. **Git**
|
|
175
|
+
|
|
176
|
+
### Build process
|
|
177
|
+
|
|
178
|
+
To clone the repository:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
git clone https://github.com/google-gemini/gemini-cli.git # Or your fork's URL
|
|
182
|
+
cd gemini-cli
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
To install dependencies defined in `package.json` as well as root dependencies:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npm install
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
To build the entire project (all packages):
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
npm run build
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
This command typically compiles TypeScript to JavaScript, bundles assets, and
|
|
198
|
+
prepares the packages for execution. Refer to `scripts/build.js` and
|
|
199
|
+
`package.json` scripts for more details on what happens during the build.
|
|
200
|
+
|
|
201
|
+
### Enabling sandboxing
|
|
202
|
+
|
|
203
|
+
[Sandboxing](#sandboxing) is highly recommended and requires, at a minimum,
|
|
204
|
+
setting `GEMINI_SANDBOX=true` in your `~/.env` and ensuring a sandboxing
|
|
205
|
+
provider (e.g. `macOS Seatbelt`, `docker`, or `podman`) is available. See
|
|
206
|
+
[Sandboxing](#sandboxing) for details.
|
|
207
|
+
|
|
208
|
+
To build both the `gemini` CLI utility and the sandbox container, run
|
|
209
|
+
`build:all` from the root directory:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
npm run build:all
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
To skip building the sandbox container, you can use `npm run build` instead.
|
|
216
|
+
|
|
217
|
+
### Running the CLI
|
|
218
|
+
|
|
219
|
+
To start the Gemini CLI from the source code (after building), run the following
|
|
220
|
+
command from the root directory:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
npm start
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
If you'd like to run the source build outside of the gemini-cli folder, you can
|
|
227
|
+
utilize `npm link path/to/gemini-cli/packages/cli` (see:
|
|
228
|
+
[docs](https://docs.npmjs.com/cli/v9/commands/npm-link)) or
|
|
229
|
+
`alias gemini="node path/to/gemini-cli/packages/cli"` to run with `gemini`
|
|
230
|
+
|
|
231
|
+
### Running tests
|
|
232
|
+
|
|
233
|
+
This project contains two types of tests: unit tests and integration tests.
|
|
234
|
+
|
|
235
|
+
#### Unit tests
|
|
236
|
+
|
|
237
|
+
To execute the unit test suite for the project:
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
npm run test
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
This will run tests located in the `packages/core` and `packages/cli`
|
|
244
|
+
directories. Ensure tests pass before submitting any changes. For a more
|
|
245
|
+
comprehensive check, it is recommended to run `npm run preflight`.
|
|
246
|
+
|
|
247
|
+
#### Integration tests
|
|
248
|
+
|
|
249
|
+
The integration tests are designed to validate the end-to-end functionality of
|
|
250
|
+
the Gemini CLI. They are not run as part of the default `npm run test` command.
|
|
251
|
+
|
|
252
|
+
To run the integration tests, use the following command:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
npm run test:e2e
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
For more detailed information on the integration testing framework, please see
|
|
259
|
+
the [Integration Tests documentation](/docs/integration-tests.md).
|
|
260
|
+
|
|
261
|
+
### Linting and preflight checks
|
|
262
|
+
|
|
263
|
+
To ensure code quality and formatting consistency, run the preflight check:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
npm run preflight
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
This command will run ESLint, Prettier, all tests, and other checks as defined
|
|
270
|
+
in the project's `package.json`.
|
|
271
|
+
|
|
272
|
+
_ProTip_
|
|
273
|
+
|
|
274
|
+
after cloning create a git precommit hook file to ensure your commits are always
|
|
275
|
+
clean.
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
echo "
|
|
279
|
+
# Run npm build and check for errors
|
|
280
|
+
if ! npm run preflight; then
|
|
281
|
+
echo "npm build failed. Commit aborted."
|
|
282
|
+
exit 1
|
|
283
|
+
fi
|
|
284
|
+
" > .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
#### Formatting
|
|
288
|
+
|
|
289
|
+
To separately format the code in this project by running the following command
|
|
290
|
+
from the root directory:
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
npm run format
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
This command uses Prettier to format the code according to the project's style
|
|
297
|
+
guidelines.
|
|
298
|
+
|
|
299
|
+
#### Linting
|
|
300
|
+
|
|
301
|
+
To separately lint the code in this project, run the following command from the
|
|
302
|
+
root directory:
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
npm run lint
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Coding conventions
|
|
309
|
+
|
|
310
|
+
- Please adhere to the coding style, patterns, and conventions used throughout
|
|
311
|
+
the existing codebase.
|
|
312
|
+
- Consult
|
|
313
|
+
[GEMINI.md](https://github.com/google-gemini/gemini-cli/blob/main/GEMINI.md)
|
|
314
|
+
(typically found in the project root) for specific instructions related to
|
|
315
|
+
AI-assisted development, including conventions for React, comments, and Git
|
|
316
|
+
usage.
|
|
317
|
+
- **Imports:** Pay special attention to import paths. The project uses ESLint to
|
|
318
|
+
enforce restrictions on relative imports between packages.
|
|
319
|
+
|
|
320
|
+
### Project structure
|
|
321
|
+
|
|
322
|
+
- `packages/`: Contains the individual sub-packages of the project.
|
|
323
|
+
- `a2a-server`: A2A server implementation for the Gemini CLI. (Experimental)
|
|
324
|
+
- `cli/`: The command-line interface.
|
|
325
|
+
- `core/`: The core backend logic for the Gemini CLI.
|
|
326
|
+
- `test-utils` Utilities for creating and cleaning temporary file systems for
|
|
327
|
+
testing.
|
|
328
|
+
- `vscode-ide-companion/`: The Gemini CLI Companion extension pairs with
|
|
329
|
+
Gemini CLI.
|
|
330
|
+
- `docs/`: Contains all project documentation.
|
|
331
|
+
- `scripts/`: Utility scripts for building, testing, and development tasks.
|
|
332
|
+
|
|
333
|
+
For more detailed architecture, see `docs/architecture.md`.
|
|
334
|
+
|
|
335
|
+
### Debugging
|
|
336
|
+
|
|
337
|
+
#### VS Code
|
|
338
|
+
|
|
339
|
+
0. Run the CLI to interactively debug in VS Code with `F5`
|
|
340
|
+
1. Start the CLI in debug mode from the root directory:
|
|
341
|
+
```bash
|
|
342
|
+
npm run debug
|
|
343
|
+
```
|
|
344
|
+
This command runs `node --inspect-brk dist/gemini.js` within the
|
|
345
|
+
`packages/cli` directory, pausing execution until a debugger attaches. You
|
|
346
|
+
can then open `chrome://inspect` in your Chrome browser to connect to the
|
|
347
|
+
debugger.
|
|
348
|
+
2. In VS Code, use the "Attach" launch configuration (found in
|
|
349
|
+
`.vscode/launch.json`).
|
|
350
|
+
|
|
351
|
+
Alternatively, you can use the "Launch Program" configuration in VS Code if you
|
|
352
|
+
prefer to launch the currently open file directly, but 'F5' is generally
|
|
353
|
+
recommended.
|
|
354
|
+
|
|
355
|
+
To hit a breakpoint inside the sandbox container run:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
DEBUG=1 gemini
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
**Note:** If you have `DEBUG=true` in a project's `.env` file, it won't affect
|
|
362
|
+
gemini-cli due to automatic exclusion. Use `.gemini/.env` files for gemini-cli
|
|
363
|
+
specific debug settings.
|
|
364
|
+
|
|
365
|
+
### React DevTools
|
|
366
|
+
|
|
367
|
+
To debug the CLI's React-based UI, you can use React DevTools. Ink, the library
|
|
368
|
+
used for the CLI's interface, is compatible with React DevTools version 4.x.
|
|
369
|
+
|
|
370
|
+
1. **Start the Gemini CLI in development mode:**
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
DEV=true npm start
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
2. **Install and run React DevTools version 4.28.5 (or the latest compatible
|
|
377
|
+
4.x version):**
|
|
378
|
+
|
|
379
|
+
You can either install it globally:
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
npm install -g react-devtools@4.28.5
|
|
383
|
+
react-devtools
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
Or run it directly using npx:
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
npx react-devtools@4.28.5
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
Your running CLI application should then connect to React DevTools.
|
|
393
|
+

|
|
394
|
+
|
|
395
|
+
### Sandboxing
|
|
396
|
+
|
|
397
|
+
#### macOS Seatbelt
|
|
398
|
+
|
|
399
|
+
On macOS, `gemini` uses Seatbelt (`sandbox-exec`) under a `permissive-open`
|
|
400
|
+
profile (see `packages/cli/src/utils/sandbox-macos-permissive-open.sb`) that
|
|
401
|
+
restricts writes to the project folder but otherwise allows all other operations
|
|
402
|
+
and outbound network traffic ("open") by default. You can switch to a
|
|
403
|
+
`restrictive-closed` profile (see
|
|
404
|
+
`packages/cli/src/utils/sandbox-macos-restrictive-closed.sb`) that declines all
|
|
405
|
+
operations and outbound network traffic ("closed") by default by setting
|
|
406
|
+
`SEATBELT_PROFILE=restrictive-closed` in your environment or `.env` file.
|
|
407
|
+
Available built-in profiles are `{permissive,restrictive}-{open,closed,proxied}`
|
|
408
|
+
(see below for proxied networking). You can also switch to a custom profile
|
|
409
|
+
`SEATBELT_PROFILE=<profile>` if you also create a file
|
|
410
|
+
`.gemini/sandbox-macos-<profile>.sb` under your project settings directory
|
|
411
|
+
`.gemini`.
|
|
412
|
+
|
|
413
|
+
#### Container-based sandboxing (all platforms)
|
|
414
|
+
|
|
415
|
+
For stronger container-based sandboxing on macOS or other platforms, you can set
|
|
416
|
+
`GEMINI_SANDBOX=true|docker|podman|<command>` in your environment or `.env`
|
|
417
|
+
file. The specified command (or if `true` then either `docker` or `podman`) must
|
|
418
|
+
be installed on the host machine. Once enabled, `npm run build:all` will build a
|
|
419
|
+
minimal container ("sandbox") image and `npm start` will launch inside a fresh
|
|
420
|
+
instance of that container. The first build can take 20-30s (mostly due to
|
|
421
|
+
downloading of the base image) but after that both build and start overhead
|
|
422
|
+
should be minimal. Default builds (`npm run build`) will not rebuild the
|
|
423
|
+
sandbox.
|
|
424
|
+
|
|
425
|
+
Container-based sandboxing mounts the project directory (and system temp
|
|
426
|
+
directory) with read-write access and is started/stopped/removed automatically
|
|
427
|
+
as you start/stop Gemini CLI. Files created within the sandbox should be
|
|
428
|
+
automatically mapped to your user/group on host machine. You can easily specify
|
|
429
|
+
additional mounts, ports, or environment variables by setting
|
|
430
|
+
`SANDBOX_{MOUNTS,PORTS,ENV}` as needed. You can also fully customize the sandbox
|
|
431
|
+
for your projects by creating the files `.gemini/sandbox.Dockerfile` and/or
|
|
432
|
+
`.gemini/sandbox.bashrc` under your project settings directory (`.gemini`) and
|
|
433
|
+
running `gemini` with `BUILD_SANDBOX=1` to trigger building of your custom
|
|
434
|
+
sandbox.
|
|
435
|
+
|
|
436
|
+
#### Proxied networking
|
|
437
|
+
|
|
438
|
+
All sandboxing methods, including macOS Seatbelt using `*-proxied` profiles,
|
|
439
|
+
support restricting outbound network traffic through a custom proxy server that
|
|
440
|
+
can be specified as `GEMINI_SANDBOX_PROXY_COMMAND=<command>`, where `<command>`
|
|
441
|
+
must start a proxy server that listens on `:::8877` for relevant requests. See
|
|
442
|
+
`docs/examples/proxy-script.md` for a minimal proxy that only allows `HTTPS`
|
|
443
|
+
connections to `example.com:443` (e.g. `curl https://example.com`) and declines
|
|
444
|
+
all other requests. The proxy is started and stopped automatically alongside the
|
|
445
|
+
sandbox.
|
|
446
|
+
|
|
447
|
+
### Manual publish
|
|
448
|
+
|
|
449
|
+
We publish an artifact for each commit to our internal registry. But if you need
|
|
450
|
+
to manually cut a local build, then run the following commands:
|
|
451
|
+
|
|
452
|
+
```
|
|
453
|
+
npm run clean
|
|
454
|
+
npm install
|
|
455
|
+
npm run auth
|
|
456
|
+
npm run prerelease:dev
|
|
457
|
+
npm publish --workspaces
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
## Documentation contribution process
|
|
461
|
+
|
|
462
|
+
Our documentation must be kept up-to-date with our code contributions. We want
|
|
463
|
+
our documentation to be clear, concise, and helpful to our users. We value:
|
|
464
|
+
|
|
465
|
+
- **Clarity:** Use simple and direct language. Avoid jargon where possible.
|
|
466
|
+
- **Accuracy:** Ensure all information is correct and up-to-date.
|
|
467
|
+
- **Completeness:** Cover all aspects of a feature or topic.
|
|
468
|
+
- **Examples:** Provide practical examples to help users understand how to use
|
|
469
|
+
Gemini CLI.
|
|
470
|
+
|
|
471
|
+
### Getting started
|
|
472
|
+
|
|
473
|
+
The process for contributing to the documentation is similar to contributing
|
|
474
|
+
code.
|
|
475
|
+
|
|
476
|
+
1. **Fork the repository** and create a new branch.
|
|
477
|
+
2. **Make your changes** in the `/docs` directory.
|
|
478
|
+
3. **Preview your changes locally** in Markdown rendering.
|
|
479
|
+
4. **Lint and format your changes.** Our preflight check includes linting and
|
|
480
|
+
formatting for documentation files.
|
|
481
|
+
```bash
|
|
482
|
+
npm run preflight
|
|
483
|
+
```
|
|
484
|
+
5. **Open a pull request** with your changes.
|
|
485
|
+
|
|
486
|
+
### Documentation structure
|
|
487
|
+
|
|
488
|
+
Our documentation is organized using [sidebar.json](/docs/sidebar.json) as the
|
|
489
|
+
table of contents. When adding new documentation:
|
|
490
|
+
|
|
491
|
+
1. Create your markdown file **in the appropriate directory** under `/docs`.
|
|
492
|
+
2. Add an entry to `sidebar.json` in the relevant section.
|
|
493
|
+
3. Ensure all internal links use relative paths and point to existing files.
|
|
494
|
+
|
|
495
|
+
### Style guide
|
|
496
|
+
|
|
497
|
+
We follow the
|
|
498
|
+
[Google Developer Documentation Style Guide](https://developers.google.com/style).
|
|
499
|
+
Please refer to it for guidance on writing style, tone, and formatting.
|
|
500
|
+
|
|
501
|
+
#### Key style points
|
|
502
|
+
|
|
503
|
+
- Use sentence case for headings.
|
|
504
|
+
- Write in second person ("you") when addressing the reader.
|
|
505
|
+
- Use present tense.
|
|
506
|
+
- Keep paragraphs short and focused.
|
|
507
|
+
- Use code blocks with appropriate language tags for syntax highlighting.
|
|
508
|
+
- Include practical examples whenever possible.
|
|
509
|
+
|
|
510
|
+
### Linting and formatting
|
|
511
|
+
|
|
512
|
+
We use `prettier` to enforce a consistent style across our documentation. The
|
|
513
|
+
`npm run preflight` command will check for any linting issues.
|
|
514
|
+
|
|
515
|
+
You can also run the linter and formatter separately:
|
|
516
|
+
|
|
517
|
+
- `npm run lint` - Check for linting issues
|
|
518
|
+
- `npm run format` - Auto-format markdown files
|
|
519
|
+
- `npm run lint:fix` - Auto-fix linting issues where possible
|
|
520
|
+
|
|
521
|
+
Please make sure your contributions are free of linting errors before submitting
|
|
522
|
+
a pull request.
|
|
523
|
+
|
|
524
|
+
### Before you submit
|
|
525
|
+
|
|
526
|
+
Before submitting your documentation pull request, please:
|
|
527
|
+
|
|
528
|
+
1. Run `npm run preflight` to ensure all checks pass.
|
|
529
|
+
2. Review your changes for clarity and accuracy.
|
|
530
|
+
3. Check that all links work correctly.
|
|
531
|
+
4. Ensure any code examples are tested and functional.
|
|
532
|
+
5. Sign the
|
|
533
|
+
[Contributor License Agreement (CLA)](https://cla.developers.google.com/) if
|
|
534
|
+
you haven't already.
|
|
535
|
+
|
|
536
|
+
### Need help?
|
|
537
|
+
|
|
538
|
+
If you have questions about contributing documentation:
|
|
539
|
+
|
|
540
|
+
- Check our [FAQ](/docs/faq.md).
|
|
541
|
+
- Review existing documentation for examples.
|
|
542
|
+
- Open [an issue](https://github.com/google-gemini/gemini-cli/issues) to discuss
|
|
543
|
+
your proposed changes.
|
|
544
|
+
- Reach out to the maintainers.
|
|
545
|
+
|
|
546
|
+
We appreciate your contributions to making Gemini CLI documentation better!
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Gemini CLI Architecture Overview
|
|
2
|
+
|
|
3
|
+
This document provides a high-level overview of the Gemini CLI's architecture.
|
|
4
|
+
|
|
5
|
+
## Core components
|
|
6
|
+
|
|
7
|
+
The Gemini CLI is primarily composed of two main packages, along with a suite of
|
|
8
|
+
tools that can be used by the system in the course of handling command-line
|
|
9
|
+
input:
|
|
10
|
+
|
|
11
|
+
1. **CLI package (`packages/cli`):**
|
|
12
|
+
- **Purpose:** This contains the user-facing portion of the Gemini CLI, such
|
|
13
|
+
as handling the initial user input, presenting the final output, and
|
|
14
|
+
managing the overall user experience.
|
|
15
|
+
- **Key functions contained in the package:**
|
|
16
|
+
- [Input processing](/docs/cli/commands.md)
|
|
17
|
+
- History management
|
|
18
|
+
- Display rendering
|
|
19
|
+
- [Theme and UI customization](/docs/cli/themes.md)
|
|
20
|
+
- [CLI configuration settings](/docs/get-started/configuration.md)
|
|
21
|
+
|
|
22
|
+
2. **Core package (`packages/core`):**
|
|
23
|
+
- **Purpose:** This acts as the backend for the Gemini CLI. It receives
|
|
24
|
+
requests sent from `packages/cli`, orchestrates interactions with the
|
|
25
|
+
Gemini API, and manages the execution of available tools.
|
|
26
|
+
- **Key functions contained in the package:**
|
|
27
|
+
- API client for communicating with the Google Gemini API
|
|
28
|
+
- Prompt construction and management
|
|
29
|
+
- Tool registration and execution logic
|
|
30
|
+
- State management for conversations or sessions
|
|
31
|
+
- Server-side configuration
|
|
32
|
+
|
|
33
|
+
3. **Tools (`packages/core/src/tools/`):**
|
|
34
|
+
- **Purpose:** These are individual modules that extend the capabilities of
|
|
35
|
+
the Gemini model, allowing it to interact with the local environment
|
|
36
|
+
(e.g., file system, shell commands, web fetching).
|
|
37
|
+
- **Interaction:** `packages/core` invokes these tools based on requests
|
|
38
|
+
from the Gemini model.
|
|
39
|
+
|
|
40
|
+
## Interaction flow
|
|
41
|
+
|
|
42
|
+
A typical interaction with the Gemini CLI follows this flow:
|
|
43
|
+
|
|
44
|
+
1. **User input:** The user types a prompt or command into the terminal, which
|
|
45
|
+
is managed by `packages/cli`.
|
|
46
|
+
2. **Request to core:** `packages/cli` sends the user's input to
|
|
47
|
+
`packages/core`.
|
|
48
|
+
3. **Request processed:** The core package:
|
|
49
|
+
- Constructs an appropriate prompt for the Gemini API, possibly including
|
|
50
|
+
conversation history and available tool definitions.
|
|
51
|
+
- Sends the prompt to the Gemini API.
|
|
52
|
+
4. **Gemini API response:** The Gemini API processes the prompt and returns a
|
|
53
|
+
response. This response might be a direct answer or a request to use one of
|
|
54
|
+
the available tools.
|
|
55
|
+
5. **Tool execution (if applicable):**
|
|
56
|
+
- When the Gemini API requests a tool, the core package prepares to execute
|
|
57
|
+
it.
|
|
58
|
+
- If the requested tool can modify the file system or execute shell
|
|
59
|
+
commands, the user is first given details of the tool and its arguments,
|
|
60
|
+
and the user must approve the execution.
|
|
61
|
+
- Read-only operations, such as reading files, might not require explicit
|
|
62
|
+
user confirmation to proceed.
|
|
63
|
+
- Once confirmed, or if confirmation is not required, the core package
|
|
64
|
+
executes the relevant action within the relevant tool, and the result is
|
|
65
|
+
sent back to the Gemini API by the core package.
|
|
66
|
+
- The Gemini API processes the tool result and generates a final response.
|
|
67
|
+
6. **Response to CLI:** The core package sends the final response back to the
|
|
68
|
+
CLI package.
|
|
69
|
+
7. **Display to user:** The CLI package formats and displays the response to
|
|
70
|
+
the user in the terminal.
|
|
71
|
+
|
|
72
|
+
## Key design principles
|
|
73
|
+
|
|
74
|
+
- **Modularity:** Separating the CLI (frontend) from the Core (backend) allows
|
|
75
|
+
for independent development and potential future extensions (e.g., different
|
|
76
|
+
frontends for the same backend).
|
|
77
|
+
- **Extensibility:** The tool system is designed to be extensible, allowing new
|
|
78
|
+
capabilities to be added.
|
|
79
|
+
- **User experience:** The CLI focuses on providing a rich and interactive
|
|
80
|
+
terminal experience.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|