Agents & automation
The Shelve CLI is designed to work in CI, shell scripts, and AI agent shells (Cursor, Claude Code, Codex, …) without hanging on prompts or polluting logs with spinners.
shelve run -- <cmd> over shelve pull. run keeps secrets in the child process memory only. pull writes plaintext to disk where agents can read them.Recommended workflow
- Run
shelve doctor --json(orshelve doctor) to validate setup. - Set context once with environment variables (no
shelve loginprompt required):terminalexport SHELVE_TOKEN="shlv_…" export SHELVE_TEAM_SLUG="my-team" export SHELVE_PROJECT="my-app" export SHELVE_DEFAULT_ENV="development" # optional export SHELVE_URL="https://app.shelve.cloud" # optional - Run
shelve initonce per repo (agent ignore files +.gitignoreblock). - Inject secrets with
shelve run -- pnpm dev(or your command). - Use
--jsonwhen a script needs to parse output. - Use
--non-interactive(or rely on agent/CI auto-detection) so missing flags fail fast.
Global flags
These flags can appear before or after the subcommand (for example shelve run --json -- pnpm dev or shelve --json config):
{ "ok": true, "command"?: string, "data"?: object }.Errors → JSON on stderr:
{ "ok": false, "error": { "code", "message", "status"?, "hint"? } }.Secret values are never included in JSON output.
pull, push when confirmChanges is enabled, etc.).MISSING_*, AUTH_REQUIRED, …).SHELVE_DEBUG=1 or DEBUG=true. HTTP requests are logged without Authorization headers or secret values.Auto non-interactive mode
The CLI enters non-interactive mode when any of these is true:
--non-interactiveis passedCI=trueorCI=1- The shell is detected as an AI agent via
std-env(cursor,claude,codex, …) AI_AGENTis set (force-detect)
In agent shells, shelve pull without --yes fails immediately with code AGENT_BLOCKED instead of prompting.
JSON output by command
| Command | data shape |
|---|---|
doctor | { healthy, checks[], exitCodes, errorCodes } |
config | Merged config; token redacted as "***" |
me | { loggedIn, username?, email? } |
push | { env, variableCount, pushed } |
pull | { env, variableCount, file, keys[] } — no values |
init | { writtenFiles, skippedFiles, gitignoreUpdated } |
login | { username, email } |
create | { name, slug, configPath } |
logout | { loggedOut: true } |
generate | { type, path } |
upgrade | { previous, current, updated } |
shelve run inherits the child stdio. Startup errors are structured on stderr; with --json, a spawn event is also emitted on stderr: { "ok": true, "event": "child_spawned", "env", "variableCount", "keys", "command", "pid" }.
Exit codes
| Code | Meaning |
|---|---|
0 | Success |
1 | CLI, API, or validation error |
128 + n | Child killed by signal (run) |
129 | Parent process gone / stdin EIO |
130 / 143 | SIGINT / SIGTERM (forwarded from run) |
Examples
# Machine-readable config (token redacted)
shelve --json config
# CI push without prompts
shelve --non-interactive --yes push --env staging
# Agent-safe dev server
shelve run -- pnpm dev
# Debug API round-trip
shelve --debug run --env preview -- pnpm build
Install the agent skill
Shelve publishes a single Agent Skill at /.well-known/skills/ on shelve.cloud (shelve — CLI, platform, and sync policies):
npx skills add https://shelve.cloud
The skill teaches agents Shelve end-to-end: platform model (teams, tokens, UI), CLI workflows, sync policies, and security rules (prefer run, avoid disk writes, use SHELVE_* env vars). Reference files ship alongside SKILL.md (cli-commands.md, platform.md, sync-policies.md, agent-workflows.md).
Local testing (contributors)
From the Shelve monorepo, use the zero-network playground:
pnpm play
pnpm play -- --json config
See the playground README on GitHub.