# Lodge operations

Run all first-party operations from the composed, runnable edition checkout
with the shared RER command path. To get a runnable checkout, run
`npx -y @runeditrun/rer install just-every/run-lodge` (or start it directly with
`npx -y @runeditrun/rer dev just-every/run-lodge`). The detailed flags and effects are in
`RUN-LOCALLY.md` and `SEED-COMMAND-CONTRACT.md`.

```sh
rer setup --owner-email you@example.com
rer dev
```

Use the setup prompt instead of the owner-email flag when entering the real
mailbox. Follow the newest ordinary sign-in message in the printed local
outbox; no external email is sent. Stop `dev` with
`rer dev --stop` or Ctrl-C, and stop `preview` with
`rer preview --stop` before build or verification.

```sh
rer verify
rer reset --yes
rer export --output exports/installation.rer
rer import --input exports/installation.rer --yes
rer deploy
rer describe
```

Use `rer describe` to inspect the checkout's actual
capabilities. `rer check --profile first-party` validates the
declared command contract; it does not run application journeys or contact a
provider.

## Local data and recovery

Setup and development use explicit owner identity and real local migrations.
Dev and preview use the same owner and canonical `.wrangler/state`. Demo mode
uses fresh state under `.rer/demo/` and deletes it on stop. Local mail is
silently suppressed. Treat the private dev key and `RER_OPEN` link as owner
credentials. Private settings are
kept in `.dev.vars` with mode 0600 and are not copied into build output.

Local export creates a private archive with an integrity receipt and explicit
exclusions. Lodge's archive carries every hiring record (`l_records`, including document bytes) and the import-kit journal and retained originals; it has no background jobs. It also carries Base's operator identities (operators, bootstrap, invitations, auth settings and owner-claim records), so restored members are the same people. Sessions, tokens, dependency keys, outbox, bookkeeping, private settings and
transient runtime state are excluded. Import validates and restores atomically
into an empty destination; confirmed reset preserves export archives. Run setup
after restore; the restored owner then signs in again. Each first-party seed verifies local
export/import/export equivalence across its supported resources. Remote transfer
is available only when the adapter declares complete resource coverage.

Preserve ambiguous state and applied migration history. Never place a remote
credential, owner secret or local resource ID in source. A schema change needs
a forward migration and verified transition/recovery.

## Deployment

`rer deploy --dry-run` validates the real owner-account
deployment declaration and builds locally without provider requests. Real
deployment requires a privately supplied `CLOUDFLARE_ACCOUNT_ID`,
`CLOUDFLARE_API_TOKEN` and the declared owner/session/setup settings. Set
`MAIL_PROVIDER=none` to turn off outbound email. The owner opens the link
printed by `rer signin` from the deployment checkout. Email sign-in,
invitations and other outbound email need a sending provider. To enable mail,
set `MAIL_PROVIDER`, a verified `MAIL_FROM` and the matching `MAIL_API_KEY`.
Follow the owner-account deploy-kit
instructions under `node_modules/@runeditrun/rer/modules/deploy-kit`; account scope,
resource ownership, migrations, receipt and health checks are defined there.
Local validation does not prove hosted acceptance, provider delivery or remote
health.

## Hosted delivery

Build with `pnpm run build`, then generate the committed import specification with
`pnpm delivery:spec`. `pnpm check:deployment-spec` checks that it still matches
the emitted Worker configuration and the policy in `packaging.json`. Package
the built Worker with `node scripts/delivery/base/cli.mjs package --config packaging.json --output rer-package`;
the artifact-only operation uses the same CLI with `artifact --config packaging.json`.
Generated delivery output is disposable and contains no private configuration.

Installation mail supports the Managed RER relay and Assisted Resend, SendGrid
and Cloudflare Email Sending. Assisted setup requires the selected provider's
verified sender and private API credential; Cloudflare also needs its account ID.
Managed configuration supplies the relay URL and installation credential. Local
development continues to suppress external mail. These declarations do not prove
provider delivery or authorize deployment.
