@ultimat3/cli 31.37.0 → 31.38.0

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 (44) hide show
  1. package/package.json +29 -29
  2. package/src/cmd-planned.ts +5 -28
  3. package/src/generate-sign-in-runtime.ts +70 -0
  4. package/src/generate-sign-in.ts +19 -6
  5. package/src/generate-write.ts +12 -0
  6. package/src/island-plugin-path.ts +35 -0
  7. package/src/island-realtime.ts +11 -8
  8. package/src/island-runtime.ts +4 -1
  9. package/src/new-shapes.ts +10 -1
  10. package/src/templates/shapes/agent-actions.ts +224 -0
  11. package/src/templates/shapes/agent-job.ts +171 -0
  12. package/src/templates/shapes/agent-model.ts +271 -0
  13. package/src/templates/shapes/agent-prompt.ts +254 -0
  14. package/src/templates/shapes/agent-scripted.ts +56 -0
  15. package/src/templates/shapes/agent.ts +138 -0
  16. package/src/templates/shapes/content-admin-es.ts +95 -0
  17. package/src/templates/shapes/content-pages.ts +221 -0
  18. package/src/templates/shapes/content-site.ts +343 -0
  19. package/src/templates/shapes/content.ts +133 -0
  20. package/src/templates/shapes/index.ts +10 -0
  21. package/src/templates/shapes/offline-e2e.ts +123 -0
  22. package/src/templates/shapes/offline-form.ts +334 -0
  23. package/src/templates/shapes/offline.ts +118 -0
  24. package/src/templates/shapes/realtime-mutator.ts +136 -0
  25. package/src/templates/shapes/realtime-nodes.ts +203 -0
  26. package/src/templates/shapes/realtime-slice.ts +166 -0
  27. package/src/templates/shapes/realtime.ts +162 -0
  28. package/src/templates/shapes/saas-billing-tests.ts +135 -0
  29. package/src/templates/shapes/saas-billing.ts +137 -0
  30. package/src/templates/shapes/saas-receiver.ts +136 -0
  31. package/src/templates/shapes/saas.ts +112 -0
  32. package/src/templates/sign-in-oidc.ts +2 -4
  33. package/src/templates/sign-in-runtime.ts +172 -0
  34. package/src/templates/sign-in-shared.ts +5 -36
  35. package/wiki/Building-Your-Own-Base.md +339 -0
  36. package/wiki/CLI-Reference.md +1 -14
  37. package/wiki/Caching-And-Invalidation.md +1 -1
  38. package/wiki/Entities-And-Migrations.md +2 -2
  39. package/wiki/Known-Gaps.md +8 -2
  40. package/wiki/MCP-And-AI.md +3 -3
  41. package/wiki/Money.md +1 -1
  42. package/wiki/Shapes.md +18 -9
  43. package/wiki/Troubleshooting.md +1 -1
  44. package/wiki/Upgrading.md +1 -1
@@ -198,6 +198,345 @@ The action is the app's (`apps/web/app/operators/actions/switch-operator.ts`), s
198
198
  any other — route, typed client, MCP tool, contract test. Nothing in the framework learns that a PIN
199
199
  exists, which is the point: the next app's PIN rules (length, rotation, which devices) are its own.
200
200
 
201
+ The check itself, one file the action calls with the operator row it loaded:
202
+
203
+ ```ts
204
+ // apps/web/shared/base/operator-pin.ts
205
+ import {
206
+ type Auth,
207
+ type AuthSession,
208
+ createSession,
209
+ hashPassword,
210
+ type IssuedSession,
211
+ loginFailed,
212
+ sessionCookie,
213
+ verifyPassword,
214
+ } from '@ultimat3/auth';
215
+
216
+ /** The app's `operators` row: whose PIN, and its hash. Never `x_users.password_hash`. */
217
+ export interface OperatorRow {
218
+ readonly userId: string;
219
+ readonly pinHash: string;
220
+ }
221
+
222
+ export interface OperatorSwitch {
223
+ readonly operatorId: string;
224
+ readonly pin: string;
225
+ /** `null` when no operator has that id — checked at the same cost as a wrong PIN. */
226
+ readonly operator: OperatorRow | null;
227
+ /** The device account's session, as `authenticate` resolved it. */
228
+ readonly device: Pick<AuthSession, 'userId' | 'absoluteExpiresAt'>;
229
+ }
230
+
231
+ /** Enrolment: the same KDF a password gets, so a leaked table is not 10 000 cheap guesses. */
232
+ export const enrolPin = (pin: string): Promise<string> => hashPassword(pin);
233
+
234
+ /**
235
+ * The PIN proves the operator; the answer is their session, capped at the device's, and the
236
+ * cookie line the response sets. The attempt is RESERVED before the KDF, per operator and per
237
+ * device: a fifth wrong PIN locks that pair (`X_ACCOUNT_LOCKED`), and every refusal before it is
238
+ * `loginFailed()` — one code whether the PIN was wrong or the operator does not exist.
239
+ */
240
+ export async function switchOperator(
241
+ auth: Auth,
242
+ input: OperatorSwitch,
243
+ ): Promise<{ readonly issued: IssuedSession; readonly cookie: string }> {
244
+ const key = `pin:${input.operatorId}:${input.device.userId}`;
245
+ await auth.limiter.reserve(key);
246
+ const hash = input.operator?.pinHash ?? null;
247
+ const verdict = await verifyPassword({ hash, password: input.pin });
248
+ if (!verdict.ok || input.operator === null) throw loginFailed();
249
+ await auth.limiter.recordSuccess(key);
250
+ const issued = await createSession(auth.sessions, {
251
+ userId: input.operator.userId,
252
+ absoluteExpiresAt: input.device.absoluteExpiresAt,
253
+ });
254
+ return { issued, cookie: sessionCookie(issued.token, auth.sessions.policy) };
255
+ }
256
+ ```
257
+
258
+ The comparison is the KDF's, constant-time inside `Bun.password.verify`; a PIN is never hashed
259
+ with a fast digest and compared with `timingSafeEqual`, because four digits under SHA-256 are
260
+ reversed from a leaked table in milliseconds. The lockout is `Auth.limiter`, so a deployment that
261
+ declared `rateLimit.scope: 'shared'` counts PIN guesses fleet-wide with no change here.
262
+
263
+ ## Recipe: billing
264
+
265
+ Billing is **not** a package (axiom 8): a price list, a refund rule and a dunning schedule are a
266
+ business's, and a framework that shipped one would ship the wrong one. It is one app file over
267
+ three shipped primitives — `defineFlag` for entitlements, `webhookReceiver` for the payment
268
+ provider's events, `Money` for prices.
269
+
270
+ | Piece | Where it lives | What it calls |
271
+ |---|---|---|
272
+ | plans and prices | `PLANS`, a constant: `Money` is `{ minor, currency }`, never a float | `equals` from `@ultimat3/money` |
273
+ | an entitlement | a **permanent** flag whose subject is the org's plan: `{ subjects: { plan: [...] } }` | `defineFlag`, `isEnabled(key, actor, { plan })` |
274
+ | a comp, a trial, a grandfathered org | the same flag, its targeting moved by an operator — `orgs: ['org_…']` | `applyFlagSnapshot` |
275
+ | the provider's event | a signed POST, verified over the exact bytes, enqueued, acknowledged | `webhookReceiver`, `verifyBodyHmac` |
276
+ | the plan change | the receiver's job: the paid amount must equal the plan's price, then the app's table moves | `PlanStore.setPlan`, one `step.run` |
277
+
278
+ ```ts
279
+ // apps/web/shared/base/billing.ts
280
+ import type { Actor } from '@ultimat3/core';
281
+ import { defineError } from '@ultimat3/core/page';
282
+ import { defineFlag, isEnabled } from '@ultimat3/flags';
283
+ import { verifyBodyHmac } from '@ultimat3/http';
284
+ import { webhookReceiver } from '@ultimat3/jobs';
285
+ import { equals, type Money } from '@ultimat3/money';
286
+ import { type JsonValue, parse, t } from '@ultimat3/schema';
287
+
288
+ /** The price list is the app's. A price is integer minor units and a currency, never a float. */
289
+ export const PLANS = {
290
+ free: { price: { minor: 0, currency: 'USD' } },
291
+ team: { price: { minor: 4_900, currency: 'USD' } },
292
+ scale: { price: { minor: 19_900, currency: 'USD' } },
293
+ } as const satisfies Record<string, { readonly price: Money }>;
294
+
295
+ const PLAN_IDS = ['free', 'team', 'scale'] as const satisfies readonly (keyof typeof PLANS)[];
296
+ export type PlanId = (typeof PLAN_IDS)[number];
297
+
298
+ /** An entitlement is a permanent flag, and the org's plan is the subject it targets. */
299
+ export const entitlement = (name: string, description: string, plans: readonly PlanId[]) =>
300
+ defineFlag({
301
+ kind: 'permanent',
302
+ key: `entitlement.${name}`,
303
+ description,
304
+ targeting: { default: false, subjects: { plan: plans } },
305
+ });
306
+
307
+ /** Synchronous, so a policy predicate asks it: `entitled('exports', actor, row.plan)`. */
308
+ export const entitled = (name: string, actor: Actor | null, plan: PlanId): boolean =>
309
+ isEnabled(`entitlement.${name}`, actor, { plan });
310
+
311
+ export const BillingEventMalformed = defineError({
312
+ code: 'X_BILLING_EVENT_MALFORMED',
313
+ title: 'a signed billing event is not JSON',
314
+ status: 422,
315
+ cause: 'the payment provider signed a body that does not parse as JSON',
316
+ fix: "x jobs list --name billing.events --json # then compare the provider's event log",
317
+ });
318
+
319
+ export const BillingAmountMismatch = defineError<{ readonly plan: PlanId }>({
320
+ code: 'X_BILLING_AMOUNT_MISMATCH',
321
+ title: 'a paid amount is not the plan price',
322
+ offSocket: true,
323
+ retry: 'terminal',
324
+ cause: (p) => `the provider charged an amount for plan ${p.plan} that is not PLANS.${p.plan}.price`,
325
+ fix: (p) => `edit apps/web/shared/base/billing.ts: set PLANS.${p.plan}.price to what the provider charges`,
326
+ });
327
+
328
+ /** The event, as the provider signs it. Vendor-neutral here; an app maps its provider's shape. */
329
+ const PlanChanged = t.object({
330
+ id: t.string,
331
+ type: t.literal('plan.changed'),
332
+ orgId: t.string,
333
+ plan: t.enumerated(...PLAN_IDS),
334
+ amount: t.money,
335
+ });
336
+
337
+ /** The app's own table. Idempotent on `eventId`: a redelivered event writes nothing twice. */
338
+ export interface PlanStore {
339
+ setPlan(orgId: string, plan: PlanId, eventId: string): Promise<void>;
340
+ }
341
+
342
+ export interface BillingReceiverInit {
343
+ /** Read per delivery, never captured: a rotation is a list, and any of it verifies. */
344
+ readonly secret: () => string | readonly string[];
345
+ readonly plans: () => PlanStore;
346
+ }
347
+
348
+ /** POST `/hooks/billing`: verify the signature over the exact bytes, then queue the change. */
349
+ export const billingReceiver = (init: BillingReceiverInit) =>
350
+ webhookReceiver({
351
+ name: 'billing.events',
352
+ path: '/hooks/billing',
353
+ tenant: (event) => event.orgId,
354
+ verify: (inbound) => {
355
+ const { text } = verifyBodyHmac({
356
+ bytes: inbound.bytes,
357
+ secret: init.secret(),
358
+ given: inbound.headers.get('x-billing-signature'),
359
+ encoding: 'hex',
360
+ });
361
+ let body: JsonValue;
362
+ try {
363
+ body = JSON.parse(text ?? '');
364
+ } catch {
365
+ throw new BillingEventMalformed();
366
+ }
367
+ // Refused here, before anything queues: a body that is not this event is a 422 to the sender.
368
+ const event = parse(PlanChanged, body);
369
+ return { eventId: event.id, orgId: event.orgId, topic: event.type, payload: body };
370
+ },
371
+ handle: async ({ eventId, payload, step }) => {
372
+ const change = parse(PlanChanged, payload);
373
+ if (!equals(change.amount, PLANS[change.plan].price)) {
374
+ throw new BillingAmountMismatch({ plan: change.plan });
375
+ }
376
+ await step.run('set-plan', () => init.plans().setPlan(change.orgId, change.plan, eventId));
377
+ },
378
+ });
379
+ ```
380
+
381
+ Declare it once, beside the entitlements the app sells:
382
+
383
+ | Call | Where |
384
+ |---|---|
385
+ | `export const exports = entitlement('exports', 'CSV and PDF exports', ['team', 'scale']);` | `apps/web/shared/base/entitlements.ts` |
386
+ | `export const billingEvents = billingReceiver({ secret: () => (Bun.env['BILLING_WEBHOOK_SECRET'] ?? '').split(','), plans: () => planRepo });` | `apps/web/app/billing/jobs/billing-events.ts`, listed in `apps/web/api/index.ts`'s `jobs:` — where `x g webhook-receiver` puts one; the boot mounts its route |
387
+ | `can('export:run', ({ actor, row }) => row !== null && entitled('exports', actor, row.plan))` | the policy on the export action — the org's plan is a row the action loads |
388
+
389
+ The signature check is `verifyBodyHmac`: HMAC-SHA256 over the exact bytes, compared with core's
390
+ `timingSafeEqual` under every secret of a rotation. A bad one is `X_WEBHOOK_SIGNATURE_INVALID`
391
+ (401) and queues nothing; a redelivery while the job is live is deduped by `eventId`; after it
392
+ settles the handler runs at least once, which is why `setPlan` is keyed on `eventId`. What a
393
+ provider calls an event, a proration, a failed card: the app maps them in `verify` and `handle`.
394
+
395
+ ## Recipe: PDF assembly
396
+
397
+ The framework prints; the app assembles. `pdf()` (`@ultimat3/scraping`) is a factory over
398
+ `action`: it renders one of the app's **own routes** in Chrome and writes the bytes to a disk,
399
+ gated by the action's policy. A document of many parts — a cover, line items, an appendix — is
400
+ one route the app composes in HTML, page breaks in CSS (`break-before: page`), printed once.
401
+ **No PDF merge ships**: two printed files are never concatenated; a pack is one route that renders
402
+ every part. What the app's convention adds is one layout, one disk and one key scheme.
403
+
404
+ ```ts
405
+ // apps/web/shared/base/document-pdf.ts
406
+ import type { ActionPolicy } from '@ultimat3/action';
407
+ import type { Actor } from '@ultimat3/core';
408
+ import { defineError } from '@ultimat3/core/page';
409
+ import type { InferOutput, StandardSchemaV1 } from '@ultimat3/schema';
410
+ import { type PdfLayout, type PdfRenderer, pdf } from '@ultimat3/scraping';
411
+ import { disk } from '@ultimat3/storage';
412
+
413
+ /** Every document this app prints: A4, one margin, page numbers in the footer — Chrome fills them. */
414
+ export const HOUSE_LAYOUT: PdfLayout = {
415
+ format: 'a4',
416
+ marginMm: { top: 18, right: 16, bottom: 18, left: 16 },
417
+ printBackground: true,
418
+ footerHtml: '<span class="pageNumber"></span> / <span class="totalPages"></span>',
419
+ };
420
+
421
+ export const DocumentOrgRequired = defineError({
422
+ code: 'X_DOCUMENT_ORG_REQUIRED',
423
+ title: 'a document is printed for an organisation',
424
+ status: 403,
425
+ cause: 'the caller has no organisation, so the document has no tenant folder to land in',
426
+ fix: "can('<document>:print', ({ actor }) => actor?.orgId !== undefined) # on the document's policy",
427
+ });
428
+
429
+ const orgOf = (actor: Actor): string => {
430
+ if (actor.orgId === undefined) throw new DocumentOrgRequired();
431
+ return actor.orgId;
432
+ };
433
+
434
+ interface DocumentDef<TInput extends StandardSchemaV1<unknown, { readonly id: string }>> {
435
+ /** The folder on the `documents` disk: `invoice`, `statement`. */
436
+ readonly kind: string;
437
+ readonly input: TInput;
438
+ readonly policy: ActionPolicy;
439
+ /** The app route that ASSEMBLES the document — its parts, in order, as HTML the app owns. */
440
+ route(input: InferOutput<TInput>): string;
441
+ /** Tests hand in a renderer; production prints through the shared Chrome. */
442
+ readonly renderer?: PdfRenderer | undefined;
443
+ }
444
+
445
+ /** A document is an action: HTTP, OpenAPI, MCP, `.job()` for a batch — and the same policy. */
446
+ export const documentPdf = <TInput extends StandardSchemaV1<unknown, { readonly id: string }>>(
447
+ def: DocumentDef<TInput>,
448
+ ) =>
449
+ pdf({
450
+ input: def.input,
451
+ policy: def.policy,
452
+ route: ({ input }) => def.route(input),
453
+ key: ({ input, ctx }) => `${orgOf(ctx.actor)}/${def.kind}/${input.id}.pdf`,
454
+ storage: () => disk('documents'),
455
+ layout: HOUSE_LAYOUT,
456
+ renderer: def.renderer,
457
+ });
458
+ ```
459
+
460
+ | Call | Answers |
461
+ |---|---|
462
+ | ``export const statementPdf = documentPdf({ kind: 'statement', input: t.object({ id: t.string }), policy: statementRead, route: ({ id }) => `/statements/${id}/print` })`` | `{ key: '<org>/statement/<id>.pdf', bytes, contentType }`, never the bytes |
463
+ | `await statementPdf.job().enqueue(…)` per org at month end | the batch, on the worker, with the action's policy |
464
+
465
+ The route is private, so `pdf()`'s `headers` option carries a short-lived token the app signs, and
466
+ the browser sends it only to the route's own origin. Chrome is a runtime dependency of the image
467
+ that prints (`CHROME_PATH`), and `chromePdfRenderer({ maxConcurrent })` bounds how many run.
468
+
469
+ ## Recipe: a named proxy pool
470
+
471
+ `scrape({ egress })` (`@ultimat3/scraping`) names the exit **one run** leaves through, resolved in
472
+ the worker. A pool — several exits under one name, a session kept on one of them — is the app's,
473
+ because which provider, how many exits and what "sticky" means are business decisions.
474
+
475
+ ```ts
476
+ // apps/web/shared/base/proxy-pool.ts
477
+ import { defineError } from '@ultimat3/core/page';
478
+
479
+ export const ProxyPoolEmpty = defineError<{ readonly variable: string }>({
480
+ code: 'X_PROXY_POOL_EMPTY',
481
+ title: 'a named proxy pool has no exit',
482
+ offSocket: true,
483
+ retry: 'terminal',
484
+ cause: (p) => `${p.variable} is unset or empty in the worker, so the pool has no exit to hand out`,
485
+ fix: (p) => `printf '%s' 'http://user:pass@exit-1.example:8080,http://user:pass@exit-2.example:8080' | x secrets set ${p.variable}`,
486
+ });
487
+
488
+ export interface ProxyPool<I> {
489
+ readonly name: string;
490
+ /** The secret holding the exits, comma-separated: `PROXY_POOL_<NAME>`. */
491
+ readonly variable: string;
492
+ /** For `scrape({ egress })`: the same subject always leaves through the same exit. */
493
+ egress(input: I): string;
494
+ }
495
+
496
+ /**
497
+ * `stickyBy` names the subject a site must see on one address — a connection, an account. Its
498
+ * hash picks the exit, so every worker agrees with no table. The exits are read per run, in the
499
+ * worker, so neither a URL nor its password ever rides the queue row.
500
+ */
501
+ export function proxyPool<I>(name: string, stickyBy: (input: I) => string): ProxyPool<I> {
502
+ const variable = `PROXY_POOL_${name.toUpperCase().replaceAll('-', '_')}`;
503
+ return {
504
+ name,
505
+ variable,
506
+ egress(input) {
507
+ const exits = (Bun.env[variable] ?? '')
508
+ .split(',')
509
+ .map((exit) => exit.trim())
510
+ .filter((exit) => exit !== '');
511
+ const exit = exits[Number(Bun.hash.wyhash(stickyBy(input)) % BigInt(exits.length || 1))];
512
+ if (exit === undefined) throw new ProxyPoolEmpty({ variable });
513
+ return exit;
514
+ },
515
+ };
516
+ }
517
+ ```
518
+
519
+ | Call | Where |
520
+ |---|---|
521
+ | `export const residential = proxyPool<{ connectionId: string }>('residential', (input) => input.connectionId);` | `apps/web/shared/base/pools.ts` |
522
+ | `scrape({ …, egress: residential.egress, concurrency: { key: (input) => input.connectionId, limit: 1 } })` | the scrape; the input carries the connection id, never an exit |
523
+ | `printf '%s' '<exit>,<exit>' \| x secrets set PROXY_POOL_RESIDENTIAL` | once per environment |
524
+
525
+ The exit's password is concealed in every artifact and log line the run writes, and an exit whose
526
+ credential is also in the input is refused before the browser opens
527
+ (`X_SCRAPE_EGRESS_IN_PAYLOAD`). Adding an exit moves some subjects to new addresses — the hash
528
+ spreads over the list as it stands; a pool that must never move a subject keeps the assignment in
529
+ the connection's own row, and `egress` reads that row instead.
530
+
531
+ ## Every recipe here runs
532
+
533
+ `As of 2026-11-16`, each `ts` fence under a `Recipe:` heading is compiled by the gate
534
+ (`scripts/wiki-fences.ts`) and **run**: `bun test ./scripts/base-recipes/` writes the fence to the
535
+ path its first line names, in a scratch app, imports it and drives it — a signed event moving an
536
+ entitlement, a document landing on its disk, a fifth wrong PIN locking, a subject keeping its exit.
537
+ The gate's `unit` step runs them on every change, and `.github/workflows/tutorial-run.yml` on every
538
+ push to `main` that touches this page.
539
+
201
540
  ## The honest limit
202
541
 
203
542
  **The registry cannot tell that an entity came from your factory, and that erasure is the feature.**
@@ -72,10 +72,7 @@ x version # CLI version
72
72
  | `x cache graph\|bust <tag>\|clear` | the tag graph off the manifest (what each write evicts), a bust of one tag or every declared tag through the app's own tiers and bus · `stats` was removed `As of 2026-11-15` ([Known gaps](Known-Gaps#not-built-yet)) | shipped |
73
73
  | `x explain <query> [--input <json>] [--org <id>]` | one declared query run once on the dev database, every statement it sent planned by the `exercise` step's oracle | shipped |
74
74
  | `x profile <route> [--runs 20] [--top 10]` | a CPU profile of rendering one route in this process: the hottest functions, file and line | shipped |
75
- | `x branch` | copy-on-write branch environments | planned |
76
75
  | `x status [--url <origin>] [--samples n]` | the build each live worker runs (`x_job_workers`), and the build, status and role each sampled origin's `/readyz` answers | shipped |
77
- | `x ai` | eval, cache stats, reindex | planned |
78
- | `x money add-currency` | extend the currency table | planned |
79
76
 
80
77
  ## x new
81
78
 
@@ -2207,17 +2204,7 @@ A route answering `>= 400` is profiled and reported red, `X_PROFILE_ROUTE_FAILED
2207
2204
 
2208
2205
  ## Planned commands
2209
2206
 
2210
- Specified in the design docs, not yet implemented. Every one is in the command registry: calling it exits `X_NOT_IMPLEMENTED` with a `fix:` naming the closest shipped command, because "not built yet" and "not a command" are different facts and only one of them is true.
2211
-
2212
- The table is `PLANNED_COMMANDS` in `packages/cli/src/cmd-planned.ts`; `cmd-planned.test.ts` asserts every row is reachable through the parser and that no `fix` points at another planned command. `PLANNED_SUBCOMMANDS` in the same file is the one-level-down version — a subcommand of a shipped command that this build does not implement — and is empty `As of 2026-11-15`: `x db`'s `studio`, `x jobs`'s `drain`, `x token`'s `grant` and `x cache`'s `stats` left the registry, each with its reason in [Known gaps](Known-Gaps), and the parser now refuses each with `X_CLI_UNKNOWN_COMMAND` — exit 1, as `X_NOT_IMPLEMENTED` was.
2213
-
2214
- | Command | Purpose | `fix:` today |
2215
- |---|---|---|
2216
- | `x branch [<name>\|delete <name>]` | copy-on-write database + preview URL + scoped MCP socket | `x db branch list --json` — the database half: `list`, `create <name>`, `delete <name>` |
2217
- | `x ai [eval <name>\|cache\|reindex]` | eval scores, cache hit rate and tokens saved, vector reindex | `x test eval --json` |
2218
- | `x money add-currency <ISO> --exponent <n>` | extend the currency table | `x errors explain X_CURRENCY_UNKNOWN --json` — extend it in code: `registerCurrency({ code, exponent, name })` from `@ultimat3/money`, once at boot. Shipped `As of 2026-08`, and it is what this command promised |
2219
-
2220
- **Flags reach the same answer**, `As of 2026-10`: `x money add-currency USD --exponent 2` and `x branch --follow --json` exit `X_NOT_IMPLEMENTED` with the row's `fix:`, as the bare form does.
2207
+ None, `As of 2026-11-16`. The table is `PLANNED_COMMANDS` in `packages/cli/src/cmd-planned.ts`, and it is empty: a planned command is registered so it can exit `X_NOT_IMPLEMENTED` with a `fix:` naming the closest shipped command, and the last three left the registry with plan 101b slice 13. `x branch`, `x ai` and `x money` are each a row in [Known gaps](Known-Gaps) with the decision ("not planned") and the extension point that does the job today, and the parser refuses each with `X_CLI_UNKNOWN_COMMAND`. `PLANNED_SUBCOMMANDS`, the one-level-down version, has been empty since `As of 2026-11-15` (`x db studio`, `x jobs drain`, `x token grant` and `x cache stats` went the same way). `cmd-planned.test.ts` asserts every row that returns is reachable through the parser and that no `fix` points at another planned command.
2221
2208
 
2222
2209
  `x token`, `x config`, `x logs` and `x cache` left this table `As of 2026-11` (plan 101-full-stack-efficiency-sweeps U5), `x status` `As of 2026-11-15`; each has its section above.
2223
2210
 
@@ -221,7 +221,7 @@ export const summarize = llm({
221
221
  | Scope | optional — the calling **actor** by default, so one org never reads another's completion. Widening is written down: `scope: () => 'global'` |
222
222
  | Bypass | `temperature > 0` results are cached but flagged; `cache: false` for anything user-visible-and-unique |
223
223
  | Invalidation | participates in the same tag graph; bumping the prompt version invalidates wholesale |
224
- | Metrics | hit rate, tokens saved, cost saved — in `/_x` and `x ai cache --json` |
224
+ | Metrics | every `llm()` call emits `ai.llm` on the instrumentation bus with `cacheHit`, `inputTokens` and `outputTokens`; hit rate and tokens saved are a subscriber's sum, and `gen_ai_client_token_usage` is on `/metrics` → [Observability](Observability) |
225
225
 
226
226
  **The locale is part of the key, and not part of the scope** — `As of 2026-08-24`. A prompt that takes `locale` as a var differs by one token between languages while carrying a whole document, so the two rendered prompts are near-identical to an embedder: measured over the reference app's summarize template, **0.9986**, against the `threshold: 0.97` in the snippet above. Before this, whichever language asked first was served to everyone — an English reader got the Spanish summary, and the model had done nothing wrong.
227
227
 
@@ -1491,7 +1491,7 @@ X_MIGRATION_DESTRUCTIVE: this migration destroys data and does not say so
1491
1491
 
1492
1492
  ## Branch DBs for agents
1493
1493
 
1494
- The shipped command is `x db branch`, and it takes a verb from a closed set — `list`, `create <name>`, `delete <name>`. `x branch` (no `db`) is **planned** and exits `X_NOT_IMPLEMENTED`; the build and MCP-socket halves of the design below are what it will add.
1494
+ The command is `x db branch`, and it takes a verb from a closed set — `list`, `create <name>`, `delete <name>`. A whole branch environment — a build and an MCP socket per branch — is **not planned**, `As of 2026-11-16` ([Known gaps](Known-Gaps#open-by-decision)): run one more container of the app's image with `DATABASE_URL` naming the branch database.
1495
1495
 
1496
1496
  ```bash
1497
1497
  x db branch create feat-new-billing --json
@@ -1511,7 +1511,7 @@ x db branch create feat-new-billing --json
1511
1511
  | Listing | `x db branch list` — name, location, created-at, size, over either database. **Managed branches only**: external, a database carrying `createBranch()`'s marker comment (`listBranches()` is that read); embedded, a `pgdata-<name>` directory under the state dir (`listPgliteBranches()`, in the CLI). A branch cloned by the pre-1.2.x `psql` path carries no marker and is invisible → [Known gaps](Known-Gaps). `created-at` and `size` read `unknown` where nothing recorded one — always the size on the embedded side, since measuring it is a full directory walk | **shipped** |
1512
1512
  | Teardown | `x db branch delete <name>`. It may only delete what `list` shows, and that guard lives in the **CLI** (`runDelete`): the shared database this session is connected to carries no marker, so it is not in the set, and there is no `--force` to get it wrong with. `@ultimat3/db`'s `dropBranch()` is the statement underneath, not the same operation — it takes the **database** name (`<source>_branch_<slug>`), reads no marker, and will drop any database but the current one. Its `force: true` means "terminate other sessions first", which the CLI always passes; it is not an override of the guard | **shipped** |
1513
1513
  | Reaping | `reapBranches({ maxAgeMs })` drops **branches of this database only**, `As of 2026-08-19`. The marker is `ultimate:branch:<base>:<iso>` and `BranchInfo` carries `base`; a branch whose base is not `current_database()` is skipped, and so is a pre-3.x marker that records no base at all. A `createdAt` that is not finite, or that does not round-trip through `toISOString()`, is also skipped — a truncated comment used to read as an infinitely old branch and be dropped on the next sweep whatever `maxAgeMs` said | **shipped** |
1514
- | Build + scoped MCP socket | a per-branch build id scoping the service worker, and `ws://localhost:9229/<branch>` | **planned**, part of `x branch` |
1514
+ | Build + scoped MCP socket | a preview container started with its own `BUILD_ID` gets its own service-worker cache namespaces (`cacheNamespace(buildId, …)`, `packages/pwa/src/service-worker.ts:201`); `x mcp serve --transport http --port <n>` with `DATABASE_URL` naming the branch is that branch's MCP host | **not planned** as one command; both halves are an env var on what ships |
1515
1515
 
1516
1516
  The same clone mechanism powers test parallelism: each worker gets its own `ultimate_test_template_w<N>` cloned from the migrated template `ultimate_test_template`, typically 100–400ms. Never mock the database — clone it.
1517
1517
 
@@ -62,7 +62,7 @@ CHANGELOG.md` finds its bounds, and it changes on any commit.
62
62
 
63
63
  ## Open by decision
64
64
 
65
- Each of these is a defect somebody has already argued about, and the reasoning is why it stays.
65
+ Each of these is a defect, or a target, somebody has already argued about, and the reasoning is why it stays. A target "not planned" names the extension point an app builds on instead.
66
66
 
67
67
  | Gap | Why it stays |
68
68
  |---|---|
@@ -77,6 +77,12 @@ Each of these is a defect somebody has already argued about, and the reasoning i
77
77
  | Drift never compares an index's `where` **text** | the catalog answers its own rewriting of the expression (`(deleted_at IS NULL)`) where the snapshot holds the author's spelling (`deleted_at is null`), so comparing the strings reports drift on a database that is exactly right. Normalising them means shipping an expression parser to compete with the server's. Three of the four parts of an index **are** compared now — columns, uniqueness, direction, and the predicate's **presence** — so a partial index recreated as a total one and a `desc` index rebuilt ascending are both caught ([`packages/db/src/drift.ts`](https://github.com/developerz-ai/ultimate/blob/main/packages/db/src/drift.ts), `compareIndexes`). `x db gen` compares the text, where both sides are generated. A predicate rewritten by hand into a *different* predicate of the same presence is the residue, and it is invisible: regenerate and read the diff |
78
78
  | A long `backfill()` retains one step name per batch | `stepRunner`'s `claimed` Set is the authority for `X_STEP_DUPLICATE` and is deliberately unbounded: a 5M-row sweep at `batch: 250` holds 20,000 short strings (~1–2 MB) for the life of the attempt, released when it ends. `MAX_TRACE_NAMES` bounds the *reported* trace, not the membership set. Bounding the set would let a duplicate step name through after 200 batches, and silently replaying a step is the worse failure. Raise `batch` if the attempt is long enough for the retention to matter |
79
79
  | The admin has no one-click select-all | `As of 2026-10`, by decision: the admin ships zero JavaScript (`hydrate: 'never'`), so every control is a link or a native form. A row checkbox joins the batch form through its `form` attribute, "all matching" is a radio whose meaning is the list's URL, and an action's input is its own page. Selecting every row on one page is one click per row. An island would buy that click and cost the admin its zero-script rule, and "all matching" already covers the whole list |
80
+ | A desktop app target | not planned, `As of 2026-11-16`. It was milestone 12 of the roadmap, a design ([`16-app-targets.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/idea/16-app-targets.md)) and never a plan in progress, and finished means the list of intended work is empty. The extension point is the build output: `x build --target static` or `x build --target binary` is the `app/` bundle and the server that answers it, which an app-owned desktop shell wraps; the installable PWA (`@ultimat3/pwa`: manifest, service worker, offline fallback) already installs as a desktop window from a Chromium browser. |
81
+ | A mobile app target — a native view layer beside SolidJS | not planned, `As of 2026-11-16`. It was milestone 13, design only ([`16-app-targets.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/idea/16-app-targets.md)). The extension point is the contract every client already reads: each `action` and `query` is HTTP with an OpenAPI document (`openapi.json`, written by `x manifest`), `x.manifest.json`, the typed client and `application/problem+json` errors, so a native app is one more client of the same policies. The installable PWA is the phone app the framework ships. |
82
+ | Over-the-air bundle updates for a native app | not planned, `As of 2026-11-16`. It was milestone 14, design only, and has no native bundle to update without milestone 13. The extension point is the web's own update path: an immutable build ID, earlier builds kept readable (`assets.retain`) and `AppUpdateAvailable` from `@ultimat3/pwa`; an app that ships a native updater serves its manifest from a `route` over `storage`, app code by [axiom 8](https://github.com/developerz-ai/ultimate/blob/main/docs/idea/19-mechanism-not-convention.md). |
83
+ | `x branch`, a whole branch environment with a preview URL | not planned, `As of 2026-11-16`. The extension point is `x db branch create <name>`, the database half, shipped; the rest is a container of the one image with `DATABASE_URL` pointed at that branch, which the platform runs (axiom 7: no platform primitive in the framework). The `PLANNED_COMMANDS` row is gone, so `x branch` is `X_CLI_UNKNOWN_COMMAND`. |
84
+ | `x ai`: eval scores, semantic-cache stats, vector reindex | not planned, `As of 2026-11-16`. Each half has its shipped extension point: evals run with `x test eval --json`, scored against their committed baselines; a vector reindex is a `backfill()` job over the vectors' source rows; cache hit rate and tokens saved are metrics on the bus. `x ai` is `X_CLI_UNKNOWN_COMMAND`. |
85
+ | `x money add-currency`, a generator for one currency | not planned, `As of 2026-11-16`. The extension point is `registerCurrency({ code, exponent, name })` from `@ultimat3/money`, once at boot, which `X_CURRENCY_UNKNOWN`'s fix already names. A generator would write that one call into the app's source and nothing else. `x money` is `X_CLI_UNKNOWN_COMMAND`. |
80
86
 
81
87
  ## Not built yet
82
88
 
@@ -132,7 +138,7 @@ step (`X_ROADMAP_TRACKER_STALE`), so this list, not a stale tracker, is where op
132
138
  |---|---|---|
133
139
  | CI's critical path: `cli`'s own slow tests (the `x upgrade` hop, the scaffold typecheck) | deferred | speed, not correctness: every job is inside its timeout. Re-measure from the run history (`x ci runs --json`) before acting on a figure. 2026/11/02 slice 33 |
134
140
  | The framework's own gate at `"isolate": false` | rejected | its suites exercise process-global registries on purpose; the slice's own fallback (keep the flag, record why) holds, [Testing](Testing) states it. Apps run without isolation by default. 2026/11/02 slice 31, step 4 |
135
- | `x branch` previews, expand/contract renames, CRDT collaboration, mobile, more chart kinds, N-pane docking | deferred | each needs a plan of its own; none is rejected. [`90-deferred.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/plans/2026/11/02/101-absorb-reinvented-patterns/90-deferred.md), "Too large for this plan" |
141
+ | Expand/contract renames, CRDT collaboration, more chart kinds, N-pane docking | deferred | each needs a plan of its own; none is rejected (`x branch` previews and mobile, once in this row, are not planned: [Open by decision](#open-by-decision)). [`90-deferred.md`](https://github.com/developerz-ai/ultimate/blob/main/docs/plans/2026/11/02/101-absorb-reinvented-patterns/90-deferred.md), "Too large for this plan" |
136
142
  | A per-route request ceiling (`X_ISLAND_REQUESTS_OVER_BUDGET`) | deferred | requests per route are measured into `.x/build-stats.json` already; a ceiling waits for the first app that declares one. 2026/11/11 slice 11, I2 |
137
143
  | One stylesheet per route instead of per surface | rejected | measured 23.8 kB gzip, immutable and cached across navigations; a per-route split costs requests for bytes the cache already holds. 2026/11/11 slice 11, I7 |
138
144
  | Re-running the 2026-11-11 scaffold-and-break session (timing and error-grade tables) | deferred | evidence, not code: `scaffold-smoke` gates two scaffold shapes on every push; the session re-runs against the next change that claims a DX gain. 2026/11/11 slice 19, step 5 |
@@ -836,7 +836,7 @@ pgvector in the same Postgres. No second datastore.
836
836
 
837
837
  ## Branch environments
838
838
 
839
- The shipped surface is `x db branch`, with three verbs. `x branch` (no `db`) is **planned** and exits `X_NOT_IMPLEMENTED`; the build-id and MCP-socket rows below are what it will add.
839
+ The surface is `x db branch`, with three verbs. A whole branch environment with a preview URL is **not planned**, `As of 2026-11-16` ([Known gaps](Known-Gaps#open-by-decision)): the rest of a preview is one more container of the app's image with `DATABASE_URL` pointed at the branch, which the platform runs (axiom 7).
840
840
 
841
841
  ```bash
842
842
  x db branch create feat-new-billing --json
@@ -850,8 +850,8 @@ x db branch delete feat-new-billing --json
850
850
  | Migrations | `db.migrate` applies here, never to the shared dev DB (`X_MCP_NOT_BRANCH_DB`) | **shipped** |
851
851
  | Preview URL | `http://<name>.localhost:<PORT>`, reported on `data.preview` | **the URL is computed**; nothing routes that subdomain for you |
852
852
  | Teardown | `x db branch delete <name>` — it may only delete what `list` shows | **shipped** |
853
- | **Build ID scopes the SW** | a per-branch build id giving the branch its own SW scope and cache namespace, so a preview can never poison prod cache → [PWA and offline](PWA-And-Offline) | **planned**, part of `x branch` |
854
- | Scoped MCP socket | `ws://localhost:9229/<name>` | **planned**, part of `x branch` |
853
+ | **Build ID scopes the SW** | boot the preview container with its own `BUILD_ID`: the service worker's cache namespaces derive from it (`cacheNamespace(buildId, …)`, `packages/pwa/src/service-worker.ts:201`), so a preview cannot poison prod cache → [PWA and offline](PWA-And-Offline) | **not planned** as a command; an env var on what ships |
854
+ | Scoped MCP socket | `x mcp serve --transport http --port <n>` with `DATABASE_URL` naming the branch database: `db.migrate` reads the branch from that database's name | **not planned** as a command; what ships, pointed at the branch |
855
855
  | Agent use | an agent can migrate, seed, test, and browse a preview without risking anything shared | |
856
856
 
857
857
  ## `--json` everywhere
package/wiki/Money.md CHANGED
@@ -293,7 +293,7 @@ the person, never round or guess.
293
293
  | Site | Shape |
294
294
  |---|---|
295
295
  | LLM budgets | `budget: { tokensIn: 8000, costPerCall: { minor: 5, currency: 'USD' } }` — exceeding it throws before spending |
296
- | LLM cost accounting | per call, per tenant, per prompt version. No MCP tool reports it yet — `budgets.report` is designed and not built. `x ai cache --json` is **planned** and exits `X_NOT_IMPLEMENTED`; `x test eval --json` is the shipped command it points at |
296
+ | LLM cost accounting | per call, per tenant, per prompt version. No MCP tool reports it yet — `budgets.report` is designed and not built. Each call's tokens are on the bus as `ai.llm` (`inputTokens`, `outputTokens`, `cacheHit`) and on `/metrics` as `gen_ai_client_token_usage` → [Observability](Observability) |
297
297
  | Job cost accounting | per job run and per step, so an expensive retry loop is visible in the queue view |
298
298
  | Admin columns | a money column renders as a right-aligned formatted amount with the currency code; the raw minor value is shown on hover |
299
299
  | OTel span attributes | `cost.minor` + `cost.currency` as separate attributes, never a formatted string |
package/wiki/Shapes.md CHANGED
@@ -17,10 +17,16 @@ cd myblog && bun run setup && bun run dev
17
17
  | `api` | the `post` slice as an API: `createPost`, `archivePost`, the live `postList`, the `reindexPost` job; an org API key (`apps/web/app/keys/`) on a `/v1` bearer mount cut by `API_KEY_SCOPES`; the complete `openapi.json` (`defineApi({ openapi })`); MCP mounted; `/admin` | every page but the error documents and the offline fallback, every island, the shell, the dashboard |
18
18
  | `dashboard` | the default app — dashboard, the `post` table at `/posts` (live list, a job), `/admin` — plus a detail page per row (`apps/web/app/posts/[id]/`, `render: 'ssr'`, read through a `single` query, `postById`) and sign-in, written by `x g sign-in --password` itself once the files land | nothing of the default; `site/` stays a home page, the offline fallback and the error documents |
19
19
  | `blog` | a `post` entity with no tenant (`apps/web/app/post/`), two public reads (`publishedPosts`, `publishedPost`), an `isr` index at `/` and one page per post at `/posts/<slug>`, both `budget: { js: '0kb' }`, a seed with one published post and one draft. Posts are written at `/admin` | `app/` pages, every island, the shell, the dashboard |
20
+ | `saas` | the default app (every table tenant-scoped by `orgId`, `member`/`admin`, `/admin`) plus billing as app code in `apps/web/app/billing/`: plans priced in `Money` (`plans.ts`), each plan feature a permanent flag keyed by plan, one `subscriptions` row per org (read-only at `/admin`), `entitled()` and a plan-sized `meter:` on `createPost`; a signed payment webhook (`jobs/billing-events.ts`, `x g webhook-receiver`'s own output edited at anchors) that runs as the org the signed event names and moves it between plans; sign-in and the member invite, written by `x g sign-in --password` and `x g invite` once the files land | nothing of the default |
21
+ | `agent` | the default app plus `apps/web/app/assistant/`: `suggestTitle`, an `agent()` whose one tool is the action `postTitles` (both MCP tools on `POST /mcp`); `draftPost`, whose code keeps the agent's title under the caller's id; `draftPostLater`, the same run as an `agentJob()` acting as the org's `assistant` role, queued by `queueDraft`; an agent eval with a committed baseline. The model is the environment's alone (`LLM_MODEL`, `LLM_BASE_URL`, `LLM_API_KEY`, its price row, `LLM_FALLBACK_URL` for a second endpoint serving it); unset, no gateway is installed and the app gates on the scripted model its tests swap in | nothing of the default |
22
+ | `realtime` | the default app plus the org's live room: a `post-activity` channel keyed by `orgId` (`apps/web/app/post/channels.ts`), joined under `canPostWatch` and caught up through `recentPosts`; a `postCreated` notifier that `createPost` enqueues in its transaction and that publishes to the room over the bus; `renamePost`, a mutator whose local twin shows the rename before the server answers. `channels.live.test.ts` puts two `sync` nodes on a real NATS and proves one post reaches a member on each | nothing of the default |
23
+ | `content` | a docs or marketing site built from files: markdown in `apps/web/content/<locale>/<slug>.md` (`en` and `es`), read at build time by `apps/web/shared/content.ts`; the front page and one page per file, all `render: 'static'` with `budget: { js: '0kb' }`; a sitemap carrying each page's `hreflang` cluster and a language switcher made of links. A page missing in one locale, or with no `#` title or lead paragraph, stops the build | the dashboard, the shell, every island, the `post` slice |
24
+ | `offline` | the default app, installable and working with no network: the post form writes through `useMutation`, so a write the network refuses waits in the page's IndexedDB outbox and is replayed on reconnect under its idempotency key (`createPost` is `idempotent: true`), landing once. Two e2e suites cut the network: the offline document answers a page no cache holds, and a post written offline is queued, replayed and listed once. Its README opens it from a phone on the LAN: `bunx x dev --host <LAN address> --tls` | nothing of the default |
20
25
 
21
26
  What no shape writes, by rule ([axiom 8](https://github.com/developerz-ai/ultimate/blob/main/docs/idea/19-mechanism-not-convention.md)):
22
- no plan, tier or quota; no payment, mail or model provider and no provider SDK; no model id in
23
- code. `packages/cli/src/templates/shapes/shapes.test.ts` refuses a provider name or a model id in
27
+ no payment, mail or model provider and no provider SDK; no model id in code. The `saas` shape's
28
+ plans, prices and quotas are example app code in `apps/web/app/billing/`, the app's to change:
29
+ the framework ships the mechanism (flags, meters, a signed webhook receiver), never the plan. `packages/cli/src/templates/shapes/shapes.test.ts` refuses a provider name or a model id in
24
30
  any shape's output, and `X_NOT_IMPLEMENTED` anywhere in it.
25
31
 
26
32
  ## What happens next
@@ -35,6 +41,11 @@ scaffold's: `bunx x g --help`.
35
41
  | `api` | `bunx x g resource invoice`: a slice with actions, a query and a job. Add its operations to `API_KEY_SCOPES` to reach them on `/v1` |
36
42
  | `blog` | write a post at `/admin`. A new page: `bunx x g route about --surface site` |
37
43
  | `dashboard` | `bunx x g resource invoice --admin`: a table, its form and its `/admin` screens. A detail page for it: copy `apps/web/app/posts/[id]/` |
44
+ | `saas` | `bunx x g resource invoice`, then gate an action on a plan: `if (!(await entitled(<flag>, ctx.actor))) throw …` |
45
+ | `agent` | give the agent a second tool: an action with `mcp: { expose: true }`, listed in its `tools:` |
46
+ | `realtime` | announce another change to the room: a notifier beside `jobs/post-created.ts`, enqueued from the action that commits the change |
47
+ | `content` | add `apps/web/content/en/<slug>.md` and its translation under `es/`, then `bun run verify` |
48
+ | `offline` | `bunx x g mutator <name> --feature post`, called from an island with `useMutation` |
38
49
 
39
50
  ## Refusals
40
51
 
@@ -42,7 +53,7 @@ scaffold's: `bunx x g --help`.
42
53
  |---|---|---|
43
54
  | `X_NEW_SHAPE_UNKNOWN` | `--shape` names no shape | `bunx @ultimat3/cli help new` lists them |
44
55
  | `X_NEW_SHAPE_CONFLICT` | `--shape` with `--no-example` | drop `--no-example`: a shape is its own example |
45
- | `X_NEW_SHAPE_GENERATE_FAILED` | a generator the shape runs in the new app (`dashboard`: `x g sign-in --password`) refused or failed | the `cd … && bunx x g … --json` it prints reproduces it; the framework's bug, so `bun test ./packages/cli/src/templates/shapes` |
56
+ | `X_NEW_SHAPE_GENERATE_FAILED` | a generator the shape runs in the new app (`dashboard`, `saas`: `x g sign-in --password`; `saas`: `x g invite`) refused or failed | the `cd … && bunx x g … --json` it prints reproduces it; the framework's bug, so `bun test ./packages/cli/src/templates/shapes` |
46
57
 
47
58
  The first two refuse before a file is written, `--dry-run` included. A shape whose capability a
48
59
  generator owns runs that generator after its files land (`ShapeOverlay.generate`), never a copy of
@@ -56,9 +67,7 @@ its output: `--dry-run` lists those runs under `data.generate`.
56
67
  | each shape typechecks, lints and meets the error contract as written | the `x new --shape <shape>` variants in `packages/cli/src/scaffold-fixture.ts`, read by `emitted-contract`, `emitted-routes`, `emitted-suites` and `scaffold-typecheck.contract` |
57
68
  | `bun run setup && bun run verify` green on the first pass, then again over every generator | `scaffold-smoke` in `.github/workflows/ci.yml`, one row per shape — `scripts/ci-workflow-shape.test.ts` refuses a shape with no row |
58
69
 
59
- `As of 2026-11-06`. Five shapes are planned (`saas` and `agent` beside these three); a shape is
60
- listed here, and accepted by `--shape`, only once its row gates green. `saas` waits on a billing
61
- seam no slice has landed — its member invite ships, as `defineMemberInvite` and `x g invite`
62
- ([Auth](Auth#member-invites), `As of 2026-11-14`); `agent` on a model and provider an app names by
63
- environment alone, which no shipped seam takes without a provider SDK or a model row the scaffold
64
- would have to invent.
70
+ `As of 2026-11-16`, eight shapes: `api`, `dashboard`, `blog`, `saas`, `agent`, `realtime`,
71
+ `content` and `offline`, each a `scaffold-smoke` row that gates twice. A shape is listed here, and
72
+ accepted by `--shape`, only once its row gates green. The `saas` billing is a recipe too, with its
73
+ proof: [Building your own base](Building-Your-Own-Base).
@@ -149,7 +149,7 @@ Boundaries run on pre-push and inside `x verify`. They are build errors, never l
149
149
  | `X_MCP_QUERY_REJECTED` | `db.query` was not given exactly one read-only statement | send a single **read-only** `SELECT`/`WITH`/`EXPLAIN`/`SHOW`/`TABLE`/`VALUES` — a data-modifying CTE is not a read. MCP has no arbitrary-write path: change data by calling an action exposed with `mcp: { expose: true }`, change schema with `db.migrate` on a branch database |
150
150
  | `X_MCP_NOT_BRANCH_DB` | `db.migrate` was aimed at a database that is not a branch | `x db branch create <name> # then retry db.migrate` |
151
151
  | `X_LLM_OUTPUT_INVALID` | structured output failed its schema twice | tighten the prompt or loosen the schema; the retry already happened once |
152
- | Prompt change had no effect | semantic cache hit | bump the prompt version — editing a prompt requires it. (`x ai cache --json` is **planned**; `x test eval --json` is the shipped command) |
152
+ | Prompt change had no effect | semantic cache hit | bump the prompt version — editing a prompt requires it. `ai.llm` events carry `cacheHit: true` for a served hit ([Observability](Observability)); `x test eval --json` scores the new version |
153
153
  | `x verify` fails on a prompt | no evals file | an unevaluated prompt is untested code. Add `<prompt>.evals.ts` |
154
154
 
155
155
  ## Still stuck
package/wiki/Upgrading.md CHANGED
@@ -3609,7 +3609,7 @@ A process that registers no tier reads **uncached** rather than filling a store
3609
3609
 
3610
3610
  ### Entries 1 and 2 — the CLI
3611
3611
 
3612
- `x db branch` takes a verb. The argument *was* the branch name and the dispatcher fell through to it, so `x db branch` with the argument `ls` (the verb is `list` since 26.0.0) — the `fix:` line the planned `x branch` command hands out — cloned the database into one called `ls`. A stray database is not a typo an agent can see: it is a copy of production-shaped data with a name nobody will recognise a week later.
3612
+ `x db branch` takes a verb. The argument *was* the branch name and the dispatcher fell through to it, so `x db branch` with the argument `ls` (the verb is `list` since 26.0.0) — the `fix:` line the top-level `branch` command handed out while it was planned (it left the registry `As of 2026-11-16`, [Known gaps](Known-Gaps#open-by-decision)) — cloned the database into one called `ls`. A stray database is not a typo an agent can see: it is a copy of production-shaped data with a name nobody will recognise a week later.
3613
3613
 
3614
3614
  ```diff
3615
3615
  - x db branch feat-new-billing