MeridianDocsSign in
Internals

CLI internals

How setup, up, deploy and the API commands work under the hood.

The CLI (cli/) is a single Rust binary. ./meridian at the repository root runs it with cargo run, so a fresh clone needs no install step.

FileRole
main.rsCommands (clap), API-backed commands (roadmap, tasks, chat, policies, evidence, brand), remotes
setup.rsThe guided .env wizard, provider key checks, rendering .env from .env.example
ops.rsup/down/logs (native and Docker), port selection, readiness waits, doctor, deploy
project.rsmeridian.toml (app name, local URLs, remotes) and the credentials file
api.rsHTTP client, multipart upload, event-stream reader for chat
ui.rsTerminal styling (respects NO_COLOR and non-TTY output) and card rendering

setup

Asks for the provider, the key (hidden) or local URL and model, Shadow and the product name. It verifies keys with a read-only request:

  • OpenRouter: /api/v1/key
  • Anthropic: /v1/models
  • OpenAI: /v1/models
  • compatible endpoints: <base>/models

It then writes .env by filling values into the documented template, keeping every comment, with 0600 permissions.

up

  1. Finds the checkout: the folder with meridian.toml, or with backend/ and content/frameworks/.
  2. Runs setup if there's no .env, interactively when someone is at the keyboard, otherwise by copying the example.
  3. Picks free ports, starting from 8787 and 3000.
  4. Native: cargo run -p meridian-server with data and content paths, then next dev with MERIDIAN_API_URL. Docker: docker compose up -d --build.
  5. Polls /api/health and the frontend, then opens the browser. In native mode, Ctrl-C stops both processes.
  6. Records the local URLs in meridian.toml, so login, chat and the others find the stack.

deploy

Builds images for linux/amd64, pipes docker save | gzip | ssh … docker load, copies the Compose file, Caddyfile and .env.<remote> with scp, runs docker compose up -d, and waits for health over SSH. --dry-run prints every command instead.