@quickback-dev/cli 0.31.1 → 0.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/commands/compile.d.ts.map +1 -1
  2. package/dist/commands/compile.js +9 -1
  3. package/dist/commands/compile.js.map +1 -1
  4. package/dist/commands/migrations.d.ts +17 -0
  5. package/dist/commands/migrations.d.ts.map +1 -0
  6. package/dist/commands/migrations.js +328 -0
  7. package/dist/commands/migrations.js.map +1 -0
  8. package/dist/docs/content.d.ts.map +1 -1
  9. package/dist/docs/content.js +15 -10
  10. package/dist/docs/content.js.map +1 -1
  11. package/dist/index.js +7 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/lib/file-loader.d.ts +15 -0
  14. package/dist/lib/file-loader.d.ts.map +1 -1
  15. package/dist/lib/file-loader.js +27 -0
  16. package/dist/lib/file-loader.js.map +1 -1
  17. package/dist/lib/file-loader.test.js +22 -1
  18. package/dist/lib/file-loader.test.js.map +1 -1
  19. package/dist/skill/docs/changelog.md +695 -0
  20. package/dist/skill/docs/compiler/config/domains.md +26 -0
  21. package/dist/skill/docs/compiler/config/index.md +74 -3
  22. package/dist/skill/docs/compiler/config/single-tenant.md +1 -1
  23. package/dist/skill/docs/compiler/definitions/access.md +161 -9
  24. package/dist/skill/docs/compiler/definitions/actions.md +45 -1
  25. package/dist/skill/docs/stack/account-ui/features/admin.md +2 -2
  26. package/dist/skill/docs/stack/account-ui/hooks.md +4 -0
  27. package/dist/skill/docs/stack/auth/plugins/aws-ses.md +60 -0
  28. package/dist/skill/docs/stack/auth/plugins/aws-sns.md +169 -0
  29. package/dist/skill/docs/stack/auth/plugins/index.md +32 -0
  30. package/package.json +1 -1
  31. package/src/skill/docs/changelog.md +695 -0
  32. package/src/skill/docs/compiler/config/domains.md +26 -0
  33. package/src/skill/docs/compiler/config/index.md +74 -3
  34. package/src/skill/docs/compiler/config/single-tenant.md +1 -1
  35. package/src/skill/docs/compiler/definitions/access.md +161 -9
  36. package/src/skill/docs/compiler/definitions/actions.md +45 -1
  37. package/src/skill/docs/stack/account-ui/features/admin.md +2 -2
  38. package/src/skill/docs/stack/account-ui/hooks.md +4 -0
  39. package/src/skill/docs/stack/auth/plugins/aws-ses.md +60 -0
  40. package/src/skill/docs/stack/auth/plugins/aws-sns.md +169 -0
  41. package/src/skill/docs/stack/auth/plugins/index.md +32 -0
@@ -1,5 +1,685 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.34.0 — May 23, 2026
4
+
5
+ Customizable email-OTP templates and a dedicated admin-create-user hook
6
+ — closes a longstanding gap where projects on `email.provider: 'aws-ses'`
7
+ had to live with the generic "Your password reset code is ..." copy for
8
+ admin-bootstrapped accounts.
9
+
10
+ ### Per-type email-OTP template overrides
11
+
12
+ Drop a `.ts` file at `quickback/email-templates/<name>.ts` that
13
+ default-exports `(input) => ({ subject, html, text })`, then reference
14
+ it from the new `plugins.emailOtp.templates` map. Missing keys fall
15
+ through to the package defaults from `@quickback-dev/better-auth-aws-ses`
16
+ — this is purely additive; existing `emailOtp: true` projects emit the
17
+ same code they did before.
18
+
19
+ ```ts title="quickback/quickback.config.ts"
20
+ defineAuth("better-auth", {
21
+ plugins: {
22
+ emailOtp: {
23
+ templates: {
24
+ 'forget-password': './email-templates/forget-password',
25
+ 'welcome': './email-templates/welcome',
26
+ },
27
+ },
28
+ },
29
+ });
30
+ ```
31
+
32
+ ```ts title="quickback/email-templates/welcome.ts"
33
+ export default function welcome({ otp, name, appName, appUrl }) {
34
+ const greeting = name ? `Hi ${name},` : 'Hi,';
35
+ return {
36
+ subject: `Welcome to ${appName} — set your password`,
37
+ html: `<h1>Welcome to ${appName}</h1><p>${greeting} use this code: <b>${otp}</b></p>`,
38
+ text: `${greeting}\n\nYour ${appName} code: ${otp}`,
39
+ };
40
+ }
41
+ ```
42
+
43
+ Recognized keys: `'sign-in' | 'email-verification' | 'forget-password' |
44
+ 'welcome'`. The first three map 1:1 to Better Auth's emailOTP `type`
45
+ enum.
46
+
47
+ ### Synthetic `welcome` routing — credential-row lookup
48
+
49
+ `'welcome'` has no native Better Auth OTP type. When configured, the
50
+ generated `sendVerificationOTP` callback queries the `account` table
51
+ for a `credential`-provider row for the recipient *before* rendering;
52
+ if the user has none (typical of an admin-plugin-created account
53
+ without a password), the send is rerouted through the welcome
54
+ template. Without a welcome template, those sends fall through to
55
+ `forget-password` — same behavior as before. DB-error path fails open
56
+ to the normal forget-password flow so a transient failure can't
57
+ deadlock the password-reset surface.
58
+
59
+ Provider scope: overrides are only honored on `email.provider:
60
+ 'aws-ses'`. The Cloudflare Email path uses the helper's own template
61
+ pipeline and ignores the new config.
62
+
63
+ ### New recognized hook: `after-admin-user-create.ts`
64
+
65
+ A virtual event that wires into the same Better Auth
66
+ `databaseHooks.user.create.after` slot as the generic
67
+ `after-user-create.ts`, but the generator gates the call on
68
+ `_baCtx?.context?.path` matching `/admin/create-user` so it only fires
69
+ when the row came from the admin plugin's create-user endpoint. Use it
70
+ for first-time-user provisioning (welcome email, default org
71
+ assignment, audit-log writes) without inspecting the BA context by
72
+ hand. The generic `after-user-create.ts` still runs for every signup,
73
+ including admin-created ones; the two coexist in a single merged
74
+ `after:` handler.
75
+
76
+ ```
77
+ quickback/hooks/
78
+ after-user-create.ts # every signup
79
+ after-admin-user-create.ts # admin-plugin /admin/create-user only
80
+ ```
81
+
82
+ ### File transport mirrors existing slots
83
+
84
+ The new `quickback/email-templates/` directory follows the same
85
+ pattern as `quickback/plugins/`, `quickback/hooks/`, and
86
+ `quickback/lib/`: the CLI walks the folder and uploads each `.ts` file
87
+ in a new `projectEmailTemplates` field on the compile request; the
88
+ better-auth provider stages referenced files into
89
+ `src/email-templates/<name>.ts` and emits default imports in
90
+ `src/lib/auth.ts`. Files not referenced by any template entry are
91
+ ignored — the CLI uploads the whole directory; the compiler picks only
92
+ what's needed. A relative path pointing at a file the CLI never
93
+ shipped fails compile fast with a "place the file at … and rerun"
94
+ hint.
95
+
96
+ See [AWS SES Plugin → Per-Type Template Overrides](/stack/auth/plugins/aws-ses#per-type-template-overrides)
97
+ and [Account UI → Hooks](/stack/account-ui/hooks#recognized-events).
98
+
99
+ ## v0.33.6 — May 22, 2026
100
+
101
+ Two compiler-side fixes for the queue-consumer / embedding surface and one
102
+ schema-emission bug that blocked `generateId: 'cuid'` projects.
103
+
104
+ ### Schema-emitted `createId()` now ships with a polyfill (no missing import)
105
+
106
+ When `providers.database.config.generateId` is set to `'cuid'`, the audit-
107
+ field injector emits an id column like
108
+ `id: text('id').primaryKey().$defaultFn(() => createId())`. Previously the
109
+ schema source referenced `createId` but no import landed, so `tsc` on the
110
+ generated project failed with `Cannot find name 'createId'`. Recurring
111
+ bug — every recompile re-emitted the broken file (the "do not edit"
112
+ banner doesn't protect from regeneration).
113
+
114
+ Fix: the injector now prepends a top-of-file polyfill backed by
115
+ `crypto.randomUUID()` — a Workers / Node 19+ / Bun global — instead of
116
+ trying to import `@paralleldrive/cuid2`. The package isn't bundled by
117
+ Quickback (per the [hooks doc](/stack/account-ui/hooks)'s "stick to
118
+ built-ins" guidance) and the schema-gen sandbox can't resolve project
119
+ node_modules anyway, so the polyfill is the only path that works
120
+ out-of-the-box.
121
+
122
+ ```ts title="Generated schema header (cuid strategy)"
123
+ import { sqliteTable, text } from 'drizzle-orm/sqlite-core';
124
+
125
+ // Polyfill — Quickback compiler does not ship @paralleldrive/cuid2 in
126
+ // generated projects, and the schema-gen sandbox can't see node_modules.
127
+ // crypto.randomUUID() is a Workers / Node 19+ / Bun global.
128
+ const createId = () => crypto.randomUUID();
129
+
130
+ export const widgets = sqliteTable('widgets', {
131
+ id: text('id').primaryKey().$defaultFn(() => createId()),
132
+ // ...
133
+ });
134
+ ```
135
+
136
+ If you want real cuid2 strings (collision-resistant, shorter than UUIDs)
137
+ you can still install `@paralleldrive/cuid2` and add the import yourself —
138
+ the injector honours an existing import and skips the polyfill.
139
+
140
+ ### queue-consumer.ts header reflects what the file actually does
141
+
142
+ Before v0.33.6 the generated `src/queue-consumer.ts` always carried the
143
+ preamble:
144
+
145
+ ```
146
+ * Queue Consumer for Embedding Jobs & Custom Queue Handlers
147
+ *
148
+ * Processes embedding jobs asynchronously using Workers AI and Vectorize.
149
+ * Also supports custom queue handlers defined in services/queues/.
150
+ ```
151
+
152
+ — even on projects with zero embedding features. Users on
153
+ custom-queue-only deployments would search for `EMBEDDINGS_QUEUE` /
154
+ Vectorize bindings that wrangler.toml correctly didn't emit, wasting
155
+ diagnostic time.
156
+
157
+ The preamble now reflects the actual surface:
158
+
159
+ | `hasEmbeddings` | `hasCustomHandlers` | Header |
160
+ |---|---|---|
161
+ | ✓ | ✓ | "Queue Consumer for Embedding Jobs & Custom Queue Handlers" |
162
+ | ✓ | — | "Queue Consumer for Embedding Jobs" |
163
+ | — | ✓ | "Queue Consumer for Custom Queue Handlers" + explicit "No embedding bindings (EMBEDDINGS_QUEUE / Vectorize / AI) are referenced" |
164
+ | — | — | "Queue Consumer Stub" (additionalQueues with no handler yet) |
165
+
166
+ ### Symmetric embedding detection prevents silent drift
167
+
168
+ The wrangler.toml emit path (`EMBEDDINGS_QUEUE` producer/consumer
169
+ declaration) and the queue-consumer.ts emit path (embedding handler code)
170
+ previously used two different functions to detect "this project has
171
+ embeddings": `hasEmbeddingsConfig` checked both `feature.resource.
172
+ embeddings` and `feature.tables[].resource.embeddings`;
173
+ `extractEmbeddingFeatures` only iterated the tables array. A feature
174
+ shape with feature-level embeddings sugar but no populated tables would
175
+ land in the wrangler binding while NOT landing in the consumer file
176
+ — silent drift.
177
+
178
+ `hasEmbeddingsConfig` is now defined as
179
+ `extractEmbeddingFeatures(...).length > 0`. The two stay in lock-step
180
+ by construction. `extractEmbeddingFeatures` now reads from both shapes
181
+ (tables-level when present, feature-level otherwise).
182
+
183
+ ## v0.33.5 — May 22, 2026
184
+
185
+ Two structural fixes that resolve recurring classes of bug for projects with
186
+ integer primary keys and for projects whose audit columns drift between
187
+ schema and database.
188
+
189
+ ### URL `:id` params coerce to Number when the PK column is integer
190
+
191
+ Per-id CRUD handlers (`GET /:id`, `PATCH /:id`, `DELETE /:id`, `PUT /:id`)
192
+ extracted the URL param as a string and passed it straight into
193
+ `eq(table.id, id)`. For resources with `integer().primaryKey()` columns —
194
+ triggered either by `generateId: 'serial'` on the database config or by
195
+ imported legacy schemas — every per-id route raised a downstream tsc
196
+ type error (integer ≠ string). One production project reported 249 such
197
+ errors across 30+ generated `*.routes.ts` files.
198
+
199
+ Generated handlers for integer-PK resources now emit:
200
+
201
+ ```ts
202
+ const __idRaw = c.req.param('id');
203
+ const id = Number(__idRaw);
204
+ if (!Number.isInteger(id)) {
205
+ return c.json(ValidationErrors.invalidInput([{
206
+ path: ['id'],
207
+ message: `Expected integer, got "${__idRaw}"`,
208
+ code: 'invalid_type',
209
+ }]), 400);
210
+ }
211
+ ```
212
+
213
+ Text-PK resources (the default and the recommended path) are unchanged.
214
+
215
+ A soft-deprecation warning now fires at compile time when
216
+ `providers.database.config.generateId === 'serial'` is set, nudging new
217
+ projects toward text-PK strategies (`'cuid'`, `'uuid'`, `'prefixed'`, or
218
+ the default). Existing serial-PK projects keep working.
219
+
220
+ ### Audit-field injection now runs for every dialect
221
+
222
+ The compiler auto-injects `created_at`, `modified_at`, `created_by`, and
223
+ `modified_by` columns into every feature table, and the scoped-db
224
+ runtime auto-fills them on insert. Until v0.33.5, the early injection
225
+ step in `parseCompilerInput` was gated on `targetDialect ===
226
+ 'postgresql'`. SQLite/D1 projects fell back to a later injection inside
227
+ `generateFeature`, which only fired when `feature.tables.length > 0` —
228
+ features arriving without a populated tables array (raw-drizzle shapes,
229
+ certain legacy migration tables) silently skipped audit injection.
230
+
231
+ Symptom: schemas claimed the columns existed (so the scoped-db proxy
232
+ tried to fill them on insert), but the database table didn't have them.
233
+ Inserts failed with "column doesn't exist." Users reported this for the
234
+ `user_preferences` table and, earlier, for `chat_reads` (the
235
+ `0028_chat_reads_id_column.sql` incident).
236
+
237
+ The early injection now runs for all dialects. `injectAuditFields` is
238
+ already idempotent, so the subsequent per-target injections in
239
+ `compilePureSQLTarget` and `feature-generator.ts` are no-ops when the
240
+ columns are already present. Net: every feature's schema source has
241
+ audit columns by the time drizzle-kit reads it, regardless of dialect
242
+ or feature shape.
243
+
244
+ Upgrade path: recompile against v0.33.5, commit the generated migration
245
+ that adds the missing audit columns, then `wrangler d1 migrations apply`.
246
+
247
+ ## v0.33.4 — May 21, 2026
248
+
249
+ Patch fixes covering upgrade-path bugs and OpenAPI spec/route divergence. No
250
+ new features or breaking changes.
251
+
252
+ ### OpenAPI emits CRUD endpoints only when the route emitter registers them
253
+
254
+ The OpenAPI emitter previously advertised `GET /`, `POST /`, `GET /:id`,
255
+ `PATCH /:id`, `DELETE /:id`, and the corresponding `/batch` operations on
256
+ every resource, regardless of which CRUD verbs were actually declared.
257
+ Clients generated from `openapi.json` then issued requests that fell
258
+ through to `ROUTE_NOT_FOUND` from the firewall layer — a silent contract
259
+ break for anyone whose code path was driven by openapi-typescript or
260
+ similar codegen.
261
+
262
+ Each gate now mirrors the route emitter exactly. A resource that only
263
+ declares `read + create + delete` (no `update`) gets no PATCH operations
264
+ in the spec. A write-only sink (`create` only, no `read`) gets no GET
265
+ operations. Same for batch variants — `POST /batch` only when
266
+ `crud.create` is set, `DELETE /batch` only when `crud.delete` is set,
267
+ etc.
268
+
269
+ If your generated client was calling these spurious endpoints, those
270
+ calls were already failing at runtime; this just removes them from the
271
+ spec.
272
+
273
+ ### Legacy D1 audit-timestamp migrations rewritten in place
274
+
275
+ Compilers ≤ v0.33.1 emitted
276
+ `DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))` for audit columns
277
+ (`created_at`, `modified_at`, etc.). Cloudflare D1 rejects this in
278
+ `ALTER TABLE ADD COLUMN` with `SQLITE_ERROR [code: 7500] "Cannot add a
279
+ column with non-constant default"`. v0.33.2 stopped emitting the
280
+ non-constant form, but pending unapplied legacy migration files on
281
+ upgrading projects still poisoned `wrangler d1 migrations apply` and
282
+ left the deploy stuck.
283
+
284
+ The D1 migration safety pass now retrofits these files in place,
285
+ replacing the strftime expression with the same `'1970-01-01T00:00:00.000Z'`
286
+ constant v0.33.2+ uses. The compile-time warning lists the affected
287
+ columns:
288
+
289
+ ```
290
+ ⚠ D1 helper adjusted features migrations for Cloudflare D1 safety:
291
+ 0004_early_dracula.sql [rewrote=applied_at,created_at,modified_at]
292
+ ```
293
+
294
+ Upgrade path: recompile against v0.33.4, commit the rewritten SQL, then
295
+ `wrangler d1 migrations apply` proceeds.
296
+
297
+ ### D1 helper warning is now actionable
298
+
299
+ The same migration safety pass auto-prepends `PRAGMA defer_foreign_keys
300
+ = on` to every drizzle table-rebuild migration — required on D1
301
+ because it doesn't honour `PRAGMA foreign_keys=OFF/ON` mid-migration the
302
+ way SQLite does. The pass used to surface this insertion as a warning
303
+ on every recompile, training users to ignore the warning entirely.
304
+
305
+ The PRAGMA is still inserted (it has to be), but no longer fires the
306
+ warning. Stripped Better Auth cleanup, reordered child-first DROPs, and
307
+ the new `rewrote=…` annotation above still warn — those are cases where
308
+ a human should look.
309
+
310
+ ### Reference: `account.appUrl` / `account.tenantPattern`
311
+
312
+ v0.33's redesigned dashboard org-card uses two new optional fields on
313
+ the `account` config to deep-link into the tenant's own app:
314
+
315
+ ```ts
316
+ // quickback.config.ts
317
+ account: {
318
+ // …existing fields
319
+ appUrl: 'https://app.example.com',
320
+ tenantPattern: '/{slug}',
321
+ }
322
+ ```
323
+
324
+ Both are typed in the config schema and baked into the Account SPA at
325
+ build time as `VITE_QUICKBACK_APP_URL` and `VITE_TENANT_URL_PATTERN`.
326
+ Without them, the dashboard falls back to a single-target card that
327
+ links to the account org-settings page (legacy v0.32 behaviour). Adding
328
+ them enables the two-zone layout with the external deep-link affordance.
329
+
330
+ (No code change in v0.33.4 — the fields shipped with v0.33.0 but weren't
331
+ called out in the changelog.)
332
+
333
+ ## v0.33.0 — May 21, 2026
334
+
335
+ ### Dedicated hostnames for `/auth/v1/*` and `/api/v1/*` (Shape 1)
336
+
337
+ Two new optional overrides let you carve specific backend surfaces onto dedicated hostnames, served by the same Worker:
338
+
339
+ ```ts
340
+ // quickback.config.ts
341
+ auth: { domain: 'auth.example.com' }, // /auth/v1/* lives here too
342
+ api: { domain: 'api.example.com' }, // /api/v1/* lives here too
343
+ ```
344
+
345
+ On the dedicated hostname, the hostname IS the namespace — `/v1/*` is a shortcut that the Worker-entry rewriter prepends with `/auth` or `/api` before route matching. So `https://api.example.com/v1/users` reaches the same handler as `https://quickback.example.com/api/v1/users`. Both forms work; the long form is also accepted on the dedicated host. Non-matching paths return a JSON 404 ("Not found on api.domain — this hostname serves /api/v1/* and the /v1/* shortcut only") — each hostname stays dedicated to its surface. `/health` and `/openapi.json` are explicit exceptions because monitoring/discovery agents expect them everywhere.
346
+
347
+ Both new domains:
348
+ - Get a `{ pattern, custom_domain: true }` route in `wrangler.toml`
349
+ - Join `trustedOrigins` (CORS allowlist)
350
+ - Join the cross-subdomain cookie inference (auto-enables `crossSubDomainCookies` when ≥2 same-parent subdomains are configured)
351
+ - Join CSP `connect-src` so SPAs can fetch from them
352
+
353
+ **Dual-reach:** all routes remain reachable at the unified backend host (see below) regardless of which dedicated hostnames are configured. The dedicated hostnames are aliases, never replacements.
354
+
355
+ ### `quickback.{baseDomain}` codified as the always-present unified backend
356
+
357
+ The compiler has always auto-inferred a `quickback.{baseDomain}` hostname when any subdomain is configured. v0.33 promotes this from inferred fallback to **load-bearing contract**:
358
+
359
+ - The unified backend hostname is GUARANTEED to exist when any custom subdomain (`account.domain`, `cms.domain`, `auth.domain`, `api.domain`, `apps.<n>.domain`) is set.
360
+ - Every compiler-emitted backend route (api, auth, storage, health, openapi, realtime, mcp, bundled SPAs, sysadmin endpoints) is reachable at the unified host, always.
361
+ - Per-surface domain overrides are additive (Shape 1) — they create more hostnames, never remove routes from the unified host.
362
+
363
+ This is forward-pointing: the future management layer can rely on a single discovery URL pattern (`https://quickback.{baseDomain}/...`) to find any backend regardless of how the operator split their surfaces onto subdomains.
364
+
365
+ Inference also extends to consider `auth.domain` and `api.domain` as domain sources, so a project configuring only one of them still derives `quickback.{baseDomain}` automatically. Explicit `config.domain` still wins over inference.
366
+
367
+ ### `compiler.routes` config block (scaffold — partial)
368
+
369
+ Optional path-prefix overrides for compiler-emitted system routes:
370
+
371
+ ```ts
372
+ compiler: {
373
+ routes: {
374
+ storage: '/files', // default '/storage'
375
+ broadcast: '/realtime', // default '/broadcast/v1'
376
+ mcp: '/agent', // default '/mcp'
377
+ health: '/_health', // default '/health'
378
+ openapi: '/openapi.yaml', // default '/openapi.json'
379
+ },
380
+ }
381
+ ```
382
+
383
+ **Status:** the config is validated and reaches the reserved-prefix registry (so SPA pass-through and compile-time collision detection already honor overrides), but the per-section route emitters still hardcode the defaults. Setting a non-default value today will produce a misconfigured Worker — the registry knows the new path but the actual `app.route('/storage/v1', …)` mount uses the old one. **Don't set these in production yet.** Per-section emit wiring lands in a follow-up.
384
+
385
+ `/api/v1/` and `/auth/v1/` are NOT configurable here — those are deep contracts touched by feature emitters, OpenAPI generation, generated clients, and BA's own basePath. The Shape 1 hostname overrides above are the supported way to relocate them.
386
+
387
+ ## v0.32.0 — May 21, 2026
388
+
389
+ ### Single-origin path-routed architecture
390
+
391
+ A modern Quickback project now runs on **one Cloudflare Worker behind one custom domain**, with the bundled Account and CMS SPAs path-mounted at `/account/` and `/cms/`, system routes at `/api/`, `/auth/`, `/storage/`, and the user's own SPAs anywhere else they want. No cross-subdomain cookies, zero CORS preflights, no separate `api.`/`account.`/`cms.` subdomains required:
392
+
393
+ ```ts
394
+ // quickback.config.ts
395
+ apps: { www: { domain: 'app.example.com' } }, // user's root SPA
396
+ account: true, // bundled at /account/
397
+ cms: true, // bundled at /cms/
398
+ // /api/, /auth/, /storage/, /openapi.json, /health all live here too
399
+ ```
400
+
401
+ The bug that previously broke this shape: when a hostname-mounted root SPA was configured (`apps.www.domain`), its middleware swallowed every path that wasn't in a hardcoded list (`/api/`, `/auth/`, `/admin/`, `/storage/`, `/health`). Requests to `/account/profile` got remapped to `/www/account/profile`, 404'd, then SPA-fallback'd to the wrong SPA. v0.32 introduces a **reserved-prefix registry** (`resolveReservedPrefixes` in `apps/compiler/src/generators/core/reserved-prefixes.ts`) as the single source of truth for what every catchall middleware must pass through:
402
+
403
+ - **System** (always present): `/api/`, `/auth/`, `/storage/`, `/health`, `/openapi.json`
404
+ - **Conditional** (only when feature is on): `/account/` (when `account: true`), `/cms/` (when `cms: true`), `/broadcast/v1/` (realtime), `/mcp` (MCP server)
405
+ - **User-contributed**: every `apps.<name>.path` for path-mounted apps
406
+
407
+ Path-mounted apps that collide with a system or bundled-SPA reservation throw a compile-time error naming both owners. `apps.api = { path: '/api' }` errors clearly instead of silently hijacking feature routes at runtime.
408
+
409
+ ### Admin URL namespace migration: `/admin/v1/*` → `/auth/v1/admin/*`
410
+
411
+ Quickback's legacy admin tier emitted three things under `/admin/v1/*`:
412
+
413
+ 1. A role-admit middleware that admitted both `'admin'` and `'sysadmin'` — contradicting the pseudo-role evaluator's strict-independence model (`ADMIN` admits `'admin'` only; `SYSADMIN` admits `'sysadmin'` only).
414
+ 2. `GET /admin/v1/organizations` — a thin proxy to Better Auth's own `/auth/v1/organization/list`.
415
+ 3. `GET /admin/v1/sysadmin/organizations` — cross-tenant org listing, sysadmin-only.
416
+
417
+ In v0.32, the first two are **removed** and the third **renames** to `GET /auth/v1/admin/list-organizations`. The new path sits under Better Auth's admin URL namespace (sibling of `/auth/v1/admin/list-users`, `/auth/v1/admin/ban-user`, etc.), follows BA's verb-noun convention, and keeps its sysadmin-only gate inside the handler — Quickback-emitted, not BA-mounted.
418
+
419
+ What this enables: `/admin/*` is no longer a reserved system prefix. Projects can mount their own admin SPA via `apps.admin = { path: '/admin' }` without colliding with anything.
420
+
421
+ What changes for callers:
422
+ - The bundled CMS SPA's sysadmin org switcher is updated in lockstep (no migration needed for projects using the SPA as-is).
423
+ - External callers of `/admin/v1/organizations` should migrate to BA's `/auth/v1/organization/list` (same behavior — caller's memberships).
424
+ - External callers of `/admin/v1/sysadmin/organizations` should migrate to `/auth/v1/admin/list-organizations`.
425
+ - Features that previously relied on the "admit both admin AND sysadmin" middleware should declare `access: { roles: ['ADMIN', 'SYSADMIN'] }` explicitly on each route.
426
+
427
+ The `ADMIN_ROUTE_FEATURES` carve-out in the compiler is also removed — feature routes always mount at `/api/v1/<feature>`, and admin-only behavior is enforced by per-operation `access: { roles: ['ADMIN'] }` at the resource level.
428
+
429
+ ### Two compiler bug fixes
430
+
431
+ - **Soft-delete index callback parameter bug.** The auto-index injector emitted hardcoded `t.<col>` references regardless of the existing extras callback's parameter name. When a user (or upstream transform) wrote `(table3) => ({ … })`, the appended composite-index entries referenced `t.organizationId, t.deletedAt` — `t` undefined inside the arrow scope, `ReferenceError` at module load. Fixed in `apps/compiler/src/utils/auto-indexes.ts` by capturing and reusing the callback's parameter name.
432
+ - **Reserved-word action filename collision.** Action discovery walks `actions/*.ts` and emits `import <name> from './actions/<name>'`. A user filename of `import.ts`, `delete.ts`, `await.ts`, `export.ts`, etc. produced `import import from './actions/import';` — a SyntaxError on module load. Fixed in `apps/compiler/src/codegen/discovered-actions.ts` by aliasing reserved-word and invalid-identifier filenames to `__action_<sanitized>` bindings while preserving the public action key (route emitters use bracket notation, so reserved-word keys are fine in the lookup map).
433
+
434
+ ## v0.29.0 — May 19, 2026
435
+
436
+ ### Opt-in `id` auto-injection (`compiler.injectId: 'auto'`)
437
+
438
+ Quickback's generated CRUD routes, FK extractor, relationship resolver, and `/:id` mount points all assume every feature table has an `id` primary key column. Authoring a table without one — common when porting an existing schema, or when a domain genuinely uses a compound or non-`id` PK — produced silent failures: routes that 404, batch operations that targeted the wrong rows, FK lookups that returned empty.
439
+
440
+ v0.29 adds an opt-in flag that auto-injects an `id` column into every feature table that doesn't already declare one. Same mechanism as the existing `createdAt`/`modifiedAt` injection — early-pass, idempotent, dialect-aware.
441
+
442
+ ```ts
443
+ // quickback.config.ts
444
+ compiler: {
445
+ injectId: 'auto', // off by default; opt in per project
446
+ }
447
+ ```
448
+
449
+ When `'auto'`:
450
+ - Tables with no `.primaryKey()` declared get `id: text("id").primaryKey().$defaultFn(() => createId())` (or the matching shape for `dbConfig.generateId` — `serial`, `uuid`, `prefixed`).
451
+ - Tables that already declare an `id` column (in any shape) are no-op — the injector is idempotent.
452
+ - Tables with a `.primaryKey()` on a non-`id` column raise a clear compile error that names the offending column and points at the v0.30 follow-up which will rewrite custom PKs to unique indexes automatically. v0.29 surfaces the conflict; v0.30 fixes it.
453
+
454
+ Default stays `false` so existing projects don't get migration churn. Opt in when you want to lean on every-table-has-id semantics across your schema.
455
+
456
+ ### Why this is opt-in (and what v0.30 changes)
457
+
458
+ The "every table has `id`" assumption is load-bearing across 68+ sites in the compiler — every CRUD emitter, the FK regex (`.references(() => target.id)`), the relationship resolver hydration block, the `/:id` route mounts. v0.29 only injects the column; v0.30 will close the remaining gaps:
459
+
460
+ - FK extraction migrates from `.id` regex to schema-aware metadata lookup, so tables with non-`id` PKs participate in FK display + relationship resolution.
461
+ - The PK→unique-index rewrite lands — tables with explicit non-`id` PKs auto-keep their uniqueness as a constraint while gaining the auto-injected `id`.
462
+ - The flag flips to default-on; opting out becomes the rare path.
463
+
464
+ v0.29 ships the foundation so projects can opt in today without waiting for the full structural pass.
465
+
466
+ ## v0.28.0 — May 19, 2026
467
+
468
+ ### INTERNAL pseudo-role: server-only schemas, unforgeable from HTTP
469
+
470
+ v0.27 had five pseudo-roles — `PUBLIC`, `AUTHENTICATED`, `USER`, `ADMIN`, `SYSADMIN` — and one structural gap: there was no way to mark a schema as "the server enumerates this; no user-facing route should ever read across tenants." Push subscriptions, personal access tokens, OAuth tokens, broadcast job tables — anywhere the server needs full visibility but users should only see their own row. The workaround was `firewall: { exception: true }` plus an out-of-band convention, which left auth on the schema looking incidental.
471
+
472
+ v0.28 adds **`INTERNAL`** as the sixth pseudo-role. Schemas with `roles: ['INTERNAL']` are reachable only by `AppContext` values where `ctx.internal === true` — a flag the HTTP auth middleware **never** sets. No session, JWT, header, query parameter, or body field populates it. The flag is reserved for compiler-emitted server-internal entry points (queue consumers, cron workers, server-side helpers that bypass HTTP entirely).
473
+
474
+ ```ts
475
+ // features/comms/push-subscriptions.ts
476
+ export default defineTable(push_subscriptions, {
477
+ firewall: [{ field: 'ownerId', equals: 'ctx.userId' }],
478
+ // User reads their own subscriptions via the standard CRUD route.
479
+ read: { access: { roles: ['USER'] } },
480
+ // Server enumerates ALL subscriptions for a broadcast — INTERNAL only.
481
+ crud: {
482
+ delete: { access: { roles: ['INTERNAL'] } },
483
+ },
484
+ });
485
+ ```
486
+
487
+ The split-surface pattern is the recommended shape: a user-facing access node uses `USER` / `AUTHENTICATED` / a real role; a server-only access node uses `INTERNAL`. Mixing INTERNAL with a user-facing pseudo-role on the **same** access node is a compile error — it almost always means the developer is confused about which side of the trust boundary they're on. The error names the cohabiting markers explicitly and points at the fix (split into separate access blocks).
488
+
489
+ The runtime stamping (queue consumer ctx, cron worker ctx) lands in a follow-up; v0.28 ships the declarative surface so projects can mark schemas accurately today. Until the stamping ships, server-internal code uses `unsafeDb` to enumerate INTERNAL surfaces — the security guarantee is in place because no HTTP-derived context can ever carry `ctx.internal === true`.
490
+
491
+ ### Reserved-name fix: SYSADMIN and INTERNAL added to ALWAYS_RESERVED
492
+
493
+ `SYSADMIN` was previously omitted from the `ALWAYS_RESERVED` set in `authz-schema.ts`. The runtime validator rejected `roles: ['SYSADMIN']` when `cms.sysadmin: true` wasn't set, but the **shadow-declaration path** — user code writing `authz.roles.SYSADMIN: { roles: [...] }` to silently change the pseudo-role's meaning — wasn't blocked. v0.28 closes that gap by adding both `SYSADMIN` and `INTERNAL` to the unconditionally-reserved set.
494
+
495
+ ### Per-table OWNER_SCOPE_RULES: explicit owner predicates no longer over-scope
496
+
497
+ When a user declared a non-canonical owner predicate on one table — e.g. `firewall: [{ field: 'linkedUserId', equals: 'ctx.userId' }]` — that column got promoted into the **project-global** `OWNER_SCOPE_RULES` list. Any other table in the project that happened to have a `linkedUserId` column (even as a plain FK reference, not for scoping) had the same `WHERE linkedUserId = ctx.userId` injected on every read, update, and delete. Silent over-scoping that surfaced only when a query returned the wrong rows.
498
+
499
+ v0.28 narrows the global list to the **canonical owner column** — the one matching `authDefaults.owner.column` (default `ownerId`). Explicit predicates on custom-named columns are honored on their declaring table via that table's own `buildFirewallConditions` helper, but stay per-table. Reads on other tables with the same column name are unaffected.
500
+
501
+ ```ts
502
+ // Before v0.28: linkedUserId on `comments` ALSO got the WHERE
503
+ // because `event_organizers` declared an explicit owner predicate.
504
+ export default defineTable(event_organizers, {
505
+ firewall: [{ field: 'linkedUserId', equals: 'ctx.userId' }],
506
+ });
507
+ export default defineTable(comments, {
508
+ // comments.linkedUserId is just an FK reference; we don't want it scoped.
509
+ firewall: [{ field: 'eventId', equals: 'ctx.activeOrgId' }],
510
+ });
511
+ ```
512
+
513
+ In v0.28, `event_organizers` queries get the per-table `linkedUserId = ctx.userId` predicate as before; `comments` queries are no longer mis-scoped.
514
+
515
+ If you genuinely want the same column to scope multiple tables (rare), declare the explicit firewall predicate on each table. The implicit "every table with this column gets scoped" behavior was the bug — explicit-per-table is the cure.
516
+
517
+ ## v0.27.0 — May 19, 2026
518
+
519
+ ### Narrow `ctx.<exposeAs>` typing for namespace-scoped actions
520
+
521
+ Since v0.23 the namespace middleware has hydrated `ctx.<exposeAs>` with the loaded resource row before each action runs. The static type of that field stayed `any` — runtime safety was solid, but autocomplete and typo-catching were missed opportunities.
522
+
523
+ v0.27 ships the second half: one **per-namespace `defineAction` helper** emitted alongside the standard one. Importing from the narrowed helper retypes `ctx.<exposeAs>` inside `execute({ ctx })` to the loaded row's `$inferSelect` shape. Nothing about discovery, routing, or runtime behavior changes — this is purely TypeScript ergonomics.
524
+
525
+ ```ts title="features/feeds/actions/feed-moments.ts"
526
+ // Before — ctx.event is `any`
527
+ import { defineAction } from '../.quickback/define-action';
528
+
529
+ // After — ctx.event is `typeof events.$inferSelect`
530
+ import { defineAction } from '../.quickback/define-action.event-scope';
531
+
532
+ export default defineAction({
533
+ path: '/event/:eventId/feed-moments',
534
+ method: 'POST',
535
+ input: z.object({ body: z.string() }),
536
+ access: { roles: ['attendee'] },
537
+ async execute({ ctx, input }) {
538
+ ctx.event.id // ✓ string, autocomplete works
539
+ ctx.event.startsAt // ✓ Date
540
+ ctx.event.idd // ✗ TS2339 — typo caught at compile time
541
+ },
542
+ });
543
+ ```
544
+
545
+ #### Where the file lives
546
+
547
+ The compiler emits one narrowed helper per `(feature, namespace)` pair where the feature owns at least one action whose `path:` falls under the namespace prefix. Filename is `define-action.<kebab(namespaceName)>.ts` (`eventScope` → `define-action.event-scope.ts`), sibling to the standard `define-action.ts`:
548
+
549
+ ```text
550
+ src/features/feeds/.quickback/
551
+ ├── define-action.ts # generic — standard fallback
552
+ └── define-action.event-scope.ts # ctx.event narrowed
553
+ ```
554
+
555
+ A feature contributing to multiple namespaces gets one helper per namespace. Each action picks the import that matches its path.
556
+
557
+ #### Opt-in, no breaking change
558
+
559
+ Actions that keep their existing `import { defineAction } from '../.quickback/define-action'` continue to compile unchanged. The `AppContext` index signature still admits `ctx.event` at type `any`; runtime hydration is unaffected. Flip imports per action at your own pace.
560
+
561
+ #### Compile-time advisory
562
+
563
+ When `quickback compile` sees a namespace-scoped action still importing the generic helper, it logs a one-line `[quickback:typing]` advisory pointing at the narrowed path:
564
+
565
+ ```text
566
+ [quickback:typing] action "feedMoments" in feature "feeds" lives under
567
+ namespace "eventScope" — switch its import to
568
+ `../.quickback/define-action.event-scope` for narrow ctx.<exposeAs> typing.
569
+ (Runtime behavior is unchanged; the narrowed helper only refines TS types.)
570
+ ```
571
+
572
+ Non-blocking — same family as `[quickback:authz]`.
573
+
574
+ #### Side fix
575
+
576
+ Repaired a latent off-by-one in the inlined `AppContext` import path that landed in the v0.26 helper prelude but hadn't been exercised against a recompiled project yet (`"../../lib/types"` → `"../../../lib/types"`). New compiles produce a helper whose `AppContext` import actually resolves.
577
+
578
+ #### Out of scope
579
+
580
+ Non-namespace standalone actions with relationship-based access keep their existing `(ctx.event as typeof events.$inferSelect)` body cast. Same per-relationship helper pattern would apply if the demand surfaces — defer until requested.
581
+
582
+ ## v0.26.0 — May 19, 2026
583
+
584
+ ### Bulk-grant namespace lanes: org admins and team members in one line
585
+
586
+ v0.25 widened `via:` to accept an array of relationship lanes — attendeeOf OR organizerOf, first match wins. That covers per-row authorization paths. v0.26 adds the missing piece: **bulk-grant lanes** for the "you work here, so you see everything in your scope" case. Org admins, team members, and other tenant-scoped staff no longer need a per-event relationship row to be authorized for a namespace.
587
+
588
+ ```ts
589
+ authz: {
590
+ namespaces: {
591
+ eventScope: {
592
+ prefix: '/event/:eventId',
593
+ via: [
594
+ 'attendeeOf', // per-event relationship
595
+ 'organizerOf', // per-event relationship
596
+ { roles: ['admin', 'owner'] }, // org-role bulk grant
597
+ { team: true }, // active-team-membership bulk grant
598
+ ],
599
+ },
600
+ },
601
+ }
602
+ ```
603
+
604
+ Lanes resolve in declaration order, first match wins. Per-row relationships and bulk-grant guards compose freely.
605
+
606
+ #### What each bulk-grant lane does
607
+
608
+ - **`{ roles: [...] }`** — passes when the caller's BA org-role for the namespace's loaded resource includes any listed role. The check is in-memory and short-circuits the relationship loop entirely. The loads-table firewall (scoped by `ctx.activeOrgId`) does the tenant isolation; this lane just adds the role precondition on top.
609
+ - **`{ team: true }`** — passes when `ctx.activeTeamId` is set. The loads-table firewall (which scopes by team for team-scoped tables) does the actual `events.teamId === ctx.activeTeamId` match during hydration. If the firewall returns no row, the request gets a contextual 404 explaining the row isn't visible to the current session — same ambiguous-by-design phrasing the firewall has always used to prevent cross-tenant ID probing.
610
+
611
+ #### Why this matters
612
+
613
+ Until v0.26, the only way to authorize an org admin for a namespace was to write `access.or: [{ via: 'attendeeOf' }, { roles: ['admin', 'owner'] }]` on every individual action under it. That OR-arm shim worked but defeated the purpose of namespaces — the whole point of hoisting the gate was to write the auth rule once. Now you do.
614
+
615
+ #### Rich deny payloads
616
+
617
+ The 403 response when every lane misses lists every path the caller could have taken — relationship names, role names, and `"team-membership"` for `{ team: true }` lanes — in the `required` field. A developer hitting an unexpected 403 sees the full set of authorization options they need to satisfy, not a generic "Insufficient permissions" wall.
618
+
619
+ The 404 from hydration (when the loads-table firewall filters the request out) now includes a hint explaining that the row may exist out of scope, and a `details` field with the resource name and key, so a developer working in their own environment has enough to debug.
620
+
621
+ #### Compile-time guards
622
+
623
+ - **Pure bulk-grant namespaces** (no relationship lane at all) are accepted as long as `loads:` + `exposeAs:` are declared directly on the namespace. With at least one relationship lane present, those fields are inherited from the relationship — declare them on the namespace itself only when no relationship lane is available to anchor hydration.
624
+ - **Heterogeneous `loads:` between relationship lanes is rejected** — `ctx.<exposeAs>` must always hydrate the same table regardless of which lane matched.
625
+ - **`namespace.loads` that disagrees with the inherited value is rejected** with a clear "drop one or align the other" message.
626
+
627
+ ## v0.25.0 — May 19, 2026
628
+
629
+ ### Multi-lane namespace gates: more than one way to be authorized
630
+
631
+ v0.24 lets you hoist a namespace gate to the project level via `authz.namespaces.<name>.via: 'attendeeOf'` — one relationship-resolver middleware running once per request for every action under `/event/:eventId/*`. That works when there's exactly one way to be authorized for the resource. It breaks the moment you have **two**: an attendee row and a per-event organizer row, say. The shim today is to OR the second check inside every individual action's `access` block, which puts you back to writing the gate over and over.
632
+
633
+ v0.25 widens `via:` to accept an array of relationship lanes. The middleware tries each in declaration order, and the first one whose subject row matches authorizes the request and hydrates `ctx.<exposeAs>`.
634
+
635
+ ```ts
636
+ authz: {
637
+ relationships: {
638
+ attendeeOf: {
639
+ from: 'guests',
640
+ subject: { column: 'linkedUserId', equals: 'ctx.userId' },
641
+ resource: { column: 'eventId' },
642
+ where: { status: 'confirmed' },
643
+ loads: 'events',
644
+ exposeAs: 'event',
645
+ },
646
+ // Per-event named organizers. The subject can be a user OUTSIDE
647
+ // the event's organization — e.g. a freelance event manager.
648
+ organizerOf: {
649
+ from: 'eventOrganizers',
650
+ subject: { column: 'linkedUserId', equals: 'ctx.userId' },
651
+ resource: { column: 'eventId' },
652
+ loads: 'events',
653
+ exposeAs: 'event',
654
+ },
655
+ },
656
+ namespaces: {
657
+ eventScope: {
658
+ prefix: '/event/:eventId',
659
+ via: ['attendeeOf', 'organizerOf'], // first match wins
660
+ },
661
+ },
662
+ }
663
+ ```
664
+
665
+ The thing this actually unlocks isn't "two checks instead of one." It's **per-event grants for users outside the owning organization** — external co-organizers, freelance event managers, partner staff. They don't need a `member` row in the event's org; they just need a row in `event_organizers` for that specific event. The horizontal axis (org / team membership) stays for "staff at this company"; the new vertical axis (per-event relationships) handles "specifically connected to this event," regardless of payroll.
666
+
667
+ #### Backward compatible
668
+
669
+ The string form keeps working — `via: 'attendeeOf'` is sugar for `via: ['attendeeOf']`. No existing namespaces break; opt into multi-lane by switching to the array form when you actually need it.
670
+
671
+ #### Compile-time guards
672
+
673
+ The validator rejects three things at parse time:
674
+
675
+ - **Undeclared lane names** — every entry in the array must resolve to an `authz.relationships[*]` declaration.
676
+ - **Lanes that disagree on `loads:` or `exposeAs:`** — if attendeeOf loads `events` as `ctx.event` and organizerOf loads `agendaItems` as `ctx.agendaItem`, downstream handlers can't predict what's in `ctx.<exposeAs>`. Lanes in one namespace must hydrate the same shape.
677
+ - **Empty arrays** — at least one lane is required (otherwise the namespace gate is meaningless).
678
+
679
+ #### Follow-up: v0.26 bulk-grant lanes (shipped same day — see above)
680
+
681
+ The full 4-lane shape adds heterogeneous `via:` arrays accepting `{ roles: ['admin', 'owner'] }` and `{ team: true }` entries, so org admins and team members get the gate without writing relationship rows. v0.25 was the foundation; [v0.26](#v0260--may-19-2026) lifted the existing per-action `access.or: [..., { roles: [...] }]` shim into the namespace and landed same-day.
682
+
3
683
  ## v0.24.0 — May 19, 2026
4
684
 
5
685
  ### Cross-feature namespaces: one hoisted gate, many features
@@ -78,6 +758,21 @@ Zero breaking changes. Nothing in v0.23 needs to change for v0.24 to land. The n
78
758
 
79
759
  The harvester runs after Zod schema validation but before route generation, so unused or misconfigured namespaces surface immediately as errors or warnings rather than as silently-broken routes.
80
760
 
761
+ #### Fixes shipped alongside
762
+
763
+ The first two were load-bearing for v0.23 namespaces to actually work — projects upgrading from a pre-fix v0.23 will see crashes/compile errors disappear on the v0.24 recompile.
764
+
765
+ - **No more dual emission of namespace-claimed standalone routes.** Pre-fix, an action with a cross-feature path like `/event/:eventId/agenda/list-my-agenda` emitted into both `src/index.ts` (without the namespace resolver) and the synthetic file (with it). The plain root copy in `src/index.ts` won every URL match and `ctx.<exposeAs>` was never hydrated — every request 500'd with `Cannot read properties of undefined (reading 'id')`. `extractStandaloneActions` now skips namespace-claimed actions; the synthetic namespace file is the sole emission.
766
+ - **Stripped-path validator no longer rejects namespace-claimed actions.** The synthetic file mounts at `/api/v1${namespace.prefix}` and strips the prefix from each action's local path. The per-action relationship-resolver was validating the *stripped* path for `:eventId`, finding nothing, and rejecting every namespace-mounted action with "action's surface exposes neither a path parameter ':eventId' nor an input field 'eventId'". `planRelationshipResolver` now receives the namespace's `via` and skips its surface-key check entirely — the hoisted middleware is the single source of truth.
767
+ - **Broadcaster DO migration tag consistent across `realtime.mode`.** Inline-mode emission was already going through `qb-do-${className}` + `new_sqlite_classes`. Separate-mode was still hardcoded `tag = "v1"` + `new_classes`, so flipping `realtime: { mode }` produced different migration tags for the same DO class and tripped CF error 10074 ("class already depended on") on cross-mode deploys. Both modes now emit `tag = "qb-do-Broadcaster"` + `new_sqlite_classes`.
768
+ - **Batch handler id arrays type-derive from the input parser.** Pre-fix, `validIds`, `recordMap`, and `validEntries` in bulk-delete / bulk-update / bulk-upsert were hardcoded `string[]` / `Map<string, any>` even when the table's PK column was `integer("id")` — 274× TS2769 in projects mixing string and integer PKs. Handlers now declare `type IdT = typeof ids[number]` (or `typeof records[number]['id']`) and use it for the local id types. Strings stay strings, integers stay integers, no emitter knowledge of the PK column type required.
769
+ - **`ctx` in action handlers is now `AppContext`, not `any`.** Both `StandaloneExecuteParams.ctx` and `RecordExecuteParams.ctx` in the generated `<feature>/.quickback/define-action.ts` are typed `AppContext`. AppContext keeps its `[key: string]: any` index signature so hydrated namespace keys (`ctx.event`, `ctx.<exposeAs>`) stay accessible without TS2339; named fields (`userId`, `activeOrgId`, `roles`, `authenticated`, `user`) get autocomplete and type-checking. Cleared ~49× TS2339 in generated projects.
770
+ - **`c.get('ctx') as AppContext` in every emitted route handler.** Pre-fix, `const ctx = c.get('ctx')` returned `any`, so `ctx.roles?.some(r => …)` left the callback parameter implicitly `any` — 16× TS7006. Now `ctx.roles` is `string[] | undefined`, `r` is `string`, no callback annotation needed.
771
+
772
+ #### Deferred (tracked, not blocking)
773
+
774
+ - Per-namespace narrow typing of `ctx.<exposeAs>` (so `ctx.event` resolves to `typeof events.$inferSelect` instead of `any`). The compiler emits a typed cast at the `execute()` call site in the routes file today, which type-checks the call but not the handler body. Full narrow typing requires per-namespace helper emission (one `define-action.<namespace>.ts` per namespace, or a generic param threading through the action config). Tracked separately.
775
+
81
776
  ---
82
777
 
83
778
  ## v0.23.0 — May 19, 2026