/lunora:lunora-deployfrom Lunora
Deploys a Lunora app to Cloudflare Workers + Durable Objects, handling wrangler.jsonc, remote resources, secrets, per-PR previews, preflight checks, binding reconciliation, schema-drift gate, and rollback.
Ships in Lunora. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Deploying a Lunora app means making wrangler.jsonc, the remote Cloudflare
resources (D1, R2, secrets) and the worker's exports agree. lunora deploy
automates most of that and refuses to ship when they don't.
Local development is lunora dev (see lunora-quickstart). If the deploy is
blocked by a breaking schema change, stage it with lunora-migration-helper
first.
lunora deploy doesIn order, stopping at the first failure:
lunora/_generated/. ERROR-level codegen
advisories fail the deploy in CI (--strict-advisories forces this locally,
--no-strict-advisories turns it off). Nothing here runs tsc and wrangler
strips types, so a project with a type error deploys — gate CI on
lunora verify, which does type-check.lunora/.lunora-schema.json (details below)..lunora/architecture[.<env>].json after
wrangler succeeds.wrangler.jsonc: Durable Object bindings plus their new_sqlite_classes
migration, the DB D1 binding for .global() tables, crons, and the
compatibility date. R2 buckets are not auto-written (the bucket name is
yours to choose); you get a warning instead.database_id still set to
<replace-with-d1-create-id>, on a loopback URL (localhost, 127.x,
::1) in vars, on a missing container Dockerfile, or on no Docker engine
when a container builds locally.wrangler.jsonc — the SHARD binding to ShardDO (or
LunoraDO for apps that merge their DOs), a minimum compatibility_date,
DO classes registered in migrations, and the shape of every binding.
compatibility_flags are not checked; templates ship nodejs_compat for
dependencies that import node: builtins.BETTER_AUTH_SECRET, LUNORA_ADMIN_TOKEN, …). In CI a
missing required secret aborts the deploy. Skipped for --dry-run, for
lunora preview (it uploads its own secrets), and when the worker doesn't
exist yet.wrangler deploy — services declared in
lunora.config deploy first (--skip-services to skip), then the app.lunora link), optionally runs --migrate and --health-check, and only
then re-blesses the schema baseline.lunora prepare runs steps 1–6 without deploying (useful in CI), but it takes
no --env, so it validates the top-level config only. lunora verify runs
validation, a codegen dry run and tsc --noEmit without writing files, and does
take --env.
Flags worth knowing:
| Flag | Effect |
|---|---|
--env <name> | Deploy a wrangler environment; checks read that env's (non-inherited) bindings. |
--dry-run | Run every gate and bundle without publishing; wrangler.jsonc edits roll back. |
--health-check | Probe /_lunora/health/ready on the new version; fail if it never answers. |
--prebuilt | Skip codegen and the drift gate when lunora prepare already ran in this job. |
--migrate | Run every declared data migration (up is idempotent) against the live worker. |
--allow-schema-drift | Deploy despite blocked drift; checks nothing, the baseline is not advanced. |
--migrate is checked before wrangler runs, so a missing requirement aborts the
whole deploy:
--migrate-yes — confirms running production data migrations.--migrate-url <https://…> — required unless this checkout is linked for the
same --env (a previous successful deploy links it automatically).--migrate-token or LUNORA_ADMIN_TOKEN.lunora deploy --migrate --migrate-yes --migrate-url https://app.example.com
lunora deploy --preview is refused: a Worker version shares production's
Durable Objects, D1 and R2, and gets no preview URL. Use lunora preview:
lunora preview deploy 123 --seed # own Worker + DO namespace + D1/KV/R2, migrated, seeded
lunora preview deploy 123 --dry-run # the plan and env block, no API call
lunora preview list
lunora preview delete 123 # Worker + every resource on its record
lunora.appId in package.json (the first local
lunora preview deploy writes it; commit it, CI cannot mint one), so a Worker rename does not
lose a preview. Old Worker-name keys are re-keyed on the next deploy/delete.--env <name> plans from that Wrangler environment (top level plus env.<name>)
for an app whose bindings live only there; recorded, so delete needs no flag for the
resources. If that environment names a different account_id, pass the same --env to
list/delete (or set CLOUDFLARE_ACCOUNT_ID); they refuse rather than guess.
Without it, env-only bindings are refused. CI leaves it unset.<worker>-preview-<name>-<binding> and recorded in the
account's lunora-preview-registry KV namespace; delete only removes what a
record lists, and refuses anything production's config names.LUNORA_PREVIEW_SECRET_SEED when set (stable across deploys); a provider key
reaches the preview only via --secret KEY (value from the environment).vars are copied; override one with --var KEY=VALUE (e.g. an
auth base URL pointing at the preview's workers.dev URL).lunora init --ci github|gitlab scaffolds the deploy-on-PR and
delete-on-close jobs.lunora doctor # read-only; exits 1 on any FAIL, WARN/INFO don't block
lunora doctor --format json # each finding carries a stable `code` for CI/agents
lunora verify --env production
lunora doctor fails on a missing or invalid wrangler.jsonc, a missing
SHARD binding, a placeholder D1 id (d1-placeholder-id), and a binding whose
class the worker doesn't export (wrangler-class-unexported), and an Artifacts
namespace in the wrong jurisdiction. It warns on unfilled .dev.vars secrets,
placeholder send_email destinations, an account near its Durable Object class
cap, and a cloudflare.config.ts (cf-config-present).
wrangler.jsoncTemplates ship this shape. The d1_databases and r2_buckets entries are
only needed when the app uses .global() tables or auth (D1) and storage (R2):
{
"name": "my-app",
"main": "src/server.ts",
"compatibility_date": "2026-10-01",
"compatibility_flags": ["nodejs_compat"],
"durable_objects": {
"bindings": [
{ "name": "SHARD", "class_name": "ShardDO" },
{ "name": "SHARD_REGISTRY", "class_name": "ShardRegistryDO" },
],
},
"migrations": [{ "tag": "v1", "new_sqlite_classes": ["ShardDO", "ShardRegistryDO"] }],
"limits": { "cpu_ms": 30000 },
"d1_databases": [{ "binding": "DB", "database_name": "my-app", "database_id": "<replace-with-d1-create-id>" }],
"r2_buckets": [{ "binding": "UPLOADS", "bucket_name": "my-app-uploads" }],
}
Reconcile adds SCHEDULER → SchedulerDO when the app schedules work, and
bindings for generated containers, workflows and agents. Every class_name
must be exported by the worker entry or wrangler rejects the deploy.
Lunora writes the bindings but cannot create the remote resources:
wrangler d1 create my-app # paste the returned database_id into wrangler.jsonc
wrangler r2 bucket create my-app-uploads
When using --env, remember that vars, d1_databases, durable_objects and
containers do not inherit in wrangler. Each environment needs its own entries,
including its own D1 database.
.dev.vars is for development only: it is git-ignored and wrangler deploy
never uploads it. Production secrets live in Cloudflare:
lunora env diff --env production # keys local-only vs set remotely
lunora env push --env production --yes # uploads .dev.vars values; refuses placeholders
wrangler secret put RESEND_API_KEY --env production # set a prod-only value by hand
lunora env push uploads the values from .dev.vars. If production needs
different values than dev (it usually does for provider keys), set those with
wrangler secret put instead.
The gate blocks when the schema changed in a breaking way since
lunora/.lunora-schema.json and no new defineMigration on the affected table
covers it. The block message lists each change and a paste-ready
lunora migrate create … --table … command. Commit the baseline file so CI
and every machine gate against the same shape. It is advanced only after a
successful deploy, so a failed deploy never moves it past a change that didn't
ship.
When the stored rows already fit a tightening, lunora deploy notices on its own:
it reads the affected tables from the deployed worker (--migrate-url or the
project link, plus LUNORA_ADMIN_TOKEN) and lets the change through, naming any
row that does not fit otherwise. A new unique index is checked the same way, for repeated values.
--allow-schema-drift skips the gate for one run without checking. Otherwise
stage the change with lunora-migration-helper.
.global() table DDLThe runtime provisions .global() tables itself on first use
(CREATE TABLE IF NOT EXISTS plus additive ADD COLUMN / indexes), so additive
changes need no step. lunora migrate generate writes a reviewable SQL file for
D1-backed global tables, but no command applies it, lunora deploy included.
Destructive or hand-written statements in it (drops, a backfilling UPDATE, a
rename) must be applied by hand:
wrangler d1 execute DB --remote --file=lunora/migrations/<file>.sql
See lunora-migration-helper for the full flow.
lunora cloudflare deployments list
lunora cloudflare deployments status # which versions carry traffic, and how much
lunora cloudflare deployments rollback --yes # previous version
lunora cloudflare deployments promote <version-id> --yes # send 100% of traffic to a version
A partial rollout (--percent N --from <live-version-id> --confirm-shared-state) runs two versions against one Durable Object database. Nothing in promote compares the two versions' schemas, so confirm them yourself before using it. Two facts bound the risk: lunora deploy --preview is refused, so a version that never carried traffic was uploaded outside Lunora with wrangler versions upload, which never ran the schema-drift gate, while a superseded version that lunora deploy once shipped passed it against the schema of its own time, unless that deploy used --prebuilt or --allow-schema-drift, which skip or override the gate; and wrangler versions upload refuses a version with a pending Durable Object migration, so that migration reaches traffic only through deploy, at 100%. A split whose live version predates a migration the target relies on is not detected by either check.
Rolling back code does not roll back data migrations or D1 DDL.
database_id. Reconcile writes
<replace-with-d1-create-id>; deploy refuses it. Run wrangler d1 create
and paste the id.ShardDO (and any generated container /
workflow class) from the worker entry; lunora doctor names the gap..dev.vars. They never reach production. Push or
wrangler secret put them before the first request.lunora/.lunora-schema.json (and
lunora/migrations/.snapshot.json if you use migrate generate).
lunora/_generated/ is regenerated by deploy; templates git-ignore it.cf dev / cf build / cf deploy. They read
cloudflare.config.ts, which Lunora never updates
(#964). Use lunora dev /
lunora deploy; cf resource commands (zones, DNS, KV) are fine.lunora doctor has no FAIL; lunora verify --env <name> passes in CI.wrangler.jsonc.class_name is exported by the worker entry.lunora env diff --env <name> shows nothing local-only that prod needs).lunora deploy --env <name> --health-check succeeded; --migrate --migrate-yes run if backfills were pending.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub anolilab/lunora --plugin lunora15 skills in this plugin
/lunoraRoutes general Lunora requests to the right Lunora skill and gives the shared mental model (codegen loop, generated `api`/`internal` references, review commands, add-on capabilities, the `@lunora/mcp` server). Use when the user asks which Lunora skill to use, gives an underspecified task in a project with a `lunora/` directory or `lunorash`/`@lunora/*` dependencies, asks to review or audit Lunora code, asks about an add-on without its own skill (queues, workflows, agents, AI, flags, payments, notifications), or wants to expose a deployment to an AI agent over MCP./lunora-cloudflare-auditAudits a Lunora app for Cloudflare cost and reliability risk before launch or after a surprise bill. Chains the read-only `lunora doctor`, `lunora advisor` and `lunora insights` signals, then traces what they cannot see — retry and fan-out loops, cron cadence, public routes that reach a metered product (Workers AI, Browser, Containers, Vectorize, R2, D1), preview environments with paid bindings, and missing usage alerts (`lunora cloudflare alerts`). Reports each finding with the billing meter it moves, the smallest fix, and how to verify. Use when the user asks to "audit before launch", "what could blow up our Cloudflare bill", "why did the bill spike", "is this safe to put on the public internet", or "review our cron / queue / AI / workflow cost". For a slow query or OCC conflict use `lunora-performance-audit`; for a failing deploy use `lunora-deploy`./lunora-create-packageBuilds a reusable Lunora capability, either as a registry item that `lunora add` / `lunora registry add` copies into an app's `lunora/`, or as a publishable `@lunora/*` workspace package in the Lunora monorepo. Use when the user wants to package schema + functions + wrangler bindings + env vars for other apps, add or edit an item under `registry/<name>/` (`registry.json`), run `vis generate lunora-package`, or wire a new `ctx.*` capability into codegen./lunora-functionsAuthoring rules for Lunora schema and server functions under `lunora/` — `defineSchema`/`defineTable`, `v.*` validators, the generated `query`/`mutation`/`action` builders (and `internal*`), indexes and `withIndex`, the `ctx.db` API, pagination, `ctx.db.related`, opt-in `ctx.*` capabilities, topics, modules, services, and `httpAction`. Use when writing or reviewing files in `lunora/` (`schema.ts`, function files, `http.ts`, `queues.ts`), when asked to "add a query/mutation/action", "add an index", "call one function from another", or "add a webhook endpoint", or when `lunora codegen` reports an error in a function./lunora-migration-helperPlans and runs Lunora schema and data migrations with the widen → migrate → narrow pattern. Covers online data migrations (`defineMigration` in `lunora/migrations.ts`, `lunora migrate create | up | down | status`), what the pre-deploy schema-drift gate treats as breaking and how a migration covers it, `.global()` table DDL on D1 (`lunora migrate generate`) and Hyperdrive, moving a dataset with `lunora migrate d1-to-hyperdrive` (and back with `hyperdrive-to-d1`), and re-keying a `.shardBy()` table. Use when the user wants to make a field required, rename or drop a field or table, change a field's type, add a unique index to a populated table, backfill data, switch a table between root / `.shardBy()` / `.global()`, or when `lunora deploy` reports "schema drift gate blocked"./lunora-performance-auditDiagnoses and fixes Lunora performance problems — full-table scans and missing indexes, expensive `ctx.db.related` traversals, OCC write conflicts (409 `CONFLICT`), live queries that re-run too often, hot shards, and choosing `.shardBy(key)` or `.global()` to scale. Starts from measured signal (`lunora insights`) and static signal (`lunora advisor`, `@lunora/advisor` lints such as `filter_without_index`, `unbounded_collect`, `unindexed_foreign_key`, `hot_shard`). Use when the user says a query or page is slow, mutations fail with conflicts under load, subscriptions are chatty, asks to "audit performance", "add the right index", or "should I shard this table", or when the Studio Advisors tab or `lunora advisor` flags something.Other plugins' skills for the same job