cli

command module
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2026 License: MIT Imports: 1 Imported by: 0

README ΒΆ

πŸ“¦ 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

# Fetch specific secrets by tag
crate secrets fetch --tags backend

# Set a new secret with tags
crate secrets set API_KEY "super_secret_value" --tags backend,prod

# 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 --tags gateway -- ./core-gateway start

🏷️ Tags Management

Manage tags used to categorize secrets across your organization.

# List all tags in the active organization
crate tags list

βš™οΈ Configuration

Validate declarative infrastructure configurations locally before pushing to the platform.

# Interactive prompt to select a YAML file
crate gateway config validate

# Headless validation
crate gateway 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.

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis
cmd
internal
cli

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL