@fold-run/cli
v0.2.0
Published
CLI for fold.run — deploy serverless functions with TypeScript bundling, secrets, and AI-powered code generation
Readme
@fold-run/cli
Command-line interface for fold.run — deploy serverless functions with automatic TypeScript bundling, secrets management, and AI-powered code generation.
Install
npm install -g @fold-run/cliRequires Node.js 18+.
Quick start
# Authenticate
fold login
# Scaffold a new project
fold init my-worker
# Start local dev server
cd my-worker
fold dev
# Deploy
fold deployCommands
Getting started
| Command | Description |
|---------|-------------|
| fold init [name] | Scaffold a new project with worker.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, tenant, role) |
| fold status | Show config and deployed functions |
Deploy & 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 8787 |
| 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 a tenant 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 |
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 |
AI & 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-worker",
"entrypoint": "worker.ts",
"tenant_id": "tenant-abc",
"intent": {
"trigger": "http",
"bindings": ["KV:cache", "D1:db"]
}
}| Field | Description |
|-------|-------------|
| name | Function name (used if --name not passed) |
| entrypoint | File to deploy (used if no file argument given) |
| tenant_id | Default tenant (overridden by --tenant flag or config) |
| 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 with esbuild before deploy:
- Target:
esnext, format: ESM - Tree-shaking and minification enabled
cloudflare:*imports kept external- Skip with
--no-bundleto deploy raw JS
Development
# Install dependencies
pnpm install
# Build
pnpm build
# Watch mode
pnpm dev
# Run tests
pnpm test
# Type check
pnpm typecheckLicense
MIT
