@ultimat3/cli 31.48.0 → 31.50.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 (287) hide show
  1. package/CLAUDE.md +30 -23
  2. package/README.md +96 -4
  3. package/package.json +30 -30
  4. package/src/api-registration.ts +45 -14
  5. package/src/api-routes.ts +1 -0
  6. package/src/app-load.ts +7 -3
  7. package/src/app-openapi.ts +7 -1
  8. package/src/app-root.ts +7 -1
  9. package/src/budgets.ts +2 -1
  10. package/src/clean-services.ts +142 -0
  11. package/src/cmd-auth.ts +3 -0
  12. package/src/cmd-clean-spec.ts +10 -3
  13. package/src/cmd-clean.ts +23 -9
  14. package/src/cmd-db-backfill.ts +6 -0
  15. package/src/cmd-db-branch.ts +10 -4
  16. package/src/cmd-db-recount.ts +5 -12
  17. package/src/cmd-db-rollback.ts +77 -0
  18. package/src/cmd-db-spec.ts +18 -2
  19. package/src/cmd-db-status.ts +5 -10
  20. package/src/cmd-db.ts +105 -33
  21. package/src/cmd-deploy-verify.ts +14 -6
  22. package/src/cmd-docs-topic.ts +94 -0
  23. package/src/cmd-docs.ts +15 -1
  24. package/src/cmd-doctor.ts +109 -41
  25. package/src/cmd-drill.ts +80 -18
  26. package/src/cmd-env.ts +30 -8
  27. package/src/cmd-errors-app.ts +63 -0
  28. package/src/cmd-errors.ts +50 -14
  29. package/src/cmd-generate.ts +17 -4
  30. package/src/cmd-heavy-spec.ts +9 -1
  31. package/src/cmd-heavy.ts +111 -27
  32. package/src/cmd-i18n.ts +33 -1
  33. package/src/cmd-jobs.ts +27 -1
  34. package/src/cmd-merge-driver-spec.ts +12 -0
  35. package/src/cmd-merge-driver.ts +95 -0
  36. package/src/cmd-new.ts +23 -3
  37. package/src/cmd-policy-spec.ts +9 -1
  38. package/src/cmd-policy.ts +72 -17
  39. package/src/cmd-stop.ts +18 -4
  40. package/src/cmd-tasks-run.ts +87 -0
  41. package/src/cmd-tasks-spec.ts +10 -3
  42. package/src/cmd-tasks.ts +8 -5
  43. package/src/cmd-test.ts +2 -1
  44. package/src/cmd-upgrade-spec.ts +8 -1
  45. package/src/cmd-upgrade.ts +15 -1
  46. package/src/cmd-verify.ts +9 -41
  47. package/src/codemods/agents-doc-row.ts +73 -0
  48. package/src/codemods/define-error-leaf.ts +37 -12
  49. package/src/codemods/docs-many-agents.ts +11 -15
  50. package/src/codemods/docs-worker-commands.ts +26 -0
  51. package/src/codemods/engine-fs.ts +9 -2
  52. package/src/codemods/index.ts +4 -0
  53. package/src/codemods/merge-drivers.ts +147 -0
  54. package/src/command.ts +3 -0
  55. package/src/db-applied-edits.ts +117 -0
  56. package/src/db-dev-wire.ts +18 -0
  57. package/src/db-diagnostics.ts +5 -10
  58. package/src/db-generate.ts +82 -7
  59. package/src/db-migrate-pass.ts +51 -0
  60. package/src/db-migrate-through-dev.ts +209 -0
  61. package/src/db-rollback-consent.ts +128 -0
  62. package/src/db-rollback-pass.ts +76 -0
  63. package/src/db-seed-generate.ts +5 -1
  64. package/src/db-seed.ts +7 -1
  65. package/src/deploy-verify-findings.ts +3 -0
  66. package/src/deploy-verify-grade.ts +3 -0
  67. package/src/deploy-verify-processes.ts +32 -0
  68. package/src/dev-boot.ts +3 -0
  69. package/src/dev-db-migrate.ts +155 -0
  70. package/src/dev-db-rollback.ts +33 -0
  71. package/src/dev-db-settled.ts +22 -0
  72. package/src/dev-lock-errors.ts +78 -0
  73. package/src/dev-lock-holder-dir.ts +64 -0
  74. package/src/dev-lock-live.ts +44 -0
  75. package/src/dev-lock.ts +59 -84
  76. package/src/dev-policy.ts +11 -8
  77. package/src/dev-rebuild-schema.ts +116 -13
  78. package/src/dev-rebuild.ts +13 -4
  79. package/src/dev-route-table.ts +7 -0
  80. package/src/dispatch.ts +21 -1
  81. package/src/doctor-api-listing.ts +114 -0
  82. package/src/doctor-guarded.ts +41 -0
  83. package/src/doctor-port.ts +90 -17
  84. package/src/doctor-probe.ts +36 -5
  85. package/src/doctor-processes-probe.ts +127 -0
  86. package/src/doctor-processes.ts +136 -0
  87. package/src/doctor-warnings.ts +17 -0
  88. package/src/error-codes-agents.ts +35 -0
  89. package/src/error-codes-processes.ts +30 -0
  90. package/src/error-codes-tooling.ts +2 -0
  91. package/src/error-codes.ts +12 -13
  92. package/src/errors-suite.ts +27 -0
  93. package/src/errors.ts +18 -22
  94. package/src/exercise-registration.ts +4 -3
  95. package/src/exercise-services.ts +13 -3
  96. package/src/framework-env.ts +7 -3
  97. package/src/framework-schema.ts +15 -5
  98. package/src/generate-files.ts +1 -0
  99. package/src/generate-grant-findings.ts +7 -5
  100. package/src/generate-grants.ts +9 -8
  101. package/src/generate-kinds.ts +30 -6
  102. package/src/generate-roles-file.ts +30 -0
  103. package/src/generate-slice-policy.ts +3 -3
  104. package/src/guard-sources.ts +1 -2
  105. package/src/guards.ts +2 -2
  106. package/src/heavy-env.ts +2 -0
  107. package/src/heavy-errors.ts +18 -0
  108. package/src/heavy-holders.ts +78 -0
  109. package/src/heavy-ledger.ts +56 -14
  110. package/src/heavy-pressure.ts +104 -0
  111. package/src/heavy.ts +31 -13
  112. package/src/i18n-registration.ts +22 -2
  113. package/src/island-harness.ts +2 -2
  114. package/src/job-budget.ts +4 -2
  115. package/src/job-registration.ts +64 -8
  116. package/src/jobs-queue-known.ts +43 -0
  117. package/src/mcp-errors-agents.ts +20 -0
  118. package/src/mcp-errors-doctor.ts +27 -0
  119. package/src/mcp-errors-processes.ts +23 -0
  120. package/src/mcp-errors.ts +15 -29
  121. package/src/mcp-host.ts +2 -2
  122. package/src/merge-driver-catalog.ts +58 -0
  123. package/src/merge-driver-config.ts +43 -0
  124. package/src/merge-driver-lines.ts +140 -0
  125. package/src/merge-state.ts +105 -0
  126. package/src/messages-db.ts +22 -1
  127. package/src/messages-processes.ts +13 -0
  128. package/src/messages-upgrade.ts +10 -0
  129. package/src/messages.ts +54 -4
  130. package/src/output-findings.ts +48 -21
  131. package/src/page-navigation.ts +5 -2
  132. package/src/parse.ts +37 -6
  133. package/src/policy-facts.ts +38 -21
  134. package/src/policy-row.ts +99 -0
  135. package/src/port-pair-free.ts +28 -0
  136. package/src/pwa-artifacts.ts +1 -1
  137. package/src/registry-lines.ts +110 -0
  138. package/src/registry.ts +2 -0
  139. package/src/retain-sweep.ts +1 -1
  140. package/src/retained-assets-boot.ts +1 -1
  141. package/src/role-replicator.ts +4 -1
  142. package/src/role-select.ts +86 -0
  143. package/src/role-start.ts +13 -55
  144. package/src/role-sync.ts +10 -5
  145. package/src/runtime-assets-site.ts +2 -2
  146. package/src/runtime-assets.ts +1 -1
  147. package/src/runtime-cache-frame.ts +46 -0
  148. package/src/runtime-cache-ttl.ts +23 -0
  149. package/src/runtime-cache.ts +33 -16
  150. package/src/runtime-database-ssl.ts +84 -0
  151. package/src/runtime-idempotency-scope.ts +16 -2
  152. package/src/runtime-jobs-share.ts +52 -0
  153. package/src/runtime-jobs.ts +43 -12
  154. package/src/runtime-queue.ts +18 -3
  155. package/src/runtime-render-document.ts +1 -2
  156. package/src/runtime-services.ts +8 -1
  157. package/src/schema-drift.ts +19 -2
  158. package/src/schema-dump-drift.ts +4 -1
  159. package/src/serve-boot-probe.ts +30 -2
  160. package/src/serve-boot.ts +11 -1
  161. package/src/serve-env.ts +39 -3
  162. package/src/serve.ts +61 -10
  163. package/src/site-asset-routes.ts +2 -2
  164. package/src/site-assets.ts +5 -158
  165. package/src/stop-run-start.ts +12 -0
  166. package/src/supervise-boot.ts +61 -0
  167. package/src/supervise-cgroup.ts +84 -0
  168. package/src/supervise-child.ts +206 -0
  169. package/src/supervise-count.ts +244 -0
  170. package/src/supervise-errors.ts +83 -0
  171. package/src/supervise-facts.ts +40 -0
  172. package/src/supervise-messages.ts +84 -0
  173. package/src/supervise-policy.ts +46 -0
  174. package/src/supervise-pool.ts +10 -0
  175. package/src/supervise-probe.ts +158 -0
  176. package/src/supervise-run.ts +54 -0
  177. package/src/supervise.ts +383 -0
  178. package/src/sw-precache-plan.ts +1 -1
  179. package/src/templates/generate-purge.ts +6 -6
  180. package/src/templates/guard-animated-layout-property.ts +2 -2
  181. package/src/templates/guard-bare-error.ts +1 -1
  182. package/src/templates/guard-error-declared.ts +2 -2
  183. package/src/templates/guard-focus-visible.ts +1 -1
  184. package/src/templates/guard-image-dimensions.ts +2 -2
  185. package/src/templates/guard-island-mount-clears.ts +1 -1
  186. package/src/templates/guard-native-confirm.ts +1 -1
  187. package/src/templates/guard-raw-breakpoint.ts +2 -2
  188. package/src/templates/guard-raw-colour.ts +2 -2
  189. package/src/templates/guard-raw-fetch.ts +1 -1
  190. package/src/templates/guard-raw-interval.ts +1 -1
  191. package/src/templates/guard-raw-length.ts +3 -3
  192. package/src/templates/guard-raw-motion.ts +97 -1
  193. package/src/templates/guard-raw-shadow.ts +1 -1
  194. package/src/templates/guard-raw-z-index.ts +1 -1
  195. package/src/templates/guard-released-forms.ts +58 -9
  196. package/src/templates/guard-repo-await-in-loop.ts +1 -1
  197. package/src/templates/guard-repo-raw-sql.ts +4 -4
  198. package/src/templates/guard-repo-unbounded.ts +1 -1
  199. package/src/templates/guard-runtime-pin.ts +1 -1
  200. package/src/templates/guard-semantic-interactive.ts +2 -2
  201. package/src/templates/guard-unbounded-fanout.ts +1 -1
  202. package/src/templates/guard-undeclared-custom-property.ts +3 -3
  203. package/src/templates/guard-undefined-style-class.ts +3 -3
  204. package/src/templates/guard-unzoned-date.ts +3 -3
  205. package/src/templates/query-slice.ts +82 -0
  206. package/src/templates/query.ts +76 -30
  207. package/src/templates/resource-page.ts +3 -2
  208. package/src/templates/scaffold-bin.ts +2 -0
  209. package/src/templates/scaffold-claude-commands.ts +6 -0
  210. package/src/templates/scaffold-claude.ts +4 -4
  211. package/src/templates/scaffold-container-compose.ts +47 -7
  212. package/src/templates/scaffold-docs.ts +7 -3
  213. package/src/templates/scaffold-gitattributes.ts +18 -1
  214. package/src/templates/scaffold-helm-templates.ts +9 -0
  215. package/src/templates/scaffold-repo.ts +5 -2
  216. package/src/templates/scaffold-test-services.ts +33 -11
  217. package/src/templates/shapes/offline.ts +0 -7
  218. package/src/templates/shapes/realtime.ts +2 -6
  219. package/src/templates/sign-in-action-tests.ts +6 -4
  220. package/src/templates/sign-in-challenge.ts +62 -0
  221. package/src/templates/sign-in-oidc-mfa.ts +31 -0
  222. package/src/templates/sign-in-oidc.ts +11 -3
  223. package/src/templates/sign-in-password.ts +18 -56
  224. package/src/test-only-shipped.ts +29 -2
  225. package/src/test-shards.ts +134 -42
  226. package/src/test-verdict.ts +79 -0
  227. package/src/test-workers.ts +15 -0
  228. package/src/upgrade-coverage-ratchet.ts +95 -0
  229. package/src/upgrade-gate-codemods.ts +5 -3
  230. package/src/upgrade-gate.ts +42 -4
  231. package/src/upgrade-merge-drivers.ts +25 -0
  232. package/src/upgrade-report.ts +32 -4
  233. package/src/upgrade-scope.ts +62 -0
  234. package/src/verify-checks.ts +2 -8
  235. package/src/verify-coverage-run.ts +4 -1
  236. package/src/verify-e2e.ts +21 -3
  237. package/src/verify-live.ts +38 -14
  238. package/src/verify-only.ts +67 -0
  239. package/src/verify-progress.ts +7 -3
  240. package/src/verify-run.ts +20 -2
  241. package/src/verify-services-stack.ts +165 -0
  242. package/src/verify-services.ts +84 -2
  243. package/src/verify-test-run.ts +6 -7
  244. package/src/verify-tests.ts +8 -2
  245. package/src/verify-typecheck.ts +25 -2
  246. package/src/workspace-checks.ts +4 -1
  247. package/wiki/Actions.md +66 -3
  248. package/wiki/Admin-Dashboard.md +2 -2
  249. package/wiki/Agents.md +5 -5
  250. package/wiki/Auth.md +20 -6
  251. package/wiki/Bare-VM.md +1 -1
  252. package/wiki/CI-Parallel-Gate.md +2 -1
  253. package/wiki/CLI-Reference.md +115 -42
  254. package/wiki/Caching-And-Invalidation.md +1 -1
  255. package/wiki/Client-Navigation.md +35 -5
  256. package/wiki/Configuration.md +12 -10
  257. package/wiki/Deployment.md +44 -4
  258. package/wiki/Entities-And-Migrations.md +17 -3
  259. package/wiki/FAQ.md +1 -1
  260. package/wiki/Getting-Started.md +2 -2
  261. package/wiki/Home.md +3 -3
  262. package/wiki/I18n.md +6 -4
  263. package/wiki/Installation.md +12 -11
  264. package/wiki/Interface-Rules.md +3 -1
  265. package/wiki/Jobs-And-Workflows.md +24 -4
  266. package/wiki/Known-Gaps.md +2 -2
  267. package/wiki/MCP-And-AI.md +48 -13
  268. package/wiki/Many-Agents.md +69 -2
  269. package/wiki/Migrations-And-Backfills.md +18 -0
  270. package/wiki/Notify.md +5 -3
  271. package/wiki/Observability.md +13 -0
  272. package/wiki/Outbound-HTTP.md +53 -2
  273. package/wiki/Policies-And-Authz.md +1 -1
  274. package/wiki/Queries-And-Live-Queries.md +2 -2
  275. package/wiki/Realtime.md +24 -7
  276. package/wiki/Routes-And-Render-Modes.md +2 -2
  277. package/wiki/Scheduled-Tasks.md +4 -1
  278. package/wiki/Static-Assets.md +5 -3
  279. package/wiki/Testing.md +64 -7
  280. package/wiki/Theming.md +6 -3
  281. package/wiki/Timezones-And-Dates.md +5 -1
  282. package/wiki/Troubleshooting.md +1 -0
  283. package/wiki/Tutorial-01-First-App.md +3 -3
  284. package/wiki/Tutorial-02-First-Feature.md +1 -1
  285. package/wiki/Tutorial-03-Auth-And-Admin.md +7 -6
  286. package/wiki/UI-Components.md +1 -0
  287. package/wiki/Upgrading.md +38 -0
@@ -46,7 +46,7 @@ import { join } from 'node:path';
46
46
  import { ERROR_DOCS_URL } from '@ultimat3/core';
47
47
  import { ISOLATED_ENV } from '@ultimat3/testing';
48
48
  import type { AffectedSelection } from './affected';
49
- import type { Runner } from './exec';
49
+ import type { ExecResult, Runner } from './exec';
50
50
  import { msg } from './messages';
51
51
  import type { CommandResult, Finding, JsonValue, StepResult } from './output';
52
52
  import { quoteArg } from './shell-quote';
@@ -57,11 +57,14 @@ import type { MachineLease } from './test-slots';
57
57
  export const TEST_TIMINGS_FILE = '.x/test-timings.json';
58
58
 
59
59
  import { runBatches, testBatches } from './test-batches';
60
+ import { countsOf } from './test-counts';
60
61
  import { tidyBeforeTestRun } from './test-housekeeping';
61
62
  import { testPasses } from './test-passes';
62
63
  import type { TestFile } from './test-select';
63
64
  import { loadTimings, SLOWEST_KEPT, slowestOf } from './test-timings';
65
+ import { allSkippedFinding, failingFiles } from './test-verdict';
64
66
  import { BATCH_FILES_PER_WORKER, SHARED_BATCH_FILES_PER_WORKER } from './test-workers';
67
+ import { appE2eRun, drivesBrowser, type E2eRun, isAppRoot } from './verify-e2e';
65
68
  import type { TestType } from './verify-tests';
66
69
 
67
70
  /**
@@ -151,27 +154,30 @@ export interface ReproduceOptions {
151
154
  * and the command still runs, over a different file set, which reproduces nothing.
152
155
  */
153
156
  export function reproduceFor(options: ReproduceOptions): string {
157
+ return `x ${quoteArg(reproduceWords(options))}`;
158
+ }
159
+
160
+ /** `reproduceFor`'s words after `x`, unquoted: each is quoted on its own (`quoteArg`) where pasted. */
161
+ export function reproduceWords(options: ReproduceOptions): readonly string[] {
154
162
  return [
155
- 'x test',
156
- ...(options.type === undefined ? [] : [quoteArg(options.type)]),
157
- ...(options.filter === undefined ? [] : ['--filter', quoteArg(options.filter)]),
163
+ 'test',
164
+ ...(options.type === undefined ? [] : [options.type]),
165
+ ...(options.filter === undefined ? [] : ['--filter', options.filter]),
158
166
  ...(options.sample === undefined ? [] : ['--sample', String(options.sample)]),
159
167
  // `--base` is emitted always rather than only when non-default: the default is `main`, and a
160
168
  // rerun days later against a moved `main` is a different diff wearing the same flag.
161
- ...(options.affected === undefined
162
- ? []
163
- : ['--affected', '--base', quoteArg(options.affected.base)]),
169
+ ...(options.affected === undefined ? [] : ['--affected', '--base', options.affected.base]),
164
170
  ...(options.affected?.dirty === true ? ['--dirty'] : []),
165
171
  '--workers',
166
172
  String(options.workers),
167
173
  ...(options.isolate === true ? ['--isolate'] : []),
168
174
  ...(options.seed === undefined ? [] : ['--seed', String(options.seed)]),
169
175
  // Last, and after a `--` of its own, because that is where the caller typed it and where the
170
- // parser will find it again. Quoted for `shell-quote.ts`'s reason: a reproduce line is pasted.
176
+ // parser will find it again.
171
177
  ...(options.passthrough === undefined || options.passthrough.length === 0
172
178
  ? []
173
- : ['--', ...options.passthrough.map(quoteArg)]),
174
- ].join(' ');
179
+ : ['--', ...options.passthrough]),
180
+ ];
175
181
  }
176
182
 
177
183
  export interface RunShardsOptions {
@@ -233,16 +239,56 @@ const planOf = (
233
239
  : { passthrough: options.passthrough }),
234
240
  });
235
241
 
242
+ /** The failing files shown in a cause; the rest are counted. */
243
+ const SHOWN_FAILING = 5;
244
+
245
+ /** `plan` narrowed to one file, alone: the rerun of a failure that is not the whole suite again. */
246
+ const narrowedTo = (plan: ReproduceOptions, file: string): ReproduceOptions => ({
247
+ workers: 1,
248
+ filter: file,
249
+ ...(plan.type === undefined ? {} : { type: plan.type }),
250
+ ...(plan.isolate === true ? { isolate: true } : {}),
251
+ ...(plan.seed === undefined ? {} : { seed: plan.seed }),
252
+ ...(plan.passthrough === undefined ? {} : { passthrough: plan.passthrough }),
253
+ });
254
+
236
255
  /**
237
- * `X_TEST_FAILED`, whose `fix:` reruns exactly what failed. `X_TEST_SHARD_FAILED` was the
238
- * `--worker` rerun's and went with it: the code stays registered (codes are forever) and unthrown.
256
+ * `X_TEST_FAILED`. With the failing files read out of bun's output, the cause names them and the
257
+ * fix reruns the first one alone — rerunning the selection that just failed is the line the
258
+ * reader already ran. Only when bun named no file is the fix the whole reproduction.
259
+ * `X_TEST_SHARD_FAILED` was the `--worker` rerun's and went with it: registered, unthrown.
239
260
  */
240
- export const failureOf = (code: number, files: number, plan: ReproduceOptions): Finding => ({
241
- code: 'X_TEST_FAILED',
242
- cause: `${plan.type ?? 'test'} run exited ${code} across ${plan.workers} worker(s) (${files} file(s))`,
243
- fix: reproduceFor(plan),
244
- docs: ERROR_DOCS_URL,
245
- });
261
+ export const failureOf = (
262
+ code: number,
263
+ files: number,
264
+ plan: ReproduceOptions,
265
+ failing: readonly string[] = [],
266
+ ): Finding => {
267
+ const first = failing[0];
268
+ const more = failing.length > SHOWN_FAILING ? ` (+${failing.length - SHOWN_FAILING} more)` : '';
269
+ const named =
270
+ first === undefined ? '' : `; failing: ${failing.slice(0, SHOWN_FAILING).join(', ')}${more}`;
271
+ return {
272
+ code: 'X_TEST_FAILED',
273
+ cause: `${plan.type ?? 'test'} run exited ${code} across ${plan.workers} worker(s) (${files} file(s))${named}`,
274
+ fix: reproduceFor(first === undefined ? plan : narrowedTo(plan, first)),
275
+ docs: ERROR_DOCS_URL,
276
+ };
277
+ };
278
+
279
+ /** The environment the children saw: this process's, with the overrides applied (undefined unsets). */
280
+ const childEnv = (
281
+ env: Readonly<Record<string, string | undefined>>,
282
+ overrides: Readonly<Record<string, string | undefined>>,
283
+ ): Readonly<Record<string, string | undefined>> => {
284
+ // A Map, never a keyed object: an env key is any string, `__proto__` included.
285
+ const out = new Map(Object.entries(env));
286
+ for (const [key, value] of Object.entries(overrides)) {
287
+ if (value === undefined) out.delete(key);
288
+ else out.set(key, value);
289
+ }
290
+ return Object.fromEntries(out);
291
+ };
246
292
 
247
293
  /**
248
294
  * ONE `bun test` PER BATCH, a pass being as many batches as `test-batches.ts` cuts it into, and
@@ -280,8 +326,10 @@ export async function runShards(options: RunShardsOptions): Promise<CommandResul
280
326
  const steps: StepResult[] = [];
281
327
  const spent: JsonValue[] = [];
282
328
  let batchCount = 0;
329
+ let peak = 1;
283
330
  let ok = true;
284
331
  let exitCode = 0;
332
+ const results: ExecResult[] = [];
285
333
  for (const pass of passes) {
286
334
  const files = pass.files.map((file) => file.path);
287
335
  // `-- --watch` is never split: it never exits, so a second batch would never start. Every
@@ -293,6 +341,15 @@ export async function runShards(options: RunShardsOptions): Promise<CommandResul
293
341
  isolatedRun(options) ? BATCH_FILES_PER_WORKER : SHARED_BATCH_FILES_PER_WORKER,
294
342
  )
295
343
  : [files];
344
+ // The e2e pass runs as the gate's `e2e` step does: in an app with a browser, under the e2e
345
+ // preload that spawns the app (`verify-e2e.ts`). Elsewhere its browser cases skip, as there.
346
+ const launch =
347
+ pass.type === 'e2e' && (await drivesBrowser(isAppRoot(options.root), options.env ?? Bun.env));
348
+ const passRun = (command: readonly string[]): E2eRun =>
349
+ launch
350
+ ? appE2eRun({ root: options.root, command, env: envOverrides })
351
+ : { command, env: envOverrides };
352
+ const passEnv = passRun([]).env;
296
353
  const result = await runBatches({
297
354
  runner: options.runner,
298
355
  batches,
@@ -300,21 +357,29 @@ export async function runShards(options: RunShardsOptions): Promise<CommandResul
300
357
  workers: pass.workers,
301
358
  ...(options.lease === undefined ? {} : { lease: options.lease }),
302
359
  argsFor: (batch, width) =>
303
- testArgs({
304
- files: batch,
305
- workers: width,
306
- ...(options.passthrough === undefined ? {} : { passthrough: options.passthrough }),
307
- ...(options.isolate === undefined ? {} : { isolate: options.isolate }),
308
- timings: join(options.root, TEST_TIMINGS_FILE),
309
- }),
360
+ passRun(
361
+ testArgs({
362
+ files: batch,
363
+ workers: width,
364
+ ...(options.passthrough === undefined ? {} : { passthrough: options.passthrough }),
365
+ ...(options.isolate === undefined ? {} : { isolate: options.isolate }),
366
+ timings: join(options.root, TEST_TIMINGS_FILE),
367
+ }),
368
+ ).command,
310
369
  options: {
311
370
  cwd: options.root,
312
- ...(Object.keys(envOverrides).length === 0 ? {} : { env: envOverrides }),
371
+ ...(Object.keys(passEnv).length === 0 ? {} : { env: passEnv }),
313
372
  },
314
373
  });
315
374
  batchCount += batches.length;
316
375
  const plan = planOf(options, pass);
317
- const label = `${pass.workers} worker(s)`;
376
+ // What ran, not what was asked: the machine lease may hold every batch below the plan.
377
+ const reached = Math.max(1, ...result.widths);
378
+ peak = Math.max(peak, reached);
379
+ const narrowed = reached < pass.workers;
380
+ const label = narrowed
381
+ ? msg('cli.test.narrowed', { peak: reached, planned: pass.workers })
382
+ : `${pass.workers} worker(s)`;
318
383
  steps.push({
319
384
  name: `${pass.type === undefined ? label : `${pass.type} · ${label}`} · ${files.length} files${
320
385
  batches.length > 1 ? msg('cli.test.batches', { batches: batches.length }) : ''
@@ -323,14 +388,17 @@ export async function runShards(options: RunShardsOptions): Promise<CommandResul
323
388
  durationMs: result.durationMs,
324
389
  // `output.ts` documents this field as absent for a NON-test step, so omitting it here made
325
390
  // `renderJson` describe the test step as one — recoverable only by parsing `name`.
326
- workers: pass.workers,
327
- findings: result.ok ? [] : [failureOf(result.code, files.length, plan)],
391
+ workers: reached,
392
+ findings: result.ok
393
+ ? []
394
+ : [failureOf(result.code, files.length, plan, failingFiles(result.output, files))],
328
395
  output: result.output,
329
396
  });
330
397
  spent.push({
331
398
  ...(pass.type === undefined ? {} : { type: pass.type }),
332
399
  files: files.length,
333
400
  workers: pass.workers,
401
+ ...(narrowed ? { peakWorkers: reached } : {}),
334
402
  ...(batches.length > 1 ? { batches: batches.length } : {}),
335
403
  ok: result.ok,
336
404
  exitCode: result.code,
@@ -338,6 +406,7 @@ export async function runShards(options: RunShardsOptions): Promise<CommandResul
338
406
  });
339
407
  ok = ok && result.ok;
340
408
  if (exitCode === 0) exitCode = result.code;
409
+ results.push(...result.results);
341
410
  }
342
411
  const durationMs = Math.round(performance.now() - started);
343
412
  const fileCount = options.files.length;
@@ -350,7 +419,7 @@ export async function runShards(options: RunShardsOptions): Promise<CommandResul
350
419
  SLOWEST_KEPT,
351
420
  );
352
421
  // Each pass's line names its own slowest, so a mixed run's serial half is not hidden by the rest.
353
- const timedSteps = steps.map((step, index) => {
422
+ let timedSteps = steps.map((step, index) => {
354
423
  const own = slowestOf(timings, passes[index]?.files.map((file) => file.path) ?? []);
355
424
  return own.length === 0 ? step : { ...step, slowest: own };
356
425
  });
@@ -362,12 +431,33 @@ export async function runShards(options: RunShardsOptions): Promise<CommandResul
362
431
  workers,
363
432
  ...(options.type === undefined ? {} : { type: options.type }),
364
433
  });
434
+ // `bun test` exits 0 over a run whose every test skipped itself: only the counts say nothing ran.
435
+ const counts = countsOf(results);
436
+ const skippedOnly = ok && !watching && counts.ran === 0 && counts.skipped > 0;
437
+ if (skippedOnly) {
438
+ const finding = allSkippedFinding({
439
+ ...(options.type === undefined ? {} : { type: options.type }),
440
+ skipped: counts.skipped,
441
+ files: options.files.map((file) => file.path),
442
+ env: childEnv(options.env ?? Bun.env, envOverrides),
443
+ rerun: reproduceWords(plan),
444
+ });
445
+ timedSteps = timedSteps.map((step) => ({
446
+ ...step,
447
+ ok: false,
448
+ findings: [...step.findings, finding],
449
+ }));
450
+ ok = false;
451
+ exitCode = 1;
452
+ }
365
453
  const type = options.type;
366
454
  const typeParam = type === undefined ? {} : { type };
367
455
  const sample = options.sample;
368
456
  const data: JsonValue = {
369
457
  ...typeParam,
370
458
  workers,
459
+ // Only when the machine held the run below `workers`, which stays the width to reproduce with.
460
+ ...(peak < workers ? { peakWorkers: peak } : {}),
371
461
  files: fileCount,
372
462
  durationMs,
373
463
  ...(options.filter === undefined ? {} : { filter: options.filter }),
@@ -386,18 +476,20 @@ export async function runShards(options: RunShardsOptions): Promise<CommandResul
386
476
  return {
387
477
  ok,
388
478
  command: 'test',
389
- summary: ok
390
- ? msg(type === undefined ? 'cli.test.pass' : 'cli.test.type.pass', {
391
- ...typeParam,
392
- files: fileCount,
393
- workers,
394
- ms: durationMs,
395
- })
396
- : msg(type === undefined ? 'cli.test.fail' : 'cli.test.type.fail', {
397
- ...typeParam,
398
- failed: steps.filter((step) => !step.ok).length,
399
- workers,
400
- }),
479
+ summary: skippedOnly
480
+ ? msg('cli.test.allSkipped', { label: type ?? 'test', skipped: counts.skipped })
481
+ : ok
482
+ ? msg(type === undefined ? 'cli.test.pass' : 'cli.test.type.pass', {
483
+ ...typeParam,
484
+ files: fileCount,
485
+ workers: Math.min(peak, workers),
486
+ ms: durationMs,
487
+ })
488
+ : msg(type === undefined ? 'cli.test.fail' : 'cli.test.type.fail', {
489
+ ...typeParam,
490
+ failed: steps.filter((step) => !step.ok).length,
491
+ workers,
492
+ }),
401
493
  steps: timedSteps,
402
494
  ...(sample === undefined
403
495
  ? {}
@@ -0,0 +1,79 @@
1
+ // What a finished `x test` run says beyond its exit code: which files failed, read out of bun's own
2
+ // per-file headers, and why a run in which every test skipped itself is not a pass. Split from
3
+ // `test-shards.ts`, which spends the files; this file only reads what came back.
4
+
5
+ import { ERROR_DOCS_URL } from '@ultimat3/core';
6
+ import { TEST_SERVICE_ENV, TEST_SERVICES_START } from '@ultimat3/testing';
7
+ import type { Finding } from './output';
8
+ import { quoteArg } from './shell-quote';
9
+
10
+ /** Bun prints `<path>:` above a file's own lines, and only for a file that printed something. */
11
+ const HEADER = /^(\S.*):$/;
12
+ /** What makes a file's section a failure: a failed test, or an error outside any test. */
13
+ const FAILED = /^\(fail\) |^# Unhandled error/;
14
+
15
+ const normal = (path: string): string => path.split('\\').join('/').replace(/^\.\//, '');
16
+
17
+ /**
18
+ * The run's files whose section in bun's output holds a failure, in the order bun printed them.
19
+ * A header naming no file of the run is ignored, so a log line ending in `:` is never a file.
20
+ */
21
+ export function failingFiles(output: string, files: readonly string[]): readonly string[] {
22
+ const known = new Set(files.map(normal));
23
+ const failing: string[] = [];
24
+ let current: string | undefined;
25
+ for (const line of output.split('\n')) {
26
+ const header = HEADER.exec(line.trimEnd())?.[1];
27
+ if (header !== undefined && known.has(normal(header))) {
28
+ current = normal(header);
29
+ continue;
30
+ }
31
+ if (current !== undefined && FAILED.test(line) && !failing.includes(current)) {
32
+ failing.push(current);
33
+ }
34
+ }
35
+ return failing;
36
+ }
37
+
38
+ type Env = Readonly<Record<string, string | undefined>>;
39
+
40
+ /** The service variables the children ran without: a test that `needs` one skips over it. */
41
+ const unsetServices = (env: Env): readonly string[] =>
42
+ Object.values(TEST_SERVICE_ENV).filter((key) => (env[key]?.trim() ?? '') === '');
43
+
44
+ const SHOWN_FILES = 3;
45
+
46
+ /**
47
+ * A run whose every test skipped itself executed nothing, and `bun test` still exits 0 over it —
48
+ * so "passed" would be the one answer that is certainly wrong. `X_TEST_FAILED`: the type ran no
49
+ * check. The cause names what the children lacked; the fix starts it, or shows each skip's
50
+ * condition when nothing the framework knows of was missing.
51
+ */
52
+ export function allSkippedFinding(input: {
53
+ readonly type?: string;
54
+ readonly skipped: number;
55
+ readonly files: readonly string[];
56
+ /** The environment the `bun test` children saw. */
57
+ readonly env: Env;
58
+ /** `reproduceWords`: the selection's words after `x`, every selector kept, quoted here. */
59
+ readonly rerun: readonly string[];
60
+ }): Finding {
61
+ const missing = unsetServices(input.env);
62
+ const label = input.type ?? 'test';
63
+ const why =
64
+ missing.length === 0
65
+ ? 'each skip is its own condition in the file (a skipIf, a test.skip, a needs: whose service is unset)'
66
+ : `the run's environment leaves ${missing.join(', ')} unset, and a test that needs that service skips without it`;
67
+ const shown = input.files.slice(0, SHOWN_FILES).map(quoteArg).join(' ');
68
+ return {
69
+ code: 'X_TEST_FAILED',
70
+ cause: `${label} run executed 0 of ${input.skipped} test(s): every one skipped itself, so nothing was checked — ${why}`,
71
+ fix:
72
+ missing.length === 0
73
+ ? `grep -nE 'skip|needs:' ${shown} # set what each skip waits for, then: x ${quoteArg(input.rerun)}`
74
+ : // The reproduce line, whole: `--affected`, `--sample` and a passthrough decide the
75
+ // selection, and a rebuilt `x test <type> --filter` reran a broader one.
76
+ `${TEST_SERVICES_START} && x ${quoteArg(input.rerun)} # this selection, now with the services`,
77
+ docs: ERROR_DOCS_URL,
78
+ };
79
+ }
@@ -9,6 +9,7 @@
9
9
  import { cpus, totalmem } from 'node:os';
10
10
  import { UltimateError } from '@ultimat3/core';
11
11
  import type { TestType } from '@ultimat3/testing';
12
+ import { msg } from './messages';
12
13
 
13
14
  /**
14
15
  * `ULTIMATE_TEST_MEMORY_BUDGET` or `ULTIMATE_TEST_MAX_WORKERS` set to something that does not
@@ -227,6 +228,20 @@ export function workerPlan(
227
228
  return { workers, budgetBytes, boundBy, reason: `${String(workers)} ${noun} (${why})` };
228
229
  }
229
230
 
231
+ /**
232
+ * A plan cut short by the selection: one worker per file. It read `4 of 6 workers`, and a run the
233
+ * machine then narrowed read `2 of 4 of 6 workers`.
234
+ */
235
+ export const fileBoundWidth = (files: number, reason: string): string =>
236
+ `${String(files)} ${files === 1 ? 'worker' : 'workers'}, one per file (plan: ${reason})`;
237
+
238
+ /**
239
+ * The step line's width: the plan when the run reached it, else the widest batch beside the plan.
240
+ * Never "held by another run": the core cap narrows a run on a machine with nobody else on it.
241
+ */
242
+ export const reachedWidth = (peak: number, planned: number, reason: string): string =>
243
+ peak < planned ? msg('cli.test.narrowedWhy', { peak, planned, reason }) : reason;
244
+
230
245
  /** The width alone — `workerPlan(...).workers`. */
231
246
  export const defaultWorkers = (
232
247
  cpus: number = availableCpus(),
@@ -0,0 +1,95 @@
1
+ // A hop's coverage ratchet: a gate whose `unit` step says `X_COVERAGE_FLOOR_STALE` — the tree
2
+ // covers more than `x.verify.json` states, a codemod's test among the causes — gets the floor
3
+ // raised to what that run measured, never lowered, and `unit` judged again. Written into the
4
+ // hop's diff and reported, never silently.
5
+
6
+ // why: Bun exposes no path-join primitive; `x.verify.json` sits at the app root.
7
+ import { join } from 'node:path';
8
+ import { t } from '@ultimat3/schema';
9
+ import { COVERAGE_BAR, COVERAGE_FIELD, floorFor } from './coverage-floor';
10
+ import { msg } from './messages';
11
+ import { statedCoverage } from './upgrade-coverage';
12
+ import { documentIn } from './upgrade-document';
13
+ import type { HopGate } from './upgrade-gate';
14
+ import { VERIFY_FLOOR_FILE } from './verify-floor';
15
+
16
+ const STALE = 'X_COVERAGE_FLOOR_STALE';
17
+ const UNIT = 'unit';
18
+
19
+ interface Numbers {
20
+ readonly lines: number;
21
+ readonly funcs: number;
22
+ }
23
+
24
+ /** What the report carries: the floor before, the one written, and the run that measured it. */
25
+ export interface HopCoverageRatchet {
26
+ readonly file: string;
27
+ readonly measured: Numbers;
28
+ readonly from: Numbers;
29
+ readonly to: Numbers;
30
+ }
31
+
32
+ type Verify = HopGate['verify'];
33
+
34
+ const MEASURED = t.object({
35
+ data: t.object({ coverage: t.object({ unit: t.object({ lines: t.number, funcs: t.number }) }) }),
36
+ });
37
+
38
+ /** Whether the gate's `unit` step said its floor is stale. */
39
+ export const staleUnitFloor = (verify: Verify): boolean =>
40
+ verify.findings.some((finding) => finding.step === UNIT && finding.code === STALE);
41
+
42
+ /** The `unit` step's measurement off a verify document; undefined when it carries none. */
43
+ export function measuredUnit(stdout: string): Numbers | undefined {
44
+ const parsed = MEASURED.safeParse(documentIn(stdout));
45
+ if (parsed.issues !== undefined) return undefined;
46
+ const { lines, funcs } = (parsed.value as { data: { coverage: { unit: Numbers } } }).data.coverage
47
+ .unit;
48
+ return { lines, funcs };
49
+ }
50
+
51
+ /**
52
+ * Each number to the larger of the stated floor and the measured whole percent — the stale
53
+ * finding's own fix — so no floor ever falls. A floor that reaches the bar drops its `why`, as
54
+ * that fix says. Null when nothing rises, or the app states no floor to raise.
55
+ */
56
+ export async function raiseCoverageFloor(
57
+ root: string,
58
+ measured: Numbers,
59
+ ): Promise<HopCoverageRatchet | null> {
60
+ const stated = await statedCoverage(root);
61
+ if (stated === undefined) return null;
62
+ const from = { lines: stated.floor.lines, funcs: stated.floor.funcs };
63
+ const to = {
64
+ lines: Math.max(from.lines, floorFor(measured.lines)),
65
+ funcs: Math.max(from.funcs, floorFor(measured.funcs)),
66
+ };
67
+ if (to.lines === from.lines && to.funcs === from.funcs) return null;
68
+ const { why, ...raw } = stated.payload[COVERAGE_FIELD] as Record<string, unknown>;
69
+ const cleared = to.lines >= COVERAGE_BAR && to.funcs >= COVERAGE_BAR;
70
+ const coverage = cleared ? { ...raw, ...to } : { ...raw, ...to, why };
71
+ const next = { ...stated.payload, [COVERAGE_FIELD]: coverage };
72
+ await Bun.write(join(root, VERIFY_FLOOR_FILE), `${JSON.stringify(next, null, 2)}\n`);
73
+ return { file: VERIFY_FLOOR_FILE, measured: { ...measured }, from, to };
74
+ }
75
+
76
+ /**
77
+ * The gate's verdict with `unit` replaced by its re-run. Green only when `unit` was the one red
78
+ * step, its re-run passed, and no finding sits outside every step.
79
+ */
80
+ export function rejudgedVerify(verify: Verify, unit: Verify): Verify {
81
+ const others = verify.findings.filter((finding) => finding.step !== UNIT);
82
+ const failedOthers = verify.failed.filter((name) => name !== UNIT);
83
+ const ok =
84
+ unit.ok &&
85
+ failedOthers.length === 0 &&
86
+ verify.failed.includes(UNIT) &&
87
+ others.every((finding) => finding.step !== undefined);
88
+ return {
89
+ ...verify,
90
+ ok,
91
+ summary: msg('cli.upgrade.coverageRejudged', { summary: verify.summary, unit: unit.summary }),
92
+ failed: unit.ok ? failedOthers : verify.failed,
93
+ findings: [...others, ...unit.findings],
94
+ };
95
+ }
@@ -15,6 +15,7 @@ import { LOCAL_CLI_BIN } from './local-cli';
15
15
  import type { Finding } from './output';
16
16
  import { documentIn } from './upgrade-document';
17
17
  import { manifestSnapshot, reinstallIfMoved } from './upgrade-gate-codemods-install';
18
+ import { installMergeDrivers } from './upgrade-merge-drivers';
18
19
  import type { HopCodemods } from './upgrade-report-codemods';
19
20
 
20
21
  const SKIP = t.object({ path: t.string, reason: t.string, diff: t.optional(t.string) });
@@ -106,9 +107,10 @@ export async function applyHopCodemods(input: {
106
107
  })),
107
108
  source: 'driver',
108
109
  };
109
- return (await reinstallIfMoved({ runner, root, to, before }))
110
- ? { ...report, reinstalled: true }
111
- : report;
110
+ const reinstalled = await reinstallIfMoved({ runner, root, to, before });
111
+ // After the install: the driver command runs the app's own `node_modules/.bin/x`.
112
+ await installMergeDrivers(runner, root);
113
+ return reinstalled ? { ...report, reinstalled: true } : report;
112
114
  }
113
115
 
114
116
  /**
@@ -1,7 +1,7 @@
1
1
  // A hop's gate, run by the CLI the hop just installed: codemods, manifest, doctor, missing guards,
2
- // a Bun-floor hop's coverage, exercise, verify (`upgrade-gate-codemods.ts`, `upgrade-guards.ts`).
3
- // Never in this process: the installed CLI may be majors older, so each answer is read as a
4
- // foreign document (`local-cli.ts`), and one that will not parse is never green.
2
+ // a Bun-floor hop's coverage, exercise, verify, a stale coverage floor raised (`upgrade-gate-*`,
3
+ // `upgrade-guards.ts`, `upgrade-coverage-ratchet.ts`). Never in this process: the installed CLI may
4
+ // be majors older, so each answer is a foreign document (`local-cli.ts`); unparsed is never green.
5
5
 
6
6
  // why: Bun exposes no path-join primitive; the installed bin is assembled from the app root.
7
7
  import { join } from 'node:path';
@@ -13,6 +13,13 @@ import { exerciseReportStamp } from './exercise-floor-report';
13
13
  import { LOCAL_CLI_BIN } from './local-cli';
14
14
  import type { CoverageRebaseline, HopCoverage } from './upgrade-coverage';
15
15
  import { rebaselineCoverage, statedCoverage } from './upgrade-coverage';
16
+ import type { HopCoverageRatchet } from './upgrade-coverage-ratchet';
17
+ import {
18
+ measuredUnit,
19
+ raiseCoverageFloor,
20
+ rejudgedVerify,
21
+ staleUnitFloor,
22
+ } from './upgrade-coverage-ratchet';
16
23
  import { documentIn } from './upgrade-document';
17
24
  import type { HopExerciseFloor } from './upgrade-exercise-floor';
18
25
  import { ratchetExerciseFloor } from './upgrade-exercise-floor';
@@ -21,6 +28,7 @@ import type { BaselinedGuard, WithheldGuard } from './upgrade-guards';
21
28
  import { installMissingGuards } from './upgrade-guards';
22
29
  import { parseJson } from './upgrade-registry';
23
30
  import type { HopCodemods } from './upgrade-report-codemods';
31
+ import { installedNotRun } from './upgrade-scope';
24
32
 
25
33
  // Where it always was: `verify-exercise.ts` and `verify-budgets-build.ts` read it from here.
26
34
  export { documentIn } from './upgrade-document';
@@ -139,12 +147,21 @@ export interface HopGate {
139
147
  readonly exercise: HopExercise;
140
148
  /** The exercise figures the hop wrote into `x.verify.json` as its ratchet; null when none. */
141
149
  readonly exerciseFloor: HopExerciseFloor | null;
150
+ /**
151
+ * The coverage floor raised to what the gate's `unit` run measured, on its `X_COVERAGE_FLOOR_STALE`
152
+ * — `verify` is then the verdict with `unit` re-run. Absent when nothing was raised.
153
+ */
154
+ readonly coverageRaised?: HopCoverageRatchet;
142
155
  readonly verify: {
143
156
  readonly ok: boolean;
144
157
  readonly summary: string;
145
158
  /** The steps that went red, whether or not they carried a finding. */
146
159
  readonly failed: readonly string[];
147
160
  readonly findings: readonly GateFinding[];
161
+ /** `x upgrade --only`'s list, as run; absent when the hop ran the full gate. */
162
+ readonly only?: readonly string[];
163
+ /** The gate's steps this hop did NOT run, owed elsewhere (CI); absent beside a full gate. */
164
+ readonly notRun?: readonly string[];
148
165
  };
149
166
  }
150
167
 
@@ -254,6 +271,8 @@ export async function runHopGate(input: {
254
271
  readonly bunMoved?: CoverageRebaseline;
255
272
  /** The span whose codemods run first, so every later stage judges the carried-across tree. */
256
273
  readonly codemods?: { readonly from: string; readonly to: string };
274
+ /** `x upgrade --only`: verify narrowed to these steps, a strict subset of the gate's. */
275
+ readonly only?: { readonly steps: readonly string[]; readonly notRun: readonly string[] };
257
276
  }): Promise<HopGate> {
258
277
  const { runner, root, onStage } = input;
259
278
  const installed = (args: readonly string[]): Promise<ExecResult> =>
@@ -294,7 +313,25 @@ export async function runHopGate(input: {
294
313
  // Before `verify`, from the report that exercise just wrote: the gate judges the figures it holds.
295
314
  const exerciseFloor = await ratchetExerciseFloor(root, stamp);
296
315
  onStage('verify');
297
- const verify = readVerify(await installed(['verify', '--json']));
316
+ const { only } = input;
317
+ // The installed gate's own list first: the steps owed to CI are steps that CLI has. None owed
318
+ // (every one of its steps named) is that CLI's full gate, run and reported as one.
319
+ const notRun = only === undefined ? undefined : await installedNotRun(installed, only);
320
+ const full = only === undefined || notRun === undefined || notRun.length === 0;
321
+ const ran = await installed(
322
+ full ? ['verify', '--json'] : ['verify', '--only', only.steps.join(','), '--json'],
323
+ );
324
+ let verify: HopGate['verify'] = full
325
+ ? readVerify(ran)
326
+ : { ...readVerify(ran), only: only.steps, notRun };
327
+ let coverageRaised: HopCoverageRatchet | null = null;
328
+ const measured = staleUnitFloor(verify) ? measuredUnit(ran.stdout) : undefined;
329
+ if (measured !== undefined) coverageRaised = await raiseCoverageFloor(root, measured);
330
+ if (coverageRaised !== null) {
331
+ onStage('coverage');
332
+ const unit = readVerify(await installed(['verify', '--only', 'unit', '--json']));
333
+ verify = rejudgedVerify(verify, unit);
334
+ }
298
335
  return {
299
336
  codemods,
300
337
  superseded,
@@ -304,6 +341,7 @@ export async function runHopGate(input: {
304
341
  coverage,
305
342
  exercise,
306
343
  exerciseFloor,
344
+ ...(coverageRaised === null ? {} : { coverageRaised }),
307
345
  verify,
308
346
  };
309
347
  }
@@ -0,0 +1,25 @@
1
+ // After a hop's codemods: the merge drivers its `.gitattributes` names, installed in this clone as
2
+ // `bun run setup` would, so an upgrade leaves no `X_MERGE_DRIVER_UNSET` for a person to act on.
3
+
4
+ // why: Bun exposes no path-join primitive.
5
+ import { join } from 'node:path';
6
+ import type { Runner } from './exec';
7
+ import { LOCAL_CLI_BIN } from './local-cli';
8
+ import { driverUnset } from './merge-driver-config';
9
+
10
+ /**
11
+ * Through the installed CLI, which the hop just installed and which has the subcommand. True when
12
+ * it ran and succeeded; a failure is not thrown, because `x doctor` reports the same unset driver
13
+ * as a warning with its fix, beside the hop's verdict.
14
+ */
15
+ export async function installMergeDrivers(runner: Runner, root: string): Promise<boolean> {
16
+ if (!(await driverUnset(root, runner))) return false;
17
+ const command = [
18
+ process.execPath,
19
+ join(root, LOCAL_CLI_BIN),
20
+ 'merge-driver',
21
+ 'install',
22
+ '--json',
23
+ ];
24
+ return (await runner(command, { cwd: root })).ok;
25
+ }