@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,375 @@
1
+ # Plan Mode (experimental)
2
+
3
+ Plan Mode is a read-only environment for architecting robust solutions before
4
+ implementation. With Plan Mode, you can:
5
+
6
+ - **Research:** Explore the project in a read-only state to prevent accidental
7
+ changes.
8
+ - **Design:** Understand problems, evaluate trade-offs, and choose a solution.
9
+ - **Plan:** Align on an execution strategy before any code is modified.
10
+
11
+ > **Note:** This is a preview feature currently under active development. Your
12
+ > feedback is invaluable as we refine this feature. If you have ideas,
13
+ > suggestions, or encounter issues:
14
+ >
15
+ > - [Open an issue] on GitHub.
16
+ > - Use the **/bug** command within Gemini CLI to file an issue.
17
+
18
+ ## How to enable Plan Mode
19
+
20
+ Enable Plan Mode in **Settings** or by editing your configuration file.
21
+
22
+ - **Settings:** Use the `/settings` command and set **Plan** to `true`.
23
+ - **Configuration:** Add the following to your `settings.json`:
24
+
25
+ ```json
26
+ {
27
+ "experimental": {
28
+ "plan": true
29
+ }
30
+ }
31
+ ```
32
+
33
+ ## How to enter Plan Mode
34
+
35
+ Plan Mode integrates seamlessly into your workflow, letting you switch between
36
+ planning and execution as needed.
37
+
38
+ You can either configure Gemini CLI to start in Plan Mode by default or enter
39
+ Plan Mode manually during a session.
40
+
41
+ ### Launch in Plan Mode
42
+
43
+ To start Gemini CLI directly in Plan Mode by default:
44
+
45
+ 1. Use the `/settings` command.
46
+ 2. Set **Default Approval Mode** to `Plan`.
47
+
48
+ To launch Gemini CLI in Plan Mode once:
49
+
50
+ 1. Use `gemini --approval-mode=plan` when launching Gemini CLI.
51
+
52
+ ### Enter Plan Mode manually
53
+
54
+ To start Plan Mode while using Gemini CLI:
55
+
56
+ - **Keyboard shortcut:** Press `Shift+Tab` to cycle through approval modes
57
+ (`Default` -> `Auto-Edit` -> `Plan`).
58
+
59
+ > **Note:** Plan Mode is automatically removed from the rotation when Gemini
60
+ > CLI is actively processing or showing confirmation dialogs.
61
+
62
+ - **Command:** Type `/plan` in the input box.
63
+
64
+ - **Natural Language:** Ask Gemini CLI to "start a plan for...". Gemini CLI
65
+ calls the [`enter_plan_mode`] tool to switch modes.
66
+ > **Note:** This tool is not available when Gemini CLI is in [YOLO mode].
67
+
68
+ ## How to use Plan Mode
69
+
70
+ Plan Mode lets you collaborate with Gemini CLI to design a solution before
71
+ Gemini CLI takes action.
72
+
73
+ 1. **Provide a goal:** Start by describing what you want to achieve. Gemini CLI
74
+ will then enter Plan Mode (if it's not already) to research the task.
75
+ 2. **Review research and provide input:** As Gemini CLI analyzes your codebase,
76
+ it may ask you questions or present different implementation options using
77
+ [`ask_user`]. Provide your preferences to help guide the design.
78
+ 3. **Review the plan:** Once Gemini CLI has a proposed strategy, it creates a
79
+ detailed implementation plan as a Markdown file in your plans directory. You
80
+ can open and read this file to understand the proposed changes.
81
+ 4. **Approve or iterate:** Gemini CLI will present the finalized plan for your
82
+ approval.
83
+ - **Approve:** If you're satisfied with the plan, approve it to start the
84
+ implementation immediately: **Yes, automatically accept edits** or **Yes,
85
+ manually accept edits**.
86
+ - **Iterate:** If the plan needs adjustments, provide feedback. Gemini CLI
87
+ will refine the strategy and update the plan.
88
+ - **Cancel:** You can cancel your plan with `Esc`.
89
+
90
+ For more complex or specialized planning tasks, you can
91
+ [customize the planning workflow with skills](#custom-planning-with-skills).
92
+
93
+ ## How to exit Plan Mode
94
+
95
+ You can exit Plan Mode at any time, whether you have finalized a plan or want to
96
+ switch back to another mode.
97
+
98
+ - **Approve a plan:** When Gemini CLI presents a finalized plan, approving it
99
+ automatically exits Plan Mode and starts the implementation.
100
+ - **Keyboard shortcut:** Press `Shift+Tab` to cycle to the desired mode.
101
+ - **Natural language:** Ask Gemini CLI to "exit plan mode" or "stop planning."
102
+
103
+ ## Customization and best practices
104
+
105
+ Plan Mode is secure by default, but you can adapt it to fit your specific
106
+ workflows. You can customize how Gemini CLI plans by using skills, adjusting
107
+ safety policies, or changing where plans are stored.
108
+
109
+ ## Commands
110
+
111
+ - **`/plan copy`**: Copy the currently approved plan to your clipboard.
112
+
113
+ ## Tool Restrictions
114
+
115
+ Plan Mode enforces strict safety policies to prevent accidental changes.
116
+
117
+ These are the only allowed tools:
118
+
119
+ - **FileSystem (Read):** [`read_file`], [`list_directory`], [`glob`]
120
+ - **Search:** [`grep_search`], [`google_web_search`]
121
+ - **Research Subagents:** [`codebase_investigator`], [`cli_help`]
122
+ - **Interaction:** [`ask_user`]
123
+ - **MCP tools (Read):** Read-only [MCP tools] (for example, `github_read_issue`,
124
+ `postgres_read_schema`) are allowed.
125
+ - **Planning (Write):** [`write_file`] and [`replace`] only allowed for `.md`
126
+ files in the `~/.gemini/tmp/<project>/<session-id>/plans/` directory or your
127
+ [custom plans directory](#custom-plan-directory-and-policies).
128
+ - **Memory:** [`save_memory`]
129
+ - **Skills:** [`activate_skill`] (allows loading specialized instructions and
130
+ resources in a read-only manner)
131
+
132
+ ### Custom planning with skills
133
+
134
+ You can use [Agent Skills] to customize how Gemini CLI approaches planning for
135
+ specific types of tasks. When a skill is activated during Plan Mode, its
136
+ specialized instructions and procedural workflows will guide the research,
137
+ design, and planning phases.
138
+
139
+ For example:
140
+
141
+ - A **"Database Migration"** skill could ensure the plan includes data safety
142
+ checks and rollback strategies.
143
+ - A **"Security Audit"** skill could prompt Gemini CLI to look for specific
144
+ vulnerabilities during codebase exploration.
145
+ - A **"Frontend Design"** skill could guide Gemini CLI to use specific UI
146
+ components and accessibility standards in its proposal.
147
+
148
+ To use a skill in Plan Mode, you can explicitly ask Gemini CLI to "use the
149
+ `<skill-name>` skill to plan..." or Gemini CLI may autonomously activate it
150
+ based on the task description.
151
+
152
+ ### Custom policies
153
+
154
+ Plan Mode's default tool restrictions are managed by the [policy engine] and
155
+ defined in the built-in [`plan.toml`] file. The built-in policy (Tier 1)
156
+ enforces the read-only state, but you can customize these rules by creating your
157
+ own policies in your `~/.gemini/policies/` directory (Tier 2).
158
+
159
+ #### Example: Automatically approve read-only MCP tools
160
+
161
+ By default, read-only MCP tools require user confirmation in Plan Mode. You can
162
+ use `toolAnnotations` and the `mcpName` wildcard to customize this behavior for
163
+ your specific environment.
164
+
165
+ `~/.gemini/policies/mcp-read-only.toml`
166
+
167
+ ```toml
168
+ [[rule]]
169
+ mcpName = "*"
170
+ toolAnnotations = { readOnlyHint = true }
171
+ decision = "allow"
172
+ priority = 100
173
+ modes = ["plan"]
174
+ ```
175
+
176
+ For more information on how the policy engine works, see the [policy engine]
177
+ docs.
178
+
179
+ #### Example: Allow git commands in Plan Mode
180
+
181
+ This rule lets you check the repository status and see changes while in Plan
182
+ Mode.
183
+
184
+ `~/.gemini/policies/git-research.toml`
185
+
186
+ ```toml
187
+ [[rule]]
188
+ toolName = "run_shell_command"
189
+ commandPrefix = ["git status", "git diff"]
190
+ decision = "allow"
191
+ priority = 100
192
+ modes = ["plan"]
193
+ ```
194
+
195
+ #### Example: Enable custom subagents in Plan Mode
196
+
197
+ Built-in research [subagents] like [`codebase_investigator`] and [`cli_help`]
198
+ are enabled by default in Plan Mode. You can enable additional [custom
199
+ subagents] by adding a rule to your policy.
200
+
201
+ `~/.gemini/policies/research-subagents.toml`
202
+
203
+ ```toml
204
+ [[rule]]
205
+ toolName = "my_custom_subagent"
206
+ decision = "allow"
207
+ priority = 100
208
+ modes = ["plan"]
209
+ ```
210
+
211
+ Tell Gemini CLI it can use these tools in your prompt, for example: _"You can
212
+ check ongoing changes in git."_
213
+
214
+ ### Custom plan directory and policies
215
+
216
+ By default, planning artifacts are stored in a managed temporary directory
217
+ outside your project: `~/.gemini/tmp/<project>/<session-id>/plans/`.
218
+
219
+ You can configure a custom directory for plans in your `settings.json`. For
220
+ example, to store plans in a `.gemini/plans` directory within your project:
221
+
222
+ ```json
223
+ {
224
+ "general": {
225
+ "plan": {
226
+ "directory": ".gemini/plans"
227
+ }
228
+ }
229
+ }
230
+ ```
231
+
232
+ To maintain the safety of Plan Mode, user-configured paths for the plans
233
+ directory are restricted to the project root. This ensures that custom planning
234
+ locations defined within a project's workspace cannot be used to escape and
235
+ overwrite sensitive files elsewhere. Any user-configured directory must reside
236
+ within the project boundary.
237
+
238
+ Using a custom directory requires updating your [policy engine] configurations
239
+ to allow `write_file` and `replace` in that specific location. For example, to
240
+ allow writing to the `.gemini/plans` directory within your project, create a
241
+ policy file at `~/.gemini/policies/plan-custom-directory.toml`:
242
+
243
+ ```toml
244
+ [[rule]]
245
+ toolName = ["write_file", "replace"]
246
+ decision = "allow"
247
+ priority = 100
248
+ modes = ["plan"]
249
+ # Adjust the pattern to match your custom directory.
250
+ # This example matches any .md file in a .gemini/plans directory within the project.
251
+ argsPattern = "\"file_path\":\"[^\"]+[\\\\/]+\\.gemini[\\\\/]+plans[\\\\/]+[\\w-]+\\.md\""
252
+ ```
253
+
254
+ ## Planning workflows
255
+
256
+ Plan Mode provides building blocks for structured research and design. These are
257
+ implemented as [extensions] using core planning tools like [`enter_plan_mode`],
258
+ [`exit_plan_mode`], and [`ask_user`].
259
+
260
+ ### Built-in planning workflow
261
+
262
+ The built-in planner uses an adaptive workflow to analyze your project, consult
263
+ you on trade-offs via [`ask_user`], and draft a plan for your approval.
264
+
265
+ ### Custom planning workflows
266
+
267
+ You can install or create specialized planners to suit your workflow.
268
+
269
+ #### Conductor
270
+
271
+ [Conductor] is designed for spec-driven development. It organizes work into
272
+ "tracks" and stores persistent artifacts in your project's `conductor/`
273
+ directory:
274
+
275
+ - **Automate transitions:** Switches to read-only mode via [`enter_plan_mode`].
276
+ - **Streamline decisions:** Uses [`ask_user`] for architectural choices.
277
+ - **Maintain project context:** Stores artifacts in the project directory using
278
+ [custom plan directory and policies](#custom-plan-directory-and-policies).
279
+ - **Handoff execution:** Transitions to implementation via [`exit_plan_mode`].
280
+
281
+ #### Build your own
282
+
283
+ Since Plan Mode is built on modular building blocks, you can develop your own
284
+ custom planning workflow as an [extensions]. By leveraging core tools and
285
+ [custom policies](#custom-policies), you can define how Gemini CLI researches
286
+ and stores plans for your specific domain.
287
+
288
+ To build a custom planning workflow, you can use:
289
+
290
+ - **Tool usage:** Use core tools like [`enter_plan_mode`], [`ask_user`], and
291
+ [`exit_plan_mode`] to manage the research and design process.
292
+ - **Customization:** Set your own storage locations and policy rules using
293
+ [custom plan directories](#custom-plan-directory-and-policies) and
294
+ [custom policies](#custom-policies).
295
+
296
+ > **Note:** Use [Conductor] as a reference when building your own custom
297
+ > planning workflow.
298
+
299
+ By using Plan Mode as its execution environment, your custom methodology can
300
+ enforce read-only safety during the design phase while benefiting from
301
+ high-reasoning model routing.
302
+
303
+ ## Automatic Model Routing
304
+
305
+ When using an [auto model], Gemini CLI automatically optimizes [model routing]
306
+ based on the current phase of your task:
307
+
308
+ 1. **Planning Phase:** While in Plan Mode, the CLI routes requests to a
309
+ high-reasoning **Pro** model to ensure robust architectural decisions and
310
+ high-quality plans.
311
+ 2. **Implementation Phase:** Once a plan is approved and you exit Plan Mode,
312
+ the CLI detects the existence of the approved plan and automatically
313
+ switches to a high-speed **Flash** model. This provides a faster, more
314
+ responsive experience during the implementation of the plan.
315
+
316
+ This behavior is enabled by default to provide the best balance of quality and
317
+ performance. You can disable this automatic switching in your settings:
318
+
319
+ ```json
320
+ {
321
+ "general": {
322
+ "plan": {
323
+ "modelRouting": false
324
+ }
325
+ }
326
+ }
327
+ ```
328
+
329
+ ## Cleanup
330
+
331
+ By default, Gemini CLI automatically cleans up old session data, including all
332
+ associated plan files and task trackers.
333
+
334
+ - **Default behavior:** Sessions (and their plans) are retained for **30 days**.
335
+ - **Configuration:** You can customize this behavior via the `/settings` command
336
+ (search for **Session Retention**) or in your `settings.json` file. See
337
+ [session retention] for more details.
338
+
339
+ Manual deletion also removes all associated artifacts:
340
+
341
+ - **Command Line:** Use `gemini --delete-session <index|id>`.
342
+ - **Session Browser:** Press `/resume`, navigate to a session, and press `x`.
343
+
344
+ If you use a [custom plans directory](#custom-plan-directory-and-policies),
345
+ those files are not automatically deleted and must be managed manually.
346
+
347
+ [`list_directory`]: ../tools/file-system.md#1-list_directory-readfolder
348
+ [`read_file`]: ../tools/file-system.md#2-read_file-readfile
349
+ [`grep_search`]: ../tools/file-system.md#5-grep_search-searchtext
350
+ [`write_file`]: ../tools/file-system.md#3-write_file-writefile
351
+ [`glob`]: ../tools/file-system.md#4-glob-findfiles
352
+ [`google_web_search`]: ../tools/web-search.md
353
+ [`replace`]: ../tools/file-system.md#6-replace-edit
354
+ [MCP tools]: ../tools/mcp-server.md
355
+ [`save_memory`]: ../tools/memory.md
356
+ [`activate_skill`]: ./skills.md
357
+ [`codebase_investigator`]: ../core/subagents.md#codebase_investigator
358
+ [`cli_help`]: ../core/subagents.md#cli_help
359
+ [subagents]: ../core/subagents.md
360
+ [custom subagents]: ../core/subagents.md#creating-custom-subagents
361
+ [policy engine]: ../reference/policy-engine.md
362
+ [`enter_plan_mode`]: ../tools/planning.md#1-enter_plan_mode-enterplanmode
363
+ [`exit_plan_mode`]: ../tools/planning.md#2-exit_plan_mode-exitplanmode
364
+ [`ask_user`]: ../tools/ask-user.md
365
+ [YOLO mode]: ../reference/configuration.md#command-line-arguments
366
+ [`plan.toml`]:
367
+ https://github.com/DGameGT/mashadev-cli/blob/main/packages/core/src/policy/policies/plan.toml
368
+ [auto model]: ../reference/configuration.md#model-settings
369
+ [model routing]: ./telemetry.md#model-routing
370
+ [preferred external editor]: ../reference/configuration.md#general
371
+ [session retention]: ./session-management.md#session-retention
372
+ [extensions]: ../extensions/index.md
373
+ [Conductor]: https://github.com/gemini-cli-extensions/conductor
374
+ [open an issue]: https://github.com/DGameGT/mashadev-cli/issues
375
+ [Agent Skills]: ./skills.md
@@ -0,0 +1,51 @@
1
+ # Rewind
2
+
3
+ The `/rewind` command lets you go back to a previous state in your conversation
4
+ and, optionally, revert any file changes made by the AI during those
5
+ interactions. This is a powerful tool for undoing mistakes, exploring different
6
+ approaches, or simply cleaning up your session history.
7
+
8
+ ## Usage
9
+
10
+ To use the rewind feature, simply type `/rewind` into the input prompt and press
11
+ **Enter**.
12
+
13
+ Alternatively, you can use the keyboard shortcut: **Press `Esc` twice**.
14
+
15
+ ## Interface
16
+
17
+ When you trigger a rewind, an interactive list of your previous interactions
18
+ appears.
19
+
20
+ 1. **Select interaction:** Use the **Up/Down arrow keys** to navigate through
21
+ the list. The most recent interactions are at the bottom.
22
+ 2. **Preview:** As you select an interaction, you'll see a preview of the user
23
+ prompt and, if applicable, the number of files changed during that step.
24
+ 3. **Confirm selection:** Press **Enter** on the interaction you want to rewind
25
+ back to.
26
+ 4. **Action selection:** After selecting an interaction, you'll be presented
27
+ with a confirmation dialog with up to three options:
28
+ - **Rewind conversation and revert code changes:** Reverts both the chat
29
+ history and the file modifications to the state before the selected
30
+ interaction.
31
+ - **Rewind conversation:** Only reverts the chat history. File changes are
32
+ kept.
33
+ - **Revert code changes:** Only reverts the file modifications. The chat
34
+ history is kept.
35
+ - **Do nothing (esc):** Cancels the rewind operation.
36
+
37
+ If no code changes were made since the selected point, the options related to
38
+ reverting code changes will be hidden.
39
+
40
+ ## Key considerations
41
+
42
+ - **Destructive action:** Rewinding is a destructive action for your current
43
+ session history and potentially your files. Use it with care.
44
+ - **Agent awareness:** When you rewind the conversation, the AI model loses all
45
+ memory of the interactions that were removed. If you only revert code changes,
46
+ you may need to inform the model that the files have changed.
47
+ - **Manual edits:** Rewinding only affects file changes made by the AI's edit
48
+ tools. It does **not** undo manual edits you've made or changes triggered by
49
+ the shell tool (`!`).
50
+ - **Compression:** Rewind works across chat compression points by reconstructing
51
+ the history from stored session data.
@@ -0,0 +1,257 @@
1
+ # Sandboxing in the Gemini CLI
2
+
3
+ This document provides a guide to sandboxing in the Gemini CLI, including
4
+ prerequisites, quickstart, and configuration.
5
+
6
+ ## Prerequisites
7
+
8
+ Before using sandboxing, you need to install and set up the Gemini CLI:
9
+
10
+ ```bash
11
+ npm install -g @dgxo/mashadevcli
12
+ ```
13
+
14
+ To verify the installation:
15
+
16
+ ```bash
17
+ gemini --version
18
+ ```
19
+
20
+ ## Overview of sandboxing
21
+
22
+ Sandboxing isolates potentially dangerous operations (such as shell commands or
23
+ file modifications) from your host system, providing a security barrier between
24
+ AI operations and your environment.
25
+
26
+ The benefits of sandboxing include:
27
+
28
+ - **Security**: Prevent accidental system damage or data loss.
29
+ - **Isolation**: Limit file system access to project directory.
30
+ - **Consistency**: Ensure reproducible environments across different systems.
31
+ - **Safety**: Reduce risk when working with untrusted code or experimental
32
+ commands.
33
+
34
+ ## Sandboxing methods
35
+
36
+ Your ideal method of sandboxing may differ depending on your platform and your
37
+ preferred container solution.
38
+
39
+ ### 1. macOS Seatbelt (macOS only)
40
+
41
+ Lightweight, built-in sandboxing using `sandbox-exec`.
42
+
43
+ **Default profile**: `permissive-open` - restricts writes outside project
44
+ directory but allows most other operations.
45
+
46
+ ### 2. Container-based (Docker/Podman)
47
+
48
+ Cross-platform sandboxing with complete process isolation.
49
+
50
+ **Note**: Requires building the sandbox image locally or using a published image
51
+ from your organization's registry.
52
+
53
+ ### 3. LXC/LXD (Linux only, experimental)
54
+
55
+ Full-system container sandboxing using LXC/LXD. Unlike Docker/Podman, LXC
56
+ containers run a complete Linux system with `systemd`, `snapd`, and other system
57
+ services. This is ideal for tools that don't work in standard Docker containers,
58
+ such as Snapcraft and Rockcraft.
59
+
60
+ **Prerequisites**:
61
+
62
+ - Linux only.
63
+ - LXC/LXD must be installed (`snap install lxd` or `apt install lxd`).
64
+ - A container must be created and running before starting Gemini CLI. Gemini
65
+ does **not** create the container automatically.
66
+
67
+ **Quick setup**:
68
+
69
+ ```bash
70
+ # Initialize LXD (first time only)
71
+ lxd init --auto
72
+
73
+ # Create and start an Ubuntu container
74
+ lxc launch ubuntu:24.04 gemini-sandbox
75
+
76
+ # Enable LXC sandboxing
77
+ export GEMINI_SANDBOX=lxc
78
+ gemini -p "build the project"
79
+ ```
80
+
81
+ **Custom container name**:
82
+
83
+ ```bash
84
+ export GEMINI_SANDBOX=lxc
85
+ export GEMINI_SANDBOX_IMAGE=my-snapcraft-container
86
+ gemini -p "build the snap"
87
+ ```
88
+
89
+ **Limitations**:
90
+
91
+ - Linux only (LXC is not available on macOS or Windows).
92
+ - The container must already exist and be running.
93
+ - The workspace directory is bind-mounted into the container at the same
94
+ absolute path — the path must be writable inside the container.
95
+ - Used with tools like Snapcraft or Rockcraft that require a full system.
96
+
97
+ ## Quickstart
98
+
99
+ ```bash
100
+ # Enable sandboxing with command flag
101
+ gemini -s -p "analyze the code structure"
102
+ ```
103
+
104
+ **Use environment variable**
105
+
106
+ **macOS/Linux**
107
+
108
+ ```bash
109
+ export GEMINI_SANDBOX=true
110
+ gemini -p "run the test suite"
111
+ ```
112
+
113
+ **Windows (PowerShell)**
114
+
115
+ ```powershell
116
+ $env:GEMINI_SANDBOX="true"
117
+ gemini -p "run the test suite"
118
+ ```
119
+
120
+ **Configure in settings.json**
121
+
122
+ ```json
123
+ {
124
+ "tools": {
125
+ "sandbox": "docker"
126
+ }
127
+ }
128
+ ```
129
+
130
+ ## Configuration
131
+
132
+ ### Enable sandboxing (in order of precedence)
133
+
134
+ 1. **Command flag**: `-s` or `--sandbox`
135
+ 2. **Environment variable**:
136
+ `GEMINI_SANDBOX=true|docker|podman|sandbox-exec|lxc`
137
+ 3. **Settings file**: `"sandbox": true` in the `tools` object of your
138
+ `settings.json` file (e.g., `{"tools": {"sandbox": true}}`).
139
+
140
+ ### macOS Seatbelt profiles
141
+
142
+ Built-in profiles (set via `SEATBELT_PROFILE` env var):
143
+
144
+ - `permissive-open` (default): Write restrictions, network allowed
145
+ - `permissive-proxied`: Write restrictions, network via proxy
146
+ - `restrictive-open`: Strict restrictions, network allowed
147
+ - `restrictive-proxied`: Strict restrictions, network via proxy
148
+ - `strict-open`: Read and write restrictions, network allowed
149
+ - `strict-proxied`: Read and write restrictions, network via proxy
150
+
151
+ ### Custom sandbox flags
152
+
153
+ For container-based sandboxing, you can inject custom flags into the `docker` or
154
+ `podman` command using the `SANDBOX_FLAGS` environment variable. This is useful
155
+ for advanced configurations, such as disabling security features for specific
156
+ use cases.
157
+
158
+ **Example (Podman)**:
159
+
160
+ To disable SELinux labeling for volume mounts, you can set the following:
161
+
162
+ **macOS/Linux**
163
+
164
+ ```bash
165
+ export SANDBOX_FLAGS="--security-opt label=disable"
166
+ ```
167
+
168
+ **Windows (PowerShell)**
169
+
170
+ ```powershell
171
+ $env:SANDBOX_FLAGS="--security-opt label=disable"
172
+ ```
173
+
174
+ Multiple flags can be provided as a space-separated string:
175
+
176
+ **macOS/Linux**
177
+
178
+ ```bash
179
+ export SANDBOX_FLAGS="--flag1 --flag2=value"
180
+ ```
181
+
182
+ **Windows (PowerShell)**
183
+
184
+ ```powershell
185
+ $env:SANDBOX_FLAGS="--flag1 --flag2=value"
186
+ ```
187
+
188
+ ## Linux UID/GID handling
189
+
190
+ The sandbox automatically handles user permissions on Linux. Override these
191
+ permissions with:
192
+
193
+ **macOS/Linux**
194
+
195
+ ```bash
196
+ export SANDBOX_SET_UID_GID=true # Force host UID/GID
197
+ export SANDBOX_SET_UID_GID=false # Disable UID/GID mapping
198
+ ```
199
+
200
+ **Windows (PowerShell)**
201
+
202
+ ```powershell
203
+ $env:SANDBOX_SET_UID_GID="true" # Force host UID/GID
204
+ $env:SANDBOX_SET_UID_GID="false" # Disable UID/GID mapping
205
+ ```
206
+
207
+ ## Troubleshooting
208
+
209
+ ### Common issues
210
+
211
+ **"Operation not permitted"**
212
+
213
+ - Operation requires access outside sandbox.
214
+ - Try more permissive profile or add mount points.
215
+
216
+ **Missing commands**
217
+
218
+ - Add to custom Dockerfile.
219
+ - Install via `sandbox.bashrc`.
220
+
221
+ **Network issues**
222
+
223
+ - Check sandbox profile allows network.
224
+ - Verify proxy configuration.
225
+
226
+ ### Debug mode
227
+
228
+ ```bash
229
+ DEBUG=1 gemini -s -p "debug command"
230
+ ```
231
+
232
+ **Note:** If you have `DEBUG=true` in a project's `.env` file, it won't affect
233
+ gemini-cli due to automatic exclusion. Use `.gemini/.env` files for gemini-cli
234
+ specific debug settings.
235
+
236
+ ### Inspect sandbox
237
+
238
+ ```bash
239
+ # Check environment
240
+ gemini -s -p "run shell command: env | grep SANDBOX"
241
+
242
+ # List mounts
243
+ gemini -s -p "run shell command: mount | grep workspace"
244
+ ```
245
+
246
+ ## Security notes
247
+
248
+ - Sandboxing reduces but doesn't eliminate all risks.
249
+ - Use the most restrictive profile that allows your work.
250
+ - Container overhead is minimal after first build.
251
+ - GUI applications may not work in sandboxes.
252
+
253
+ ## Related documentation
254
+
255
+ - [Configuration](../reference/configuration.md): Full configuration options.
256
+ - [Commands](../reference/commands.md): Available commands.
257
+ - [Troubleshooting](../resources/troubleshooting.md): General troubleshooting.