@ultimat3/cli 31.26.0 → 31.28.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 (206) hide show
  1. package/CLAUDE.md +47 -37
  2. package/README.md +19 -8
  3. package/package.json +29 -29
  4. package/src/app-manifest.ts +6 -1
  5. package/src/app-mcp.ts +17 -3
  6. package/src/cmd-cache-spec.ts +5 -2
  7. package/src/cmd-db-spec.ts +2 -3
  8. package/src/cmd-db.ts +0 -2
  9. package/src/cmd-deploy-verify-sample.ts +93 -0
  10. package/src/cmd-deploy-verify.ts +2 -41
  11. package/src/cmd-dev-spec.ts +15 -1
  12. package/src/cmd-dev.ts +31 -4
  13. package/src/cmd-doctor.ts +15 -4
  14. package/src/cmd-exercise-spec.ts +7 -1
  15. package/src/cmd-exercise.ts +22 -10
  16. package/src/cmd-generate.ts +2 -0
  17. package/src/cmd-jobs-spec.ts +3 -6
  18. package/src/cmd-jobs.ts +1 -7
  19. package/src/cmd-logs-spec.ts +2 -1
  20. package/src/cmd-logs.ts +9 -28
  21. package/src/cmd-planned.ts +11 -45
  22. package/src/cmd-profile-frames.ts +99 -0
  23. package/src/cmd-profile-spec.ts +24 -0
  24. package/src/cmd-profile.ts +164 -0
  25. package/src/cmd-repro-spec.ts +13 -1
  26. package/src/cmd-repro.ts +37 -5
  27. package/src/cmd-status-sample.ts +57 -0
  28. package/src/cmd-status-spec.ts +30 -0
  29. package/src/cmd-status.ts +108 -0
  30. package/src/cmd-token-spec.ts +5 -2
  31. package/src/cmd-token.ts +7 -3
  32. package/src/cmd-upgrade-codemods.ts +71 -0
  33. package/src/cmd-upgrade-spec.ts +19 -5
  34. package/src/cmd-upgrade.ts +91 -34
  35. package/src/codemods/agents-dev-mcp.ts +50 -0
  36. package/src/codemods/authenticator-session-refusal.ts +214 -0
  37. package/src/codemods/biome-no-default-export.ts +58 -0
  38. package/src/codemods/bunfig-island-coverage.ts +33 -0
  39. package/src/codemods/chart-dashboard.ts +73 -0
  40. package/src/codemods/ci-e2e-browser-stock.ts +75 -0
  41. package/src/codemods/ci-e2e-browser.ts +63 -0
  42. package/src/codemods/codemod.ts +58 -0
  43. package/src/codemods/define-error-leaf.ts +73 -0
  44. package/src/codemods/docs-ci-parts.ts +65 -0
  45. package/src/codemods/docs-gate-prose.ts +53 -0
  46. package/src/codemods/docs-island-rows.ts +31 -0
  47. package/src/codemods/docs-shipped-guards.ts +100 -0
  48. package/src/codemods/docs-test-services.ts +62 -0
  49. package/src/codemods/engine-diff.ts +104 -0
  50. package/src/codemods/engine-edits.ts +111 -0
  51. package/src/codemods/engine-fs.ts +95 -0
  52. package/src/codemods/engine.ts +191 -0
  53. package/src/codemods/format-edited-hook-3122.ts +28 -0
  54. package/src/codemods/format-edited-hook.ts +152 -0
  55. package/src/codemods/helm-alerts-objective.ts +105 -0
  56. package/src/codemods/helm-alerts-stock.ts +108 -0
  57. package/src/codemods/index.ts +56 -0
  58. package/src/codemods/metrics-probe-healthz.ts +47 -0
  59. package/src/codemods/pending.ts +36 -0
  60. package/src/codemods/repro-gitignore.ts +40 -0
  61. package/src/codemods/runtime-pin-lines.ts +109 -0
  62. package/src/codemods/runtime-pin.ts +116 -0
  63. package/src/codemods/solid-floor.ts +63 -0
  64. package/src/codemods/test-ports.ts +86 -0
  65. package/src/codemods/test-suites.ts +37 -0
  66. package/src/codemods/theme-toggle-mount-over.ts +70 -0
  67. package/src/codemods/vendored-guards.ts +186 -0
  68. package/src/codemods/verify-floor-skips.ts +88 -0
  69. package/src/codemods/verify-floor-steps.ts +90 -0
  70. package/src/coverage-island.ts +121 -0
  71. package/src/coverage-lcov.ts +49 -5
  72. package/src/coverage-remap.ts +146 -0
  73. package/src/db-replay-engine-prepared.ts +66 -0
  74. package/src/db-replay-engine-template.ts +156 -0
  75. package/src/db-replay-engine.ts +4 -0
  76. package/src/db-replay-scratch-reap.ts +54 -0
  77. package/src/deploy-verify-flags.ts +9 -2
  78. package/src/deploy-verify-grade.ts +10 -3
  79. package/src/dev-boot.ts +14 -1
  80. package/src/dev-dashboard-guard.ts +57 -10
  81. package/src/dev-host.ts +46 -0
  82. package/src/dev-tls-cache.ts +103 -0
  83. package/src/dev-tls-der.ts +69 -0
  84. package/src/dev-tls.ts +120 -0
  85. package/src/doctor-advisory-floors.ts +113 -0
  86. package/src/doctor-browser.ts +60 -0
  87. package/src/doctor-guards.ts +39 -86
  88. package/src/doctor-superseded.ts +67 -0
  89. package/src/error-codes-doctor.ts +12 -4
  90. package/src/error-codes-verify.ts +47 -0
  91. package/src/error-codes.ts +20 -23
  92. package/src/exercise-database.ts +47 -9
  93. package/src/exercise-push-device.ts +51 -0
  94. package/src/exercise-route-api.ts +74 -0
  95. package/src/exercise-routes.ts +14 -5
  96. package/src/exercise-services.ts +3 -1
  97. package/src/exercise-shard-flag.ts +47 -0
  98. package/src/fix-command.ts +2 -2
  99. package/src/generate-factories.ts +5 -11
  100. package/src/generate-feature-required.ts +9 -4
  101. package/src/generate-files.ts +26 -7
  102. package/src/generate-kinds.ts +5 -1
  103. package/src/guards-built-in-codes.ts +36 -0
  104. package/src/guards-built-in-refusal.ts +25 -0
  105. package/src/guards-built-in.ts +134 -0
  106. package/src/guards-materialize.ts +42 -0
  107. package/src/guards-paths.ts +37 -0
  108. package/src/guards-shipped-names.ts +38 -0
  109. package/src/guards-vendored.ts +73 -0
  110. package/src/guards.ts +105 -34
  111. package/src/index.ts +10 -0
  112. package/src/island-bundle-options.ts +48 -0
  113. package/src/island-bundle.ts +18 -46
  114. package/src/island-link.ts +5 -0
  115. package/src/island-outputs.ts +5 -0
  116. package/src/lint-findings.ts +3 -3
  117. package/src/mcp-errors-verify.ts +35 -0
  118. package/src/mcp-errors.ts +21 -20
  119. package/src/mcp-host-logs.ts +121 -0
  120. package/src/mcp-host.ts +12 -73
  121. package/src/measure-scope.ts +23 -3
  122. package/src/messages-floor.ts +19 -0
  123. package/src/messages-repro.ts +16 -2
  124. package/src/messages-status.ts +10 -0
  125. package/src/messages-upgrade.ts +15 -0
  126. package/src/messages.ts +22 -1
  127. package/src/registry.ts +4 -0
  128. package/src/repro-archive-collect.ts +161 -0
  129. package/src/repro-archive-write.ts +96 -0
  130. package/src/repro-archive.ts +161 -0
  131. package/src/repro-bundle.ts +8 -16
  132. package/src/repro-errors.ts +14 -2
  133. package/src/repro-framework.ts +53 -0
  134. package/src/repro-parse.ts +87 -0
  135. package/src/repro-redact.ts +218 -0
  136. package/src/repro-scrub.ts +257 -0
  137. package/src/role-start-types.ts +7 -0
  138. package/src/role-start.ts +4 -0
  139. package/src/serve-boot.ts +7 -1
  140. package/src/serve-env-tls.ts +57 -0
  141. package/src/solid-loader.ts +27 -10
  142. package/src/superseded-match.ts +87 -0
  143. package/src/superseded.ts +84 -0
  144. package/src/templates/bun-image.ts +48 -0
  145. package/src/templates/generate-export-rows.ts +136 -0
  146. package/src/templates/generate-import-rows.ts +186 -0
  147. package/src/templates/generate-rows-slice.ts +95 -0
  148. package/src/templates/github/ci.yml.ts +5 -1
  149. package/src/templates/guard-released-forms.ts +112 -0
  150. package/src/templates/guard-runtime-pin-test.ts +54 -0
  151. package/src/templates/guard-runtime-pin.ts +189 -0
  152. package/src/templates/scaffold-claude-agents.ts +6 -6
  153. package/src/templates/scaffold-claude-commands.ts +1 -1
  154. package/src/templates/scaffold-claude-hook.ts +18 -8
  155. package/src/templates/scaffold-claude.ts +2 -2
  156. package/src/templates/scaffold-db-package.ts +3 -0
  157. package/src/templates/scaffold-docs.ts +34 -30
  158. package/src/templates/scaffold-guards.ts +73 -39
  159. package/src/templates/scaffold-repo.ts +4 -8
  160. package/src/templates/scaffold-site.ts +4 -1
  161. package/src/templates/scaffold-suites.ts +72 -0
  162. package/src/templates/scaffold-test-services.ts +35 -10
  163. package/src/templates/scaffold-verify-floor.ts +53 -31
  164. package/src/templates/shapes/api.ts +4 -0
  165. package/src/templates/slice-foundation.ts +3 -3
  166. package/src/unthrown-codes.ts +3 -1
  167. package/src/upgrade-bun-floor.ts +4 -0
  168. package/src/upgrade-clean-tree.ts +54 -0
  169. package/src/upgrade-gate-codemods-install.ts +40 -0
  170. package/src/upgrade-gate-codemods.ts +151 -0
  171. package/src/upgrade-gate.ts +44 -7
  172. package/src/upgrade-guards-baseline.ts +43 -0
  173. package/src/upgrade-guards.ts +37 -2
  174. package/src/upgrade-lock.ts +118 -0
  175. package/src/upgrade-plan.ts +2 -1
  176. package/src/upgrade-report-codemods.ts +54 -0
  177. package/src/upgrade-report.ts +55 -27
  178. package/src/upgrade-signals.ts +91 -0
  179. package/src/upgrade-unfinished.ts +61 -0
  180. package/src/verify-coverage-run.ts +42 -11
  181. package/src/verify-e2e.ts +115 -4
  182. package/src/verify-floor.ts +27 -0
  183. package/src/verify-guard-baseline.ts +109 -0
  184. package/src/verify-live.ts +72 -0
  185. package/src/verify-merge-skips.ts +51 -0
  186. package/src/verify-merge.ts +36 -2
  187. package/src/verify-run.ts +48 -7
  188. package/src/verify-services.ts +287 -0
  189. package/src/verify-skip-reason.ts +53 -0
  190. package/src/verify-strict.ts +108 -0
  191. package/src/verify-test-command.ts +129 -0
  192. package/src/verify-tests.ts +39 -126
  193. package/types/babel-modules.d.ts +2 -0
  194. package/wiki/CLI-Reference.md +200 -27
  195. package/wiki/Caching-And-Invalidation.md +1 -1
  196. package/wiki/Entities-And-Migrations.md +1 -1
  197. package/wiki/Interface-Rules.md +17 -8
  198. package/wiki/Jobs-And-Workflows.md +3 -3
  199. package/wiki/Known-Gaps.md +5 -1
  200. package/wiki/MCP-And-AI.md +1 -1
  201. package/wiki/Observability.md +1 -0
  202. package/wiki/PWA-And-Offline.md +1 -1
  203. package/wiki/Project-Layout.md +4 -4
  204. package/wiki/Troubleshooting.md +3 -3
  205. package/wiki/Tutorial-05-Deploy-Free.md +2 -2
  206. package/wiki/Upgrading.md +8 -0
@@ -13,6 +13,8 @@ import type { CliShotErrorCode } from './error-codes-shot';
13
13
  import { CLI_SHOT_ERROR_CODES, CLI_SHOT_ERROR_TITLES } from './error-codes-shot';
14
14
  import type { CliToolingErrorCode } from './error-codes-tooling';
15
15
  import { CLI_TOOLING_ERROR_CODES, CLI_TOOLING_ERROR_TITLES } from './error-codes-tooling';
16
+ import type { CliVerifyErrorCode } from './error-codes-verify';
17
+ import { CLI_VERIFY_ERROR_CODES, CLI_VERIFY_ERROR_TITLES } from './error-codes-verify';
16
18
 
17
19
  /** Codes this package declares and owns. */
18
20
  export const CLI_OWNED_ERROR_CODES = [
@@ -51,10 +53,6 @@ export const CLI_OWNED_ERROR_CODES = [
51
53
  'X_TYPECHECK_FAILED',
52
54
  'X_LINT_FAILED',
53
55
  'X_TEST_FAILED',
54
- // The ratchet's own code. A skipped step is not a failure — unless `x.verify.json` says this
55
- // repo already ran it, in which case the suite was deleted and the gate would otherwise print
56
- // one more green line for it.
57
- 'X_VERIFY_SUITE_VANISHED',
58
56
  // The framework's own tables, refused by name rather than by the driver's rejection: a raw
59
57
  // `permission denied for schema public` says which statement failed and neither which framework
60
58
  // table it was creating nor which package wants it.
@@ -164,17 +162,10 @@ export const CLI_OWNED_ERROR_CODES = [
164
162
  'X_ROUTE_ASYNC_PAGE',
165
163
  'X_BUDGET_PARAMS_UNDECLARED',
166
164
  'X_TEST_BUDGET_INVALID',
167
- 'X_VERIFY_SHARD_INVALID',
168
- 'X_VERIFY_MERGE_INCOMPLETE',
169
- 'X_VERIFY_MERGE_INPUT',
170
165
  'X_SITEMAP_EXTRA_INVALID',
171
166
  'X_DEV_RESTART_REQUIRED',
172
167
  'X_DEV_ROOT_GONE',
173
168
  'X_SEAL_RESEAL_PENDING',
174
- 'X_VERIFY_STEP_TIMEOUT',
175
- 'X_COVERAGE_BELOW_FLOOR',
176
- 'X_COVERAGE_FLOOR_UNSTATED',
177
- 'X_COVERAGE_FLOOR_STALE',
178
169
  'X_DB_HANDLE_UNREGISTERED',
179
170
  'X_ROLE_LOAD_INCOMPLETE',
180
171
  'X_ADMIN_RESOURCE_UNWIRED',
@@ -227,7 +218,6 @@ export const CLI_OWNED_ERROR_CODES = [
227
218
  'X_SEO_CARD_ROUTE_UNKNOWN',
228
219
  'X_SEO_CARD_BROWSER_MISSING',
229
220
  'X_IMAGE_SOURCE_UNREADABLE',
230
- 'X_VERIFY_SKIPS_OVER_CEILING',
231
221
  'X_ASSET_VARIANT_UNDECLARED',
232
222
  'X_NEW_SHAPE_GENERATE_FAILED',
233
223
  'X_ISLAND_DISPOSER_MISSING',
@@ -243,6 +233,13 @@ export const CLI_OWNED_ERROR_CODES = [
243
233
  'X_NATIVE_FORM_UNANSWERED',
244
234
  'X_ASSET_RETAIN_UNDECLARED',
245
235
  'X_DEV_DATA_UNOPENABLE',
236
+ 'X_DEV_LOG_ABSENT',
237
+ 'X_DEV_PEER_REFUSED',
238
+ 'X_PROFILE_ROUTE_FAILED',
239
+ 'X_ROWS_SLICE_ENTITY',
240
+ 'X_GUARD_BUILT_IN',
241
+ 'X_REPRO_BUNDLE_INVALID',
242
+ 'X_UPGRADE_LOCKED',
246
243
  ] as const;
247
244
 
248
245
  /**
@@ -283,6 +280,7 @@ export const CLI_ERROR_CODES = [
283
280
  ...CLI_PACKAGE_ERROR_CODES,
284
281
  ...CLI_SHOT_ERROR_CODES,
285
282
  ...CLI_TOOLING_ERROR_CODES,
283
+ ...CLI_VERIFY_ERROR_CODES,
286
284
  ...CLI_BORROWED_ERROR_CODES,
287
285
  ] as const;
288
286
 
@@ -294,7 +292,8 @@ export type CliOwnedErrorCode =
294
292
  | CliDoctorErrorCode
295
293
  | CliPackageErrorCode
296
294
  | CliShotErrorCode
297
- | CliToolingErrorCode;
295
+ | CliToolingErrorCode
296
+ | CliVerifyErrorCode;
298
297
  export type CliErrorCode = (typeof CLI_ERROR_CODES)[number];
299
298
 
300
299
  /**
@@ -331,7 +330,6 @@ export const CLI_ERROR_TITLES: Readonly<Record<CliListedErrorCode, string>> = {
331
330
  X_TYPECHECK_FAILED: 'tsc failed',
332
331
  X_LINT_FAILED: 'Biome failed',
333
332
  X_TEST_FAILED: 'a test type failed',
334
- X_VERIFY_SUITE_VANISHED: 'a step the committed floor requires had nothing left to check',
335
333
  X_MANIFEST_STALE: 'openapi.json is stale',
336
334
  X_MANIFEST_MISSING: 'the app ships no x.manifest.json',
337
335
  X_BUDGET_UNMEASURED: 'a route declares a budget the build never measured',
@@ -380,19 +378,11 @@ export const CLI_ERROR_TITLES: Readonly<Record<CliListedErrorCode, string>> = {
380
378
  X_BUDGET_PARAMS_UNDECLARED:
381
379
  'a dynamic route with a budget declares no prerender() paths to weigh it by',
382
380
  X_TEST_BUDGET_INVALID: 'a test memory budget or worker cap env var does not parse',
383
- X_VERIFY_SHARD_INVALID: 'x verify --shard was given a spec or a step list it cannot split',
384
- X_VERIFY_MERGE_INCOMPLETE: 'x verify merge was handed parts that do not add up to the whole gate',
385
- X_VERIFY_MERGE_INPUT: 'a part handed to x verify merge is not an x verify --json document',
386
381
  X_SITEMAP_EXTRA_INVALID: 'a seo.sitemap.extra path names no public page',
387
382
  X_DEV_RESTART_REQUIRED:
388
383
  'a save reached a module that defines a primitive; only a new process serves it',
389
384
  X_DEV_ROOT_GONE: 'the app root x dev serves was deleted or moved',
390
385
  X_SEAL_RESEAL_PENDING: 'sealed columns still hold values under a retired master key',
391
- X_VERIFY_STEP_TIMEOUT: 'a gate step ran past its deadline and was stopped',
392
- X_COVERAGE_BELOW_FLOOR: 'the unit suite covers less of the app than x.verify.json states',
393
- X_COVERAGE_FLOOR_UNSTATED:
394
- 'x.verify.json states no coverage floor, or one under 95 with no reason',
395
- X_COVERAGE_FLOOR_STALE: 'the app now covers more than the floor in x.verify.json states',
396
386
  X_DB_HANDLE_UNREGISTERED: "an entity x g wrote is not in the app's typed database handle",
397
387
  X_ROLE_LOAD_INCOMPLETE: 'a worker or scheduler did not register a job or task the manifest names',
398
388
  X_ADMIN_RESOURCE_UNWIRED: "an admin override x g wrote is not in the app's defineAdmin() call",
@@ -453,7 +443,6 @@ export const CLI_ERROR_TITLES: Readonly<Record<CliListedErrorCode, string>> = {
453
443
  X_SEO_CARD_BROWSER_MISSING:
454
444
  'a static build with social cards found no browser to photograph them',
455
445
  X_IMAGE_SOURCE_UNREADABLE: 'a responsiveImage src is not a file the static export holds',
456
- X_VERIFY_SKIPS_OVER_CEILING: 'a step skipped more tests than its skipCeiling allows',
457
446
  X_ASSET_VARIANT_UNDECLARED: 'an /assets image variant responsiveImage() never mints',
458
447
  X_NEW_SHAPE_GENERATE_FAILED: 'a shape generator failed in the new app',
459
448
  X_ISLAND_DISPOSER_MISSING: "an island's mount returns no disposer",
@@ -472,6 +461,13 @@ export const CLI_ERROR_TITLES: Readonly<Record<CliListedErrorCode, string>> = {
472
461
  X_NATIVE_FORM_UNANSWERED: 'a page form posts to an action that declares no native answer',
473
462
  X_ASSET_RETAIN_UNDECLARED: "A served build keeps no earlier build's assets",
474
463
  X_DEV_DATA_UNOPENABLE: 'x dev set aside an embedded data directory that would not open',
464
+ X_DEV_LOG_ABSENT: 'the dev log does not exist yet',
465
+ X_DEV_PEER_REFUSED: 'a /_x request came from a non-loopback peer',
466
+ X_PROFILE_ROUTE_FAILED: 'the profiled route answered an error',
467
+ X_ROWS_SLICE_ENTITY: "the slice's entity is not the scaffolded table",
468
+ X_GUARD_BUILT_IN: 'x g guard named a shipped guard',
469
+ X_REPRO_BUNDLE_INVALID: 'the file is not a repro bundle this version can open',
470
+ X_UPGRADE_LOCKED: 'another x upgrade holds this app',
475
471
  };
476
472
 
477
473
  // One unconditional call, so a second package claiming one of the CLI's codes throws
@@ -485,6 +481,7 @@ registerErrorCodes(
485
481
  ...CLI_PACKAGE_ERROR_TITLES,
486
482
  ...CLI_SHOT_ERROR_TITLES,
487
483
  ...CLI_TOOLING_ERROR_TITLES,
484
+ ...CLI_VERIFY_ERROR_TITLES,
488
485
  }).map(([code, title]) => [code, { title }]),
489
486
  ),
490
487
  );
@@ -4,8 +4,8 @@
4
4
  // gate needs nothing listening, exactly as the `drift` step does not.
5
5
 
6
6
  import type { Environment } from '@ultimat3/core';
7
- import { ENVIRONMENT_KEY, resolveEnvironment, UltimateError } from '@ultimat3/core';
8
- import type { DbClient } from '@ultimat3/db';
7
+ import { ENVIRONMENT_KEY, resolveEnvironment, UltimateError, withStoreMode } from '@ultimat3/core';
8
+ import type { DbClient, Migration } from '@ultimat3/db';
9
9
  import { dbExecutor, migrate, raw, setDbClient } from '@ultimat3/db';
10
10
  import {
11
11
  captureDeterminism,
@@ -14,9 +14,10 @@ import {
14
14
  testSealKeyEnv,
15
15
  } from '@ultimat3/testing';
16
16
  import { loadAppConfig } from './app-config-load';
17
- import { chooseReplayEngine, withScratchDatabase } from './db-replay-engine';
17
+ import { chooseReplayEngine } from './db-replay-engine';
18
+ import { withPreparedScratch } from './db-replay-engine-prepared';
18
19
  import { installExerciseServices } from './exercise-services';
19
- import { applyFrameworkSchema } from './framework-schema';
20
+ import { applyFrameworkSchema, FRAMEWORK_SCHEMA, schemaStatements } from './framework-schema';
20
21
  import { readMigrations } from './migrations';
21
22
  import { resolveServices } from './runtime-bindings';
22
23
 
@@ -58,6 +59,8 @@ const PINNED = [ENVIRONMENT_KEY, 'NODE_ENV'] as const;
58
59
  * no `ULTIMATE_SECRETS_KEY`, and every row sealed here dies with the scratch database). Every
59
60
  * variable is put back as found: a command that exits must not leave the next one a test process.
60
61
  *
62
+ * Core's `storeMode` is declared `database` for the length of `work` (`withStoreMode`).
63
+ *
61
64
  * The frozen clock too, and FIRST — as `bun test`'s preload freezes it before any module loads. The
62
65
  * scratch database is PGlite, whose Postgres arms its timers off `Date.now()`: booted on the real
63
66
  * clock and frozen under later (the pass's room), its 10 s idle-stats timer was re-armed at
@@ -79,7 +82,10 @@ export async function withExerciseProcess<T>(
79
82
  if (!clock.installed) installDeterminism();
80
83
  Object.assign(process.env, added);
81
84
  try {
82
- return await work();
85
+ // A test process ON a database: the scratch one `withExerciseDatabase` installs. A store an
86
+ // app picks at load by core's `storeMode` (an api key, a device token) is that database's, or
87
+ // every reach writing it sends no statement and proves nothing. `bun test` stays `memory`.
88
+ return await withStoreMode('database', work);
83
89
  } finally {
84
90
  restoreCapturedDeterminism(clock);
85
91
  for (const [key, value] of previous) {
@@ -89,10 +95,36 @@ export async function withExerciseProcess<T>(
89
95
  }
90
96
  }
91
97
 
98
+ /**
99
+ * What decides a prepared scratch database: every framework statement, every migration's id and
100
+ * text, and the extensions they link — hashed, so a new migration (or a framework release that
101
+ * changes a table) is a new key and a miss. PGlite's own version is `@ultimat3/db`'s to add.
102
+ */
103
+ export function exerciseSchemaKey(
104
+ migrations: readonly Migration[],
105
+ extensions: readonly string[],
106
+ ): string {
107
+ const hasher = new Bun.CryptoHasher('sha256');
108
+ const part = (text: string): void => {
109
+ hasher.update(`${String(text.length)}:${text}\u0000`);
110
+ };
111
+ for (const entry of FRAMEWORK_SCHEMA)
112
+ for (const statement of schemaStatements(entry.ddl)) part(statement);
113
+ part('--migrations--');
114
+ for (const migration of migrations) {
115
+ part(migration.id);
116
+ part(migration.up);
117
+ }
118
+ part('--extensions--');
119
+ for (const name of extensions) part(name);
120
+ return hasher.digest('hex');
121
+ }
122
+
92
123
  /**
93
124
  * Framework tables, then every migration — the order every real boot runs them in — then `work`
94
125
  * with the client installed. Released either way: a command that exits holding an installed
95
- * client would hand the next caller in this process a closed pool.
126
+ * client would hand the next caller in this process a closed pool. The migrated state is kept
127
+ * under the app's state dir (`db-replay-engine-prepared.ts`), so a second run restores it.
96
128
  */
97
129
  export async function withExerciseDatabase<T>(
98
130
  root: string,
@@ -102,9 +134,15 @@ export async function withExerciseDatabase<T>(
102
134
  const migrations = await readMigrations(root);
103
135
  const engine = await chooseReplayEngine(migrations, env);
104
136
  const { stateDir } = resolveServices(root, env);
105
- return withScratchDatabase(engine, stateDir, async (client) => {
106
- await applyFrameworkSchema((statement) => client.execute(raw(statement)));
107
- await migrate({ migrations, client });
137
+ const extensions = engine.kind === 'embedded' ? engine.extensions : engine.requires;
138
+ const preparation = {
139
+ key: exerciseSchemaKey(migrations, extensions),
140
+ prepare: async (client: DbClient) => {
141
+ await applyFrameworkSchema((statement) => client.execute(raw(statement)));
142
+ await migrate({ migrations, client });
143
+ },
144
+ };
145
+ return withPreparedScratch(engine, stateDir, preparation, async (client) => {
108
146
  setDbClient(client);
109
147
  // What a server's boot installs beside its database, over this one: a primitive that reads a
110
148
  // disk, a shared rate limit or the push runtime runs, rather than needing `{ off }`.
@@ -0,0 +1,51 @@
1
+ // The device every actor holds in `x exercise`: the pass's push store answers each actor's stored
2
+ // subscriptions, else one stand-in on a listed push service with real P-256 keys, so a notifier's
3
+ // push is encrypted, signed and sent to the captured service — and recorded as a `push` effect by
4
+ // the room. As the memory mail driver accepts every address: a pusher that sends nothing shows.
5
+
6
+ import type { PushSubscriptionRecord, PushSubscriptionStore } from '@ultimat3/pwa';
7
+
8
+ /** A host `pushHostAllowed` lists, under a path no real browser hands out. */
9
+ const STAND_IN_ENDPOINT = 'https://fcm.googleapis.com/fcm/send/x-exercise-';
10
+
11
+ const base64Url = (bytes: Uint8Array): string => bytes.toBase64({ alphabet: 'base64url' });
12
+
13
+ /** One receiver key pair for the whole pass: the private half is never read, only the public. */
14
+ async function standInKeys(): Promise<PushSubscriptionRecord['keys']> {
15
+ const pair = await crypto.subtle.generateKey({ name: 'ECDH', namedCurve: 'P-256' }, true, [
16
+ 'deriveBits',
17
+ ]);
18
+ const point = new Uint8Array(await crypto.subtle.exportKey('raw', pair.publicKey));
19
+ return { p256dh: base64Url(point), auth: base64Url(crypto.getRandomValues(new Uint8Array(16))) };
20
+ }
21
+
22
+ /**
23
+ * `store`, with one stand-in device for an actor it holds none for. Never written: a subscribe the
24
+ * pass runs stores its row in `store`, and a stand-in's removal (a 404 the captured service never
25
+ * answers) removes nothing.
26
+ */
27
+ export function withStandInDevice(store: PushSubscriptionStore): PushSubscriptionStore {
28
+ let keys: Promise<PushSubscriptionRecord['keys']> | undefined;
29
+ return {
30
+ save: (record) => store.save(record),
31
+ async listFor(actorId) {
32
+ const held = await store.listFor(actorId);
33
+ if (held.length > 0) return held;
34
+ keys ??= standInKeys();
35
+ const device: PushSubscriptionRecord = {
36
+ endpoint: `${STAND_IN_ENDPOINT}${encodeURIComponent(actorId)}`,
37
+ keys: await keys,
38
+ locale: 'en',
39
+ timeZone: 'UTC',
40
+ actorId,
41
+ createdAt: 0,
42
+ expirationTime: null,
43
+ };
44
+ return [device];
45
+ },
46
+ remove: (endpoint, actorId) =>
47
+ endpoint.startsWith(STAND_IN_ENDPOINT)
48
+ ? Promise.resolve(false)
49
+ : store.remove(endpoint, actorId),
50
+ };
51
+ }
@@ -0,0 +1,74 @@
1
+ // A route `load` that reads through the app's own typed client (`queries.orgPosts(…)` over
2
+ // `APP_URL`) answered IN PROCESS during `x exercise`, as the build's measurement render is
3
+ // (`measure-scope.ts`): core's `withInProcessFetch` hands each call to the app's own API pipeline,
4
+ // authenticated as the actor the load runs as — so its statements are the load's, counted and swept.
5
+
6
+ import type { Actor } from '@ultimat3/core';
7
+ import { asyncContext, isAnonymous, tryUseContext, withInProcessFetch } from '@ultimat3/core';
8
+ import { defineHttpConfig, httpPipeline, httpRouter } from '@ultimat3/http';
9
+ import type { RouteLoadSubject } from '@ultimat3/testing';
10
+ import { apiRoutes } from './api-routes';
11
+
12
+ /** The origin the typed client is told when the app's env names none: never dialled. */
13
+ export const EXERCISE_APP_URL = 'http://localhost:3000';
14
+
15
+ /** Who the in-process request authenticates as: the load's own actor, read at the call. */
16
+ const caller = asyncContext<Actor | null>('the exercise in-process caller');
17
+
18
+ /** One dispatcher over the app's API table, built on first use: the registries are full by then. */
19
+ function dispatcher(): (url: string, init: RequestInit) => Promise<Response> {
20
+ // No rate limit: every request is the pass's own, as a build's are (`measure-scope.ts`).
21
+ const config = defineHttpConfig({
22
+ buildId: process.env['BUILD_ID'] ?? 'dev',
23
+ rateLimit: { enabled: false },
24
+ });
25
+ const pipeline = httpPipeline({
26
+ table: httpRouter(apiRoutes()),
27
+ config,
28
+ hooks: { authenticate: () => caller.get() ?? null },
29
+ });
30
+ return (url, init) => {
31
+ // A `prerender()` runs in no request: nobody, as a published read is (`publicScope`).
32
+ const actor = tryUseContext()?.actor;
33
+ // The page's own server calling its own API: same-origin by construction, so it says so —
34
+ // a write with neither `origin` nor `sec-fetch-site` is `X_CSRF_BLOCKED`, as it should be.
35
+ const headers = new Headers(init.headers);
36
+ if (!headers.has('origin')) headers.set('origin', new URL(url).origin);
37
+ return caller.run(actor === undefined || isAnonymous(actor) ? null : actor, () =>
38
+ pipeline.handle(new Request(url, { ...init, headers }), { role: 'web' }),
39
+ );
40
+ };
41
+ }
42
+
43
+ /**
44
+ * The app's own origin — `APP_URL` as the typed client reads it, at the call: only its urls are
45
+ * the app's to answer. Any other host is a call out, left to the pass's sealed network, which
46
+ * refuses and records it as one (`exercise-report.ts`).
47
+ */
48
+ const ownOrigin = (url: string): boolean => {
49
+ const base = process.env['APP_URL'] || EXERCISE_APP_URL;
50
+ try {
51
+ return new URL(url).origin === new URL(base).origin;
52
+ } catch {
53
+ return false;
54
+ }
55
+ };
56
+
57
+ /** `routes`, each load's (and `prerender()`'s) typed-client calls answered by the app's API here. */
58
+ export function servedInProcess(routes: readonly RouteLoadSubject[]): readonly RouteLoadSubject[] {
59
+ let dispatch: ReturnType<typeof dispatcher> | undefined;
60
+ const served = (url: string, init: RequestInit): Promise<Response> => {
61
+ dispatch ??= dispatcher();
62
+ return dispatch(url, init);
63
+ };
64
+ return routes.map((route) => {
65
+ const { samples } = route;
66
+ return {
67
+ ...route,
68
+ load: (ctx) => withInProcessFetch(served, () => route.load(ctx), ownOrigin),
69
+ ...(samples === undefined
70
+ ? {}
71
+ : { samples: () => withInProcessFetch(served, () => samples.call(route), ownOrigin) }),
72
+ };
73
+ });
74
+ }
@@ -3,6 +3,7 @@
3
3
  // each naming the route file or the primitive. Warnings on `main` — a page read was never judged
4
4
  // before, and an app that has not opted in stays green (X_BREAKING_ON_MAIN); red needs a floor key.
5
5
 
6
+ import { renderFixLiteral } from '@ultimat3/core';
6
7
  import type { ExerciseRecord, RouteLoadRecord } from '@ultimat3/testing';
7
8
 
8
9
  const where = (record: RouteLoadRecord): string => `route ${record.name} (${record.file})`;
@@ -10,10 +11,13 @@ const where = (record: RouteLoadRecord): string => `route ${record.name} (${reco
10
11
  /** Each route's load as warning lines: a loop, a call over the ceiling, a seq scan, or unrun. */
11
12
  export function routeLoadWarnings(records: readonly RouteLoadRecord[]): readonly string[] {
12
13
  return records.flatMap((record): readonly string[] => {
14
+ // `off` is declared, with its reason, in the report: nothing left to say.
15
+ if (record.outcome === 'off') return [];
13
16
  if (record.outcome !== 'reached') {
14
17
  return [`${where(record)} · load not exercised: ${record.reason ?? record.outcome}`];
15
18
  }
16
19
  const lines: string[] = [];
20
+ if (vacuous(record) && record.empty === undefined) lines.push(emptyRouteLine(record));
17
21
  if (record.scale?.verdict === 'grows') {
18
22
  for (const shape of record.scale.shapes) {
19
23
  lines.push(
@@ -35,6 +39,14 @@ export function routeLoadWarnings(records: readonly RouteLoadRecord[]): readonly
35
39
  });
36
40
  }
37
41
 
42
+ /** Reached with no statement and no effect: every proof on it is vacuous. */
43
+ const vacuous = (record: ExerciseRecord | RouteLoadRecord): boolean =>
44
+ record.outcome === 'reached' && record.statements === 0 && record.effects.length === 0;
45
+
46
+ /** The route's own line: its entry is keyed by pattern, so the paste names it. */
47
+ const emptyRouteLine = (record: RouteLoadRecord): string =>
48
+ `${where(record)} · ${EMPTY_REACH} its load sent no statement and had no effect, so its proofs prove nothing — fix: edit exercise.ts: defineExercise({…}, { routes: { ${renderFixLiteral(record.name, '<pattern>')}: { empty: '<why it reads nothing>' } } }), or give it the params that reach its read`;
49
+
38
50
  /** How many names an empty-reach line lists before it says how many more. */
39
51
  const NAMED = 5;
40
52
 
@@ -46,14 +58,11 @@ const EMPTY_REACH = 'X_EXERCISE_EMPTY_REACH';
46
58
  * is "flat", a tenant proof over nothing is "proven". Said once, with the first few named.
47
59
  */
48
60
  export function emptyReachWarnings(records: readonly ExerciseRecord[]): readonly string[] {
49
- const empty = records.filter(
50
- (record) =>
51
- record.outcome === 'reached' && record.statements === 0 && record.effects.length === 0,
52
- );
61
+ const empty = records.filter((record) => vacuous(record) && record.empty === undefined);
53
62
  if (empty.length === 0) return [];
54
63
  const named = empty.slice(0, NAMED).map((record) => `${record.kind} ${record.name}`);
55
64
  const more = empty.length > NAMED ? `, and ${String(empty.length - NAMED)} more` : '';
56
65
  return [
57
- `${EMPTY_REACH} ${String(empty.length)} reached primitive(s) sent no statement and had no effect, so their proofs prove nothing: ${named.join(', ')}${more} — fix: edit exercise.ts: give each an input that reaches its work, or { off: '<why>' }`,
66
+ `${EMPTY_REACH} ${String(empty.length)} reached primitive(s) sent no statement and had no effect, so their proofs prove nothing: ${named.join(', ')}${more} — fix: edit exercise.ts: give each an input that reaches its work, { empty: '<why it touches nothing>' }, or { off: '<why>' }`,
58
67
  ];
59
68
  }
@@ -13,6 +13,7 @@ import {
13
13
  memoryStorageDriver,
14
14
  resetStorage,
15
15
  } from '@ultimat3/storage';
16
+ import { withStandInDevice } from './exercise-push-device';
16
17
  import type { Env } from './runtime-bindings';
17
18
  import { selectWebPush } from './runtime-push';
18
19
 
@@ -55,7 +56,8 @@ async function installPush(inputs: ExerciseServiceInputs): Promise<() => void> {
55
56
  if (selection === undefined) return () => undefined;
56
57
  const { installWebPush, postgresPushSubscriptionStore } = await import('@ultimat3/pwa');
57
58
  return installWebPush({
58
- store: postgresPushSubscriptionStore({ executor: inputs.executor }),
59
+ // Every actor holds a device (`exercise-push-device.ts`): a sent push is an effect the room sees.
60
+ store: withStandInDevice(postgresPushSubscriptionStore({ executor: inputs.executor })),
59
61
  keys: selection.resolved.keys,
60
62
  subject: selection.subject,
61
63
  pushHosts: selection.pushHosts,
@@ -0,0 +1,47 @@
1
+ // `x exercise --shard i/n`: one of n processes' slice of the pass (`@ultimat3/testing`'s
2
+ // `exercise-shard.ts`), each on its own scratch database. A slice writes its own report beside the
3
+ // whole pass's, and judges no whole-pass floor: a ratio over a third of the pass is not the pass's.
4
+
5
+ // why: Bun ships no path joiner.
6
+ import { join } from 'node:path';
7
+ import { EXERCISE_REPORT_FILE } from './exercise-findings';
8
+ import type { ParsedArgs } from './parse';
9
+ import { flagString } from './parse';
10
+ import type { ShardSpec } from './verify-shard';
11
+ import { parseShard, VerifyShardInvalidError } from './verify-shard';
12
+
13
+ const COMMAND = 'x exercise';
14
+
15
+ /** `--shard`, read: absent, the whole pass. Refused beside a `<name>`, which is a slice already. */
16
+ export function readExerciseShard(
17
+ args: ParsedArgs,
18
+ only: string | undefined,
19
+ ): ShardSpec | undefined {
20
+ const raw = flagString(args, 'shard');
21
+ if (raw === undefined) return undefined;
22
+ let spec: ShardSpec;
23
+ try {
24
+ spec = parseShard(raw, COMMAND);
25
+ } catch {
26
+ // The verify step's fix names `--only`, which this command has not: the reason, with ours.
27
+ throw new VerifyShardInvalidError({
28
+ reason: 'expects i/n with 1 <= i <= n (e.g. 2/4)',
29
+ fix: `${COMMAND} --shard 1/2 --json`,
30
+ command: COMMAND,
31
+ });
32
+ }
33
+ if (only !== undefined) {
34
+ throw new VerifyShardInvalidError({
35
+ reason: 'a shard is a slice of the whole pass, and a <name> already runs one primitive',
36
+ fix: `${COMMAND} --shard ${String(spec.index)}/${String(spec.total)} --json`,
37
+ command: COMMAND,
38
+ });
39
+ }
40
+ return spec;
41
+ }
42
+
43
+ /** Where a slice's report goes: `.x/exercise.2-of-4.json`, never over the whole pass's file. */
44
+ export const shardReportFile = (shard: ShardSpec | undefined): string =>
45
+ shard === undefined
46
+ ? EXERCISE_REPORT_FILE
47
+ : join('.x', `exercise.${String(shard.index)}-of-${String(shard.total)}.json`);
@@ -147,8 +147,8 @@ export interface CommandCatalog {
147
147
  * one is a defect; a doc page may legitimately *say* a command is planned, and a rule that refused
148
148
  * that would delete `wiki/CLI-Reference.md`'s planned table one true row at a time.
149
149
  *
150
- * `allowPlanned` covers `PLANNED_SUBCOMMANDS` as well as `PLANNED_COMMANDS` — `x db studio` is the
151
- * single entry in the first table, and four pages name it as planned.
150
+ * `allowPlanned` covers `PLANNED_SUBCOMMANDS` as well as `PLANNED_COMMANDS`. The subcommand table is
151
+ * empty `As of 2026-11-15`; the rule stays so the next planned subcommand needs no second one.
152
152
  */
153
153
  export interface CitationRules {
154
154
  readonly allowPlanned?: boolean;
@@ -27,7 +27,7 @@ export const FACTORY_GENERATORS: readonly FactoryGenerator[] = [
27
27
  { factory: 'agent', none: MODEL },
28
28
  {
29
29
  factory: 'agentJob',
30
- none: 'wraps an action the app already declares, and which one is a choice x g cannot read off the disk; deferred (plan 101 U6) until x g takes the action to wrap',
30
+ none: "a worker runs a job as its tenant alone, with no grant, so an agentJob over any action x g action writes (policy: can('<feature>:write')) is X_FORBIDDEN on every attempt unless its actor() re-reads the member who asked — and how a member is found (its id on the input, the app's own member table and roles) is the app's convention; paste agentJob(<action>, { name, tenant, retry, actor }) beside the action, as examples/dummy/apps/web/app/posts/jobs/review-draft-later.ts does",
31
31
  },
32
32
  { factory: 'backfill', generator: 'backfill' },
33
33
  {
@@ -39,15 +39,9 @@ export const FACTORY_GENERATORS: readonly FactoryGenerator[] = [
39
39
  factory: 'deviceSocket',
40
40
  none: 'a websocket mount speaking the app’s own device protocol; the protocol is the whole of the declaration, and only the app knows it',
41
41
  },
42
- {
43
- factory: 'exportRows',
44
- none: 'reads one table through the app’s typed handle into a storage disk; deferred (plan 101 U6) until x g can refuse a slice whose table is not the scaffolded one under its own code',
45
- },
42
+ { factory: 'exportRows', generator: 'export-rows' },
46
43
  { factory: 'hive', none: MODEL },
47
- {
48
- factory: 'importRows',
49
- none: 'writes an uploaded file into one table through the app’s typed handle; deferred (plan 101 U6) on the same refusal exportRows waits for',
50
- },
44
+ { factory: 'importRows', generator: 'import-rows' },
51
45
  {
52
46
  factory: 'ledger',
53
47
  none: 'the attempt table a webhook() delivery writes, declared once beside that webhook — it has no meaning without one, so it ships with it',
@@ -96,7 +90,7 @@ export const FACTORY_GENERATORS: readonly FactoryGenerator[] = [
96
90
  },
97
91
  {
98
92
  factory: 'rollup',
99
- none: 'counts a source table into a destination entity by bucket; deferred (plan 101 U6) until x g plants the destination entity and its migration beside it',
93
+ none: 'counts a source table into a DESTINATION entity by bucket, with that entity’s key columns as the upsert key — two tables, one of them new, so the declaration is an entity, a migration (x db gen) and the call, never one call; x g entity <name>-daily writes the destination, then the rollup is pasted beside it',
100
94
  },
101
95
  {
102
96
  factory: 'scrape',
@@ -120,7 +114,7 @@ export const FACTORY_GENERATORS: readonly FactoryGenerator[] = [
120
114
  },
121
115
  {
122
116
  factory: 'webhook',
123
- none: 'one signed delivery to an endpoint the app stores, with its ledger; deferred (plan 101 U6) until x g plants the endpoint table and the ledger it needs',
117
+ none: 'one signed delivery to an endpoint the app stores, read per attempt with its secret, plus the ledger() table every attempt is written to — the endpoint and event tables are the app’s own schema and the ledger is a migration, so the declaration is two tables and the call, never one call',
124
118
  },
125
119
  { factory: 'webhookReceiver', generator: 'webhook-receiver' },
126
120
  {
@@ -1,6 +1,6 @@
1
- // `x g query` and `x g backfill` read a table, so a slice with no `entity.ts` is refused rather than
2
- // handed one. `x g query order` wrote 14 files and `next: x db gen "create orders"`: a read asked
3
- // for and a table delivered. Only `x g entity` and `x g resource` create a feature's data.
1
+ // `x g query`, `backfill`, `export-rows` and `import-rows` read a table, so a slice with no
2
+ // `entity.ts` is refused rather than handed one: `x g query order` wrote 14 files and `next: x db
3
+ // gen "create orders"`. Only `x g entity` and `x g resource` create a feature's data.
4
4
 
5
5
  import { existsSync } from 'node:fs'; // why: a synchronous file probe, as the slice's own guard.
6
6
  import { UltimateError } from '@ultimat3/core';
@@ -11,7 +11,12 @@ import { containedPath } from './generate-write';
11
11
  import { quoteArg } from './shell-quote';
12
12
 
13
13
  /** The generators whose whole body reads a table the slice declares. */
14
- const READS_A_TABLE: ReadonlySet<Generator> = new Set<Generator>(['query', 'backfill']);
14
+ export const READS_A_TABLE: ReadonlySet<Generator> = new Set<Generator>([
15
+ 'query',
16
+ 'backfill',
17
+ 'export-rows',
18
+ 'import-rows',
19
+ ]);
15
20
 
16
21
  /** Declared beside its one thrower: `errors.ts` sits at its 500-line ceiling. */
17
22
  export class FeatureRequiredError extends UltimateError {
@@ -8,6 +8,7 @@ import type { Generator } from './generate-kinds';
8
8
  import { assertLiveSupported, assertSurfaceSupported, GENERATORS } from './generate-kinds';
9
9
  import type { SignInMode } from './generate-sign-in-mode';
10
10
  import { dedupe } from './generate-write';
11
+ import { refuseShippedGuardName } from './guards-built-in-refusal';
11
12
  import { quoteArg } from './shell-quote';
12
13
  import type { GeneratedFile, Surface } from './templates';
13
14
  import {
@@ -24,12 +25,13 @@ import {
24
25
  queryFiles,
25
26
  resourceFiles,
26
27
  routeFiles,
27
- shippedGuardFiles,
28
28
  taskFiles,
29
29
  } from './templates';
30
30
  import { adminCatalogFiles } from './templates/admin-catalog';
31
31
  import { helmDashboardFiles } from './templates/chart-dashboard';
32
32
  import { cronJobFiles } from './templates/generate-cron-job';
33
+ import { exportRowsFiles } from './templates/generate-export-rows';
34
+ import { importRowsFiles } from './templates/generate-import-rows';
33
35
  import { purgeFiles } from './templates/generate-purge';
34
36
  import { webhookReceiverFiles } from './templates/generate-webhook-receiver';
35
37
  import { inviteFiles } from './templates/invite';
@@ -200,14 +202,30 @@ export function generate(options: GenerateOptions): readonly GeneratedFile[] {
200
202
  ...(options.sliceRepo === undefined ? {} : { sliceRepo: options.sliceRepo }),
201
203
  }),
202
204
  );
203
- // A primitive factory's one call, in the feature's slice. None reads the slice: each declares
204
- // no table of its own, so it compiles in a feature that has no entity yet.
205
+ // A primitive factory's one call, in the feature's slice. These three read no slice: each
206
+ // declares no table of its own, so it compiles in a feature that has no entity yet.
205
207
  case 'cron-job':
206
208
  return dedupe(cronJobFiles(options.name, target));
207
209
  case 'purge':
208
210
  return dedupe(purgeFiles(options.name, target));
209
211
  case 'webhook-receiver':
210
212
  return dedupe(webhookReceiverFiles(options.name, target));
213
+ // These two DO read the slice: each moves its own scaffolded table through storage, so a slice
214
+ // shaped otherwise is refused, and one with no entity has it planted — `backfill`'s rule.
215
+ case 'export-rows':
216
+ case 'import-rows': {
217
+ const rows = {
218
+ ...target,
219
+ ...(options.locales === undefined ? {} : { locales: options.locales }),
220
+ ...(options.sliceEntity === undefined ? {} : { sliceEntity: options.sliceEntity }),
221
+ ...(options.sliceRepo === undefined ? {} : { sliceRepo: options.sliceRepo }),
222
+ };
223
+ return dedupe(
224
+ options.kind === 'export-rows'
225
+ ? exportRowsFiles(options.name, rows)
226
+ : importRowsFiles(options.name, rows),
227
+ );
228
+ }
211
229
  case 'entity':
212
230
  // With the labels the admin reads for it: the entity is an admin screen once it is in the
213
231
  // handle, whether or not a resource was generated around it.
@@ -247,11 +265,12 @@ export function generate(options: GenerateOptions): readonly GeneratedFile[] {
247
265
  return dedupe(islandFiles(options.name, { dir: options.at ?? `${surfaceDir}/${feature}` }));
248
266
  // No `--at`, no surface, no feature: `guards/` is the one directory the gate discovers, and a
249
267
  // guard that lived anywhere else would need an app-side registration to be found.
250
- // A name the framework ships a guard under gets THAT guard — how an app adopts one it does
251
- // not have (`x doctor` names them). Any other name is the app's own convention, from the blank
252
- // template.
268
+ // A name the framework ships a guard under is refused: that guard already runs, built in, and
269
+ // installing the framework is the one way to get it (`guards-built-in-refusal.ts`). Any other
270
+ // name is the app's own convention, from the blank template.
253
271
  case 'guard':
254
- return dedupe(shippedGuardFiles(kebab(options.name)) ?? guardFiles(options.name));
272
+ refuseShippedGuardName(kebab(options.name));
273
+ return dedupe(guardFiles(options.name));
255
274
  case 'admin:page':
256
275
  // A default permission, never none: an empty list is `X_ADMIN_PAGE_UNGUARDED` on sight.
257
276
  return dedupe(