@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.
- package/LICENSE +202 -0
- package/README.md +393 -0
- package/bundle/builtin/skill-creator/SKILL.md +382 -0
- package/bundle/builtin/skill-creator/scripts/init_skill.cjs +239 -0
- package/bundle/builtin/skill-creator/scripts/package_skill.cjs +131 -0
- package/bundle/builtin/skill-creator/scripts/validate_skill.cjs +131 -0
- package/bundle/docs/CONTRIBUTING.md +1 -0
- package/bundle/docs/admin/enterprise-controls.md +115 -0
- package/bundle/docs/assets/connected_devtools.png +0 -0
- package/bundle/docs/assets/gemini-screenshot.png +0 -0
- package/bundle/docs/assets/monitoring-dashboard-logs.png +0 -0
- package/bundle/docs/assets/monitoring-dashboard-metrics.png +0 -0
- package/bundle/docs/assets/monitoring-dashboard-overview.png +0 -0
- package/bundle/docs/assets/release_patch.png +0 -0
- package/bundle/docs/assets/theme-ansi-light.png +0 -0
- package/bundle/docs/assets/theme-ansi.png +0 -0
- package/bundle/docs/assets/theme-atom-one.png +0 -0
- package/bundle/docs/assets/theme-ayu-light.png +0 -0
- package/bundle/docs/assets/theme-ayu.png +0 -0
- package/bundle/docs/assets/theme-custom.png +0 -0
- package/bundle/docs/assets/theme-default-light.png +0 -0
- package/bundle/docs/assets/theme-default.png +0 -0
- package/bundle/docs/assets/theme-dracula.png +0 -0
- package/bundle/docs/assets/theme-github-light.png +0 -0
- package/bundle/docs/assets/theme-github.png +0 -0
- package/bundle/docs/assets/theme-google-light.png +0 -0
- package/bundle/docs/assets/theme-xcode-light.png +0 -0
- package/bundle/docs/changelogs/index.md +867 -0
- package/bundle/docs/changelogs/latest.md +208 -0
- package/bundle/docs/changelogs/preview.md +187 -0
- package/bundle/docs/cli/checkpointing.md +93 -0
- package/bundle/docs/cli/cli-reference.md +115 -0
- package/bundle/docs/cli/creating-skills.md +80 -0
- package/bundle/docs/cli/custom-commands.md +327 -0
- package/bundle/docs/cli/enterprise.md +604 -0
- package/bundle/docs/cli/gemini-ignore.md +71 -0
- package/bundle/docs/cli/gemini-md.md +116 -0
- package/bundle/docs/cli/generation-settings.md +210 -0
- package/bundle/docs/cli/headless.md +50 -0
- package/bundle/docs/cli/model-routing.md +42 -0
- package/bundle/docs/cli/model.md +53 -0
- package/bundle/docs/cli/plan-mode.md +375 -0
- package/bundle/docs/cli/rewind.md +51 -0
- package/bundle/docs/cli/sandbox.md +257 -0
- package/bundle/docs/cli/session-management.md +184 -0
- package/bundle/docs/cli/settings.md +165 -0
- package/bundle/docs/cli/skills.md +134 -0
- package/bundle/docs/cli/system-prompt.md +125 -0
- package/bundle/docs/cli/telemetry.md +922 -0
- package/bundle/docs/cli/themes.md +269 -0
- package/bundle/docs/cli/token-caching.md +20 -0
- package/bundle/docs/cli/trusted-folders.md +126 -0
- package/bundle/docs/cli/tutorials/automation.md +283 -0
- package/bundle/docs/cli/tutorials/file-management.md +142 -0
- package/bundle/docs/cli/tutorials/mcp-setup.md +113 -0
- package/bundle/docs/cli/tutorials/memory-management.md +126 -0
- package/bundle/docs/cli/tutorials/session-management.md +105 -0
- package/bundle/docs/cli/tutorials/shell-commands.md +107 -0
- package/bundle/docs/cli/tutorials/skills-getting-started.md +110 -0
- package/bundle/docs/cli/tutorials/task-planning.md +93 -0
- package/bundle/docs/cli/tutorials/web-tools.md +78 -0
- package/bundle/docs/core/index.md +107 -0
- package/bundle/docs/core/remote-agents.md +84 -0
- package/bundle/docs/core/subagents.md +307 -0
- package/bundle/docs/examples/proxy-script.md +83 -0
- package/bundle/docs/extensions/best-practices.md +188 -0
- package/bundle/docs/extensions/index.md +61 -0
- package/bundle/docs/extensions/reference.md +333 -0
- package/bundle/docs/extensions/releasing.md +154 -0
- package/bundle/docs/extensions/writing-extensions.md +308 -0
- package/bundle/docs/get-started/authentication.md +402 -0
- package/bundle/docs/get-started/examples.md +139 -0
- package/bundle/docs/get-started/gemini-3.md +115 -0
- package/bundle/docs/get-started/index.md +82 -0
- package/bundle/docs/get-started/installation.md +174 -0
- package/bundle/docs/hooks/best-practices.md +709 -0
- package/bundle/docs/hooks/index.md +164 -0
- package/bundle/docs/hooks/reference.md +330 -0
- package/bundle/docs/hooks/writing-hooks.md +474 -0
- package/bundle/docs/ide-integration/ide-companion-spec.md +267 -0
- package/bundle/docs/ide-integration/index.md +224 -0
- package/bundle/docs/index.md +141 -0
- package/bundle/docs/integration-tests.md +211 -0
- package/bundle/docs/issue-and-pr-automation.md +172 -0
- package/bundle/docs/local-development.md +134 -0
- package/bundle/docs/mermaid/context.mmd +103 -0
- package/bundle/docs/mermaid/render-path.mmd +64 -0
- package/bundle/docs/npm.md +62 -0
- package/bundle/docs/redirects.json +20 -0
- package/bundle/docs/reference/commands.md +526 -0
- package/bundle/docs/reference/configuration.md +1786 -0
- package/bundle/docs/reference/keyboard-shortcuts.md +164 -0
- package/bundle/docs/reference/memport.md +246 -0
- package/bundle/docs/reference/policy-engine.md +364 -0
- package/bundle/docs/reference/tools.md +106 -0
- package/bundle/docs/release-confidence.md +164 -0
- package/bundle/docs/releases.md +540 -0
- package/bundle/docs/resources/faq.md +175 -0
- package/bundle/docs/resources/quota-and-pricing.md +165 -0
- package/bundle/docs/resources/tos-privacy.md +102 -0
- package/bundle/docs/resources/troubleshooting.md +176 -0
- package/bundle/docs/resources/uninstall.md +56 -0
- package/bundle/docs/sidebar.json +233 -0
- package/bundle/docs/tools/activate-skill.md +43 -0
- package/bundle/docs/tools/ask-user.md +95 -0
- package/bundle/docs/tools/file-system.md +129 -0
- package/bundle/docs/tools/internal-docs.md +46 -0
- package/bundle/docs/tools/mcp-server.md +1150 -0
- package/bundle/docs/tools/memory.md +35 -0
- package/bundle/docs/tools/planning.md +58 -0
- package/bundle/docs/tools/shell.md +216 -0
- package/bundle/docs/tools/todos.md +35 -0
- package/bundle/docs/tools/web-fetch.md +35 -0
- package/bundle/docs/tools/web-search.md +32 -0
- package/bundle/docs/update/update-guide.md +111 -0
- package/bundle/masha.js +563471 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/client/main.js +89 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.d.ts +7 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js +9 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/_client-assets.js.map +1 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.d.ts +48 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js +299 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/index.js.map +1 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.d.ts +36 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js +7 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/dist/src/types.js.map +1 -0
- package/bundle/node_modules/@dgxo/mashadevcli-devtools/package.json +32 -0
- package/bundle/policies/conseca.toml +6 -0
- package/bundle/policies/discovered.toml +8 -0
- package/bundle/policies/plan.toml +109 -0
- package/bundle/policies/read-only.toml +53 -0
- package/bundle/policies/write.toml +80 -0
- package/bundle/policies/yolo.toml +54 -0
- package/bundle/sandbox-macos-permissive-open.sb +27 -0
- package/bundle/sandbox-macos-permissive-proxied.sb +37 -0
- package/bundle/sandbox-macos-restrictive-open.sb +96 -0
- package/bundle/sandbox-macos-restrictive-proxied.sb +98 -0
- package/bundle/sandbox-macos-strict-open.sb +131 -0
- package/bundle/sandbox-macos-strict-proxied.sb +133 -0
- package/package.json +169 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# File management with Gemini CLI
|
|
2
|
+
|
|
3
|
+
Explore, analyze, and modify your codebase using Gemini CLI. In this guide,
|
|
4
|
+
you'll learn how to provide Gemini CLI with files and directories, modify and
|
|
5
|
+
create files, and control what Gemini CLI can see.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
- Gemini CLI installed and authenticated.
|
|
10
|
+
- A project directory to work with (e.g., a git repository).
|
|
11
|
+
|
|
12
|
+
## How to give the agent context (Reading files)
|
|
13
|
+
|
|
14
|
+
Gemini CLI will generally try to read relevant files, sometimes prompting you
|
|
15
|
+
for access (depending on your settings). To ensure that Gemini CLI uses a file,
|
|
16
|
+
you can also include it directly.
|
|
17
|
+
|
|
18
|
+
### Direct file inclusion (`@`)
|
|
19
|
+
|
|
20
|
+
If you know the path to the file you want to work on, use the `@` symbol. This
|
|
21
|
+
forces the CLI to read the file immediately and inject its content into your
|
|
22
|
+
prompt.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
`@src/components/UserProfile.tsx Explain how this component handles user data.`
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Working with multiple files
|
|
29
|
+
|
|
30
|
+
Complex features often span multiple files. You can chain `@` references to give
|
|
31
|
+
the agent a complete picture of the dependencies.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
`@src/components/UserProfile.tsx @src/types/User.ts Refactor the component to use the updated User interface.`
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Including entire directories
|
|
38
|
+
|
|
39
|
+
For broad questions or refactoring, you can include an entire directory. Be
|
|
40
|
+
careful with large folders, as this consumes more tokens.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
`@src/utils/ Check these utility functions for any deprecated API usage.`
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## How to find files (Exploration)
|
|
47
|
+
|
|
48
|
+
If you _don't_ know the exact file path, you can ask Gemini CLI to find it for
|
|
49
|
+
you. This is useful when navigating a new codebase or looking for specific
|
|
50
|
+
logic.
|
|
51
|
+
|
|
52
|
+
### Scenario: Find a component definition
|
|
53
|
+
|
|
54
|
+
You know there's a `UserProfile` component, but you don't know where it lives.
|
|
55
|
+
|
|
56
|
+
```none
|
|
57
|
+
`Find the file that defines the UserProfile component.`
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Gemini uses the `glob` or `list_directory` tools to search your project
|
|
61
|
+
structure. It will return the specific path (e.g.,
|
|
62
|
+
`src/components/UserProfile.tsx`), which you can then use with `@` in your next
|
|
63
|
+
turn.
|
|
64
|
+
|
|
65
|
+
> **Tip:** You can also ask for lists of files, like "Show me all the TypeScript
|
|
66
|
+
> configuration files in the root directory."
|
|
67
|
+
|
|
68
|
+
## How to modify code
|
|
69
|
+
|
|
70
|
+
Once Gemini CLI has context, you can direct it to make specific edits. The agent
|
|
71
|
+
is capable of complex refactoring, not just simple text replacement.
|
|
72
|
+
|
|
73
|
+
```none
|
|
74
|
+
`Update @src/components/UserProfile.tsx to show a loading spinner if the user data is null.`
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Gemini CLI uses the `replace` tool to propose a targeted code change.
|
|
78
|
+
|
|
79
|
+
### Creating new files
|
|
80
|
+
|
|
81
|
+
You can also ask the agent to create entirely new files or folder structures.
|
|
82
|
+
|
|
83
|
+
```none
|
|
84
|
+
`Create a new file @src/components/LoadingSpinner.tsx with a simple Tailwind CSS spinner.`
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Gemini CLI uses the `write_file` tool to generate the new file from scratch.
|
|
88
|
+
|
|
89
|
+
## Review and confirm changes
|
|
90
|
+
|
|
91
|
+
Gemini CLI prioritizes safety. Before any file is modified, it presents a
|
|
92
|
+
unified diff of the proposed changes.
|
|
93
|
+
|
|
94
|
+
```diff
|
|
95
|
+
- if (!user) return null;
|
|
96
|
+
+ if (!user) return <LoadingSpinner />;
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
- **Red lines (-):** Code that will be removed.
|
|
100
|
+
- **Green lines (+):** Code that will be added.
|
|
101
|
+
|
|
102
|
+
Press **y** to confirm and apply the change to your local file system. If the
|
|
103
|
+
diff doesn't look right, press **n** to cancel and refine your prompt.
|
|
104
|
+
|
|
105
|
+
## Verify the result
|
|
106
|
+
|
|
107
|
+
After the edit is complete, verify the fix. You can simply read the file again
|
|
108
|
+
or, better yet, run your project's tests.
|
|
109
|
+
|
|
110
|
+
```none
|
|
111
|
+
`Run the tests for the UserProfile component.`
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Gemini CLI uses the `run_shell_command` tool to execute your test runner (e.g.,
|
|
115
|
+
`npm test` or `jest`). This ensures the changes didn't break existing
|
|
116
|
+
functionality.
|
|
117
|
+
|
|
118
|
+
## Advanced: Controlling what Gemini sees
|
|
119
|
+
|
|
120
|
+
By default, Gemini CLI respects your `.gitignore` file. It won't read or search
|
|
121
|
+
through `node_modules`, build artifacts, or other ignored paths.
|
|
122
|
+
|
|
123
|
+
If you have sensitive files (like `.env`) or large assets that you want to keep
|
|
124
|
+
hidden from the AI _without_ ignoring them in Git, you can create a
|
|
125
|
+
`.geminiignore` file in your project root.
|
|
126
|
+
|
|
127
|
+
**Example `.geminiignore`:**
|
|
128
|
+
|
|
129
|
+
```text
|
|
130
|
+
.env
|
|
131
|
+
local-db-dump.sql
|
|
132
|
+
private-notes.md
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Next steps
|
|
136
|
+
|
|
137
|
+
- Learn how to [Manage context and memory](memory-management.md) to keep your
|
|
138
|
+
agent smarter over long sessions.
|
|
139
|
+
- See [Execute shell commands](shell-commands.md) for more on running tests and
|
|
140
|
+
builds.
|
|
141
|
+
- Explore the technical [File system reference](../../tools/file-system.md) for
|
|
142
|
+
advanced tool parameters.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Set up an MCP server
|
|
2
|
+
|
|
3
|
+
Connect Gemini CLI to your external databases and services. In this guide,
|
|
4
|
+
you'll learn how to extend Gemini CLI's capabilities by installing the GitHub
|
|
5
|
+
MCP server and using it to manage your repositories.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
- Gemini CLI installed.
|
|
10
|
+
- **Docker:** Required for this specific example (many MCP servers run as Docker
|
|
11
|
+
containers).
|
|
12
|
+
- **GitHub token:** A Personal Access Token (PAT) with repo permissions.
|
|
13
|
+
|
|
14
|
+
## How to prepare your credentials
|
|
15
|
+
|
|
16
|
+
Most MCP servers require authentication. For GitHub, you need a PAT.
|
|
17
|
+
|
|
18
|
+
1. Create a [fine-grained PAT](https://github.com/settings/tokens?type=beta).
|
|
19
|
+
2. Grant it **Read** access to **Metadata** and **Contents**, and
|
|
20
|
+
**Read/Write** access to **Issues** and **Pull Requests**.
|
|
21
|
+
3. Store it in your environment:
|
|
22
|
+
|
|
23
|
+
**macOS/Linux**
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
export GITHUB_PERSONAL_ACCESS_TOKEN="github_pat_..."
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Windows (PowerShell)**
|
|
30
|
+
|
|
31
|
+
```powershell
|
|
32
|
+
$env:GITHUB_PERSONAL_ACCESS_TOKEN="github_pat_..."
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## How to configure Gemini CLI
|
|
36
|
+
|
|
37
|
+
You tell Gemini about new servers by editing your `settings.json`.
|
|
38
|
+
|
|
39
|
+
1. Open `~/.gemini/settings.json` (or the project-specific
|
|
40
|
+
`.gemini/settings.json`).
|
|
41
|
+
2. Add the `mcpServers` block. This tells Gemini: "Run this docker container
|
|
42
|
+
and talk to it."
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"mcpServers": {
|
|
47
|
+
"github": {
|
|
48
|
+
"command": "docker",
|
|
49
|
+
"args": [
|
|
50
|
+
"run",
|
|
51
|
+
"-i",
|
|
52
|
+
"--rm",
|
|
53
|
+
"-e",
|
|
54
|
+
"GITHUB_PERSONAL_ACCESS_TOKEN",
|
|
55
|
+
"ghcr.io/modelcontextprotocol/servers/github:latest"
|
|
56
|
+
],
|
|
57
|
+
"env": {
|
|
58
|
+
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PERSONAL_ACCESS_TOKEN}"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
> **Note:** The `command` is `docker`, and the rest are arguments passed to it.
|
|
66
|
+
> We map the local environment variable into the container so your secret isn't
|
|
67
|
+
> hardcoded in the config file.
|
|
68
|
+
|
|
69
|
+
## How to verify the connection
|
|
70
|
+
|
|
71
|
+
Restart Gemini CLI. It will automatically try to start the defined servers.
|
|
72
|
+
|
|
73
|
+
**Command:** `/mcp list`
|
|
74
|
+
|
|
75
|
+
You should see: `✓ github: docker ... - Connected`
|
|
76
|
+
|
|
77
|
+
If you see `Disconnected` or an error, check that Docker is running and your API
|
|
78
|
+
token is valid.
|
|
79
|
+
|
|
80
|
+
## How to use the new tools
|
|
81
|
+
|
|
82
|
+
Now that the server is running, the agent has new capabilities ("tools"). You
|
|
83
|
+
don't need to learn special commands; just ask in natural language.
|
|
84
|
+
|
|
85
|
+
### Scenario: Listing pull requests
|
|
86
|
+
|
|
87
|
+
**Prompt:** `List the open PRs in the google/gemini-cli repository.`
|
|
88
|
+
|
|
89
|
+
The agent will:
|
|
90
|
+
|
|
91
|
+
1. Recognize the request matches a GitHub tool.
|
|
92
|
+
2. Call `github_list_pull_requests`.
|
|
93
|
+
3. Present the data to you.
|
|
94
|
+
|
|
95
|
+
### Scenario: Creating an issue
|
|
96
|
+
|
|
97
|
+
**Prompt:**
|
|
98
|
+
`Create an issue in my repo titled "Bug: Login fails" with the description "See logs".`
|
|
99
|
+
|
|
100
|
+
## Troubleshooting
|
|
101
|
+
|
|
102
|
+
- **Server won't start?** Try running the docker command manually in your
|
|
103
|
+
terminal to see if it prints an error (e.g., "image not found").
|
|
104
|
+
- **Tools not found?** Run `/mcp refresh` to force the CLI to re-query the
|
|
105
|
+
server for its capabilities.
|
|
106
|
+
|
|
107
|
+
## Next steps
|
|
108
|
+
|
|
109
|
+
- Explore the [MCP servers reference](../../tools/mcp-server.md) to learn about
|
|
110
|
+
SSE and HTTP transports for remote servers.
|
|
111
|
+
- Browse the
|
|
112
|
+
[official MCP server list](https://github.com/modelcontextprotocol/servers) to
|
|
113
|
+
find connectors for Slack, Postgres, Google Drive, and more.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Manage context and memory
|
|
2
|
+
|
|
3
|
+
Control what Gemini CLI knows about you and your projects. In this guide, you'll
|
|
4
|
+
learn how to define project-wide rules with `GEMINI.md`, teach the agent
|
|
5
|
+
persistent facts, and inspect the active context.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
- Gemini CLI installed and authenticated.
|
|
10
|
+
- A project directory where you want to enforce specific rules.
|
|
11
|
+
|
|
12
|
+
## Why manage context?
|
|
13
|
+
|
|
14
|
+
Out of the box, Gemini CLI is smart but generic. It doesn't know your preferred
|
|
15
|
+
testing framework, your indentation style, or that you hate using `any` in
|
|
16
|
+
TypeScript. Context management solves this by giving the agent persistent
|
|
17
|
+
memory.
|
|
18
|
+
|
|
19
|
+
You'll use these features when you want to:
|
|
20
|
+
|
|
21
|
+
- **Enforce standards:** Ensure every generated file matches your team's style
|
|
22
|
+
guide.
|
|
23
|
+
- **Set a persona:** Tell the agent to act as a "Senior Rust Engineer" or "QA
|
|
24
|
+
Specialist."
|
|
25
|
+
- **Remember facts:** Save details like "My database port is 5432" so you don't
|
|
26
|
+
have to repeat them.
|
|
27
|
+
|
|
28
|
+
## How to define project-wide rules (GEMINI.md)
|
|
29
|
+
|
|
30
|
+
The most powerful way to control the agent's behavior is through `GEMINI.md`
|
|
31
|
+
files. These are Markdown files containing instructions that are automatically
|
|
32
|
+
loaded into every conversation.
|
|
33
|
+
|
|
34
|
+
### Scenario: Create a project context file
|
|
35
|
+
|
|
36
|
+
1. In the root of your project, create a file named `GEMINI.md`.
|
|
37
|
+
|
|
38
|
+
2. Add your instructions:
|
|
39
|
+
|
|
40
|
+
```markdown
|
|
41
|
+
# Project Instructions
|
|
42
|
+
|
|
43
|
+
- **Framework:** We use React with Vite.
|
|
44
|
+
- **Styling:** Use Tailwind CSS for all styling. Do not write custom CSS.
|
|
45
|
+
- **Testing:** All new components must include a Vitest unit test.
|
|
46
|
+
- **Tone:** Be concise. Don't explain basic React concepts.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
3. Start a new session. Gemini CLI will now know these rules automatically.
|
|
50
|
+
|
|
51
|
+
### Scenario: Using the hierarchy
|
|
52
|
+
|
|
53
|
+
Context is loaded hierarchically. This allows you to have general rules for
|
|
54
|
+
everything and specific rules for sub-projects.
|
|
55
|
+
|
|
56
|
+
1. **Global:** `~/.gemini/GEMINI.md` (Rules for _every_ project you work on).
|
|
57
|
+
2. **Project Root:** `./GEMINI.md` (Rules for the current repository).
|
|
58
|
+
3. **Subdirectory:** `./src/GEMINI.md` (Rules specific to the `src` folder).
|
|
59
|
+
|
|
60
|
+
**Example:** You might set "Always use strict typing" in your global config, but
|
|
61
|
+
"Use Python 3.11" only in your backend repository.
|
|
62
|
+
|
|
63
|
+
## How to teach the agent facts (Memory)
|
|
64
|
+
|
|
65
|
+
Sometimes you don't want to write a config file. You just want to tell the agent
|
|
66
|
+
something once and have it remember forever. You can do this naturally in chat.
|
|
67
|
+
|
|
68
|
+
### Scenario: Saving a memory
|
|
69
|
+
|
|
70
|
+
Just tell the agent to remember something.
|
|
71
|
+
|
|
72
|
+
**Prompt:** `Remember that I prefer using 'const' over 'let' wherever possible.`
|
|
73
|
+
|
|
74
|
+
The agent will use the `save_memory` tool to store this fact in your global
|
|
75
|
+
memory file.
|
|
76
|
+
|
|
77
|
+
**Prompt:** `Save the fact that the staging server IP is 10.0.0.5.`
|
|
78
|
+
|
|
79
|
+
### Scenario: Using memory in conversation
|
|
80
|
+
|
|
81
|
+
Once a fact is saved, you don't need to invoke it explicitly. The agent "knows"
|
|
82
|
+
it.
|
|
83
|
+
|
|
84
|
+
**Next Prompt:** `Write a script to deploy to staging.`
|
|
85
|
+
|
|
86
|
+
**Agent Response:** "I'll write a script to deploy to **10.0.0.5**..."
|
|
87
|
+
|
|
88
|
+
## How to manage and inspect context
|
|
89
|
+
|
|
90
|
+
As your project grows, you might want to see exactly what instructions the agent
|
|
91
|
+
is following.
|
|
92
|
+
|
|
93
|
+
### Scenario: View active context
|
|
94
|
+
|
|
95
|
+
To see the full, concatenated set of instructions currently loaded (from all
|
|
96
|
+
`GEMINI.md` files and saved memories), use the `/memory show` command.
|
|
97
|
+
|
|
98
|
+
**Command:** `/memory show`
|
|
99
|
+
|
|
100
|
+
This prints the raw text the model receives at the start of the session. It's
|
|
101
|
+
excellent for debugging why the agent might be ignoring a rule.
|
|
102
|
+
|
|
103
|
+
### Scenario: Refresh context
|
|
104
|
+
|
|
105
|
+
If you edit a `GEMINI.md` file while a session is running, the agent won't know
|
|
106
|
+
immediately. Force a reload with:
|
|
107
|
+
|
|
108
|
+
**Command:** `/memory refresh`
|
|
109
|
+
|
|
110
|
+
## Best practices
|
|
111
|
+
|
|
112
|
+
- **Keep it focused:** Don't dump your entire internal wiki into `GEMINI.md`.
|
|
113
|
+
Keep instructions actionable and relevant to code generation.
|
|
114
|
+
- **Use negative constraints:** Explicitly telling the agent what _not_ to do
|
|
115
|
+
(e.g., "Do not use class components") is often more effective than vague
|
|
116
|
+
positive instructions.
|
|
117
|
+
- **Review often:** Periodically check your `GEMINI.md` files to remove outdated
|
|
118
|
+
rules.
|
|
119
|
+
|
|
120
|
+
## Next steps
|
|
121
|
+
|
|
122
|
+
- Learn about [Session management](session-management.md) to see how short-term
|
|
123
|
+
history works.
|
|
124
|
+
- Explore the [Command reference](../../reference/commands.md) for more
|
|
125
|
+
`/memory` options.
|
|
126
|
+
- Read the technical spec for [Project context](../../cli/gemini-md.md).
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Manage sessions and history
|
|
2
|
+
|
|
3
|
+
Resume, browse, and rewind your conversations with Gemini CLI. In this guide,
|
|
4
|
+
you'll learn how to switch between tasks, manage your session history, and undo
|
|
5
|
+
mistakes using the rewind feature.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
- Gemini CLI installed and authenticated.
|
|
10
|
+
- At least one active or past session.
|
|
11
|
+
|
|
12
|
+
## How to resume where you left off
|
|
13
|
+
|
|
14
|
+
It's common to switch context—maybe you're waiting for a build and want to work
|
|
15
|
+
on a different feature. Gemini makes it easy to jump back in.
|
|
16
|
+
|
|
17
|
+
### Scenario: Resume the last session
|
|
18
|
+
|
|
19
|
+
The fastest way to pick up your most recent work is with the `--resume` flag (or
|
|
20
|
+
`-r`).
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
gemini -r
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This restores your chat history and memory, so you can say "Continue with the
|
|
27
|
+
next step" immediately.
|
|
28
|
+
|
|
29
|
+
### Scenario: Browse past sessions
|
|
30
|
+
|
|
31
|
+
If you want to find a specific conversation from yesterday, use the interactive
|
|
32
|
+
browser.
|
|
33
|
+
|
|
34
|
+
**Command:** `/resume`
|
|
35
|
+
|
|
36
|
+
This opens a searchable list of all your past sessions. You'll see:
|
|
37
|
+
|
|
38
|
+
- A timestamp (e.g., "2 hours ago").
|
|
39
|
+
- The first user message (helping you identify the topic).
|
|
40
|
+
- The number of turns in the conversation.
|
|
41
|
+
|
|
42
|
+
Select a session and press **Enter** to load it.
|
|
43
|
+
|
|
44
|
+
## How to manage your workspace
|
|
45
|
+
|
|
46
|
+
Over time, you'll accumulate a lot of history. Keeping your session list clean
|
|
47
|
+
helps you find what you need.
|
|
48
|
+
|
|
49
|
+
### Scenario: Deleting sessions
|
|
50
|
+
|
|
51
|
+
In the `/resume` browser, navigate to a session you no longer need and press
|
|
52
|
+
**x**. This permanently deletes the history for that specific conversation.
|
|
53
|
+
|
|
54
|
+
You can also manage sessions from the command line:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# List all sessions with their IDs
|
|
58
|
+
gemini --list-sessions
|
|
59
|
+
|
|
60
|
+
# Delete a specific session by ID or index
|
|
61
|
+
gemini --delete-session 1
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## How to rewind time (Undo mistakes)
|
|
65
|
+
|
|
66
|
+
Gemini CLI's **Rewind** feature is like `Ctrl+Z` for your workflow.
|
|
67
|
+
|
|
68
|
+
### Scenario: Triggering rewind
|
|
69
|
+
|
|
70
|
+
At any point in a chat, type `/rewind` or press **Esc** twice.
|
|
71
|
+
|
|
72
|
+
### Scenario: Choosing a restore point
|
|
73
|
+
|
|
74
|
+
You'll see a list of your recent interactions. Select the point _before_ the
|
|
75
|
+
undesired changes occurred.
|
|
76
|
+
|
|
77
|
+
### Scenario: Choosing what to revert
|
|
78
|
+
|
|
79
|
+
Gemini gives you granular control over the undo process. You can choose to:
|
|
80
|
+
|
|
81
|
+
1. **Rewind conversation:** Only remove the chat history. The files stay
|
|
82
|
+
changed. (Useful if the code is good but the chat got off track).
|
|
83
|
+
2. **Revert code changes:** Keep the chat history but undo the file edits.
|
|
84
|
+
(Useful if you want to keep the context but retry the implementation).
|
|
85
|
+
3. **Rewind both:** Restore everything to exactly how it was.
|
|
86
|
+
|
|
87
|
+
## How to fork conversations
|
|
88
|
+
|
|
89
|
+
Sometimes you want to try two different approaches to the same problem.
|
|
90
|
+
|
|
91
|
+
1. Start a session and get to a decision point.
|
|
92
|
+
2. Save the current state with `/chat save decision-point`.
|
|
93
|
+
3. Try your first approach.
|
|
94
|
+
4. Later, use `/chat resume decision-point` to fork the conversation back to
|
|
95
|
+
that moment and try a different approach.
|
|
96
|
+
|
|
97
|
+
This creates a new branch of history without losing your original work.
|
|
98
|
+
|
|
99
|
+
## Next steps
|
|
100
|
+
|
|
101
|
+
- Learn about [Checkpointing](../../cli/checkpointing.md) to understand the
|
|
102
|
+
underlying safety mechanism.
|
|
103
|
+
- Explore [Task planning](task-planning.md) to keep complex sessions organized.
|
|
104
|
+
- See the [Command reference](../../reference/commands.md) for all `/chat` and
|
|
105
|
+
`/resume` options.
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Execute shell commands
|
|
2
|
+
|
|
3
|
+
Use the CLI to run builds, manage git, and automate system tasks without leaving
|
|
4
|
+
the conversation. In this guide, you'll learn how to run commands directly,
|
|
5
|
+
automate complex workflows, and manage background processes safely.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
- Gemini CLI installed and authenticated.
|
|
10
|
+
- Basic familiarity with your system's shell (Bash, Zsh, PowerShell, etc.).
|
|
11
|
+
|
|
12
|
+
## How to run commands directly (`!`)
|
|
13
|
+
|
|
14
|
+
Sometimes you just need to check a file size or git status without asking the AI
|
|
15
|
+
to do it for you. You can pass commands directly to your shell using the `!`
|
|
16
|
+
prefix.
|
|
17
|
+
|
|
18
|
+
**Example:** `!ls -la`
|
|
19
|
+
|
|
20
|
+
This executes `ls -la` immediately and prints the output to your terminal. The
|
|
21
|
+
AI doesn't "see" this output unless you paste it back into the chat or use it in
|
|
22
|
+
a prompt.
|
|
23
|
+
|
|
24
|
+
### Scenario: Entering Shell mode
|
|
25
|
+
|
|
26
|
+
If you're doing a lot of manual work, toggle "Shell Mode" by typing `!` and
|
|
27
|
+
pressing **Enter**. Now, everything you type is sent to the shell until you exit
|
|
28
|
+
(usually by pressing **Esc** or typing `exit`).
|
|
29
|
+
|
|
30
|
+
## How to automate complex tasks
|
|
31
|
+
|
|
32
|
+
You can automate tasks using a combination of Gemini CLI and shell commands.
|
|
33
|
+
|
|
34
|
+
### Scenario: Run tests and fix failures
|
|
35
|
+
|
|
36
|
+
You want to run tests and fix any failures.
|
|
37
|
+
|
|
38
|
+
**Prompt:**
|
|
39
|
+
`Run the unit tests. If any fail, analyze the error and try to fix the code.`
|
|
40
|
+
|
|
41
|
+
**Workflow:**
|
|
42
|
+
|
|
43
|
+
1. Gemini calls `run_shell_command('npm test')`.
|
|
44
|
+
2. You see a confirmation prompt: `Allow command 'npm test'? [y/N]`.
|
|
45
|
+
3. You press `y`.
|
|
46
|
+
4. The tests run. If they fail, Gemini reads the error output.
|
|
47
|
+
5. Gemini uses `read_file` to inspect the failing test.
|
|
48
|
+
6. Gemini uses `replace` to fix the bug.
|
|
49
|
+
7. Gemini runs `npm test` again to verify the fix.
|
|
50
|
+
|
|
51
|
+
This loop turns Gemini into an autonomous engineer.
|
|
52
|
+
|
|
53
|
+
## How to manage background processes
|
|
54
|
+
|
|
55
|
+
You can ask Gemini to start long-running tasks, like development servers or file
|
|
56
|
+
watchers.
|
|
57
|
+
|
|
58
|
+
**Prompt:** `Start the React dev server in the background.`
|
|
59
|
+
|
|
60
|
+
Gemini will run the command (e.g., `npm run dev`) and detach it.
|
|
61
|
+
|
|
62
|
+
### Scenario: Viewing active shells
|
|
63
|
+
|
|
64
|
+
To see what's running in the background, use the `/shells` command.
|
|
65
|
+
|
|
66
|
+
**Command:** `/shells`
|
|
67
|
+
|
|
68
|
+
This opens a dashboard where you can view logs or kill runaway processes.
|
|
69
|
+
|
|
70
|
+
## How to handle interactive commands
|
|
71
|
+
|
|
72
|
+
Gemini CLI attempts to handle interactive commands (like `git add -p` or
|
|
73
|
+
confirmation prompts) by streaming the output to you. However, for highly
|
|
74
|
+
interactive tools (like `vim` or `top`), it's often better to run them yourself
|
|
75
|
+
in a separate terminal window or use the `!` prefix.
|
|
76
|
+
|
|
77
|
+
## Safety first
|
|
78
|
+
|
|
79
|
+
Giving an AI access to your shell is powerful but risky. Gemini CLI includes
|
|
80
|
+
several safety layers.
|
|
81
|
+
|
|
82
|
+
### Confirmation prompts
|
|
83
|
+
|
|
84
|
+
By default, **every** shell command requested by the agent requires your
|
|
85
|
+
explicit approval.
|
|
86
|
+
|
|
87
|
+
- **Allow once:** Runs the command one time.
|
|
88
|
+
- **Allow always:** Trusts this specific command for the rest of the session.
|
|
89
|
+
- **Deny:** Stops the agent.
|
|
90
|
+
|
|
91
|
+
### Sandboxing
|
|
92
|
+
|
|
93
|
+
For maximum security, especially when running untrusted code or exploring new
|
|
94
|
+
projects, we strongly recommend enabling Sandboxing. This runs all shell
|
|
95
|
+
commands inside a secure Docker container.
|
|
96
|
+
|
|
97
|
+
**Enable sandboxing:** Use the `--sandbox` flag when starting the CLI:
|
|
98
|
+
`gemini --sandbox`.
|
|
99
|
+
|
|
100
|
+
## Next steps
|
|
101
|
+
|
|
102
|
+
- Learn about [Sandboxing](../../cli/sandbox.md) to safely run destructive
|
|
103
|
+
commands.
|
|
104
|
+
- See the [Shell tool reference](../../tools/shell.md) for configuration options
|
|
105
|
+
like timeouts and working directories.
|
|
106
|
+
- Explore [Task planning](task-planning.md) to see how shell commands fit into
|
|
107
|
+
larger workflows.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Get started with Agent Skills
|
|
2
|
+
|
|
3
|
+
Agent Skills extend Gemini CLI with specialized expertise. In this guide, you'll
|
|
4
|
+
learn how to create your first skill, bundle custom scripts, and activate them
|
|
5
|
+
during a session.
|
|
6
|
+
|
|
7
|
+
## How to create a skill
|
|
8
|
+
|
|
9
|
+
A skill is defined by a directory containing a `SKILL.md` file. Let's create an
|
|
10
|
+
**API Auditor** skill that helps you verify if local or remote endpoints are
|
|
11
|
+
responding correctly.
|
|
12
|
+
|
|
13
|
+
### Create the directory structure
|
|
14
|
+
|
|
15
|
+
1. Run the following command to create the folders:
|
|
16
|
+
|
|
17
|
+
**macOS/Linux**
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
mkdir -p .gemini/skills/api-auditor/scripts
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Windows (PowerShell)**
|
|
24
|
+
|
|
25
|
+
```powershell
|
|
26
|
+
New-Item -ItemType Directory -Force -Path ".gemini\skills\api-auditor\scripts"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Create the definition
|
|
30
|
+
|
|
31
|
+
1. Create a file at `.gemini/skills/api-auditor/SKILL.md`. This tells the agent
|
|
32
|
+
_when_ to use the skill and _how_ to behave.
|
|
33
|
+
|
|
34
|
+
```markdown
|
|
35
|
+
---
|
|
36
|
+
name: api-auditor
|
|
37
|
+
description:
|
|
38
|
+
Expertise in auditing and testing API endpoints. Use when the user asks to
|
|
39
|
+
"check", "test", or "audit" a URL or API.
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
# API Auditor Instructions
|
|
43
|
+
|
|
44
|
+
You act as a QA engineer specialized in API reliability. When this skill is
|
|
45
|
+
active, you MUST:
|
|
46
|
+
|
|
47
|
+
1. **Audit**: Use the bundled `scripts/audit.js` utility to check the
|
|
48
|
+
status of the provided URL.
|
|
49
|
+
2. **Report**: Analyze the output (status codes, latency) and explain any
|
|
50
|
+
failures in plain English.
|
|
51
|
+
3. **Secure**: Remind the user if they are testing a sensitive endpoint
|
|
52
|
+
without an `https://` protocol.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Add the tool logic
|
|
56
|
+
|
|
57
|
+
Skills can bundle resources like scripts.
|
|
58
|
+
|
|
59
|
+
1. Create a file at `.gemini/skills/api-auditor/scripts/audit.js`. This is the
|
|
60
|
+
code the agent will run.
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
// .gemini/skills/api-auditor/scripts/audit.js
|
|
64
|
+
const url = process.argv[2];
|
|
65
|
+
|
|
66
|
+
if (!url) {
|
|
67
|
+
console.error('Usage: node audit.js <url>');
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
console.log(`Auditing ${url}...`);
|
|
72
|
+
fetch(url, { method: 'HEAD' })
|
|
73
|
+
.then((r) => console.log(`Result: Success (Status ${r.status})`))
|
|
74
|
+
.catch((e) => console.error(`Result: Failed (${e.message})`));
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## How to verify discovery
|
|
78
|
+
|
|
79
|
+
Gemini CLI automatically discovers skills in the `.gemini/skills` directory. You
|
|
80
|
+
can also use `.agents/skills` as a more generic alternative. Check that it found
|
|
81
|
+
your new skill.
|
|
82
|
+
|
|
83
|
+
**Command:** `/skills list`
|
|
84
|
+
|
|
85
|
+
You should see `api-auditor` in the list of available skills.
|
|
86
|
+
|
|
87
|
+
## How to use the skill
|
|
88
|
+
|
|
89
|
+
Now, try it out. Start a new session and ask a question that triggers the
|
|
90
|
+
skill's description.
|
|
91
|
+
|
|
92
|
+
**User:** "Can you audit http://geminicli.com"
|
|
93
|
+
|
|
94
|
+
Gemini recognizes the request matches the `api-auditor` description and asks for
|
|
95
|
+
permission to activate it.
|
|
96
|
+
|
|
97
|
+
**Model:** (After calling `activate_skill`) "I've activated the **api-auditor**
|
|
98
|
+
skill. I'll run the audit script now..."
|
|
99
|
+
|
|
100
|
+
Gemini then uses the `run_shell_command` tool to execute your bundled Node
|
|
101
|
+
script:
|
|
102
|
+
|
|
103
|
+
`node .gemini/skills/api-auditor/scripts/audit.js http://geminili.com`
|
|
104
|
+
|
|
105
|
+
## Next steps
|
|
106
|
+
|
|
107
|
+
- Explore the
|
|
108
|
+
[Agent Skills Authoring Guide](../../cli/skills.md#creating-a-skill) to learn
|
|
109
|
+
about more advanced features.
|
|
110
|
+
- Learn how to share skills via [Extensions](../../extensions/index.md).
|