Local CLI to manage multiple Cloudflare Wrangler login profiles by saving and swapping the Wrangler config file.
- Save the current Wrangler config as a named profile
- Switch between profiles by copying a saved config into place
- List or inspect status (active profile and matching profile)
- Optional automatic backups when switching
npm i -g @leeguoo/wrangler-accountsFrom this repo:
npm linkOr run directly:
node bin/wrangler-accounts.js <command>wrangler-accounts list
wrangler-accounts status
wrangler-accounts login work
wrangler-accounts save work
wrangler-accounts use personal
wrangler-accounts remove old-c, --config <path> Wrangler config path
-p, --profiles <path> Profiles directory
--json JSON output for list/status
--plain Plain output for list (one name per line)
-f, --force Overwrite existing profile on save
--backup Backup current config on use (default)
--no-backup Disable backup on use
- WRANGLER_CONFIG_PATH
- WRANGLER_ACCOUNTS_DIR
- XDG_CONFIG_HOME
If you do not specify a config path, the CLI checks for these and uses the first existing path:
- ~/.wrangler/config/default.toml
- ~/Library/Preferences/.wrangler/config/default.toml
- ~/.config/.wrangler/config/default.toml
- ~/.config/wrangler/config/default.toml
The profiles directory defaults to:
- $XDG_CONFIG_HOME/wrangler-accounts (if set)
- ~/.config/wrangler-accounts
- Profile names accept only letters, numbers, dot, underscore, and dash.
- On
use, the current config is backed up into__backup-YYYYMMDD-HHMMSSunless you pass--no-backup. login <name>overwrites an existing profile with the same name.
mkdir -p ~/.zsh/completions
cp $(pnpm root -g)/@leeguoo/wrangler-accounts/completions/wrangler-accounts.zsh ~/.zsh/completions/_wrangler-accountsThen add to your ~/.zshrc:
fpath=(~/.zsh/completions $fpath)
autoload -Uz compinit && compinit