@wxp212/gemini-cli 0.28.3-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +393 -0
  3. package/bundle/builtin/skill-creator/SKILL.md +382 -0
  4. package/bundle/builtin/skill-creator/scripts/init_skill.cjs +235 -0
  5. package/bundle/builtin/skill-creator/scripts/package_skill.cjs +102 -0
  6. package/bundle/builtin/skill-creator/scripts/validate_skill.cjs +127 -0
  7. package/bundle/docs/architecture.md +80 -0
  8. package/bundle/docs/assets/connected_devtools.png +0 -0
  9. package/bundle/docs/assets/gemini-screenshot.png +0 -0
  10. package/bundle/docs/assets/monitoring-dashboard-logs.png +0 -0
  11. package/bundle/docs/assets/monitoring-dashboard-metrics.png +0 -0
  12. package/bundle/docs/assets/monitoring-dashboard-overview.png +0 -0
  13. package/bundle/docs/assets/release_patch.png +0 -0
  14. package/bundle/docs/assets/theme-ansi-light.png +0 -0
  15. package/bundle/docs/assets/theme-ansi.png +0 -0
  16. package/bundle/docs/assets/theme-atom-one.png +0 -0
  17. package/bundle/docs/assets/theme-ayu-light.png +0 -0
  18. package/bundle/docs/assets/theme-ayu.png +0 -0
  19. package/bundle/docs/assets/theme-custom.png +0 -0
  20. package/bundle/docs/assets/theme-default-light.png +0 -0
  21. package/bundle/docs/assets/theme-default.png +0 -0
  22. package/bundle/docs/assets/theme-dracula.png +0 -0
  23. package/bundle/docs/assets/theme-github-light.png +0 -0
  24. package/bundle/docs/assets/theme-github.png +0 -0
  25. package/bundle/docs/assets/theme-google-light.png +0 -0
  26. package/bundle/docs/assets/theme-xcode-light.png +0 -0
  27. package/bundle/docs/changelogs/index.md +743 -0
  28. package/bundle/docs/changelogs/latest.md +338 -0
  29. package/bundle/docs/changelogs/preview.md +437 -0
  30. package/bundle/docs/cli/authentication.md +3 -0
  31. package/bundle/docs/cli/checkpointing.md +94 -0
  32. package/bundle/docs/cli/cli-reference.md +101 -0
  33. package/bundle/docs/cli/commands.md +430 -0
  34. package/bundle/docs/cli/creating-skills.md +80 -0
  35. package/bundle/docs/cli/custom-commands.md +315 -0
  36. package/bundle/docs/cli/enterprise.md +582 -0
  37. package/bundle/docs/cli/gemini-ignore.md +71 -0
  38. package/bundle/docs/cli/gemini-md.md +108 -0
  39. package/bundle/docs/cli/generation-settings.md +210 -0
  40. package/bundle/docs/cli/headless.md +388 -0
  41. package/bundle/docs/cli/index.md +65 -0
  42. package/bundle/docs/cli/keyboard-shortcuts.md +141 -0
  43. package/bundle/docs/cli/model-routing.md +42 -0
  44. package/bundle/docs/cli/model.md +62 -0
  45. package/bundle/docs/cli/rewind.md +51 -0
  46. package/bundle/docs/cli/sandbox.md +171 -0
  47. package/bundle/docs/cli/session-management.md +158 -0
  48. package/bundle/docs/cli/settings.md +141 -0
  49. package/bundle/docs/cli/skills.md +112 -0
  50. package/bundle/docs/cli/system-prompt.md +125 -0
  51. package/bundle/docs/cli/telemetry.md +826 -0
  52. package/bundle/docs/cli/themes.md +235 -0
  53. package/bundle/docs/cli/token-caching.md +20 -0
  54. package/bundle/docs/cli/trusted-folders.md +95 -0
  55. package/bundle/docs/cli/tutorials/skills-getting-started.md +97 -0
  56. package/bundle/docs/cli/tutorials.md +87 -0
  57. package/bundle/docs/cli/uninstall.md +65 -0
  58. package/bundle/docs/core/index.md +107 -0
  59. package/bundle/docs/core/memport.md +246 -0
  60. package/bundle/docs/core/policy-engine.md +305 -0
  61. package/bundle/docs/core/remote-agents.md +84 -0
  62. package/bundle/docs/core/subagents.md +191 -0
  63. package/bundle/docs/core/tools-api.md +131 -0
  64. package/bundle/docs/examples/proxy-script.md +83 -0
  65. package/bundle/docs/extensions/best-practices.md +139 -0
  66. package/bundle/docs/extensions/index.md +45 -0
  67. package/bundle/docs/extensions/reference.md +336 -0
  68. package/bundle/docs/extensions/releasing.md +183 -0
  69. package/bundle/docs/extensions/writing-extensions.md +281 -0
  70. package/bundle/docs/faq.md +154 -0
  71. package/bundle/docs/get-started/authentication.md +321 -0
  72. package/bundle/docs/get-started/configuration-v1.md +880 -0
  73. package/bundle/docs/get-started/configuration.md +1602 -0
  74. package/bundle/docs/get-started/examples.md +219 -0
  75. package/bundle/docs/get-started/gemini-3.md +101 -0
  76. package/bundle/docs/get-started/index.md +71 -0
  77. package/bundle/docs/get-started/installation.md +141 -0
  78. package/bundle/docs/hooks/best-practices.md +677 -0
  79. package/bundle/docs/hooks/index.md +164 -0
  80. package/bundle/docs/hooks/reference.md +322 -0
  81. package/bundle/docs/hooks/writing-hooks.md +450 -0
  82. package/bundle/docs/ide-integration/ide-companion-spec.md +267 -0
  83. package/bundle/docs/ide-integration/index.md +202 -0
  84. package/bundle/docs/index.md +123 -0
  85. package/bundle/docs/integration-tests.md +211 -0
  86. package/bundle/docs/issue-and-pr-automation.md +134 -0
  87. package/bundle/docs/local-development.md +128 -0
  88. package/bundle/docs/mermaid/context.mmd +103 -0
  89. package/bundle/docs/mermaid/render-path.mmd +64 -0
  90. package/bundle/docs/npm.md +62 -0
  91. package/bundle/docs/quota-and-pricing.md +158 -0
  92. package/bundle/docs/release-confidence.md +164 -0
  93. package/bundle/docs/releases.md +540 -0
  94. package/bundle/docs/sidebar.json +152 -0
  95. package/bundle/docs/tools/file-system.md +216 -0
  96. package/bundle/docs/tools/index.md +98 -0
  97. package/bundle/docs/tools/mcp-server.md +1068 -0
  98. package/bundle/docs/tools/memory.md +54 -0
  99. package/bundle/docs/tools/shell.md +260 -0
  100. package/bundle/docs/tools/todos.md +57 -0
  101. package/bundle/docs/tools/web-fetch.md +59 -0
  102. package/bundle/docs/tools/web-search.md +42 -0
  103. package/bundle/docs/tos-privacy.md +96 -0
  104. package/bundle/docs/troubleshooting.md +173 -0
  105. package/bundle/gemini.js +538280 -0
  106. package/bundle/policies/discovered.toml +8 -0
  107. package/bundle/policies/plan.toml +86 -0
  108. package/bundle/policies/read-only.toml +51 -0
  109. package/bundle/policies/write.toml +78 -0
  110. package/bundle/policies/yolo.toml +32 -0
  111. package/bundle/sandbox-macos-permissive-closed.sb +32 -0
  112. package/bundle/sandbox-macos-permissive-open.sb +27 -0
  113. package/bundle/sandbox-macos-permissive-proxied.sb +37 -0
  114. package/bundle/sandbox-macos-restrictive-closed.sb +93 -0
  115. package/bundle/sandbox-macos-restrictive-open.sb +96 -0
  116. package/bundle/sandbox-macos-restrictive-proxied.sb +98 -0
  117. package/package.json +154 -0
@@ -0,0 +1,202 @@
1
+ # IDE integration
2
+
3
+ Gemini CLI can integrate with your IDE to provide a more seamless and
4
+ context-aware experience. This integration allows the CLI to understand your
5
+ workspace better and enables powerful features like native in-editor diffing.
6
+
7
+ Currently, the supported IDEs are [Antigravity](https://antigravity.google),
8
+ [Visual Studio Code](https://code.visualstudio.com/), and other editors that
9
+ support VS Code extensions. To build support for other editors, see the
10
+ [IDE Companion Extension Spec](./ide-companion-spec.md).
11
+
12
+ ## Features
13
+
14
+ - **Workspace context:** The CLI automatically gains awareness of your workspace
15
+ to provide more relevant and accurate responses. This context includes:
16
+ - The **10 most recently accessed files** in your workspace.
17
+ - Your active cursor position.
18
+ - Any text you have selected (up to a 16KB limit; longer selections will be
19
+ truncated).
20
+
21
+ - **Native diffing:** When Gemini suggests code modifications, you can view the
22
+ changes directly within your IDE's native diff viewer. This allows you to
23
+ review, edit, and accept or reject the suggested changes seamlessly.
24
+
25
+ - **VS Code commands:** You can access Gemini CLI features directly from the VS
26
+ Code Command Palette (`Cmd+Shift+P` or `Ctrl+Shift+P`):
27
+ - `Gemini CLI: Run`: Starts a new Gemini CLI session in the integrated
28
+ terminal.
29
+ - `Gemini CLI: Accept Diff`: Accepts the changes in the active diff editor.
30
+ - `Gemini CLI: Close Diff Editor`: Rejects the changes and closes the active
31
+ diff editor.
32
+ - `Gemini CLI: View Third-Party Notices`: Displays the third-party notices for
33
+ the extension.
34
+
35
+ ## Installation and setup
36
+
37
+ There are three ways to set up the IDE integration:
38
+
39
+ ### 1. Automatic nudge (recommended)
40
+
41
+ When you run Gemini CLI inside a supported editor, it will automatically detect
42
+ your environment and prompt you to connect. Answering "Yes" will automatically
43
+ run the necessary setup, which includes installing the companion extension and
44
+ enabling the connection.
45
+
46
+ ### 2. Manual installation from CLI
47
+
48
+ If you previously dismissed the prompt or want to install the extension
49
+ manually, you can run the following command inside Gemini CLI:
50
+
51
+ ```
52
+ /ide install
53
+ ```
54
+
55
+ This will find the correct extension for your IDE and install it.
56
+
57
+ ### 3. Manual installation from a marketplace
58
+
59
+ You can also install the extension directly from a marketplace.
60
+
61
+ - **For Visual Studio Code:** Install from the
62
+ [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=google.gemini-cli-vscode-ide-companion).
63
+ - **For VS Code forks:** To support forks of VS Code, the extension is also
64
+ published on the
65
+ [Open VSX Registry](https://open-vsx.org/extension/google/gemini-cli-vscode-ide-companion).
66
+ Follow your editor's instructions for installing extensions from this
67
+ registry.
68
+
69
+ > NOTE: The "Gemini CLI Companion" extension may appear towards the bottom of
70
+ > search results. If you don't see it immediately, try scrolling down or sorting
71
+ > by "Newly Published".
72
+ >
73
+ > After manually installing the extension, you must run `/ide enable` in the CLI
74
+ > to activate the integration.
75
+
76
+ ## Usage
77
+
78
+ ### Enabling and disabling
79
+
80
+ You can control the IDE integration from within the CLI:
81
+
82
+ - To enable the connection to the IDE, run:
83
+ ```
84
+ /ide enable
85
+ ```
86
+ - To disable the connection, run:
87
+ ```
88
+ /ide disable
89
+ ```
90
+
91
+ When enabled, Gemini CLI will automatically attempt to connect to the IDE
92
+ companion extension.
93
+
94
+ ### Checking the status
95
+
96
+ To check the connection status and see the context the CLI has received from the
97
+ IDE, run:
98
+
99
+ ```
100
+ /ide status
101
+ ```
102
+
103
+ If connected, this command will show the IDE it's connected to and a list of
104
+ recently opened files it is aware of.
105
+
106
+ > [!NOTE] The file list is limited to 10 recently accessed files within your
107
+ > workspace and only includes local files on disk.)
108
+
109
+ ### Working with diffs
110
+
111
+ When you ask Gemini to modify a file, it can open a diff view directly in your
112
+ editor.
113
+
114
+ **To accept a diff**, you can perform any of the following actions:
115
+
116
+ - Click the **checkmark icon** in the diff editor's title bar.
117
+ - Save the file (e.g., with `Cmd+S` or `Ctrl+S`).
118
+ - Open the Command Palette and run **Gemini CLI: Accept Diff**.
119
+ - Respond with `yes` in the CLI when prompted.
120
+
121
+ **To reject a diff**, you can:
122
+
123
+ - Click the **'x' icon** in the diff editor's title bar.
124
+ - Close the diff editor tab.
125
+ - Open the Command Palette and run **Gemini CLI: Close Diff Editor**.
126
+ - Respond with `no` in the CLI when prompted.
127
+
128
+ You can also **modify the suggested changes** directly in the diff view before
129
+ accepting them.
130
+
131
+ If you select ‘Allow for this session’ in the CLI, changes will no longer show
132
+ up in the IDE as they will be auto-accepted.
133
+
134
+ ## Using with sandboxing
135
+
136
+ If you are using Gemini CLI within a sandbox, please be aware of the following:
137
+
138
+ - **On macOS:** The IDE integration requires network access to communicate with
139
+ the IDE companion extension. You must use a Seatbelt profile that allows
140
+ network access.
141
+ - **In a Docker container:** If you run Gemini CLI inside a Docker (or Podman)
142
+ container, the IDE integration can still connect to the VS Code extension
143
+ running on your host machine. The CLI is configured to automatically find the
144
+ IDE server on `host.docker.internal`. No special configuration is usually
145
+ required, but you may need to ensure your Docker networking setup allows
146
+ connections from the container to the host.
147
+
148
+ ## Troubleshooting
149
+
150
+ If you encounter issues with IDE integration, here are some common error
151
+ messages and how to resolve them.
152
+
153
+ ### Connection errors
154
+
155
+ - **Message:**
156
+ `🔴 Disconnected: Failed to connect to IDE companion extension in [IDE Name]. Please ensure the extension is running. To install the extension, run /ide install.`
157
+ - **Cause:** Gemini CLI could not find the necessary environment variables
158
+ (`GEMINI_CLI_IDE_WORKSPACE_PATH` or `GEMINI_CLI_IDE_SERVER_PORT`) to connect
159
+ to the IDE. This usually means the IDE companion extension is not running or
160
+ did not initialize correctly.
161
+ - **Solution:**
162
+ 1. Make sure you have installed the **Gemini CLI Companion** extension in
163
+ your IDE and that it is enabled.
164
+ 2. Open a new terminal window in your IDE to ensure it picks up the correct
165
+ environment.
166
+
167
+ - **Message:**
168
+ `🔴 Disconnected: IDE connection error. The connection was lost unexpectedly. Please try reconnecting by running /ide enable`
169
+ - **Cause:** The connection to the IDE companion was lost.
170
+ - **Solution:** Run `/ide enable` to try and reconnect. If the issue
171
+ continues, open a new terminal window or restart your IDE.
172
+
173
+ ### Configuration errors
174
+
175
+ - **Message:**
176
+ `🔴 Disconnected: Directory mismatch. Gemini CLI is running in a different location than the open workspace in [IDE Name]. Please run the CLI from one of the following directories: [List of directories]`
177
+ - **Cause:** The CLI's current working directory is outside the workspace you
178
+ have open in your IDE.
179
+ - **Solution:** `cd` into the same directory that is open in your IDE and
180
+ restart the CLI.
181
+
182
+ - **Message:**
183
+ `🔴 Disconnected: To use this feature, please open a workspace folder in [IDE Name] and try again.`
184
+ - **Cause:** You have no workspace open in your IDE.
185
+ - **Solution:** Open a workspace in your IDE and restart the CLI.
186
+
187
+ ### General errors
188
+
189
+ - **Message:**
190
+ `IDE integration is not supported in your current environment. To use this feature, run Gemini CLI in one of these supported IDEs: [List of IDEs]`
191
+ - **Cause:** You are running Gemini CLI in a terminal or environment that is
192
+ not a supported IDE.
193
+ - **Solution:** Run Gemini CLI from the integrated terminal of a supported
194
+ IDE, like Antigravity or VS Code.
195
+
196
+ - **Message:**
197
+ `No installer is available for IDE. Please install the Gemini CLI Companion extension manually from the marketplace.`
198
+ - **Cause:** You ran `/ide install`, but the CLI does not have an automated
199
+ installer for your specific IDE.
200
+ - **Solution:** Open your IDE's extension marketplace, search for "Gemini CLI
201
+ Companion", and
202
+ [install it manually](#3-manual-installation-from-a-marketplace).
@@ -0,0 +1,123 @@
1
+ # Gemini CLI documentation
2
+
3
+ Gemini CLI is an open-source AI agent that brings the power of Gemini directly
4
+ into your terminal. It is designed to be a terminal-first, extensible, and
5
+ powerful tool for developers, engineers, SREs, and beyond.
6
+
7
+ Gemini CLI integrates with your local environment. It can read and edit files,
8
+ execute shell commands, and search the web, all while maintaining your project
9
+ context.
10
+
11
+ ## Get started
12
+
13
+ Begin your journey with Gemini CLI by setting up your environment and learning
14
+ the basics.
15
+
16
+ - **[Quickstart](./get-started/index.md):** A streamlined guide to get you
17
+ chatting in minutes.
18
+ - **[Installation](./get-started/installation.md):** Instructions for macOS,
19
+ Linux, and Windows.
20
+ - **[Authentication](./get-started/authentication.md):** Set up access using
21
+ Google OAuth, API keys, or Vertex AI.
22
+ - **[Examples](./get-started/examples.md):** View common usage scenarios to
23
+ inspire your own workflows.
24
+
25
+ ## Use Gemini CLI
26
+
27
+ Master the core capabilities that let Gemini CLI interact with your system
28
+ safely and effectively.
29
+
30
+ - **[Using the CLI](./cli/index.md):** Learn the basics of the command-line
31
+ interface.
32
+ - **[File management](./tools/file-system.md):** Grant the model the ability to
33
+ read code and apply changes directly to your files.
34
+ - **[Shell commands](./tools/shell.md):** Allow the model to run builds, tests,
35
+ and git commands.
36
+ - **[Memory management](./tools/memory.md):** Teach Gemini CLI facts about your
37
+ project and preferences that persist across sessions.
38
+ - **[Project context](./cli/gemini-md.md):** Use `GEMINI.md` files to provide
39
+ persistent context for your projects.
40
+ - **[Web search and fetch](./tools/web-search.md):** Enable the model to fetch
41
+ real-time information from the internet.
42
+ - **[Session management](./cli/session-management.md):** Save, resume, and
43
+ organize your chat sessions.
44
+
45
+ ## Configuration
46
+
47
+ Customize Gemini CLI to match your workflow and preferences.
48
+
49
+ - **[Settings](./cli/settings.md):** Control response creativity, output
50
+ verbosity, and more.
51
+ - **[Model selection](./cli/model.md):** Choose the best Gemini model for your
52
+ specific task.
53
+ - **[Ignore files](./cli/gemini-ignore.md):** Use `.geminiignore` to keep
54
+ sensitive files out of the model's context.
55
+ - **[Trusted folders](./cli/trusted-folders.md):** Define security boundaries
56
+ for file access and execution.
57
+ - **[Token caching](./cli/token-caching.md):** Optimize performance and cost by
58
+ caching context.
59
+ - **[Themes](./cli/themes.md):** Personalize the visual appearance of the CLI.
60
+
61
+ ## Advanced features
62
+
63
+ Explore powerful features for complex workflows and enterprise environments.
64
+
65
+ - **[Headless mode](./cli/headless.md):** Run Gemini CLI in scripts or CI/CD
66
+ pipelines for automated reasoning.
67
+ - **[Sandboxing](./cli/sandbox.md):** Execute untrusted code or tools in a
68
+ secure, isolated container.
69
+ - **[Checkpointing](./cli/checkpointing.md):** Save and restore workspace state
70
+ to recover from experimental changes.
71
+ - **[Custom commands](./cli/custom-commands.md):** Create shortcuts for
72
+ frequently used prompts.
73
+ - **[System prompt override](./cli/system-prompt.md):** Customize the core
74
+ instructions given to the model.
75
+ - **[Telemetry](./cli/telemetry.md):** Understand how usage data is collected
76
+ and managed.
77
+ - **[Enterprise](./cli/enterprise.md):** Manage configurations and policies for
78
+ large teams.
79
+
80
+ ## Extensions
81
+
82
+ Extend Gemini CLI's capabilities with new tools and behaviors using extensions.
83
+
84
+ - **[Introduction](./extensions/index.md):** Learn about the extension system
85
+ and how to manage extensions.
86
+ - **[Writing extensions](./extensions/writing-extensions.md):** Learn how to
87
+ create your first extension.
88
+ - **[Extensions reference](./extensions/reference.md):** Deeply understand the
89
+ extension format, commands, and configuration.
90
+ - **[Best practices](./extensions/best-practices.md):** Learn strategies for
91
+ building great extensions.
92
+ - **[Extensions releasing](./extensions/releasing.md):** Learn how to share your
93
+ extensions with the world.
94
+
95
+ ## Ecosystem and extensibility
96
+
97
+ Connect Gemini CLI to external services and other development tools.
98
+
99
+ - **[MCP servers](./tools/mcp-server.md):** Connect to external services using
100
+ the Model Context Protocol.
101
+ - **[IDE integration](./ide-integration/index.md):** Use Gemini CLI alongside VS
102
+ Code.
103
+ - **[Hooks](./hooks/index.md):** (Preview) Write scripts that run on specific
104
+ CLI events.
105
+ - **[Agent skills](./cli/skills.md):** (Preview) Add specialized expertise and
106
+ workflows.
107
+ - **[Sub-agents](./core/subagents.md):** (Preview) Delegate tasks to specialized
108
+ agents.
109
+
110
+ ## Development and reference
111
+
112
+ Deep dive into the architecture and contribute to the project.
113
+
114
+ - **[Architecture](./architecture.md):** Understand the technical design of
115
+ Gemini CLI.
116
+ - **[Command reference](./cli/commands.md):** A complete list of available
117
+ commands.
118
+ - **[Local development](./local-development.md):** Set up your environment to
119
+ contribute to Gemini CLI.
120
+ - **[Contributing](../CONTRIBUTING.md):** Learn how to submit pull requests and
121
+ report issues.
122
+ - **[FAQ](./faq.md):** Answers to common questions.
123
+ - **[Troubleshooting](./troubleshooting.md):** Solutions for common issues.
@@ -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!