CLI

CLI

Shelve CLI is a command-line interface designed for the Shelve app.

The CLI is the primary way to sync secrets between your terminal and Shelve. Use it to inject variables at runtime (shelve run), push local changes upstream, or pull secrets to disk when you really need a .env file.

New to AI agents or CI? Start with Agents & automation and install the published skill: npx skills add https://shelve.cloud

Installation

Install @shelve/cli in your project or globally. See the Quickstart guide.

terminal
pnpm add -D @shelve/cli

Command overview

CommandDescription
runInject secrets into a child process (preferred)
initAgent-safe ignore files + .gitignore block
login / logoutManage stored credentials
meShow the logged-in user
push / pullSync secrets with Shelve
diff / syncCompare or apply sync policy
createCreate a project + shelve.json
configShow merged configuration
generateGenerate .env.example or ESLint config
upgradeUpdate the CLI package
doctorValidate config, auth, API, and cache
agents-automationGlobal flags, JSON output, CI & agents
troubleshootingError codes and common fixes

Global flags

Available on every command (before or after the subcommand):

FlagAliasDescription
--jsonMachine-readable stdout; structured errors on stderr
--quiet-qNo spinners or clack UI
--yes-ySkip confirmation prompts
--non-interactiveFail instead of prompting
--debugVerbose logs (SHELVE_DEBUG=1)

Configuration

Configuration is loaded from the current working directory. Supported filenames: shelve.json, shelve.config.json, .shelverc.json. If none exists and a command requires config, the CLI can create shelve.json interactively (or fail in non-interactive mode).

JSON Schema: shelve.cloud/schema.json

shelve.json
{
  "$schema": "https://shelve.cloud/schema.json",
  "slug": "nuxtlabs",
  "project": "@nuxt/ui",
  "defaultEnv": "development",
  "confirmChanges": false,
  "autoCreateProject": true
}

Monorepo support

Shelve detects monorepo roots and merges the root shelve.json with the local one (shared team slug, per-package project, etc.):

shelve.json
{
  "slug": "nuxtlabs"
}

Commands always run in the current directory — they do not automatically execute across every package in the monorepo.

Configuration options

OptionTypeDefaultDescription
projectstringSHELVE_PROJECT or nearest package.json nameProject name
slugstringSHELVE_TEAM_SLUGTeam slug
tokenstringKeychain / $XDG_CONFIG_HOME/.shelve / SHELVE_TOKENAPI token
urlstringhttps://app.shelve.cloudShelve instance URL
defaultEnvstringDefault environment for run, push, pull
confirmChangesbooleanfalseConfirm before push/pull writes
envFileNamestring.envLocal env file name
autoUppercasebooleantrueUppercase keys on push
autoCreateProjectbooleantrueCreate project if missing
syncobjectSync policies (per-env push/pull rules)

Environment variables

VariableDescription
SHELVE_PROJECTProject name
SHELVE_TEAM_SLUGTeam slug
SHELVE_TOKENAuthentication token
SHELVE_URLShelve instance URL
SHELVE_DEFAULT_ENVDefault environment
SHELVE_DEBUG=1Enable debug logging
AI_AGENTForce AI-agent shell detection

Credentials are stored in the OS keychain when available, with an XDG file fallback (~/.config/.shelve, mode 0600).