@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,80 @@
1
+ # Creating Agent Skills
2
+
3
+ This guide provides an overview of how to create your own Agent Skills to extend
4
+ the capabilities of Gemini CLI.
5
+
6
+ ## Getting started: The `skill-creator` skill
7
+
8
+ The recommended way to create a new skill is to use the built-in `skill-creator`
9
+ skill. To use it, ask Gemini CLI to create a new skill for you.
10
+
11
+ **Example prompt:**
12
+
13
+ > "create a new skill called 'code-reviewer'"
14
+
15
+ Gemini CLI will then use the `skill-creator` to generate the skill:
16
+
17
+ 1. Generate a new directory for your skill (e.g., `my-new-skill/`).
18
+ 2. Create a `SKILL.md` file with the necessary YAML frontmatter (`name` and
19
+ `description`).
20
+ 3. Create the standard resource directories: `scripts/`, `references/`, and
21
+ `assets/`.
22
+
23
+ ## Manual skill creation
24
+
25
+ If you prefer to create skills manually:
26
+
27
+ 1. **Create a directory** for your skill (e.g., `my-new-skill/`).
28
+ 2. **Create a `SKILL.md` file** inside the new directory.
29
+
30
+ To add additional resources that support the skill, refer to the skill
31
+ structure.
32
+
33
+ ## Skill structure
34
+
35
+ A skill is a directory containing a `SKILL.md` file at its root.
36
+
37
+ ### Folder structure
38
+
39
+ While a `SKILL.md` file is the only required component, we recommend the
40
+ following structure for organizing your skill's resources:
41
+
42
+ ```text
43
+ my-skill/
44
+ ├── SKILL.md (Required) Instructions and metadata
45
+ ├── scripts/ (Optional) Executable scripts
46
+ ├── references/ (Optional) Static documentation
47
+ └── assets/ (Optional) Templates and other resources
48
+ ```
49
+
50
+ ### `SKILL.md` file
51
+
52
+ The `SKILL.md` file is the core of your skill. This file uses YAML frontmatter
53
+ for metadata and Markdown for instructions. For example:
54
+
55
+ ```markdown
56
+ ---
57
+ name: code-reviewer
58
+ description:
59
+ Use this skill to review code. It supports both local changes and remote Pull
60
+ Requests.
61
+ ---
62
+
63
+ # Code Reviewer
64
+
65
+ This skill guides the agent in conducting thorough code reviews.
66
+
67
+ ## Workflow
68
+
69
+ ### 1. Determine Review Target
70
+
71
+ - **Remote PR**: If the user gives a PR number or URL, target that remote PR.
72
+ - **Local Changes**: If changes are local... ...
73
+ ```
74
+
75
+ - **`name`**: A unique identifier for the skill. This should match the directory
76
+ name.
77
+ - **`description`**: A description of what the skill does and when Gemini should
78
+ use it.
79
+ - **Body**: The Markdown body of the file contains the instructions that guide
80
+ the agent's behavior when the skill is active.
@@ -0,0 +1,327 @@
1
+ # Custom commands
2
+
3
+ Custom commands let you save and reuse your favorite or most frequently used
4
+ prompts as personal shortcuts within Gemini CLI. You can create commands that
5
+ are specific to a single project or commands that are available globally across
6
+ all your projects, streamlining your workflow and ensuring consistency.
7
+
8
+ ## File locations and precedence
9
+
10
+ Gemini CLI discovers commands from two locations, loaded in a specific order:
11
+
12
+ 1. **User commands (global):** Located in `~/.gemini/commands/`. These commands
13
+ are available in any project you are working on.
14
+ 2. **Project commands (local):** Located in
15
+ `<your-project-root>/.gemini/commands/`. These commands are specific to the
16
+ current project and can be checked into version control to be shared with
17
+ your team.
18
+
19
+ If a command in the project directory has the same name as a command in the user
20
+ directory, the **project command will always be used.** This allows projects to
21
+ override global commands with project-specific versions.
22
+
23
+ ## Naming and namespacing
24
+
25
+ The name of a command is determined by its file path relative to its `commands`
26
+ directory. Subdirectories are used to create namespaced commands, with the path
27
+ separator (`/` or `\`) being converted to a colon (`:`).
28
+
29
+ - A file at `~/.gemini/commands/test.toml` becomes the command `/test`.
30
+ - A file at `<project>/.gemini/commands/git/commit.toml` becomes the namespaced
31
+ command `/git:commit`.
32
+
33
+ > [!TIP] After creating or modifying `.toml` command files, run
34
+ > `/commands reload` to pick up your changes without restarting the CLI.
35
+
36
+ ## TOML file format (v1)
37
+
38
+ Your command definition files must be written in the TOML format and use the
39
+ `.toml` file extension.
40
+
41
+ ### Required fields
42
+
43
+ - `prompt` (String): The prompt that will be sent to the Gemini model when the
44
+ command is executed. This can be a single-line or multi-line string.
45
+
46
+ ### Optional fields
47
+
48
+ - `description` (String): A brief, one-line description of what the command
49
+ does. This text will be displayed next to your command in the `/help` menu.
50
+ **If you omit this field, a generic description will be generated from the
51
+ filename.**
52
+
53
+ ## Handling arguments
54
+
55
+ Custom commands support two powerful methods for handling arguments. The CLI
56
+ automatically chooses the correct method based on the content of your command's
57
+ `prompt`.
58
+
59
+ ### 1. Context-aware injection with `{{args}}`
60
+
61
+ If your `prompt` contains the special placeholder `{{args}}`, the CLI will
62
+ replace that placeholder with the text the user typed after the command name.
63
+
64
+ The behavior of this injection depends on where it is used:
65
+
66
+ **A. Raw injection (outside shell commands)**
67
+
68
+ When used in the main body of the prompt, the arguments are injected exactly as
69
+ the user typed them.
70
+
71
+ **Example (`git/fix.toml`):**
72
+
73
+ ```toml
74
+ # Invoked via: /git:fix "Button is misaligned"
75
+
76
+ description = "Generates a fix for a given issue."
77
+ prompt = "Please provide a code fix for the issue described here: {{args}}."
78
+ ```
79
+
80
+ The model receives:
81
+ `Please provide a code fix for the issue described here: "Button is misaligned".`
82
+
83
+ **B. Using arguments in shell commands (inside `!{...}` blocks)**
84
+
85
+ When you use `{{args}}` inside a shell injection block (`!{...}`), the arguments
86
+ are automatically **shell-escaped** before replacement. This allows you to
87
+ safely pass arguments to shell commands, ensuring the resulting command is
88
+ syntactically correct and secure while preventing command injection
89
+ vulnerabilities.
90
+
91
+ **Example (`/grep-code.toml`):**
92
+
93
+ ```toml
94
+ prompt = """
95
+ Please summarize the findings for the pattern `{{args}}`.
96
+
97
+ Search Results:
98
+ !{grep -r {{args}} .}
99
+ """
100
+ ```
101
+
102
+ When you run `/grep-code It's complicated`:
103
+
104
+ 1. The CLI sees `{{args}}` used both outside and inside `!{...}`.
105
+ 2. Outside: The first `{{args}}` is replaced raw with `It's complicated`.
106
+ 3. Inside: The second `{{args}}` is replaced with the escaped version (e.g., on
107
+ Linux: `"It\'s complicated"`).
108
+ 4. The command executed is `grep -r "It's complicated" .`.
109
+ 5. The CLI prompts you to confirm this exact, secure command before execution.
110
+ 6. The final prompt is sent.
111
+
112
+ ### 2. Default argument handling
113
+
114
+ If your `prompt` does **not** contain the special placeholder `{{args}}`, the
115
+ CLI uses a default behavior for handling arguments.
116
+
117
+ If you provide arguments to the command (e.g., `/mycommand arg1`), the CLI will
118
+ append the full command you typed to the end of the prompt, separated by two
119
+ newlines. This allows the model to see both the original instructions and the
120
+ specific arguments you just provided.
121
+
122
+ If you do **not** provide any arguments (e.g., `/mycommand`), the prompt is sent
123
+ to the model exactly as it is, with nothing appended.
124
+
125
+ **Example (`changelog.toml`):**
126
+
127
+ This example shows how to create a robust command by defining a role for the
128
+ model, explaining where to find the user's input, and specifying the expected
129
+ format and behavior.
130
+
131
+ ```toml
132
+ # In: <project>/.gemini/commands/changelog.toml
133
+ # Invoked via: /changelog 1.2.0 added "Support for default argument parsing."
134
+
135
+ description = "Adds a new entry to the project's CHANGELOG.md file."
136
+ prompt = """
137
+ # Task: Update Changelog
138
+
139
+ You are an expert maintainer of this software project. A user has invoked a command to add a new entry to the changelog.
140
+
141
+ **The user's raw command is appended below your instructions.**
142
+
143
+ Your task is to parse the `<version>`, `<change_type>`, and `<message>` from their input and use the `write_file` tool to correctly update the `CHANGELOG.md` file.
144
+
145
+ ## Expected Format
146
+ The command follows this format: `/changelog <version> <type> <message>`
147
+ - `<type>` must be one of: "added", "changed", "fixed", "removed".
148
+
149
+ ## Behavior
150
+ 1. Read the `CHANGELOG.md` file.
151
+ 2. Find the section for the specified `<version>`.
152
+ 3. Add the `<message>` under the correct `<type>` heading.
153
+ 4. If the version or type section doesn't exist, create it.
154
+ 5. Adhere strictly to the "Keep a Changelog" format.
155
+ """
156
+ ```
157
+
158
+ When you run `/changelog 1.2.0 added "New feature"`, the final text sent to the
159
+ model will be the original prompt followed by two newlines and the command you
160
+ typed.
161
+
162
+ ### 3. Executing shell commands with `!{...}`
163
+
164
+ You can make your commands dynamic by executing shell commands directly within
165
+ your `prompt` and injecting their output. This is ideal for gathering context
166
+ from your local environment, like reading file content or checking the status of
167
+ Git.
168
+
169
+ When a custom command attempts to execute a shell command, Gemini CLI will now
170
+ prompt you for confirmation before proceeding. This is a security measure to
171
+ ensure that only intended commands can be run.
172
+
173
+ **How it works:**
174
+
175
+ 1. **Inject commands:** Use the `!{...}` syntax.
176
+ 2. **Argument substitution:** If `{{args}}` is present inside the block, it is
177
+ automatically shell-escaped (see
178
+ [Context-Aware Injection](#1-context-aware-injection-with-args) above).
179
+ 3. **Robust parsing:** The parser correctly handles complex shell commands that
180
+ include nested braces, such as JSON payloads. **Note:** The content inside
181
+ `!{...}` must have balanced braces (`{` and `}`). If you need to execute a
182
+ command containing unbalanced braces, consider wrapping it in an external
183
+ script file and calling the script within the `!{...}` block.
184
+ 4. **Security check and confirmation:** The CLI performs a security check on
185
+ the final, resolved command (after arguments are escaped and substituted). A
186
+ dialog will appear showing the exact command(s) to be executed.
187
+ 5. **Execution and error reporting:** The command is executed. If the command
188
+ fails, the output injected into the prompt will include the error messages
189
+ (stderr) followed by a status line, e.g.,
190
+ `[Shell command exited with code 1]`. This helps the model understand the
191
+ context of the failure.
192
+
193
+ **Example (`git/commit.toml`):**
194
+
195
+ This command gets the staged git diff and uses it to ask the model to write a
196
+ commit message.
197
+
198
+ ````toml
199
+ # In: <project>/.gemini/commands/git/commit.toml
200
+ # Invoked via: /git:commit
201
+
202
+ description = "Generates a Git commit message based on staged changes."
203
+
204
+ # The prompt uses !{...} to execute the command and inject its output.
205
+ prompt = """
206
+ Please generate a Conventional Commit message based on the following git diff:
207
+
208
+ ```diff
209
+ !{git diff --staged}
210
+ ```
211
+
212
+ """
213
+
214
+ ````
215
+
216
+ When you run `/git:commit`, the CLI first executes `git diff --staged`, then
217
+ replaces `!{git diff --staged}` with the output of that command before sending
218
+ the final, complete prompt to the model.
219
+
220
+ ### 4. Injecting file content with `@{...}`
221
+
222
+ You can directly embed the content of a file or a directory listing into your
223
+ prompt using the `@{...}` syntax. This is useful for creating commands that
224
+ operate on specific files.
225
+
226
+ **How it works:**
227
+
228
+ - **File injection**: `@{path/to/file.txt}` is replaced by the content of
229
+ `file.txt`.
230
+ - **Multimodal support**: If the path points to a supported image (e.g., PNG,
231
+ JPEG), PDF, audio, or video file, it will be correctly encoded and injected as
232
+ multimodal input. Other binary files are handled gracefully and skipped.
233
+ - **Directory listing**: `@{path/to/dir}` is traversed and each file present
234
+ within the directory and all subdirectories is inserted into the prompt. This
235
+ respects `.gitignore` and `.geminiignore` if enabled.
236
+ - **Workspace-aware**: The command searches for the path in the current
237
+ directory and any other workspace directories. Absolute paths are allowed if
238
+ they are within the workspace.
239
+ - **Processing order**: File content injection with `@{...}` is processed
240
+ _before_ shell commands (`!{...}`) and argument substitution (`{{args}}`).
241
+ - **Parsing**: The parser requires the content inside `@{...}` (the path) to
242
+ have balanced braces (`{` and `}`).
243
+
244
+ **Example (`review.toml`):**
245
+
246
+ This command injects the content of a _fixed_ best practices file
247
+ (`docs/best-practices.md`) and uses the user's arguments to provide context for
248
+ the review.
249
+
250
+ ```toml
251
+ # In: <project>/.gemini/commands/review.toml
252
+ # Invoked via: /review FileCommandLoader.ts
253
+
254
+ description = "Reviews the provided context using a best practice guide."
255
+ prompt = """
256
+ You are an expert code reviewer.
257
+
258
+ Your task is to review {{args}}.
259
+
260
+ Use the following best practices when providing your review:
261
+
262
+ @{docs/best-practices.md}
263
+ """
264
+ ```
265
+
266
+ When you run `/review FileCommandLoader.ts`, the `@{docs/best-practices.md}`
267
+ placeholder is replaced by the content of that file, and `{{args}}` is replaced
268
+ by the text you provided, before the final prompt is sent to the model.
269
+
270
+ ---
271
+
272
+ ## Example: A "Pure Function" refactoring command
273
+
274
+ Let's create a global command that asks the model to refactor a piece of code.
275
+
276
+ **1. Create the file and directories:**
277
+
278
+ First, ensure the user commands directory exists, then create a `refactor`
279
+ subdirectory for organization and the final TOML file.
280
+
281
+ **macOS/Linux**
282
+
283
+ ```bash
284
+ mkdir -p ~/.gemini/commands/refactor
285
+ touch ~/.gemini/commands/refactor/pure.toml
286
+ ```
287
+
288
+ **Windows (PowerShell)**
289
+
290
+ ```powershell
291
+ New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.gemini\commands\refactor"
292
+ New-Item -ItemType File -Force -Path "$env:USERPROFILE\.gemini\commands\refactor\pure.toml"
293
+ ```
294
+
295
+ **2. Add the content to the file:**
296
+
297
+ Open `~/.gemini/commands/refactor/pure.toml` in your editor and add the
298
+ following content. We are including the optional `description` for best
299
+ practice.
300
+
301
+ ```toml
302
+ # In: ~/.gemini/commands/refactor/pure.toml
303
+ # This command will be invoked via: /refactor:pure
304
+
305
+ description = "Asks the model to refactor the current context into a pure function."
306
+
307
+ prompt = """
308
+ Please analyze the code I've provided in the current context.
309
+ Refactor it into a pure function.
310
+
311
+ Your response should include:
312
+ 1. The refactored, pure function code block.
313
+ 2. A brief explanation of the key changes you made and why they contribute to purity.
314
+ """
315
+ ```
316
+
317
+ **3. Run the command:**
318
+
319
+ That's it! You can now run your command in the CLI. First, you might add a file
320
+ to the context, and then invoke your command:
321
+
322
+ ```
323
+ > @my-messy-function.js
324
+ > /refactor:pure
325
+ ```
326
+
327
+ Gemini CLI will then execute the multi-line prompt defined in your TOML file.