CLI Reference

XtraSecurity CLI

Complete reference for all 32+ commands. Search below to find specific syntax, options, and usage examples.

Installation

The CLI is distributed as an npm package. You can install it globally using your preferred package manager.

Verify Installation

Run xtra --version to ensure the CLI is correctly installed.
>_Terminal
npm install -g xtra-cli

Core Workflow

Essential commands for bootstrapping projects and injecting secrets.

xtra init

Bootstraps a new project by creating an .xtrarc config file and linking it to the cloud.

>_Terminal
xtra init [options]

On execution, you'll see the following prompts:

>_Terminal
What is your project named? my-project
Would you like to link an existing XtraSecurity project?
> Yes, link existing project
No, create a new project

After the prompts, xtra init will create an .xtrarc file in your directory and authenticate your environment.

Options

-y, --yesSkip interactive prompts
--project <id>Specify existing project ID

Examples

>_Terminal
xtra init --project prj_abc123 -y
xtra login

Authenticates your CLI session. Opens browser for SSO by default.

>_Terminal
xtra login [options]

On execution, you'll see the following prompts:

>_Terminal
> Opening browser to https://xtrasecurity.com/auth/device
> Successfully authenticated as user@example.com

This command securely stores a session token in your local OS keychain.

Options

--ssoForce SSO flow
--key <token>Machine identity authentication for CI/CD

Examples

>_Terminal
xtra login --key xs_prod_123456789
xtra logout

Terminates session and securely purges all local encrypted caches.

>_Terminal
xtra logout

On execution, you'll see the following prompts:

>_Terminal
> Successfully logged out.
> Local caches securely purged.

This removes your session token and clears any local fallback secrets to ensure complete security.

Examples

>_Terminal
xtra logout
xtra run

Fetches secrets and injects them securely into a child process memory.

>_Terminal
xtra run [options] <command> [args...]

This is the most common command. It securely fetches your environment variables and runs the specified child process (e.g. your dev server) without writing secrets to the disk.

Options

--env <name>Target environment (e.g., production)
--project <id>Override .xtrarc project context

Examples

>_Terminal
xtra run --env production -- npm run start
xtra secrets

Manage secrets. Subcommands: ls, get, set, rm.

>_Terminal
xtra secrets <command> [options]

Options

--env <name>Target environment
--jsonJSON output for 'ls'
-y, --yesSkip confirmation for 'rm'

Examples

>_Terminal
xtra secrets set API_KEY [VALUE]

Environments & Context

Manage project contexts, environments, and secret branching.

xtra project

Manage and list project contexts.

>_Terminal
xtra project <command> [options]

Lists all projects you have access to, or modifies the active project link.

Examples

>_Terminal
xtra project ls --json
xtra env

List and manage environments within the active project.

>_Terminal
xtra env <command> [options]

Lists or modifies environments like staging, dev, prod.

Examples

>_Terminal
xtra env ls
xtra branch

Create and list isolated secret branches for feature development.

>_Terminal
xtra branch <command> [options]

Secret branching works just like git branching. It isolates your secret changes before merging them to the main environment.

Examples

>_Terminal
xtra branch create feat/new-payment-gateway
xtra checkout

Switch the active branch context. All subsequent 'xtra run' commands will pull from this branch.

>_Terminal
xtra checkout [options] [branchName]

On execution, you'll see the following prompts:

>_Terminal
> Switched to branch 'feat/new-payment-gateway'
> 14 secrets loaded in local context.

Sets the active branch context for your current terminal session.

Examples

>_Terminal
xtra checkout feat/new-payment-gateway
xtra profile

Manage named configuration profiles for multiple XtraSecurity instances.

>_Terminal
xtra profile <command> [options]

Useful when switching between personal and work accounts without logging out.

Examples

>_Terminal
xtra profile use personal
xtra local

Toggle cloud/local mode for offline development. Uses fallback .env if cloud is unreachable.

>_Terminal
xtra local <command>

Enables a fallback for offline development. If the cloud is unreachable, it will use a locally cached, encrypted fallback.

Examples

>_Terminal
xtra local enable

Advanced Execution

Powerful developer experience features for live-reloading and dry-runs.

xtra watch

Live reload. Automatically restarts your child process whenever secrets change in the cloud.

>_Terminal
xtra watch [options] <command> [args...]

Great for hot-reloading frontend apps when a teammate updates a shared secret.

Examples

>_Terminal
xtra watch -- npm run dev
xtra simulate

Dry-run mode. Shows exactly what variables would be injected without executing the actual command.

>_Terminal
xtra simulate [options] [command]

On execution, you'll see the following prompts:

>_Terminal
> STRIPE_KEY=sk_test_***
> DB_URL=postgres://***
> 2 variables would be injected. Process execution skipped.

Verify your injection pipeline without side effects.

Examples

>_Terminal
xtra simulate -- npm run build
xtra ui

Launches an interactive, terminal-based (TUI) secrets dashboard.

>_Terminal
xtra ui

Provides a rich, interactive terminal UI if you prefer not to use the web interface.

Examples

>_Terminal
xtra ui
xtra ci

Strict headless mode tailored for CI/CD pipelines. Disables all interactive prompts.

>_Terminal
xtra ci <command> [options]

Bypasses all prompts, failing immediately on errors. Perfect for GitHub Actions or GitLab CI.

Examples

>_Terminal
xtra ci run -- npm test
xtra completion

Generate auto-completion scripts for your shell (bash, zsh, powershell).

>_Terminal
xtra completion [options] [shell]

Install autocomplete for your specific shell to speed up your workflow.

Examples

>_Terminal
xtra completion zsh > ~/.xtra-completion

Security & Compliance

Auditing, zero-downtime rotation, and Just-In-Time access controls.

xtra access

Submit a Just-In-Time (JIT) access request for a sensitive environment.

>_Terminal
xtra access <command> [options]

On execution, you'll see the following prompts:

>_Terminal
Requesting JIT access for Production...
> Request sent to admins.
> Approved by admin@company.com
> Access granted for 1h.

This workflow integrates directly with your team's Slack or email approvals.

Examples

>_Terminal
xtra access request --env prod --reason "Debug" --duration 1h
xtra audit / logs

View cryptographically verified audit logs for secret access and modifications.

>_Terminal
xtra logs [options]

Fetches tamper-proof audit trails from the server for compliance reporting.

Examples

>_Terminal
xtra logs --days 7
xtra scan

Scan your local codebase for hardcoded secrets or misconfigured .env files.

>_Terminal
xtra scan [options]

On execution, you'll see the following prompts:

>_Terminal
> Scanning .
> Found 1 exposed AWS key in .env.local
> Action Required: Rotate immediately

Detects over 100+ patterns of exposed secrets before you commit them.

Examples

>_Terminal
xtra scan . --strict
xtra history

View the version history of a specific secret.

>_Terminal
xtra history [options] <key>

View past versions, who changed them, and when they were changed.

Examples

>_Terminal
xtra history DATABASE_URL
xtra rollback

Instantly revert a secret to a previous version.

>_Terminal
xtra rollback [options] <key>

Immediately restore a prior version if a bad secret deployment breaks production.

Examples

>_Terminal
xtra rollback STRIPE_KEY --version 3
xtra rotate

Zero-Downtime Shadow Mode rotation. Updates a secret and slowly drains traffic from the old one.

>_Terminal
xtra rotate [options] <key>

Perform zero-downtime rotation. Extremely useful for high-availability database credential rotation.

Examples

>_Terminal
xtra rotate AWS_ACCESS_KEY

Utility & Ecosystem

Exporting, templating, and diagnosing connectivity issues.

xtra export

Bulk migrate secrets in various formats (JSON, Dotenv, CSV).

>_Terminal
xtra export [options]

Backup your secrets or migrate them locally.

Examples

>_Terminal
xtra export --format dotenv > .env.backup
xtra import

Bulk import secrets from a file.

>_Terminal
xtra import [options] <file>

Upload multiple secrets at once from existing dotenv files.

Examples

>_Terminal
xtra import --format dotenv .env.backup
xtra template / generate

Secret templating engine. Injects secrets into static configuration files (e.g., docker-compose.yml).

>_Terminal
xtra template [options]

Inject secrets into a static template file before deployment.

Examples

>_Terminal
xtra template ./config.tpl.yaml > ./config.yaml
xtra diff

Compare secrets between two environments or between local cache and remote.

>_Terminal
xtra diff [options] [env1] [env2]

See exactly what changed between staging and production environments.

Examples

>_Terminal
xtra diff staging production
xtra doctor

Diagnose common setup issues, network connectivity, and token validity.

>_Terminal
xtra doctor [options]

On execution, you'll see the following prompts:

>_Terminal
> Checking connection... OK
> Verifying token... OK
> Checking workspace context... OK
All systems operational.

Run this command first if you're experiencing any authentication or network issues.

Examples

>_Terminal
xtra doctor