npm package: @sidequestvr/bonto
Description: Bonto CLI — deploy and manage Node.js apps from your terminal. Zero dependencies.
Author: Bonto
Latest version: 1.0.3

# bonto

Command-line tool for [Bonto](https://bonto.dev) — deploy and manage Node.js apps from your terminal.

Zero dependencies. Works anywhere Node.js 18+ runs.

## Install

```bash
npm install -g @sidequestvr/bonto
```

## Quick Start

```bash
bonto auth login                          # one-time device-code login
bonto apps list                           # see your apps
bonto apps create "My App" my-subdomain   # create an app
bonto files write my-subdomain server.js --content 'const http = require("http"); http.createServer((req, res) => { res.end("Hello!"); }).listen(3000);'
bonto logs my-subdomain                   # check logs
```

Your app is live at `https://my-subdomain.bonto.run`.

## Authentication

| Command | Description |
|---------|-------------|
| `bonto auth` | Authenticate (auto-detects container vs standalone) |
| `bonto auth login` | Device-code login for use outside containers |
| `bonto auth status` | Show current authentication status |
| `bonto auth revoke` | Delete local token |

Token is stored at `~/.bonto/token`. Inside Bonto containers, tokens are stored at `/app/data/.bonto/token`.

## Apps

| Command | Description |
|---------|-------------|
| `bonto apps list` | List your apps |
| `bonto apps create <name> <subdomain>` | Create a new app (starts running immediately) |
| `bonto apps get <app>` | Get app details |
| `bonto apps update <app> [flags]` | Update app settings |
| `bonto apps delete <app>` | Delete an app (with confirmation) |

`<app>` can be either an app UUID or subdomain.

### Update Flags

| Flag | Description |
|------|-------------|
| `--name <n>` | Display name |
| `--memory <512M\|768M\|1G>` | Memory limit |
| `--cpu <0.5-4>` | CPU limit |
| `--always-on` / `--no-always-on` | Toggle always-on |
| `--allow-remixing` / `--no-allow-remixing` | Toggle remixing |
| `--env KEY=VALUE` | Set env var (repeatable) |
| `--watch-ext <exts>` | Comma-separated file extensions to watch |
| `--watch-ignore <paths>` | Comma-separated paths to ignore |
| `--start-script <name>` | Package.json script name to run |
| `--git-auto-commit` / `--no-git-auto-commit` | Toggle auto-commit |
| `--http-auth-user <user>` | Basic auth username |
| `--http-auth-pass <pass>` | Basic auth password (min 8 chars) |
| `--no-http-auth` | Disable HTTP basic auth |
| `--sso-enabled` / `--no-sso` | Bonto SSO protection |
| `--sso-mode any\|list` | SSO access mode |
| `--sso-users <json>` | JSON array of allowed emails |
| `--healthcheck-interval 
` | Healthcheck interval (5-120s) |
| `--healthcheck-timeout 
` | Healthcheck timeout (1-30s) |
| `--healthcheck-start-period 
` | Healthcheck grace period (10-1200s) |

## Files

| Command | Description |
|---------|-------------|
| `bonto files list <app> [path]` | List directory contents |
| `bonto files read <app> <path>` | Read a file (`--offset <line>` `--limit <lines>` for partial reads) |
| `bonto files write <app> <path>` | Write a file (stdin or `--content`) |
| `bonto files delete <app> <path>` | Delete a file or directory (with confirmation) |
| `bonto files mkdir <app> <path>` | Create a directory |
| `bonto files rename <app> <old> <new>` | Rename a file or directory |
| `bonto files upload <app> <remote> <local>` | Upload a binary or large file |
| `bonto files search <app> <query>` | Search across files (grep-like) |

### File Search Flags

| Flag | Description |
|------|-------------|
| `--regex` / `-E` | Treat query as regex |
| `--case-sensitive` / `-i` | Case-sensitive search |
| `-A N` / `--after N` | N lines of context after each match |
| `-B N` / `--before N` | N lines of context before each match |
| `-C N` / `--context N` | N lines of context before AND after |
| `--glob PATTERN` | Filter by file pattern (e.g. `*.ts`, `src/**/*.ts`) |
| `--output MODE` / `-l` / `-c` | Output mode: `content` (default), `files_with_matches` (`-l`), `count` (`-c`) |

## Packages

| Command | Description |
|---------|-------------|
| `bonto packages list <app>` | List installed packages and Node.js version |
| `bonto packages search <query>` | Search the npm registry |
| `bonto packages install <app> <pkg...>` | Install one or more packages |
| `bonto packages remove <app> <pkg>` | Remove a package |
| `bonto packages install-status <app>` | Poll install progress |
| `bonto packages set-node-version <app> <ver>` | Change Node.js version (`18`, `20`, or `22`) |

## Git

| Command | Description |
|---------|-------------|
| `bonto git info <app>` | Show git remote configuration and clone URL |
| `bonto git set-remote <app> <url>` | Set upstream remote (`--token <tok>` for private repos, `--branch <b>`) |
| `bonto git remove-remote <app>` | Remove upstream remote |
| `bonto git pull <app>` | Pull latest changes from upstream |
| `bonto git push <app>` | Push app commits to upstream |

## Versions

| Command | Description |
|---------|-------------|
| `bonto versions list <app> [--limit N]` | List version history |
| `bonto versions files <app> <hash> [path]` | List files at a specific version |
| `bonto versions read <app> <hash> <path>` | Read a file at a specific version |
| `bonto versions restore <app> <hash> --confirm` | Restore to a previous version (destructive) |

## Operations

| Command | Description |
|---------|-------------|
| `bonto logs <app> [--tail N] [--since ISO]` | Get app console output |
| `bonto status <app>` | Get app status (running/stopped/replicas) |
| `bonto metrics <app>` | Get CPU, memory, and network metrics |
| `bonto restart <app> [--hard]` | Restart app (`--hard` for full container restart) |
| `bonto start <app>` | Start a stopped app |
| `bonto stop <app>` | Stop a running app |

## Global Options

| Flag | Description |
|------|-------------|
| `--json` | Output raw JSON (for scripting / AI consumption) |
| `--help`, `-h` | Show help |
| `--version`, `-V` | Show version |

## Environment Variables

| Variable | Description | Default |
|----------|-------------|---------|
| `BONTO_API_URL` | API base URL | `https://api.bonto.dev/api` |
| `WEBSLOP_API_URL` | Legacy alias for `BONTO_API_URL` | — |

## Container Mode

When running inside a Bonto container (where `APP_ID` is set), the CLI auto-detects the environment and uses container-local auth via the Bonto editor approval flow. Outside containers, use `bonto auth login` for device-code authentication.

## License

MIT