π¦ Crate CLI
The Crate CLI is the unified command-line interface for managing your Crate platform resources. It provides a beautiful, interactive, and powerful way to handle authentication, inject secrets into your CI/CD pipelines, validate infrastructure configurations, and more.
β‘οΈ Features
- Interactive by Default: Forget about memorizing flags. If you omit an argument, the CLI will present a beautiful terminal UI to guide you.
- Secure Secrets Management: Fetch, inject, and manage environment-specific secrets effortlessly.
- Context Aware: Seamlessly switch between different Crate Organizations.
- Self-Updating: Built-in auto-updater ensures you always have the latest features.
π Installation
1. Build and Install Globally
Clone the repository, build the binary, and use the built-in installer to add it to your system PATH:
# Build the binary
go build -o crate .
# Install globally to your PATH
./crate system install
Note on Permissions: On Linux/macOS, the installer attempts to move the binary to /usr/local/bin. If it encounters a permission error, try running sudo ./crate system install. It will automatically fall back to ~/.local/bin if needed!
2. Auto-Updates
The Crate CLI is smart enough to check for updates in the background. If a new version drops, it will notify you. To upgrade to the latest version at any time, simply run:
crate system update
π Authentication & Context
Before interacting with the platform, authenticate your machine and select your active organization:
# 1. Log in via your web browser (OAuth 2.0 PKCE)
crate login
# 2. View your current identity
crate me
# 3. Select your active organization (Interactive prompt)
crate session org set
# When you're done, clear your local session securely
crate logout
π Secrets Management
Manage and retrieve organization-level secrets. Perfect for local development or injecting environment variables into CI/CD pipelines.
Interactive Usage
Run commands without flags to trigger the interactive UI:
# Pick from a list of secrets to download
crate secrets fetch
Headless Usage (CI/CD)
For automated environments, bypass prompts by passing explicit arguments:
# List all available secrets
crate secrets list
# Fetch all secrets securely
crate secrets fetch --all
# Fetch specific secrets by name
crate secrets fetch --names DB_PASSWORD,STRIPE_SECRET_KEY
# Set a new secret
crate secrets set API_KEY "super_secret_value"
# Retrieve the raw value of a single secret
crate secrets get API_KEY
# Delete a secret
crate secrets delete API_KEY
π Run Applications with Secrets
You can seamlessly inject secrets into the environment of any child process, completely eliminating the need for local .env files.
The crate run command securely fetches all secrets for your active organization and environment, merges them into your machine's environment variables, and executes the target command.
# Verify secrets are injected
crate run -- env | grep MY_SECRET
# Run a local Node.js server with production secrets
crate run --env=prod -- npm run dev
# Run the Crate Core Gateway
crate run -- ./core-gateway start
βοΈ Configuration
Validate declarative infrastructure configurations locally before pushing to the platform.
# Interactive prompt to select a YAML file
crate config validate
# Headless validation
crate config validate config.prod.yaml
π‘ Pro Tips
- Navigation: When using the interactive menus, use your
Up/Down arrow keys to navigate, Spacebar to select multiple items (like secrets), and Enter to confirm.
- Bypassing Prompts: If you are writing a bash script, always use explicit flags (e.g.,
--all, --names) to prevent the CLI from hanging while waiting for user input.
π Support & Issues
If you encounter any bugs, issues, or have feature requests, please open an issue in the repository or reach out to the platform engineering team.