phase cli
ฮป phase --help
Keep Secrets.
/$$
| $$
/$$$$$$ | $$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$
/$$__ $$| $$__ $$ |____ $$ /$$_____/ /$$__ $$
| $$ \ $$| $$ \ $$ /$$$$$$$| $$$$$$ | $$$$$$$$
| $$ | $$| $$ | $$ /$$__ $$ \____ $$| $$_____/
| $$$$$$$/| $$ | $$| $$$$$$$ /$$$$$$$/| $$$$$$$
| $$____/ |__/ |__/ \_______/|_______/ \_______/
| $$
|__/
Commands:
auth ๐ป Authenticate with Phase
init ๐ Link your project with your Phase app
run ๐ Run and inject secrets to your app
shell ๐ Launch a sub-shell with secrets as environment variables
apps list ๐ฑ List available apps and their environments
secrets list ๐ List all the secrets
secrets get ๐ Fetch details about one or more secrets in JSON
secrets create ๐ณ Create a new secret
secrets update ๐ Update an existing secret
secrets delete ๐๏ธ Delete secrets
secrets import ๐ฉ Import secrets from a .env file
secrets export ๐ฅก Export secrets in a specific format
dynamic-secrets list ๐ List dynamic secrets & metadata
dynamic-secrets lease generate โจ Generate a lease (create fresh dynamic secret)
dynamic-secrets lease get ๐ Get leases for a dynamic secret
dynamic-secrets lease renew ๐ Renew a lease
dynamic-secrets lease revoke ๐๏ธ Revoke a lease
users whoami ๐ See details of the current user
users switch ๐ช Switch between Phase users, orgs and hosts
users logout ๐ Logout from phase-cli
users keyring ๐ Display information about the Phase keyring
ai enable ๐ช Enable AI integrations and configure secret visibility
ai disable ๐ซ Disable AI integrations and remove skill docs
ai skill ๐ Print the Phase AI skill document
console ๐ฅ๏ธ Open the Phase Console in your browser
docs ๐ Open the Phase CLI Docs in your browser
completion โจ๏ธ Generate the autocompletion script for the specified shell
Flags:
-h, --help help for phase
-v, --version version for phase
Features
- End-to-end encryption โ secrets are encrypted client-side before leaving your machine
- Secret types โ
config (non-sensitive), secret (sensitive), and sealed (write-only) with enforced visibility rules
phase run โ inject secrets as environment variables into any command without code changes
phase shell โ launch a sub-shell (bash, zsh, fish, etc.) with secrets preloaded
- Dynamic secrets โ generate short-lived credentials (e.g. AWS IAM) with automatic lease management (generate, renew, revoke)
- Secret references โ reference secrets across environments and apps, resolved automatically at runtime
- Personal overrides โ override shared secrets locally without affecting your team
- Import / Export โ import from
.env files; export to dotenv, JSON, YAML, TOML, CSV, XML, HCL, INI, Java properties, and more
- Path-based organisation โ organise secrets in hierarchical paths for monorepos and microservices
- Tagging โ tag secrets and filter operations by tag
- Random secret generation โ generate hex, alphanumeric, base64, base64url, 128-bit, or 256-bit keys on create or update
- AI agent integration โ skill-based integration with Claude Code, Cursor, VS Code Copilot, Codex, and OpenCode with automatic value redaction and safety guardrails
- Multiple auth methods โ web-based login, personal access tokens, service account tokens, and AWS IAM identity auth
- Multi-user & multi-org โ switch between Phase accounts, orgs, and self-hosted instances
- OS keyring integration โ credentials stored in macOS Keychain, GNOME Keyring, or Windows Credential Manager
- Multiple environments โ dev, staging, production, and custom environments with per-project defaults via
phase init
Installation
You can install Phase CLI using curl:
curl -fsSL https://pkg.phase.dev/install.sh | bash
Usage
Prerequisites
Login
phase auth
Initialize
Link the Phase CLI to your project:
phase init
Or non-interactively:
phase apps list # find your app ID
phase init --app-id "your-app-id" --env Development
Import .env (optional)
Import and encrypt existing secrets and environment variables:
phase secrets import .env
List / view secrets
phase secrets list --show
Run and inject secrets
phase run 'npm start'
phase run 'go run main.go'
phase run --env production 'python manage.py runserver'
AI integration
Enable AI agent support (installs a skill doc for your AI coding tool):
phase ai enable
This installs the Phase skill to your chosen AI tool (Claude Code, Cursor, VS Code Copilot, Codex, or OpenCode) and configures secret visibility. Sealed secrets are never revealed to AI agents regardless of settings.
Development
Prerequisites
Project structure
src/
โโโ main.go # Entrypoint
โโโ cmd/ # Cobra command definitions
โโโ pkg/
โ โโโ ai/ # AI agent detection, skill doc, redaction
โ โโโ config/ # Config file handling (~/.phase/, .phase.json)
โ โโโ display/ # Output formatting (tree view, tables)
โ โโโ errors/ # Error types
โ โโโ keyring/ # OS keyring integration
โ โโโ phase/ # Phase client helpers (auth, init)
โ โโโ util/ # Misc utilities (color, spinner, browser)
โ โโโ version/ # Version constant
โโโ go.mod
Run from source
cd src
go run main.go --help
Build a binary
cd src
go build -o phase .
./phase --version
You can set the version at build time with -ldflags:
go build -ldflags "-X github.com/phasehq/cli/pkg/version.Version=2.0.0" -o phase .
Install locally (development)
Build and install to /usr/local/bin so phase is available globally:
cd src
sudo go build -o /usr/local/bin/phase .
phase --version
Or if $GOPATH/bin is in your $PATH:
cd src
go build -o $(go env GOPATH)/bin/phase .
Run tests
cd src
go test ./...
Local SDK development
The CLI uses the Phase Go SDK via a replace directive in go.mod. To develop against a local copy of the SDK:
// go.mod
replace github.com/phasehq/golang-sdk/v2 => /path/to/your/golang-sdk