CLI (fold)

The fold CLI wraps the platform API for deploying and managing functions with automatic TypeScript bundling, secrets management, and AI-powered code generation.

Install

npm install -g @fold-run/cli

Requires Node.js 18+.

Or from the repo: cd packages/cli && pnpm install && pnpm build && pnpm link --global.

Quick start

fold login
fold init my-project
cd my-project
fold dev
fold deploy

Commands

Getting started

Command Description
fold init [name] Scaffold a new project with index.ts and fold.json
fold login Authenticate via email/password or API token
fold logout Remove saved credentials
fold whoami Show current login info (API, organization, role)
fold status Show config and deployed functions

Deploy and manage

Command Description
fold deploy [file] Deploy a function (reads fold.json if no file given)
fold dev [file] Start a local dev server on port 8000
fold functions List deployed functions
fold delete <function-id> Delete a deployed function
fold rollback <function-id> <version> Rollback to a previous version
fold logs View activation logs (-F to follow, -v for details)

Configuration

Command Description
fold secrets set <name> Create or update an organization secret (masked input)
fold secrets list List secrets (names only)
fold secrets delete <id> Delete a secret
fold env set <name> -f <fn-id> Set a function environment variable (masked input)
fold env list -f <fn-id> List function env vars
fold env delete <name> -f <fn-id> Delete a function env var

Hooks (outbound webhooks)

Command Description
fold hooks list List all hooks
fold hooks create <event> <url> Create a hook (--secret for HMAC signing)
fold hooks delete <hook_id> Delete a hook (--yes to skip confirmation)
fold hooks toggle <hook_id> Enable or disable a hook (--enable, --disable)
fold hooks test <hook_id> Send a test payload to the hook URL

Supported events: deploy.success, deploy.failed, activation.error, rollback.success, usage.threshold.

Integrations

Command Description
fold webhooks list List webhook endpoints
fold webhooks create <fn-id> <path> Create a webhook endpoint
fold webhooks delete <id> Delete a webhook endpoint
fold schedules list List scheduled triggers
fold schedules create <fn-id> <cron> Create a cron trigger
fold schedules toggle <fn-id> Enable or disable a schedule
fold schedules delete <fn-id> Delete a schedule

Workspaces

Command Description
fold workspace list List all workspaces with plan limits
fold workspace get <id|slug> Show workspace details
fold workspace create <name> Create a new workspace (--environment, --description)
fold workspace switch <id|slug> Switch active workspace
fold workspace current Show current active workspace
fold workspace members list <id|slug> List workspace members
fold workspace members add <id|slug> <user_id> Add member (--role)
fold workspace members remove <id|slug> <user_id> Remove member
fold workspace usage Per-workspace usage breakdown

AI and templates

Command Description
fold create-tool <name> <description> Generate and deploy an MCP tool from natural language
fold tools list List deployed MCP tools
fold templates list Browse the template marketplace
fold templates get <name> View a template's details and code
fold templates deploy <name> Deploy a function from a template

fold.json

The project manifest configures defaults for fold deploy:

{
  "name": "my-project",
  "entrypoint": "index.ts",
  "tenant_id": "tenant-abc",
  "intent": {
    "trigger": "http",
    "bindings": ["key-value:cache"]
  }
}
Field Description
name Function name (used if --name not passed)
entrypoint File to deploy (used if no file argument given)
tenant_id Default organization (overridden by --tenant flag or config)
workspace_id Target workspace (overridden by --workspace flag or fold workspace switch)
intent.trigger Trigger type hint
intent.bindings Resource bindings in TYPE:name format

Global options

Flag Description
--json Output results as JSON (works with functions, logs, deploy, secrets list, env list)
-V, --version Print version
-h, --help Show help

Authentication

Credentials are stored in ~/.config/fold/config.json (mode 0600). The CLI supports two auth methods:

  • Email/password — authenticates via the API and stores a JWT
  • API token — direct token input for CI/automation

The CLI checks JWT expiry before each command and exits early if the token has expired.

TypeScript bundling

.ts and .tsx files are automatically bundled before deploy:

  • Target: esnext, format: ESM
  • Tree-shaking and minification enabled
  • Platform imports kept external
  • Skip with --no-bundle to deploy raw JS