@1aboveio/engineering-skills 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/README.md +28 -2
  2. package/package.json +34 -4
  3. package/skills/better-review/LICENSE +3 -0
  4. package/skills/better-review/SKILL.md +249 -0
  5. package/skills/better-review/agents/openai.yaml +9 -0
  6. package/skills/better-review/references/domain-hazards.md +53 -0
  7. package/skills/better-review/references/passes.md +147 -0
  8. package/skills/better-review/references/result.md +151 -0
  9. package/skills/better-review/release-check.mjs +93 -0
  10. package/skills/better-review/scripts/pr-context.mjs +212 -0
  11. package/skills/better-review/scripts/pr-context.test.mjs +168 -0
  12. package/skills/better-review/scripts/rereview-scope.mjs +503 -0
  13. package/skills/better-review/scripts/rereview-scope.test.mjs +587 -0
  14. package/skills/better-review/scripts/scan-diff.mjs +365 -0
  15. package/skills/better-review/scripts/scan-diff.test.mjs +414 -0
  16. package/skills/better-review/scripts/vendor-sync.test.mjs +96 -0
  17. package/skills/e2e-test/LICENSE +3 -0
  18. package/skills/e2e-test/SKILL.md +98 -0
  19. package/skills/e2e-test/assets/ci-gates.cloudbuild.yaml +24 -0
  20. package/skills/e2e-test/references/authoring/auth-flows.md +159 -0
  21. package/skills/e2e-test/references/authoring/playwright-config.md +73 -0
  22. package/skills/e2e-test/references/authoring/playwright-patterns.md +144 -0
  23. package/skills/e2e-test/references/ci-integration.md +25 -0
  24. package/skills/e2e-test/references/ci-playwright-container.md +290 -0
  25. package/skills/e2e-test/references/presentation-sweep.md +104 -0
  26. package/skills/e2e-test/references/reviewing.md +41 -0
  27. package/skills/e2e-test/references/route-manifest.md +51 -0
  28. package/skills/e2e-test/release-check.mjs +93 -0
  29. package/skills/e2e-test/scripts/detect-routes-nextjs.mjs +200 -0
  30. package/skills/e2e-test/scripts/presentation-checks.mjs +171 -0
  31. package/skills/e2e-test/scripts/presentation-checks.test.mjs +106 -0
  32. package/skills/e2e-test/scripts/presentation-perceivability.mjs +179 -0
  33. package/skills/e2e-test/scripts/presentation-perceivability.test.mjs +117 -0
  34. package/skills/e2e-test/scripts/presentation-reachability.mjs +154 -0
  35. package/skills/e2e-test/scripts/presentation-reachability.test.mjs +69 -0
  36. package/skills/e2e-test/scripts/presentation-render-health.mjs +141 -0
  37. package/skills/e2e-test/scripts/presentation-render-health.test.mjs +98 -0
  38. package/skills/e2e-test/scripts/presentation-sweep.mjs +147 -0
  39. package/skills/e2e-test/scripts/presentation-sweep.test.mjs +71 -0
  40. package/skills/e2e-test/scripts/presentation-temporal.mjs +127 -0
  41. package/skills/e2e-test/scripts/presentation-temporal.test.mjs +59 -0
  42. package/skills/e2e-test/scripts/project-route-manifest.mjs +82 -0
  43. package/skills/e2e-test/scripts/project-route-manifest.test.mjs +76 -0
  44. package/skills/e2e-test/scripts/validate-manifest.mjs +106 -0
  45. package/skills/engineering-runtime/LICENSE +3 -0
  46. package/skills/engineering-runtime/SKILL.md +11 -0
  47. package/skills/engineering-runtime/agents/openai.yaml +6 -0
  48. package/skills/engineering-runtime/coherence/workflow.json +597 -0
  49. package/skills/engineering-runtime/engineering-runtime.test.mjs +68 -0
  50. package/skills/engineering-runtime/release-check.mjs +93 -0
  51. package/skills/engineering-runtime/scripts/exact-head-artifact.mjs +131 -0
  52. package/skills/engineering-runtime/scripts/head-check-set.mjs +398 -0
  53. package/skills/engineering-runtime/scripts/invocation-policy.mjs +187 -0
  54. package/skills/engineering-runtime/scripts/invocation-policy.test.mjs +95 -0
  55. package/skills/engineering-runtime/scripts/main-module.mjs +79 -0
  56. package/skills/engineering-runtime/scripts/main-module.test.mjs +288 -0
  57. package/skills/engineering-runtime/scripts/mergify-yaml.mjs +11 -0
  58. package/skills/engineering-runtime/scripts/package-lock.json +43 -0
  59. package/skills/engineering-runtime/scripts/package.json +10 -0
  60. package/skills/engineering-runtime/scripts/required-check-plan.mjs +223 -0
  61. package/skills/engineering-runtime/scripts/required-check-plan.test.mjs +96 -0
  62. package/skills/engineering-runtime/scripts/review-completion.mjs +56 -0
  63. package/skills/engineering-runtime/scripts/workflow-coherence.mjs +595 -0
  64. package/skills/engineering-runtime/scripts/workflow-policy.mjs +189 -0
  65. package/skills/engineering-runtime/scripts/yaml-mapping.mjs +18 -0
  66. package/skills/ensure-coverage/LICENSE +3 -0
  67. package/skills/ensure-coverage/SKILL.md +129 -0
  68. package/skills/ensure-coverage/references/breadth/coverage-ledger.md +92 -0
  69. package/skills/ensure-coverage/references/breadth/inventory-contract.md +85 -0
  70. package/skills/ensure-coverage/references/breadth/surface-baseline.md +44 -0
  71. package/skills/ensure-coverage/references/breadth/surface-discovery.md +16 -0
  72. package/skills/ensure-coverage/references/depth/characterization.md +68 -0
  73. package/skills/ensure-coverage/references/depth/coverage.config.example.json +19 -0
  74. package/skills/ensure-coverage/references/depth/grading.md +35 -0
  75. package/skills/ensure-coverage/references/depth/mock-policy.md +57 -0
  76. package/skills/ensure-coverage/references/depth/test-smells.md +39 -0
  77. package/skills/ensure-coverage/references/enforcement/ci-contract.md +44 -0
  78. package/skills/ensure-coverage/references/examples/coverage-ledger.md +110 -0
  79. package/skills/ensure-coverage/references/examples/refund-flow.md +35 -0
  80. package/skills/ensure-coverage/references/presentation/axis.md +64 -0
  81. package/skills/ensure-coverage/references/process/audit-mode.md +27 -0
  82. package/skills/ensure-coverage/references/process/output-template.md +139 -0
  83. package/skills/ensure-coverage/references/process/test-strategy.md +56 -0
  84. package/skills/ensure-coverage/release-check.mjs +93 -0
  85. package/skills/ensure-coverage/schemas/coverage-config.schema.json +67 -0
  86. package/skills/ensure-coverage/schemas/coverage-file.schema.json +140 -0
  87. package/skills/ensure-coverage/scripts/README.md +99 -0
  88. package/skills/ensure-coverage/scripts/adapters/nextjs-inventory.mjs +182 -0
  89. package/skills/ensure-coverage/scripts/adapters/nextjs-inventory.test.mjs +96 -0
  90. package/skills/ensure-coverage/scripts/check-quarantine-expiry.mjs +105 -0
  91. package/skills/ensure-coverage/scripts/check-quarantine-expiry.test.mjs +47 -0
  92. package/skills/ensure-coverage/scripts/ci-audit.mjs +137 -0
  93. package/skills/ensure-coverage/scripts/ci-audit.test.mjs +86 -0
  94. package/skills/ensure-coverage/scripts/coverage-ledger.mjs +674 -0
  95. package/skills/ensure-coverage/scripts/coverage-ledger.test.mjs +447 -0
  96. package/skills/ensure-coverage/scripts/design-parity.mjs +591 -0
  97. package/skills/ensure-coverage/scripts/design-parity.test.mjs +552 -0
  98. package/skills/ensure-coverage/scripts/lint-tests.mjs +282 -0
  99. package/skills/ensure-coverage/scripts/lint-tests.test.mjs +289 -0
  100. package/skills/ensure-coverage/scripts/mock-policy-config.mjs +176 -0
  101. package/skills/ensure-coverage/scripts/mock-policy-config.test.mjs +119 -0
  102. package/skills/ensure-coverage/scripts/package.json +19 -0
  103. package/skills/golden-path/LICENSE +3 -0
  104. package/skills/golden-path/SKILL.md +230 -0
  105. package/skills/golden-path/agents/openai.yaml +3 -0
  106. package/skills/golden-path/assets/golden-paths.example.json +57 -0
  107. package/skills/golden-path/references/contract.md +239 -0
  108. package/skills/golden-path/references/migration.md +111 -0
  109. package/skills/golden-path/release-check.mjs +93 -0
  110. package/skills/golden-path/scripts/golden-path-core.mjs +1779 -0
  111. package/skills/golden-path/scripts/golden-path.mjs +6 -0
  112. package/skills/golden-path/scripts/golden-path.test.mjs +1457 -0
  113. package/skills/harness-runtime/LICENSE +3 -0
  114. package/skills/harness-runtime/SKILL.md +19 -0
  115. package/skills/harness-runtime/agents/openai.yaml +6 -0
  116. package/skills/harness-runtime/bin/discover-models.mjs +4 -0
  117. package/skills/harness-runtime/bin/model-catalog.mjs +4 -0
  118. package/skills/harness-runtime/contracts.md +15 -0
  119. package/skills/harness-runtime/discover-models.mjs +392 -0
  120. package/skills/harness-runtime/discover-models.test.mjs +363 -0
  121. package/skills/harness-runtime/fixtures/native-question-schemas.json +33 -0
  122. package/skills/harness-runtime/fixtures/question-responses.json +54 -0
  123. package/skills/harness-runtime/harness-runtime.test.mjs +967 -0
  124. package/skills/harness-runtime/index.mjs +767 -0
  125. package/skills/harness-runtime/model-catalog-seed.test.mjs +829 -0
  126. package/skills/harness-runtime/model-catalog.mjs +787 -0
  127. package/skills/harness-runtime/model-catalog.test.mjs +366 -0
  128. package/skills/harness-runtime/native-question-contracts.md +37 -0
  129. package/skills/harness-runtime/references/model-catalog-seed.json +408 -0
  130. package/skills/harness-runtime/references/model-catalog.md +57 -0
  131. package/skills/harness-runtime/release-check.mjs +93 -0
  132. package/skills/resolve-issues/LICENSE +3 -0
  133. package/skills/resolve-issues/SKILL.md +250 -0
  134. package/skills/resolve-issues/agents/openai.yaml +9 -0
  135. package/skills/resolve-issues/plugin-hooks.json +17 -0
  136. package/skills/resolve-issues/references/canary.md +28 -0
  137. package/skills/resolve-issues/references/ci.md +105 -0
  138. package/skills/resolve-issues/references/done.md +25 -0
  139. package/skills/resolve-issues/references/dropbox.md +90 -0
  140. package/skills/resolve-issues/references/expire.md +318 -0
  141. package/skills/resolve-issues/references/exploration.md +202 -0
  142. package/skills/resolve-issues/references/implementation.md +303 -0
  143. package/skills/resolve-issues/references/preflight.md +445 -0
  144. package/skills/resolve-issues/references/review.md +228 -0
  145. package/skills/resolve-issues/references/shared-modules.md +44 -0
  146. package/skills/resolve-issues/references/task-plan.md +264 -0
  147. package/skills/resolve-issues/release-check.mjs +93 -0
  148. package/skills/resolve-issues/scripts/cleanup-runs.mjs +364 -0
  149. package/skills/resolve-issues/scripts/cleanup-runs.test.mjs +280 -0
  150. package/skills/resolve-issues/scripts/discover-models.mjs +9 -0
  151. package/skills/resolve-issues/scripts/dropbox.mjs +473 -0
  152. package/skills/resolve-issues/scripts/dropbox.test.mjs +346 -0
  153. package/skills/resolve-issues/scripts/findings-reuse.mjs +98 -0
  154. package/skills/resolve-issues/scripts/findings-reuse.test.mjs +88 -0
  155. package/skills/resolve-issues/scripts/github-reviews.mjs +384 -0
  156. package/skills/resolve-issues/scripts/github-reviews.test.mjs +264 -0
  157. package/skills/resolve-issues/scripts/install-hooks.mjs +135 -0
  158. package/skills/resolve-issues/scripts/install-hooks.test.mjs +79 -0
  159. package/skills/resolve-issues/scripts/issue-tree.mjs +162 -0
  160. package/skills/resolve-issues/scripts/issue-tree.test.mjs +107 -0
  161. package/skills/resolve-issues/scripts/manual-invocation.test.mjs +14 -0
  162. package/skills/resolve-issues/scripts/model-catalog.mjs +9 -0
  163. package/skills/resolve-issues/scripts/next-actions-capacity.test.mjs +149 -0
  164. package/skills/resolve-issues/scripts/next-actions.mjs +856 -0
  165. package/skills/resolve-issues/scripts/next-actions.test.mjs +915 -0
  166. package/skills/resolve-issues/scripts/plan-sync.mjs +269 -0
  167. package/skills/resolve-issues/scripts/plan-sync.test.mjs +156 -0
  168. package/skills/resolve-issues/scripts/preflight-models.mjs +736 -0
  169. package/skills/resolve-issues/scripts/preflight-models.test.mjs +448 -0
  170. package/skills/resolve-issues/scripts/ready-check.mjs +185 -0
  171. package/skills/resolve-issues/scripts/ready-check.test.mjs +217 -0
  172. package/skills/resolve-issues/scripts/rehydrate.mjs +98 -0
  173. package/skills/resolve-issues/scripts/rehydrate.test.mjs +91 -0
  174. package/skills/resolve-issues/scripts/review-verdict.mjs +509 -0
  175. package/skills/resolve-issues/scripts/review-verdict.test.mjs +1060 -0
  176. package/skills/resolve-issues/scripts/size-check.mjs +492 -0
  177. package/skills/resolve-issues/scripts/size-check.test.mjs +458 -0
  178. package/skills/resolve-release/LICENSE +3 -0
  179. package/skills/resolve-release/SKILL.md +215 -0
  180. package/skills/resolve-release/agents/openai.yaml +8 -0
  181. package/skills/resolve-release/flows/cloud-run-canary.md +13 -0
  182. package/skills/resolve-release/flows/cloud-run.md +7 -0
  183. package/skills/resolve-release/flows/root-tag-npm.md +13 -0
  184. package/skills/resolve-release/flows/workspace-npm.md +22 -0
  185. package/skills/resolve-release/references/canary.md +51 -0
  186. package/skills/resolve-release/references/candidate.md +41 -0
  187. package/skills/resolve-release/references/cut.md +131 -0
  188. package/skills/resolve-release/references/dark-launch.md +66 -0
  189. package/skills/resolve-release/references/flows.md +150 -0
  190. package/skills/resolve-release/references/preflight.md +154 -0
  191. package/skills/resolve-release/references/prepared-metadata.md +260 -0
  192. package/skills/resolve-release/references/promotion.md +82 -0
  193. package/skills/resolve-release/references/publish.md +232 -0
  194. package/skills/resolve-release/references/workspace-npm.md +103 -0
  195. package/skills/resolve-release/release-check.mjs +93 -0
  196. package/skills/resolve-release/scripts/apply.mjs +212 -0
  197. package/skills/resolve-release/scripts/apply.test.mjs +99 -0
  198. package/skills/resolve-release/scripts/dark-flags.mjs +134 -0
  199. package/skills/resolve-release/scripts/dark-flags.test.mjs +100 -0
  200. package/skills/resolve-release/scripts/flow.mjs +500 -0
  201. package/skills/resolve-release/scripts/flow.test.mjs +340 -0
  202. package/skills/resolve-release/scripts/green-head.mjs +231 -0
  203. package/skills/resolve-release/scripts/green-head.test.mjs +101 -0
  204. package/skills/resolve-release/scripts/npm-version-absence.mjs +138 -0
  205. package/skills/resolve-release/scripts/npm-version-absence.test.mjs +426 -0
  206. package/skills/resolve-release/scripts/plan-npm.test.mjs +659 -0
  207. package/skills/resolve-release/scripts/plan-toml-boundary.test.mjs +317 -0
  208. package/skills/resolve-release/scripts/plan-uv.test.mjs +291 -0
  209. package/skills/resolve-release/scripts/plan.mjs +806 -0
  210. package/skills/resolve-release/scripts/plan.test.mjs +428 -0
  211. package/skills/rush-issues/LICENSE +3 -0
  212. package/skills/rush-issues/SKILL.md +58 -0
  213. package/skills/rush-issues/agents/openai.yaml +8 -0
  214. package/skills/rush-issues/rehydrate.mjs +10 -0
  215. package/skills/rush-issues/release-check.mjs +93 -0
  216. package/skills/rush-release/LICENSE +3 -0
  217. package/skills/rush-release/SKILL.md +35 -0
  218. package/skills/rush-release/agents/openai.yaml +8 -0
  219. package/skills/rush-release/release-check.mjs +93 -0
  220. package/skills/test-quality/LICENSE +3 -0
  221. package/skills/test-quality/SKILL.md +79 -0
  222. package/skills/test-quality/references/audit.md +80 -0
  223. package/skills/test-quality/references/lint.md +24 -0
  224. package/skills/test-quality/references/principles.md +143 -0
  225. package/skills/test-quality/references/testing-conventions.md +9 -0
  226. package/skills/test-quality/release-check.mjs +93 -0
  227. package/skills/test-quality/scripts/lint-tests.mjs +574 -0
  228. package/skills/test-quality/scripts/lint-tests.test.mjs +591 -0
  229. package/skills/test-quality/scripts/mock-policy-config.mjs +176 -0
  230. package/skills/test-quality/scripts/mock-policy-config.test.mjs +119 -0
  231. package/skills/test-quality/scripts/persist-conventions-core.mjs +117 -0
  232. package/skills/test-quality/scripts/persist-conventions.mjs +17 -0
  233. package/skills/test-quality/scripts/persist-conventions.test.mjs +104 -0
@@ -0,0 +1,492 @@
1
+ #!/usr/bin/env node
2
+ // Check a planned resolve-issues run against its size limits, after exploration and
3
+ // before implementation.
4
+ //
5
+ // size-check.mjs --plan <task-plan.json> --findings <findings.json> [--exit-verdict]
6
+ //
7
+ // Each unit should be close to one tracer-bullet slice. The check weighs two
8
+ // separate considerations and tags every reason with one of them:
9
+ //
10
+ // scope is the unit one slice of work? (behaviors, prerequisites, lines)
11
+ // proof can the run show it works? (proof level, end-to-end suite, physical
12
+ // devices)
13
+ //
14
+ // plus run-wide `plan` measures (open questions; a long dependency chain only
15
+ // warns, since it costs time, not success: ADR 0016). A run takes every runnable unit:
16
+ // the dependency order, never a unit count, decides what starts when. A plan may list
17
+ // `merged` (ids merged by an earlier run): a dependency on one counts as met. Only scope
18
+ // and open questions hold a unit; proof
19
+ // signals only warn, since the unit builds what its proof needs, counted in its lines.
20
+ // A held unit gets one proposed split covering both, and every unit that
21
+ // depends on it waits with it; the rest of the run can go on. Prints a JSON
22
+ // verdict with every reason:
23
+ //
24
+ // ok nothing to report
25
+ // warn over a soft limit; proceed
26
+ // hold some units are held (see `held`); the `runnable` units can proceed
27
+ // stop the run as a whole cannot start
28
+ //
29
+ // The verdict is in the output, and the exit code is 0 whenever the script ran and answered
30
+ // (ok, warn, hold, stop, or exploration-unfinished); 2 for a bad plan or command.
31
+ // `exploration-unfinished` (printed as `{ verdict, reason }`) means findings that are unreadable,
32
+ // not version 2, or missing a planned unit, its `slice`, its `proof`, or its `estimatedLines`;
33
+ // only the explorer fixes it. --exit-verdict restores the old exit codes for one release
34
+ // (deprecated): 0 for ok/warn, 4 for hold, 1 for stop, 3 for exploration-unfinished.
35
+
36
+ import { readFileSync } from 'node:fs'
37
+
38
+ import { isMainModule } from '../../engineering-runtime/scripts/main-module.mjs'
39
+
40
+ // One unit is one issue and one PR, so the line limits measure a single PR.
41
+ // Explorer estimates have run about half of the real diff, so the line limits
42
+ // sit well below what one PR can hold; they back up the slice rules.
43
+ // Calibrated on 93 delivered issues (ADR 0014): two or three behaviors merged
44
+ // as fast as one, so they only warn; four or more hold. Line limits apply to the
45
+ // estimate scaled by ESTIMATE_FACTOR: on 45 delivered units the real diff ran a
46
+ // median 1.3x the explorer's estimate.
47
+ export const LIMITS = Object.freeze({
48
+ chainUnits: { warn: 6 },
49
+ unitLines: { warn: 2501, stop: 5001 },
50
+ behaviors: { warn: 2, stop: 4 },
51
+ emulatorLayers: { warn: 3 },
52
+ })
53
+ export const ESTIMATE_FACTOR = 1.3
54
+ // A proof group or shared setup must fit in this many estimated lines (before ESTIMATE_FACTOR).
55
+ export const SLICE_LINES = 1900
56
+ // A proposed split packs each slice up to this many estimated lines and up to three behaviors:
57
+ // the largest slice the hold limits let run (3,800 x 1.3 = 4,940). Every slice is a PR, a
58
+ // review, a queue turn, and often an app build and journey, so the fewest slices ship soonest.
59
+ export const PACK_LINES = 2 * SLICE_LINES
60
+ const PACK_BEHAVIORS = LIMITS.behaviors.stop - 1
61
+ export const sizedLines = (estimate) => Math.round(estimate * ESTIMATE_FACTOR)
62
+ const normalize = (text) => String(text).toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim()
63
+
64
+ const PREREQUISITE_STATUSES = new Set(['present', 'missing'])
65
+ const BLOCKING_QUESTION_KINDS = new Set(['product', 'scope', 'approval'])
66
+
67
+ // The weakest level that shows a unit's behaviors work and that the run itself
68
+ // can reach, weakest first. A real device is never one: that evidence goes in
69
+ // `proof.physical`, recorded once for the run as pending at the release gate.
70
+ export const PROOF_LEVELS = Object.freeze(['unit', 'database', 'browser', 'emulator'])
71
+ const NEEDS_SUITE = new Set(['browser', 'emulator'])
72
+ const SUITE_STATUSES = new Set(['present', 'missing'])
73
+ // A suite's `local` command reproduces one journey off CI, so a failed journey is debugged
74
+ // before the next push; a CI dispatch or rerun there would make CI the debugger.
75
+ const CI_RUN = /\bgh\s+(workflow\s+run|run\s+rerun|api\b.*\/dispatches\b)/
76
+
77
+ export const FINDINGS_VERSION = 2
78
+
79
+ export class SizeCheckError extends Error {}
80
+
81
+ // Unfinished exploration: the explorer, not the orchestrator, fixes it.
82
+ export class ExplorationUnfinished extends SizeCheckError {}
83
+
84
+ function unitsOf(plan) {
85
+ const units = Array.isArray(plan?.units) ? plan.units : null
86
+ if (!units || units.length === 0) throw new SizeCheckError('task plan has no units')
87
+ for (const unit of units) {
88
+ if (typeof unit?.id !== 'string' && typeof unit?.id !== 'number') throw new SizeCheckError('every unit needs an id')
89
+ if (unit.dependsOn !== undefined && !Array.isArray(unit.dependsOn)) throw new SizeCheckError(`unit ${unit.id}: dependsOn must be a list`)
90
+ if (unit.stacksOn !== undefined && !Array.isArray(unit.stacksOn)) throw new SizeCheckError(`unit ${unit.id}: stacksOn must be a list`)
91
+ }
92
+ if (plan.merged !== undefined && !Array.isArray(plan.merged)) throw new SizeCheckError('merged must be a list of unit ids')
93
+ // A parent merged by an earlier run is met: drop it, so it is neither unknown nor waited on.
94
+ const merged = new Set((plan.merged ?? []).map(String))
95
+ return units.map((u) => ({ id: String(u.id), dependsOn: (u.dependsOn ?? []).map(String).filter((d) => !merged.has(d)), stacksOn: (u.stacksOn ?? []).map(String) }))
96
+ }
97
+
98
+ // Longest dependency chain, counted in units. Throws on a cycle or an unknown
99
+ // dependency, since either means the plan itself is wrong.
100
+ export function longestChain(units) {
101
+ const byId = new Map(units.map((u) => [u.id, u]))
102
+ const memo = new Map()
103
+ const visiting = new Set()
104
+ const depth = (id) => {
105
+ if (memo.has(id)) return memo.get(id)
106
+ if (visiting.has(id)) throw new SizeCheckError(`dependency cycle through unit ${id}`)
107
+ const unit = byId.get(id)
108
+ if (!unit) throw new SizeCheckError(`unknown dependency ${id}`)
109
+ visiting.add(id)
110
+ const value = 1 + Math.max(0, ...unit.dependsOn.map(depth))
111
+ visiting.delete(id)
112
+ memo.set(id, value)
113
+ return value
114
+ }
115
+ let best = { length: 0, end: null }
116
+ for (const unit of units) {
117
+ const length = depth(unit.id)
118
+ if (length > best.length) best = { length, end: unit.id }
119
+ }
120
+ return best
121
+ }
122
+
123
+ const isLines = (value) => Number.isFinite(value) && value >= 0
124
+ const isText = (value) => typeof value === 'string' && value.trim() !== ''
125
+
126
+ // ---- Scope: is the unit one slice of work? ----
127
+
128
+ // Why a unit's `slice` is not a finished record, or null when it is.
129
+ function sliceProblem(slice) {
130
+ if (!slice || typeof slice !== 'object') return 'no slice'
131
+ if (!Array.isArray(slice.behaviors) || slice.behaviors.length === 0 || !slice.behaviors.every(isText)) return 'slice.behaviors must list at least one behavior'
132
+ if (!Array.isArray(slice.prerequisites)) return 'slice.prerequisites must be a list (empty when the unit builds on nothing)'
133
+ for (const p of slice.prerequisites) {
134
+ if (!isText(p?.what) || !PREREQUISITE_STATUSES.has(p?.status) || !isText(p?.evidence)) {
135
+ return 'every slice.prerequisites entry needs what, status (present or missing), and evidence'
136
+ }
137
+ if (p.status === 'missing' && typeof p.separate !== 'boolean') {
138
+ return 'every missing prerequisite needs separate (true or false)'
139
+ }
140
+ }
141
+ if (!Array.isArray(slice.layers) || slice.layers.length === 0 || !slice.layers.every(isText)) return 'slice.layers must list at least one layer'
142
+ if (slice.newProductBehaviorCount !== undefined && !(Number.isInteger(slice.newProductBehaviorCount) && slice.newProductBehaviorCount >= 0)) {
143
+ return 'slice.newProductBehaviorCount must be a whole number (0 for a unit that only proves merged code)'
144
+ }
145
+ // A unit's own behavior is what it builds, never something it builds on.
146
+ const own = new Set(slice.behaviors.map(normalize))
147
+ const self = slice.prerequisites.find((p) => p.status === 'missing' && own.has(normalize(p.what)))
148
+ if (self) return `missing prerequisite "${self.what}" is the unit's own behavior; list it only under behaviors`
149
+ return null
150
+ }
151
+
152
+ const separateMissing = (entry) => entry.slice.prerequisites.filter((p) => p.status === 'missing' && p.separate)
153
+
154
+ function scopeReasons(id, entry) {
155
+ const reasons = []
156
+ const add = (level, measure, message) => reasons.push({ level, consideration: 'scope', measure, message })
157
+ const { estimatedLines: estimate, slice } = entry
158
+ const lines = sizedLines(estimate)
159
+ const sized = `${lines} changed lines (estimate ${estimate} x ${ESTIMATE_FACTOR})`
160
+ if (lines >= LIMITS.unitLines.stop) add('stop', 'unitLines', `unit ${id} is sized at ${sized}, limit 5000; split it into sub-issues that together carry all its criteria`)
161
+ else if (lines >= LIMITS.unitLines.warn) add('warn', 'unitLines', `unit ${id} is sized at ${sized}; aim for 2500 or fewer`)
162
+ const n = slice.behaviors.length
163
+ const list = slice.behaviors.join('; ')
164
+ if (n >= LIMITS.behaviors.stop) add('stop', 'behaviors', `unit ${id} delivers ${n} behaviors (${list}); split it into the fewest issues of at most ${PACK_BEHAVIORS} behaviors each`)
165
+ else if (n >= LIMITS.behaviors.warn) add('warn', 'behaviors', `unit ${id} delivers ${n} behaviors (${list}); fine while each stays small`)
166
+ for (const p of slice.prerequisites.filter((p) => p.status === 'missing')) {
167
+ add('warn', 'prerequisites', `unit ${id} must also build ${p.what} (${p.evidence}); build it inside the unit, counted in its lines`)
168
+ }
169
+ return reasons
170
+ }
171
+
172
+ // ---- Proof: can the run show the unit works? ----
173
+
174
+ // The proof record's suite: the repository's end-to-end suite for that kind of
175
+ // journey, such as its Playwright tests or Android emulator journeys
176
+ // (older findings call it `harness`).
177
+ const suiteOf = (proof) => proof.suite ?? proof.harness
178
+
179
+ // Why a unit's `proof` is not a finished record, or null when it is.
180
+ function proofProblem(proof) {
181
+ if (!proof || typeof proof !== 'object') return 'no proof'
182
+ if (!PROOF_LEVELS.includes(proof.level)) return `proof.level must be one of ${PROOF_LEVELS.join(', ')} (real devices go in proof.physical)`
183
+ const r = suiteOf(proof)
184
+ if (NEEDS_SUITE.has(proof.level)) {
185
+ if (!r || !SUITE_STATUSES.has(r.status) || !isText(r.what) || !isText(r.evidence)) {
186
+ return `${proof.level} proof needs an end-to-end suite with what, status (present or missing), and evidence`
187
+ }
188
+ if (r.status === 'present' && !isText(r.check)) return 'a present end-to-end suite needs a check command'
189
+ if (r.status === 'present' && !isText(r.local)) return 'a present end-to-end suite needs a local command that runs one journey off CI'
190
+ if (r.status === 'present' && CI_RUN.test(r.local)) return `proof.suite.local must run off CI, not dispatch it: ${r.local}`
191
+ if (r.skill !== null && !(isText(r.skill) && r.skill.startsWith('/') && r.skill.endsWith('SKILL.md'))) {
192
+ return 'proof.suite.skill must be the absolute SKILL.md path of the installed skill for this journey, or null'
193
+ }
194
+ } else if (r !== undefined) {
195
+ return `proof.suite is only for browser and emulator proof; leave it out at ${proof.level}`
196
+ }
197
+ if (!Array.isArray(proof.physical) || !proof.physical.every(isText)) return 'proof.physical must be a list (empty when no real device is needed)'
198
+ return null
199
+ }
200
+
201
+ const proofOnly = (entry) => entry.slice.newProductBehaviorCount === 0
202
+
203
+ // Why a proof-only unit's groups are not a finished record, or null. A unit that only
204
+ // proves merged code (newProductBehaviorCount 0) lists its proof groups, so a held one can
205
+ // split along them: each group names the issue whose criteria it proves, its estimate, and
206
+ // the shared setup it needs (an id from proof.setups, or null).
207
+ function groupsProblem(entry) {
208
+ const { groups, setups = [] } = entry.proof
209
+ if (!proofOnly(entry)) return groups === undefined ? null : 'proof.groups is only for a unit with slice.newProductBehaviorCount 0'
210
+ if (!Array.isArray(groups) || groups.length === 0) return 'a unit with slice.newProductBehaviorCount 0 needs proof.groups: each group with id, covers, estimatedLines, and setup'
211
+ if (!Array.isArray(setups)) return 'proof.setups must be a list of shared setups'
212
+ for (const su of setups) {
213
+ if (!isText(su?.id) || !isText(su?.what) || !isLines(su?.estimatedLines)) return 'every proof.setups entry needs id, what, and estimatedLines'
214
+ if (su.estimatedLines >= SLICE_LINES) return `shared setup ${su.id} is estimated at ${su.estimatedLines} lines; split it below ${SLICE_LINES}`
215
+ }
216
+ const setupIds = new Set(setups.map((su) => su.id))
217
+ const ids = new Set()
218
+ for (const g of groups) {
219
+ if (!isText(g?.id) || !isText(g?.covers) || !isLines(g?.estimatedLines)) return 'every proof.groups entry needs id, covers (the issue it proves), and estimatedLines'
220
+ if (ids.has(g.id)) return `proof group ${g.id} is listed twice`
221
+ ids.add(g.id)
222
+ if (g.setup !== undefined && g.setup !== null && !setupIds.has(g.setup)) return `proof group ${g.id} names setup ${g.setup}, which proof.setups does not list`
223
+ if (g.estimatedLines >= SLICE_LINES) return `proof group ${g.id} is estimated at ${g.estimatedLines} lines; split it below ${SLICE_LINES}`
224
+ }
225
+ return null
226
+ }
227
+
228
+ const missingSuite = (entry) => (NEEDS_SUITE.has(entry.proof.level) && suiteOf(entry.proof).status === 'missing' ? suiteOf(entry.proof) : null)
229
+
230
+ function proofReasons(id, entry) {
231
+ const reasons = []
232
+ const add = (level, measure, message) => reasons.push({ level, consideration: 'proof', measure, message })
233
+ const { proof, slice } = entry
234
+ const suite = missingSuite(entry)
235
+ if (suite) {
236
+ add('warn', 'suite', `unit ${id} needs ${proof.level} proof but the repository has no working end-to-end suite for it: ${suite.what} (${suite.evidence}); build the ${proof.level} journey it needs inside the unit, counted in its lines`)
237
+ }
238
+ if (proof.level === 'emulator' && slice.layers.length >= LIMITS.emulatorLayers.warn) {
239
+ add('warn', 'emulatorLayers', `unit ${id} needs emulator proof across ${slice.layers.length} layers (${slice.layers.join(', ')}); prove the logic below the emulator and keep one journey on it`)
240
+ }
241
+ if (proof.physical.length > 0) {
242
+ add('warn', 'physical', `unit ${id} needs evidence only a real device gives (${proof.physical.join('; ')}); it is recorded once, as pending at the release gate, never proved in the unit`)
243
+ }
244
+ return reasons
245
+ }
246
+
247
+ // One environment check per distinct end-to-end suite command, with the units that rely on it;
248
+ // the first relying implementer runs it as its first step. A `check` that dispatches CI checks
249
+ // nothing on this host, so the suite's off-CI `local` command stands in for it.
250
+ function environmentChecks(units, byUnit) {
251
+ const checks = new Map()
252
+ for (const { id } of units) {
253
+ const { proof } = byUnit[id]
254
+ if (!NEEDS_SUITE.has(proof.level) || suiteOf(proof).status !== 'present') continue
255
+ const key = CI_RUN.test(suiteOf(proof).check) ? suiteOf(proof).local : suiteOf(proof).check
256
+ if (!checks.has(key)) checks.set(key, { check: key, suite: suiteOf(proof).what, units: [] })
257
+ checks.get(key).units.push(id)
258
+ }
259
+ return [...checks.values()]
260
+ }
261
+
262
+ // ---- The whole check ----
263
+
264
+ // A unit counts as explored once its entry carries a valid `slice`, `proof`,
265
+ // and `estimatedLines`; the explorer's scaffold (an empty entry per unit) does not pass.
266
+ function findingsUnitsOf(findings, units) {
267
+ const unfinished = (why) => new ExplorationUnfinished(`exploration unfinished: ${why}; continue the explorer`)
268
+ if (findings?.version !== FINDINGS_VERSION) throw unfinished(`findings version is ${JSON.stringify(findings?.version)}, expected ${FINDINGS_VERSION}`)
269
+ const byUnit = findings.units
270
+ if (!byUnit || typeof byUnit !== 'object' || Array.isArray(byUnit)) throw unfinished('findings has no units map')
271
+ const missing = units.filter(({ id }) => !Object.hasOwn(byUnit, id)).map(({ id }) => id)
272
+ if (missing.length) throw unfinished(`no findings for unit ${missing.join(', ')}`)
273
+ const problems = units
274
+ .map(({ id }) => {
275
+ const problems = [sliceProblem(byUnit[id]?.slice), proofProblem(byUnit[id]?.proof)].filter(Boolean)
276
+ if (problems.length === 0) problems.push(groupsProblem(byUnit[id]))
277
+ return [id, problems.filter(Boolean).join('; ')]
278
+ })
279
+ .filter(([, problem]) => problem)
280
+ if (problems.length) throw unfinished(problems.map(([id, problem]) => `unit ${id}: ${problem}`).join('; '))
281
+ if (findings.openQuestions !== undefined && !Array.isArray(findings.openQuestions)) throw unfinished('openQuestions must be a list')
282
+ const unestimated = units.filter(({ id }) => !isLines(byUnit[id]?.estimatedLines)).map(({ id }) => id)
283
+ if (unestimated.length) throw unfinished(`no estimatedLines for unit ${unestimated.join(', ')}`)
284
+ return byUnit
285
+ }
286
+
287
+ // The split to hand back for a held unit: the fewest behavior slices that fit, in order, when
288
+ // scope asks for it (four or more behaviors, or too many lines with two or more); otherwise
289
+ // null. Each slice takes at most PACK_BEHAVIORS behaviors and, sharing the estimate evenly,
290
+ // stays under PACK_LINES. The first slice builds the separate missing prerequisites
291
+ // (`builds`), and only the later slices wait on it. A missing suite is never a prefactor: the
292
+ // unit builds the journey it needs inside each slice. A proof-only unit splits along its
293
+ // proof groups instead: one prefactor per shared setup (and prerequisite), then groups packed
294
+ // in order, those sharing a setup together, each slice under PACK_LINES and blocked by its setup.
295
+ // Null when there is nothing mechanical to split along: a held one-behavior unit, or a
296
+ // unit held only by an open question; the human decides.
297
+ function proposedSplit(entry) {
298
+ const titles = separateMissing(entry).map((p) => p.what)
299
+ const seen = new Set()
300
+ const prefactors = titles
301
+ .filter((t) => { const key = t.trim().toLowerCase(); if (seen.has(key)) return false; seen.add(key); return true })
302
+ .map((title) => ({ kind: 'prefactor', title, blockedBy: [] }))
303
+ if (proofOnly(entry)) return [...prefactors, ...proofSlices(entry, prefactors.map((p) => p.title))]
304
+ const n = entry.slice.behaviors.length
305
+ const splitBehaviors = n >= LIMITS.behaviors.stop
306
+ || (sizedLines(entry.estimatedLines) >= LIMITS.unitLines.stop && n >= 2)
307
+ if (!splitBehaviors) return null
308
+ // The first slice builds the missing prerequisites; only later slices wait on it, so the
309
+ // split never starts behind a prefactor of its own.
310
+ const builds = prefactors.map((p) => p.title)
311
+ const groups = packBehaviors(entry.slice.behaviors, entry.estimatedLines)
312
+ const title = (group) => group.join('; ')
313
+ return groups.map((group, i) => ({
314
+ kind: 'behavior', title: title(group), blockedBy: i > 0 && builds.length ? [title(groups[0])] : [], ...(i === 0 && builds.length ? { builds } : {}),
315
+ }))
316
+ }
317
+
318
+ // The fewest consecutive groups, sizes as even as possible, whose largest group holds at most
319
+ // PACK_BEHAVIORS behaviors and its even share of the estimate under PACK_LINES.
320
+ function packBehaviors(behaviors, estimatedLines) {
321
+ const n = behaviors.length
322
+ let k = 1
323
+ for (; k < n; k++) {
324
+ const largest = Math.ceil(n / k)
325
+ if (largest <= PACK_BEHAVIORS && (estimatedLines * largest) / n < PACK_LINES) break
326
+ }
327
+ const out = []
328
+ for (let i = 0, start = 0; i < k; i++) {
329
+ const size = Math.floor(n / k) + (i < n % k ? 1 : 0)
330
+ out.push(behaviors.slice(start, start + size))
331
+ start += size
332
+ }
333
+ return out
334
+ }
335
+
336
+ function proofSlices(entry, blockers) {
337
+ const setups = new Map((entry.proof.setups ?? []).map((su) => [su.id, su]))
338
+ const setupTitle = (id) => `Shared setup: ${setups.get(id).what}`
339
+ const used = [...new Set(entry.proof.groups.map((g) => g.setup ?? null))].filter((id) => id !== null)
340
+ const out = used.map((id) => ({ kind: 'prefactor', title: setupTitle(id), estimatedLines: setups.get(id).estimatedLines, blockedBy: blockers }))
341
+ const order = [...new Set(entry.proof.groups.map((g) => g.setup ?? null))]
342
+ for (const setup of order) {
343
+ let slice = null
344
+ for (const g of entry.proof.groups.filter((x) => (x.setup ?? null) === setup)) {
345
+ if (!slice || slice.estimatedLines + g.estimatedLines >= PACK_LINES) {
346
+ slice = { kind: 'proof', groups: [], covers: [], estimatedLines: 0, blockedBy: setup === null ? blockers : [...blockers, setupTitle(setup)] }
347
+ out.push(slice)
348
+ }
349
+ slice.groups.push(g.id)
350
+ if (!slice.covers.includes(g.covers)) slice.covers.push(g.covers)
351
+ slice.estimatedLines += g.estimatedLines
352
+ }
353
+ }
354
+ for (const sl of out) if (sl.kind === 'proof') sl.title = `Proof: ${sl.groups.join(', ')} (${sl.covers.join(', ')})`
355
+ return out
356
+ }
357
+
358
+ const verdictOf = (reasons) => (reasons.some((r) => r.level === 'stop') ? 'stop' : reasons.length ? 'warn' : 'ok')
359
+
360
+ export function sizeCheck(plan, findings) {
361
+ const units = unitsOf(plan)
362
+ const chain = longestChain(units)
363
+ const byUnit = findingsUnitsOf(findings, units)
364
+ const unitIds = new Set(units.map((u) => u.id))
365
+ const reasons = []
366
+ const add = (level, measure, message, unit = null) => reasons.push({ level, consideration: 'plan', measure, message, ...(unit ? { unit } : {}) })
367
+
368
+ for (const { id } of units) {
369
+ for (const r of [...scopeReasons(id, byUnit[id]), ...proofReasons(id, byUnit[id])]) reasons.push({ ...r, unit: id })
370
+ }
371
+
372
+ if (chain.length >= LIMITS.chainUnits.warn) add('warn', 'chainUnits', `longest dependency chain is ${chain.length} units, ending at ${chain.end}; its PRs land one after another`)
373
+
374
+ for (const q of findings?.openQuestions ?? []) {
375
+ if (q?.resolved === true) continue
376
+ const text = typeof q?.text === 'string' ? q.text : JSON.stringify(q)
377
+ const unit = q?.unit === undefined || q?.unit === null ? null : String(q.unit)
378
+ if (unit !== null && !unitIds.has(unit)) add('stop', 'openQuestions', `question assigned to unknown unit ${unit}: ${text}`)
379
+ else if (BLOCKING_QUESTION_KINDS.has(q?.kind)) add('stop', 'openQuestions', `unresolved ${q.kind} question${unit ? ` for unit ${unit}` : ''}: ${text}`, unit)
380
+ // Technical questions are implementation notes for the unit's worker; they never block.
381
+ else if (q?.kind !== 'technical') add('stop', 'openQuestions', `open question without a valid kind (product, scope, approval): ${text}`)
382
+ }
383
+
384
+ // A unit-level stop holds that unit; anything that depends on it, directly
385
+ // or through another unit, waits with it. A run-level stop stops everything.
386
+ const stoppedUnits = new Set(reasons.filter((r) => r.level === 'stop' && r.unit).map((r) => r.unit))
387
+ const byId = new Map(units.map((u) => [u.id, u]))
388
+ const heldAncestors = (id, seen = new Set()) => {
389
+ for (const parent of byId.get(id).dependsOn) {
390
+ if (seen.has(parent)) continue
391
+ seen.add(parent)
392
+ heldAncestors(parent, seen)
393
+ }
394
+ return [...seen].filter((p) => stoppedUnits.has(p)).sort()
395
+ }
396
+
397
+ const unitRows = units.map(({ id }) => {
398
+ const { estimatedLines: lines, slice, proof } = byUnit[id]
399
+ const own = reasons.filter((r) => r.unit === id)
400
+ return {
401
+ id,
402
+ lines,
403
+ behaviors: slice.behaviors.length,
404
+ missingPrerequisites: slice.prerequisites.filter((p) => p.status === 'missing').map((p) => p.what),
405
+ layers: slice.layers,
406
+ proof: proof.level,
407
+ suite: NEEDS_SUITE.has(proof.level) ? suiteOf(proof).status : null,
408
+ physical: proof.physical.length,
409
+ scope: verdictOf(own.filter((r) => r.consideration === 'scope')),
410
+ proofVerdict: verdictOf(own.filter((r) => r.consideration === 'proof')),
411
+ verdict: verdictOf(own),
412
+ heldBy: heldAncestors(id),
413
+ }
414
+ })
415
+
416
+ const held = unitRows
417
+ .filter((row) => row.verdict === 'stop')
418
+ .map(({ id }) => ({
419
+ id,
420
+ reasons: reasons.filter((r) => r.unit === id && r.level === 'stop').map((r) => r.message),
421
+ proposedSplit: proposedSplit(byUnit[id]),
422
+ physical: byUnit[id].proof.physical,
423
+ }))
424
+ const runnable = unitRows.filter((row) => row.verdict !== 'stop' && row.heldBy.length === 0).map((row) => row.id)
425
+
426
+ // Real-device evidence is integrated acceptance: one record for the whole run, pending at
427
+ // the release gate, never one issue per unit. A held unit's evidence travels with its split.
428
+ const deviceUnits = runnable.filter((id) => byUnit[id].proof.physical.length > 0)
429
+ const verification = deviceUnits.length === 0 ? [] : [{
430
+ title: 'Physical-device verification at the release gate',
431
+ units: deviceUnits,
432
+ evidence: deviceUnits.flatMap((id) => byUnit[id].proof.physical.map((e) => `#${id}: ${e}`)),
433
+ }]
434
+ const handback = [
435
+ ...(findings?.handback ?? []).map((h) => ({ what: h?.what ?? String(h), unit: h?.unit ?? null })),
436
+ ...verification.map((v) => ({ what: `${v.title} (pending): ${v.evidence.join('; ')}`, unit: null })),
437
+ ]
438
+
439
+ const runStop = reasons.some((r) => r.level === 'stop' && !r.unit) || runnable.length === 0
440
+ const verdict = runStop ? 'stop' : held.length ? 'hold' : reasons.length ? 'warn' : 'ok'
441
+ return {
442
+ verdict,
443
+ reasons,
444
+ units: unitRows,
445
+ held,
446
+ runnable,
447
+ environmentChecks: environmentChecks(units, byUnit).map((c) => ({ ...c, units: c.units.filter((u) => runnable.includes(u)) })).filter((c) => c.units.length),
448
+ verification,
449
+ longestChain: chain,
450
+ handback,
451
+ }
452
+ }
453
+
454
+ function parseArgs(argv) {
455
+ const opts = {}
456
+ for (let i = 0; i < argv.length; i += 2) {
457
+ if (argv[i] === '--exit-verdict') { opts.exitVerdict = true; i--; continue }
458
+ if (!argv[i]?.startsWith('--') || argv[i + 1] === undefined) throw new SizeCheckError('usage: size-check.mjs --plan <task-plan.json> --findings <findings.json> [--exit-verdict]')
459
+ opts[argv[i].slice(2)] = argv[i + 1]
460
+ }
461
+ if (!opts.plan || !opts.findings) throw new SizeCheckError('usage: size-check.mjs --plan <task-plan.json> --findings <findings.json> [--exit-verdict]')
462
+ return opts
463
+ }
464
+
465
+ function readJson(path, ErrorType = SizeCheckError) {
466
+ try {
467
+ return JSON.parse(readFileSync(path, 'utf8'))
468
+ } catch (error) {
469
+ throw new ErrorType(`cannot read ${path}: ${error.message}`)
470
+ }
471
+ }
472
+
473
+ const EXIT = { ok: 0, warn: 0, hold: 4, stop: 1 }
474
+
475
+ if (isMainModule(import.meta.url)) {
476
+ try {
477
+ const opts = parseArgs(process.argv.slice(2))
478
+ const plan = readJson(opts.plan)
479
+ const result = sizeCheck(plan, readJson(opts.findings, ExplorationUnfinished))
480
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`)
481
+ process.exitCode = opts.exitVerdict ? EXIT[result.verdict] : 0
482
+ } catch (error) {
483
+ if (error instanceof ExplorationUnfinished) {
484
+ // Unfinished exploration is an answer (the explorer continues), not a failure of the script.
485
+ process.stdout.write(`${JSON.stringify({ verdict: 'exploration-unfinished', reason: error.message }, null, 2)}\n`)
486
+ process.exitCode = process.argv.includes('--exit-verdict') ? 3 : 0
487
+ } else {
488
+ process.stderr.write(`${error instanceof SizeCheckError ? error.message : error.stack}\n`)
489
+ process.exitCode = 2
490
+ }
491
+ }
492
+ }