@dgxo/mashadevcli 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) 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 +239 -0
  5. package/bundle/builtin/skill-creator/scripts/package_skill.cjs +131 -0
  6. package/bundle/builtin/skill-creator/scripts/validate_skill.cjs +131 -0
  7. package/bundle/docs/CONTRIBUTING.md +1 -0
  8. package/bundle/docs/admin/enterprise-controls.md +115 -0
  9. package/bundle/docs/assets/connected_devtools.png +0 -0
  10. package/bundle/docs/assets/gemini-screenshot.png +0 -0
  11. package/bundle/docs/assets/monitoring-dashboard-logs.png +0 -0
  12. package/bundle/docs/assets/monitoring-dashboard-metrics.png +0 -0
  13. package/bundle/docs/assets/monitoring-dashboard-overview.png +0 -0
  14. package/bundle/docs/assets/release_patch.png +0 -0
  15. package/bundle/docs/assets/theme-ansi-light.png +0 -0
  16. package/bundle/docs/assets/theme-ansi.png +0 -0
  17. package/bundle/docs/assets/theme-atom-one.png +0 -0
  18. package/bundle/docs/assets/theme-ayu-light.png +0 -0
  19. package/bundle/docs/assets/theme-ayu.png +0 -0
  20. package/bundle/docs/assets/theme-custom.png +0 -0
  21. package/bundle/docs/assets/theme-default-light.png +0 -0
  22. package/bundle/docs/assets/theme-default.png +0 -0
  23. package/bundle/docs/assets/theme-dracula.png +0 -0
  24. package/bundle/docs/assets/theme-github-light.png +0 -0
  25. package/bundle/docs/assets/theme-github.png +0 -0
  26. package/bundle/docs/assets/theme-google-light.png +0 -0
  27. package/bundle/docs/assets/theme-xcode-light.png +0 -0
  28. package/bundle/docs/changelogs/index.md +867 -0
  29. package/bundle/docs/changelogs/latest.md +208 -0
  30. package/bundle/docs/changelogs/preview.md +187 -0
  31. package/bundle/docs/cli/checkpointing.md +93 -0
  32. package/bundle/docs/cli/cli-reference.md +115 -0
  33. package/bundle/docs/cli/creating-skills.md +80 -0
  34. package/bundle/docs/cli/custom-commands.md +327 -0
  35. package/bundle/docs/cli/enterprise.md +604 -0
  36. package/bundle/docs/cli/gemini-ignore.md +71 -0
  37. package/bundle/docs/cli/gemini-md.md +116 -0
  38. package/bundle/docs/cli/generation-settings.md +210 -0
  39. package/bundle/docs/cli/headless.md +50 -0
  40. package/bundle/docs/cli/model-routing.md +42 -0
  41. package/bundle/docs/cli/model.md +53 -0
  42. package/bundle/docs/cli/plan-mode.md +375 -0
  43. package/bundle/docs/cli/rewind.md +51 -0
  44. package/bundle/docs/cli/sandbox.md +257 -0
  45. package/bundle/docs/cli/session-management.md +184 -0
  46. package/bundle/docs/cli/settings.md +165 -0
  47. package/bundle/docs/cli/skills.md +134 -0
  48. package/bundle/docs/cli/system-prompt.md +125 -0
  49. package/bundle/docs/cli/telemetry.md +922 -0
  50. package/bundle/docs/cli/themes.md +269 -0
  51. package/bundle/docs/cli/token-caching.md +20 -0
  52. package/bundle/docs/cli/trusted-folders.md +126 -0
  53. package/bundle/docs/cli/tutorials/automation.md +283 -0
  54. package/bundle/docs/cli/tutorials/file-management.md +142 -0
  55. package/bundle/docs/cli/tutorials/mcp-setup.md +113 -0
  56. package/bundle/docs/cli/tutorials/memory-management.md +126 -0
  57. package/bundle/docs/cli/tutorials/session-management.md +105 -0
  58. package/bundle/docs/cli/tutorials/shell-commands.md +107 -0
  59. package/bundle/docs/cli/tutorials/skills-getting-started.md +110 -0
  60. package/bundle/docs/cli/tutorials/task-planning.md +93 -0
  61. package/bundle/docs/cli/tutorials/web-tools.md +78 -0
  62. package/bundle/docs/core/index.md +107 -0
  63. package/bundle/docs/core/remote-agents.md +84 -0
  64. package/bundle/docs/core/subagents.md +307 -0
  65. package/bundle/docs/examples/proxy-script.md +83 -0
  66. package/bundle/docs/extensions/best-practices.md +188 -0
  67. package/bundle/docs/extensions/index.md +61 -0
  68. package/bundle/docs/extensions/reference.md +333 -0
  69. package/bundle/docs/extensions/releasing.md +154 -0
  70. package/bundle/docs/extensions/writing-extensions.md +308 -0
  71. package/bundle/docs/get-started/authentication.md +402 -0
  72. package/bundle/docs/get-started/examples.md +139 -0
  73. package/bundle/docs/get-started/gemini-3.md +115 -0
  74. package/bundle/docs/get-started/index.md +82 -0
  75. package/bundle/docs/get-started/installation.md +174 -0
  76. package/bundle/docs/hooks/best-practices.md +709 -0
  77. package/bundle/docs/hooks/index.md +164 -0
  78. package/bundle/docs/hooks/reference.md +330 -0
  79. package/bundle/docs/hooks/writing-hooks.md +474 -0
  80. package/bundle/docs/ide-integration/ide-companion-spec.md +267 -0
  81. package/bundle/docs/ide-integration/index.md +224 -0
  82. package/bundle/docs/index.md +141 -0
  83. package/bundle/docs/integration-tests.md +211 -0
  84. package/bundle/docs/issue-and-pr-automation.md +172 -0
  85. package/bundle/docs/local-development.md +134 -0
  86. package/bundle/docs/mermaid/context.mmd +103 -0
  87. package/bundle/docs/mermaid/render-path.mmd +64 -0
  88. package/bundle/docs/npm.md +62 -0
  89. package/bundle/docs/redirects.json +20 -0
  90. package/bundle/docs/reference/commands.md +526 -0
  91. package/bundle/docs/reference/configuration.md +1786 -0
  92. package/bundle/docs/reference/keyboard-shortcuts.md +164 -0
  93. package/bundle/docs/reference/memport.md +246 -0
  94. package/bundle/docs/reference/policy-engine.md +364 -0
  95. package/bundle/docs/reference/tools.md +106 -0
  96. package/bundle/docs/release-confidence.md +164 -0
  97. package/bundle/docs/releases.md +540 -0
  98. package/bundle/docs/resources/faq.md +175 -0
  99. package/bundle/docs/resources/quota-and-pricing.md +165 -0
  100. package/bundle/docs/resources/tos-privacy.md +102 -0
  101. package/bundle/docs/resources/troubleshooting.md +176 -0
  102. package/bundle/docs/resources/uninstall.md +56 -0
  103. package/bundle/docs/sidebar.json +233 -0
  104. package/bundle/docs/tools/activate-skill.md +43 -0
  105. package/bundle/docs/tools/ask-user.md +95 -0
  106. package/bundle/docs/tools/file-system.md +129 -0
  107. package/bundle/docs/tools/internal-docs.md +46 -0
  108. package/bundle/docs/tools/mcp-server.md +1150 -0
  109. package/bundle/docs/tools/memory.md +35 -0
  110. package/bundle/docs/tools/planning.md +58 -0
  111. package/bundle/docs/tools/shell.md +216 -0
  112. package/bundle/docs/tools/todos.md +35 -0
  113. package/bundle/docs/tools/web-fetch.md +35 -0
  114. package/bundle/docs/tools/web-search.md +32 -0
  115. package/bundle/docs/update/update-guide.md +111 -0
  116. package/bundle/masha.js +563471 -0
  117. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/client/main.js +89 -0
  118. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.d.ts +7 -0
  119. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js +9 -0
  120. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js.map +1 -0
  121. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.d.ts +48 -0
  122. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js +299 -0
  123. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js.map +1 -0
  124. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.d.ts +36 -0
  125. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js +7 -0
  126. package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js.map +1 -0
  127. package/bundle/node_modules/@dgxo/mashadevcli-devtools/package.json +32 -0
  128. package/bundle/policies/conseca.toml +6 -0
  129. package/bundle/policies/discovered.toml +8 -0
  130. package/bundle/policies/plan.toml +109 -0
  131. package/bundle/policies/read-only.toml +53 -0
  132. package/bundle/policies/write.toml +80 -0
  133. package/bundle/policies/yolo.toml +54 -0
  134. package/bundle/sandbox-macos-permissive-open.sb +27 -0
  135. package/bundle/sandbox-macos-permissive-proxied.sb +37 -0
  136. package/bundle/sandbox-macos-restrictive-open.sb +96 -0
  137. package/bundle/sandbox-macos-restrictive-proxied.sb +98 -0
  138. package/bundle/sandbox-macos-strict-open.sb +131 -0
  139. package/bundle/sandbox-macos-strict-proxied.sb +133 -0
  140. package/package.json +169 -0
@@ -0,0 +1,83 @@
1
+ # Example proxy script
2
+
3
+ The following is an example of a proxy script that can be used with the
4
+ `GEMINI_SANDBOX_PROXY_COMMAND` environment variable. This script only allows
5
+ `HTTPS` connections to `example.com:443` and declines all other requests.
6
+
7
+ ```javascript
8
+ #!/usr/bin/env node
9
+
10
+ /**
11
+ * @license
12
+ * Copyright 2025 Google LLC
13
+ * SPDX-License-Identifier: Apache-2.0
14
+ */
15
+
16
+ // Example proxy server that listens on :::8877 and only allows HTTPS connections to example.com.
17
+ // Set `GEMINI_SANDBOX_PROXY_COMMAND=scripts/example-proxy.js` to run proxy alongside sandbox
18
+ // Test via `curl https://example.com` inside sandbox (in shell mode or via shell tool)
19
+
20
+ import http from 'node:http';
21
+ import net from 'node:net';
22
+ import { URL } from 'node:url';
23
+ import console from 'node:console';
24
+
25
+ const PROXY_PORT = 8877;
26
+ const ALLOWED_DOMAINS = ['example.com', 'googleapis.com'];
27
+ const ALLOWED_PORT = '443';
28
+
29
+ const server = http.createServer((req, res) => {
30
+ // Deny all requests other than CONNECT for HTTPS
31
+ console.log(
32
+ `[PROXY] Denying non-CONNECT request for: ${req.method} ${req.url}`,
33
+ );
34
+ res.writeHead(405, { 'Content-Type': 'text/plain' });
35
+ res.end('Method Not Allowed');
36
+ });
37
+
38
+ server.on('connect', (req, clientSocket, head) => {
39
+ // req.url will be in the format "hostname:port" for a CONNECT request.
40
+ const { port, hostname } = new URL(`http://${req.url}`);
41
+
42
+ console.log(`[PROXY] Intercepted CONNECT request for: ${hostname}:${port}`);
43
+
44
+ if (
45
+ ALLOWED_DOMAINS.some(
46
+ (domain) => hostname == domain || hostname.endsWith(`.${domain}`),
47
+ ) &&
48
+ port === ALLOWED_PORT
49
+ ) {
50
+ console.log(`[PROXY] Allowing connection to ${hostname}:${port}`);
51
+
52
+ // Establish a TCP connection to the original destination.
53
+ const serverSocket = net.connect(port, hostname, () => {
54
+ clientSocket.write('HTTP/1.1 200 Connection Established\r\n\r\n');
55
+ // Create a tunnel by piping data between the client and the destination server.
56
+ serverSocket.write(head);
57
+ serverSocket.pipe(clientSocket);
58
+ clientSocket.pipe(serverSocket);
59
+ });
60
+
61
+ serverSocket.on('error', (err) => {
62
+ console.error(`[PROXY] Error connecting to destination: ${err.message}`);
63
+ clientSocket.end(`HTTP/1.1 502 Bad Gateway\r\n\r\n`);
64
+ });
65
+ } else {
66
+ console.log(`[PROXY] Denying connection to ${hostname}:${port}`);
67
+ clientSocket.end('HTTP/1.1 403 Forbidden\r\n\r\n');
68
+ }
69
+
70
+ clientSocket.on('error', (err) => {
71
+ // This can happen if the client hangs up.
72
+ console.error(`[PROXY] Client socket error: ${err.message}`);
73
+ });
74
+ });
75
+
76
+ server.listen(PROXY_PORT, () => {
77
+ const address = server.address();
78
+ console.log(`[PROXY] Proxy listening on ${address.address}:${address.port}`);
79
+ console.log(
80
+ `[PROXY] Allowing HTTPS connections to domains: ${ALLOWED_DOMAINS.join(', ')}`,
81
+ );
82
+ });
83
+ ```
@@ -0,0 +1,188 @@
1
+ # Gemini CLI extension best practices
2
+
3
+ This guide covers best practices for developing, securing, and maintaining
4
+ Gemini CLI extensions.
5
+
6
+ ## Development
7
+
8
+ Developing extensions for Gemini CLI is a lightweight, iterative process. Use
9
+ these strategies to build robust and efficient extensions.
10
+
11
+ ### Structure your extension
12
+
13
+ While simple extensions may contain only a few files, we recommend a organized
14
+ structure for complex projects.
15
+
16
+ ```text
17
+ my-extension/
18
+ ├── package.json
19
+ ├── tsconfig.json
20
+ ├── gemini-extension.json
21
+ ├── src/
22
+ │ ├── index.ts
23
+ │ └── tools/
24
+ └── dist/
25
+ ```
26
+
27
+ - **Use TypeScript:** We strongly recommend using TypeScript for type safety and
28
+ improved developer experience.
29
+ - **Separate source and build:** Keep your source code in `src/` and output
30
+ build artifacts to `dist/`.
31
+ - **Bundle dependencies:** If your extension has many dependencies, bundle them
32
+ using a tool like `esbuild` to reduce installation time and avoid conflicts.
33
+
34
+ ### Iterate with `link`
35
+
36
+ Use the `gemini extensions link` command to develop locally without reinstalling
37
+ your extension after every change.
38
+
39
+ ```bash
40
+ cd my-extension
41
+ gemini extensions link .
42
+ ```
43
+
44
+ Changes to your code are immediately available in the CLI after you rebuild the
45
+ project and restart the session.
46
+
47
+ ### Use `GEMINI.md` effectively
48
+
49
+ Your `GEMINI.md` file provides essential context to the model.
50
+
51
+ - **Focus on goals:** Explain the high-level purpose of the extension and how to
52
+ interact with its tools.
53
+ - **Be concise:** Avoid dumping exhaustive documentation into the file. Use
54
+ clear, direct language.
55
+ - **Provide examples:** Include brief examples of how the model should use
56
+ specific tools or commands.
57
+
58
+ ## Security
59
+
60
+ Follow the principle of least privilege and rigorous input validation when
61
+ building extensions.
62
+
63
+ ### Minimal permissions
64
+
65
+ Only request the permissions your MCP server needs to function. Avoid giving the
66
+ model broad access (such as full shell access) if restricted tools are
67
+ sufficient.
68
+
69
+ If your extension uses powerful tools like `run_shell_command`, restrict them in
70
+ your `gemini-extension.json` file:
71
+
72
+ ```json
73
+ {
74
+ "name": "my-safe-extension",
75
+ "excludeTools": ["run_shell_command(rm -rf *)"]
76
+ }
77
+ ```
78
+
79
+ This ensures the CLI blocks dangerous commands even if the model attempts to
80
+ execute them.
81
+
82
+ ### Validate inputs
83
+
84
+ Your MCP server runs on the user's machine. Always validate tool inputs to
85
+ prevent arbitrary code execution or unauthorized filesystem access.
86
+
87
+ ```typescript
88
+ // Example: Validating paths
89
+ if (!path.resolve(inputPath).startsWith(path.resolve(allowedDir) + path.sep)) {
90
+ throw new Error('Access denied');
91
+ }
92
+ ```
93
+
94
+ ### Secure sensitive settings
95
+
96
+ If your extension requires API keys or other secrets, use the `sensitive: true`
97
+ option in your manifest. This ensures keys are stored in the system keychain and
98
+ obfuscated in the CLI output.
99
+
100
+ ```json
101
+ "settings": [
102
+ {
103
+ "name": "API Key",
104
+ "envVar": "MY_API_KEY",
105
+ "sensitive": true
106
+ }
107
+ ]
108
+ ```
109
+
110
+ ## Release
111
+
112
+ Follow standard versioning and release practices to ensure a smooth experience
113
+ for your users.
114
+
115
+ ### Semantic versioning
116
+
117
+ Follow [Semantic Versioning (SemVer)](https://semver.org/) to communicate
118
+ changes clearly.
119
+
120
+ - **Major:** Breaking changes (e.g., renaming tools or changing arguments).
121
+ - **Minor:** New features (e.g., adding new tools or commands).
122
+ - **Patch:** Bug fixes and performance improvements.
123
+
124
+ ### Release channels
125
+
126
+ Use Git branches to manage release channels. This lets users choose between
127
+ stability and the latest features.
128
+
129
+ ```bash
130
+ # Install the stable version (default branch)
131
+ gemini extensions install github.com/user/repo
132
+
133
+ # Install the development version
134
+ gemini extensions install github.com/user/repo --ref dev
135
+ ```
136
+
137
+ ### Clean artifacts
138
+
139
+ When using GitHub Releases, ensure your archives only contain necessary files
140
+ (such as `dist/`, `gemini-extension.json`, and `package.json`). Exclude
141
+ `node_modules/` and `src/` to minimize download size.
142
+
143
+ ## Test and verify
144
+
145
+ Test your extension thoroughly before releasing it to users.
146
+
147
+ - **Manual verification:** Use `gemini extensions link` to test your extension
148
+ in a live CLI session. Verify that tools appear in the debug console (F12) and
149
+ that custom commands resolve correctly.
150
+ - **Automated testing:** If your extension includes an MCP server, write unit
151
+ tests for your tool logic using a framework like Vitest or Jest. You can test
152
+ MCP tools in isolation by mocking the transport layer.
153
+
154
+ ## Troubleshooting
155
+
156
+ Use these tips to diagnose and fix common extension issues.
157
+
158
+ ### Extension not loading
159
+
160
+ If your extension doesn't appear in `/extensions list`:
161
+
162
+ - **Check the manifest:** Ensure `gemini-extension.json` is in the root
163
+ directory and contains valid JSON.
164
+ - **Verify the name:** The `name` field in the manifest must match the extension
165
+ directory name exactly.
166
+ - **Restart the CLI:** Extensions are loaded at the start of a session. Restart
167
+ Gemini CLI after making changes to the manifest or linking a new extension.
168
+
169
+ ### MCP server failures
170
+
171
+ If your tools aren't working as expected:
172
+
173
+ - **Check the logs:** View the CLI logs to see if the MCP server failed to
174
+ start.
175
+ - **Test the command:** Run the server's `command` and `args` directly in your
176
+ terminal to ensure it starts correctly outside of Gemini CLI.
177
+ - **Debug console:** In interactive mode, press **F12** to open the debug
178
+ console and inspect tool calls and responses.
179
+
180
+ ### Command conflicts
181
+
182
+ If a custom command isn't responding:
183
+
184
+ - **Check precedence:** Remember that user and project commands take precedence
185
+ over extension commands. Use the prefixed name (e.g., `/extension.command`) to
186
+ verify the extension's version.
187
+ - **Help command:** Run `/help` to see a list of all available commands and
188
+ their sources.
@@ -0,0 +1,61 @@
1
+ # Gemini CLI extensions
2
+
3
+ Gemini CLI extensions package prompts, MCP servers, custom commands, themes,
4
+ hooks, sub-agents, and agent skills into a familiar and user-friendly format.
5
+ With extensions, you can expand the capabilities of Gemini CLI and share those
6
+ capabilities with others. They are designed to be easily installable and
7
+ shareable.
8
+
9
+ To see what's possible, browse the
10
+ [Gemini CLI extension gallery](https://geminicli.com/extensions/browse/).
11
+
12
+ ## Choose your path
13
+
14
+ Choose the guide that best fits your needs.
15
+
16
+ ### I want to use extensions
17
+
18
+ Learn how to discover, install, and manage extensions to enhance your Gemini CLI
19
+ experience.
20
+
21
+ - **[Manage extensions](#manage-extensions):** List and verify your installed
22
+ extensions.
23
+ - **[Install extensions](#installation):** Add new capabilities from GitHub or
24
+ local paths.
25
+
26
+ ### I want to build extensions
27
+
28
+ Learn how to create, test, and share your own extensions with the community.
29
+
30
+ - **[Build extensions](writing-extensions.md):** Create your first extension
31
+ from a template.
32
+ - **[Best practices](best-practices.md):** Learn how to build secure and
33
+ reliable extensions.
34
+ - **[Publish to the gallery](releasing.md):** Share your work with the world.
35
+
36
+ ## Manage extensions
37
+
38
+ Use the interactive `/extensions` command to verify your installed extensions
39
+ and their status:
40
+
41
+ ```bash
42
+ /extensions list
43
+ ```
44
+
45
+ You can also manage extensions from your terminal using the `gemini extensions`
46
+ command group:
47
+
48
+ ```bash
49
+ gemini extensions list
50
+ ```
51
+
52
+ ## Installation
53
+
54
+ Install an extension by providing its GitHub repository URL. For example:
55
+
56
+ ```bash
57
+ gemini extensions install https://github.com/gemini-cli-extensions/workspace
58
+ ```
59
+
60
+ For more advanced installation options, see the
61
+ [Extension reference](reference.md#install-an-extension).
@@ -0,0 +1,333 @@
1
+ # Extension reference
2
+
3
+ This guide covers the `gemini extensions` commands and the structure of the
4
+ `gemini-extension.json` configuration file.
5
+
6
+ ## Manage extensions
7
+
8
+ Use the `gemini extensions` command group to manage your extensions from the
9
+ terminal.
10
+
11
+ Note that commands like `gemini extensions install` are not supported within the
12
+ CLI's interactive mode. However, you can use the `/extensions list` command to
13
+ view installed extensions. All management operations, including updates to slash
14
+ commands, take effect only after you restart the CLI session.
15
+
16
+ ### Install an extension
17
+
18
+ Install an extension by providing its GitHub repository URL or a local file
19
+ path.
20
+
21
+ Gemini CLI creates a copy of the extension during installation. You must run
22
+ `gemini extensions update` to pull changes from the source. To install from
23
+ GitHub, you must have `git` installed on your machine.
24
+
25
+ ```bash
26
+ gemini extensions install <source> [--ref <ref>] [--auto-update] [--pre-release] [--consent]
27
+ ```
28
+
29
+ - `<source>`: The GitHub URL or local path of the extension.
30
+ - `--ref`: The git ref (branch, tag, or commit) to install.
31
+ - `--auto-update`: Enable automatic updates for this extension.
32
+ - `--pre-release`: Enable installation of pre-release versions.
33
+ - `--consent`: Acknowledge security risks and skip the confirmation prompt.
34
+
35
+ ### Uninstall an extension
36
+
37
+ To uninstall one or more extensions, use the `uninstall` command:
38
+
39
+ ```bash
40
+ gemini extensions uninstall <name...>
41
+ ```
42
+
43
+ ### Disable an extension
44
+
45
+ Extensions are enabled globally by default. You can disable an extension
46
+ entirely or for a specific workspace.
47
+
48
+ ```bash
49
+ gemini extensions disable <name> [--scope <scope>]
50
+ ```
51
+
52
+ - `<name>`: The name of the extension to disable.
53
+ - `--scope`: The scope to disable the extension in (`user` or `workspace`).
54
+
55
+ ### Enable an extension
56
+
57
+ Re-enable a disabled extension using the `enable` command:
58
+
59
+ ```bash
60
+ gemini extensions enable <name> [--scope <scope>]
61
+ ```
62
+
63
+ - `<name>`: The name of the extension to enable.
64
+ - `--scope`: The scope to enable the extension in (`user` or `workspace`).
65
+
66
+ ### Update an extension
67
+
68
+ Update an extension to the version specified in its `gemini-extension.json`
69
+ file.
70
+
71
+ ```bash
72
+ gemini extensions update <name>
73
+ ```
74
+
75
+ To update all installed extensions at once:
76
+
77
+ ```bash
78
+ gemini extensions update --all
79
+ ```
80
+
81
+ ### Create an extension from a template
82
+
83
+ Create a new extension directory using a built-in template.
84
+
85
+ ```bash
86
+ gemini extensions new <path> [template]
87
+ ```
88
+
89
+ - `<path>`: The directory to create.
90
+ - `[template]`: The template to use (e.g., `mcp-server`, `context`,
91
+ `custom-commands`).
92
+
93
+ ### Link a local extension
94
+
95
+ Create a symbolic link between your development directory and the Gemini CLI
96
+ extensions directory. This lets you test changes immediately without
97
+ reinstalling.
98
+
99
+ ```bash
100
+ gemini extensions link <path>
101
+ ```
102
+
103
+ ## Extension format
104
+
105
+ Gemini CLI loads extensions from `<home>/.gemini/extensions`. Each extension
106
+ must have a `gemini-extension.json` file in its root directory.
107
+
108
+ ### `gemini-extension.json`
109
+
110
+ The manifest file defines the extension's behavior and configuration.
111
+
112
+ ```json
113
+ {
114
+ "name": "my-extension",
115
+ "version": "1.0.0",
116
+ "description": "My awesome extension",
117
+ "mcpServers": {
118
+ "my-server": {
119
+ "command": "node",
120
+ "args": ["${extensionPath}/my-server.js"],
121
+ "cwd": "${extensionPath}"
122
+ }
123
+ },
124
+ "contextFileName": "GEMINI.md",
125
+ "excludeTools": ["run_shell_command"],
126
+ "plan": {
127
+ "directory": ".gemini/plans"
128
+ }
129
+ }
130
+ ```
131
+
132
+ - `name`: The name of the extension. This is used to uniquely identify the
133
+ extension and for conflict resolution when extension commands have the same
134
+ name as user or project commands. The name should be lowercase or numbers and
135
+ use dashes instead of underscores or spaces. This is how users will refer to
136
+ your extension in the CLI. Note that we expect this name to match the
137
+ extension directory name.
138
+ - `version`: The version of the extension.
139
+ - `description`: A short description of the extension. This will be displayed on
140
+ [geminicli.com/extensions](https://geminicli.com/extensions).
141
+ - `mcpServers`: A map of MCP servers to settings. The key is the name of the
142
+ server, and the value is the server configuration. These servers will be
143
+ loaded on startup just like MCP servers defined in a
144
+ [`settings.json` file](../reference/configuration.md). If both an extension
145
+ and a `settings.json` file define an MCP server with the same name, the server
146
+ defined in the `settings.json` file takes precedence.
147
+ - Note that all MCP server configuration options are supported except for
148
+ `trust`.
149
+ - For portability, you should use `${extensionPath}` to refer to files within
150
+ your extension directory.
151
+ - Separate your executable and its arguments using `command` and `args`
152
+ instead of putting them both in `command`.
153
+ - `contextFileName`: The name of the file that contains the context for the
154
+ extension. This will be used to load the context from the extension directory.
155
+ If this property is not used but a `GEMINI.md` file is present in your
156
+ extension directory, then that file will be loaded.
157
+ - `excludeTools`: An array of tool names to exclude from the model. You can also
158
+ specify command-specific restrictions for tools that support it, like the
159
+ `run_shell_command` tool. For example,
160
+ `"excludeTools": ["run_shell_command(rm -rf)"]` will block the `rm -rf`
161
+ command. Note that this differs from the MCP server `excludeTools`
162
+ functionality, which can be listed in the MCP server config.
163
+ - `plan`: Planning features configuration.
164
+ - `directory`: The directory where planning artifacts are stored. This serves
165
+ as a fallback if the user hasn't specified a plan directory in their
166
+ settings. If not specified by either the extension or the user, the default
167
+ is `~/.gemini/tmp/<project>/<session-id>/plans/`.
168
+
169
+ When Gemini CLI starts, it loads all the extensions and merges their
170
+ configurations. If there are any conflicts, the workspace configuration takes
171
+ precedence.
172
+
173
+ ### Extension settings
174
+
175
+ Extensions can define settings that users provide during installation, such as
176
+ API keys or URLs. These values are stored in a `.env` file within the extension
177
+ directory.
178
+
179
+ To define settings, add a `settings` array to your manifest:
180
+
181
+ ```json
182
+ {
183
+ "name": "my-api-extension",
184
+ "version": "1.0.0",
185
+ "settings": [
186
+ {
187
+ "name": "API Key",
188
+ "description": "Your API key for the service.",
189
+ "envVar": "MY_API_KEY",
190
+ "sensitive": true
191
+ }
192
+ ]
193
+ }
194
+ ```
195
+
196
+ - `name`: The setting's display name.
197
+ - `description`: A clear explanation of the setting.
198
+ - `envVar`: The environment variable name where the value is stored.
199
+ - `sensitive`: If `true`, the value is stored in the system keychain and
200
+ obfuscated in the UI.
201
+
202
+ To update an extension's settings:
203
+
204
+ ```bash
205
+ gemini extensions config <name> [setting] [--scope <scope>]
206
+ ```
207
+
208
+ ### Custom commands
209
+
210
+ Provide [custom commands](../cli/custom-commands.md) by placing TOML files in a
211
+ `commands/` subdirectory. Gemini CLI uses the directory structure to determine
212
+ the command name.
213
+
214
+ For an extension named `gcp`:
215
+
216
+ - `commands/deploy.toml` becomes `/deploy`
217
+ - `commands/gcs/sync.toml` becomes `/gcs:sync` (namespaced with a colon)
218
+
219
+ ### Hooks
220
+
221
+ Intercept and customize CLI behavior using [hooks](../hooks/index.md). Define
222
+ hooks in a `hooks/hooks.json` file within your extension directory. Note that
223
+ hooks are not defined in the `gemini-extension.json` manifest.
224
+
225
+ ### Agent skills
226
+
227
+ Bundle [agent skills](../cli/skills.md) to provide specialized workflows. Place
228
+ skill definitions in a `skills/` directory. For example,
229
+ `skills/security-audit/SKILL.md` exposes a `security-audit` skill.
230
+
231
+ ### Sub-agents
232
+
233
+ > **Note:** Sub-agents are a preview feature currently under active development.
234
+
235
+ Provide [sub-agents](../core/subagents.md) that users can delegate tasks to. Add
236
+ agent definition files (`.md`) to an `agents/` directory in your extension root.
237
+
238
+ ### <a id="policy-engine"></a>Policy Engine
239
+
240
+ Extensions can contribute policy rules and safety checkers to the Gemini CLI
241
+ [Policy Engine](../reference/policy-engine.md). These rules are defined in
242
+ `.toml` files and take effect when the extension is activated.
243
+
244
+ To add policies, create a `policies/` directory in your extension's root and
245
+ place your `.toml` policy files inside it. Gemini CLI automatically loads all
246
+ `.toml` files from this directory.
247
+
248
+ Rules contributed by extensions run in their own tier (tier 2), alongside
249
+ workspace-defined policies. This tier has higher priority than the default rules
250
+ but lower priority than user or admin policies.
251
+
252
+ > **Warning:** For security, Gemini CLI ignores any `allow` decisions or `yolo`
253
+ > mode configurations in extension policies. This ensures that an extension
254
+ > cannot automatically approve tool calls or bypass security measures without
255
+ > your confirmation.
256
+
257
+ **Example `policies.toml`**
258
+
259
+ ```toml
260
+ [[rule]]
261
+ toolName = "my_server__dangerous_tool"
262
+ decision = "ask_user"
263
+ priority = 100
264
+
265
+ [[safety_checker]]
266
+ toolName = "my_server__write_data"
267
+ priority = 200
268
+ [safety_checker.checker]
269
+ type = "in-process"
270
+ name = "allowed-path"
271
+ required_context = ["environment"]
272
+ ```
273
+
274
+ ### Themes
275
+
276
+ Extensions can provide custom themes to personalize the CLI UI. Themes are
277
+ defined in the `themes` array in `gemini-extension.json`.
278
+
279
+ **Example**
280
+
281
+ ```json
282
+ {
283
+ "name": "my-green-extension",
284
+ "version": "1.0.0",
285
+ "themes": [
286
+ {
287
+ "name": "shades-of-green",
288
+ "type": "custom",
289
+ "background": {
290
+ "primary": "#1a362a"
291
+ },
292
+ "text": {
293
+ "primary": "#a6e3a1",
294
+ "secondary": "#6e8e7a",
295
+ "link": "#89e689"
296
+ },
297
+ "status": {
298
+ "success": "#76c076",
299
+ "warning": "#d9e689",
300
+ "error": "#b34e4e"
301
+ },
302
+ "border": {
303
+ "default": "#4a6c5a"
304
+ },
305
+ "ui": {
306
+ "comment": "#6e8e7a"
307
+ }
308
+ }
309
+ ]
310
+ }
311
+ ```
312
+
313
+ Custom themes provided by extensions can be selected using the `/theme` command
314
+ or by setting the `ui.theme` property in your `settings.json` file. Note that
315
+ when referring to a theme from an extension, the extension name is appended to
316
+ the theme name in parentheses, e.g., `shades-of-green (my-green-extension)`.
317
+
318
+ ### Conflict resolution
319
+
320
+ Extension commands have the lowest precedence. If an extension command name
321
+ conflicts with a user or project command, the extension command is prefixed with
322
+ the extension name (e.g., `/gcp.deploy`) using a dot separator.
323
+
324
+ ## Variables
325
+
326
+ Gemini CLI supports variable substitution in `gemini-extension.json` and
327
+ `hooks/hooks.json`.
328
+
329
+ | Variable | Description |
330
+ | :----------------- | :---------------------------------------------- |
331
+ | `${extensionPath}` | The absolute path to the extension's directory. |
332
+ | `${workspacePath}` | The absolute path to the current workspace. |
333
+ | `${/}` | The platform-specific path separator. |