Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 2 additions & 109 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ for this purpose.

### Self Assigning Issues

If you're looking for an issue to work on, check out our list of issues that are labeled ["help wanted"](https://github.com/google-gemini/gemini-cli-workspace/issues?q=is%3Aissue+state%3Aopen+label%3A%22help+wanted%22).
If you're looking for an issue to work on, check out our list of issues that are labeled ["help wanted"](https://github.com/gemini-cli-extensions/workspace/issues?q=is%3Aissue+state%3Aopen+label%3A%22help+wanted%22).

To assign an issue to yourself, simply add a comment with the text `/assign`. The comment must contain only that text and nothing else. This command will assign the issue to you, provided it is not already assigned.

Expand Down Expand Up @@ -80,111 +80,4 @@ In the PR description, explain the "why" behind your changes and link to the rel

## Development Setup and Workflow

This section guides contributors on how to build, modify, and understand the development setup of this project.

### Setting Up the Development Environment

**Prerequisites:**

1. **Node.js**:
- **Development:** Please use Node.js `~20.19.0`. This specific version is required due to an upstream development dependency issue. You can use a tool like [nvm](https://github.com/nvm-sh/nvm) to manage Node.js versions.
- **Production:** For running the CLI in a production environment, any version of Node.js `>=20` is acceptable.
2. **Git**

### Build Process

To clone the repository:

```bash
git clone https://github.com/google-gemini/gemini-cli-workspace.git # Or your fork's URL
cd gemini-cli-workspace
```

To install dependencies defined in `package.json` as well as root dependencies:

```bash
npm install
```

To build the entire project (all packages):

```bash
npm run build
```

This command typically compiles TypeScript to JavaScript, bundles assets, and prepares the packages for execution. Refer to `scripts/build.js` and `package.json` scripts for more details on what happens during the build.

### Running Tests

This project contains unit tests.

#### Unit Tests

To execute the unit test suite for the project:

```bash
npm run test
```

This will run tests located in the `workspace-mcp-server/src/__tests__` directory. Ensure tests pass before submitting any changes. For a more comprehensive check, it is recommended to run `npm run test && npm run lint`.

### Linting and Style Checks

To ensure code quality and formatting consistency, run the linter and tests:

```bash
npm run test && npm run lint
```

This command will run ESLint, Prettier, all tests, and other checks as defined in the project's `package.json`.

_ProTip_

after cloning create a git precommit hook file to ensure your commits are always clean.

```bash
echo "
# Run npm build and check for errors
#!/bin/sh
# Run tests and linting before commit
if ! (npm run test && npm run lint); then
echo "Pre-commit checks failed. Commit aborted."
exit 1
fi
" > .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit
```

#### Formatting

To separately format the code in this project by running the following command from the root directory:

```bash
npm run format
```

This command uses Prettier to format the code according to the project's style guidelines.

#### Linting

To separately lint the code in this project, run the following command from the root directory:

```bash
npm run lint
```

### Coding Conventions

- Please adhere to the coding style, patterns, and conventions used throughout the existing codebase.
- Consult [GEMINI.md](https://github.com/google-gemini/gemini-cli-workspace/blob/main/GEMINI.md) (typically found in the project root) for specific instructions related to AI-assisted development, including conventions for comments, and Git usage.
- **Imports:** Pay special attention to import paths. The project uses ESLint to enforce restrictions on relative imports between packages.

### Project Structure

- `workspace-mcp-server/`: The main workspace for the MCP server.
- `src/`: Contains the source code for the server.
- `__tests__/`: Contains all the tests.
- `auth/`: Handles authentication.
- `services/`: Contains the business logic for each service.
- `utils/`: Contains utility functions.
- `config/`: Contains configuration files.
- `scripts/`: Utility scripts for building, testing, and development tasks.
For information on how to build, modify, and understand the development setup of this project, please see the [development documentation](docs/development.md).
56 changes: 38 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,57 @@
# Gemini Workspace Extension
# Google Workspace Extension for Gemini CLI

[![Build Status](https://github.com/google-gemini/gemini-cli-workspace/actions/workflows/ci.yml/badge.svg)](https://github.com/google-gemini/gemini-cli-workspace/actions/workflows/ci.yml)
[![Build Status](https://github.com/gemini-cli-extensions/workspace/actions/workflows/ci.yml/badge.svg)](https://github.com/gemini-cli-extensions/workspace/actions/workflows/ci.yml)

Google Workspace MCP Server Extension.
The Google Workspace extension for Gemini CLI brings the power of your Google Workspace apps to your command line. Manage your documents, spreadsheets, presentations, emails, chat, and calendar events without leaving your terminal.

This project is a Gemini extension that provides tools for interacting with Google Workspace services like Google Docs, Google Sheets, Google Slides, Google Calendar, Gmail, and Google Drive.
## Prerequisites

Before using the Google Workspace extension, you need to be logged into your Google account.

## Installation

To install the dependencies, run the following command:
Install the Google Workspace extension by running the following command from your terminal:

```bash
npm install
gemini extensions install https://github.com/gemini-cli-extensions/workspace
Comment thread
allenhutchison marked this conversation as resolved.
```

## Usage

To build the project, run the following command:
Once the extension is installed, you can use it to interact with your Google Workspace apps. Here are a few examples:

```bash
npm run build
```
**Create a new Google Doc:**

To run the tests, run the following command:
> "Create a new Google Doc with the title 'My New Doc' and the content '# My New Document\n\nThis is a new document created from the command line.'"

```bash
npm run test
```
**List your upcoming calendar events:**

To start the server, run the following command:
> "What's on my calendar for today?"

```bash
npm start
```
**Search for a file in Google Drive:**

> "Find the file named 'my-file.txt' in my Google Drive."

## Commands

This extension provides a variety of commands. Here are a few examples:

### Get Schedule

**Command:** `/calendar:get-schedule [date]`

Shows your schedule for today or a specified date.

### Search Drive

**Command:** `/drive:search <query>`

Searches your Google Drive for files matching the given query.

## Resources

- [Documentation](docs/index.md): Detailed documentation on all the available tools.
- [GitHub Issues](https://github.com/gemini-cli-extensions/workspace/issues): Report bugs or request features.

## Important security consideration: Indirect Prompt Injection Risk

Expand All @@ -55,3 +74,4 @@ Contributions are welcome! Please read the [CONTRIBUTING.md](CONTRIBUTING.md) fi
- **Terms of Service**: [Terms of Service](https://policies.google.com/terms)
- **Privacy Policy**: [Privacy Policy](https://policies.google.com/privacy)
- **Security**: [Security Policy](SECURITY.md)

131 changes: 131 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Development

This document provides instructions for developing the Google Workspace extension.

## Development Setup and Workflow

This section guides contributors on how to build, modify, and understand the development setup of this project.

### Setting Up the Development Environment

**Prerequisites:**

1. **Node.js**:
- **Development:** Please use Node.js `~20.19.0`. This specific version is required due to an upstream development dependency issue. You can use a tool like [nvm](https://github.com/nvm-sh/nvm) to manage Node.js versions.
- **Production:** For running the CLI in a production environment, any version of Node.js `>=20` is acceptable.
2. **Git**

### Build Process

To clone the repository:

```bash
git clone https://github.com/gemini-cli-extensions/workspace.git # Or your fork's URL
cd workspace
```

To install dependencies defined in `package.json` as well as root dependencies:

```bash
npm install
```

To build the entire project (all packages):

```bash
npm run build
```

This command typically compiles TypeScript to JavaScript, bundles assets, and prepares the packages for execution. Refer to `scripts/build.js` and `package.json` scripts for more details on what happens during the build.

### Running Tests

This project contains unit tests.

#### Unit Tests

To execute the unit test suite for the project:

```bash
npm run test
```

This will run tests located in the `workspace-mcp-server/src/__tests__` directory. Ensure tests pass before submitting any changes. For a more comprehensive check, it is recommended to run `npm run test && npm run lint`.

### Linting and Style Checks

To ensure code quality and formatting consistency, run the linter and tests:

```bash
npm run test && npm run lint
```

This command will run ESLint, Prettier, all tests, and other checks as defined in the project's `package.json`.

_ProTip_

after cloning create a git precommit hook file to ensure your commits are always clean.

cat <<'EOF' > .git/hooks/pre-commit
#!/bin/sh
# Run tests and linting before commit
if ! (npm run test && npm run lint); then
echo "Pre-commit checks failed. Commit aborted."
exit 1
fi
EOF
chmod +x .git/hooks/pre-commit

#### Formatting

To separately format the code in this project by running the following command from the root directory:

```bash
npm run format
```

This command uses Prettier to format the code according to the project's style guidelines.

#### Linting

To separately lint the code in this project, run the following command from the root directory:

```bash
npm run lint
```

### Coding Conventions

- Please adhere to the coding style, patterns, and conventions used throughout the existing codebase.
- Consult [GEMINI.md](https://github.com/gemini-cli-extensions/workspace/blob/main/GEMINI.md) (typically found in the project root) for specific instructions related to AI-assisted development, including conventions for comments, and Git usage.
- **Imports:** Pay special attention to import paths. The project uses ESLint to enforce restrictions on relative imports between packages.

### Project Structure

- `workspace-mcp-server/`: The main workspace for the MCP server.
- `src/`: Contains the source code for the server.
- `__tests__/`: Contains all the tests.
- `auth/`: Handles authentication.
- `services/`: Contains the business logic for each service.
- `utils/`: Contains utility functions.
- `config/`: Contains configuration files.
- `scripts/`: Utility scripts for building, testing, and development tasks.

## Authentication

The extension uses OAuth 2.0 to authenticate with Google Workspace APIs. The `scripts/auth-utils.js` script provides a command-line interface to manage authentication credentials.

### Usage

To use the script, run the following command:

```bash
node scripts/auth-utils.js <command>
```

### Commands

- `clear`: Clear all authentication credentials.
- `expire`: Force the access token to expire (for testing refresh).
- `status`: Show current authentication status.
- `help`: Show the help message.
Loading
Loading