Worktree Cloud CLI (wtc)
A command-line interface for managing Worktree Cloud resources including static sites and S3-compatible object storage.
Installation
Homebrew
If you use the Homebrew package manager, you can use our official Tap to install wtc and receive updates. Both macOS and Linux are supported.
$ brew tap worktree/tap https://worktree.ca/worktree/homebrew-tap
$ brew install worktree/tap/wtc
Manual Download
Download the latest release from the repository Releases page. Each release publishes static binaries for Linux (AMD64, ARM64) and macOS (ARM64).
Put the wtc binary somewhere on your $PATH and you're ready to go.
From Source
make build
make install # Optional: install globally to /usr/local/bin
Configuration
The CLI can be configured using either a YAML configuration file or environment variables. Environment variables take precedence over the configuration file.
Configuration File
Create a configuration file at ~/.config/worktree/cli.yaml:
profiles:
default:
public_key: your-default-public-key
secret_key: your-default-secret-key
region: qc-south-1
Note: The config file must contain a profiles section. At minimum, you need a default profile. Profiles can be named anything you wish, and you can add as many as required.
Switching Profiles
Use the --profile or -p flag:
wtc --profile work deploy
wtc -p personal storage cp file.txt bucket:path/file.txt
Or set the WTC_PROFILE environment variable:
export WTC_PROFILE=personal
wtc deploy
If no profile is specified, the default profile is used.
Environment Variables
All configuration options can be set via environment variables with the WTC_ prefix:
export WTC_PUBLIC_KEY=your-public-key
export WTC_SECRET_KEY=your-secret-key
export WTC_REGION=qc-south-1
export WTC_PROFILE=personal # Optional: select profile
export WTC_CONFIG=/path/to/config.yaml # Optional: specify custom config file location
Environment variables always override profile and config file settings.
Usage
Static Sites
Deploy a directory as a static website using wtc deploy.
Configuration File
Create a deployment configuration file at .worktree/deploy.yaml in your project directory:
type: static-site
siteID: my-site-id
siteSource: ./dist
Then deploy with:
wtc deploy
CLI Flags
You can override any configuration value using CLI flags:
wtc deploy --site-id my-site-id --site-source ./dist --type static-site
Or mix both approaches (flags override config file):
# Use config file for most settings, override site-id
wtc deploy --site-id different-site-id
This will:
- Create a new version for the site
- Upload all files from the specified directory
- Seal the version and set it as the current version
Object Storage
Manage files in Worktree object storage:
Upload a File
wtc storage cp <local-file> <bucketID>:<remote-path>
Example:
wtc storage cp ./document.pdf my-bucket:documents/document.pdf
Download a File
wtc storage download <bucketID>:<remote-path> <local-file>
Example:
wtc storage download my-bucket:documents/document.pdf ./document.pdf
Delete a File
wtc storage delete <bucketID>:<remote-path>
Example:
wtc storage delete my-bucket:documents/old-file.pdf
Sync a Directory
Upload all files from a local directory to a bucket with a prefix:
wtc storage sync <local-directory> <bucketID>:<remote-prefix>
Example:
wtc storage sync ./assets my-bucket:public/assets
Command-Line Flags
Global flags available for all commands:
--config, -c: Path to config file (default: ~/.config/worktree/cli.yaml)
--profile, -p: Config profile to use (default: default)
--region: Cloud Region to use (overrides config)
--public-key: WTC public key (overrides config)
--secret-key: WTC secret key (overrides config)
--api-endpoint: API endpoint (overrides config)
Examples:
# Use a specific profile
wtc --profile personal deploy
wtc -p work storage cp file.txt bucket:path/file.txt
# Override credentials for a single command
wtc --public-key=my-key --secret-key=my-secret deploy
Testing
Run the test suite:
make test
Run tests with coverage report:
make test-coverage