CLI Reference

Leash CLI

Install, authenticate, and deploy from the command line. Everything you need to ship apps with Leash.

Installation

Quick install

The fastest way to get the Leash CLI is with the install script. It detects your OS and architecture automatically.

Terminal

$ curl -fsSL https://leash.build/install.sh | sh

Downloading leash v0.12.0 for darwin-arm64...

Installed to /usr/local/bin/leash

✓ leash installed successfully

Build from source

Clone the repository and build locally:

Terminal

$ git clone https://github.com/leash-dev/leash-cli.git

$ cd leash-cli

$ npm install

$ npm run build

$ npm link

After linking, the leash command will be available globally on your system.

Verify installation

Terminal

$ leash version

leash/0.12.0 darwin-arm64 node-v22.0.0

Authentication

All deploy and management commands require authentication. The CLI uses an OAuth-based flow that opens your browser to sign in securely.

leash login

Start the sign-in flow. The CLI opens your default browser and waits for authorization. Once complete, your session token is stored locally.

Terminal

$ leash login

? How would you like to sign in?

> Continue with Google

Email & Password

Opening browser...

✓ Logged in as arvin@example.com

How the OAuth flow works

The CLI starts a temporary local server on an available port. After you sign in through the browser, the callback delivers the session token to the local server. The token is then stored in ~/.leash/credentials.json and used for all subsequent requests.

leash logout

Sign out and remove stored credentials from your machine.

Terminal

$ leash logout

✓ Logged out successfully

leash whoami

Check which account is currently authenticated.

Terminal

$ leash whoami

arvin@example.com (free plan)

Deploying

The leash deploy command pushes your project to the Leash build pipeline and gives you a live URL.

Basic deploy

Run leash deploy from your project root. The CLI auto-detects your framework (Next.js, Flask, Express, Go, etc.) and configures the build accordingly.

Terminal

$ cd my-nextjs-app

$ leash deploy

✓ Detected Next.js 15

✓ Preflight build passed

✓ Image built and pushed

✓ Deployed successfully!

→ https://my-nextjs-app-arvin.un.leash.build

Deploy a single HTML file

Use the --html flag to deploy a standalone HTML file as a static site. Great for artifacts, prototypes, and quick demos.

Terminal

$ leash deploy --html artifact.html

✓ Deployed static site

→ https://artifact-arvin.un.leash.build

Auto-detection

The CLI inspects your project to determine the framework and build steps:

Detected byFramework
next.config.* in package.jsonNext.js
requirements.txt with flaskFlask (Python)
package.json with start scriptNode.js / Express
go.modGo
DockerfileDocker (used directly)
index.htmlStatic site

Preflight checks

Before shipping your code to the build server, the CLI runs preflight checks locally to catch errors early. For Next.js projects this includes running npm run build. If the preflight fails, the deploy is aborted and you see the errors locally.

Preflight failure

If your local build fails, fix the errors and re-run leash deploy. The CLI will not send broken code to the build server. This saves time and avoids wasted build minutes.

Deploy flags

FlagDescription
--html <file>Deploy a single HTML file as a static site
--visibility <level>Set access control: public, private, or team
--name <name>Override the auto-detected app name
--no-preflightSkip local preflight build checks

App Management

View and manage your deployed applications from the CLI.

leash apps

List all apps deployed to your account, including their URLs, status, and last deploy time.

Terminal

$ leash apps

NAME URL STATUS

my-nextjs-app https://my-nextjs-app-arvin.un.leash.build running

landing-page https://landing-page-arvin.un.leash.build running

api-prototype https://api-prototype-arvin.un.leash.build stopped

leash apps delete

Delete a deployed app by name. This stops the running container and removes the deployment. The app URL will no longer be accessible.

Terminal

$ leash apps delete api-prototype

? Are you sure you want to delete api-prototype? (y/N) y

✓ api-prototype deleted

This action is permanent

Deleting an app removes its container, environment variables, and deployment history. This cannot be undone. You will be prompted to confirm before deletion proceeds.

Environment Variables

Set environment variables for your deployed apps. Variables are encrypted at rest and injected at runtime. The CLI auto-detects the app based on your current directory.

leash env set

Set or update an environment variable. After setting, the CLI prompts you to redeploy so the change takes effect immediately.

Terminal

$ leash env set DATABASE_URL "postgresql://user:pass@host:5432/db"

✓ DATABASE_URL set

? Redeploy now to apply changes? (Y/n)

Redeploy prompt

Environment variable changes only take effect after a redeploy. The CLI prompts you automatically after each env set or env delete to keep things in sync. If you decline, a stale deploy badge will appear in the dashboard until the next deploy.

leash env list

View all environment variables for the current app. Secret values are partially masked.

Terminal

$ leash env list

DATABASE_URL = postgresql://...

API_KEY = sk-****

NODE_ENV = production

leash env delete

Remove an environment variable. Like env set, you will be prompted to redeploy.

Terminal

$ leash env delete API_KEY

✓ API_KEY deleted

? Redeploy now to apply changes? (Y/n)

API Keys

API keys identify which app is making SDK calls. Create a key for your app, then pass it to the Leash SDK.

Create a key

Terminal

$ leash keys create my-app

✓ API key created for my-app

Key: lsk_live_a1b2c3d4e5f6...

⚠ Save this key — it won't be shown again.

List keys

Terminal

$ leash keys list my-app

PREFIX NAME STATUS LAST USED CREATED

lsk_live_a1b2c3... Default active 2 hours ago Apr 11

Revoke a key

Terminal

$ leash keys revoke <key-id>

Revoke this API key? (y/N) y

✓ API key revoked

Using API keys in the SDK

Pass the key when initializing the SDK. You can also manage keys from the dashboard under App Settings.

Command Reference

Complete list of all available CLI commands.

CommandDescription
leash loginSign in with Google or email (opens browser)
leash logoutSign out and clear stored credentials
leash whoamiShow current authenticated user and plan
leash deployDeploy current directory (auto-detects framework)
leash deploy --html <file>Deploy a single HTML file as a static site
leash deploy --visibility <level>Deploy with access control (public, private, team)
leash deploy --name <name>Deploy with a custom app name
leash deploy --no-preflightDeploy without running local preflight checks
leash appsList all deployed apps with URLs and status
leash apps delete <name>Delete a deployed app permanently
leash env set <key> <value>Set an environment variable for the current app
leash env listList all environment variables for the current app
leash env delete <key>Delete an environment variable
leash keys create <app-name>Create an API key for an app
leash keys list <app-name>List API keys for an app
leash keys revoke <key-id>Revoke an API key
leash integrations:connect <provider>Connect an integration (gmail, calendar, drive)
leash integrations:listList connected integrations
leash integrations:disconnect <provider>Disconnect an integration
leash integrations:statusShow status of all integrations
leash versionShow CLI version and system info
leash helpShow help for all commands
leash help <command>Show help for a specific command