CLI Reference
The Cloudwerk CLI provides commands for development, building, and deployment.
Installation
Section titled “Installation”The CLI is included with @cloudwerk/cli:
pnpm add -D @cloudwerk/cliCommands
Section titled “Commands”cloudwerk dev
Section titled “cloudwerk dev”Start the development server with hot reload.
cloudwerk dev [path] [options]Options:
| Option | Description | Default |
|---|---|---|
--port, -p | Port number | 8787 |
--host, -H | Host to bind | localhost |
--config, -c | Path to config file | Auto-detected |
--verbose | Enable verbose logging | false |
Examples:
# Start dev servercloudwerk dev
# Custom portcloudwerk dev --port 3000
# All interfacescloudwerk dev --host 0.0.0.0
# With custom configcloudwerk dev --config cloudwerk.staging.tscloudwerk build
Section titled “cloudwerk build”Build the application for production.
cloudwerk build [path] [options]Options:
| Option | Description | Default |
|---|---|---|
--output, -o | Output directory | ./dist |
--ssg | Generate static pages for rendering: static routes | false |
--minify | Minify bundles | true |
--no-minify | Disable minification | - |
--sourcemap | Generate source maps | false |
--config, -c | Path to config file | Auto-detected |
--verbose | Enable verbose logging | false |
Examples:
# Production buildcloudwerk build
# With bundle analysiscloudwerk build --sourcemap
# Development buildcloudwerk build --no-minify
# Static site generationcloudwerk build --ssgcloudwerk deploy
Section titled “cloudwerk deploy”Deploy to Cloudflare Workers.
cloudwerk deploy [path] [options]Options:
| Option | Description | Default |
|---|---|---|
--env, -e | Environment to deploy to | - |
--dry-run | Preview without deploying | false |
--skip-build | Skip the build step | false |
--config, -c | Path to config file | Auto-detected |
--verbose | Enable verbose logging | false |
Examples:
# Deploy to productioncloudwerk deploy
# Deploy to stagingcloudwerk deploy --env staging
# Preview deploymentcloudwerk deploy --dry-runcloudwerk config
Section titled “cloudwerk config”Manage Cloudwerk configuration.
cloudwerk config <command> [options]Subcommands:
| Command | Description |
|---|---|
get <key> | Get a configuration value |
set <key> <value> | Set a configuration value |
Examples:
# Get config valuecloudwerk config get appDir
# Set config valuecloudwerk config set dev.port 3000cloudwerk bindings
Section titled “cloudwerk bindings”Manage Cloudflare bindings (D1, KV, R2, Queues, etc.).
cloudwerk bindings [options]cloudwerk bindings <command> [options]Running without a subcommand shows an overview of all configured bindings.
Subcommands:
| Command | Description |
|---|---|
add [type] | Add a new binding (d1, kv, r2, queue, do, secret) |
remove [name] | Remove a binding |
update [name] | Update an existing binding |
generate-types | Regenerate TypeScript type definitions |
Examples:
# Show bindings overviewcloudwerk bindings
# Add D1 databasecloudwerk bindings add d1
# Add KV namespacecloudwerk bindings add kv
# Remove a bindingcloudwerk bindings remove --force
# Regenerate typescloudwerk bindings generate-typescloudwerk triggers
Section titled “cloudwerk triggers”Manage Cloudwerk triggers (scheduled, queue, R2, webhook, etc.).
cloudwerk triggers [options]cloudwerk triggers <command> [options]Running without a subcommand shows an overview of all triggers.
Subcommands:
| Command | Description |
|---|---|
list | List all triggers with details |
validate | Validate trigger configurations |
generate | Regenerate wrangler.toml and TypeScript types |
Examples:
# Show triggers overviewcloudwerk triggers
# List all triggerscloudwerk triggers list
# Filter by typecloudwerk triggers list --type scheduled
# Validate configscloudwerk triggers validate --strict
# Regenerate configcloudwerk triggers generate
# Output as JSONcloudwerk triggers list --jsoncloudwerk objects
Section titled “cloudwerk objects”Manage Cloudwerk Durable Objects.
cloudwerk objects [options]cloudwerk objects <command> [options]Running without a subcommand shows an overview of all durable objects.
Subcommands:
| Command | Description |
|---|---|
list | List all durable objects with details |
info <name> | Show durable object details |
migrations | Show migration history for SQLite durable objects |
generate | Regenerate wrangler.toml and TypeScript types |
Examples:
# Show objects overviewcloudwerk objects
# List all durable objectscloudwerk objects list
# Show details for specific objectcloudwerk objects info Counter
# View migrationscloudwerk objects migrations
# Regenerate configcloudwerk objects generatecloudwerk services
Section titled “cloudwerk services”Manage Cloudwerk services (RPC bindings).
cloudwerk services [options]cloudwerk services <command> [options]Running without a subcommand shows an overview of all services.
Subcommands:
| Command | Description |
|---|---|
list | List all services with details |
info <name> | Show service details |
extract <name> | Extract service to separate Worker |
inline <name> | Convert extracted service back to local mode |
deploy <name> | Deploy extracted service |
status | Show status of all services |
Examples:
# Show services overviewcloudwerk services
# List all servicescloudwerk services list
# Show details for specific servicecloudwerk services info email
# Extract service to separate Workercloudwerk services extract payments
# Convert back to local modecloudwerk services inline payments
# Deploy extracted servicecloudwerk services deploy payments --env staging
# Show all services statuscloudwerk services statusGlobal Options
Section titled “Global Options”These options work with all commands:
| Option | Description |
|---|---|
--config, -c | Config file path |
--help, -h | Show help |
--version, -v | Show version |
--verbose | Verbose output |
Configuration
Section titled “Configuration”Commands read from cloudwerk.config.ts by default. Override with --config:
cloudwerk dev --config cloudwerk.production.tsExit Codes
Section titled “Exit Codes”| Code | Description |
|---|---|
0 | Success |
1 | General error |
2 | Configuration error |
3 | Build error |
4 | Deployment error |
Planned Commands
Section titled “Planned Commands”Next Steps
Section titled “Next Steps”- Configuration - Config file options
- Deployment Guide - Deploy your app
- Testing - Testing utilities