Start, stop, and restart the Pusula server from the CLI. Manage daemon mode, port configuration, auto-recovery, system tray integration, and the dashboard open shortcut.
2 stars
0 votes
0 copies
0 views
Added December 5, 2026
ai-agentsshellbashsqlnodedockergitapidatabase
Works with
cli
api
mcp
Security analysis
A96/100
mediumInstalls packages at runtime which could introduce malicious dependencies
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Cli Serve?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ferhat-yasinoglu-cli-serve)
---
name: cli-serve
description: Start, stop, and restart the Pusula server from the CLI. Manage daemon mode, port configuration, auto-recovery, system tray integration, and the dashboard open shortcut.
---
<!-- generated by src/lib/agentSkills/generator.ts; manual edits will be overwritten -->
## Overview
Start, stop, and restart the Pusula server from the CLI. Manage daemon mode, port configuration, auto-recovery, system tray integration, and the dashboard open shortcut.
## Quick install
```bash
npm install -g pusula # or: npx pusula
pusula --version
```
## Subcommands
### `dashboard`
**Flags:**
- `--url`
- `--port <port>`
- `--tui`
**Example:**
```bash
pusula dashboard
```
### `restart`
**Flags:**
- `--port <port>`
**Example:**
```bash
pusula restart
```
### `serve`
**Flags:**
- `--port <port>`
- `--no-open`
- `--daemon`
- `--log`
- `--no-recovery`
- `--max-restarts <n>`
- `--headless`
- `--tray`
- `--no-tray`
- `--ready-timeout <ms>`
- `--tls-cert <path>`
- `--tls-key <path>`
**Example:**
```bash
pusula serve
```
### `stop`
**Flags:**
- `--port <port>`
**Example:**
```bash
pusula stop
```
<!-- skill:custom-start -->
<!-- Aggregated from: pusula-cli (setup + index), pusula-cli-admin (lifecycle/setup/backup/tunnel) -->
## Setup
The `pusula` binary ships with the Pusula server. It is both the server launcher and a full management CLI with 250+ commands across 39 groups.
### Install
```bash
npm install -g pusula # npm registry
# or: use the binary bundled with the desktop app
```
Requires Node.js ≥22.22.2 or ≥24.
Verify:
```bash
pusula --version # prints installed version
pusula --help # full command tree
```
### Connection
Every CLI command that talks to the server reads two values:
| Source | Variable / Flag |
| -------- | ------------------------------------ |
| Base URL | `PUSULA_BASE_URL` or `--base-url` |
| API key | `PUSULA_API_KEY` or `--api-key` |
Default base URL: `http://localhost:20128`
```bash
export PUSULA_BASE_URL="http://localhost:20128"
export PUSULA_API_KEY="sk-..." # from Dashboard → API Manager
```
For a remote server:
```bash
export PUSULA_BASE_URL="https://your-server.com"
```
### Global flags
| Flag | Description |
| ------------------- | -------------------------------------------------------- |
| `--base-url <url>` | Override server URL for this invocation |
| `--api-key <key>` | Override API key for this invocation |
| `--output <format>` | Output format: `table` (default), `json`, `jsonl`, `csv` |
| `--json` | Shorthand for `--output json` |
| `--non-interactive` | Disable prompts — for CI / shell scripts |
| `--no-open` | Don't auto-open the browser on start |
| `--port <n>` | Override default port 20128 |
| `--help`, `-h` | Show help for the current command |
| `--version`, `-v` | Print the installed version |
### Output formats
All listing commands support `--output`:
```bash
pusula combo list # human-readable table
pusula combo list --output json # JSON array
pusula combo list --output jsonl # one JSON object per line
pusula combo list --output csv # CSV with header row
```
### Quick start: one-shot server + provider setup
```bash
# 1. Start server
pusula
# 2. (First run) interactive setup wizard
pusula setup
# 3. Verify everything is healthy
pusula doctor
```
### CLI capability skills
| Capability | Skill |
| ---------------------------------- | --------------------------------------------------------------------------------------------- |
| Backup & restore | https://raw.githubusercontent.com/Ferhat-Yasinoglu/pusula/main/skills/cli-backup-sync/SKILL.md |
| Provider & key management | https://raw.githubusercontent.com/Ferhat-Yasinoglu/pusula/main/skills/cli-providers/SKILL.md |
| Cloud agents (`pusula cloud …`) | https://raw.githubusercontent.com/Ferhat-Yasinoglu/pusula/main/skills/cli-backup-sync/SKILL.md |
| Evals & benchmarking | https://raw.githubusercontent.com/Ferhat-Yasinoglu/pusula/main/skills/cli-eval/SKILL.md |
### Errors
- `Connection refused` → server not running; run `pusula` or `pusula serve`
- `401 Unauthorized` → wrong or missing API key
- `command not found: pusula` → not in PATH; check `npm root -g` or re-install
- `doctor` reports SQLite incompatible → `npm rebuild better-sqlite3` in the app directory
## Admin lifecycle
Requires the `pusula` CLI. See the install and global-flags sections above.
### Server lifecycle
```bash
pusula # Start server (default port 20128)
pusula serve # Explicit alias
pusula --port 3000 # Override port
pusula --no-open # Don't auto-open browser
pusula --mcp # Start as MCP server (stdio transport)
pusula stop # Stop the running server
pusula restart # Restart the server
pusula dashboard # Open dashboard in browser
pusula open # Alias for dashboard
pusula status # Runtime status (uptime, requests, providers)
```
### Setup & provisioning
#### Interactive wizard
```bash
pusula setup # Step-by-step interactive setup
```
#### Non-interactive (CI / Docker)
```bash
pusula setup --non-interactive \
--password 'admin-password' \
--add-provider \
--provider openai \
--api-key 'sk-...' \
--test-provider
```
Environment variables for non-interactive setup:
| Variable | Purpose |
| ----------------------------- | -------------------------------------------- |
| `PUSULA_SETUP_PASSWORD` | Admin password (≥8 chars) |
| `PUSULA_PROVIDER` | Provider id (e.g. `openai`, `anthropic`) |
| `PUSULA_PROVIDER_NAME` | Display name for the connection |
| `PUSULA_PROVIDER_BASE_URL` | Optional OpenAI-compatible base URL override |
| `PUSULA_API_KEY` | Provider API key |
| `PUSULA_DEFAULT_MODEL` | Optional default model |
| `DATA_DIR` | Override Pusula data directory |
### Diagnostics
```bash
pusula doctor # Full health check
pusula doctor --json # Machine-readable JSON
pusula doctor --no-liveness # Skip HTTP health probe
pusula doctor --host 0.0.0.0 # Override liveness host
pusula doctor --liveness-url <url> # Full URL override
```
Checks performed: Config, Database, Storage/encryption, Port, Node runtime, Native binary (better-sqlite3), Memory, Server liveness.
Exit code is non-zero if any check fails — useful in CI:
```bash
pusula doctor --json | jq '.checks[] | select(.status=="fail")'
```
### Backup & restore
```bash
pusula backup # Snapshot config + SQLite DB to ~/.pusula/backups/
pusula restore # Restore from a previous snapshot (interactive picker)
```
### Autostart (system tray / startup)
```bash
pusula autostart enable # Register Pusula as a system startup item
pusula autostart disable # Remove startup registration
pusula autostart status # Show current autostart state
```
On Linux: creates a **systemd user service** (`~/.config/systemd/user/pusula.service`) and enables **linger** so the service can start after reboot without a graphical login; on desktop sessions it also adds an XDG autostart entry with `--tray`. On macOS: LaunchAgent plist. On Windows: registry startup entry.
### Tunnels (public URL)
Expose a local Pusula instance via a secure tunnel:
```bash
pusula tunnel list # List active tunnels
pusula tunnel create cloudflare # Start a Cloudflare Tunnel (free)
pusula tunnel create tailscale # Start a Tailscale funnel
pusula tunnel create ngrok # Start an ngrok tunnel
pusula tunnel stop <id> # Stop a running tunnel
```
The tunnel URL is printed and can be used as `PUSULA_BASE_URL` from remote machines.
### Config & environment
```bash
pusula config show # Display current effective configuration
pusula env show # List all Pusula environment variables
pusula env get <KEY> # Get a single env var value
pusula env set <KEY> <value> # Set an env var (temporary — until restart)
```
### Recovery
```bash
pusula reset-password # Reset the admin password interactively
pusula reset-encrypted-columns # Dry-run: show encrypted credential columns
pusula reset-encrypted-columns --force # Null out encrypted credentials in SQLite
```
Use `reset-encrypted-columns --force` only if `STORAGE_ENCRYPTION_KEY` was lost and you need to re-enter all provider API keys.
### Logs
```bash
pusula logs # Stream live request logs
pusula logs --json # JSON log entries
pusula logs --search <term> # Filter by term
pusula logs --follow # Tail mode (keep streaming)
```
### Update
```bash
pusula update # Check for a newer version and prompt to update
```
### Errors
- `doctor` shows `STORAGE_ENCRYPTION_KEY missing` → set the key in `.env` or run `reset-encrypted-columns --force` to wipe and re-enter credentials
- `doctor` reports native binary fail → `npm rebuild better-sqlite3` in the Pusula app directory
- `tunnel create cloudflare` hangs → ensure `cloudflared` is installed: `brew install cloudflare/cloudflare/cloudflared`
<!-- skill:custom-end -->