Skip to content

Commit 18b3482

Browse files
authored
Merge branch 'main' into renovate/googleapis-genai-toolbox-0.x
2 parents 6379237 + 881500c commit 18b3482

3 files changed

Lines changed: 137 additions & 12 deletions

File tree

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ body:
3838
- label: "I've updated to the latest versions"
3939

4040
- type: input
41-
id: version
41+
id: ex_version
4242
attributes:
4343
label: Extension Version
4444
description: |

DEVELOPER.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# DEVELOPER.md
2+
3+
This document provides instructions for setting up your development environment
4+
and contributing to the Spanner Gemini CLI Extension project.
5+
6+
## Prerequisites
7+
8+
Before you begin, ensure you have the following:
9+
10+
1. **Gemini CLI:** Install the Gemini CLI version v0.6.0 or above. Installation
11+
instructions can be found on the official Gemini CLI documentation. You can
12+
verify your version by running `gemini --version`.
13+
2. **Spanner Instance:** For testing data plane tools, you will need access to an active Spanner instance and database.
14+
15+
## Developing the Extension
16+
17+
### Running from Local Source
18+
19+
The core logic for this extension is handled by a pre-built `toolbox` binary. The development process involves installing the extension locally into the Gemini CLI to test changes.
20+
21+
1. **Clone the Repository:**
22+
23+
```bash
24+
git clone https://github.com/gemini-cli-extensions/spanner.git
25+
cd spanner
26+
```
27+
28+
2. **Download the Toolbox Binary:** The required version of the `toolbox` binary
29+
is specified in `toolbox_version.txt`. Download it for your platform.
30+
31+
```bash
32+
# Read the required version
33+
VERSION=$(cat toolbox_version.txt)
34+
35+
# Example for macOS/amd64
36+
curl -L -o toolbox https://storage.googleapis.com/genai-toolbox/v$VERSION/darwin/amd64/toolbox
37+
chmod +x toolbox
38+
```
39+
Adjust the URL for your operating system (`linux/amd64`, `darwin/arm64`, `windows/amd64`).
40+
41+
3. **Install the Extension Locally:** Use the Gemini CLI to install the
42+
extension from your local directory.
43+
44+
```bash
45+
gemini extensions install .
46+
gemini extensions link .
47+
```
48+
The CLI will prompt you to confirm the installation. Accept it to proceed.
49+
50+
4. **Testing Changes:** After installation, start the Gemini CLI (`gemini`).
51+
You can now interact with the `spanner` tools to manually test your changes
52+
against your connected database.
53+
54+
## Testing
55+
56+
### Automated Presubmit Checks
57+
58+
A GitHub Actions workflow (`.github/workflows/presubmit-tests.yml`) is triggered
59+
for every pull request. This workflow primarily verifies that the extension can
60+
be successfully installed by the Gemini CLI.
61+
62+
Currently, there are no automated unit or integration test suites
63+
within this repository. All functional testing must be performed manually. All tools
64+
are currently tested in the [MCP Toolbox GitHub](https://github.com/googleapis/genai-toolbox).
65+
66+
### Other GitHub Checks
67+
68+
* **License Header Check:** A workflow ensures all necessary files contain the
69+
proper license header.
70+
* **Conventional Commits:** This repository uses
71+
[Release Please](https://github.com/googleapis/release-please) to manage
72+
releases. Your commit messages must adhere to the
73+
[Conventional Commits](https://www.conventionalcommits.org/) specification.
74+
* **Dependency Updates:** [Renovate](https://github.com/apps/forking-renovate)
75+
is configured to automatically create pull requests for dependency updates.
76+
77+
## Building the Extension
78+
79+
The "build" process for this extension involves packaging the extension's
80+
metadata files (`gemini-extension.json`, `spanner.md`, `LICENSE`) along with the
81+
pre-built `toolbox` binary into platform-specific archives (`.tar.gz` or `.zip`).
82+
83+
This process is handled automatically by the
84+
[`package-and-upload-assets.yml`](.github/workflows/package-and-upload-assets.yml)
85+
GitHub Actions workflow when a new release is created. Manual building is not
86+
required.
87+
88+
## Maintainer Information
89+
90+
### Team
91+
92+
The primary maintainers for this repository are defined in the
93+
[`.github/CODEOWNERS`](.github/CODEOWNERS) file:
94+
95+
* `@gemini-cli-extensions/senseai-eco`
96+
* `@gemini-cli-extensions/spanner-maintainers`
97+
98+
### Releasing
99+
100+
The release process is automated using `release-please`.
101+
102+
1. **Release PR:** When commits with conventional commit headers (e.g., `feat:`,
103+
`fix:`) are merged into the `main` branch, `release-please` will
104+
automatically create or update a "Release PR".
105+
2. **Merge Release PR:** A maintainer approves and merges the Release PR. This
106+
action triggers `release-please` to create a new GitHub tag and a
107+
corresponding GitHub Release.
108+
3. **Package and Upload:** The new release triggers the
109+
`package-and-upload-assets.yml` workflow. This workflow builds the
110+
platform-specific extension archives and uploads them as assets to the
111+
GitHub Release.

README.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,29 @@
66
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.
77

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

1016
## Why Use the Spanner Extension?
1117

1218
* **Natural Language Management:** Stop wrestling with complex commands. Explore schemas and query data by describing what you want in plain English.
1319
* **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.
1420
* **Code Generation:** Accelerate development by asking Gemini to generate data classes and other code snippets based on your table schemas.
1521

22+
1623
## Prerequisites
1724

1825
Before you begin, ensure you have the following:
1926

20-
* [Gemini CLI](https://github.com/google-gemini/gemini-cli) installed with version **+v0.6.0**.
21-
* A Google Cloud project with the **Spanner API** enabled.
22-
* IAM Permissions
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
2332
* Cloud Spanner Database Reader (`roles/spanner.databaseReader`)
2433
* Cloud Spanner Database User (`roles/spanner.databaseUser`)
2534

@@ -35,12 +44,12 @@ gemini extensions install https://github.com/gemini-cli-extensions/spanner
3544

3645
### Configuration
3746

38-
Set the following environment variables before starting the Gemini CLI:
47+
Set the following environment variables before starting the Gemini CLI. These variables can be loaded from a `.env` file.
3948

40-
* `SPANNER_PROJECT`: The GCP project ID.
41-
* `SPANNER_INSTANCE`: The Spanner instance ID.
42-
* `SPANNER_DATABASE`: The Spanner database ID.
43-
* `SPANNER_DIALECT`: (Optional) The Spanner database dialect e.g. "googlesql" or "postgresql" (Default: "googlesql")
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 Spanner database dialect e.g. "googlesql" or "postgresql" (Default: "googlesql")
4453

4554
Ensure [Application Default Credentials](https://cloud.google.com/docs/authentication/gcloud) are available in your environment.
4655

@@ -59,12 +68,12 @@ gemini
5968
6069
## Usage
6170

62-
* **Explore Schemas and Data:**
71+
* **Explore Schemas and Data:**
6372
* "Show me all tables in the 'orders' database."
6473
* "What are the columns in the 'products' table?"
6574
* "How many orders were placed in the last 30 days, and what were the top 5 most purchased items?"
6675

67-
* **Generate Code:**
76+
* **Generate Code:**
6877
* "Generate a Python dataclass to represent the 'customers' tab
6978

7079
## Supported Tools
@@ -79,6 +88,11 @@ Find additional extensions to support your entire software development lifecycle
7988

8089
## Troubleshooting
8190

91+
Use `gemini --debug` to enable debugging.
92+
93+
Common issues:
94+
95+
* "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.
8296
* "✖ 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.
83-
* "✖ 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+.
97+
* "✖ 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+.
8498
* "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://googleapis.github.io/genai-toolbox/getting-started/introduction/#installing-the-server) for more information.

0 commit comments

Comments
 (0)