@defrex/autobuild 1.4.2 → 1.6.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.
- package/README.md +1 -1
- package/SPEC.md +512 -101
- package/bin/ab-dispatch-kernel.ts +1 -0
- package/docs/accounts.md +9 -0
- package/docs/agent-runtimes.md +1 -0
- package/docs/answering-blocked-builds.md +7 -3
- package/docs/architecture.md +313 -130
- package/docs/assets/headline-wide.png +0 -0
- package/docs/build-store.md +33 -3
- package/docs/cli.md +2 -1
- package/docs/configuration-overview.md +9 -0
- package/docs/configuration.md +217 -106
- package/docs/dispatcher-hosting.md +19 -3
- package/docs/dispatcher.md +11 -6
- package/docs/glossary.md +1 -1
- package/docs/integration-overview.md +2 -2
- package/docs/integration-tree.md +91 -28
- package/docs/merge-policy.md +28 -9
- package/docs/operating.md +1 -1
- package/docs/operator-api.md +57 -20
- package/docs/operator-surfaces.md +1 -1
- package/docs/plugin-authoring.md +89 -8
- package/docs/remote-store-protocol.md +39 -11
- package/docs/remote-ticket-protocol.md +126 -12
- package/docs/restacking.md +24 -6
- package/docs/seams.md +2 -2
- package/docs/setup.md +19 -13
- package/docs/spec-standard.md +2 -1
- package/docs/ticket-dependencies.md +26 -8
- package/docs/ticket-migration.md +70 -7
- package/docs/ticket-sources.md +82 -5
- package/docs/tickets.md +34 -2
- package/docs/troubleshooting.md +3 -3
- package/docs/verification.md +5 -5
- package/docs/website.md +8 -0
- package/docs/workspaces.md +1 -1
- package/package.json +4 -3
- package/packages/core/src/accounts/hosted-readiness.ts +21 -0
- package/packages/core/src/cli/attention.ts +3 -0
- package/packages/core/src/cli/build-control.ts +36 -12
- package/packages/core/src/cli/connect.ts +9 -18
- package/packages/core/src/cli/context.ts +44 -0
- package/packages/core/src/cli/dashboard/configuration.ts +11 -0
- package/packages/core/src/cli/dashboard/model.ts +51 -11
- package/packages/core/src/cli/dashboard/poll.ts +14 -0
- package/packages/core/src/cli/dashboard/queue.ts +21 -0
- package/packages/core/src/cli/dashboard/render.ts +43 -22
- package/packages/core/src/cli/dispatch-frontend.ts +63 -30
- package/packages/core/src/cli/dispatch-mode.ts +35 -16
- package/packages/core/src/cli/dispatch-preflight.ts +4 -1
- package/packages/core/src/cli/dispatch-repository-feed.ts +40 -11
- package/packages/core/src/cli/dispatch-tickets.ts +47 -0
- package/packages/core/src/cli/dispatch-upgrade-controller.ts +3 -0
- package/packages/core/src/cli/dispatch.ts +522 -145
- package/packages/core/src/cli/help.ts +63 -24
- package/packages/core/src/cli/init-hosted-accounts.ts +54 -0
- package/packages/core/src/cli/init-readiness-remote.ts +16 -3
- package/packages/core/src/cli/init-validation.ts +144 -42
- package/packages/core/src/cli/issue-links.ts +67 -0
- package/packages/core/src/cli/main.ts +32 -15
- package/packages/core/src/cli/pr-summary-publication.ts +38 -7
- package/packages/core/src/cli/publication-settlement.ts +36 -24
- package/packages/core/src/cli/repo-lease.ts +225 -0
- package/packages/core/src/cli/repository-status.ts +203 -49
- package/packages/core/src/cli/status.ts +42 -4
- package/packages/core/src/cli/terminals.ts +37 -2
- package/packages/core/src/cli/ticket-editor.ts +20 -6
- package/packages/core/src/cli/ticket.ts +264 -46
- package/packages/core/src/cli/triage-count-sampler.ts +59 -0
- package/packages/core/src/cli/wait.ts +4 -1
- package/packages/core/src/cli/watch.ts +19 -4
- package/packages/core/src/config/live.ts +45 -4
- package/packages/core/src/config/load.ts +9 -0
- package/packages/core/src/config/pipeline-source.ts +6 -2
- package/packages/core/src/config/ready-assignee.ts +86 -0
- package/packages/core/src/config/schema.ts +202 -38
- package/packages/core/src/distribution-packaging.ts +1 -1
- package/packages/core/src/events/catalog.ts +7 -0
- package/packages/core/src/events/compatibility.ts +2 -1
- package/packages/core/src/events/payloads.ts +85 -0
- package/packages/core/src/events/policy.ts +10 -0
- package/packages/core/src/events/repository.ts +93 -28
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +237 -230
- package/packages/core/src/kernel/build-identity.ts +12 -0
- package/packages/core/src/kernel/change-presence.ts +139 -6
- package/packages/core/src/kernel/dispatch-capacity.ts +189 -19
- package/packages/core/src/kernel/dispatch-status.ts +10 -1
- package/packages/core/src/kernel/dispatch-upgrade.ts +104 -5
- package/packages/core/src/kernel/engine.ts +17 -8
- package/packages/core/src/kernel/finalize-pr-rejection.ts +95 -0
- package/packages/core/src/kernel/generators/build-log.ts +9 -0
- package/packages/core/src/kernel/generators/repository-journals.ts +15 -1
- package/packages/core/src/kernel/harvest.ts +4 -1
- package/packages/core/src/kernel/incremental-fixtures.ts +1 -0
- package/packages/core/src/kernel/integration-completeness.ts +104 -17
- package/packages/core/src/kernel/integration-landing.ts +17 -0
- package/packages/core/src/kernel/integration-state.ts +17 -0
- package/packages/core/src/kernel/issue-keywords.ts +202 -0
- package/packages/core/src/kernel/janitor-failure.ts +96 -5
- package/packages/core/src/kernel/kernel-git.ts +87 -0
- package/packages/core/src/kernel/landing-readiness.ts +25 -17
- package/packages/core/src/kernel/leaf-restack-state.ts +4 -2
- package/packages/core/src/kernel/log-index.ts +1 -1
- package/packages/core/src/kernel/node-issue-links.ts +142 -0
- package/packages/core/src/kernel/node-landing.ts +2 -1
- package/packages/core/src/kernel/node-parent.ts +6 -0
- package/packages/core/src/kernel/node-restack-transaction.ts +2 -0
- package/packages/core/src/kernel/pr-summary.ts +24 -0
- package/packages/core/src/kernel/read-deferrals.ts +75 -12
- package/packages/core/src/kernel/read-facts.ts +32 -1
- package/packages/core/src/kernel/reconcile-restack.ts +1 -1
- package/packages/core/src/kernel/reducer-registry.ts +37 -2
- package/packages/core/src/kernel/reducer.ts +147 -5
- package/packages/core/src/kernel/ticket-preparation.ts +16 -0
- package/packages/core/src/kernel/verify-budget.ts +43 -0
- package/packages/core/src/operator/index.ts +3 -1
- package/packages/core/src/operator/presentation.ts +3 -0
- package/packages/core/src/operator/protocol.ts +38 -2
- package/packages/core/src/operator/query.ts +69 -29
- package/packages/core/src/operator/registry.ts +47 -26
- package/packages/core/src/operator/tickets.ts +77 -10
- package/packages/core/src/plugin-sdk/index.ts +13 -0
- package/packages/core/src/plugins/manifest.ts +1 -1
- package/packages/core/src/plugins/registry.ts +1 -0
- package/packages/core/src/ports/forge/contract.ts +69 -0
- package/packages/core/src/ports/forge/create.ts +5 -0
- package/packages/core/src/ports/forge/fake.ts +184 -3
- package/packages/core/src/ports/forge/git-rewrite.ts +4 -2
- package/packages/core/src/ports/forge/github.ts +175 -38
- package/packages/core/src/ports/forge/local-git.ts +14 -0
- package/packages/core/src/ports/forge/readiness.ts +10 -0
- package/packages/core/src/ports/forge-failure.ts +43 -0
- package/packages/core/src/ports/runner/claude.ts +7 -1
- package/packages/core/src/ports/runner/codex.ts +7 -2
- package/packages/core/src/ports/runner/native-cli-fixture.ts +2 -1
- package/packages/core/src/ports/runner/pi.ts +7 -1
- package/packages/core/src/ports/runner/runtime.ts +3 -0
- package/packages/core/src/ports/runner/start-prompt.ts +37 -0
- package/packages/core/src/ports/tickets/contract.ts +320 -7
- package/packages/core/src/ports/tickets/create.ts +89 -20
- package/packages/core/src/ports/tickets/fake.ts +18 -0
- package/packages/core/src/ports/tickets/file-codec.ts +20 -0
- package/packages/core/src/ports/tickets/file.ts +43 -1
- package/packages/core/src/ports/tickets/github-fake.ts +1123 -0
- package/packages/core/src/ports/tickets/github-issues.ts +431 -0
- package/packages/core/src/ports/tickets/github-validators.ts +194 -0
- package/packages/core/src/ports/tickets/github.ts +2029 -0
- package/packages/core/src/ports/tickets/hosted-index.ts +34 -3
- package/packages/core/src/ports/tickets/issue-links.ts +86 -0
- package/packages/core/src/ports/tickets/lifecycle.ts +60 -4
- package/packages/core/src/ports/tickets/linear.ts +66 -6
- package/packages/core/src/ports/tickets/migration.ts +290 -68
- package/packages/core/src/ports/tickets/operations.ts +98 -12
- package/packages/core/src/ports/tickets/priority.ts +55 -0
- package/packages/core/src/ports/tickets/remote-protocol.ts +195 -29
- package/packages/core/src/ports/tickets/remote.ts +188 -13
- package/packages/core/src/ports/tickets/revision.ts +22 -1
- package/packages/core/src/ports/tickets/states.ts +43 -0
- package/packages/core/src/ports/tickets/tree.ts +58 -12
- package/packages/core/src/ports/tickets/update.ts +12 -2
- package/packages/core/src/ports/types.ts +194 -9
- package/packages/core/src/ports/workspace/commit-preservation.ts +163 -25
- package/packages/core/src/ports/workspace/git-worktree.ts +6 -2
- package/packages/core/src/ports/workspace/harvest-execution.ts +4 -2
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +121 -27
- package/packages/core/src/processes/build-runner.ts +101 -22
- package/packages/core/src/processes/dispatcher.ts +1046 -372
- package/packages/core/src/processes/execution-no-progress.ts +7 -0
- package/packages/core/src/processes/harvest-child.ts +4 -2
- package/packages/core/src/processes/harvest-execution-state.ts +104 -0
- package/packages/core/src/processes/harvest-runner.ts +263 -25
- package/packages/core/src/processes/harvest.ts +5 -8
- package/packages/core/src/processes/tick-publication.ts +12 -2
- package/packages/core/src/processes/ticket-scan-schedule.ts +78 -0
- package/packages/core/src/processes/workspace-preservation.ts +36 -1
- package/packages/core/src/runtime-identity.ts +10 -2
- package/packages/core/src/scenarios/harness.ts +149 -35
- package/packages/core/src/store/adapter.ts +7 -1
- package/packages/core/src/store/contract.ts +83 -2
- package/packages/core/src/store/digest.ts +32 -1
- package/packages/core/src/store/reduced-reads.ts +10 -0
- package/packages/core/src/store/reducer-value-shapes.json +4471 -3427
- package/packages/core/src/store/remote/protocol.ts +2 -0
- package/packages/core/src/store/remote/released-clients.json +22 -0
- package/packages/core/src/store/remote/released-reducer-values/1.5.0.json +26924 -0
- package/packages/core/src/store/remote/released-reducer-values/1.6.0.json +27173 -0
- package/packages/core/src/store/remote/released-reducer-values/index.ts +4 -0
- package/packages/core/src/store/repo-state-events.ts +2 -0
- package/packages/core/src/store/types.ts +5 -0
- package/packages/core/src/testing/dispatch-read-budget.ts +729 -123
- package/packages/core/src/testing/index.ts +18 -1
- package/packages/core/src/testing/presence-history.ts +79 -0
- package/packages/core/src/testing/reduced-read-budget.ts +1424 -33
- package/packages/core/src/testing/upgrade-generations.ts +77 -0
- package/skills/code-review/SKILL.md +4 -3
- package/skills/finalize/SKILL.md +18 -2
- package/skills/guide/SKILL.md +417 -143
- package/skills/guide/references/accounts.md +9 -0
- package/skills/guide/references/integration-tree.md +91 -28
- package/skills/guide/references/merge-policy.md +28 -9
- package/skills/guide/references/operator-api.md +57 -20
- package/skills/guide/references/plugin-authoring.md +89 -8
- package/skills/guide/references/remote-store-protocol.md +39 -11
- package/skills/guide/references/remote-ticket-protocol.md +126 -12
- package/skills/guide/references/restacking.md +24 -6
- package/skills/guide/references/setup.md +19 -13
- package/skills/guide/references/spec-standard.md +2 -1
- package/skills/guide/references/ticket-dependencies.md +26 -8
- package/skills/guide/references/ticket-migration.md +70 -7
- package/skills/harvest-review/SKILL.md +4 -3
- package/skills/implement/SKILL.md +20 -1
- package/skills/operate/SKILL.md +149 -35
- package/skills/plan/SKILL.md +1 -1
- package/skills/reconcile/SKILL.md +5 -4
- package/skills/spec/SKILL.md +15 -2
- package/skills/tickets/SKILL.md +116 -37
- package/templates/autobuild.toml +5 -0
- package/templates/hosted-service/package.json +2 -2
|
@@ -201,17 +201,17 @@ export const HELP_CATALOG: readonly HelpEntry[] = [
|
|
|
201
201
|
detail: page([
|
|
202
202
|
'Usage:',
|
|
203
203
|
' ab ticket tree [--json]',
|
|
204
|
-
' ab ticket create <title> --body <file> [--state <state>] [--labels a,b] [--blocked-by id,id] [--kind work|node] [--target <id> | --no-target] [--json]',
|
|
204
|
+
' ab ticket create <title> --body <file> [--state <state>] [--labels a,b] [--blocked-by id,id] [--issues N[:refs],...] [--priority urgent|normal] [--kind work|node] [--target <id> | --no-target] [--json]',
|
|
205
205
|
' ab ticket edit <id>',
|
|
206
206
|
' ab ticket export <dir> [--store <ref>]',
|
|
207
|
-
' ab ticket import <dir> [--store <ref>]',
|
|
207
|
+
' ab ticket import <dir> [--states <state,...>] [--store <ref>]',
|
|
208
208
|
' ab ticket migration record <dir> [--store <ref>]',
|
|
209
|
-
' ab ticket update <id> [--kind work|node] [--target <id> | --no-target] [--title <title>] [--body <file>] [--labels a,b] [--expected-revision <opaque>] [--json]',
|
|
209
|
+
' ab ticket update <id> [--kind work|node] [--target <id> | --no-target] [--title <title>] [--body <file>] [--labels a,b] [--issues N[:refs],...] [--priority urgent|normal] [--expected-revision <opaque>] [--json]',
|
|
210
210
|
' ab ticket block <id> <blocker-id[,blocker-id...]> [--expected-revision <opaque>] [--json]',
|
|
211
211
|
' ab ticket unblock <id> <blocker-id[,blocker-id...]> [--expected-revision <opaque>] [--json]',
|
|
212
212
|
' ab ticket list [--state <state>] [--labels a,b] [--json]',
|
|
213
213
|
' ab ticket show <id> [--store <ref>] [--json]',
|
|
214
|
-
' ab ticket move <id> <state> [--expected-revision <opaque>] [--json]',
|
|
214
|
+
' ab ticket move <id> (<state> | --role triage|ready|backlog|rejected) [--expected-revision <opaque>] [--json]',
|
|
215
215
|
' ab ticket states [--json]',
|
|
216
216
|
' ab ticket state create <name> [--about <text>] [--json]',
|
|
217
217
|
' ab ticket attach <id> <kind> <path> [--name <name>] [--store <ref>] [--json]',
|
|
@@ -220,7 +220,7 @@ export const HELP_CATALOG: readonly HelpEntry[] = [
|
|
|
220
220
|
'',
|
|
221
221
|
'Operate on the configured [tickets] source (§8.8); commands run outside sessions.',
|
|
222
222
|
'Every JSON ticket read includes an opaque revision. update, move, block and',
|
|
223
|
-
'unblock accept --expected-revision to refuse stale writes. Linear
|
|
223
|
+
'unblock accept --expected-revision to refuse stale writes. Linear and GitHub refuse checks.',
|
|
224
224
|
'edit opens VISUAL or EDITOR, checks the opening revision, and preserves failed buffers.',
|
|
225
225
|
`create files a ticket and may establish initial blockers.
|
|
226
226
|
--kind work|node declares a ticket's kind; work is the default. --target <id>
|
|
@@ -235,9 +235,18 @@ These fields describe intent; dispatch and merge behavior are unchanged.`,
|
|
|
235
235
|
'"" clears labels, and update never changes state. block and unblock accept',
|
|
236
236
|
'comma-separated blocker ids and are idempotent. Every id is validated before',
|
|
237
237
|
'any relationship is written, so an invalid list leaves the ticket unchanged.',
|
|
238
|
+
'--issues records forge issues the ticket addresses: N (closes, the default)',
|
|
239
|
+
'or N:refs for partial work, comma-separated. On update it replaces the set',
|
|
240
|
+
'and --issues "" clears it. Sources that cannot store issue links refuse the',
|
|
241
|
+
'write, name the source, and write nothing.',
|
|
242
|
+
'--priority urgent dispatches the ticket before normal ready work, each class',
|
|
243
|
+
'in source order; it never preempts a running build. normal (the default)',
|
|
244
|
+
'removes urgency. Sources that cannot store priority refuse urgent, name the',
|
|
245
|
+
'source, and write nothing; normal is a no-op there.',
|
|
238
246
|
'',
|
|
239
247
|
'With no list filters, list uses the same ready criteria as dispatch. show one ticket, including its body/spec.',
|
|
240
|
-
'Human output is the default. --json emits exactly
|
|
248
|
+
'Human output is the default and marks urgent tickets. --json emits exactly',
|
|
249
|
+
'one bare value, and every JSON ticket names its priority: Ticket[]',
|
|
241
250
|
'for list, the hierarchy for tree, and the resulting Ticket for ticket mutations; show',
|
|
242
251
|
'adds an assets array (kind, name, revision, size, layout, fileCount).',
|
|
243
252
|
'',
|
|
@@ -252,20 +261,31 @@ These fields describe intent; dispatch and merge behavior are unchanged.`,
|
|
|
252
261
|
'its source naming the asset and how to download it. Assets over the store',
|
|
253
262
|
'limit (25 MiB by default, lower on a hosted deployment) are refused.',
|
|
254
263
|
'',
|
|
255
|
-
'
|
|
256
|
-
'
|
|
257
|
-
'
|
|
258
|
-
'
|
|
264
|
+
'move --role triage|ready|backlog|rejected moves a ticket into a lifecycle',
|
|
265
|
+
'role through the [tickets] names. backlog and rejected exist only when',
|
|
266
|
+
'[tickets].backlogState or rejectedState is set; otherwise the move is refused',
|
|
267
|
+
'naming the key. A source that creates states creates the role state on first use.',
|
|
268
|
+
'',
|
|
269
|
+
'states lists every state of the source: role-holding states in workflow order',
|
|
270
|
+
'(triage, create, proposal, backlog, ready, claimed, done, rejected), then the',
|
|
271
|
+
'rest, each with the roles it plays under the current config (or none), its',
|
|
272
|
+
'ticket count, and its purpose when set. --json emits one bare',
|
|
259
273
|
'array of {name, roles, tickets, about?}. state create makes a state, e.g.',
|
|
260
|
-
'
|
|
274
|
+
'needs-design, and is idempotent: an existing state is reported, and --about (one',
|
|
261
275
|
'line) records or replaces its purpose. A name is one to forty lowercase',
|
|
262
276
|
'letters, digits, and hyphens, starting with a letter, and may not match an',
|
|
263
|
-
'existing state case-insensitively. There is no rename or delete.
|
|
264
|
-
'
|
|
265
|
-
'
|
|
266
|
-
'',
|
|
267
|
-
'
|
|
268
|
-
'
|
|
277
|
+
'existing state case-insensitively. There is no rename or delete. The file,',
|
|
278
|
+
'hosted and github sources support both; others exit nonzero naming the source.',
|
|
279
|
+
'Hosted and github creation refuse an existing name instead of reporting it. A',
|
|
280
|
+
'file state with no purpose and no tickets is an empty directory that git does',
|
|
281
|
+
'not track.',
|
|
282
|
+
'',
|
|
283
|
+
'export writes every ticket to a portable directory; import loads one into the',
|
|
284
|
+
'configured source. import --states a,b imports only tickets in those states and',
|
|
285
|
+
'refuses a selection that leaves behind a blocker, target or unfinished build.',
|
|
286
|
+
'',
|
|
287
|
+
'Ticket ids are source-local (for example AUT-8, file-1 or GitHub issue 123). For',
|
|
288
|
+
'block and unblock, the first id is always the ticket being changed. State names and',
|
|
269
289
|
'unknown-id errors come from the configured source; ab ticket states lists them.',
|
|
270
290
|
]),
|
|
271
291
|
},
|
|
@@ -380,13 +400,15 @@ These fields describe intent; dispatch and merge behavior are unchanged.`,
|
|
|
380
400
|
' --store <ref> Override the BuildStore path or URL.',
|
|
381
401
|
'',
|
|
382
402
|
'Default filter — actionable attention only. Builds: escalation.raised, phase.deferral-escalated, integration.landed,',
|
|
383
|
-
'integration.verification-failed (failed node verification), build.janitor-failing, build.
|
|
384
|
-
'node.item-conflicted, target.rewritten, conflicted restack.replayed,
|
|
403
|
+
'integration.verification-failed (failed node verification), build.janitor-failing, build.janitor-escalated,',
|
|
404
|
+
'build.compatibility-deferred, node.item-conflicted, target.rewritten, conflicted restack.replayed,',
|
|
405
|
+
'derived build.consent-ready and',
|
|
385
406
|
'build.merge-decision (a current actionable merge-gate deferral or unsafe forge outcome).',
|
|
386
407
|
'Consent and held ready merges use only build.consent-ready, once per readiness episode.',
|
|
387
408
|
'Unready or stale consent candidates stay silent; one merge gate decision per build/PR.',
|
|
388
409
|
'Repository: harvest.escalated, harvest.recovery-exhausted, dispatcher.config-rejected, dispatcher.forge-readiness-failed,',
|
|
389
|
-
'dispatcher.config-reloaded with restartRequired, abnormal dispatcher.run-stopped,',
|
|
410
|
+
'dispatcher.kernel-git-unavailable, dispatcher.config-reloaded with restartRequired, abnormal dispatcher.run-stopped,',
|
|
411
|
+
'abandoned ticket-preparation.resolved (claim confirmed or unconfirmed; ticket unchanged),',
|
|
390
412
|
'and dispatcher.lost. dispatcher.ticket-source-persistent reports degradation past',
|
|
391
413
|
'resetAt after a tick started at or after reset completes or fails while still degraded,',
|
|
392
414
|
'or 15 minutes without a reset; dispatcher.tick-failure-persistent reports',
|
|
@@ -755,6 +777,22 @@ These fields describe intent; dispatch and merge behavior are unchanged.`,
|
|
|
755
777
|
'build phase at any time and is not a terminal command.',
|
|
756
778
|
]),
|
|
757
779
|
},
|
|
780
|
+
{
|
|
781
|
+
name: 'issue',
|
|
782
|
+
audience: 'ai',
|
|
783
|
+
summary: 'Downgrade a linked issue from closes to refs.',
|
|
784
|
+
detail: page([
|
|
785
|
+
'Usage:',
|
|
786
|
+
' ab issue downgrade <N> --reason <text>',
|
|
787
|
+
'',
|
|
788
|
+
'Record that this build only partly resolves linked issue N, so its PR and',
|
|
789
|
+
'landed commit write Refs #N instead of Closes #N. --reason is required and',
|
|
790
|
+
'shows in build status. Downgrades are one-way: a refs link, an unlinked',
|
|
791
|
+
'issue, or any upgrade is refused. Finalize seals the links before the PR is',
|
|
792
|
+
"opened; after that the command fails and you should use 'ab escalate'.",
|
|
793
|
+
'This is not a terminal command.',
|
|
794
|
+
]),
|
|
795
|
+
},
|
|
758
796
|
{
|
|
759
797
|
name: 'done',
|
|
760
798
|
audience: 'ai',
|
|
@@ -788,14 +826,15 @@ These fields describe intent; dispatch and merge behavior are unchanged.`,
|
|
|
788
826
|
{
|
|
789
827
|
name: 'escalate',
|
|
790
828
|
audience: 'ai',
|
|
791
|
-
summary: 'Park the build with a question for
|
|
829
|
+
summary: 'Park the build with a question for external judgment.',
|
|
792
830
|
detail: page([
|
|
793
831
|
'Usage:',
|
|
794
832
|
' ab escalate <question> [--refs a,b]',
|
|
795
833
|
'',
|
|
796
|
-
'Park the build for
|
|
797
|
-
'or artifact references.
|
|
798
|
-
'
|
|
834
|
+
'Park the build for external judgment, optionally attaching comma-separated',
|
|
835
|
+
'source or artifact references. The operator agent or a human answers the',
|
|
836
|
+
'question; a build-phase agent cannot answer its own escalation. This is a',
|
|
837
|
+
'terminal command. Every phase ends with exactly one terminal command (D5).',
|
|
799
838
|
]),
|
|
800
839
|
},
|
|
801
840
|
{
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure readiness checks for hosted Claude and Kimi accounts whose credential
|
|
3
|
+
* is a static project secret (`ab secrets set NAME`). Only write-only
|
|
4
|
+
* metadata is read; a project secret's value is never downloaded or printed.
|
|
5
|
+
*/
|
|
6
|
+
import type { Account } from '../config/accounts'
|
|
7
|
+
import type { ProjectSecretMetadata } from '../project-secrets'
|
|
8
|
+
import type { ReadinessCheck } from '../ports/workspace/provider-capabilities'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A Claude or Kimi account is checked by metadata only on a connected project
|
|
12
|
+
* validated by a provider with remote readiness (the Vercel egress transform
|
|
13
|
+
* is what supplies project secrets), and only when no local variable is set.
|
|
14
|
+
*/
|
|
15
|
+
export function staticSecretEligible(
|
|
16
|
+
descriptor: Account,
|
|
17
|
+
env: Readonly<Record<string, string | undefined>>,
|
|
18
|
+
opts: { connected: boolean; remoteReadiness: boolean },
|
|
19
|
+
): boolean {
|
|
20
|
+
return (
|
|
21
|
+
(descriptor.kind === 'claude-subscription' || descriptor.kind === 'kimi-code') &&
|
|
22
|
+
opts.connected &&
|
|
23
|
+
opts.remoteReadiness &&
|
|
24
|
+
!env[descriptor.credentialEnv]
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function staticSecretRemedy(descriptor: Account): string {
|
|
29
|
+
const local =
|
|
30
|
+
descriptor.kind === 'kimi-code'
|
|
31
|
+
? 'provide the Kimi Code membership key in the local variable'
|
|
32
|
+
: 'run claude setup-token and provide the local variable'
|
|
33
|
+
return `set the project secret with bun ab secrets set ${descriptor.credentialEnv}, or ${local}`
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function staticSecretReadiness(
|
|
37
|
+
name: string,
|
|
38
|
+
descriptor: Account,
|
|
39
|
+
metadata: readonly ProjectSecretMetadata[] | undefined,
|
|
40
|
+
): ReadinessCheck & { ready: boolean } {
|
|
41
|
+
const entry = metadata?.find((s) => s.name === descriptor.credentialEnv && s.kind === 'static')
|
|
42
|
+
const ready = entry?.status === 'ready' && entry.failureCode === null
|
|
43
|
+
const facts = entry ? `owner ${entry.owner}; set ${entry.setAt}` : ''
|
|
44
|
+
return {
|
|
45
|
+
name: `account ${JSON.stringify(name)}`,
|
|
46
|
+
status: ready ? 'pass' : 'fail',
|
|
47
|
+
ready,
|
|
48
|
+
detail: ready
|
|
49
|
+
? `Hosted credential ready; ${facts}. Hosted Claude and Kimi accounts are checked by metadata; the first hosted build is the live check.`
|
|
50
|
+
: entry
|
|
51
|
+
? `Hosted credential ${entry.status}${entry.failureCode === null ? '' : ` (${entry.failureCode})`}; ${facts}; ${staticSecretRemedy(descriptor)}`
|
|
52
|
+
: `${descriptor.credentialEnv} is missing; ${staticSecretRemedy(descriptor)}`,
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -12,17 +12,30 @@ import type {
|
|
|
12
12
|
} from '../ports/workspace/provider-capabilities'
|
|
13
13
|
import { validateVercelSandbox, type VercelSandboxFacade } from '../ports/workspace/vercel-sandbox'
|
|
14
14
|
import { gitText, parseGuestOutput } from './init-readiness-shared'
|
|
15
|
+
import { hostedReadinessNames } from '../accounts/hosted-readiness'
|
|
16
|
+
import { staticSecretRemedy } from './init-hosted-accounts'
|
|
17
|
+
import { isRemoteStoreRef } from './repo-state'
|
|
15
18
|
|
|
16
19
|
export async function validateRemoteReadiness(
|
|
17
20
|
ctx: WorkspaceReadinessContext,
|
|
18
21
|
): Promise<InitValidationReport> {
|
|
19
22
|
const vercel = ctx.providerConfig as VercelSandboxConfig
|
|
23
|
+
const hosted = hostedReadinessNames(ctx.env)
|
|
24
|
+
const connected = isRemoteStoreRef(ctx.storeRef)
|
|
20
25
|
const hostChecks = Object.entries(ctx.accounts ?? {}).map(([name, descriptor]) => ({
|
|
21
26
|
name: `host account ${JSON.stringify(name)}`,
|
|
22
27
|
status: ctx.env[descriptor.credentialEnv] ? ('pass' as const) : ('fail' as const),
|
|
23
|
-
detail:
|
|
24
|
-
? `${descriptor.credentialEnv} is
|
|
25
|
-
:
|
|
28
|
+
detail: hosted.includes(name)
|
|
29
|
+
? `${descriptor.credentialEnv} is a ready hosted project secret (metadata only)`
|
|
30
|
+
: ctx.env[descriptor.credentialEnv]
|
|
31
|
+
? `${descriptor.credentialEnv} is present`
|
|
32
|
+
: `${descriptor.credentialEnv} is missing; ${
|
|
33
|
+
connected && descriptor.kind !== 'chatgpt-subscription'
|
|
34
|
+
? staticSecretRemedy(descriptor)
|
|
35
|
+
: descriptor.kind === 'claude-subscription'
|
|
36
|
+
? 'run claude setup-token and set the dispatcher variable'
|
|
37
|
+
: 'provision the Kimi membership key'
|
|
38
|
+
}`,
|
|
26
39
|
}))
|
|
27
40
|
if (hostChecks.some((check) => check.status === 'fail'))
|
|
28
41
|
return {
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { LocalCredentials } from '../accounts/local-credentials'
|
|
2
2
|
import { LocalAccountOwner } from '../accounts/local-owner'
|
|
3
3
|
import { abSecrets } from './secrets'
|
|
4
|
+
import {
|
|
5
|
+
HOSTED_ACCOUNT_READINESS_ENV,
|
|
6
|
+
HOSTED_METADATA_PLACEHOLDER,
|
|
7
|
+
hostedReadinessNames,
|
|
8
|
+
withHostedReadiness,
|
|
9
|
+
} from '../accounts/hosted-readiness'
|
|
10
|
+
import { staticSecretEligible, staticSecretReadiness } from './init-hosted-accounts'
|
|
4
11
|
import type { ProjectSecretMetadata } from '../project-secrets'
|
|
5
12
|
import { accountRemedy } from '../config/accounts'
|
|
6
13
|
import { createForge } from '../ports/forge/create'
|
|
@@ -16,7 +23,7 @@ import { mkdtemp, readFile, rm } from 'node:fs/promises'
|
|
|
16
23
|
import { tmpdir } from 'node:os'
|
|
17
24
|
import { join, resolve } from 'node:path'
|
|
18
25
|
import { effectiveRuntimeReferences } from '../config/roles'
|
|
19
|
-
import type { Config } from '../config/schema'
|
|
26
|
+
import type { Config, TicketsConfig } from '../config/schema'
|
|
20
27
|
import { loadConfig } from '../config/load'
|
|
21
28
|
import { createProductionRuntimes } from '../ports/runner/production'
|
|
22
29
|
import { createRuntimeResolver } from '../ports/runner/routing'
|
|
@@ -37,6 +44,11 @@ import { diagnosePlugins, loadPlugins } from '../plugins/load'
|
|
|
37
44
|
import { materializePluginRuntimes } from '../plugins/runtimes'
|
|
38
45
|
import { createTicketSource } from '../ports/tickets/create'
|
|
39
46
|
import { LinearTicketSource } from '../ports/tickets/linear'
|
|
47
|
+
import { GitHubTicketSource } from '../ports/tickets/github'
|
|
48
|
+
import { representableState } from '../ports/tickets/github-issues'
|
|
49
|
+
import { STATE_NAME_RULE } from '../ports/tickets/states'
|
|
50
|
+
import { holdsState } from '../ports/tickets/lifecycle'
|
|
51
|
+
import type { TicketSource } from '../ports/types'
|
|
40
52
|
import { inspectLocalStoreSnapshot } from '../store/local/store'
|
|
41
53
|
import type { StoreOpener } from './store-opening'
|
|
42
54
|
import { openProductionStore } from './store-opening'
|
|
@@ -55,6 +67,74 @@ export type {
|
|
|
55
67
|
ReadinessCheck,
|
|
56
68
|
} from '../ports/workspace/provider-capabilities'
|
|
57
69
|
|
|
70
|
+
const OPTIONAL_ROLES = [
|
|
71
|
+
{ role: 'backlog', key: 'backlogState', recommended: 'backlog' },
|
|
72
|
+
{ role: 'rejected', key: 'rejectedState', recommended: 'rejected' },
|
|
73
|
+
] as const
|
|
74
|
+
|
|
75
|
+
/** GitHub holds every open state as an `autobuild:<state>` label, so each
|
|
76
|
+
* configured state other than done and rejected (closing reasons) must follow
|
|
77
|
+
* the label rule. Throws naming the first offending key. */
|
|
78
|
+
export function assertGitHubStateLabels(tickets: TicketsConfig): void {
|
|
79
|
+
const keys = [
|
|
80
|
+
'readyState',
|
|
81
|
+
'claimedState',
|
|
82
|
+
'createState',
|
|
83
|
+
'triageState',
|
|
84
|
+
'proposalState',
|
|
85
|
+
'backlogState',
|
|
86
|
+
] as const
|
|
87
|
+
for (const key of keys) {
|
|
88
|
+
const name = tickets[key]
|
|
89
|
+
if (name !== undefined && !representableState(name))
|
|
90
|
+
throw new Error(
|
|
91
|
+
`[tickets].${key} "${name}" cannot be a GitHub state label (autobuild:<state>) — ${STATE_NAME_RULE}`,
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Advisory findings for the optional backlog and rejected roles. An unset role
|
|
98
|
+
* is an informational note, never a failure. A configured role naming no state
|
|
99
|
+
* is a warning, unless the source creates states on first use. Costs one state
|
|
100
|
+
* listing, and only when a role is configured.
|
|
101
|
+
*/
|
|
102
|
+
export async function ticketRoleReadiness(
|
|
103
|
+
tickets: TicketsConfig,
|
|
104
|
+
source: () => Promise<TicketSource>,
|
|
105
|
+
): Promise<{ notes: string[]; checks: ReadinessCheck[] }> {
|
|
106
|
+
const notes: string[] = []
|
|
107
|
+
const checks: ReadinessCheck[] = []
|
|
108
|
+
const configured = OPTIONAL_ROLES.filter(({ key }) => tickets[key] !== undefined)
|
|
109
|
+
for (const { role, key, recommended } of OPTIONAL_ROLES)
|
|
110
|
+
if (tickets[key] === undefined)
|
|
111
|
+
notes.push(
|
|
112
|
+
`Note: [tickets].${key} is not set; the ${role} role is unavailable (recommended: ${key} = "${recommended}")`,
|
|
113
|
+
)
|
|
114
|
+
if (configured.length === 0) return { notes, checks }
|
|
115
|
+
const ticketSource = await source()
|
|
116
|
+
const names =
|
|
117
|
+
ticketSource instanceof LinearTicketSource
|
|
118
|
+
? await ticketSource.workflowStateNames()
|
|
119
|
+
: ticketSource.listStates
|
|
120
|
+
? (await ticketSource.listStates()).map((info) => info.name)
|
|
121
|
+
: undefined
|
|
122
|
+
if (names === undefined) return { notes, checks }
|
|
123
|
+
for (const { role, key } of configured) {
|
|
124
|
+
const name = tickets[key]!
|
|
125
|
+
if (names.some((state) => holdsState(state, name))) continue
|
|
126
|
+
if (ticketSource.addState)
|
|
127
|
+
notes.push(`Note: ${role} role state "${name}" is created on first use`)
|
|
128
|
+
else
|
|
129
|
+
checks.push({
|
|
130
|
+
name: `ticket-role-${role}`,
|
|
131
|
+
status: 'warning',
|
|
132
|
+
detail: `[tickets].${key} "${name}" names no state in the ${ticketSource.name} source (known: ${names.join(', ') || 'none'})`,
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
return { notes, checks }
|
|
136
|
+
}
|
|
137
|
+
|
|
58
138
|
async function shell(
|
|
59
139
|
exec: Exec,
|
|
60
140
|
cwd: string,
|
|
@@ -229,17 +309,17 @@ export async function runGuestReadinessProbe(opts: {
|
|
|
229
309
|
|
|
230
310
|
try {
|
|
231
311
|
for (const [name, descriptor] of Object.entries(config.accounts)) {
|
|
312
|
+
const hosted = hostedReadinessNames(opts.env).includes(name)
|
|
232
313
|
checks.push({
|
|
233
314
|
name: `credential ${JSON.stringify(name)}`,
|
|
234
315
|
status: opts.env[descriptor.credentialEnv] ? 'pass' : 'warning',
|
|
235
|
-
detail:
|
|
316
|
+
detail: hosted
|
|
317
|
+
? `${descriptor.credentialEnv} is a hosted project secret (metadata only)`
|
|
318
|
+
: `${descriptor.credentialEnv} is ${opts.env[descriptor.credentialEnv] ? 'present' : 'absent'}${!opts.env[descriptor.credentialEnv] && descriptor.kind === 'claude-subscription' ? '; run claude setup-token for remote use' : ''}`,
|
|
236
319
|
})
|
|
237
320
|
const account = { name, descriptor }
|
|
238
321
|
const runtime = descriptor.kind === 'chatgpt-subscription' ? 'codex' : 'claude'
|
|
239
|
-
if (
|
|
240
|
-
descriptor.kind === 'chatgpt-subscription' &&
|
|
241
|
-
(JSON.parse(opts.env.AB_CHATGPT_HOSTED_READINESS ?? '[]') as string[]).includes(name)
|
|
242
|
-
) {
|
|
322
|
+
if (hosted) {
|
|
243
323
|
checks.push({
|
|
244
324
|
name: `account ${JSON.stringify(name)}`,
|
|
245
325
|
status: 'pass',
|
|
@@ -497,6 +577,7 @@ async function validateInitReadinessInner(opts: {
|
|
|
497
577
|
])
|
|
498
578
|
let caps: WorkspaceProviderCapabilities | undefined
|
|
499
579
|
let assigneeLine: string | undefined
|
|
580
|
+
let roles: Awaited<ReturnType<typeof ticketRoleReadiness>> = { notes: [], checks: [] }
|
|
500
581
|
let forgeChecks: ForgeReadinessCheck[] = readinessChecks(
|
|
501
582
|
'unknown',
|
|
502
583
|
'Host forge construction unavailable; check adapter configuration and access.',
|
|
@@ -560,14 +641,24 @@ async function validateInitReadinessInner(opts: {
|
|
|
560
641
|
}
|
|
561
642
|
}
|
|
562
643
|
}
|
|
563
|
-
|
|
564
|
-
|
|
644
|
+
let ticketSource: TicketSource | undefined
|
|
645
|
+
const openTicketSource = async () =>
|
|
646
|
+
(ticketSource ??= await createTicketSource(
|
|
565
647
|
config.tickets,
|
|
566
648
|
{ ...opts.env, AB_STORE: state.storeRef },
|
|
567
649
|
repo,
|
|
568
650
|
state.localStateRoot,
|
|
569
651
|
hostPlugins,
|
|
570
|
-
)
|
|
652
|
+
))
|
|
653
|
+
if (config.tickets.source === 'github') assertGitHubStateLabels(config.tickets)
|
|
654
|
+
if (config.tickets.source !== 'file') {
|
|
655
|
+
const ticketSource = await openTicketSource()
|
|
656
|
+
if (ticketSource instanceof GitHubTicketSource) await ticketSource.validateAccess()
|
|
657
|
+
// Who the assignee gate names, before the read it narrows, so an
|
|
658
|
+
// unresolvable value fails with the source's own remediation.
|
|
659
|
+
const assignee = config.tickets.readyAssignee
|
|
660
|
+
if (assignee !== undefined && ticketSource.describeReadyAssignee !== undefined)
|
|
661
|
+
assigneeLine = `Ticket assignee gate: ${await ticketSource.describeReadyAssignee(assignee)}`
|
|
571
662
|
await ticketSource.listReady({
|
|
572
663
|
...(config.tickets.readyLabels !== undefined ? { labels: config.tickets.readyLabels } : {}),
|
|
573
664
|
state: config.tickets.readyState,
|
|
@@ -575,19 +666,8 @@ async function validateInitReadinessInner(opts: {
|
|
|
575
666
|
? { assignee: config.tickets.readyAssignee }
|
|
576
667
|
: {}),
|
|
577
668
|
})
|
|
578
|
-
const assignee = config.tickets.readyAssignee
|
|
579
|
-
if (assignee !== undefined && ticketSource instanceof LinearTicketSource) {
|
|
580
|
-
const user = await ticketSource.resolveAssignee(assignee)
|
|
581
|
-
if (user === null) {
|
|
582
|
-
throw new Error(
|
|
583
|
-
assignee === 'me'
|
|
584
|
-
? '[tickets].readyAssignee = "me" but LINEAR_API_KEY did not resolve to a Linear user — check the key'
|
|
585
|
-
: `[tickets].readyAssignee "${assignee}" matches no user in the Linear workspace — check the address or use "me"`,
|
|
586
|
-
)
|
|
587
|
-
}
|
|
588
|
-
assigneeLine = `Ticket assignee gate: ${assignee} → ${user.name} <${user.email}>`
|
|
589
|
-
}
|
|
590
669
|
}
|
|
670
|
+
roles = await ticketRoleReadiness(config.tickets, openTicketSource)
|
|
591
671
|
} catch (error) {
|
|
592
672
|
throw new Error(redact(error))
|
|
593
673
|
}
|
|
@@ -709,6 +789,7 @@ async function validateInitReadinessInner(opts: {
|
|
|
709
789
|
}
|
|
710
790
|
|
|
711
791
|
if (report === undefined) throw new Error('readiness validation produced no report')
|
|
792
|
+
report.checks.push(...roles.checks)
|
|
712
793
|
report.checks.push(
|
|
713
794
|
...forgeChecks.map(
|
|
714
795
|
(check): ReadinessCheck => ({
|
|
@@ -728,6 +809,7 @@ async function validateInitReadinessInner(opts: {
|
|
|
728
809
|
stdout(`Store: ${state.storeRef}`)
|
|
729
810
|
stdout(`Forge: ${config.forge}`)
|
|
730
811
|
if (assigneeLine !== undefined) stdout(assigneeLine)
|
|
812
|
+
for (const note of roles.notes) stdout(note)
|
|
731
813
|
// Same raw `[workspace.config]` fallback guestEnvNames gets (f_55ba7591): a
|
|
732
814
|
// provider that declares describeEnvironment without a configSchema still
|
|
733
815
|
// receives a defined argument — the raw table — never undefined.
|
|
@@ -754,35 +836,58 @@ async function validateInitReadinessInner(opts: {
|
|
|
754
836
|
}
|
|
755
837
|
}
|
|
756
838
|
|
|
757
|
-
/**
|
|
839
|
+
/**
|
|
840
|
+
* Validation consumes the current owner's access value, never its refresh
|
|
841
|
+
* token. On a connected project, ChatGPT accounts without a local login and
|
|
842
|
+
* Claude or Kimi accounts eligible for a static project secret are reported
|
|
843
|
+
* from one write-only metadata listing; their values are never downloaded, a
|
|
844
|
+
* placeholder satisfies downstream presence checks, and the guest skips their
|
|
845
|
+
* live model probe.
|
|
846
|
+
*/
|
|
758
847
|
export async function validateInitReadiness(
|
|
759
|
-
opts: Parameters<typeof validateInitReadinessInner>[0]
|
|
848
|
+
opts: Parameters<typeof validateInitReadinessInner>[0] & {
|
|
849
|
+
fetch?: (input: string, init?: RequestInit) => Promise<Response>
|
|
850
|
+
},
|
|
760
851
|
): Promise<InitValidationReport> {
|
|
852
|
+
const { fetch: fetchImpl, ...innerOpts } = opts
|
|
761
853
|
const exec = opts.exec ?? spawnExec
|
|
762
854
|
const repo = await resolveMainRepo(opts.targetRepo, exec)
|
|
763
855
|
const config = await loadConfig(join(repo, 'autobuild.toml'))
|
|
856
|
+
const service = opts.env.AB_STORE?.trim() || config.store?.url
|
|
857
|
+
const connected = Boolean(service && isRemoteStoreRef(service))
|
|
858
|
+
const remoteReadiness =
|
|
859
|
+
builtinWorkspaceProviderCapabilities(config.workspace.provider)?.validateReadiness !== undefined
|
|
764
860
|
const accounts = Object.entries(config.accounts).filter(
|
|
765
861
|
([, a]) => a.kind === 'chatgpt-subscription',
|
|
766
862
|
)
|
|
767
|
-
|
|
863
|
+
const staticAccounts = Object.entries(config.accounts).filter(([, a]) =>
|
|
864
|
+
staticSecretEligible(a, opts.env, { connected, remoteReadiness }),
|
|
865
|
+
)
|
|
866
|
+
if (!accounts.length && !staticAccounts.length)
|
|
867
|
+
return validateInitReadinessInner({ ...innerOpts, resolvedRepo: repo })
|
|
768
868
|
const credentials = new LocalCredentials(join(repo, '.autobuild'))
|
|
769
869
|
const owner = new LocalAccountOwner(credentials)
|
|
770
870
|
const claimed: string[] = []
|
|
771
871
|
const env = { ...opts.env }
|
|
772
872
|
const checks: InitValidationReport['checks'] = []
|
|
873
|
+
const failed = (): InitValidationReport => ({
|
|
874
|
+
provider: config.workspace.provider,
|
|
875
|
+
context: config.workspace.provider === 'git-worktree' ? 'local worktree' : 'Vercel Sandbox',
|
|
876
|
+
checks,
|
|
877
|
+
exitCode: 1,
|
|
878
|
+
})
|
|
773
879
|
try {
|
|
774
|
-
const service = opts.env.AB_STORE?.trim() || config.store?.url
|
|
775
880
|
let metadata: ProjectSecretMetadata[] | undefined
|
|
776
881
|
if (
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
accounts.some(([name]) => !credentials.load(name))
|
|
882
|
+
connected &&
|
|
883
|
+
(staticAccounts.length > 0 || accounts.some(([name]) => !credentials.load(name)))
|
|
780
884
|
) {
|
|
781
885
|
await abSecrets('list', undefined, {
|
|
782
886
|
cwd: repo,
|
|
783
887
|
env: opts.env,
|
|
784
888
|
exec,
|
|
785
889
|
json: true,
|
|
890
|
+
...(fetchImpl === undefined ? {} : { fetch: fetchImpl }),
|
|
786
891
|
print: (text) => {
|
|
787
892
|
metadata = JSON.parse(text).secrets
|
|
788
893
|
},
|
|
@@ -812,22 +917,19 @@ export async function validateInitReadiness(
|
|
|
812
917
|
? `Hosted credential ${entry.status}; owner ${entry.owner}; set ${entry.setAt}; ${entry.warnings?.join(', ') || 'no refresh-window warning'}. The first hosted build is the live check.`
|
|
813
918
|
: `Credential absent; run ab accounts login ${JSON.stringify(name)} ${service && isRemoteStoreRef(service) ? '--project' : '--local'}`,
|
|
814
919
|
})
|
|
815
|
-
if (!ready)
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
context:
|
|
819
|
-
config.workspace.provider === 'git-worktree' ? 'local worktree' : 'Vercel Sandbox',
|
|
820
|
-
checks,
|
|
821
|
-
exitCode: 1,
|
|
822
|
-
}
|
|
823
|
-
env.AB_CHATGPT_HOSTED_READINESS = JSON.stringify([
|
|
824
|
-
...(JSON.parse(env.AB_CHATGPT_HOSTED_READINESS ?? '[]') as string[]),
|
|
825
|
-
name,
|
|
826
|
-
])
|
|
827
|
-
env[descriptor.credentialEnv] = 'autobuild-hosted-metadata-only'
|
|
920
|
+
if (!ready) return failed()
|
|
921
|
+
env[HOSTED_ACCOUNT_READINESS_ENV] = withHostedReadiness(env, name)
|
|
922
|
+
env[descriptor.credentialEnv] = HOSTED_METADATA_PLACEHOLDER
|
|
828
923
|
}
|
|
829
924
|
}
|
|
830
|
-
|
|
925
|
+
for (const [name, descriptor] of staticAccounts) {
|
|
926
|
+
const { ready, ...check } = staticSecretReadiness(name, descriptor, metadata)
|
|
927
|
+
checks.push(check)
|
|
928
|
+
if (!ready) return failed()
|
|
929
|
+
env[HOSTED_ACCOUNT_READINESS_ENV] = withHostedReadiness(env, name)
|
|
930
|
+
env[descriptor.credentialEnv] = HOSTED_METADATA_PLACEHOLDER
|
|
931
|
+
}
|
|
932
|
+
const report = await validateInitReadinessInner({ ...innerOpts, env, resolvedRepo: repo })
|
|
831
933
|
return { ...report, checks: [...checks, ...report.checks] }
|
|
832
934
|
} finally {
|
|
833
935
|
for (const name of claimed) owner.release(name)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ab issue downgrade <N> --reason <text>` (SPEC "Forge issue links"): an
|
|
3
|
+
* agent found the build only partly resolves a linked `closes` issue. The
|
|
4
|
+
* downgrade is one-way and must land before the kernel seals the links for
|
|
5
|
+
* the PR; a downgrade the reducer would treat as inert is refused, or, when
|
|
6
|
+
* a seal overtakes it, reported as a failure rather than a success.
|
|
7
|
+
*
|
|
8
|
+
* NOT a terminal: usable in any phase until the seal.
|
|
9
|
+
*/
|
|
10
|
+
import type { EventEnvelope } from '../events/catalog'
|
|
11
|
+
import { agentActor } from '../events/envelope'
|
|
12
|
+
import { formatIssueLinks } from '../ports/tickets/issue-links'
|
|
13
|
+
import { readBuildFacts } from '../store/reduced-reads'
|
|
14
|
+
import type { BuildStore } from '../store/types'
|
|
15
|
+
import type { CliEnv } from './env'
|
|
16
|
+
|
|
17
|
+
export interface IssueDowngradeDeps {
|
|
18
|
+
store: BuildStore
|
|
19
|
+
env: CliEnv
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface IssueDowngradeOpts {
|
|
23
|
+
issue: string
|
|
24
|
+
reason: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function downgradeIssueLink(
|
|
28
|
+
deps: IssueDowngradeDeps,
|
|
29
|
+
opts: IssueDowngradeOpts,
|
|
30
|
+
): Promise<EventEnvelope<'issue-link.downgraded'>> {
|
|
31
|
+
const match = /^#?(\d+)$/.exec(opts.issue.trim())
|
|
32
|
+
const issue = match === null ? Number.NaN : Number(match[1])
|
|
33
|
+
if (!Number.isSafeInteger(issue) || issue <= 0)
|
|
34
|
+
throw new Error(`'ab issue downgrade' expects an issue number such as 824, not "${opts.issue}"`)
|
|
35
|
+
const reason = opts.reason.trim()
|
|
36
|
+
if (reason === '') throw new Error("'ab issue downgrade' requires a non-empty --reason")
|
|
37
|
+
|
|
38
|
+
const { env, store } = deps
|
|
39
|
+
const before = (await readBuildFacts(store, env.build)).value.state
|
|
40
|
+
if (before.issueLinksSealedSeq !== undefined)
|
|
41
|
+
throw new Error(
|
|
42
|
+
`issue links were sealed when the PR was prepared at seq ${before.issueLinksSealedSeq}; ` +
|
|
43
|
+
"use 'ab escalate' instead",
|
|
44
|
+
)
|
|
45
|
+
const link = before.issueLinks.find((entry) => entry.issue === issue)
|
|
46
|
+
if (link === undefined)
|
|
47
|
+
throw new Error(
|
|
48
|
+
before.issueLinks.length === 0
|
|
49
|
+
? `issue #${issue} is not linked: this build has no issue links`
|
|
50
|
+
: `issue #${issue} is not linked; linked: ${formatIssueLinks(before.issueLinks)}`,
|
|
51
|
+
)
|
|
52
|
+
if (link.intent === 'refs')
|
|
53
|
+
throw new Error(`issue #${issue} is already refs; nothing to downgrade`)
|
|
54
|
+
|
|
55
|
+
const appended = await store.append(env.build, {
|
|
56
|
+
actor: agentActor(env.phase, env.session),
|
|
57
|
+
type: 'issue-link.downgraded',
|
|
58
|
+
payload: { issue, reason },
|
|
59
|
+
})
|
|
60
|
+
const after = (await readBuildFacts(store, env.build)).value.state
|
|
61
|
+
if (after.issueLinks.find((entry) => entry.issue === issue)?.downgrade?.seq !== appended.seq)
|
|
62
|
+
throw new Error(
|
|
63
|
+
`downgrade recorded at seq ${appended.seq} but inert: links were sealed at seq ` +
|
|
64
|
+
`${after.issueLinksSealedSeq ?? '?'}; use 'ab escalate' instead`,
|
|
65
|
+
)
|
|
66
|
+
return appended
|
|
67
|
+
}
|