@defrex/autobuild 1.0.0-beta.3 → 1.0.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 (168) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +362 -56
  3. package/bin/ab-dispatch-generation.ts +93 -0
  4. package/docs/agent-runtimes.md +157 -0
  5. package/docs/answering-blocked-builds.md +21 -3
  6. package/docs/architecture.md +166 -7
  7. package/docs/build-store.md +123 -0
  8. package/docs/builds.md +82 -0
  9. package/docs/cli.md +48 -0
  10. package/docs/configuration-overview.md +93 -0
  11. package/docs/configuration.md +1778 -188
  12. package/docs/dispatcher-hosting.md +115 -0
  13. package/docs/dispatcher.md +59 -0
  14. package/docs/forges.md +121 -0
  15. package/docs/getting-started.md +60 -0
  16. package/docs/glossary.md +60 -0
  17. package/docs/hosted-service.md +2 -2
  18. package/docs/intake.md +48 -0
  19. package/docs/integration-overview.md +81 -0
  20. package/docs/integration-tree.md +87 -2
  21. package/docs/integration.md +54 -0
  22. package/docs/operating.md +114 -0
  23. package/docs/operator-api.md +64 -11
  24. package/docs/operator-surfaces.md +90 -0
  25. package/docs/overview.md +49 -0
  26. package/docs/plugin-authoring.md +426 -0
  27. package/docs/remote-store-protocol.md +12 -9
  28. package/docs/restacking.md +4 -1
  29. package/docs/seams.md +66 -0
  30. package/docs/setup.md +28 -6
  31. package/docs/skills.md +119 -0
  32. package/docs/spec-standard.md +23 -5
  33. package/docs/ticket-sources.md +132 -0
  34. package/docs/tickets.md +69 -0
  35. package/docs/troubleshooting.md +111 -0
  36. package/docs/upgrading.md +50 -0
  37. package/docs/verification.md +146 -0
  38. package/docs/website.md +47 -5
  39. package/docs/workspaces.md +152 -0
  40. package/package.json +5 -4
  41. package/packages/core/src/cli/artifact.ts +5 -4
  42. package/packages/core/src/cli/attention.ts +2 -0
  43. package/packages/core/src/cli/binary-direct.ts +190 -0
  44. package/packages/core/src/cli/binary-lifecycle.ts +46 -0
  45. package/packages/core/src/cli/binary.ts +24 -210
  46. package/packages/core/src/cli/build-control.ts +105 -2
  47. package/packages/core/src/cli/context.ts +41 -1
  48. package/packages/core/src/cli/dashboard/hand-pushed.ts +24 -0
  49. package/packages/core/src/cli/dashboard/handoff.ts +64 -0
  50. package/packages/core/src/cli/dashboard/integration-detail.ts +3 -0
  51. package/packages/core/src/cli/dashboard/model.ts +34 -10
  52. package/packages/core/src/cli/dashboard/render.ts +24 -2
  53. package/packages/core/src/cli/dashboard/rollback.ts +30 -0
  54. package/packages/core/src/cli/dispatch-args.ts +53 -0
  55. package/packages/core/src/cli/dispatch-crash-budget.ts +15 -0
  56. package/packages/core/src/cli/dispatch-frontend.ts +52 -5
  57. package/packages/core/src/cli/dispatch-handoff.ts +276 -0
  58. package/packages/core/src/cli/dispatch-launch-contract.ts +170 -0
  59. package/packages/core/src/cli/dispatch-launcher.ts +580 -0
  60. package/packages/core/src/cli/dispatch-parent-watch.ts +44 -0
  61. package/packages/core/src/cli/dispatch-preflight.ts +272 -0
  62. package/packages/core/src/cli/dispatch-presentation-job.ts +46 -0
  63. package/packages/core/src/cli/dispatch-presentation-ownership.ts +9 -0
  64. package/packages/core/src/cli/dispatch-process.ts +22 -90
  65. package/packages/core/src/cli/dispatch-readiness.ts +47 -0
  66. package/packages/core/src/cli/dispatch-repository-feed.ts +5 -1
  67. package/packages/core/src/cli/dispatch-runtime-cache.ts +522 -0
  68. package/packages/core/src/cli/dispatch-runtime-dependencies.ts +291 -0
  69. package/packages/core/src/cli/dispatch-runtime-use.ts +336 -0
  70. package/packages/core/src/cli/dispatch-upgrade-controller.ts +221 -0
  71. package/packages/core/src/cli/dispatch-upgrade-install.ts +258 -0
  72. package/packages/core/src/cli/dispatch-upgrade-source.ts +309 -0
  73. package/packages/core/src/cli/dispatch-upgrade-target.ts +190 -0
  74. package/packages/core/src/cli/dispatch.ts +604 -60
  75. package/packages/core/src/cli/dispatcher-liveness.ts +1 -1
  76. package/packages/core/src/cli/env.ts +1 -1
  77. package/packages/core/src/cli/harvest.ts +28 -11
  78. package/packages/core/src/cli/help.ts +10 -5
  79. package/packages/core/src/cli/installation.ts +5 -3
  80. package/packages/core/src/cli/main-checkout.ts +59 -0
  81. package/packages/core/src/cli/main.ts +15 -45
  82. package/packages/core/src/cli/node-verification-provenance.ts +97 -0
  83. package/packages/core/src/cli/repo-state.ts +3 -58
  84. package/packages/core/src/cli/repository-status.ts +67 -3
  85. package/packages/core/src/cli/runtime-spawn.ts +16 -0
  86. package/packages/core/src/cli/status.ts +57 -3
  87. package/packages/core/src/cli/upgrade-followup.ts +25 -0
  88. package/packages/core/src/cli/wait.ts +3 -0
  89. package/packages/core/src/cli/watch.ts +7 -0
  90. package/packages/core/src/config/landing.ts +8 -0
  91. package/packages/core/src/config/live.ts +1 -0
  92. package/packages/core/src/config/reference-metadata.ts +31 -0
  93. package/packages/core/src/config/reference.ts +342 -0
  94. package/packages/core/src/config/roles.ts +1 -1
  95. package/packages/core/src/config/schema.ts +352 -10
  96. package/packages/core/src/distribution-packaging.ts +116 -0
  97. package/packages/core/src/events/catalog.ts +6 -0
  98. package/packages/core/src/events/payloads.ts +53 -9
  99. package/packages/core/src/events/policy.ts +25 -0
  100. package/packages/core/src/events/repository.ts +184 -4
  101. package/packages/core/src/events/runtime.ts +16 -0
  102. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +2515 -78
  103. package/packages/core/src/kernel/dispatch-drain-recovery.ts +121 -0
  104. package/packages/core/src/kernel/dispatch-status.ts +4 -2
  105. package/packages/core/src/kernel/dispatch-upgrade.ts +171 -0
  106. package/packages/core/src/kernel/dispatcher-liveness.ts +7 -0
  107. package/packages/core/src/kernel/generators/repository-journals.ts +82 -0
  108. package/packages/core/src/kernel/guarded-forge.ts +1 -1
  109. package/packages/core/src/kernel/harvest.ts +98 -4
  110. package/packages/core/src/kernel/integration-attention.ts +20 -0
  111. package/packages/core/src/kernel/integration-state.ts +80 -11
  112. package/packages/core/src/kernel/landing-readiness.ts +6 -1
  113. package/packages/core/src/kernel/mixed-version.ts +34 -0
  114. package/packages/core/src/kernel/node-polling.ts +160 -0
  115. package/packages/core/src/kernel/read-facts.ts +40 -5
  116. package/packages/core/src/kernel/reducer-registry.ts +3 -0
  117. package/packages/core/src/kernel/reducer.ts +75 -14
  118. package/packages/core/src/kernel/service-facts.ts +11 -4
  119. package/packages/core/src/ontology.ts +2 -2
  120. package/packages/core/src/open-map.ts +3 -1
  121. package/packages/core/src/operator/presentation.ts +7 -0
  122. package/packages/core/src/operator/query.ts +6 -2
  123. package/packages/core/src/operator/registry.ts +1 -1
  124. package/packages/core/src/plugins/load.ts +4 -1
  125. package/packages/core/src/plugins/runtime-snapshot.ts +128 -0
  126. package/packages/core/src/ports/forge/contract.ts +29 -0
  127. package/packages/core/src/ports/forge/github.ts +189 -61
  128. package/packages/core/src/ports/forge-failure.ts +1 -0
  129. package/packages/core/src/ports/forge-telemetry.ts +3 -0
  130. package/packages/core/src/ports/runner/session-env.ts +1 -0
  131. package/packages/core/src/ports/types.ts +10 -0
  132. package/packages/core/src/ports/workspace/distribution-archive.ts +22 -149
  133. package/packages/core/src/ports/workspace/distribution-release.ts +56 -0
  134. package/packages/core/src/ports/workspace/git-worktree.ts +2 -1
  135. package/packages/core/src/ports/workspace/local-build-execution.ts +37 -17
  136. package/packages/core/src/processes/build-child-exit.ts +5 -26
  137. package/packages/core/src/processes/build-runner.ts +81 -11
  138. package/packages/core/src/processes/dispatcher.ts +254 -23
  139. package/packages/core/src/processes/execution-no-progress.ts +6 -0
  140. package/packages/core/src/processes/execution-relaunch.ts +30 -0
  141. package/packages/core/src/processes/execution-settlement.ts +16 -7
  142. package/packages/core/src/processes/harvest-runner.ts +328 -292
  143. package/packages/core/src/processes/process-group-reaper.ts +17 -10
  144. package/packages/core/src/runtime-identity.ts +22 -3
  145. package/packages/core/src/store/contract.ts +153 -0
  146. package/packages/core/src/store/local/store.ts +197 -72
  147. package/packages/core/src/store/reduced-reads.ts +8 -0
  148. package/packages/core/src/store/reducer-value-shapes.json +5783 -3305
  149. package/packages/core/src/store/remote/client.ts +43 -0
  150. package/packages/core/src/store/repo-state-events.ts +20 -3
  151. package/packages/core/src/store/types.ts +7 -0
  152. package/skills/finalize/SKILL.md +3 -1
  153. package/skills/guide/SKILL.md +273 -48
  154. package/skills/guide/references/integration-tree.md +87 -2
  155. package/skills/guide/references/operator-api.md +71 -14
  156. package/skills/guide/references/plugin-authoring.md +231 -266
  157. package/skills/guide/references/remote-store-protocol.md +12 -9
  158. package/skills/guide/references/restacking.md +4 -1
  159. package/skills/guide/references/setup.md +28 -6
  160. package/skills/guide/references/spec-standard.md +23 -5
  161. package/skills/harvest/SKILL.md +4 -0
  162. package/skills/harvest-review/SKILL.md +4 -0
  163. package/skills/implement/SKILL.md +4 -2
  164. package/skills/operate/SKILL.md +104 -35
  165. package/skills/plan/SKILL.md +12 -4
  166. package/skills/spec/SKILL.md +20 -2
  167. package/skills/tickets/SKILL.md +20 -1
  168. package/templates/hosted-service/package.json +2 -2
@@ -12,6 +12,7 @@
12
12
  * validated.
13
13
  */
14
14
  import { z } from 'zod'
15
+ import { documentSchema, documentFields } from './reference-metadata'
15
16
  import { landingRuleSchema } from './landing'
16
17
  export { landingRuleSchema, type LandingRule } from './landing'
17
18
  import { normalizeServiceURL } from '../connection'
@@ -66,15 +67,16 @@ function stepSection<T, C>(
66
67
  compose: (steps: string[], stepConfigs: Record<string, T>, afterReconcile: boolean) => C,
67
68
  allowAfterReconcile = false,
68
69
  ) {
69
- return z
70
+ const afterReconcileSchema = z.boolean().default(true)
71
+ const schema = z
70
72
  .unknown()
71
73
  .transform((input, ctx): C => {
72
74
  const stepConfigs: Record<string, T> = Object.create(null)
73
75
  let steps: string[] = []
74
- let afterReconcile = true
76
+ let afterReconcile = afterReconcileSchema.parse(undefined)
75
77
  for (const [key, raw] of ownEntries(input, label, ctx)) {
76
78
  if (key === 'afterReconcile' && allowAfterReconcile) {
77
- const parsed = z.boolean().safeParse(raw)
79
+ const parsed = afterReconcileSchema.safeParse(raw)
78
80
  if (parsed.success) afterReconcile = parsed.data
79
81
  else forwardIssues(parsed.error.issues, ctx, [key])
80
82
  continue
@@ -91,6 +93,26 @@ function stepSection<T, C>(
91
93
  return compose(steps, stepConfigs, afterReconcile)
92
94
  })
93
95
  .prefault({})
96
+ documentSchema(stepsSchema, {
97
+ description:
98
+ 'Ordered names of the configured step tables. Every listed step must have a table and every table must be listed.',
99
+ })
100
+ documentSchema(tableSchema, {
101
+ description:
102
+ 'Named step. Select exactly one strict variant using kind; command belongs only to check, skill only to agent.',
103
+ })
104
+ documentSchema(afterReconcileSchema, {
105
+ description:
106
+ 'Whether verification runs after reconciliation. A step override takes precedence.',
107
+ })
108
+ return documentSchema(schema, {
109
+ structure: {
110
+ kind: 'steps',
111
+ steps: stepsSchema,
112
+ table: tableSchema,
113
+ ...(allowAfterReconcile ? { afterReconcile: afterReconcileSchema } : {}),
114
+ },
115
+ })
94
116
  }
95
117
 
96
118
  // ── [pr] / [pr.imageHost] ────────────────────────────────────────────────────
@@ -98,11 +120,22 @@ function stepSection<T, C>(
98
120
  /** Optional public GitHub release used for review-window image copies.
99
121
  * Omission is intentionally `undefined`: hosting is off by default. */
100
122
  export const imageHostSchema = prImageHostSchema
123
+
124
+ documentFields(imageHostSchema, {
125
+ provider: 'Select the GitHub release adapter.',
126
+ repository: 'Public repository containing the existing review release.',
127
+ releaseId: 'Numeric id of an existing published, mutable release.',
128
+ })
101
129
  export type ImageHostConfig = z.infer<typeof imageHostSchema>
102
130
 
103
131
  export const prSchema = z.strictObject({
104
132
  imageHost: imageHostSchema.optional(),
105
133
  })
134
+
135
+ documentFields(prSchema, {
136
+ imageHost:
137
+ 'Copy attached images to a temporary public review location so they can render inline.',
138
+ })
106
139
  export type PrConfig = z.infer<typeof prSchema>
107
140
 
108
141
  // ── [workspace] ─────────────────────────────────────────────────────────────
@@ -120,6 +153,12 @@ export const vercelProvisioningStepSchema = z.strictObject({
120
153
  name: nonblankProvisioningString('provisioning step name'),
121
154
  command: nonblankProvisioningString('provisioning step command'),
122
155
  })
156
+
157
+ documentFields(vercelProvisioningStepSchema, {
158
+ name: 'Unique provisioning step name. Must contain a non-whitespace character.',
159
+ command:
160
+ 'Shell command executed in declaration order during provisioning. Must contain a non-whitespace character.',
161
+ })
123
162
  export type VercelProvisioningStep = z.infer<typeof vercelProvisioningStepSchema>
124
163
 
125
164
  const vercelUniversalImageSchema = z
@@ -136,6 +175,15 @@ export const runtimeProvisioningEntrySchema = z.strictObject({
136
175
  install: z.string().refine((value) => value.trim().length > 0, 'install must be nonblank'),
137
176
  preflight: z.string().refine((value) => value.trim().length > 0, 'preflight must be nonblank'),
138
177
  })
178
+
179
+ documentFields(runtimeProvisioningEntrySchema, {
180
+ install: 'required nonblank shell command; use an immutable package version, digest, or commit',
181
+ preflight: 'required nonblank shell command; verify the expected executable and exact version',
182
+ })
183
+ documentSchema(runtimeProvisioningEntrySchema, {
184
+ description:
185
+ 'Installation and preflight commands for an effective runtime. Every effective role or alternate runtime must have an entry.',
186
+ })
139
187
  export type RuntimeProvisioningEntry = z.infer<typeof runtimeProvisioningEntrySchema>
140
188
 
141
189
  export const runtimeProvisioningSchema = openMap(
@@ -230,6 +278,36 @@ export const vercelSandboxConfigSchema = z
230
278
  }
231
279
  }
232
280
  })
281
+
282
+ documentFields(vercelSandboxConfigSchema, {
283
+ image: 'Managed image used to provision the workspace.',
284
+ vcpus:
285
+ 'Virtual CPUs allocated to each workspace; provider account limits may further restrict allocation.',
286
+ timeoutSeconds:
287
+ 'VM/session lifetime in seconds and abrupt-orphan bound. Provider plan limits also apply.',
288
+ operationTimeoutMs:
289
+ 'Deadline in milliseconds for each provider acknowledgement, independent of session lifetime.',
290
+ snapshotExpirationSeconds:
291
+ 'Snapshot expiration in seconds. Omission uses the provider expiration policy.',
292
+ region: 'Primary region; omission uses the provider region selection.',
293
+ failoverRegions:
294
+ 'Ordered alternative regions used if the primary region cannot provision a workspace.',
295
+ environmentVariables:
296
+ 'unique API-credential variable names copied into runtime and agent/check commands',
297
+ provisioning:
298
+ 'ordered strict inline tables `{ name, command }`; names and commands are nonblank and names are unique',
299
+ runtimeProvisioning:
300
+ 'open map keyed by every effective role/alternate runtime; each entry requires `install` and `preflight`',
301
+ gitUsernameEnv:
302
+ 'optional variable name for the dedicated read-only clone username; requires `gitPasswordEnv`',
303
+ gitPasswordEnv:
304
+ 'optional variable name for the dedicated read-only clone password; requires `gitUsernameEnv`',
305
+ })
306
+ documentSchema(vercelSandboxConfigSchema, {
307
+ description: 'Strict Vercel workspace provisioning configuration.',
308
+ constraints:
309
+ 'Environment variable and failover region lists must be unique. Failovers exclude the primary region. Provisioning names must be unique. Clone credential names must be configured together, excluded from runtime environmentVariables, and separate from Forge and Vercel credentials.',
310
+ })
233
311
  type NormalizedVercelSandboxConfig = z.infer<typeof vercelSandboxConfigSchema>
234
312
  /** Direct provider construction remains source-compatible; schema-parsed
235
313
  * production config always materializes operationTimeoutMs. */
@@ -256,7 +334,21 @@ export const workspaceSchema = z.strictObject({
256
334
  '[workspace].provider must be a nonblank provider name',
257
335
  )
258
336
  .default('git-worktree'),
259
- config: openMap('[workspace.config]', z.unknown(), { keys: 'any' }),
337
+ config: openMap(
338
+ '[workspace.config]',
339
+ documentSchema(z.unknown(), {
340
+ description:
341
+ 'Plugin-owned value passed through unchanged. Builtin providers validate their own declared schema.',
342
+ }),
343
+ { keys: 'any' },
344
+ ),
345
+ })
346
+
347
+ documentFields(workspaceSchema, {
348
+ provider:
349
+ 'Select the provider used for provisioning, recovery, PR epilogue working-directory calls, and release.',
350
+ config:
351
+ 'Adapter-specific declarative configuration passed unchanged to the selected plugin factory.',
260
352
  })
261
353
  export type WorkspaceConfig = z.infer<typeof workspaceSchema>
262
354
 
@@ -329,7 +421,10 @@ export const BUILTIN_WORKSPACE_PROVIDER_CONFIG: ReadonlyMap<
329
421
  // Open map of deterministic verbs the kernel may run. `setup`, `lint`,
330
422
  // `typecheck`, `test` are conventions, not required keys (§16.1).
331
423
 
332
- export const commandsSchema = openMap('[commands]', z.string().min(1))
424
+ export const commandsSchema = openMap(
425
+ '[commands]',
426
+ documentSchema(z.string().min(1), { description: 'Named deterministic shell command.' }),
427
+ )
333
428
  export type Commands = z.infer<typeof commandsSchema>
334
429
 
335
430
  // ── [verify.<step>] ──────────────────────────────────────────────────────────
@@ -377,6 +472,11 @@ export const verifyPathGlobSchema = z.string().superRefine((pattern, ctx) => {
377
472
  if (message !== undefined) ctx.addIssue({ code: 'custom', message })
378
473
  })
379
474
 
475
+ documentSchema(verifyPathGlobSchema, {
476
+ constraints:
477
+ 'Positive repository-relative globs with literal characters, *, ?, and whole-segment ** only. No NUL, absolute paths, backslashes, negation, empty or traversal segments, character classes, brace expansion or extglobs.',
478
+ })
479
+
380
480
  const verifyApplicabilityShape = {
381
481
  afterReconcile: z.boolean().optional(),
382
482
  /** Any-match positive path selectors; absent means unconditional. */
@@ -397,6 +497,17 @@ export const verifyCheckStepSchema = z.strictObject({
397
497
  ...verifyApplicabilityShape,
398
498
  })
399
499
 
500
+ documentFields(verifyCheckStepSchema, {
501
+ kind: 'Select the strict step variant. Fields from another variant are rejected.',
502
+ command:
503
+ 'Name of an existing command in [commands]; required for check steps and forbidden for agent steps.',
504
+ afterReconcile:
505
+ 'Step override wins over `[verify].afterReconcile`; false skips this step after reconciliation only.',
506
+ paths: 'Apply only when at least one changed path matches. Available to both variants.',
507
+ always:
508
+ '`true` makes the step mandatory in plan selection and bypasses path gating. Available to both variants.',
509
+ })
510
+
400
511
  export const verifyAgentStepSchema = z.strictObject({
401
512
  /** Agent-verify: skill + verdict schema (§16.1). */
402
513
  kind: z.literal('agent'),
@@ -404,6 +515,16 @@ export const verifyAgentStepSchema = z.strictObject({
404
515
  ...verifyApplicabilityShape,
405
516
  })
406
517
 
518
+ documentFields(verifyAgentStepSchema, {
519
+ kind: 'Select the strict step variant. Fields from another variant are rejected.',
520
+ skill: 'Exact installed skill name; required for agent steps and forbidden for check steps.',
521
+ afterReconcile:
522
+ 'Step override wins over `[verify].afterReconcile`; false skips this step after reconciliation only.',
523
+ paths: 'Apply only when at least one changed path matches. Available to both variants.',
524
+ always:
525
+ '`true` makes the step mandatory in plan selection and bypasses path gating. Available to both variants.',
526
+ })
527
+
407
528
  export const verifyStepConfigSchema = z.discriminatedUnion('kind', [
408
529
  verifyCheckStepSchema,
409
530
  verifyAgentStepSchema,
@@ -441,12 +562,23 @@ export const finalizeCheckStepSchema = z.strictObject({
441
562
  command: z.string().min(1),
442
563
  })
443
564
 
565
+ documentFields(finalizeCheckStepSchema, {
566
+ kind: 'Select the strict step variant. Fields from another variant are rejected.',
567
+ command:
568
+ 'Name of an existing command in [commands]; required for check steps and forbidden for agent steps.',
569
+ })
570
+
444
571
  export const finalizeAgentStepSchema = z.strictObject({
445
572
  kind: z.literal('agent'),
446
573
  /** Exact installed skill name passed to the configured runtime. */
447
574
  skill: z.string().min(1),
448
575
  })
449
576
 
577
+ documentFields(finalizeAgentStepSchema, {
578
+ kind: 'Select the strict step variant. Fields from another variant are rejected.',
579
+ skill: 'Exact installed skill name; required for agent steps and forbidden for check steps.',
580
+ })
581
+
450
582
  export const finalizeStepConfigSchema = z.discriminatedUnion('kind', [
451
583
  finalizeCheckStepSchema,
452
584
  finalizeAgentStepSchema,
@@ -487,6 +619,14 @@ const runtimeAxesSchema = z.strictObject({
487
619
  extensions: z.array(z.string().min(1)).optional(),
488
620
  })
489
621
 
622
+ documentFields(runtimeAxesSchema, {
623
+ runtime: 'Select an agent adapter.',
624
+ model: 'Select the exact model. Codex uses unqualified `gpt-*`; Pi ids are provider-qualified.',
625
+ args: 'Ordered extra CLI argv tokens applied to every phase and tool-free one-shot invocation. A supplied list replaces, rather than unions with, the inherited list.',
626
+ extensions:
627
+ 'Compatibility-only field. Dispatch warns for each declaring role; migrate explicit runtime options to `args`.',
628
+ })
629
+
490
630
  export const roleSchema = runtimeAxesSchema.extend({
491
631
  // Wall-clock budget for each session dispatched through this logical role.
492
632
  // Absent ⇒ inherit [roles.default], then [policy].sessionBudgetSeconds.
@@ -504,11 +644,48 @@ export const roleSchema = runtimeAxesSchema.extend({
504
644
  // entry overlays the concrete role's resolved primary axes.
505
645
  alternates: z.array(runtimeAxesSchema).optional(),
506
646
  })
647
+
648
+ documentFields(roleSchema, {
649
+ runtime: 'Select an agent adapter.',
650
+ model: 'Select the exact model. Codex uses unqualified `gpt-*`; Pi ids are provider-qualified.',
651
+ args: 'Ordered extra CLI argv tokens applied to every phase and tool-free one-shot invocation. A supplied list replaces, rather than unions with, the inherited list.',
652
+ extensions:
653
+ 'Compatibility-only field. Dispatch warns for each declaring role; migrate explicit runtime options to `args`.',
654
+ sessionBudgetSeconds:
655
+ 'Active-time budget for each build phase session routed through this logical role. Suspended intervals are excluded; native continuation retains the original ceiling and accumulated active time. One budget covers the primary and every alternate target.',
656
+ alternates:
657
+ "Failure-triggered execution targets (provider failures and a runtime whose CLI is not installed). A role's list replaces the inherited list wholesale; each entry overlays that role's effective primary axes. `extensions` is accepted there only as the same deprecated no-op.",
658
+ })
659
+ documentSchema(roleSchema, {
660
+ description:
661
+ 'Named role inheriting each omitted axis from roles.default. The default role must name a registered runtime.',
662
+ })
663
+ documentSchema(roleSchema.shape.runtime, {
664
+ constraints:
665
+ 'Required on roles.default by runtime resolution; other roles inherit it. Must name a registered runtime.',
666
+ })
667
+ documentSchema(roleSchema.shape.model, {
668
+ constraints:
669
+ 'Omission inherits the base model, otherwise uses the selected runtime default. Must be compatible with that runtime.',
670
+ })
671
+ documentSchema(roleSchema.shape.args, {
672
+ constraints:
673
+ 'Omission inherits the base list, otherwise resolves to an empty list; an explicit list replaces it.',
674
+ })
675
+ documentSchema(roleSchema.shape.sessionBudgetSeconds, {
676
+ constraints:
677
+ 'Omission inherits roles.default.sessionBudgetSeconds, otherwise policy.sessionBudgetSeconds.',
678
+ })
679
+ documentSchema(roleSchema.shape.alternates, {
680
+ constraints:
681
+ 'Omission inherits the base alternate list, otherwise resolves to an empty list; each alternate overlays the resolved primary axes.',
682
+ })
507
683
  export type RoleConfig = z.infer<typeof roleSchema>
508
684
 
509
685
  // ── [policy] ─────────────────────────────────────────────────────────────────
510
686
 
511
687
  export const policySchema = z.strictObject({
688
+ upgradeDrainSeconds: z.number().int().positive().default(900),
512
689
  /** Wall-clock bound for an agent phase session; roles may override it. */
513
690
  sessionBudgetSeconds: z.number().int().positive().default(3600),
514
691
  /** Same-finding survival threshold before auto-escalate (§10, §15.4). */
@@ -527,9 +704,35 @@ export const policySchema = z.strictObject({
527
704
  harvestThreshold: z.number().int().positive().default(5),
528
705
  /** Merged builds after the oldest observation that start harvest; zero disables drift. */
529
706
  janitorFailureAttentionSeconds: z.number().int().positive().default(600),
707
+ nodeIdleAfterSeconds: z.number().int().positive().default(600),
708
+ nodeIdlePollSeconds: z.number().int().positive().default(120),
530
709
  janitorBackoffMaxSeconds: z.number().int().positive().default(300),
531
710
  harvestMaxDrift: z.number().int().nonnegative().default(3),
532
711
  })
712
+
713
+ documentFields(policySchema, {
714
+ upgradeDrainSeconds:
715
+ 'Deadline for a retiring generation, relative to handoff start; hot-reloaded during drain.',
716
+ sessionBudgetSeconds:
717
+ 'Active-time bound for each build agent session unless its logical role overrides it. Native continuation retains the original ceiling; suspension does not consume it.',
718
+ stallRounds: 'Escalate when the same review finding survives this many rounds.',
719
+ maxVerifyAttempts: 'Bound failure-driven verify \u2192 implement retry cycles.',
720
+ maxDispatchAttempts: 'Bound consecutive dispatch failures before human escalation.',
721
+ maxSetupAttempts: 'Bound consecutive workspace setup failures before human escalation.',
722
+ maxInfrastructureAttempts:
723
+ 'Bound consecutive provision/start/wait/cleanup failures before a setup-targeted policy escalation; a human `retry` answer re-arms this budget.',
724
+ maxReconcileAttempts:
725
+ 'Bound completed reconciles that leave the PR conflicted against an unchanged authoritative base. Moving-base races do not consume the bound.',
726
+ maxReviewRounds:
727
+ 'Default bound for each plan/review and implement/review convergence loop. Your agent may replace it for one parked build loop and current spec revision with `ab answer --review-round-ceiling`; other builds are unaffected.',
728
+ harvestThreshold: 'New unclaimed observation occurrences needed to start one harvest run.',
729
+ janitorFailureAttentionSeconds: 'Consecutive janitor failure duration before build attention.',
730
+ nodeIdleAfterSeconds: 'Quiet period before opened integration nodes enter idle polling.',
731
+ nodeIdlePollSeconds: 'Interval between idle node checks; durable activity wakes the next tick.',
732
+ janitorBackoffMaxSeconds: 'Cap on exponential janitor retry delay, starting at 30 seconds.',
733
+ harvestMaxDrift:
734
+ 'Other builds merged after the oldest unclaimed observation needed to start a run; `0` disables drift.',
735
+ })
533
736
  export type PolicyConfig = z.infer<typeof policySchema>
534
737
 
535
738
  // ── [tickets] ────────────────────────────────────────────────────────────────
@@ -640,6 +843,65 @@ export const ticketsInputSchema = z.strictObject({
640
843
  * still tell a defaulted dir from an explicit one. */
641
844
  dir: z.string().min(1).optional(),
642
845
  })
846
+
847
+ documentFields(ticketsInputSchema, {
848
+ url: 'Ticket service independent of [store] url and AB_STORE. Required with local builds.',
849
+ source: 'Select the ticket adapter after configured plugins load.',
850
+ readyLabels: 'Require every listed label in addition to the state gate.',
851
+ readyState: 'The one workflow state eligible for dispatch.',
852
+ readyAssignee:
853
+ 'Require the ticket to be assigned to one Linear user, in addition to the state and label gates.',
854
+ teamKey: 'Backend team key such as `"ENG"`, or an existing plugin config field.',
855
+ claimedState: 'Workflow state entered when a ticket is claimed.',
856
+ doneState: 'Project completion state and merged-ticket transition.',
857
+ createState: 'Default state for newly created tickets when `ab ticket create` omits `--state`.',
858
+ triageState: 'State used for spec-gate bounces, aborts, and closed-unmerged PRs.',
859
+ proposalState:
860
+ 'State harvest files its synthesized proposals into. Setting it to `readyState` waives the human grooming gate, not dependency eligibility.',
861
+ dir: 'Root containing file-source state directories, or an existing plugin config field. Relative file paths resolve from the repository.',
862
+ })
863
+ documentSchema(ticketsInputSchema, {
864
+ constraints:
865
+ 'readyState is required except for hosted, which resolves omission to ready. url is forbidden for file and linear; hosted URLs are normalized service URLs.',
866
+ })
867
+ documentSchema(ticketsInputSchema.shape.readyState, {
868
+ required: 'Required unless source = "hosted"; hosted omission resolves to "ready".',
869
+ })
870
+ documentSchema(ticketsInputSchema.shape.teamKey, {
871
+ required: 'Required for linear and hosted; forbidden for file; optional for plugins.',
872
+ })
873
+ documentSchema(ticketsInputSchema.shape.claimedState, { constraints: 'Forbidden for file.' })
874
+ documentSchema(ticketsInputSchema.shape.dir, { constraints: 'Forbidden for linear and hosted.' })
875
+ documentSchema(ticketsInputSchema.shape.readyAssignee, { constraints: 'Allowed only for linear.' })
876
+ documentSchema(ticketsInputSchema.shape.readyLabels, {
877
+ constraints:
878
+ 'Omission uses source readiness defaults (Linear: autobuild label; file: none). Explicit [] disables label gating.',
879
+ })
880
+ documentSchema(ticketsInputSchema.shape.url, {
881
+ constraints:
882
+ 'Forbidden for file and linear. Hosted omission uses the selected remote BuildStore URL; with a local BuildStore an explicit hosted URL is required.',
883
+ })
884
+ documentSchema(ticketsInputSchema.shape.doneState, {
885
+ constraints: 'Hosted resolution uses done when omitted.',
886
+ })
887
+ documentSchema(ticketsInputSchema.shape.claimedState, {
888
+ constraints:
889
+ 'Forbidden for file. Resolution uses In Progress for direct Linear, doing for hosted.',
890
+ })
891
+ documentSchema(ticketsInputSchema.shape.createState, {
892
+ constraints: 'Omission uses the source creation state (Linear team default; file Triage).',
893
+ })
894
+ documentSchema(ticketsInputSchema.shape.triageState, {
895
+ constraints:
896
+ 'Omission resolves to Backlog for Linear, triage for hosted, Triage for file/plugin sources.',
897
+ })
898
+ documentSchema(ticketsInputSchema.shape.proposalState, {
899
+ constraints: 'Omission uses the resolved triageState.',
900
+ })
901
+ documentSchema(ticketsInputSchema.shape.dir, {
902
+ constraints:
903
+ 'Forbidden for linear and hosted. File omission resolves to the selected local state root tickets directory; plugin omission remains omitted.',
904
+ })
643
905
  export const ticketsSchema = ticketsInputSchema
644
906
  .superRefine((tickets, ctx) => {
645
907
  if (tickets.source === 'hosted' && tickets.url !== undefined) {
@@ -670,6 +932,11 @@ export const ticketsSchema = ticketsInputSchema
670
932
  ? { url: normalizeServiceURL(tickets.url, 'tickets.url') }
671
933
  : {}),
672
934
  }))
935
+
936
+ documentSchema(ticketsSchema, {
937
+ constraints:
938
+ 'readyState is required except for hosted, whose omitted value resolves to ready. url is forbidden for file and linear; hosted URLs must be absolute HTTPS (loopback HTTP allowed), without credentials, query or fragment, and are normalized.',
939
+ })
673
940
  export type TicketsConfig = z.infer<typeof ticketsSchema>
674
941
 
675
942
  // ── [orchestrator] ──────────────────────────────────────────────────────────
@@ -689,6 +956,17 @@ export const orchestratorSandboxSchema = z.strictObject({
689
956
  * config error. Unset means none. */
690
957
  environmentVariables: z.array(z.string().min(1)).default([]),
691
958
  })
959
+
960
+ documentFields(orchestratorSandboxSchema, {
961
+ idleMinutes:
962
+ "Minutes without a sandbox tool call after which the dispatcher tick's janitor stops the environment, keeping its snapshot; the next tool call resumes it.",
963
+ environmentVariables:
964
+ 'Names of non-secret host variables forwarded into the sandbox \u2014 the only non-toolchain environment it ever sees, during provisioning/setup and tool exec/start alike. Unset means none.',
965
+ })
966
+ documentSchema(orchestratorSandboxSchema.shape.environmentVariables, {
967
+ constraints:
968
+ 'When enabled, forwarding store, forge, ticket-provider, model or Vercel credentials, or builtin-provider forbidden names, is rejected.',
969
+ })
692
970
  export type OrchestratorSandboxConfig = z.infer<typeof orchestratorSandboxSchema>
693
971
 
694
972
  /** The turn runner lives inside the hosted operator route and the dispatcher
@@ -715,12 +993,12 @@ const ORCHESTRATOR_APPROVAL_ENTRY = /^[a-z][a-z0-9_.]*(:[a-z0-9_-]+)?$/
715
993
 
716
994
  /** The attention set a new session's wake settings inherit when the
717
995
  * repository does not override `wake`: the build events an operator or agent
718
- * must wake up for (the same set `ab watch` filters on by default) plus the
719
- * repository-journal attention events (the same set `ab watch`
720
- * follows), spelled as literal globs. Both halves of the attention set can
721
- * wake a session. */
996
+ * must wake up for, spelled as literal globs. These legacy hosted defaults
997
+ * remain independent of CLI watch defaults; failed node verification belongs
998
+ * to both. Repository-journal attention can also wake a session. */
722
999
  export const defaultOrchestratorWakeGlobs: readonly string[] = [
723
1000
  'escalation.raised',
1001
+ 'integration.verification-failed',
724
1002
  'phase.deferral-escalated',
725
1003
  'phase.failed',
726
1004
  'infrastructure.failed',
@@ -794,6 +1072,29 @@ export const orchestratorSchema = z.strictObject({
794
1072
  * `ab watch` compiler. */
795
1073
  wake: z.array(z.string().min(1)).optional(),
796
1074
  })
1075
+
1076
+ documentFields(orchestratorSchema, {
1077
+ enabled:
1078
+ 'Master gate. With the table absent or `enabled = false`, the sandbox tools are absent from every binding, no environment is ever provisioned, and no dispatcher tick or message post ever runs orchestrator code \u2014 a local dispatcher is inert even when enabled, because the turn runner exists only in the hosted deployment.',
1079
+ sandbox: 'Sandbox behavior knobs.',
1080
+ model:
1081
+ "Provider-qualified model string for the turn runner, in the same vocabulary as `[roles]` model strings (a leading `vercel-ai-gateway/` prefix is accepted and stripped). Resolved through the deployment's gateway credential.",
1082
+ invocationBudgetSeconds:
1083
+ 'Wall-clock budget in seconds for one turn invocation. Values above the route limit are clamped after parsing.',
1084
+ approvals:
1085
+ "Registry tool names whose calls suspend a turn until you answer. Empty (`[]`) means none \u2014 autonomous operation. An entry naming an absent or unknown tool is **inert by design**, never a config error: the list stays stable while the registry grows, and a tool's removal cannot break parsing. A `tool:qualifier` entry applies to the named discriminator value only (for example `tickets.move:ready` approves moving a ticket to `ready`); for a tool without a discriminator, only the bare form matches.",
1086
+ wake: 'The attention events a **new** session wakes for. Kept schema-optional so absent (inherit the legacy hosted wake set including `integration.verification-failed`, independently of CLI watch defaults) and `[]` (never wake; message-only) stay distinct. Each glob must match at least one build or repository-journal event type, validated with the same compiler `ab watch` uses. Existing sessions never retroactively inherit; an explicit `PUT .../wake` always wins.',
1087
+ })
1088
+ documentSchema(orchestratorSchema.shape.model, {
1089
+ required: 'Required when orchestrator.enabled = true.',
1090
+ })
1091
+ documentSchema(orchestratorSchema.shape.invocationBudgetSeconds, {
1092
+ constraints: `Values above ${ORCHESTRATOR_ROUTE_LIMIT_SECONDS} are clamped to that limit after parsing.`,
1093
+ })
1094
+ documentSchema(orchestratorSchema.shape.wake, {
1095
+ constraints:
1096
+ 'Every glob must match a known build or repository-journal event. Omission inherits the legacy hosted wake set independently of CLI watch defaults; [] disables waking.',
1097
+ })
797
1098
  export type OrchestratorConfig = z.infer<typeof orchestratorSchema>
798
1099
 
799
1100
  // ── Whole file ───────────────────────────────────────────────────────────────
@@ -808,8 +1109,17 @@ export const storeSchema = z.strictObject({
808
1109
  }
809
1110
  }),
810
1111
  })
811
- const configRootSchema = z.strictObject({
1112
+
1113
+ documentFields(storeSchema, {
1114
+ url: 'Absolute HTTPS service base URL; loopback HTTP is allowed for development. No credentials, query or fragment. Trailing slashes are normalized.',
1115
+ })
1116
+ documentSchema(storeSchema.shape.url, {
1117
+ constraints:
1118
+ 'Absolute HTTPS service URL; loopback HTTP allowed. No credentials, query or fragment. Trailing slashes normalized.',
1119
+ })
1120
+ export const configRootSchema = z.strictObject({
812
1121
  store: storeSchema.optional(),
1122
+ upgrade: z.strictObject({ automatic: z.boolean().default(true) }).prefault({}),
813
1123
  /** Base branch builds cut from and target (§16.1). */
814
1124
  baseBranch: z.string().min(1).default('main'),
815
1125
  /** Concurrent builds for this repository (§16.1). */
@@ -854,6 +1164,38 @@ const configRootSchema = z.strictObject({
854
1164
  } as z.input<typeof ticketsSchema>),
855
1165
  })
856
1166
 
1167
+ documentFields(configRootSchema, {
1168
+ store: 'Optional remote BuildStore connection. Credentials live outside TOML.',
1169
+ upgrade: 'Automatic dispatcher runtime target checks and adoption.',
1170
+ baseBranch: 'Branch used to cut builds, target PRs, and merge during reconciliation.',
1171
+ capacity:
1172
+ 'Concurrent occupied slots for this repository. Paused and blocked work retains slots. Node reconcile and verification exclude their own blocked/paused descendants at admission; new claims use total occupancy. See [integration capacity](integration-tree.md).',
1173
+ ticketScanIntervalSeconds:
1174
+ 'Ticket-source ready scan cadence; tick spacing is the effective minimum.',
1175
+ forge:
1176
+ 'Forge adapter name. Shipped values are `github` and `local-git`; configured plugins may register other names.',
1177
+ plugins:
1178
+ 'Trusted Bun plugin modules loaded by dispatch, `ab ticket`, and scoped phase CLI processes.',
1179
+ landing: 'Ordered landing rules; the first matching rule controls consent.',
1180
+ pr: 'Pull request review image hosting configuration.',
1181
+ workspace: 'Workspace provider selector and provider-specific configuration.',
1182
+ commands: 'Named shell commands used by setup and deterministic checks.',
1183
+ verify: 'Ordered verification steps and applicability rules.',
1184
+ finalize: 'Ordered post-PR steps. Failures are recorded without blocking the PR.',
1185
+ roles: 'Named agent roles. The reserved default role provides inherited runtime axes.',
1186
+ policy: 'Lifecycle budgets, retries, convergence and harvest limits.',
1187
+ orchestrator:
1188
+ 'Operator-agent sandbox settings. This table does not start or host an operator agent.',
1189
+ tickets:
1190
+ 'Ticket source and lifecycle vocabulary. Omitting the table supplies source=file but still requires readyState.',
1191
+ })
1192
+ documentSchema(configRootSchema.shape.upgrade.unwrap().shape.automatic, {
1193
+ description: 'Check and adopt changed runtime targets automatically.',
1194
+ })
1195
+ documentSchema(configRootSchema.shape.plugins, {
1196
+ constraints: 'Exact module specifiers must be unique.',
1197
+ })
1198
+
857
1199
  /** Root metadata keeps strict error prose and documentation coverage honest. */
858
1200
  export const TOP_LEVEL_SCALARS = [
859
1201
  'baseBranch',
@@ -0,0 +1,116 @@
1
+ import { cp, mkdir, mkdtemp, readdir, readFile, rm, writeFile } from 'node:fs/promises'
2
+ import { tmpdir } from 'node:os'
3
+ import { dirname, join } from 'node:path'
4
+
5
+ async function spawnExec(cmd: string[], options: { cwd: string; signal?: AbortSignal }) {
6
+ const child = Bun.spawn(cmd, {
7
+ cwd: options.cwd,
8
+ stdout: 'pipe',
9
+ stderr: 'pipe',
10
+ signal: options.signal,
11
+ })
12
+ const [exitCode, stdout, stderr] = await Promise.all([
13
+ child.exited,
14
+ new Response(child.stdout).text(),
15
+ new Response(child.stderr).text(),
16
+ ])
17
+ return { exitCode, stdout, stderr }
18
+ }
19
+
20
+ type PackagingExec = typeof spawnExec
21
+
22
+ async function execOrThrow(
23
+ cmd: string[],
24
+ cwd: string,
25
+ exec: PackagingExec,
26
+ signal?: AbortSignal,
27
+ ): Promise<string> {
28
+ const result = await exec(cmd, { cwd, signal })
29
+ if (result.exitCode !== 0) {
30
+ throw new Error(
31
+ `${cmd.join(' ')} exited ${result.exitCode}: ${result.stderr.trim() || result.stdout.trim()}`,
32
+ )
33
+ }
34
+ return result.stdout.trim()
35
+ }
36
+
37
+ /** Manifest fields that name repo-local packaging state and must never reach
38
+ * the packed distribution manifest. `patchedDependencies` entries are resolved
39
+ * by bun against the consuming project's root, and bun 1.4.0 panics
40
+ * (`Option::unwrap`, exit 134) when a consumed manifest declares a patch for a
41
+ * package the consumer tree contains — so a packed manifest carrying the
42
+ * repo's better-auth patch declaration breaks any consumer that installs
43
+ * autobuild next to better-auth. The packed artifact ships no patched
44
+ * package, so the declaration is stripped from the packed manifest while the
45
+ * repo manifest keeps it for workspace installs. The strip is an enforced
46
+ * invariant, not a local detail: the `patchedDependencies` rule in
47
+ * `tools/workspace-manifest-check.ts` rejects a root manifest whose packed
48
+ * dependency set contains a patched package, and the negative control in
49
+ * `packages/core/src/plugin-sdk/package.test.ts` (the packed-distribution
50
+ * better-auth canary) pins the consumed-manifest failure shape this strip
51
+ * guards, so removing the field from this list fails the suite loudly.
52
+ *
53
+ * `devDependencies` is stripped for two reasons. First, the workspace link
54
+ * specifiers it may carry (for example the root's
55
+ * `@defrex/autobuild-postgres-store: workspace:*`) cannot be resolved in the
56
+ * staging tree — it stages only the manifest's `files` set, with no
57
+ * `bun.lock`, no `node_modules`, and no workspace packages — so `bun pm pack`
58
+ * fails there with "Failed to resolve workspace version". Second, the guest
59
+ * installs the distribution with `bun install --production --ignore-scripts`,
60
+ * which ignores devDependencies entirely; the packed artifact ships no
61
+ * dev-only tooling, so the declaration is dead weight in the packed manifest
62
+ * while the repo manifest keeps it for workspace installs. */
63
+ const packedManifestOmittedFields = ['patchedDependencies', 'devDependencies'] as const
64
+
65
+ export async function packageDistribution(
66
+ root: string,
67
+ exec: PackagingExec = spawnExec,
68
+ signal?: AbortSignal,
69
+ ): Promise<Uint8Array> {
70
+ const staging = await mkdtemp(join(tmpdir(), 'autobuild-pack-staging-'))
71
+ const destination = await mkdtemp(join(tmpdir(), 'autobuild-pack-'))
72
+ try {
73
+ // Pack from a staging copy of the repo's `files` set rather than the repo
74
+ // root: the packed manifest must differ from the repo manifest (above), and
75
+ // rewriting the repo manifest in place would leave a window where tracked
76
+ // files are dirty.
77
+ const manifestPath = join(root, 'package.json')
78
+ const manifest = JSON.parse(await readFile(manifestPath, 'utf8')) as Record<string, unknown>
79
+ const files = manifest.files
80
+ if (!Array.isArray(files) || files.some((entry) => typeof entry !== 'string')) {
81
+ throw new Error(
82
+ 'Autobuild packaging requires the root package.json to list its files as an array of paths',
83
+ )
84
+ }
85
+ for (const entry of files as string[]) {
86
+ // npm `files` entries may be negated globs (for example
87
+ // `!packages/core/src/**/*.test.ts`, which keeps test files out of the
88
+ // published package). Only positive entries name a path to stage: the
89
+ // negations stay in the staged manifest and `bun pm pack` applies them,
90
+ // so the packed set still excludes those paths.
91
+ if (entry.startsWith('!')) continue
92
+ const target = join(staging, entry)
93
+ await mkdir(dirname(target), { recursive: true })
94
+ await cp(join(root, entry), target, {
95
+ recursive: true,
96
+ errorOnExist: true,
97
+ force: false,
98
+ })
99
+ }
100
+ for (const field of packedManifestOmittedFields) delete manifest[field]
101
+ await writeFile(join(staging, 'package.json'), `${JSON.stringify(manifest, null, 2)}\n`)
102
+ await execOrThrow(
103
+ ['bun', 'pm', 'pack', '--ignore-scripts', '--destination', destination],
104
+ staging,
105
+ exec,
106
+ signal,
107
+ )
108
+ const archives = (await readdir(destination)).filter((name) => name.endsWith('.tgz'))
109
+ if (archives.length !== 1)
110
+ throw new Error('Autobuild packaging did not produce exactly one archive')
111
+ return new Uint8Array(await readFile(join(destination, archives[0]!)))
112
+ } finally {
113
+ await rm(staging, { recursive: true, force: true })
114
+ await rm(destination, { recursive: true, force: true })
115
+ }
116
+ }