@google/gemini-cli-core 0.21.0-nightly.20251219.70696e364 → 0.21.0-nightly.20251221.8feeffb29

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.
Files changed (183) hide show
  1. package/dist/docs/CONTRIBUTING.md +546 -0
  2. package/dist/docs/architecture.md +80 -0
  3. package/dist/docs/assets/connected_devtools.png +0 -0
  4. package/dist/docs/assets/gemini-screenshot.png +0 -0
  5. package/dist/docs/assets/release_patch.png +0 -0
  6. package/dist/docs/assets/theme-ansi-light.png +0 -0
  7. package/dist/docs/assets/theme-ansi.png +0 -0
  8. package/dist/docs/assets/theme-atom-one.png +0 -0
  9. package/dist/docs/assets/theme-ayu-light.png +0 -0
  10. package/dist/docs/assets/theme-ayu.png +0 -0
  11. package/dist/docs/assets/theme-custom.png +0 -0
  12. package/dist/docs/assets/theme-default-light.png +0 -0
  13. package/dist/docs/assets/theme-default.png +0 -0
  14. package/dist/docs/assets/theme-dracula.png +0 -0
  15. package/dist/docs/assets/theme-github-light.png +0 -0
  16. package/dist/docs/assets/theme-github.png +0 -0
  17. package/dist/docs/assets/theme-google-light.png +0 -0
  18. package/dist/docs/assets/theme-xcode-light.png +0 -0
  19. package/dist/docs/changelogs/index.md +592 -0
  20. package/dist/docs/changelogs/latest.md +225 -0
  21. package/dist/docs/changelogs/preview.md +129 -0
  22. package/dist/docs/changelogs/releases.md +896 -0
  23. package/dist/docs/cli/authentication.md +3 -0
  24. package/dist/docs/cli/checkpointing.md +94 -0
  25. package/dist/docs/cli/commands.md +354 -0
  26. package/dist/docs/cli/configuration.md +780 -0
  27. package/dist/docs/cli/custom-commands.md +315 -0
  28. package/dist/docs/cli/enterprise.md +565 -0
  29. package/dist/docs/cli/gemini-ignore.md +71 -0
  30. package/dist/docs/cli/gemini-md.md +108 -0
  31. package/dist/docs/cli/generation-settings.md +210 -0
  32. package/dist/docs/cli/headless.md +388 -0
  33. package/dist/docs/cli/index.md +63 -0
  34. package/dist/docs/cli/keyboard-shortcuts.md +143 -0
  35. package/dist/docs/cli/model-routing.md +37 -0
  36. package/dist/docs/cli/model.md +62 -0
  37. package/dist/docs/cli/sandbox.md +171 -0
  38. package/dist/docs/cli/session-management.md +158 -0
  39. package/dist/docs/cli/settings.md +112 -0
  40. package/dist/docs/cli/system-prompt.md +93 -0
  41. package/dist/docs/cli/telemetry.md +791 -0
  42. package/dist/docs/cli/themes.md +237 -0
  43. package/dist/docs/cli/token-caching.md +20 -0
  44. package/dist/docs/cli/trusted-folders.md +95 -0
  45. package/dist/docs/cli/tutorials.md +83 -0
  46. package/dist/docs/cli/uninstall.md +47 -0
  47. package/dist/docs/core/index.md +101 -0
  48. package/dist/docs/core/memport.md +244 -0
  49. package/dist/docs/core/policy-engine.md +267 -0
  50. package/dist/docs/core/tools-api.md +131 -0
  51. package/dist/docs/examples/proxy-script.md +83 -0
  52. package/dist/docs/extensions/extension-releasing.md +183 -0
  53. package/dist/docs/extensions/getting-started-extensions.md +245 -0
  54. package/dist/docs/extensions/index.md +293 -0
  55. package/dist/docs/faq.md +154 -0
  56. package/dist/docs/get-started/authentication.md +321 -0
  57. package/dist/docs/get-started/configuration-v1.md +888 -0
  58. package/dist/docs/get-started/configuration.md +1444 -0
  59. package/dist/docs/get-started/deployment.md +143 -0
  60. package/dist/docs/get-started/examples.md +219 -0
  61. package/dist/docs/get-started/gemini-3.md +116 -0
  62. package/dist/docs/get-started/index.md +71 -0
  63. package/dist/docs/get-started/installation.md +141 -0
  64. package/dist/docs/hooks/best-practices.md +806 -0
  65. package/dist/docs/hooks/index.md +665 -0
  66. package/dist/docs/hooks/reference.md +168 -0
  67. package/dist/docs/hooks/writing-hooks.md +1026 -0
  68. package/dist/docs/ide-integration/ide-companion-spec.md +267 -0
  69. package/dist/docs/ide-integration/index.md +202 -0
  70. package/dist/docs/index.md +147 -0
  71. package/dist/docs/integration-tests.md +211 -0
  72. package/dist/docs/issue-and-pr-automation.md +134 -0
  73. package/dist/docs/local-development.md +128 -0
  74. package/dist/docs/mermaid/context.mmd +103 -0
  75. package/dist/docs/mermaid/render-path.mmd +64 -0
  76. package/dist/docs/npm.md +62 -0
  77. package/dist/docs/quota-and-pricing.md +158 -0
  78. package/dist/docs/release-confidence.md +164 -0
  79. package/dist/docs/releases.md +540 -0
  80. package/dist/docs/sidebar.json +297 -0
  81. package/dist/docs/tools/file-system.md +217 -0
  82. package/dist/docs/tools/index.md +95 -0
  83. package/dist/docs/tools/mcp-server.md +1044 -0
  84. package/dist/docs/tools/memory.md +54 -0
  85. package/dist/docs/tools/shell.md +260 -0
  86. package/dist/docs/tools/todos.md +57 -0
  87. package/dist/docs/tools/web-fetch.md +59 -0
  88. package/dist/docs/tools/web-search.md +42 -0
  89. package/dist/docs/tos-privacy.md +96 -0
  90. package/dist/docs/troubleshooting.md +158 -0
  91. package/dist/google-gemini-cli-core-0.21.0-nightly.20251219.70696e364.tgz +0 -0
  92. package/dist/src/agents/delegate-to-agent-tool.test.js +1 -0
  93. package/dist/src/agents/delegate-to-agent-tool.test.js.map +1 -1
  94. package/dist/src/agents/introspection-agent.d.ts +23 -0
  95. package/dist/src/agents/introspection-agent.js +72 -0
  96. package/dist/src/agents/introspection-agent.js.map +1 -0
  97. package/dist/src/agents/introspection-agent.test.d.ts +6 -0
  98. package/dist/src/agents/introspection-agent.test.js +47 -0
  99. package/dist/src/agents/introspection-agent.test.js.map +1 -0
  100. package/dist/src/agents/local-executor.js +14 -12
  101. package/dist/src/agents/local-executor.js.map +1 -1
  102. package/dist/src/agents/local-executor.test.js +3 -0
  103. package/dist/src/agents/local-executor.test.js.map +1 -1
  104. package/dist/src/agents/registry.js +6 -0
  105. package/dist/src/agents/registry.js.map +1 -1
  106. package/dist/src/agents/registry.test.js +16 -0
  107. package/dist/src/agents/registry.test.js.map +1 -1
  108. package/dist/src/config/config.d.ts +6 -0
  109. package/dist/src/config/config.js +22 -0
  110. package/dist/src/config/config.js.map +1 -1
  111. package/dist/src/config/config.test.js +59 -1
  112. package/dist/src/config/config.test.js.map +1 -1
  113. package/dist/src/core/client.js +8 -4
  114. package/dist/src/core/client.js.map +1 -1
  115. package/dist/src/core/client.test.js +20 -0
  116. package/dist/src/core/client.test.js.map +1 -1
  117. package/dist/src/core/clientHookTriggers.js +2 -2
  118. package/dist/src/core/clientHookTriggers.js.map +1 -1
  119. package/dist/src/core/coreToolHookTriggers.js +3 -3
  120. package/dist/src/core/coreToolHookTriggers.js.map +1 -1
  121. package/dist/src/core/geminiChatHookTriggers.js +3 -3
  122. package/dist/src/core/geminiChatHookTriggers.js.map +1 -1
  123. package/dist/src/core/sessionHookTriggers.js +3 -3
  124. package/dist/src/core/sessionHookTriggers.js.map +1 -1
  125. package/dist/src/generated/git-commit.d.ts +2 -2
  126. package/dist/src/generated/git-commit.js +2 -2
  127. package/dist/src/hooks/hookEventHandler.js +10 -4
  128. package/dist/src/hooks/hookEventHandler.js.map +1 -1
  129. package/dist/src/hooks/hookEventHandler.test.js +40 -0
  130. package/dist/src/hooks/hookEventHandler.test.js.map +1 -1
  131. package/dist/src/hooks/hookRunner.js +12 -8
  132. package/dist/src/hooks/hookRunner.js.map +1 -1
  133. package/dist/src/hooks/hookRunner.test.js +58 -33
  134. package/dist/src/hooks/hookRunner.test.js.map +1 -1
  135. package/dist/src/mcp/oauth-provider.js +6 -2
  136. package/dist/src/mcp/oauth-provider.js.map +1 -1
  137. package/dist/src/mcp/oauth-provider.test.js +4 -1
  138. package/dist/src/mcp/oauth-provider.test.js.map +1 -1
  139. package/dist/src/mcp/oauth-utils.d.ts +8 -1
  140. package/dist/src/mcp/oauth-utils.js +30 -1
  141. package/dist/src/mcp/oauth-utils.js.map +1 -1
  142. package/dist/src/mcp/oauth-utils.test.js +42 -0
  143. package/dist/src/mcp/oauth-utils.test.js.map +1 -1
  144. package/dist/src/services/contextManager.d.ts +5 -11
  145. package/dist/src/services/contextManager.js +20 -17
  146. package/dist/src/services/contextManager.js.map +1 -1
  147. package/dist/src/services/contextManager.test.js +40 -41
  148. package/dist/src/services/contextManager.test.js.map +1 -1
  149. package/dist/src/tools/confirmation-policy.test.d.ts +6 -0
  150. package/dist/src/tools/confirmation-policy.test.js +152 -0
  151. package/dist/src/tools/confirmation-policy.test.js.map +1 -0
  152. package/dist/src/tools/edit.js +5 -1
  153. package/dist/src/tools/edit.js.map +1 -1
  154. package/dist/src/tools/get-internal-docs.d.ts +27 -0
  155. package/dist/src/tools/get-internal-docs.js +129 -0
  156. package/dist/src/tools/get-internal-docs.js.map +1 -0
  157. package/dist/src/tools/get-internal-docs.test.d.ts +6 -0
  158. package/dist/src/tools/get-internal-docs.test.js +56 -0
  159. package/dist/src/tools/get-internal-docs.test.js.map +1 -0
  160. package/dist/src/tools/smart-edit.js +5 -1
  161. package/dist/src/tools/smart-edit.js.map +1 -1
  162. package/dist/src/tools/tool-names.d.ts +1 -0
  163. package/dist/src/tools/tool-names.js +1 -0
  164. package/dist/src/tools/tool-names.js.map +1 -1
  165. package/dist/src/tools/web-fetch.js +5 -1
  166. package/dist/src/tools/web-fetch.js.map +1 -1
  167. package/dist/src/tools/write-file.js +5 -1
  168. package/dist/src/tools/write-file.js.map +1 -1
  169. package/dist/src/utils/environmentContext.js +3 -0
  170. package/dist/src/utils/environmentContext.js.map +1 -1
  171. package/dist/src/utils/environmentContext.test.js +2 -0
  172. package/dist/src/utils/environmentContext.test.js.map +1 -1
  173. package/dist/src/utils/events.d.ts +3 -2
  174. package/dist/src/utils/events.js.map +1 -1
  175. package/dist/src/utils/memoryDiscovery.js +1 -1
  176. package/dist/src/utils/memoryDiscovery.js.map +1 -1
  177. package/dist/src/utils/memoryDiscovery.test.js +3 -1
  178. package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
  179. package/dist/src/utils/shell-utils.js +25 -4
  180. package/dist/src/utils/shell-utils.js.map +1 -1
  181. package/dist/tsconfig.tsbuildinfo +1 -1
  182. package/package.json +1 -1
  183. package/dist/google-gemini-cli-core-0.21.0-nightly.20251218.739c02bd6.tgz +0 -0
@@ -0,0 +1,211 @@
1
+ # Integration tests
2
+
3
+ This document provides information about the integration testing framework used
4
+ in this project.
5
+
6
+ ## Overview
7
+
8
+ The integration tests are designed to validate the end-to-end functionality of
9
+ the Gemini CLI. They execute the built binary in a controlled environment and
10
+ verify that it behaves as expected when interacting with the file system.
11
+
12
+ These tests are located in the `integration-tests` directory and are run using a
13
+ custom test runner.
14
+
15
+ ## Building the tests
16
+
17
+ Prior to running any integration tests, you need to create a release bundle that
18
+ you want to actually test:
19
+
20
+ ```bash
21
+ npm run bundle
22
+ ```
23
+
24
+ You must re-run this command after making any changes to the CLI source code,
25
+ but not after making changes to tests.
26
+
27
+ ## Running the tests
28
+
29
+ The integration tests are not run as part of the default `npm run test` command.
30
+ They must be run explicitly using the `npm run test:integration:all` script.
31
+
32
+ The integration tests can also be run using the following shortcut:
33
+
34
+ ```bash
35
+ npm run test:e2e
36
+ ```
37
+
38
+ ## Running a specific set of tests
39
+
40
+ To run a subset of test files, you can use
41
+ `npm run <integration test command> <file_name1> ....` where &lt;integration
42
+ test command&gt; is either `test:e2e` or `test:integration*` and `<file_name>`
43
+ is any of the `.test.js` files in the `integration-tests/` directory. For
44
+ example, the following command runs `list_directory.test.js` and
45
+ `write_file.test.js`:
46
+
47
+ ```bash
48
+ npm run test:e2e list_directory write_file
49
+ ```
50
+
51
+ ### Running a single test by name
52
+
53
+ To run a single test by its name, use the `--test-name-pattern` flag:
54
+
55
+ ```bash
56
+ npm run test:e2e -- --test-name-pattern "reads a file"
57
+ ```
58
+
59
+ ### Regenerating model responses
60
+
61
+ Some integration tests use faked out model responses, which may need to be
62
+ regenerated from time to time as the implementations change.
63
+
64
+ To regenerate these golden files, set the REGENERATE_MODEL_GOLDENS environment
65
+ variable to "true" when running the tests, for example:
66
+
67
+ **WARNING**: If running locally you should review these updated responses for
68
+ any information about yourself or your system that gemini may have included in
69
+ these responses.
70
+
71
+ ```bash
72
+ REGENERATE_MODEL_GOLDENS="true" npm run test:e2e
73
+ ```
74
+
75
+ **WARNING**: Make sure you run **await rig.cleanup()** at the end of your test,
76
+ else the golden files will not be updated.
77
+
78
+ ### Deflaking a test
79
+
80
+ Before adding a **new** integration test, you should test it at least 5 times
81
+ with the deflake script or workflow to make sure that it is not flaky.
82
+
83
+ ### Deflake script
84
+
85
+ ```bash
86
+ npm run deflake -- --runs=5 --command="npm run test:e2e -- -- --test-name-pattern '<your-new-test-name>'"
87
+ ```
88
+
89
+ #### Deflake workflow
90
+
91
+ ```bash
92
+ gh workflow run deflake.yml --ref <your-branch> -f test_name_pattern="<your-test-name-pattern>"
93
+ ```
94
+
95
+ ### Running all tests
96
+
97
+ To run the entire suite of integration tests, use the following command:
98
+
99
+ ```bash
100
+ npm run test:integration:all
101
+ ```
102
+
103
+ ### Sandbox matrix
104
+
105
+ The `all` command will run tests for `no sandboxing`, `docker` and `podman`.
106
+ Each individual type can be run using the following commands:
107
+
108
+ ```bash
109
+ npm run test:integration:sandbox:none
110
+ ```
111
+
112
+ ```bash
113
+ npm run test:integration:sandbox:docker
114
+ ```
115
+
116
+ ```bash
117
+ npm run test:integration:sandbox:podman
118
+ ```
119
+
120
+ ## Diagnostics
121
+
122
+ The integration test runner provides several options for diagnostics to help
123
+ track down test failures.
124
+
125
+ ### Keeping test output
126
+
127
+ You can preserve the temporary files created during a test run for inspection.
128
+ This is useful for debugging issues with file system operations.
129
+
130
+ To keep the test output set the `KEEP_OUTPUT` environment variable to `true`.
131
+
132
+ ```bash
133
+ KEEP_OUTPUT=true npm run test:integration:sandbox:none
134
+ ```
135
+
136
+ When output is kept, the test runner will print the path to the unique directory
137
+ for the test run.
138
+
139
+ ### Verbose output
140
+
141
+ For more detailed debugging, set the `VERBOSE` environment variable to `true`.
142
+
143
+ ```bash
144
+ VERBOSE=true npm run test:integration:sandbox:none
145
+ ```
146
+
147
+ When using `VERBOSE=true` and `KEEP_OUTPUT=true` in the same command, the output
148
+ is streamed to the console and also saved to a log file within the test's
149
+ temporary directory.
150
+
151
+ The verbose output is formatted to clearly identify the source of the logs:
152
+
153
+ ```
154
+ --- TEST: <log dir>:<test-name> ---
155
+ ... output from the gemini command ...
156
+ --- END TEST: <log dir>:<test-name> ---
157
+ ```
158
+
159
+ ## Linting and formatting
160
+
161
+ To ensure code quality and consistency, the integration test files are linted as
162
+ part of the main build process. You can also manually run the linter and
163
+ auto-fixer.
164
+
165
+ ### Running the linter
166
+
167
+ To check for linting errors, run the following command:
168
+
169
+ ```bash
170
+ npm run lint
171
+ ```
172
+
173
+ You can include the `:fix` flag in the command to automatically fix any fixable
174
+ linting errors:
175
+
176
+ ```bash
177
+ npm run lint:fix
178
+ ```
179
+
180
+ ## Directory structure
181
+
182
+ The integration tests create a unique directory for each test run inside the
183
+ `.integration-tests` directory. Within this directory, a subdirectory is created
184
+ for each test file, and within that, a subdirectory is created for each
185
+ individual test case.
186
+
187
+ This structure makes it easy to locate the artifacts for a specific test run,
188
+ file, or case.
189
+
190
+ ```
191
+ .integration-tests/
192
+ └── <run-id>/
193
+ └── <test-file-name>.test.js/
194
+ └── <test-case-name>/
195
+ ├── output.log
196
+ └── ...other test artifacts...
197
+ ```
198
+
199
+ ## Continuous integration
200
+
201
+ To ensure the integration tests are always run, a GitHub Actions workflow is
202
+ defined in `.github/workflows/chained_e2e.yml`. This workflow automatically runs
203
+ the integrations tests for pull requests against the `main` branch, or when a
204
+ pull request is added to a merge queue.
205
+
206
+ The workflow runs the tests in different sandboxing environments to ensure
207
+ Gemini CLI is tested across each:
208
+
209
+ - `sandbox:none`: Runs the tests without any sandboxing.
210
+ - `sandbox:docker`: Runs the tests in a Docker container.
211
+ - `sandbox:podman`: Runs the tests in a Podman container.
@@ -0,0 +1,134 @@
1
+ # Automation and triage processes
2
+
3
+ This document provides a detailed overview of the automated processes we use to
4
+ manage and triage issues and pull requests. Our goal is to provide prompt
5
+ feedback and ensure that contributions are reviewed and integrated efficiently.
6
+ Understanding this automation will help you as a contributor know what to expect
7
+ and how to best interact with our repository bots.
8
+
9
+ ## Guiding principle: Issues and pull requests
10
+
11
+ First and foremost, almost every Pull Request (PR) should be linked to a
12
+ corresponding Issue. The issue describes the "what" and the "why" (the bug or
13
+ feature), while the PR is the "how" (the implementation). This separation helps
14
+ us track work, prioritize features, and maintain clear historical context. Our
15
+ automation is built around this principle.
16
+
17
+ > **Note:** Issues tagged as "🔒Maintainers only" are reserved for project
18
+ > maintainers. We will not accept pull requests related to these issues.
19
+
20
+ ---
21
+
22
+ ## Detailed automation workflows
23
+
24
+ Here is a breakdown of the specific automation workflows that run in our
25
+ repository.
26
+
27
+ ### 1. When you open an issue: `Automated Issue Triage`
28
+
29
+ This is the first bot you will interact with when you create an issue. Its job
30
+ is to perform an initial analysis and apply the correct labels.
31
+
32
+ - **Workflow File**: `.github/workflows/gemini-automated-issue-triage.yml`
33
+ - **When it runs**: Immediately after an issue is created or reopened.
34
+ - **What it does**:
35
+ - It uses a Gemini model to analyze the issue's title and body against a
36
+ detailed set of guidelines.
37
+ - **Applies one `area/*` label**: Categorizes the issue into a functional area
38
+ of the project (e.g., `area/ux`, `area/models`, `area/platform`).
39
+ - **Applies one `kind/*` label**: Identifies the type of issue (e.g.,
40
+ `kind/bug`, `kind/enhancement`, `kind/question`).
41
+ - **Applies one `priority/*` label**: Assigns a priority from P0 (critical) to
42
+ P3 (low) based on the described impact.
43
+ - **May apply `status/need-information`**: If the issue lacks critical details
44
+ (like logs or reproduction steps), it will be flagged for more information.
45
+ - **May apply `status/need-retesting`**: If the issue references a CLI version
46
+ that is more than six versions old, it will be flagged for retesting on a
47
+ current version.
48
+ - **What you should do**:
49
+ - Fill out the issue template as completely as possible. The more detail you
50
+ provide, the more accurate the triage will be.
51
+ - If the `status/need-information` label is added, please provide the
52
+ requested details in a comment.
53
+
54
+ ### 2. When you open a pull request: `Continuous Integration (CI)`
55
+
56
+ This workflow ensures that all changes meet our quality standards before they
57
+ can be merged.
58
+
59
+ - **Workflow File**: `.github/workflows/ci.yml`
60
+ - **When it runs**: On every push to a pull request.
61
+ - **What it does**:
62
+ - **Lint**: Checks that your code adheres to our project's formatting and
63
+ style rules.
64
+ - **Test**: Runs our full suite of automated tests across macOS, Windows, and
65
+ Linux, and on multiple Node.js versions. This is the most time-consuming
66
+ part of the CI process.
67
+ - **Post Coverage Comment**: After all tests have successfully passed, a bot
68
+ will post a comment on your PR. This comment provides a summary of how well
69
+ your changes are covered by tests.
70
+ - **What you should do**:
71
+ - Ensure all CI checks pass. A green checkmark ✅ will appear next to your
72
+ commit when everything is successful.
73
+ - If a check fails (a red "X" ❌), click the "Details" link next to the failed
74
+ check to view the logs, identify the problem, and push a fix.
75
+
76
+ ### 3. Ongoing triage for pull requests: `PR Auditing and Label Sync`
77
+
78
+ This workflow runs periodically to ensure all open PRs are correctly linked to
79
+ issues and have consistent labels.
80
+
81
+ - **Workflow File**: `.github/workflows/gemini-scheduled-pr-triage.yml`
82
+ - **When it runs**: Every 15 minutes on all open pull requests.
83
+ - **What it does**:
84
+ - **Checks for a linked issue**: The bot scans your PR description for a
85
+ keyword that links it to an issue (e.g., `Fixes #123`, `Closes #456`).
86
+ - **Adds `status/need-issue`**: If no linked issue is found, the bot will add
87
+ the `status/need-issue` label to your PR. This is a clear signal that an
88
+ issue needs to be created and linked.
89
+ - **Synchronizes labels**: If an issue _is_ linked, the bot ensures the PR's
90
+ labels perfectly match the issue's labels. It will add any missing labels
91
+ and remove any that don't belong, and it will remove the `status/need-issue`
92
+ label if it was present.
93
+ - **What you should do**:
94
+ - **Always link your PR to an issue.** This is the most important step. Add a
95
+ line like `Resolves #<issue-number>` to your PR description.
96
+ - This will ensure your PR is correctly categorized and moves through the
97
+ review process smoothly.
98
+
99
+ ### 4. Ongoing triage for issues: `Scheduled Issue Triage`
100
+
101
+ This is a fallback workflow to ensure that no issue gets missed by the triage
102
+ process.
103
+
104
+ - **Workflow File**: `.github/workflows/gemini-scheduled-issue-triage.yml`
105
+ - **When it runs**: Every hour on all open issues.
106
+ - **What it does**:
107
+ - It actively seeks out issues that either have no labels at all or still have
108
+ the `status/need-triage` label.
109
+ - It then triggers the same powerful Gemini-based analysis as the initial
110
+ triage bot to apply the correct labels.
111
+ - **What you should do**:
112
+ - You typically don't need to do anything. This workflow is a safety net to
113
+ ensure every issue is eventually categorized, even if the initial triage
114
+ fails.
115
+
116
+ ### 5. Release automation
117
+
118
+ This workflow handles the process of packaging and publishing new versions of
119
+ the Gemini CLI.
120
+
121
+ - **Workflow File**: `.github/workflows/release-manual.yml`
122
+ - **When it runs**: On a daily schedule for "nightly" releases, and manually for
123
+ official patch/minor releases.
124
+ - **What it does**:
125
+ - Automatically builds the project, bumps the version numbers, and publishes
126
+ the packages to npm.
127
+ - Creates a corresponding release on GitHub with generated release notes.
128
+ - **What you should do**:
129
+ - As a contributor, you don't need to do anything for this process. You can be
130
+ confident that once your PR is merged into the `main` branch, your changes
131
+ will be included in the very next nightly release.
132
+
133
+ We hope this detailed overview is helpful. If you have any questions about our
134
+ automation or processes, please don't hesitate to ask!
@@ -0,0 +1,128 @@
1
+ # Local development guide
2
+
3
+ This guide provides instructions for setting up and using local development
4
+ features, such as development tracing.
5
+
6
+ ## Development tracing
7
+
8
+ Development traces (dev traces) are OpenTelemetry (OTel) traces that help you
9
+ debug your code by instrumenting interesting events like model calls, tool
10
+ scheduler, tool calls, etc.
11
+
12
+ Dev traces are verbose and are specifically meant for understanding agent
13
+ behaviour and debugging issues. They are disabled by default.
14
+
15
+ To enable dev traces, set the `GEMINI_DEV_TRACING=true` environment variable
16
+ when running Gemini CLI.
17
+
18
+ ### Viewing dev traces
19
+
20
+ You can view dev traces using either Jaeger or the Genkit Developer UI.
21
+
22
+ #### Using Genkit
23
+
24
+ Genkit provides a web-based UI for viewing traces and other telemetry data.
25
+
26
+ 1. **Start the Genkit telemetry server:**
27
+
28
+ Run the following command to start the Genkit server:
29
+
30
+ ```bash
31
+ npm run telemetry -- --target=genkit
32
+ ```
33
+
34
+ The script will output the URL for the Genkit Developer UI, for example:
35
+
36
+ ```
37
+ Genkit Developer UI: http://localhost:4000
38
+ ```
39
+
40
+ 2. **Run Gemini CLI with dev tracing:**
41
+
42
+ In a separate terminal, run your Gemini CLI command with the
43
+ `GEMINI_DEV_TRACING` environment variable:
44
+
45
+ ```bash
46
+ GEMINI_DEV_TRACING=true gemini
47
+ ```
48
+
49
+ 3. **View the traces:**
50
+
51
+ Open the Genkit Developer UI URL in your browser and navigate to the
52
+ **Traces** tab to view the traces.
53
+
54
+ #### Using Jaeger
55
+
56
+ You can view dev traces in the Jaeger UI. To get started, follow these steps:
57
+
58
+ 1. **Start the telemetry collector:**
59
+
60
+ Run the following command in your terminal to download and start Jaeger and
61
+ an OTEL collector:
62
+
63
+ ```bash
64
+ npm run telemetry -- --target=local
65
+ ```
66
+
67
+ This command also configures your workspace for local telemetry and provides
68
+ a link to the Jaeger UI (usually `http://localhost:16686`).
69
+
70
+ 2. **Run Gemini CLI with dev tracing:**
71
+
72
+ In a separate terminal, run your Gemini CLI command with the
73
+ `GEMINI_DEV_TRACING` environment variable:
74
+
75
+ ```bash
76
+ GEMINI_DEV_TRACING=true gemini
77
+ ```
78
+
79
+ 3. **View the traces:**
80
+
81
+ After running your command, open the Jaeger UI link in your browser to view
82
+ the traces.
83
+
84
+ For more detailed information on telemetry, see the
85
+ [telemetry documentation](./cli/telemetry.md).
86
+
87
+ ### Instrumenting code with dev traces
88
+
89
+ You can add dev traces to your own code for more detailed instrumentation. This
90
+ is useful for debugging and understanding the flow of execution.
91
+
92
+ Use the `runInDevTraceSpan` function to wrap any section of code in a trace
93
+ span.
94
+
95
+ Here is a basic example:
96
+
97
+ ```typescript
98
+ import { runInDevTraceSpan } from '@google/gemini-cli-core';
99
+
100
+ await runInDevTraceSpan({ name: 'my-custom-span' }, async ({ metadata }) => {
101
+ // The `metadata` object allows you to record the input and output of the
102
+ // operation as well as other attributes.
103
+ metadata.input = { key: 'value' };
104
+ // Set custom attributes.
105
+ metadata.attributes['gen_ai.request.model'] = 'gemini-4.0-mega';
106
+
107
+ // Your code to be traced goes here
108
+ try {
109
+ const output = await somethingRisky();
110
+ metadata.output = output;
111
+ return output;
112
+ } catch (e) {
113
+ metadata.error = e;
114
+ throw e;
115
+ }
116
+ });
117
+ ```
118
+
119
+ In this example:
120
+
121
+ - `name`: The name of the span, which will be displayed in the trace.
122
+ - `metadata.input`: (Optional) An object containing the input data for the
123
+ traced operation.
124
+ - `metadata.output`: (Optional) An object containing the output data from the
125
+ traced operation.
126
+ - `metadata.attributes`: (Optional) A record of custom attributes to add to the
127
+ span.
128
+ - `metadata.error`: (Optional) An error object to record if the operation fails.
@@ -0,0 +1,103 @@
1
+ graph LR
2
+ %% --- Style Definitions ---
3
+ classDef new fill:#98fb98,color:#000
4
+ classDef changed fill:#add8e6,color:#000
5
+ classDef unchanged fill:#f0f0f0,color:#000
6
+
7
+ %% --- Subgraphs ---
8
+ subgraph "Context Providers"
9
+ direction TB
10
+ A["gemini.tsx"]
11
+ B["AppContainer.tsx"]
12
+ end
13
+
14
+ subgraph "Contexts"
15
+ direction TB
16
+ CtxSession["SessionContext"]
17
+ CtxVim["VimModeContext"]
18
+ CtxSettings["SettingsContext"]
19
+ CtxApp["AppContext"]
20
+ CtxConfig["ConfigContext"]
21
+ CtxUIState["UIStateContext"]
22
+ CtxUIActions["UIActionsContext"]
23
+ end
24
+
25
+ subgraph "Component Consumers"
26
+ direction TB
27
+ ConsumerApp["App"]
28
+ ConsumerAppContainer["AppContainer"]
29
+ ConsumerAppHeader["AppHeader"]
30
+ ConsumerDialogManager["DialogManager"]
31
+ ConsumerHistoryItem["HistoryItemDisplay"]
32
+ ConsumerComposer["Composer"]
33
+ ConsumerMainContent["MainContent"]
34
+ ConsumerNotifications["Notifications"]
35
+ end
36
+
37
+ %% --- Provider -> Context Connections ---
38
+ A -.-> CtxSession
39
+ A -.-> CtxVim
40
+ A -.-> CtxSettings
41
+
42
+ B -.-> CtxApp
43
+ B -.-> CtxConfig
44
+ B -.-> CtxUIState
45
+ B -.-> CtxUIActions
46
+ B -.-> CtxSettings
47
+
48
+ %% --- Context -> Consumer Connections ---
49
+ CtxSession -.-> ConsumerAppContainer
50
+ CtxSession -.-> ConsumerApp
51
+
52
+ CtxVim -.-> ConsumerAppContainer
53
+ CtxVim -.-> ConsumerComposer
54
+ CtxVim -.-> ConsumerApp
55
+
56
+ CtxSettings -.-> ConsumerAppContainer
57
+ CtxSettings -.-> ConsumerAppHeader
58
+ CtxSettings -.-> ConsumerDialogManager
59
+ CtxSettings -.-> ConsumerApp
60
+
61
+ CtxApp -.-> ConsumerAppHeader
62
+ CtxApp -.-> ConsumerNotifications
63
+
64
+ CtxConfig -.-> ConsumerAppHeader
65
+ CtxConfig -.-> ConsumerHistoryItem
66
+ CtxConfig -.-> ConsumerComposer
67
+ CtxConfig -.-> ConsumerDialogManager
68
+
69
+
70
+
71
+ CtxUIState -.-> ConsumerApp
72
+ CtxUIState -.-> ConsumerMainContent
73
+ CtxUIState -.-> ConsumerComposer
74
+ CtxUIState -.-> ConsumerDialogManager
75
+
76
+ CtxUIActions -.-> ConsumerComposer
77
+ CtxUIActions -.-> ConsumerDialogManager
78
+
79
+ %% --- Apply Styles ---
80
+ %% New Elements (Green)
81
+ class B,CtxApp,CtxConfig,CtxUIState,CtxUIActions,ConsumerAppHeader,ConsumerDialogManager,ConsumerComposer,ConsumerMainContent,ConsumerNotifications new
82
+
83
+ %% Heavily Changed Elements (Blue)
84
+ class A,ConsumerApp,ConsumerAppContainer,ConsumerHistoryItem changed
85
+
86
+ %% Mostly Unchanged Elements (Gray)
87
+ class CtxSession,CtxVim,CtxSettings unchanged
88
+
89
+ %% --- Link Styles ---
90
+ %% CtxSession (Red)
91
+ linkStyle 0,8,9 stroke:#e57373,stroke-width:2px
92
+ %% CtxVim (Orange)
93
+ linkStyle 1,10,11,12 stroke:#ffb74d,stroke-width:2px
94
+ %% CtxSettings (Yellow)
95
+ linkStyle 2,7,13,14,15,16 stroke:#fff176,stroke-width:2px
96
+ %% CtxApp (Green)
97
+ linkStyle 3,17,18 stroke:#81c784,stroke-width:2px
98
+ %% CtxConfig (Blue)
99
+ linkStyle 4,19,20,21,22 stroke:#64b5f6,stroke-width:2px
100
+ %% CtxUIState (Indigo)
101
+ linkStyle 5,23,24,25,26 stroke:#7986cb,stroke-width:2px
102
+ %% CtxUIActions (Violet)
103
+ linkStyle 6,27,28 stroke:#ba68c8,stroke-width:2px
@@ -0,0 +1,64 @@
1
+ graph TD
2
+ %% --- Style Definitions ---
3
+ classDef new fill:#98fb98,color:#000
4
+ classDef changed fill:#add8e6,color:#000
5
+ classDef unchanged fill:#f0f0f0,color:#000
6
+ classDef dispatcher fill:#f9e79f,color:#000,stroke:#333,stroke-width:1px
7
+ classDef container fill:#f5f5f5,color:#000,stroke:#ccc
8
+
9
+ %% --- Component Tree ---
10
+ subgraph "Entry Point"
11
+ A["gemini.tsx"]
12
+ end
13
+
14
+ subgraph "State & Logic Wrapper"
15
+ B["AppContainer.tsx"]
16
+ end
17
+
18
+ subgraph "Primary Layout"
19
+ C["App.tsx"]
20
+ end
21
+
22
+ A -.-> B
23
+ B -.-> C
24
+
25
+ subgraph "UI Containers"
26
+ direction LR
27
+ C -.-> D["MainContent"]
28
+ C -.-> G["Composer"]
29
+ C -.-> F["DialogManager"]
30
+ C -.-> E["Notifications"]
31
+ end
32
+
33
+ subgraph "MainContent"
34
+ direction TB
35
+ D -.-> H["AppHeader"]
36
+ D -.-> I["HistoryItemDisplay"]:::dispatcher
37
+ D -.-> L["ShowMoreLines"]
38
+ end
39
+
40
+ subgraph "Composer"
41
+ direction TB
42
+ G -.-> K_Prompt["InputPrompt"]
43
+ G -.-> K_Footer["Footer"]
44
+ end
45
+
46
+ subgraph "DialogManager"
47
+ F -.-> J["Various Dialogs<br>(Auth, Theme, Settings, etc.)"]
48
+ end
49
+
50
+ %% --- Apply Styles ---
51
+ class B,D,E,F,G,H,J,K_Prompt,L new
52
+ class A,C,I changed
53
+ class K_Footer unchanged
54
+
55
+ %% --- Link Styles ---
56
+ %% MainContent Branch (Blue)
57
+ linkStyle 2,6,7,8 stroke:#64b5f6,stroke-width:2px
58
+ %% Composer Branch (Green)
59
+ linkStyle 3,9,10 stroke:#81c784,stroke-width:2px
60
+ %% DialogManager Branch (Orange)
61
+ linkStyle 4,11 stroke:#ffb74d,stroke-width:2px
62
+ %% Notifications Branch (Violet)
63
+ linkStyle 5 stroke:#ba68c8,stroke-width:2px
64
+
@@ -0,0 +1,62 @@
1
+ # Package overview
2
+
3
+ This monorepo contains two main packages: `@google/gemini-cli` and
4
+ `@google/gemini-cli-core`.
5
+
6
+ ## `@google/gemini-cli`
7
+
8
+ This is the main package for the Gemini CLI. It is responsible for the user
9
+ interface, command parsing, and all other user-facing functionality.
10
+
11
+ When this package is published, it is bundled into a single executable file.
12
+ This bundle includes all of the package's dependencies, including
13
+ `@google/gemini-cli-core`. This means that whether a user installs the package
14
+ with `npm install -g @google/gemini-cli` or runs it directly with
15
+ `npx @google/gemini-cli`, they are using this single, self-contained executable.
16
+
17
+ ## `@google/gemini-cli-core`
18
+
19
+ This package contains the core logic for interacting with the Gemini API. It is
20
+ responsible for making API requests, handling authentication, and managing the
21
+ local cache.
22
+
23
+ This package is not bundled. When it is published, it is published as a standard
24
+ Node.js package with its own dependencies. This allows it to be used as a
25
+ standalone package in other projects, if needed. All transpiled js code in the
26
+ `dist` folder is included in the package.
27
+
28
+ ## NPM workspaces
29
+
30
+ This project uses
31
+ [NPM Workspaces](https://docs.npmjs.com/cli/v10/using-npm/workspaces) to manage
32
+ the packages within this monorepo. This simplifies development by allowing us to
33
+ manage dependencies and run scripts across multiple packages from the root of
34
+ the project.
35
+
36
+ ### How it works
37
+
38
+ The root `package.json` file defines the workspaces for this project:
39
+
40
+ ```json
41
+ {
42
+ "workspaces": ["packages/*"]
43
+ }
44
+ ```
45
+
46
+ This tells NPM that any folder inside the `packages` directory is a separate
47
+ package that should be managed as part of the workspace.
48
+
49
+ ### Benefits of workspaces
50
+
51
+ - **Simplified dependency management**: Running `npm install` from the root of
52
+ the project will install all dependencies for all packages in the workspace
53
+ and link them together. This means you don't need to run `npm install` in each
54
+ package's directory.
55
+ - **Automatic linking**: Packages within the workspace can depend on each other.
56
+ When you run `npm install`, NPM will automatically create symlinks between the
57
+ packages. This means that when you make changes to one package, the changes
58
+ are immediately available to other packages that depend on it.
59
+ - **Simplified script execution**: You can run scripts in any package from the
60
+ root of the project using the `--workspace` flag. For example, to run the
61
+ `build` script in the `cli` package, you can run
62
+ `npm run build --workspace @google/gemini-cli`.