Reference
CLI commands
Scaffold, pair, tunnel localhost, push schema, and use the current diagnostic ladder without leaving the docs route.
Core commands
The CLI does more than scaffold now, so it deserves its own route instead of a short appendix.
npx clivly init # scaffold config, routes and env placeholders
npx clivly login # pair this machine, write credentials to your env file
npx clivly status # check your setup, step by step (read-only)
npx clivly add widget # scaffold the chat-session route only
npx clivly push-schema # push schema, custom objects and mappings, without deploying
npx clivly dev # tunnel localhost so remote sync can reach you
npx clivly --version # print the installed clivly version
# Every command accepts --help, which describes without acting.
npx clivly init --helpinitscaffolds three files —clivly.config.ts(yours to edit), the tick route and the auth-verify route (both Clivly-owned,--forceto overwrite) — plus env placeholders, and can hand straight into login.initgenerates a config for Drizzle only. Prisma and Kysely projects hand-write afetchPagesource instead.loginwrites to your framework's env file:.env.localon Next.js,.dev.varson Cloudflare Workers,.envelsewhere. On Workers this is not cosmetic — wrangler reads.dev.varsand nothing else.devopens acloudflaredtunnel so remote sync can hit localhost during development. It needscloudflaredon yourPATH. The tunnel targets your framework's usual dev port —5173for Vite-based frameworks,3000for Next.js and Nuxt — and warns when nothing is listening there;--portoverrides it.- Vite-based apps need
server: { allowedHosts: [".trycloudflare.com"] }in their Vite config, or every tunnelled sync fails403before reaching the tick route.devprints this when it applies. Next.js is unaffected. - If registration fails, the warning names the cause — an invalid key, a backend without the endpoint enabled, an HTTP status Clivly returned, or a real network failure. Outbound sync is unaffected either way.
push-schemasends table and column names without a deployment — never row data — and also creates the custom object types your config declares plus the mappings that make them receive rows.- Mappings are what make a sync store anything. A workspace with no mappings rejects a push outright, naming what is missing; a workspace mapped for some entities but not others accepts the push and drops those rows, and the SDK warns once per entity.
clivly statusreports both as Entities mapped in Clivly. push-schemaexits1if Clivly refuses your config — most often because an entity would overwrite a mapping edited in the dashboard — so it is safe to run in CI as a schema gate.add widgetscaffolds only the chat-session route — idempotent, and it creates no widget record (that lives in the dashboard).
Telling init where things live
init detects your framework, ORM and auth library, then probes the conventional locations for your schema, database instance and auth instance. When it finds your better-auth instance it prints Auth: better-auth (wired) and imports it directly into the auth-verify route.
Pass a flag only when the probe cannot see something — most often because it lives in a sibling workspace package.
npx clivly init --schema ./src/lib/server/schema.ts
npx clivly init --db-import '@acme/database#database'
npx clivly init --auth-import '$lib/server/auth'
npx clivly init --contact-table patients --company-table practices--auth-importand--db-importaccept an alias or subpath import ($lib/server/auth,@/lib/auth,#auth), a package name, or a project-relative path (src/lib/server/auth). The first two are emitted unchanged because they already resolve; a path is rebased to the route file's depth.- Both accept
@acme/database#databaseto name the export when the module does not use the conventional name. --contact-tableand--company-tabletake either the SQL table name or the name it is exported under in your schema module. Use them when a schema has more than one plausible people table, or to override the naming heuristics.- If the auth probe finds nothing,
initsays so and repeats--auth-importrather than scaffolding an import that will not resolve.
Use the right diagnostic command
Reach for status first. The other three are kept because older output and docs recommended them.
clivly status
start here
Your project
this machine
Also what `clivly doctor` sees — and all it can see.
Clivly
your workspace
Nothing local can tell you this.
clivly ping · clivly connect
Prove the network hop and the credential only. Neither inspects your config.
Every local check can pass while the workspace still stores nothing — which is exactly the gap `status` exists to close.
npx clivly status # the whole guided ladder — prefer this
# Deprecated aliases. Each runs part of the same ladder.
npx clivly ping # credential + reachability
npx clivly connect # the above, plus config and trigger URL
npx clivly doctor # config, setup checks and edge safetystatusruns the whole ladder and tells you which step you are on: credential → Clivly reachable → config loads → config is edge-safe → setup checks → sync trigger URL.ping,connectanddoctorare deprecated aliases, each running part of that same ladder. They still work.- In code,
await clivly.doctor()returns{ ok, checks }— API key, entities, sources, concept coverage, cursor/id columns, sample fetch, mapping dry-run, custom-object slugs, heartbeat, namespace reachability. - Checks can come back
warn: true— a working setup carrying a risk worth stating, such as paging on a column that never changes on edit. Warnings do not fail the report.