Skip to content

Commit ebfcd7e

Browse files
committed
feat: add Claude Code plugin config and marketplace
1 parent 57b0b56 commit ebfcd7e

3 files changed

Lines changed: 257 additions & 69 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "spanner-marketplace",
3+
"interface": {
4+
"displayName": "Spanner Agent Skills"
5+
},
6+
"plugins": [
7+
{
8+
"name": "spanner",
9+
"source": {
10+
"source": "git",
11+
"url": "https://github.com/gemini-cli-extensions/spanner.git"
12+
},
13+
"policy": {
14+
"installation": "AVAILABLE",
15+
"authentication": "ON_INSTALL"
16+
},
17+
"category": "Database"
18+
}
19+
]
20+
}

.claude-plugin/plugin.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "spanner",
3+
"version": "0.2.6",
4+
"description": "Connect and interact with Spanner data using natural language.",
5+
"author": {
6+
"name": "Google LLC",
7+
"email": "data-cloud-ai-integrations@google.com"
8+
},
9+
"homepage": "https://cloud.google.com/spanner",
10+
"license": "Apache-2.0",
11+
"repository": "https://github.com/gemini-cli-extensions/spanner",
12+
"skills": "./skills/",
13+
"userConfig": {
14+
"spanner_project": {
15+
"title": "Project ID",
16+
"description": "ID of the Google Cloud project",
17+
"type": "string",
18+
"sensitive": false
19+
},
20+
"spanner_instance": {
21+
"title": "Instance",
22+
"description": "ID of the Spanner instance",
23+
"type": "string",
24+
"sensitive": false
25+
},
26+
"spanner_database": {
27+
"title": "Database",
28+
"description": "ID of the Spanner database",
29+
"type": "string",
30+
"sensitive": false
31+
},
32+
"spanner_dialect": {
33+
"title": "Database Dialect",
34+
"description": "(Optional) The SQL dialect of the Spanner Database: 'googlesql' or 'postgresql'. (Default: 'googlesql')",
35+
"type": "string",
36+
"sensitive": false
37+
}
38+
}
39+
}

README.md

Lines changed: 198 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,251 @@
1-
# Gemini CLI Extension - Spanner
1+
# Spanner Agent Skills
22

33
> [!NOTE]
4-
> This extension is currently in beta (pre-v1.0), and may see breaking changes until the first stable release (v1.0).
4+
> Currently in beta (pre-v1.0), and may see breaking changes until the first stable release (v1.0).
55
6-
This Gemini CLI extension provides a set of tools to interact with [Google Cloud Spanner](https://cloud.google.com/spanner/docs) instances. It allows you to manage your databases, execute queries, and explore schemas directly from the [Gemini CLI](https://google-gemini.github.io/gemini-cli/), using natural language prompts.
6+
This repository provides a set of agent skills to interact with [Google Cloud Spanner](https://cloud.google.com/spanner/docs) instances. These skills can be used with various AI agents, including [Gemini CLI](https://google-gemini.github.io/gemini-cli/), Claude Code, and Codex, to manage your databases, execute queries, explore schemas, and troubleshoot issues using natural language prompts.
77

8-
Learn more about [Gemini CLI Extensions](https://github.com/google-gemini/gemini-cli/blob/main/docs/extensions/index.md).
98
> [!IMPORTANT]
109
> **We Want Your Feedback!**
11-
> Please share your thoughts with us by filling out our feedback [form][form].
10+
> Please share your thoughts with us by filling out our feedback [form][form].
1211
> Your input is invaluable and helps us improve the project for everyone.
1312
1413
[form]: https://docs.google.com/forms/d/e/1FAIpQLSfEGmLR46iipyNTgwTmIDJqzkAwDPXxbocpXpUbHXydiN1RTw/viewform?usp=pp_url&entry.157487=spanner
1514

16-
## Why Use the Spanner Extension?
17-
18-
* **Natural Language Management:** Stop wrestling with complex commands. Explore schemas and query data by describing what you want in plain English.
19-
* **Seamless Workflow:** As a Google-developed extension, it integrates seamlessly into the Gemini CLI environment. No need to constantly switch contexts for common database tasks.
20-
* **Code Generation:** Accelerate development by asking Gemini to generate data classes and other code snippets based on your table schemas.
21-
15+
## Table of Contents
16+
17+
- [Why Use Spanner Agent Skills?](#why-use-spanner-agent-skills)
18+
- [Prerequisites](#prerequisites)
19+
- [Getting Started](#getting-started)
20+
- [Configuration](#configuration)
21+
- [Installation & Usage](#installation--usage)
22+
- [Gemini CLI](#gemini-cli)
23+
- [Claude Code](#claude-code)
24+
- [Codex](#codex)
25+
- [Antigravity](#antigravity)
26+
- [Usage Examples](#usage-examples)
27+
- [Supported Skills](#supported-skills)
28+
- [Additional Agent Skills](#additional-agent-skills)
29+
- [Troubleshooting](#troubleshooting)
30+
31+
## Why Use Spanner Agent Skills?
32+
33+
- **Seamless Workflow:** Integrates seamlessly into your AI agent's environment. No need to constantly switch contexts for common database tasks.
34+
- **Natural Language Queries:** Stop wrestling with complex commands. Explore schemas and query data by describing what you want in plain English.
35+
- **Full Lifecycle Control:** Manage your Spanner databases, from exploring schemas to running queries.
36+
- **Code Generation:** Accelerate development by asking your agent to generate data classes and other code snippets based on your table schemas.
2237

2338
## Prerequisites
2439

2540
Before you begin, ensure you have the following:
2641

27-
* [Gemini CLI](https://github.com/google-gemini/gemini-cli) installed with version **+v0.6.0**.
28-
* Setup Gemini CLI [Authentication](https://github.com/google-gemini/gemini-cli/tree/main?tab=readme-ov-file#-authentication-options).
29-
* A Google Cloud project with the **Spanner API** enabled.
30-
* Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
31-
* IAM Permissions
32-
* Cloud Spanner Database Reader (`roles/spanner.databaseReader`)
33-
* Cloud Spanner Database User (`roles/spanner.databaseUser`)
42+
- One of these AI agents installed
43+
- [Gemini CLI](https://github.com/google-gemini/gemini-cli) version **v0.6.0** or higher
44+
- [Claude Code](https://claude.com/product/claude-code) version **v2.1.94** or higher
45+
- [Codex](https://developers.openai.com/codex) **v0.117.0** or higher
46+
- [Antigravity](https://antigravity.google) **v1.14.2** or higher
47+
- A Google Cloud project with the **Spanner API** enabled.
48+
- Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
49+
- IAM Permissions:
50+
- Cloud Spanner Database Reader (`roles/spanner.databaseReader`)
51+
- Cloud Spanner Database User (`roles/spanner.databaseUser`)
3452

3553
## Getting Started
3654

37-
### Installation
55+
### Configuration
3856

39-
To install the extension, use the command:
57+
Please keep these env vars handy during the installation process:
4058

41-
```bash
42-
gemini extensions install https://github.com/gemini-cli-extensions/spanner
43-
```
59+
- `SPANNER_PROJECT`: The GCP project ID.
60+
- `SPANNER_INSTANCE`: The Spanner instance ID.
61+
- `SPANNER_DATABASE`: The Spanner database ID.
62+
- `SPANNER_DIALECT`: (Optional) The SQL dialect of the Spanner Database: 'googlesql' or 'postgresql'. Defaults to "googlesql".
4463

45-
### Configuration
64+
> [!NOTE]
65+
>
66+
> - Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
4667
47-
You will be prompted to configure the following settings during installation. These settings are saved in an `.env` file within the extension's directory.
68+
### Installation & Usage
4869

49-
* `SPANNER_PROJECT`: The GCP project ID.
50-
* `SPANNER_INSTANCE`: The Spanner instance ID.
51-
* `SPANNER_DATABASE`: The Spanner database ID.
52-
* `SPANNER_DIALECT`: (Optional) The SQL dialect of the Spanner database: 'googlesql' or 'postgresql'. Defaults to "googlesql".
70+
To start interacting with your database, install the skills for your preferred AI agent, then launch the agent and use natural language to ask questions or perform tasks.
5371

54-
To view or update your configuration:
72+
For the latest version, check the [releases page][releases].
5573

56-
**List Settings:**
57-
* Terminal: `gemini extensions list`
58-
* Gemini CLI: `/extensions list`
74+
[releases]: https://github.com/gemini-cli-extensions/spanner/releases
5975

60-
**Update Settings:**
61-
* Terminal: `gemini extensions config spanner [setting name] [--scope <scope>]`
62-
* `setting name`: (Optional) The single setting to configure.
63-
* `scope`: (Optional) The scope of the setting in (`user` or `workspace`). Defaults to `user`.
64-
* Currently, you must restart the Gemini CLI for changes to take effect. We recommend using `gemini --resume` to resume your session.
76+
<!-- {x-release-please-start-version} -->
6577

66-
Alternatively, you can manually set these environment variables before starting the Gemini CLI:
78+
<details open>
79+
<summary id="gemini-cli">Gemini CLI</summary>
80+
81+
**1. Install the extension:**
6782

6883
```bash
69-
export SPANNER_PROJECT="<your-gcp-project-id>"
70-
export SPANNER_INSTANCE="<your-spanner-instance-id>"
71-
export SPANNER_DATABASE="<your-spanner-database-id>"
72-
export SPANNER_DIALECT="googlesql" # Optional: "googlesql" or "postgresql". Defaults to "googlesql".
84+
gemini extensions install https://github.com/gemini-cli-extensions/spanner
7385
```
7486

75-
> [!NOTE]
76-
> * Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
77-
> * See [Troubleshooting](#troubleshooting) for debugging your configuration.
87+
During the installation, enter your environment vars as described in the [configuration section](#configuration).
88+
89+
**2. (Optional) Manage Configuration:**
90+
To view or update your configuration in Gemini CLI:
7891

79-
### Start Gemini CLI
92+
- Terminal: `gemini extensions config spanner [setting name] [--scope <scope>]`
93+
- Gemini CLI: `/extensions list`
8094

81-
To start the Gemini CLI, use the following command:
95+
**3. Start the agent:**
8296

8397
```bash
8498
gemini
8599
```
86100

101+
_(Tip: Run `/extensions list` to verify your configuration and active extensions.)_
102+
87103
> [!WARNING]
88104
> **Changing Instance & Database Connections**
89-
> Currently, the database connection must be configured before starting the Gemini CLI and can not be changed during a session.
90-
> To save and resume conversation history use command: `/chat save <tag>` and `/chat resume <tag>`.
105+
> Currently, the database connection must be configured before starting the agent and can not be changed during a session.
106+
> To save and resume conversation history in Gemini CLI use command: `/chat save <tag>` and `/chat resume <tag>`.
107+
108+
</details>
109+
110+
<details>
111+
<summary id="claude-code">Claude Code</summary>
112+
113+
**1. Set env vars:**
114+
In your terminal, set your environment vars as described in the [configuration section](#configuration).
115+
116+
**2. Start the agent:**
117+
118+
```bash
119+
claude
120+
```
121+
122+
**3. Add the marketplace:**
123+
124+
```bash
125+
/plugin marketplace add https://github.com/gemini-cli-extensions/spanner.git#0.2.6
126+
```
127+
128+
**4. Install the plugin:**
129+
130+
```bash
131+
/plugin install spanner@spanner-marketplace
132+
```
133+
134+
_(Tip: Run `/plugin list` inside Claude Code to verify the plugin is active, or `/reload-plugins` if you just installed it.)_
135+
136+
</details>
137+
138+
<details>
139+
<summary id="codex">Codex</summary>
140+
141+
**1. Clone the Repo:**
142+
143+
```bash
144+
git clone --branch 0.2.6 git@github.com:gemini-cli-extensions/spanner.git
145+
```
146+
147+
**2. Install the plugin:**
148+
149+
```bash
150+
mkdir -p ~/.codex/plugins
151+
cp -R /absolute/path/to/spanner ~/.codex/plugins/spanner
152+
```
153+
154+
**3. Set env vars:**
155+
Enter your environment vars as described in the [configuration section](#configuration).
156+
157+
**4. Create or update marketplace.json:**
158+
`~/.agents/plugins/marketplace.json`
159+
160+
```json
161+
{
162+
"name": "my-data-cloud-google-marketplace",
163+
"interface": {
164+
"displayName": "Google Data Cloud Skills"
165+
},
166+
"plugins": [
167+
{
168+
"name": "spanner",
169+
"source": {
170+
"source": "local",
171+
"path": "./plugins/spanner"
172+
},
173+
"policy": {
174+
"installation": "AVAILABLE",
175+
"authentication": "ON_INSTALL"
176+
},
177+
"category": "Database"
178+
}
179+
]
180+
}
181+
```
182+
183+
_(Tip: Run `codex plugin list` or use the `/plugins` interactive menu to verify your installed plugins.)_
184+
185+
</details>
186+
187+
<details>
188+
<summary id="antigravity">Antigravity</summary>
189+
190+
**1. Clone the Repo:**
191+
192+
```bash
193+
git clone --branch 0.2.6 https://github.com/gemini-cli-extensions/spanner.git
194+
```
195+
196+
**2. Install the skills:**
197+
198+
Choose a location for the skills:
199+
- **Global (all workspaces):** `~/.gemini/antigravity/skills/`
200+
- **Workspace-specific:** `<workspace-root>/.agents/skills/`
201+
202+
Copy the skill folders from the cloned repository's `skills/` directory to your chosen location:
203+
204+
```bash
205+
cp -R spanner/skills/* ~/.gemini/antigravity/skills/
206+
```
207+
208+
**3. Set env vars:**
209+
Set your environment vars as described in the [configuration section](#configuration).
210+
211+
_(Tip: Antigravity automatically discovers skills in these directories at the start of a session.)_
212+
213+
</details>
214+
215+
<!-- {x-release-please-end} -->
216+
217+
## Usage Examples
218+
219+
Interact with Spanner using natural language:
91220

92-
## Usage
221+
- **Explore Schemas and Data:**
222+
- "Show me all tables in the 'orders' database."
223+
- "What are the columns in the 'products' table?"
224+
- "How many orders were placed in the last 30 days, and what were the top 5 most purchased items?"
225+
- **Generate Code:**
226+
- "Generate a Python dataclass to represent the 'customers' table."
93227

94-
* **Explore Schemas and Data:**
95-
* "Show me all tables in the 'orders' database."
96-
* "What are the columns in the 'products' table?"
97-
* "How many orders were placed in the last 30 days, and what were the top 5 most purchased items?"
228+
## Supported Skills
98229

99-
* **Generate Code:**
100-
* "Generate a Python dataclass to represent the 'customers' tab
230+
The following skills are available in this repository:
101231

102-
## Supported Tools
232+
- [Spanner Data](./skills/spanner-data/SKILL.md) - Use these skills when you need to explore the database structure, discover schema objects like tables and graphs, and execute custom SQL queries to interact with your data.
103233

104-
* `list_tables`: Use this tool to list tables and descriptions.
105-
* `list_graphs`: Use this tool to lists graphs in the database.
106-
* `execute_sql`: Use this tool to execute any SQL statement.
107-
* `execute_sql_dql`: Use this tool to execute DQL SQL statement.
234+
## Additional Agent Skills
108235

109-
## Additional Extensions
236+
Find additional skills to support your entire software development lifecycle at [github.com/gemini-cli-extensions](https://github.com/gemini-cli-extensions), including:
110237

111-
Find additional extensions to support your entire software development lifecycle at [github.com/gemini-cli-extensions](https://github.com/gemini-cli-extensions).
238+
- [Generic PostgreSQL skills](https://github.com/gemini-cli-extensions/postgres)
239+
- [Cloud SQL for PostgreSQL skills](https://github.com/gemini-cli-extensions/cloud-sql-postgresql)
240+
- and more!
112241

113242
## Troubleshooting
114243

115-
Use `gemini --debug` to enable debugging.
244+
Use the debug mode of your agent (e.g., `gemini --debug`) to enable debugging.
116245

117246
Common issues:
118247

119-
* "failed to find default credentials: google: could not find default credentials.": Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment. See [Set up Application Default Credentials](https://cloud.google.com/docs/authentication/external/set-up-adc) for more information.
120-
* "✖ Error during discovery for server: MCP error -32000: Connection closed": The database connection has not been established. Ensure your configuration is set via environment variables.
121-
* "✖ MCP ERROR: Error: spawn /Users/USER/.gemini/extensions/spanner/toolbox ENOENT": The Toolbox binary did not download correctly. Ensure you are using Gemini CLI v0.6.0+.
122-
* "cannot execute binary file": The Toolbox binary did not download correctly. Ensure the correct binary for your OS/Architecture has been downloaded. See [Installing the server](https://mcp-toolbox.dev/documentation/introduction/#install-toolbox) for more information.
248+
- "failed to find default credentials: google: could not find default credentials.": Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment. See [Set up Application Default Credentials](https://cloud.google.com/docs/authentication/external/set-up-adc) for more information.
249+
- "✖ Error during discovery for server: MCP error -32000: Connection closed": The database connection has not been established. Ensure your configuration is set via environment variables.
250+
- "✖ MCP ERROR: Error: spawn .../toolbox ENOENT": The Toolbox binary did not download correctly. Ensure you are using the latest version of your agent.
251+
- "cannot execute binary file": The Toolbox binary did not download correctly. Ensure the correct binary for your OS/Architecture has been downloaded. See [Installing the server](https://mcp-toolbox.dev/documentation/introduction/#install-toolbox) for more information.

0 commit comments

Comments
 (0)