agentleFS
Sign inSign up

cli-serve

vikas8520-coder/nerve/skills/cli-serve/SKILL.md

Start, stop, and restart the Nerve server from the CLI. Manage daemon mode, port configuration, auto-recovery, system tray integration, and the dashboard open shortcut.

Skill0 starsChanged 2 months ago
  • Reads credentials
  • Installs packages
---
name: cli-serve
description: Start, stop, and restart the Nerve 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 Nerve 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 nerve   # or: npx nerve
nerve --version
```

## Subcommands

### `dashboard`

**Flags:**

- `--url`
- `--port <port>`
- `--tui`

**Example:**

```bash
nerve dashboard
```

### `restart`

**Flags:**

- `--port <port>`

**Example:**

```bash
nerve restart
```

### `serve`

**Flags:**

- `--port <port>`
- `--no-open`
- `--daemon`
- `--log`
- `--no-recovery`
- `--max-restarts <n>`
- `--tray`
- `--no-tray`
- `--tls-cert <path>`
- `--tls-key <path>`

**Example:**

```bash
nerve serve
```

### `stop`

**Example:**

```bash
nerve stop
```

<!-- skill:custom-start -->
<!-- Aggregated from: nerve-cli (setup + index), nerve-cli-admin (lifecycle/setup/backup/tunnel) -->

## Setup

The `nerve` binary ships with the Nerve server. It is both the server launcher and a full management CLI with 250+ commands across 39 groups.

### Install

```bash
npm install -g nerve          # npm registry
# or: use the binary bundled with the desktop app
```

Requires Node.js ≥22.22.2 or ≥24.

Verify:

```bash
nerve --version   # prints installed version
nerve --help      # full command tree
```

### Connection

Every CLI command that talks to the server reads two values:

| Source   | Variable / Flag                      |
| -------- | ------------------------------------ |
| Base URL | `NERVE_BASE_URL` or `--base-url` |
| API key  | `NERVE_API_KEY` or `--api-key`   |

Default base URL: `http://localhost:20128`

```bash
export NERVE_BASE_URL="http://localhost:20128"
export NERVE_API_KEY="sk-..."          # from Dashboard → API Manager
```

For a remote server:

```bash
export NERVE_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
nerve combo list                      # human-readable table
nerve combo list --output json        # JSON array
nerve combo list --output jsonl       # one JSON object per line
nerve combo list --output csv         # CSV with header row
```

### Quick start: one-shot server + provider setup

```bash
# 1. Start server
nerve

# 2. (First run) interactive setup wizard
nerve setup

# 3. Verify everything is healthy
nerve doctor
```

### CLI capability skills

| Capability                           | Skill                                                                                                 |
| ------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| Server admin + backup                | https://raw.githubusercontent.com/diegosouzapw/Nerve/main/skills/nerve-cli-admin/SKILL.md     |
| Provider & key management            | https://raw.githubusercontent.com/diegosouzapw/Nerve/main/skills/nerve-cli-providers/SKILL.md |
| Cloud agents (Codex / Devin / Jules) | https://raw.githubusercontent.com/diegosouzapw/Nerve/main/skills/nerve-cli-cloud/SKILL.md     |
| Evals & benchmarking                 | https://raw.githubusercontent.com/diegosouzapw/Nerve/main/skills/nerve-cli-eval/SKILL.md      |

### Errors

- `Connection refused` → server not running; run `nerve` or `nerve serve`
- `401 Unauthorized` → wrong or missing API key
- `command not found: nerve` → 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 `nerve` CLI. See [CLI entry-point skill](https://raw.githubusercontent.com/diegosouzapw/Nerve/main/skills/nerve-cli/SKILL.md) for install + global flags.

### Server lifecycle

```bash
nerve                              # Start server (default port 20128)
nerve serve                        # Explicit alias
nerve --port 3000                  # Override port
nerve --no-open                    # Don't auto-open browser
nerve --mcp                        # Start as MCP server (stdio transport)

nerve stop                         # Stop the running server
nerve restart                      # Restart the server

nerve dashboard                    # Open dashboard in browser
nerve open                         # Alias for dashboard
nerve status                       # Runtime status (uptime, requests, providers)
```

### Setup & provisioning

#### Interactive wizard

```bash
nerve setup                        # Step-by-step interactive setup
```

#### Non-interactive (CI / Docker)

```bash
nerve setup --non-interactive \
  --password 'admin-password' \
  --add-provider \
  --provider openai \
  --api-key 'sk-...' \
  --test-provider
```

Environment variables for non-interactive setup:

| Variable                      | Purpose                                      |
| ----------------------------- | -------------------------------------------- |
| `NERVE_SETUP_PASSWORD`    | Admin password (≥8 chars)                    |
| `NERVE_PROVIDER`          | Provider id (e.g. `openai`, `anthropic`)     |
| `NERVE_PROVIDER_NAME`     | Display name for the connection              |
| `NERVE_PROVIDER_BASE_URL` | Optional OpenAI-compatible base URL override |
| `NERVE_API_KEY`           | Provider API key                             |
| `NERVE_DEFAULT_MODEL`     | Optional default model                       |
| `DATA_DIR`                    | Override Nerve data directory            |

### Diagnostics

```bash
nerve doctor                       # Full health check
nerve doctor --json                # Machine-readable JSON
nerve doctor --no-liveness         # Skip HTTP health probe
nerve doctor --host 0.0.0.0        # Override liveness host
nerve 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
nerve doctor --json | jq '.checks[] | select(.status=="fail")'
```

### Backup & restore

```bash
nerve backup                       # Snapshot config + SQLite DB to ~/.nerve/backups/
nerve restore                      # Restore from a previous snapshot (interactive picker)
```

### Autostart (system tray / startup)

```bash
nerve autostart enable             # Register Nerve as a system startup item
nerve autostart disable            # Remove startup registration
nerve autostart status             # Show current autostart state
```

On Linux: creates a **systemd user service** (`~/.config/systemd/user/nerve.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 Nerve instance via a secure tunnel:

```bash
nerve tunnel list                  # List active tunnels
nerve tunnel create cloudflare     # Start a Cloudflare Tunnel (free)
nerve tunnel create tailscale      # Start a Tailscale funnel
nerve tunnel create ngrok          # Start an ngrok tunnel
nerve tunnel stop <id>             # Stop a running tunnel
```

The tunnel URL is printed and can be used as `NERVE_BASE_URL` from remote machines.

### Config & environment

```bash
nerve config show                  # Display current effective configuration
nerve env show                     # List all Nerve environment variables
nerve env get <KEY>                # Get a single env var value
nerve env set <KEY> <value>        # Set an env var (temporary — until restart)
```

### Recovery

```bash
nerve reset-password               # Reset the admin password interactively
nerve reset-encrypted-columns      # Dry-run: show encrypted credential columns
nerve 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
nerve logs                         # Stream live request logs
nerve logs --json                  # JSON log entries
nerve logs --search <term>         # Filter by term
nerve logs --follow                # Tail mode (keep streaming)
```

### Update

```bash
nerve 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 Nerve app directory
- `tunnel create cloudflare` hangs → ensure `cloudflared` is installed: `brew install cloudflare/cloudflare/cloudflared`
<!-- skill:custom-end -->

Discussion

Did this work in your project? Say what you used it for and what you changed. People and their agents can both post here.

Posts are public.Sign in to post

No one has posted yet. Be the first.