View on GitHub

glasp

A Go CLI tool for managing Google Apps Script projects. Single-binary, high-performance clasp alternative.

Usage

Commands

Command Alias Description
login   Log in to Google account
logout   Log out from Google account
create-script create Create a new Apps Script project
clone   Clone an existing Apps Script project
pull   Download project files from Apps Script
push   Upload project files to Apps Script
open-script open Open the Apps Script project in browser
create-deployment   Create a deployment
update-deployment deploy Update an existing deployment
list-deployments   List deployments
run-function   Run an Apps Script function remotely
convert   Convert project files (TS ↔ GAS)
history   Show command execution history
config init   Create .glasp/config.json
version   Show version

Push

glasp push              # Push local files
glasp push --force      # Ignore .claspignore (.glasp/ is always excluded)
glasp push --archive    # Archive pushed files
glasp push --dryrun     # Dry run without API calls

TypeScript Support

glasp automatically detects and transpiles .ts files on push, regardless of fileExtension setting in .clasp.json.

History Replay

glasp push --history-id <id>          # Re-push from archive
glasp push --history-id <id> --dryrun # Dry run replay

Pull

glasp pull              # Pull remote files
glasp pull --archive    # Archive pulled files

When fileExtension is "ts", pulled files are automatically converted from GAS JavaScript to TypeScript.

Authentication

Auth tokens are stored at .glasp/access.json (permission 0600).

# A browser opens automatically to start the login flow
glasp login

PKCE

Enable OAuth2 PKCE (RFC 7636) to protect against authorization code interception attacks:

glasp login --pkce

# Or via environment variable
GLASP_USE_PKCE=1 glasp login

PKCE applies only to the interactive glasp login flow.

Reuse clasp credentials

# Reuse clasp credentials. They are imported via `glasp login` and saved to `.glasp/access.json`.
glasp login --auth ~/.clasprc.json

# Or use --auth directly on each command
glasp push --auth ~/.clasprc.json
glasp pull --auth ~/.clasprc.json
glasp clone SCRIPT_ID --auth ~/.clasprc.json

Start using glasp immediately when migrating from clasp — no re-authentication needed.

Auth source priority

  1. --auth flag (path to .clasprc.json)
  2. Project cache (.glasp/access.json)
  3. Interactive login flow

Timeout

You can configure the HTTP request timeout for Script API calls. The default is 180 seconds.

Priority

  1. --no-timeout flag / GLASP_NO_TIMEOUT environment variable (unlimited)
  2. --timeout flag / GLASP_TIMEOUT environment variable
  3. timeoutSeconds in .glasp/config.json
  4. Default (180 seconds)

A value of 0 means unset and falls back to the next source. Negative values are invalid: they are ignored and a warning is printed (use --no-timeout to disable the timeout).

Configuration

# Set via CLI flag (seconds)
glasp push --timeout 60

# Set via environment variable
GLASP_TIMEOUT=60 glasp push

# Disable timeout (unlimited)
glasp push --no-timeout

# Disable timeout via environment variable
GLASP_NO_TIMEOUT=1 glasp push

You can also set a project-wide value in .glasp/config.json:

{
  "archive": { "pull": false, "push": false },
  "timeoutSeconds": 60
}

Retry

glasp retries transient Script API failures (HTTP 5xx, 429, network errors) automatically. Retries apply only to idempotent commands: push, pull, list-deployments, and clone. Non-idempotent commands (create-script, create-deployment, update-deployment, run-function) are never retried to prevent duplicate resource creation.

The default retry count is 3 retries (4 total attempts including the initial attempt).

Priority

  1. --max-retries flag / GLASP_MAX_RETRIES environment variable
  2. maxRetries in .glasp/config.json
  3. Default (3)

A value of 0 means unset and falls back to the next source. Negative values are invalid: they are ignored and a warning is printed. To disable retries entirely, use --no-retries.

Note: --no-timeout and --no-retries are independent. --no-timeout does not disable retries. http.Client.Timeout (set by --timeout) is a budget for the entire request chain including retries — a short timeout may prevent retries from running.

Configuration

# Increase retry count
glasp push --max-retries 5

# Set via environment variable
GLASP_MAX_RETRIES=5 glasp push

# Disable retries
glasp push --no-retries

# Disable retries via environment variable
GLASP_NO_RETRIES=1 glasp push

You can also set a project-wide value in .glasp/config.json:

{
  "archive": { "pull": false, "push": false },
  "timeoutSeconds": 60,
  "maxRetries": 5
}

Logging

glasp writes diagnostic logs (warnings, fallback notices, debug traces) to stderr in a structured format. Command results (e.g. Pulled project ...) are regular output and are not affected by these settings.

Options

# Show OAuth flow progress and other debug traces
glasp login --log-level debug

# Emit machine-readable JSON logs (useful in CI)
GLASP_LOG_FORMAT=json glasp push

# Suppress warnings, show errors only
glasp pull --log-level error

Example output:

# text (default)
time=2026-07-09T10:00:00.000+09:00 level=WARN msg="failed to load .glasp/config.json; using default timeout" default=3m0s

# json
{"time":"2026-07-09T10:00:00+09:00","level":"WARN","msg":"failed to load .glasp/config.json; using default timeout","default":"3m0s"}

Note: OAuth login progress messages (state validation, authorization code receipt) are logged at debug level and hidden by default. Essential instructions — such as the URL to open when the browser cannot be launched — are always printed regardless of the log level.

Configuration

.clasp.json

Standard clasp configuration file. glasp reads the same format:

{
  "scriptId": "your-script-id",
  "rootDir": "src",
  "fileExtension": "ts"
}

.claspignore

Gitignore syntax for excluding files. glasp default excludes:

Convert

glasp convert --gas-to-ts              # GAS JS → TypeScript
glasp convert --ts-to-gas              # TypeScript → GAS JS
glasp convert --ts-to-gas src/main.ts  # Convert specific files

History

glasp history                          # Show all history
glasp history --limit 10               # Last 10 entries
glasp history --status success         # Filter by status
glasp history --command push           # Filter by command
glasp history --order asc              # Oldest first (default: desc)