CLI Overview
Install, authenticate, and use environment-scoped secret workflows from your terminal
Envault CLI
The Envault CLI is the fastest way to work with project secrets across development, preview, and production without leaving your terminal.
Installation
Universal Script (Recommended)
The easiest way to install Envault on macOS and Linux.
curl -fsSL https://raw.githubusercontent.com/DinanathDash/Envault/main/install.sh | shHomebrew (macOS & Linux)
If you use Homebrew, you can install Envault via our official tap.
brew tap DinanathDash/envault
brew install envaultJS Package Managers
Envault is available as an NPM package, allowing you to use it with any Node.js package manager.
npm install -g @dinanathdash/envaultpnpm add -g @dinanathdash/envaultyarn global add @dinanathdash/envaultbun add -g @dinanathdash/envaultYou can also run it directly without global install:
npx @dinanathdash/envault <command>Global Flags
All commands accept these global flags:
--config <path>: Use a specific config file instead of~/.envault/config.toml-e, --env <slug>: Target environment (development,preview,production, or any valid project environment slug)-v, --version: Print CLI version
Quick Workflow
# 1) Authenticate once
envault login
# 2) Link current directory to a project
envault init
# 3) Inspect current context (user, role, project, environment)
envault status
# 4) Pull one environment to local file
envault pull --env preview --file .env.preview
# 5) Compare local vs remote before deploy
envault diff --env preview --file .env.preview
# 6) Deploy to target environment
envault deploy --env preview --file .env.previewSee Commands for full details.
If a project has GitHub Integration enabled, envault pull can auto-grant
Viewer access for repository collaborators (Just-in-Time access) before
returning secrets.
Environment-Scoped Local Files
When a command needs a local env file (pull, diff, deploy), Envault resolves file path in this order:
--fileenvault env map --env <slug> --file <path>- Auto-detected
.env*candidate in current directory (example/sample/template files are ignored) - Fallback
.env
Recommended setup:
envault env map --env development --file .env.development
envault env map --env preview --file .env.preview
envault env map --env production --file .env.production
envault env default --env developmentThen run commands without repeating --file.
Command Index
envault login: authenticate via device flowenvault init: link current directory to a projectenvault status: show auth/project/environment contextenvault pull: fetch remote secrets into local fileenvault diff: show local vs remote key/value driftenvault deployorenvault push: push local secrets to remoteenvault run -- <cmd>: run a command with injected secretsenvault env map|unmap|default: manage local file mappings/default envenvault versionorenvault --version: print versionenvault completion <shell>: generate shell completion
Authentication & Sessions
Envault CLI relies on secure Device Flow for interactive authentication. When you run envault login:
- A 30-day Refresh Token is generated and saved securely in your native OS Secure Enclave (macOS Keychain, Windows Credential Manager, or Linux Secret Service).
- A 1-hour Access Token is stored in your configuration file (
~/.envault/config.toml).
The CLI features an Auto-Refresh Interceptor. If your access token expires, the CLI silently securely requests a new one using your keyring refresh token and retries your command without failing, creating a seamless rolling session.
Automatic Updates
Envault performs a non-blocking update check after commands and shows a hint when a newer release is available.
Environment Variables
The Envault CLI uses the following environment variables for configuration:
| Variable | Description | Default |
|---|---|---|
ENVAULT_CLI_URL | The URL of the Envault API server. | https://envault.tech/api/cli |
ENVAULT_CONFIG_FILE | Path to a custom configuration file. | ~/.envault/config.toml |
Using Local Instance
To test against a local instance of Envault:
export ENVAULT_CLI_URL="https://envault.localhost:1355/api/cli"
envault loginInsecure http:// URLs are blocked by default. Use an HTTPS base URL for
ENVAULT_CLI_URL.