@ultimat3/cli 31.48.0 → 31.49.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 (260) hide show
  1. package/CLAUDE.md +30 -23
  2. package/README.md +96 -4
  3. package/package.json +29 -29
  4. package/src/api-registration.ts +28 -14
  5. package/src/app-load.ts +6 -1
  6. package/src/app-root.ts +7 -1
  7. package/src/clean-services.ts +142 -0
  8. package/src/cmd-auth.ts +3 -0
  9. package/src/cmd-clean-spec.ts +10 -3
  10. package/src/cmd-clean.ts +23 -9
  11. package/src/cmd-db-backfill.ts +6 -0
  12. package/src/cmd-db-branch.ts +10 -4
  13. package/src/cmd-db-recount.ts +5 -12
  14. package/src/cmd-db-rollback.ts +77 -0
  15. package/src/cmd-db-spec.ts +18 -2
  16. package/src/cmd-db-status.ts +5 -10
  17. package/src/cmd-db.ts +105 -33
  18. package/src/cmd-deploy-verify.ts +14 -6
  19. package/src/cmd-docs-topic.ts +94 -0
  20. package/src/cmd-docs.ts +15 -1
  21. package/src/cmd-doctor.ts +109 -41
  22. package/src/cmd-drill.ts +80 -18
  23. package/src/cmd-env.ts +30 -8
  24. package/src/cmd-errors-app.ts +63 -0
  25. package/src/cmd-errors.ts +50 -14
  26. package/src/cmd-generate.ts +17 -4
  27. package/src/cmd-heavy-spec.ts +9 -1
  28. package/src/cmd-heavy.ts +111 -27
  29. package/src/cmd-jobs.ts +27 -1
  30. package/src/cmd-merge-driver-spec.ts +12 -0
  31. package/src/cmd-merge-driver.ts +95 -0
  32. package/src/cmd-new.ts +23 -3
  33. package/src/cmd-policy-spec.ts +9 -1
  34. package/src/cmd-policy.ts +72 -17
  35. package/src/cmd-stop.ts +18 -4
  36. package/src/cmd-tasks-run.ts +87 -0
  37. package/src/cmd-tasks-spec.ts +10 -3
  38. package/src/cmd-tasks.ts +8 -5
  39. package/src/cmd-test.ts +2 -1
  40. package/src/cmd-upgrade-spec.ts +8 -1
  41. package/src/cmd-upgrade.ts +15 -1
  42. package/src/cmd-verify.ts +9 -41
  43. package/src/codemods/agents-doc-row.ts +73 -0
  44. package/src/codemods/define-error-leaf.ts +37 -12
  45. package/src/codemods/docs-many-agents.ts +11 -15
  46. package/src/codemods/docs-worker-commands.ts +26 -0
  47. package/src/codemods/index.ts +4 -0
  48. package/src/codemods/merge-drivers.ts +66 -0
  49. package/src/command.ts +3 -0
  50. package/src/db-applied-edits.ts +117 -0
  51. package/src/db-dev-wire.ts +18 -0
  52. package/src/db-diagnostics.ts +5 -10
  53. package/src/db-generate.ts +82 -7
  54. package/src/db-migrate-pass.ts +51 -0
  55. package/src/db-migrate-through-dev.ts +209 -0
  56. package/src/db-rollback-consent.ts +128 -0
  57. package/src/db-rollback-pass.ts +76 -0
  58. package/src/db-seed-generate.ts +5 -1
  59. package/src/db-seed.ts +7 -1
  60. package/src/deploy-verify-findings.ts +3 -0
  61. package/src/deploy-verify-grade.ts +3 -0
  62. package/src/deploy-verify-processes.ts +32 -0
  63. package/src/dev-boot.ts +3 -0
  64. package/src/dev-db-migrate.ts +155 -0
  65. package/src/dev-db-rollback.ts +33 -0
  66. package/src/dev-db-settled.ts +22 -0
  67. package/src/dev-lock-errors.ts +78 -0
  68. package/src/dev-lock-holder-dir.ts +64 -0
  69. package/src/dev-lock-live.ts +44 -0
  70. package/src/dev-lock.ts +59 -84
  71. package/src/dev-policy.ts +11 -8
  72. package/src/dev-rebuild-schema.ts +116 -13
  73. package/src/dev-rebuild.ts +13 -4
  74. package/src/dev-route-table.ts +7 -0
  75. package/src/dispatch.ts +21 -1
  76. package/src/doctor-api-listing.ts +114 -0
  77. package/src/doctor-guarded.ts +41 -0
  78. package/src/doctor-port.ts +90 -17
  79. package/src/doctor-probe.ts +36 -5
  80. package/src/doctor-processes-probe.ts +127 -0
  81. package/src/doctor-processes.ts +136 -0
  82. package/src/doctor-warnings.ts +17 -0
  83. package/src/error-codes-agents.ts +35 -0
  84. package/src/error-codes-processes.ts +30 -0
  85. package/src/error-codes-tooling.ts +2 -0
  86. package/src/error-codes.ts +12 -13
  87. package/src/errors-suite.ts +27 -0
  88. package/src/errors.ts +18 -22
  89. package/src/exercise-registration.ts +4 -3
  90. package/src/framework-env.ts +7 -3
  91. package/src/generate-files.ts +1 -0
  92. package/src/generate-grant-findings.ts +7 -5
  93. package/src/generate-grants.ts +9 -8
  94. package/src/generate-kinds.ts +30 -6
  95. package/src/generate-roles-file.ts +30 -0
  96. package/src/generate-slice-policy.ts +3 -3
  97. package/src/guards.ts +2 -2
  98. package/src/heavy-env.ts +2 -0
  99. package/src/heavy-errors.ts +18 -0
  100. package/src/heavy-holders.ts +78 -0
  101. package/src/heavy-ledger.ts +56 -14
  102. package/src/heavy-pressure.ts +104 -0
  103. package/src/heavy.ts +31 -13
  104. package/src/i18n-registration.ts +22 -2
  105. package/src/island-harness.ts +2 -2
  106. package/src/job-budget.ts +4 -2
  107. package/src/job-registration.ts +64 -8
  108. package/src/jobs-queue-known.ts +43 -0
  109. package/src/mcp-errors-agents.ts +20 -0
  110. package/src/mcp-errors-doctor.ts +27 -0
  111. package/src/mcp-errors-processes.ts +23 -0
  112. package/src/mcp-errors.ts +15 -29
  113. package/src/mcp-host.ts +2 -2
  114. package/src/merge-driver-catalog.ts +58 -0
  115. package/src/merge-driver-config.ts +43 -0
  116. package/src/merge-driver-lines.ts +140 -0
  117. package/src/merge-state.ts +105 -0
  118. package/src/messages-db.ts +22 -1
  119. package/src/messages-processes.ts +13 -0
  120. package/src/messages-upgrade.ts +6 -0
  121. package/src/messages.ts +54 -4
  122. package/src/output-findings.ts +48 -21
  123. package/src/parse.ts +37 -6
  124. package/src/policy-facts.ts +38 -21
  125. package/src/policy-row.ts +99 -0
  126. package/src/port-pair-free.ts +28 -0
  127. package/src/registry-lines.ts +110 -0
  128. package/src/registry.ts +2 -0
  129. package/src/retain-sweep.ts +1 -1
  130. package/src/role-replicator.ts +4 -1
  131. package/src/role-select.ts +86 -0
  132. package/src/role-start.ts +13 -55
  133. package/src/role-sync.ts +10 -5
  134. package/src/runtime-cache-frame.ts +46 -0
  135. package/src/runtime-cache-ttl.ts +23 -0
  136. package/src/runtime-cache.ts +33 -16
  137. package/src/runtime-database-ssl.ts +84 -0
  138. package/src/runtime-idempotency-scope.ts +16 -2
  139. package/src/runtime-jobs-share.ts +52 -0
  140. package/src/runtime-jobs.ts +43 -12
  141. package/src/runtime-queue.ts +18 -3
  142. package/src/runtime-services.ts +8 -1
  143. package/src/schema-drift.ts +19 -2
  144. package/src/schema-dump-drift.ts +4 -1
  145. package/src/serve-boot-probe.ts +30 -2
  146. package/src/serve-boot.ts +11 -1
  147. package/src/serve-env.ts +39 -3
  148. package/src/serve.ts +61 -10
  149. package/src/stop-run-start.ts +12 -0
  150. package/src/supervise-boot.ts +61 -0
  151. package/src/supervise-cgroup.ts +84 -0
  152. package/src/supervise-child.ts +206 -0
  153. package/src/supervise-count.ts +244 -0
  154. package/src/supervise-errors.ts +83 -0
  155. package/src/supervise-facts.ts +40 -0
  156. package/src/supervise-messages.ts +84 -0
  157. package/src/supervise-policy.ts +46 -0
  158. package/src/supervise-pool.ts +10 -0
  159. package/src/supervise-probe.ts +158 -0
  160. package/src/supervise-run.ts +54 -0
  161. package/src/supervise.ts +383 -0
  162. package/src/templates/generate-purge.ts +6 -6
  163. package/src/templates/guard-animated-layout-property.ts +2 -2
  164. package/src/templates/guard-bare-error.ts +1 -1
  165. package/src/templates/guard-error-declared.ts +2 -2
  166. package/src/templates/guard-focus-visible.ts +1 -1
  167. package/src/templates/guard-image-dimensions.ts +2 -2
  168. package/src/templates/guard-island-mount-clears.ts +1 -1
  169. package/src/templates/guard-native-confirm.ts +1 -1
  170. package/src/templates/guard-raw-breakpoint.ts +2 -2
  171. package/src/templates/guard-raw-colour.ts +2 -2
  172. package/src/templates/guard-raw-fetch.ts +1 -1
  173. package/src/templates/guard-raw-interval.ts +1 -1
  174. package/src/templates/guard-raw-length.ts +3 -3
  175. package/src/templates/guard-raw-motion.ts +1 -1
  176. package/src/templates/guard-raw-shadow.ts +1 -1
  177. package/src/templates/guard-raw-z-index.ts +1 -1
  178. package/src/templates/guard-released-forms.ts +54 -8
  179. package/src/templates/guard-repo-await-in-loop.ts +1 -1
  180. package/src/templates/guard-repo-raw-sql.ts +4 -4
  181. package/src/templates/guard-repo-unbounded.ts +1 -1
  182. package/src/templates/guard-runtime-pin.ts +1 -1
  183. package/src/templates/guard-semantic-interactive.ts +2 -2
  184. package/src/templates/guard-unbounded-fanout.ts +1 -1
  185. package/src/templates/guard-undeclared-custom-property.ts +3 -3
  186. package/src/templates/guard-undefined-style-class.ts +3 -3
  187. package/src/templates/guard-unzoned-date.ts +3 -3
  188. package/src/templates/query-slice.ts +82 -0
  189. package/src/templates/query.ts +76 -30
  190. package/src/templates/resource-page.ts +3 -2
  191. package/src/templates/scaffold-bin.ts +2 -0
  192. package/src/templates/scaffold-claude-commands.ts +6 -0
  193. package/src/templates/scaffold-claude.ts +4 -4
  194. package/src/templates/scaffold-container-compose.ts +47 -7
  195. package/src/templates/scaffold-docs.ts +7 -3
  196. package/src/templates/scaffold-gitattributes.ts +18 -1
  197. package/src/templates/scaffold-helm-templates.ts +9 -0
  198. package/src/templates/scaffold-repo.ts +4 -1
  199. package/src/templates/scaffold-test-services.ts +33 -11
  200. package/src/templates/shapes/offline.ts +0 -7
  201. package/src/templates/shapes/realtime.ts +2 -6
  202. package/src/templates/sign-in-action-tests.ts +6 -4
  203. package/src/templates/sign-in-challenge.ts +62 -0
  204. package/src/templates/sign-in-oidc-mfa.ts +31 -0
  205. package/src/templates/sign-in-oidc.ts +11 -3
  206. package/src/templates/sign-in-password.ts +18 -56
  207. package/src/test-shards.ts +114 -34
  208. package/src/test-verdict.ts +79 -0
  209. package/src/test-workers.ts +15 -0
  210. package/src/upgrade-gate-codemods.ts +5 -3
  211. package/src/upgrade-gate.ts +19 -1
  212. package/src/upgrade-merge-drivers.ts +25 -0
  213. package/src/upgrade-report.ts +18 -4
  214. package/src/upgrade-scope.ts +62 -0
  215. package/src/verify-checks.ts +2 -8
  216. package/src/verify-coverage-run.ts +4 -1
  217. package/src/verify-live.ts +38 -14
  218. package/src/verify-only.ts +67 -0
  219. package/src/verify-progress.ts +7 -3
  220. package/src/verify-run.ts +20 -2
  221. package/src/verify-services-stack.ts +165 -0
  222. package/src/verify-services.ts +84 -2
  223. package/src/verify-test-run.ts +6 -7
  224. package/src/verify-tests.ts +8 -2
  225. package/src/verify-typecheck.ts +25 -2
  226. package/wiki/Actions.md +2 -1
  227. package/wiki/Admin-Dashboard.md +2 -2
  228. package/wiki/Agents.md +5 -5
  229. package/wiki/Auth.md +15 -5
  230. package/wiki/Bare-VM.md +1 -1
  231. package/wiki/CI-Parallel-Gate.md +2 -1
  232. package/wiki/CLI-Reference.md +107 -40
  233. package/wiki/Caching-And-Invalidation.md +1 -1
  234. package/wiki/Client-Navigation.md +1 -1
  235. package/wiki/Configuration.md +10 -9
  236. package/wiki/Deployment.md +44 -4
  237. package/wiki/Entities-And-Migrations.md +5 -1
  238. package/wiki/FAQ.md +1 -1
  239. package/wiki/Getting-Started.md +2 -2
  240. package/wiki/Home.md +1 -1
  241. package/wiki/I18n.md +5 -3
  242. package/wiki/Installation.md +12 -11
  243. package/wiki/Jobs-And-Workflows.md +24 -4
  244. package/wiki/Known-Gaps.md +1 -1
  245. package/wiki/MCP-And-AI.md +8 -5
  246. package/wiki/Many-Agents.md +69 -2
  247. package/wiki/Migrations-And-Backfills.md +18 -0
  248. package/wiki/Notify.md +1 -1
  249. package/wiki/Observability.md +13 -0
  250. package/wiki/Queries-And-Live-Queries.md +2 -2
  251. package/wiki/Realtime.md +10 -1
  252. package/wiki/Routes-And-Render-Modes.md +1 -1
  253. package/wiki/Scheduled-Tasks.md +4 -1
  254. package/wiki/Testing.md +7 -4
  255. package/wiki/Timezones-And-Dates.md +5 -1
  256. package/wiki/Troubleshooting.md +1 -0
  257. package/wiki/Tutorial-01-First-App.md +3 -3
  258. package/wiki/Tutorial-02-First-Feature.md +1 -1
  259. package/wiki/Tutorial-03-Auth-And-Admin.md +7 -6
  260. package/wiki/Upgrading.md +37 -0
@@ -3,7 +3,6 @@
3
3
  // realtime's outbox, `createPost` safe to replay, both proven offline in a real browser, and the
4
4
  // README's recipe for a phone on the LAN (`x dev --host <address> --tls`).
5
5
 
6
- import { loadVersion } from '../../version-loader';
7
6
  import { catalogJson } from '../catalog-json';
8
7
  import { catalogPath } from '../locales';
9
8
  import type { GeneratedFile, NameSet } from '../naming';
@@ -86,12 +85,6 @@ const edits = (): readonly ShapeEdit[] => [
86
85
  replace:
87
86
  ' cache: { invalidates: [postTag] },\n // The outbox replays a write whose answer was lost under the SAME Idempotency-Key: this is what\n // makes that replay answer the first result instead of inserting a second post.\n idempotent: true,\n',
88
87
  },
89
- // The form imports `@ultimat3/realtime`; an isolated install resolves only what the app declares.
90
- {
91
- path: 'package.json',
92
- find: ' "@ultimat3/render": ',
93
- replace: ` "@ultimat3/realtime": "${loadVersion()}",\n "@ultimat3/render": `,
94
- },
95
88
  { path: 'README.md', find: README_LAYOUT, replace: `${lan()}${README_LAYOUT}` },
96
89
  ...shapeLines(
97
90
  'offline',
@@ -132,17 +132,13 @@ import * as recentPosts from '../app/post/queries/recent-posts';
132
132
  find: ' },\n});\n',
133
133
  replace: ` },\n${exerciseEntry('renamePost', 'post:write')}${exerciseEntry('recentPosts', 'post:read')}});\n`,
134
134
  },
135
- // The room and the notifier import both; an isolated install resolves only what the app declares.
135
+ // The notifier imports `@ultimat3/notify`; an isolated install resolves only what the app declares
136
+ // (`@ultimat3/realtime` is every scaffold's own dependency).
136
137
  {
137
138
  path: 'package.json',
138
139
  find: ' "@ultimat3/policy": ',
139
140
  replace: ` "@ultimat3/notify": "${loadVersion()}",\n "@ultimat3/policy": `,
140
141
  },
141
- {
142
- path: 'package.json',
143
- find: ' "@ultimat3/render": ',
144
- replace: ` "@ultimat3/realtime": "${loadVersion()}",\n "@ultimat3/render": `,
145
- },
146
142
  ...shapeLines(
147
143
  'realtime',
148
144
  "multi-user live state across nodes — a notifier tells the org's room (`apps/web/app/post/channels.ts`) of each new post over the bus; two `sync` nodes in `apps/web/app/post/channels.live.test.ts`",
@@ -77,9 +77,9 @@ export const createSessionTest =
77
77
  (): string => `// createSession, run inside a real request over the app's migrated database: a wrong password is
78
78
  // refused, a right one sets the session cookie, and a second factor still owed holds the challenge.
79
79
  import { toRoute } from '@ultimat3/action';
80
- import { generateTotpSecret, register, saveTotpSecret } from '@ultimat3/auth';
80
+ import { generateTotpSecret, MFA_CHALLENGE_COOKIE, register, saveTotpSecret } from '@ultimat3/auth';
81
81
  ${SHARED_IMPORTS}
82
- import { MFA_CHALLENGE_COOKIE, SECOND_FACTOR_PATH } from '../sign-in-challenge';
82
+ import { SECOND_FACTOR_PATH } from '../sign-in-challenge';
83
83
  import { AFTER_SIGN_IN } from '../sign-in-flow';
84
84
  import { createSession } from './create-session';
85
85
 
@@ -149,17 +149,19 @@ unitTest('a second factor still owed holds the challenge and sets no session', a
149
149
  export const confirmSessionTest =
150
150
  (): string => `// confirmSession, run inside a real request over the app's migrated database: with no challenge
151
151
  // held it refuses, a wrong code is refused, and the held challenge plus the right code signs in.
152
+ // The challenge and its cookie's name are auth's, whichever shape's first leg held it.
152
153
  import { toRoute } from '@ultimat3/action';
153
154
  import {
154
155
  generateTotpSecret,
155
156
  login,
157
+ MFA_CHALLENGE_COOKIE,
158
+ mfaChallengeOf,
156
159
  register,
157
160
  saveTotpSecret,
158
161
  totpCode,
159
162
  totpStep,
160
163
  } from '@ultimat3/auth';
161
164
  ${SHARED_IMPORTS}
162
- import { challengeOf, MFA_CHALLENGE_COOKIE } from '../sign-in-challenge';
163
165
  import { confirmSession } from './confirm-session';
164
166
 
165
167
  ${DATABASE}
@@ -184,7 +186,7 @@ const challenged = async (email: string) => {
184
186
  const secret = generateTotpSecret();
185
187
  await saveTotpSecret(appAuth(), user.id, secret);
186
188
  const first = await login(appAuth(), { email, password: PASSWORD }).catch((e: unknown) => e);
187
- const challenge = challengeOf(first);
189
+ const challenge = mfaChallengeOf(first);
188
190
  expect(challenge).not.toBeNull();
189
191
  return { secret, cookie: \`\${MFA_CHALLENGE_COOKIE}=\${challenge}\` };
190
192
  };
@@ -0,0 +1,62 @@
1
+ // `sign-in-challenge.ts` as both `x g sign-in` shapes write it: the second-factor challenge rides
2
+ // auth's ONE cookie (`__Host-x_mfa`), written, read and cleared through `@ultimat3/auth`. The
3
+ // password shape also holds it (its own first leg); OIDC's is held by `oauthLogin({ mfaPath })`.
4
+
5
+ import { SIGN_IN_PATH } from './sign-in-shared';
6
+
7
+ const HEADER: Readonly<Record<'password' | 'oidc', string>> = {
8
+ password: `// The second-factor challenge between the two legs: a sealed, five-minute credential \`login()\`
9
+ // hands back inside \`X_MFA_REQUIRED\`, carried in auth's own HttpOnly cookie — never a URL a log
10
+ // keeps — and read back by \`confirmSession\` through here.`,
11
+ oidc: `// The second-factor challenge between the provider's callback and the code. \`oauthLogin({ mfaPath })\`
12
+ // sends an enrolled user to SECOND_FACTOR_PATH with it sealed in auth's own HttpOnly cookie — never
13
+ // a URL a log keeps — and \`confirmSession\` reads it back through here.`,
14
+ };
15
+
16
+ const PATH_DOC: Readonly<Record<'password' | 'oidc', string>> = {
17
+ password:
18
+ '/** Where `createSession` sends a person who owes a code, and the page that posts it. */',
19
+ oidc: '/** The `mfaPath` `oidc.ts` hands `oauthLogin`, and the page that posts the code. */',
20
+ };
21
+
22
+ const HOLD = `
23
+ /** Auth's own line: the cookie a built-in callback sets, living as long as the challenge. */
24
+ export const holdChallenge = (challenge: string): void => {
25
+ useRequestContext('holdChallenge').headers.append('set-cookie', mfaChallengeCookie(challenge));
26
+ };
27
+ `;
28
+
29
+ export const challengeSource = (shape: 'password' | 'oidc'): string => {
30
+ const names = [
31
+ 'clearMfaChallengeCookie',
32
+ ...(shape === 'password' ? ['mfaChallengeCookie'] : []),
33
+ 'readMfaChallenge',
34
+ ];
35
+ return `${HEADER[shape]}
36
+ import { ${names.join(', ')} } from '@ultimat3/auth';
37
+ import { useRequestContext, useRequestHeaders } from '@ultimat3/http';
38
+
39
+ ${PATH_DOC[shape]}
40
+ export const SECOND_FACTOR_PATH = '${SIGN_IN_PATH}/second-factor';
41
+ ${shape === 'password' ? HOLD : ''}
42
+ export const heldChallenge = (): string | null => {
43
+ const value = readMfaChallenge({ headers: useRequestHeaders() });
44
+ return value === null || value === '' ? null : value;
45
+ };
46
+
47
+ /** Auth's own clearing line, relayed as it is: the cookie's name and attributes are auth's. */
48
+ export const dropChallenge = (): void => {
49
+ useRequestContext('dropChallenge').headers.append('set-cookie', clearMfaChallengeCookie());
50
+ };
51
+ `;
52
+ };
53
+
54
+ export const challengeTest =
55
+ (): string => `// The path the second leg lives at is the page this app serves the second-factor form at.
56
+ import { expect, unitTest } from '@ultimat3/testing';
57
+ import { SECOND_FACTOR_PATH } from './sign-in-challenge';
58
+
59
+ unitTest('the second leg lives under the sign-in page', () => {
60
+ expect(SECOND_FACTOR_PATH).toBe('${SIGN_IN_PATH}/second-factor');
61
+ });
62
+ `;
@@ -0,0 +1,31 @@
1
+ // `x g sign-in --oidc`'s second leg. An MFA-enrolled user's callback cannot finish inside
2
+ // `oauthLogin`: it 303s to `mfaPath` with the challenge sealed in auth's own HttpOnly cookie, so the
3
+ // scaffold passes that path and ships the page and the action behind it (auth README, MFA).
4
+
5
+ import type { GeneratedFile } from './naming';
6
+ import { confirmSessionTest } from './sign-in-action-tests';
7
+ import { challengeSource, challengeTest } from './sign-in-challenge';
8
+ import { secondFactorSource, signInPageTest } from './sign-in-pages';
9
+ import { confirmSessionSource, POSTS_AT } from './sign-in-password';
10
+ import { AUTH_DIR } from './sign-in-shared';
11
+
12
+ /** The `import` and the option `oidc.ts` gains: the callback's way to the second-factor page. */
13
+ export const OIDC_MFA_IMPORT = "import { SECOND_FACTOR_PATH } from './sign-in-challenge';";
14
+ export const OIDC_MFA_OPTION = 'mfaPath: SECOND_FACTOR_PATH,';
15
+
16
+ export function oidcSecondFactorFiles(module: string | undefined): readonly GeneratedFile[] {
17
+ return [
18
+ { path: `${AUTH_DIR}/sign-in-challenge.ts`, contents: challengeSource('oidc') },
19
+ { path: `${AUTH_DIR}/sign-in-challenge.test.ts`, contents: challengeTest() },
20
+ { path: `${AUTH_DIR}/actions/confirm-session.ts`, contents: confirmSessionSource() },
21
+ {
22
+ path: `${AUTH_DIR}/actions/confirm-session.test.ts`,
23
+ contents: confirmSessionTest(),
24
+ },
25
+ { path: `${AUTH_DIR}/sign-in/second-factor/page.tsx`, contents: secondFactorSource(module) },
26
+ {
27
+ path: `${AUTH_DIR}/sign-in/second-factor/page.test.ts`,
28
+ contents: signInPageTest(module, 'app.auth.secondFactor', POSTS_AT('confirmSession'), false),
29
+ },
30
+ ];
31
+ }
@@ -1,13 +1,14 @@
1
1
  // `x g sign-in --oidc <provider>`: an OpenID Connect issuer, discovered when the first sign-in
2
- // arrives (`discoverOAuthProvider`), its two legs (`oauthLogin`) mounted on `runtime.routes`, and
3
- // the page that links to the first one. PKCE, the sealed handshake, the state check and the account
4
- // link are the framework's; which IdP group means which role stays the app's (`resolveGrants`).
2
+ // arrives, its two legs (`oauthLogin`) mounted on `runtime.routes`, and the page linking the first.
3
+ // PKCE, the sealed handshake and the account link are the framework's; which IdP group means which
4
+ // role stays the app's (`resolveGrants`). The second factor's leg is `sign-in-oidc-mfa.ts`'s.
5
5
 
6
6
  // The literal the generated tests pin comes from auth itself, so the scaffold cannot drift from it.
7
7
  import { oauthStartPath } from '@ultimat3/auth';
8
8
  import { catalogJson } from './catalog-json';
9
9
  import { catalogPath } from './locales';
10
10
  import type { GeneratedFile } from './naming';
11
+ import { OIDC_MFA_IMPORT, OIDC_MFA_OPTION, oidcSecondFactorFiles } from './sign-in-oidc-mfa';
11
12
  import {
12
13
  SIGN_IN_CATALOG,
13
14
  type SignInForm,
@@ -15,6 +16,7 @@ import {
15
16
  signInPageSource,
16
17
  signInPageTest,
17
18
  } from './sign-in-pages';
19
+ import { SECOND_FACTOR_CATALOG } from './sign-in-password';
18
20
  import { OIDC_RUNTIME_ROUTES } from './sign-in-runtime';
19
21
  import { AUTH_DIR, sharedSignInFiles } from './sign-in-shared';
20
22
 
@@ -54,6 +56,7 @@ import {
54
56
  registerOAuthProvider,
55
57
  } from '@ultimat3/auth';
56
58
  import { appAuth } from './auth';
59
+ ${OIDC_MFA_IMPORT}
57
60
  import { AFTER_SIGN_IN } from './sign-in-flow';
58
61
 
59
62
  export const OIDC_PROVIDER = '${provider}';
@@ -89,6 +92,9 @@ export const oidcLegs = (env: Env = process.env): Promise<OAuthLoginRoutes> => {
89
92
  return oauthLogin(signInAuth(), {
90
93
  successPath: AFTER_SIGN_IN,
91
94
  callbackPath: OIDC_CALLBACK_PATH,
95
+ // An MFA-enrolled user finishes on this app's second-factor page; without it their
96
+ // callback is a 401 they can never get past.
97
+ ${OIDC_MFA_OPTION}
92
98
  });
93
99
  })().catch((error: unknown) => {
94
100
  legs = undefined;
@@ -192,11 +198,13 @@ export function oidcSignInFiles(
192
198
  path: `${AUTH_DIR}/sign-in/page.test.ts`,
193
199
  contents: signInPageTest(module, 'app.auth.signIn', `'href="${oauthStartPath(provider)}"'`),
194
200
  },
201
+ ...oidcSecondFactorFiles(module),
195
202
  ...options.locales.map((locale) => ({
196
203
  path: catalogPath(locale),
197
204
  contents: catalogJson({
198
205
  ...SIGN_IN_CATALOG,
199
206
  'app.auth.signIn.continue': `Continue with ${provider}`,
207
+ ...SECOND_FACTOR_CATALOG,
200
208
  }),
201
209
  merge: 'json' as const,
202
210
  })),
@@ -6,6 +6,7 @@ import { catalogJson } from './catalog-json';
6
6
  import { catalogPath } from './locales';
7
7
  import type { GeneratedFile } from './naming';
8
8
  import { confirmSessionTest, createSessionTest } from './sign-in-action-tests';
9
+ import { challengeSource, challengeTest } from './sign-in-challenge';
9
10
  import {
10
11
  SIGN_IN_CATALOG,
11
12
  type SignInForm,
@@ -14,66 +15,21 @@ import {
14
15
  signInPageSource,
15
16
  signInPageTest,
16
17
  } from './sign-in-pages';
17
- import { AUTH_DIR, SIGN_IN_PATH, sharedSignInFiles } from './sign-in-shared';
18
+ import { AUTH_DIR, sharedSignInFiles } from './sign-in-shared';
18
19
 
19
20
  /** The master key seals the second-factor challenge between the two legs. */
20
21
  export const PASSWORD_SIGN_IN_ENV: readonly string[] = ['ULTIMATE_SECRETS_KEY'];
21
22
 
22
- const challengeSource =
23
- (): string => `// The second-factor challenge between the two legs: a sealed, five-minute credential \`login()\`
24
- // hands back inside \`X_MFA_REQUIRED\`, carried in an HttpOnly cookie rather than a URL a log keeps.
25
- import { MFA_CHALLENGE_TTL_MS } from '@ultimat3/auth';
26
- import { isUltimateError } from '@ultimat3/core';
27
- import { deleteCookie, setCookie, useRequestCookie } from '@ultimat3/http';
28
-
29
- export const MFA_CHALLENGE_COOKIE = 'x_mfa_challenge';
30
- export const SECOND_FACTOR_PATH = '${SIGN_IN_PATH}/second-factor';
31
-
32
- /** The sealed challenge an \`X_MFA_REQUIRED\` carries, or \`null\` for any other throw. */
33
- export const challengeOf = (error: unknown): string | null => {
34
- if (!isUltimateError(error) || error.code !== 'X_MFA_REQUIRED') return null;
35
- const challenge = error.meta?.['challenge'];
36
- return typeof challenge === 'string' && challenge !== '' ? challenge : null;
37
- };
38
-
39
- export const holdChallenge = (challenge: string): void =>
40
- setCookie(MFA_CHALLENGE_COOKIE, challenge, { maxAge: Math.floor(MFA_CHALLENGE_TTL_MS / 1000) });
41
-
42
- export const heldChallenge = (): string | null => {
43
- const value = useRequestCookie(MFA_CHALLENGE_COOKIE);
44
- return value === null || value === '' ? null : value;
45
- };
46
-
47
- export const dropChallenge = (): void => deleteCookie(MFA_CHALLENGE_COOKIE);
48
- `;
49
-
50
- const challengeTest =
51
- (): string => `// Only an X_MFA_REQUIRED carrying a challenge is a second leg; every other throw is not.
52
- import { UltimateError } from '@ultimat3/core';
53
- import { expect, unitTest } from '@ultimat3/testing';
54
- import { challengeOf } from './sign-in-challenge';
55
-
56
- const coded = (code: string, meta?: Record<string, unknown>) =>
57
- new UltimateError({ code, cause: 'a test throw', fix: 'none', ...(meta ? { meta } : {}) });
58
-
59
- unitTest('a sealed challenge is read off X_MFA_REQUIRED, and nothing else is one', () => {
60
- expect(challengeOf(coded('X_MFA_REQUIRED', { challenge: 'sealed' }))).toBe('sealed');
61
- expect(challengeOf(coded('X_MFA_REQUIRED'))).toBeNull();
62
- expect(challengeOf(coded('X_UNAUTHENTICATED', { challenge: 'sealed' }))).toBeNull();
63
- expect(challengeOf('X_MFA_REQUIRED')).toBeNull();
64
- });
65
- `;
66
-
67
23
  const createSessionSource =
68
24
  (): string => `// Sign in with an address and a password. \`login()\` is the whole check — the hash, the lockout and
69
25
  // one indistinguishable \`X_UNAUTHENTICATED\` for every way a credential is wrong. A second factor
70
26
  // still owed stops here with the sealed challenge held for the next page.
71
27
  import { action, t } from '@ultimat3/action';
72
- import { login } from '@ultimat3/auth';
28
+ import { login, mfaChallengeOf } from '@ultimat3/auth';
73
29
  import { useRequestContext } from '@ultimat3/http';
74
30
  import { allow } from '@ultimat3/policy';
75
31
  import { appAuth } from '../auth';
76
- import { challengeOf, holdChallenge, SECOND_FACTOR_PATH } from '../sign-in-challenge';
32
+ import { holdChallenge, SECOND_FACTOR_PATH } from '../sign-in-challenge';
77
33
  import { NEXT_PARAM, nextPath } from '../sign-in-flow';
78
34
 
79
35
  export const createSession = action({
@@ -99,7 +55,7 @@ export const createSession = action({
99
55
  request.headers.append('set-cookie', signedIn.cookie);
100
56
  return { ok: true, next: nextPath(input[NEXT_PARAM]), secondFactor: false };
101
57
  } catch (error) {
102
- const challenge = challengeOf(error);
58
+ const challenge = mfaChallengeOf(error);
103
59
  if (challenge === null) throw error;
104
60
  holdChallenge(challenge);
105
61
  // The way on survives the second leg: its form posts \`next\` back to \`confirmSession\`.
@@ -114,7 +70,8 @@ export const createSession = action({
114
70
  });
115
71
  `;
116
72
 
117
- const confirmSessionSource =
73
+ /** Both shapes' second leg: it reads the challenge through `../sign-in-challenge`, whoever held it. */
74
+ export const confirmSessionSource =
118
75
  (): string => `// The second leg: the six digits (or one recovery code) against the challenge the first leg held.
119
76
  // \`completeMfa()\` meters the guess against the same lockout a password guess spends.
120
77
  import { action, t } from '@ultimat3/action';
@@ -168,19 +125,24 @@ const PASSWORD_FORM: SignInForm = {
168
125
  </form>`,
169
126
  };
170
127
 
128
+ /** The second-factor page's copy, for whichever shape reaches it. */
129
+ export const SECOND_FACTOR_CATALOG: Readonly<Record<string, string>> = {
130
+ 'app.auth.secondFactor.title': 'Second factor',
131
+ 'app.auth.secondFactor.description': 'Enter the code from your authenticator app.',
132
+ 'app.auth.secondFactor.code': 'Code',
133
+ 'app.auth.secondFactor.submit': 'Continue',
134
+ };
135
+
171
136
  const CATALOG: Readonly<Record<string, string>> = {
172
137
  ...SIGN_IN_CATALOG,
173
138
  'app.auth.signIn.email': 'Email',
174
139
  'app.auth.signIn.password': 'Password',
175
140
  'app.auth.signIn.submit': 'Sign in',
176
- 'app.auth.secondFactor.title': 'Second factor',
177
- 'app.auth.secondFactor.description': 'Enter the code from your authenticator app.',
178
- 'app.auth.secondFactor.code': 'Code',
179
- 'app.auth.secondFactor.submit': 'Continue',
141
+ ...SECOND_FACTOR_CATALOG,
180
142
  };
181
143
 
182
144
  /** The test's expectation that the page's form posts at `action`'s derived route. */
183
- const POSTS_AT = (action: string): string => `\`action="\${derivePath('${action}').path}"\``;
145
+ export const POSTS_AT = (action: string): string => `\`action="\${derivePath('${action}').path}"\``;
184
146
 
185
147
  export function passwordSignInFiles(options: SignInTemplateOptions): readonly GeneratedFile[] {
186
148
  const module = options.catalogModule;
@@ -189,7 +151,7 @@ export function passwordSignInFiles(options: SignInTemplateOptions): readonly Ge
189
151
  PASSWORD_SIGN_IN_ENV,
190
152
  'The master key seals the second-factor challenge between the two legs.',
191
153
  ),
192
- { path: `${AUTH_DIR}/sign-in-challenge.ts`, contents: challengeSource() },
154
+ { path: `${AUTH_DIR}/sign-in-challenge.ts`, contents: challengeSource('password') },
193
155
  { path: `${AUTH_DIR}/sign-in-challenge.test.ts`, contents: challengeTest() },
194
156
  { path: `${AUTH_DIR}/actions/create-session.ts`, contents: createSessionSource() },
195
157
  {
@@ -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,10 +57,12 @@ 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';
65
67
  import type { TestType } from './verify-tests';
66
68
 
@@ -151,27 +153,30 @@ export interface ReproduceOptions {
151
153
  * and the command still runs, over a different file set, which reproduces nothing.
152
154
  */
153
155
  export function reproduceFor(options: ReproduceOptions): string {
156
+ return `x ${quoteArg(reproduceWords(options))}`;
157
+ }
158
+
159
+ /** `reproduceFor`'s words after `x`, unquoted: each is quoted on its own (`quoteArg`) where pasted. */
160
+ export function reproduceWords(options: ReproduceOptions): readonly string[] {
154
161
  return [
155
- 'x test',
156
- ...(options.type === undefined ? [] : [quoteArg(options.type)]),
157
- ...(options.filter === undefined ? [] : ['--filter', quoteArg(options.filter)]),
162
+ 'test',
163
+ ...(options.type === undefined ? [] : [options.type]),
164
+ ...(options.filter === undefined ? [] : ['--filter', options.filter]),
158
165
  ...(options.sample === undefined ? [] : ['--sample', String(options.sample)]),
159
166
  // `--base` is emitted always rather than only when non-default: the default is `main`, and a
160
167
  // 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)]),
168
+ ...(options.affected === undefined ? [] : ['--affected', '--base', options.affected.base]),
164
169
  ...(options.affected?.dirty === true ? ['--dirty'] : []),
165
170
  '--workers',
166
171
  String(options.workers),
167
172
  ...(options.isolate === true ? ['--isolate'] : []),
168
173
  ...(options.seed === undefined ? [] : ['--seed', String(options.seed)]),
169
174
  // 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.
175
+ // parser will find it again.
171
176
  ...(options.passthrough === undefined || options.passthrough.length === 0
172
177
  ? []
173
- : ['--', ...options.passthrough.map(quoteArg)]),
174
- ].join(' ');
178
+ : ['--', ...options.passthrough]),
179
+ ];
175
180
  }
176
181
 
177
182
  export interface RunShardsOptions {
@@ -233,16 +238,56 @@ const planOf = (
233
238
  : { passthrough: options.passthrough }),
234
239
  });
235
240
 
241
+ /** The failing files shown in a cause; the rest are counted. */
242
+ const SHOWN_FAILING = 5;
243
+
244
+ /** `plan` narrowed to one file, alone: the rerun of a failure that is not the whole suite again. */
245
+ const narrowedTo = (plan: ReproduceOptions, file: string): ReproduceOptions => ({
246
+ workers: 1,
247
+ filter: file,
248
+ ...(plan.type === undefined ? {} : { type: plan.type }),
249
+ ...(plan.isolate === true ? { isolate: true } : {}),
250
+ ...(plan.seed === undefined ? {} : { seed: plan.seed }),
251
+ ...(plan.passthrough === undefined ? {} : { passthrough: plan.passthrough }),
252
+ });
253
+
236
254
  /**
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.
255
+ * `X_TEST_FAILED`. With the failing files read out of bun's output, the cause names them and the
256
+ * fix reruns the first one alone — rerunning the selection that just failed is the line the
257
+ * reader already ran. Only when bun named no file is the fix the whole reproduction.
258
+ * `X_TEST_SHARD_FAILED` was the `--worker` rerun's and went with it: registered, unthrown.
239
259
  */
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
- });
260
+ export const failureOf = (
261
+ code: number,
262
+ files: number,
263
+ plan: ReproduceOptions,
264
+ failing: readonly string[] = [],
265
+ ): Finding => {
266
+ const first = failing[0];
267
+ const more = failing.length > SHOWN_FAILING ? ` (+${failing.length - SHOWN_FAILING} more)` : '';
268
+ const named =
269
+ first === undefined ? '' : `; failing: ${failing.slice(0, SHOWN_FAILING).join(', ')}${more}`;
270
+ return {
271
+ code: 'X_TEST_FAILED',
272
+ cause: `${plan.type ?? 'test'} run exited ${code} across ${plan.workers} worker(s) (${files} file(s))${named}`,
273
+ fix: reproduceFor(first === undefined ? plan : narrowedTo(plan, first)),
274
+ docs: ERROR_DOCS_URL,
275
+ };
276
+ };
277
+
278
+ /** The environment the children saw: this process's, with the overrides applied (undefined unsets). */
279
+ const childEnv = (
280
+ env: Readonly<Record<string, string | undefined>>,
281
+ overrides: Readonly<Record<string, string | undefined>>,
282
+ ): Readonly<Record<string, string | undefined>> => {
283
+ // A Map, never a keyed object: an env key is any string, `__proto__` included.
284
+ const out = new Map(Object.entries(env));
285
+ for (const [key, value] of Object.entries(overrides)) {
286
+ if (value === undefined) out.delete(key);
287
+ else out.set(key, value);
288
+ }
289
+ return Object.fromEntries(out);
290
+ };
246
291
 
247
292
  /**
248
293
  * ONE `bun test` PER BATCH, a pass being as many batches as `test-batches.ts` cuts it into, and
@@ -280,8 +325,10 @@ export async function runShards(options: RunShardsOptions): Promise<CommandResul
280
325
  const steps: StepResult[] = [];
281
326
  const spent: JsonValue[] = [];
282
327
  let batchCount = 0;
328
+ let peak = 1;
283
329
  let ok = true;
284
330
  let exitCode = 0;
331
+ const results: ExecResult[] = [];
285
332
  for (const pass of passes) {
286
333
  const files = pass.files.map((file) => file.path);
287
334
  // `-- --watch` is never split: it never exits, so a second batch would never start. Every
@@ -314,7 +361,13 @@ export async function runShards(options: RunShardsOptions): Promise<CommandResul
314
361
  });
315
362
  batchCount += batches.length;
316
363
  const plan = planOf(options, pass);
317
- const label = `${pass.workers} worker(s)`;
364
+ // What ran, not what was asked: the machine lease may hold every batch below the plan.
365
+ const reached = Math.max(1, ...result.widths);
366
+ peak = Math.max(peak, reached);
367
+ const narrowed = reached < pass.workers;
368
+ const label = narrowed
369
+ ? msg('cli.test.narrowed', { peak: reached, planned: pass.workers })
370
+ : `${pass.workers} worker(s)`;
318
371
  steps.push({
319
372
  name: `${pass.type === undefined ? label : `${pass.type} · ${label}`} · ${files.length} files${
320
373
  batches.length > 1 ? msg('cli.test.batches', { batches: batches.length }) : ''
@@ -323,14 +376,17 @@ export async function runShards(options: RunShardsOptions): Promise<CommandResul
323
376
  durationMs: result.durationMs,
324
377
  // `output.ts` documents this field as absent for a NON-test step, so omitting it here made
325
378
  // `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)],
379
+ workers: reached,
380
+ findings: result.ok
381
+ ? []
382
+ : [failureOf(result.code, files.length, plan, failingFiles(result.output, files))],
328
383
  output: result.output,
329
384
  });
330
385
  spent.push({
331
386
  ...(pass.type === undefined ? {} : { type: pass.type }),
332
387
  files: files.length,
333
388
  workers: pass.workers,
389
+ ...(narrowed ? { peakWorkers: reached } : {}),
334
390
  ...(batches.length > 1 ? { batches: batches.length } : {}),
335
391
  ok: result.ok,
336
392
  exitCode: result.code,
@@ -338,6 +394,7 @@ export async function runShards(options: RunShardsOptions): Promise<CommandResul
338
394
  });
339
395
  ok = ok && result.ok;
340
396
  if (exitCode === 0) exitCode = result.code;
397
+ results.push(...result.results);
341
398
  }
342
399
  const durationMs = Math.round(performance.now() - started);
343
400
  const fileCount = options.files.length;
@@ -350,7 +407,7 @@ export async function runShards(options: RunShardsOptions): Promise<CommandResul
350
407
  SLOWEST_KEPT,
351
408
  );
352
409
  // 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) => {
410
+ let timedSteps = steps.map((step, index) => {
354
411
  const own = slowestOf(timings, passes[index]?.files.map((file) => file.path) ?? []);
355
412
  return own.length === 0 ? step : { ...step, slowest: own };
356
413
  });
@@ -362,12 +419,33 @@ export async function runShards(options: RunShardsOptions): Promise<CommandResul
362
419
  workers,
363
420
  ...(options.type === undefined ? {} : { type: options.type }),
364
421
  });
422
+ // `bun test` exits 0 over a run whose every test skipped itself: only the counts say nothing ran.
423
+ const counts = countsOf(results);
424
+ const skippedOnly = ok && !watching && counts.ran === 0 && counts.skipped > 0;
425
+ if (skippedOnly) {
426
+ const finding = allSkippedFinding({
427
+ ...(options.type === undefined ? {} : { type: options.type }),
428
+ skipped: counts.skipped,
429
+ files: options.files.map((file) => file.path),
430
+ env: childEnv(options.env ?? Bun.env, envOverrides),
431
+ rerun: reproduceWords(plan),
432
+ });
433
+ timedSteps = timedSteps.map((step) => ({
434
+ ...step,
435
+ ok: false,
436
+ findings: [...step.findings, finding],
437
+ }));
438
+ ok = false;
439
+ exitCode = 1;
440
+ }
365
441
  const type = options.type;
366
442
  const typeParam = type === undefined ? {} : { type };
367
443
  const sample = options.sample;
368
444
  const data: JsonValue = {
369
445
  ...typeParam,
370
446
  workers,
447
+ // Only when the machine held the run below `workers`, which stays the width to reproduce with.
448
+ ...(peak < workers ? { peakWorkers: peak } : {}),
371
449
  files: fileCount,
372
450
  durationMs,
373
451
  ...(options.filter === undefined ? {} : { filter: options.filter }),
@@ -386,18 +464,20 @@ export async function runShards(options: RunShardsOptions): Promise<CommandResul
386
464
  return {
387
465
  ok,
388
466
  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
- }),
467
+ summary: skippedOnly
468
+ ? msg('cli.test.allSkipped', { label: type ?? 'test', skipped: counts.skipped })
469
+ : ok
470
+ ? msg(type === undefined ? 'cli.test.pass' : 'cli.test.type.pass', {
471
+ ...typeParam,
472
+ files: fileCount,
473
+ workers: Math.min(peak, workers),
474
+ ms: durationMs,
475
+ })
476
+ : msg(type === undefined ? 'cli.test.fail' : 'cli.test.type.fail', {
477
+ ...typeParam,
478
+ failed: steps.filter((step) => !step.ok).length,
479
+ workers,
480
+ }),
401
481
  steps: timedSteps,
402
482
  ...(sample === undefined
403
483
  ? {}