Airsc miễn phí cho tất cả. Nếu nó giúp bạn, hãy ủng hộ $2–$20.

Ủng hộ
SkillAn toànKết nối & tự động hoáCần cài đặt chút

cli

googleworkspace · googleworkspace/cli

Một giao diện dòng lệnh cho các API của Google Workspace bao gồm hơn 40 skill AI agent để quản lý Drive, Gmail, Calendar và nhiều hơn nữa.

Google Workspace CLI — one command-line tool for Drive, Gmail, Calendar, Sheets, Docs, Chat, Admin, and more. Dynamically built from Google Discovery Service. Includes AI agent skills.

31k sao1.9kGiấy phép: Apache-2.0Cập nhật 12 ngày trước0 lượt mở

Xem trước

▍

Bạn có thể làm gì với nó

  • Tự động tạo sự kiện lịch hoặc gửi email dựa trên hướng dẫn của AI agent.
  • Cho phép một AI agent tìm kiếm và truy xuất các tài liệu cụ thể từ Google Drive.
  • Xây dựng quy trình làm việc tùy chỉnh nơi AI tương tác với Google Sheets hoặc Docs.

Thử hỏi agent của bạn

  • “Sử dụng `gws` để liệt kê tất cả các tệp trong Google Drive của tôi đã được sửa đổi tuần trước.”
  • “Yêu cầu agent gửi email tới 'team@example.com' với chủ đề 'Báo cáo hàng tuần' và đính kèm một Google Doc tên là 'Q3 Performance'.”
  • “Cấu hình xác thực `gws` và sau đó tạo một Google Sheet mới tên là 'Project Budget 2024'.”

Kiểm tra an toàn

An toàn

Không thấy dấu hiệu rủi ro trong các file đã quét.

Quét tự động các file trong repo. Luôn xem lại code trước khi chạy.

Trích từ README

gws

One CLI for all of Google Workspace — built for humans and AI agents. Drive, Gmail, Calendar, and every Workspace API. Zero boilerplate. Structured JSON output. 40+ agent skills included.

[!NOTE] This is not an officially supported Google product.

⬇️ Download the latest release for your OS

gws doesn't ship a static list of commands. It reads Google's own Discovery Service at runtime and builds its entire command surface dynamically. When Google Workspace adds an API endpoint or method, gws picks it up automatically.

[!IMPORTANT] This project is under active development. Expect breaking changes as we march toward v1.0.

Contents

Prerequisites

  • Node.js 18+ — for npm install (or download a pre-built binary from GitHub Releases)
  • A Google Cloud project — required for OAuth credentials. You can create one via the Google Cloud Console or with the gcloud CLI or with the gws auth setup command.
  • A Google account with access to Google Workspace

Installation

The recommended way to install gws is to download the pre-built binary for your OS and architecture from the GitHub Releases page. Extract the archive and place the gws binary in your $PATH.

For convenience, you can also use npm to automate downloading the appropriate binary from GitHub Releases:

npm install -g @googleworkspace/cli

Or build from source:

cargo install --git https://github.com/googleworkspace/cli --locked

A Nix flake is also available at github:googleworkspace/cli

nix run github:googleworkspace/cli

On macOS and Linux, you can also install via Homebrew:

brew install googleworkspace-cli

Quick Start

gws auth setup     # walks you through Google Cloud project config
gws auth login     # subsequent OAuth login
gws drive files list --params '{"pageSize": 5}'

Why gws?

For humans — stop writing curl calls against REST docs. gws gives you --help on every resource, --dry-run to preview requests, and auto‑pagination.

For AI agents — every response is structured JSON. Pair it with the included agent skills and your LLM can manage Workspace without custom tooling.

# List the 10 most recent files
gws drive files list --params '{"pageSize": 10}'

# Create a spreadsheet
gws sheets spreadsheets create --json '{"properties": {"title": "Q1 Budget"}}'

# Send a Chat message
gws chat spaces messages create \
  --params '{"parent": "spaces/xyz"}' \
  --json '{"text": "Deploy complete."}' \
  --dry-run

# Introspect any method's request/response schema
gws schema drive.files.list

# Stream paginated results as NDJSON
gws drive files list --params '{"pageSize": 100}' --page-all | jq -r '.files[].name'

Authentication

The CLI supports multiple auth workflows so it works on your laptop, in CI, and on a server.

Which setup should I use?

I have…Use
gcloud installed and authenticatedgws auth setup (fastest)
A GCP project but no gcloudManual OAuth setup
An existing OAuth access tokenGOOGLE_WORKSPACE_CLI_TOKEN
Existing CredentialsGOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE

Interactive (local desktop)

Credentials are encrypted at rest (AES-256-GCM) with the key stored in your OS keyring (or ~/.config/gws/.encryption_key when GOOGLE_WORKSPACE_CLI_KEYRING_BACKEND=file).

gws auth setup       # one-time: creates a Cloud project, enables APIs, logs you in
gws auth login       # subsequent scope selection and login

gws auth setup requires the gcloud CLI. If you don't have gcloud, use the manual setup below instead.

[!WARNING] Scope limits in testing mode: If your OAuth app is unverified (testing mode), Google limits consent to ~25 scopes. The recommended scope preset includes 85+ scopes and will fail for unverified apps (especially for @gmail.com accounts). Choose individual services instead to filter the scope picker:

gws auth login -s drive,gmail,sheets

Manual OAuth setup (Google Cloud Console)

Use this when gws auth setup cannot automate project/client creation, or when you want explicit control.

  1. Open Google Cloud Console in the target project:
    • OAuth consent screen: https://console.cloud.google.com/apis/credentials/consent?project=
    • Credentials: https://console.cloud.google.com/apis/credentials?project=
  2. Configure OAuth branding/audience if prompted:
    • App type: External (testing mode is fine)
  3. Add your account under Test users
  4. Create an OAuth client:
    • Type: Desktop app
  5. Download the client JSON and save it to:
    • ~/.config/gws/client_secret.json

[!IMPORTANT] You must add yourself as a test user. In the OAuth consent screen, click Test users → Add users and enter your Google account email. Without this, login will fail with a generic "Access blocked" error.

Then run:

gws auth login

Browser-assisted auth (human or agent)

You c

Xem mã nguồn trên GitHub