wrangler-accounts
AWS-style multi-account convenience for Cloudflare Wrangler. Run commands against different Cloudflare accounts in parallel shells without switching global state.
wrangler-accounts login work # first-time setup (isolated)
wrangler-accounts default work # set persistent default
wrangler-accounts deploy # uses default profile
wrangler-accounts --profile personal deploy
wrangler-accounts exec personal -- npm run release
Two shells side by side, two different Cloudflare accounts, zero interference:
# terminal 1
wrangler-accounts --profile work tail my-worker
# terminal 2
wrangler-accounts --profile personal dev
New in 1.9.0: built on wrangler's native profiles
Wrangler 4.149 added its own named login profiles (wrangler auth create, wrangler --profile <name>, optional OS-keychain encryption). wrangler-accounts now builds on them without changing any command you already use:
wrangler-accounts migrate work # move an OAuth profile into wrangler's own profile store
wrangler-accounts protect work # encrypt its OAuth credentials (key in macOS Keychain / Linux secret-tool)
wrangler-accounts --profile work deploy # same as before
wrangler --profile work deploy # now also works directly
wrangler-accounts --profile work cf dns records list --zone example.com # Cloudflare's new `cf` CLI
- Two backends, one CLI. Profiles you don't migrate keep the shadow-HOME backend and work with any wrangler version. Migrated profiles run as
wrangler --profile <name>; exec, list --deep, whoami-style checks still isolate correctly (a bare wrangler or npm run deploy inside exec uses that profile only). Projects that lock an older wrangler (< 4.149) keep working too (1.9.2+): exec <name> -- npx wrangler ... also gets that profile's credentials as the old-style default.toml in the throw-away shadow HOME — an encrypted profile is decrypted into a 0600 file there for the run only, a refreshed token is re-encrypted back into <name>.enc, and the copy is deleted when the command exits (also on Ctrl-C).
migrate is opt-in and reversible. It copies the credentials, asks wrangler to read them back (wrangler auth token), and only then removes the old copy. --dry-run shows the plan, unmigrate moves it back. An existing wrangler profile with the same name is never overwritten without --force (and then it is backed up first). Names wrangler doesn't allow (acme.prod) become acme-prod, or pick one with --as.
- OAuth encryption at rest (#3).
protect <oauth-profile> migrates if needed and lets wrangler encrypt the credentials (<name>.enc, AES-256-GCM, key in the OS keychain). Verified: no plaintext file is left. unprotect decrypts it back. protect --all now covers token and OAuth profiles.
- cf support.
wrangler-accounts --profile <name> cf ... and exec <name> -- cf ... run Cloudflare's cf: token profiles get CLOUDFLARE_API_TOKEN/CLOUDFLARE_ACCOUNT_ID, OAuth profiles use cf's own login of the same name (cf auth create <name> once — cf and wrangler log in separately). The guard hook and PATH shim also cover a bare cf, only when it is Cloudflare's — Cloud Foundry's cf is never touched.
Do I still need wrangler-accounts?
If you only use OAuth logins, run wrangler by hand, and are happy typing --profile or binding directories with wrangler auth activate, native profiles alone are enough. wrangler-accounts adds:
- a persistent default and
WRANGLER_PROFILE for scripts, plus positional shorthand (wrangler-accounts work deploy)
- API-token profiles next to OAuth ones (and their tokens in the keychain)
- stripping of exported
CLOUDFLARE_API_TOKEN / CLOUDFLARE_ACCOUNT_ID, which otherwise silently override or redirect --profile; the profile's own account id is exported for account-scoped commands
exec <name> subshells where every wrangler (including npx/npm run) and cf use that account
- guard rails for AI agents: the Claude Code hook and the
wrangler/cf PATH shim
list --deep health checks, notes, JSON output, and the same commands for old wrangler versions
Things to know about wrangler's keyring mode