Command Reference
Complete reference for all xenvsync commands, flags, and usage examples.
Quick Reference
| Command | Alias | Description |
|---|---|---|
| init | — | Generates a cryptographically secure 256-bit AES key, saves it to |
| push | encrypt | Reads the plaintext |
| pull | decrypt | Reads the encrypted |
| run | — | Decrypts the vault in-memory and spawns a child process with the decrypted variables merged into the environment |
| diff | — | Decrypts the vault and compares its contents to the current |
| status | — | Reports the presence and last-modified time of |
| envs | — | Scans the current directory for |
| export | — | Decrypts the vault and writes variables to stdout in the specified format |
| team add | — | Registers a team member by name and their X25519 public key (base64-encoded, as shown by 'xenvsync whoami') |
| team remove | — | Removes a team member from the project roster by name, revoking their ability to decrypt future vaults |
| team list | — | Displays all team members in the project roster with their public keys and the date they were added |
| doctor | — | Audits the local xenvsync setup for security issues |
| verify | — | Validates vault file structural integrity, performs GCM authentication to detect tampering, checks for duplicate keys in |
| log | — | Parses Git history for commits that modified the vault file and displays a timeline of changes |
| rotate | — | Rotates the encryption key and re-encrypts the vault in one atomic step |
| keygen | — | Generates an X25519 keypair and stores the private key in ~/ |
| whoami | — | Reads your X25519 private key from ~/ |
| completion | — | Generates shell completion scripts for bash, zsh, fish, or powershell |
| version | — | Prints the version, commit hash, and build date |
init
Generates a cryptographically secure 256-bit AES key, saves it to .xenvsync.key with owner-only permissions (0600), and ensures the key file and .env are in .gitignore.
Usage
xenvsync init [flags]Flags
| --force, -f | Overwrite existing key file (regenerate key) |
| --passphrase | Encrypt the key file with a passphrase (requires XENVSYNC_PASSPHRASE env var) |
Example
push
alias: encryptReads the plaintext .env file, encrypts it using AES-256-GCM, and writes the ciphertext to .env.vault. The vault file is safe to commit to version control.
Usage
xenvsync push [flags]Flags
| --env | Environment name (e.g., staging, production) |
| --file, -e | Path to the .env file (default: .env) |
| --out, -o | Path to the output vault file (default: .env.vault) |
| --no-fallback | Disable .env.shared and .env.local merging |
Example
pull
alias: decryptReads the encrypted .env.vault, decrypts it using the local .xenvsync.key, and writes the plaintext variables to .env.
Usage
xenvsync pull [flags]Flags
| --env | Environment name (e.g., staging, production) |
| --vault, -v | Path to the vault file (default: .env.vault) |
| --out, -o | Path to the output .env file (default: .env) |
Example
run
Decrypts the vault in-memory and spawns a child process with the decrypted variables merged into the environment. Plaintext secrets never touch disk — they exist only in the child process's memory.
Usage
xenvsync run [flags] -- <command> [args...]Flags
| --env | Environment name (e.g., staging, production) |
| --vault, -v | Path to the vault file (default: .env.vault) |
Example
diff
Decrypts the vault and compares its contents to the current .env file. Shows added, removed, and changed variables. Values are hidden by default for security — use --show-values to reveal them.
Usage
xenvsync diff [flags]Flags
| --env | Environment name (e.g., staging, production) |
| --file, -e | Path to the .env file (default: .env) |
| --vault, -v | Path to the vault file (default: .env.vault) |
| --show-values | Display actual values in output (sensitive) |
Example
status
Reports the presence and last-modified time of .xenvsync.key, .env, and .env.vault. Warns about insecure key file permissions and suggests whether to push or pull.
Usage
xenvsync status [flags]Flags
| --env | Environment name (e.g., staging, production) |
Example
envs
Scans the current directory for .env.* and .env.*.vault files and displays all discovered environments with their sync status.
Usage
xenvsync envsExample
export
Decrypts the vault and writes variables to stdout in the specified format. Output is always written to stdout (never to disk) to preserve the security model.
Usage
xenvsync export [flags]Flags
| --env | Environment name (e.g., staging, production) |
| --format, -f | Output format: dotenv, json, yaml, shell, tfvars (default: dotenv) |
| --vault, -v | Path to the vault file (default: .env.vault) |
Example
team add
Registers a team member by name and their X25519 public key (base64-encoded, as shown by 'xenvsync whoami'). The roster is stored in .xenvsync-team.json and should be committed to version control.
Usage
xenvsync team add <name> <public-key>Example
team remove
Removes a team member from the project roster by name, revoking their ability to decrypt future vaults.
Usage
xenvsync team remove <name>Example
team list
Displays all team members in the project roster with their public keys and the date they were added.
Usage
xenvsync team listExample
doctor
Audits the local xenvsync setup for security issues. Checks key file existence, permissions, strength, .gitignore entries, vault structure and decryptability, stale vault detection, and X25519 identity configuration.
Usage
xenvsync doctor [flags]Flags
| --env | Environment name (e.g., staging, production) |
Example
verify
Validates vault file structural integrity, performs GCM authentication to detect tampering, checks for duplicate keys in .env files, and warns about stale vaults. Without a key, only structural checks run; with a key, full decrypt and authenticate is performed.
Usage
xenvsync verify [flags]Flags
| --env | Environment name (e.g., staging, production) |
Example
log
Parses Git history for commits that modified the vault file and displays a timeline of changes. For each commit, shows which keys were added, modified, or removed. Values are hidden by default.
Usage
xenvsync log [flags]Flags
| --env | Environment name (e.g., staging, production) |
| --show-values | Display actual decrypted values (sensitive) |
| -n, --limit | Maximum number of commits to show (default: 10) |
Example
rotate
Rotates the encryption key and re-encrypts the vault in one atomic step. In V1 mode, generates a new symmetric key. In V2 (team) mode, re-encrypts for all current roster members with fresh ephemeral keys. Use --revoke to remove a member and rotate simultaneously.
Usage
xenvsync rotate [flags]Flags
| --env | Environment name (e.g., staging, production) |
| --revoke | Remove a team member and rotate in one step |
Example
keygen
Generates an X25519 keypair and stores the private key in ~/.xenvsync/identity with restricted permissions (0600). The public key is printed to stdout for sharing with teammates. This identity is user-global (not per-project).
Usage
xenvsync keygen [flags]Flags
| --force, -f | Overwrite existing identity (regenerate keypair) |
Example
whoami
Reads your X25519 private key from ~/.xenvsync/identity, derives the public key, and prints it in a copy-paste-friendly format.
Usage
xenvsync whoamiExample
completion
Generates shell completion scripts for bash, zsh, fish, or powershell. Source the output in your shell profile for tab completion of commands and flags.
Usage
xenvsync completion [bash|zsh|fish|powershell]Example
version
Prints the version, commit hash, and build date. Build info is injected at compile time via ldflags.
Usage
xenvsync versionExample
Global Help
Every command supports --help for inline documentation.