A collection of bash scripts that simplify deploying Google Apps Script projects using clasp. Includes multi-account credential management for seamlessly switching between Google accounts without repeated logins.
If you work with multiple Google Apps Script projects across different Google accounts, you know the pain of constantly running clasp login to switch accounts. This toolset solves that problem by:
- Storing credentials for each Google account separately
- Automatically switching to the correct account based on project configuration
- Providing an interactive UI for managing accounts
| Script | Description |
|---|---|
claspalt |
Multi-account credential manager - use instead of clasp |
claspdeploy |
Deployment script with named deployment management |
git clone https://github.com/yourusername/claspdeploy.git
cd claspdeploy
./install.shThis installs claspalt and claspdeploy to ~/bin/ and creates the credentials directory at ~/.config/claspalt/.
# In any clasp project directory:
claspalt push # Push code using the configured account
claspdeploy "Bug fix" # Push and deploy with a descriptionOn first run, you'll be prompted to select or create an account.
claspalt is a drop-in replacement for clasp that automatically switches to the correct Google account before running any clasp command.
claspalt [OPTIONS]
claspalt [CLASP_COMMANDS...]
OPTIONS:
-h, --help Show help message
-l, --list List all saved accounts
-e, --edit Open interactive account manager
List all accounts:
claspalt --listOutput:
account-personal
account-work (active)
account-client
The (active) marker shows which account is configured for the current project directory.
Interactive account manager:
claspalt --editOpens a terminal UI where you can:
- Navigate with arrow keys (↑/↓)
- Select accounts with Space
- Add new accounts with
A - Delete selected accounts with
D - Quit with
Q
══════════════════════════════════════════
CLASPALT - Account Management
══════════════════════════════════════════
> [ ] 1. account-personal
[x] 2. account-work
[ ] 3. account-client
──────────────────────────────────────────
[A]dd [D]elete selected [Q]uit
Space: select/deselect
↑/↓: navigate
──────────────────────────────────────────
Use claspalt exactly like you would use clasp:
claspalt push # Push code
claspalt pull # Pull code
claspalt deployments # List deployments
claspalt open # Open in browser
claspalt status # Show statusWhen you run claspalt in a new project:
- You'll see a list of existing accounts (if any)
- Select an account number or press
Nto create a new one - For new accounts:
- Enter a name (e.g., "work", "personal", "client-abc")
- Make sure the correct browser profile is active
- Complete the Google OAuth flow
- The account is saved and associated with the project
~/.config/claspalt/
├── work.json # Credentials for "work" account
├── personal.json # Credentials for "personal" account
└── client-abc.json # Credentials for "client-abc" account
your-project/
└── claspConfig.txt # Contains: account=work, deploymentId=...
When you run claspalt push:
- Reads
claspConfig.txtto find the account name - Copies
~/.config/claspalt/work.jsonto~/.clasprc.json - Runs
clasp push
claspdeploy solves a common problem when developing Google Apps Script web apps: keeping the same URL across multiple deployments.
When you run clasp deploy, it creates a new deployment with a new URL. But during development, you want to test with a consistent URL that you can bookmark or share. claspdeploy saves your deployment ID and reuses it on every deploy, so your web app URL stays the same after each clasp push.
Main use case: Managing multiple named deployments (e.g., production and development) so you can keep stable URLs and switch between them easily.
claspdeploy combines clasp push and clasp deploy into a single command, managing your deployment IDs automatically.
claspdeploy [OPTIONS] [DESCRIPTION]| Option | Description |
|---|---|
-h, --help |
Show help message |
-y, --yes |
Skip confirmation and deployment selection prompts (for CI/CD) |
-n, --dry-run |
Preview without deploying |
-l, --log |
Enable logging to deployment.log |
-ld, --list-deployments |
List all named deployments for this project |
-dd, --delete-deployment |
Delete a named deployment |
# Basic deployment
claspdeploy "Fixed authentication bug"
# CI/CD deployment (no prompts)
claspdeploy --yes "Automated deployment"
# Preview what would happen
claspdeploy --dry-run "Testing"
# Deploy with logging
claspdeploy --log "Version 2.0"You can store multiple named deployment IDs per project. During each interactive deploy, you are prompted to select, switch, or create a deployment:
🚀 Deployment activo: prod — AKfycbwXXXXXXXXXXXXXXXX
Pulsa Enter para usar el deployment actual, S para seleccionar otro, N para crear uno nuevo:
- Enter — deploy using the active deployment
- S — open a selection menu to pick or register a deployment
- N — create a new deployment on the server and name it
# List all named deployments
claspdeploy --list-deployments
# Delete a named deployment
claspdeploy --delete-deploymentOn first run in a new project:
- Select or create a Google account (via claspalt)
- View available deployments from the server
- Name and select a deployment to use
- Configuration is saved to
claspConfig.txt
Each project has a claspConfig.txt file:
account=work
activeDeployment=prod
deployment_prod=AKfycbwXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
deployment_dev=AKfycbwYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
deploymentId=AKfycbwXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
activeDeployment— name of the currently active deploymentdeployment_{name}— named deployment ID entriesdeploymentId— backward-compatible mirror of the active deployment's ID
From single deploymentId: If your project has only a deploymentId= entry (no named deployments), you'll be prompted to assign it a name on first interactive run.
From deploymentId.txt: If your project has an old deploymentId.txt file, it will be automatically migrated on first run:
- You'll select an account
claspConfig.txtis created with both valuesdeploymentId.txtis deleted
- clasp - Google's Apps Script CLI
- Bash shell (works with macOS default bash 3.2+)
- A Google Apps Script project configured with clasp (
.clasp.jsonpresent)
npm install -g @google/clasp
clasp login # Initial login (claspalt will manage accounts after this)Install clasp with npm install -g @google/clasp
Delete the account file and recreate:
rm ~/.config/claspalt/accountname.json
claspalt # Will prompt to recreateCheck which account is configured:
claspalt --list
cat claspConfig.txtThe --edit option requires an interactive terminal. It won't work when piped or in non-TTY contexts.
MIT License - feel free to use and modify.