We are launching all new Klivolks 3.0See what is new

update

nexler update

local only
nexler update [-dir <app-dir>] [-merge-service-auth] [-multitenant] [-opt-out <name>[,<name>]] [-opt-in <name>[,<name>]]

Brings an existing app's Nexler-owned files — ones you generally don't hand-edit — up to date with whatever the current nexler binary knows how to generate, without needing to trigger it as a side effect of create <route>. Covers things like openapi/openapi.go (regenerated when it predates a field Nexler now sets), response/response.go (missing helpers appended, never rewritten), and mongo/mongo.go (backfilling the Filter{And, Or, Eq} composable filter expression plus EnsureUniqueIndex/EnsureTTLIndex for an app scaffolded before they existed). Never touches handlers/services/store/models, main.go, .env, or templates/html/* — anything you're expected to hand-edit stays out of scope. Prints "updated" or "already up to date" per file checked; runs every check best-effort — one check unable to recognize a hand-edited file (printed as "failed", with the reason) no longer stops the rest of the checks from running. Exits non-zero if any check failed, but only after every other check has had a chance to apply.

-merge-service-auth is a separate, explicit opt-in step — not one of the checks that always run. It converts an already-scaffolded -auth jwt|both -db app from a separate middleware.RequireServiceAuth to the folded-into-RequireAuth design (see API-key auth), removing middleware/service_auth.go and regenerating middleware/auth.go. It's never run as part of a plain nexler update, since merged-vs-separate is a real per-app design choice, not a one-true-shape fix — and it refuses (naming the file) if middleware/service_auth.go has been hand-edited since it was generated, rather than discarding the changes.

-multitenant is likewise a separate, explicit opt-in step. It threads a tenant Org through an already-scaffolded -auth jwt|session|both app's auth/context.go (ContextWithOrg/Org), auth/session.go (StartSession/SessionFromRequest's org parameter, when the app has sessions), middleware/auth.go (attaching Org after a successful JWT or session check), and core/users.go (OrgId, when present) — see multi-tenant Org propagation. Never runs automatically, same reasoning as -merge-service-auth: whether an app wants tenant-scoped data is a per-app design choice. Refuses (naming the file) if any of these files has been hand-edited since it was generated. A no-op if the app isn't eligible (needs -auth jwt, session, or both) or is already on the multitenant shape.

-opt-out records pieces an app doesn't want in nexler.json at the app root (commit it). This update and every later one leave them out instead of adding them back, and each run prints what is opted out. -opt-in removes a name, and the piece comes back on that same run. Neither flag deletes files: delete an opted-out piece by hand. Names:

  • admin-users: handlers/admin/users, its routes/protected wiring, and core/users.go.
  • admin-services: handlers/admin/services and its wiring. core/services.go stays, because service-key auth needs it.
nexler update -dir ./myapp
nexler update -dir ./myapp -merge-service-auth
nexler update -dir ./myapp -multitenant
nexler update -dir ./myapp -opt-out admin-users,admin-services