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.
| File | Role |
|---|---|
main.rs | Commands (clap), API-backed commands (roadmap, tasks, chat, policies, evidence, brand), remotes |
setup.rs | The guided .env wizard, provider key checks, rendering .env from .env.example |
ops.rs | up/down/logs (native and Docker), port selection, readiness waits, doctor, deploy |
project.rs | meridian.toml (app name, local URLs, remotes) and the credentials file |
api.rs | HTTP client, multipart upload, event-stream reader for chat |
ui.rs | Terminal 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
- Finds the checkout: the folder with
meridian.toml, or withbackend/andcontent/frameworks/. - Runs
setupif there's no.env, interactively when someone is at the keyboard, otherwise by copying the example. - Picks free ports, starting from 8787 and 3000.
- Native:
cargo run -p meridian-serverwith data and content paths, thennext devwithMERIDIAN_API_URL. Docker:docker compose up -d --build. - Polls
/api/healthand the frontend, then opens the browser. In native mode,Ctrl-Cstops both processes. - Records the local URLs in
meridian.toml, sologin,chatand 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.
