@defrex/autobuild 1.0.0 → 1.1.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 +6 -6
- package/SPEC.md +360 -229
- package/docs/answering-blocked-builds.md +2 -2
- package/docs/architecture.md +155 -45
- package/docs/assets/headline-wide.png +0 -0
- package/docs/builds.md +4 -4
- package/docs/cli.md +4 -4
- package/docs/configuration-overview.md +4 -4
- package/docs/configuration.md +245 -210
- package/docs/dispatcher-hosting.md +2 -2
- package/docs/dispatcher.md +1 -1
- package/docs/forges.md +5 -5
- package/docs/getting-started.md +2 -2
- package/docs/glossary.md +6 -6
- package/docs/hosted-dispatcher.md +6 -3
- package/docs/hosted-service.md +16 -5
- package/docs/integration-overview.md +15 -15
- package/docs/integration-tree.md +45 -38
- package/docs/integration.md +6 -6
- package/docs/mcp.md +16 -15
- package/docs/{landing-policy.md → merge-policy.md} +42 -24
- package/docs/migration-1.0.md +17 -13
- package/docs/operating.md +41 -18
- package/docs/operator-api.md +91 -15
- package/docs/operator-surfaces.md +8 -4
- package/docs/overview.md +3 -3
- package/docs/remote-store-protocol.md +76 -11
- package/docs/remote-ticket-protocol.md +1 -1
- package/docs/restacking.md +54 -15
- package/docs/setup.md +41 -6
- package/docs/skills.md +1 -1
- package/docs/spec-standard.md +6 -6
- package/docs/ticket-dependencies.md +7 -7
- package/docs/tickets.md +8 -2
- package/docs/troubleshooting.md +2 -2
- package/docs/upgrading.md +8 -3
- package/docs/verification.md +60 -14
- package/package.json +7 -5
- package/packages/core/src/cli/binary-direct.ts +13 -1
- package/packages/core/src/cli/binary-lifecycle.ts +65 -2
- package/packages/core/src/cli/build-control.ts +83 -28
- package/packages/core/src/cli/context.ts +81 -38
- package/packages/core/src/cli/dashboard/facts.ts +2 -1
- package/packages/core/src/cli/dashboard/integration-detail.ts +8 -8
- package/packages/core/src/cli/dashboard/integration-row.ts +40 -13
- package/packages/core/src/cli/dashboard/landing-display.ts +25 -0
- package/packages/core/src/cli/dashboard/model.ts +56 -33
- package/packages/core/src/cli/dashboard/poll.ts +9 -3
- package/packages/core/src/cli/dashboard/render.ts +59 -37
- package/packages/core/src/cli/dashboard/target-distance.ts +14 -0
- package/packages/core/src/cli/dashboard/tree.ts +3 -2
- package/packages/core/src/cli/dispatch-args.ts +1 -1
- package/packages/core/src/cli/dispatch-frontend.ts +6 -3
- package/packages/core/src/cli/dispatch.ts +35 -9
- package/packages/core/src/cli/env.ts +4 -0
- package/packages/core/src/cli/help.ts +30 -23
- package/packages/core/src/cli/main.ts +24 -8
- package/packages/core/src/cli/node-verification-provenance.ts +1 -97
- package/packages/core/src/cli/publication-settlement.ts +43 -20
- package/packages/core/src/cli/repository-status.ts +20 -9
- package/packages/core/src/cli/status.ts +42 -5
- package/packages/core/src/cli/store-opening.ts +6 -1
- package/packages/core/src/cli/terminal.ts +22 -1
- package/packages/core/src/cli/terminals.ts +14 -10
- package/packages/core/src/cli/upgrade-landing.ts +70 -30
- package/packages/core/src/cli/upgrade.ts +3 -1
- package/packages/core/src/cli/wait.ts +15 -7
- package/packages/core/src/cli/watch-lifetime.ts +111 -0
- package/packages/core/src/cli/watch.ts +634 -511
- package/packages/core/src/config/effective-artifact.fixture.ts +27 -0
- package/packages/core/src/config/effective-artifact.ts +13 -0
- package/packages/core/src/config/landing.ts +1 -1
- package/packages/core/src/config/load.ts +21 -1
- package/packages/core/src/config/pipeline-source.ts +28 -0
- package/packages/core/src/config/reference-metadata.ts +2 -0
- package/packages/core/src/config/reference.ts +22 -7
- package/packages/core/src/config/schema.ts +86 -162
- package/packages/core/src/context-directory.ts +26 -0
- package/packages/core/src/distribution-packaging.ts +26 -5
- package/packages/core/src/events/catalog.ts +10 -2
- package/packages/core/src/events/globs.ts +1 -1
- package/packages/core/src/events/payloads.ts +70 -1
- package/packages/core/src/events/policy.ts +7 -0
- package/packages/core/src/events/repository.ts +2 -4
- package/packages/core/src/events/sessions.ts +6 -6
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +571 -0
- package/packages/core/src/kernel/auto-merge.ts +2 -2
- package/packages/core/src/kernel/engine.ts +255 -26
- package/packages/core/src/kernel/generators/leaf-restack-log.ts +10 -0
- package/packages/core/src/kernel/integration-landing.ts +3 -3
- package/packages/core/src/kernel/integration-state.ts +27 -4
- package/packages/core/src/kernel/leaf-restack-state.ts +28 -3
- package/packages/core/src/kernel/log-index.ts +13 -1
- package/packages/core/src/kernel/node-landing.ts +8 -8
- package/packages/core/src/kernel/node-parent.ts +2 -2
- package/packages/core/src/kernel/node-restack-transaction.ts +1 -1
- package/packages/core/src/kernel/node-verification-context.ts +216 -0
- package/packages/core/src/kernel/phases.ts +1 -1
- package/packages/core/src/kernel/plan-verify-selection.ts +16 -0
- package/packages/core/src/kernel/publication-retry.ts +168 -0
- package/packages/core/src/kernel/reconcile-restack.ts +29 -1
- package/packages/core/src/kernel/reducer.ts +82 -5
- package/packages/core/src/kernel/target-distance.ts +45 -0
- package/packages/core/src/kernel/terminal-guard.ts +10 -1
- package/packages/core/src/kernel/verify-stage-state.ts +123 -0
- package/packages/core/src/kernel/verify-stages.ts +39 -0
- package/packages/core/src/ontology.ts +1 -0
- package/packages/core/src/operator/annotations.ts +6 -0
- package/packages/core/src/operator/control.ts +1 -1
- package/packages/core/src/operator/index.ts +1 -7
- package/packages/core/src/operator/landings.ts +5 -1
- package/packages/core/src/operator/presentation.ts +6 -1
- package/packages/core/src/operator/query.ts +14 -18
- package/packages/core/src/operator/registry.ts +17 -6
- package/packages/core/src/operator/sandbox-host.ts +64 -40
- package/packages/core/src/operator/sandbox.ts +3 -0
- package/packages/core/src/operator/ticket-source-backend.ts +3 -12
- package/packages/core/src/ports/forge/contract.ts +2 -2
- package/packages/core/src/ports/forge/git-rewrite.ts +25 -2
- package/packages/core/src/ports/forge/github-readiness.ts +2 -2
- package/packages/core/src/ports/forge/github.ts +26 -7
- package/packages/core/src/ports/forge/local-git.ts +4 -4
- package/packages/core/src/ports/forge/readiness.ts +1 -1
- package/packages/core/src/ports/forge-failure.ts +24 -0
- package/packages/core/src/ports/workspace/build-execution.ts +3 -1
- package/packages/core/src/ports/workspace/phase-scratch.ts +4 -3
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +59 -39
- package/packages/core/src/processes/build-child.ts +6 -8
- package/packages/core/src/processes/build-execution-state.ts +8 -5
- package/packages/core/src/processes/build-runner.ts +522 -98
- package/packages/core/src/processes/dispatcher.ts +186 -101
- package/packages/core/src/processes/execution-no-progress.ts +8 -1
- package/packages/core/src/processes/phase-failure-budget.ts +1 -0
- package/packages/core/src/processes/publication-loss.ts +8 -2
- package/packages/core/src/processes/publication-state.ts +42 -4
- package/packages/core/src/processes/repo-view.ts +14 -0
- package/packages/core/src/processes/verify-cycle-config.ts +96 -0
- package/packages/core/src/{integration → scenarios}/harness.ts +330 -317
- package/packages/core/src/store/adapter.ts +1 -0
- package/packages/core/src/store/build-scope.ts +9 -0
- package/packages/core/src/store/contract.ts +113 -1
- package/packages/core/src/store/local/schema.ts +13 -0
- package/packages/core/src/store/local/store.ts +42 -0
- package/packages/core/src/store/memory.ts +47 -0
- package/packages/core/src/store/operator-presence.ts +21 -0
- package/packages/core/src/store/phase-session.ts +10 -0
- package/packages/core/src/store/reducer-value-shapes.json +5081 -4160
- package/packages/core/src/store/remote/client.ts +47 -1
- package/packages/core/src/store/remote/compatibility.ts +2 -0
- package/packages/core/src/store/remote/protocol.ts +4 -0
- package/packages/core/src/store/remote/version.ts +3 -1
- package/packages/core/src/store/retention.ts +2 -3
- package/packages/core/src/store/session-handle.ts +9 -0
- package/packages/core/src/store/streams/session-writer.ts +1 -1
- package/packages/core/src/store/types.ts +12 -2
- package/packages/core/src/testing/index.ts +11 -1
- package/packages/core/src/testing/temp-directories.ts +58 -0
- package/skills/code-review/SKILL.md +23 -9
- package/skills/finalize/SKILL.md +15 -7
- package/skills/guide/SKILL.md +253 -118
- package/skills/guide/references/integration-tree.md +45 -38
- package/skills/guide/references/{landing-policy.md → merge-policy.md} +42 -24
- package/skills/guide/references/migration-1.0.md +17 -13
- package/skills/guide/references/operator-api.md +91 -15
- package/skills/guide/references/remote-store-protocol.md +76 -11
- package/skills/guide/references/remote-ticket-protocol.md +1 -1
- package/skills/guide/references/restacking.md +54 -15
- package/skills/guide/references/setup.md +41 -6
- package/skills/guide/references/spec-standard.md +6 -6
- package/skills/guide/references/ticket-dependencies.md +7 -7
- package/skills/implement/SKILL.md +43 -17
- package/skills/operate/SKILL.md +117 -116
- package/skills/plan/SKILL.md +39 -13
- package/skills/plan-review/SKILL.md +15 -10
- package/skills/reconcile/SKILL.md +22 -3
- package/skills/spec/SKILL.md +19 -19
- package/skills/tickets/SKILL.md +9 -7
- package/templates/autobuild.toml +1 -1
- package/templates/hosted-service/package.json +2 -2
- package/packages/core/src/orchestrator/approvals.ts +0 -115
- package/packages/core/src/orchestrator/conversation.ts +0 -167
- package/packages/core/src/orchestrator/model.ts +0 -86
- package/packages/core/src/orchestrator/prompt.ts +0 -63
- package/packages/core/src/orchestrator/tools.ts +0 -117
- package/packages/core/src/orchestrator/turn-runner.ts +0 -457
- package/packages/core/src/processes/orchestrator-tick.ts +0 -360
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
operatorPresenceBodySchema,
|
|
3
|
+
operatorPresenceWireSchema,
|
|
4
|
+
operatorPresenceListSchema,
|
|
5
|
+
} from './protocol'
|
|
6
|
+
import {
|
|
7
|
+
operatorIdentitySchema,
|
|
8
|
+
type OperatorIdentity,
|
|
9
|
+
type OperatorPresence,
|
|
10
|
+
} from '../operator-presence'
|
|
1
11
|
import {
|
|
2
12
|
clientIdentityError,
|
|
3
13
|
classifyClient,
|
|
@@ -261,7 +271,7 @@ export class RemoteBuildStore implements BuildStore {
|
|
|
261
271
|
}
|
|
262
272
|
|
|
263
273
|
private async raw(
|
|
264
|
-
method: 'GET' | 'POST' | 'PUT',
|
|
274
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE',
|
|
265
275
|
path: string,
|
|
266
276
|
body?: unknown,
|
|
267
277
|
signal?: AbortSignal,
|
|
@@ -619,6 +629,42 @@ export class RemoteBuildStore implements BuildStore {
|
|
|
619
629
|
})
|
|
620
630
|
}
|
|
621
631
|
|
|
632
|
+
async upsertOperatorPresence(
|
|
633
|
+
repo: string,
|
|
634
|
+
identity: OperatorIdentity,
|
|
635
|
+
signal?: AbortSignal,
|
|
636
|
+
): Promise<OperatorPresence> {
|
|
637
|
+
return this.requestJson(
|
|
638
|
+
'POST',
|
|
639
|
+
`${this.repoPath(repo)}/operator-presence`,
|
|
640
|
+
operatorPresenceWireSchema,
|
|
641
|
+
operatorPresenceBodySchema.parse(identity),
|
|
642
|
+
signal ? AbortSignal.any([signal, AbortSignal.timeout(10_000)]) : AbortSignal.timeout(10_000),
|
|
643
|
+
)
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
async removeOperatorPresence(repo: string, id: string, signal?: AbortSignal): Promise<void> {
|
|
647
|
+
id = operatorIdentitySchema.shape.id.parse(id)
|
|
648
|
+
const response = await this.raw(
|
|
649
|
+
'DELETE',
|
|
650
|
+
`${this.repoPath(repo)}/operator-presence/${encodeURIComponent(id)}`,
|
|
651
|
+
undefined,
|
|
652
|
+
signal,
|
|
653
|
+
)
|
|
654
|
+
if (response.status === 404 || response.status === 405) return
|
|
655
|
+
if (!response.ok) throw await this.toError(response)
|
|
656
|
+
const result = okResponseSchema.strict().parse(await response.json())
|
|
657
|
+
if (!result.ok) throw new Error('operator withdrawal was not acknowledged')
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
async listOperatorPresence(repo: string): Promise<OperatorPresence[]> {
|
|
661
|
+
return this.requestJson(
|
|
662
|
+
'GET',
|
|
663
|
+
`${this.repoPath(repo)}/operator-presence`,
|
|
664
|
+
operatorPresenceListSchema,
|
|
665
|
+
)
|
|
666
|
+
}
|
|
667
|
+
|
|
622
668
|
async ensureRepo(repo: string): Promise<RepositoryRecord> {
|
|
623
669
|
return this.requestJson('POST', '/repos', repositoryRecordWireSchema, { repo })
|
|
624
670
|
}
|
|
@@ -78,6 +78,8 @@ export function compatibilityAdvice(
|
|
|
78
78
|
* Historical lines require explicit entries; the service's own line uses its
|
|
79
79
|
* current protocol identity. Unknown historical protocols fail closed. */
|
|
80
80
|
export const RELEASE_LINE_PROTOCOLS: Readonly<Record<string, string>> = {
|
|
81
|
+
// v1.0.x shipped protocol 4; protocol 5+ requires the next minor line.
|
|
82
|
+
'1.0': '4',
|
|
81
83
|
'0.9': '3',
|
|
82
84
|
'0.10': '3',
|
|
83
85
|
'0.11': '3',
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { operatorIdentitySchema, operatorPresenceSchema } from '../operator-presence'
|
|
2
|
+
export const operatorPresenceBodySchema = operatorIdentitySchema
|
|
3
|
+
export const operatorPresenceWireSchema = operatorPresenceSchema
|
|
4
|
+
export const operatorPresenceListSchema = operatorPresenceSchema.array()
|
|
1
5
|
import { compatibilityMetadataSchema } from '../../events/policy'
|
|
2
6
|
/**
|
|
3
7
|
* The wire protocol of the remote BuildStore (SPEC §7.2 adapter 2): JSON
|
|
@@ -4,13 +4,15 @@ import manifest from '../../../../../package.json'
|
|
|
4
4
|
export const AUTOBUILD_VERSION = manifest.version
|
|
5
5
|
|
|
6
6
|
/** Wire compatibility version for the remote BuildStore protocol.
|
|
7
|
+
* Version 6: adds operator presence withdrawal (next minor line).
|
|
8
|
+
* Version 5: adds mutable advisory operator presence operations.
|
|
7
9
|
* Version 4: adds required fenced begin/finish tick operations and bounded
|
|
8
10
|
* repository tick telemetry.
|
|
9
11
|
* Version 3 (AUT-521): the build-digest wire shape gains per-occurrence
|
|
10
12
|
* observation timestamps and the `merged` fact — a breaking shape change,
|
|
11
13
|
* so stale peers are rejected at handshake instead of failing mid-request
|
|
12
14
|
* at schema parse. */
|
|
13
|
-
export const REMOTE_STORE_PROTOCOL_VERSION = '
|
|
15
|
+
export const REMOTE_STORE_PROTOCOL_VERSION = '6'
|
|
14
16
|
|
|
15
17
|
export const AUTOBUILD_VERSION_HEADER = 'x-autobuild-version'
|
|
16
18
|
export const REMOTE_STORE_PROTOCOL_VERSION_HEADER = 'x-autobuild-protocol-version'
|
|
@@ -39,9 +39,8 @@
|
|
|
39
39
|
export const OPERATOR_NOTES_REPO_KIND = 'operator-notes'
|
|
40
40
|
|
|
41
41
|
/** The repository artifact carrying the schema-validated composed Config one
|
|
42
|
-
* dispatch run used.
|
|
43
|
-
*
|
|
44
|
-
* (AUT-342). Defined here — the store must not import from the CLI — and
|
|
42
|
+
* dispatch run used. Hosted external operator tools and archive cleanup resolve
|
|
43
|
+
* their sandbox gate from the latest revision of this kind. Defined here — the store must not import from the CLI — and
|
|
45
44
|
* re-exported by `cli/dispatch.ts`, which deposits it. */
|
|
46
45
|
export const DISPATCHER_EFFECTIVE_CONFIG_ARTIFACT = 'dispatcher-effective-config'
|
|
47
46
|
|
|
@@ -103,6 +103,15 @@ export function createSessionScopedStore(store: BuildStore, scope: string): Sess
|
|
|
103
103
|
listBuildsForRepo(repo: string): Promise<BuildRecord[]> {
|
|
104
104
|
return Promise.reject(new SessionScopeError(scope, 'listBuildsForRepo', repo))
|
|
105
105
|
},
|
|
106
|
+
async upsertOperatorPresence(): Promise<never> {
|
|
107
|
+
throw new SessionScopeError(scope, 'upsertOperatorPresence')
|
|
108
|
+
},
|
|
109
|
+
async removeOperatorPresence(): Promise<never> {
|
|
110
|
+
throw new SessionScopeError(scope, 'removeOperatorPresence')
|
|
111
|
+
},
|
|
112
|
+
async listOperatorPresence(): Promise<never> {
|
|
113
|
+
throw new SessionScopeError(scope, 'listOperatorPresence')
|
|
114
|
+
},
|
|
106
115
|
getRepoChangePosition(repo: string): Promise<string> {
|
|
107
116
|
return Promise.reject(new SessionScopeError(scope, 'getRepoChangePosition', repo))
|
|
108
117
|
},
|
|
@@ -54,7 +54,7 @@ export interface SessionStreamSinkOptions {
|
|
|
54
54
|
/** The sink's concrete surface. Structurally a superset of the
|
|
55
55
|
* `SessionStreamSink` port (ports/types.ts): `open` keeps its port-declared
|
|
56
56
|
* shape for the build-runner's `openSessionStreamLabel` caller, while the
|
|
57
|
-
*
|
|
57
|
+
* historical turn persistence additionally supported `resume` (bind to an
|
|
58
58
|
* already-open stream — a resumed invocation must append to the turn's
|
|
59
59
|
* existing stream, never create a second one) and `flush` (await the drain,
|
|
60
60
|
* so a step-boundary checkpoint is durable before the next step starts). */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { OperatorIdentity, OperatorPresence } from './operator-presence'
|
|
2
|
+
export type { OperatorIdentity, OperatorPresence } from './operator-presence'
|
|
1
3
|
import type { ReducerValueRequest, ReducerValue } from './reducer-values'
|
|
2
4
|
/**
|
|
3
5
|
* The BuildStore seam (SPEC §7): the durable home of everything a build
|
|
@@ -421,6 +423,14 @@ export interface BuildStore {
|
|
|
421
423
|
// Kept alongside, not inside, build streams: repository state is not a build.
|
|
422
424
|
ensureRepo(repo: string): Promise<RepositoryRecord>
|
|
423
425
|
getRepo(repo: string): Promise<RepositoryRecord | null>
|
|
426
|
+
/** Mutable advisory liveness. No event, lease or repository creation. */
|
|
427
|
+
upsertOperatorPresence(
|
|
428
|
+
repo: string,
|
|
429
|
+
identity: OperatorIdentity,
|
|
430
|
+
signal?: AbortSignal,
|
|
431
|
+
): Promise<OperatorPresence>
|
|
432
|
+
removeOperatorPresence(repo: string, id: string, signal?: AbortSignal): Promise<void>
|
|
433
|
+
listOperatorPresence(repo: string): Promise<OperatorPresence[]>
|
|
424
434
|
appendRepo<T extends RepositoryEventType>(
|
|
425
435
|
repo: string,
|
|
426
436
|
event: RepositoryEventWrite<T>,
|
|
@@ -691,8 +701,8 @@ export interface BuildScopedStore extends BuildStore {
|
|
|
691
701
|
/** A BuildStore constrained to one operator session. `sessionScope` is
|
|
692
702
|
* immutable; the handle may touch only its own session's events, artifacts,
|
|
693
703
|
* and session-scoped streams, and rejects session create/list and every
|
|
694
|
-
* build/repository operation.
|
|
695
|
-
*
|
|
704
|
+
* build/repository operation. The handle confines access to exactly one
|
|
705
|
+
* historical session, mirroring `BuildScopedStore`. */
|
|
696
706
|
export interface SessionScopedStore extends BuildStore {
|
|
697
707
|
readonly sessionScope: string
|
|
698
708
|
scopeSession(id: string): SessionScopedStore
|
|
@@ -56,7 +56,7 @@ export {
|
|
|
56
56
|
type Cli,
|
|
57
57
|
type E2eHarness,
|
|
58
58
|
type SkillHandlers,
|
|
59
|
-
} from '../
|
|
59
|
+
} from '../scenarios/harness'
|
|
60
60
|
|
|
61
61
|
// Harvest lifecycle and CLI seams for delegated-credential integration tests.
|
|
62
62
|
export { HarvestRunner } from '../processes/harvest-runner'
|
|
@@ -81,3 +81,13 @@ export { readBuildFacts, readBuildStreamSeed, readRepositoryFacts } from '../sto
|
|
|
81
81
|
export { deferMixedVersion } from '../kernel/mixed-version'
|
|
82
82
|
|
|
83
83
|
export { guardForge } from '../kernel/guarded-forge'
|
|
84
|
+
|
|
85
|
+
// Node verification delivery seam exercised by the hosted authorization suite.
|
|
86
|
+
export { buildContext } from '../cli/context'
|
|
87
|
+
export { scopeLocalStoreToPhaseSession } from '../store/phase-session'
|
|
88
|
+
export {
|
|
89
|
+
prepareNodeVerificationContext,
|
|
90
|
+
NODE_VERIFICATION_CONTEXT,
|
|
91
|
+
} from '../kernel/node-verification-context'
|
|
92
|
+
|
|
93
|
+
export { temporaryDirectories, temporaryOriginScratch } from './temp-directories'
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs'
|
|
2
|
+
import { createHash } from 'node:crypto'
|
|
3
|
+
import { tmpdir } from 'node:os'
|
|
4
|
+
import { join } from 'node:path'
|
|
5
|
+
import { normalizeGitRemoteUrl } from '../kernel/origin'
|
|
6
|
+
import { mkdtemp, rm, rmdir } from 'node:fs/promises'
|
|
7
|
+
|
|
8
|
+
/** Register ownership before fixture setup can throw. Create one allocator per
|
|
9
|
+
* test file/suite, passing its afterEach hook. Existing earlier cleanup is safe. */
|
|
10
|
+
export function temporaryDirectories(afterEach: (cleanup: () => Promise<void>) => unknown) {
|
|
11
|
+
const paths = new Set<string>()
|
|
12
|
+
afterEach(async () => {
|
|
13
|
+
const owned = [...paths]
|
|
14
|
+
paths.clear()
|
|
15
|
+
const results = await Promise.allSettled(
|
|
16
|
+
owned.map((path) => rm(path, { recursive: true, force: true })),
|
|
17
|
+
)
|
|
18
|
+
const errors = results.flatMap((result) =>
|
|
19
|
+
result.status === 'rejected' ? [result.reason] : [],
|
|
20
|
+
)
|
|
21
|
+
if (errors.length) throw new AggregateError(errors, 'Test temporary directory cleanup failed')
|
|
22
|
+
})
|
|
23
|
+
return async (prefix: string): Promise<string> => {
|
|
24
|
+
const path = await mkdtemp(prefix)
|
|
25
|
+
paths.add(path)
|
|
26
|
+
return path
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Origin-mode dispatch creates a deterministic scratch path without mkdtemp.
|
|
31
|
+
* Tests own only the repository identities they exercise, never the shared parent. */
|
|
32
|
+
export function temporaryOriginScratch(afterEach: (cleanup: () => Promise<void>) => unknown) {
|
|
33
|
+
const paths = new Set<string>()
|
|
34
|
+
let ownsParent = false
|
|
35
|
+
afterEach(async () => {
|
|
36
|
+
await Promise.all([...paths].map((path) => rm(path, { recursive: true, force: true })))
|
|
37
|
+
paths.clear()
|
|
38
|
+
if (ownsParent) {
|
|
39
|
+
try {
|
|
40
|
+
await rmdir(join(tmpdir(), 'autobuild'))
|
|
41
|
+
} catch (error) {
|
|
42
|
+
if (!['ENOENT', 'ENOTEMPTY'].includes((error as NodeJS.ErrnoException).code ?? ''))
|
|
43
|
+
throw error
|
|
44
|
+
}
|
|
45
|
+
ownsParent = false
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
return (repository: string) => {
|
|
49
|
+
const parent = join(tmpdir(), 'autobuild')
|
|
50
|
+
ownsParent ||= !existsSync(parent)
|
|
51
|
+
paths.add(
|
|
52
|
+
join(
|
|
53
|
+
parent,
|
|
54
|
+
createHash('sha256').update(normalizeGitRemoteUrl(repository)).digest('hex').slice(0, 16),
|
|
55
|
+
),
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -9,12 +9,21 @@ You are a fresh skeptic reviewing the diff. You have no memory of prior
|
|
|
9
9
|
rounds by design. Your verdict travels the typed channel; prose you print
|
|
10
10
|
goes nowhere.
|
|
11
11
|
|
|
12
|
+
Large scratch belongs under the session's `.ab/` directory (prefer `$AB_CONTEXT_DIR`),
|
|
13
|
+
not `/tmp`: this includes ad-hoc PostgreSQL data/cluster directories, Cargo target
|
|
14
|
+
directories, browser profiles, and database copies. Configure `PGDATA`,
|
|
15
|
+
`CARGO_TARGET_DIR`, and explicit browser profile paths for those resources.
|
|
16
|
+
Keep `TMPDIR` outside the worktree for test suites and commands that discover
|
|
17
|
+
repositories or configuration through parent directories, including focused tests
|
|
18
|
+
and Git probes. Do not relocate required installed tooling or retained evidence;
|
|
19
|
+
manifest-directed artifact paths remain authoritative. Never commit scratch.
|
|
20
|
+
|
|
12
21
|
## Session shape
|
|
13
22
|
|
|
14
|
-
1. Run `ab context`. You get
|
|
15
|
-
(`base`/`head` in
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
1. Run `ab context`. You get `$AB_CONTEXT_DIR/spec.md`, `$AB_CONTEXT_DIR/plan.md`, the commit range
|
|
24
|
+
(`base`/`head` in `$AB_CONTEXT_DIR/context.json`), `$AB_CONTEXT_DIR/implement-notes.md`, and
|
|
25
|
+
`$AB_CONTEXT_DIR/history/` with prior rounds' findings. When present,
|
|
26
|
+
`$AB_CONTEXT_DIR/dismissed-findings.json` lists finding ids a human explicitly dismissed.
|
|
18
27
|
2. Read the actual diff (`git diff <base>..<head>`), then the surrounding
|
|
19
28
|
code. Review what changed *and* what the change touches.
|
|
20
29
|
3. Judge on exactly these axes, in this order:
|
|
@@ -28,19 +37,19 @@ goes nowhere.
|
|
|
28
37
|
author's assumption.
|
|
29
38
|
- **Spec conformance** — every acceptance criterion met; nothing beyond
|
|
30
39
|
the spec's scope smuggled in. A pinned `design` asset (listed under
|
|
31
|
-
`assets` in
|
|
40
|
+
`assets` in `$AB_CONTEXT_DIR/context.json`, files under `$AB_CONTEXT_DIR/assets/<kind>/<name>/`)
|
|
32
41
|
is a contract on observable visual and reference outcomes, not on implementation: judge the rendered output against it wherever the code lets you
|
|
33
42
|
check, and treat a divergence as a finding. A gap in the asset is not a
|
|
34
43
|
reason to invent requirements.
|
|
35
44
|
- **Tests** — do the new tests exercise the seams this change created or
|
|
36
45
|
moved? Would they fail if the change were wrong?
|
|
37
46
|
- **Fit** — matches the codebase's idioms; no needless indirection.
|
|
38
|
-
4. Write
|
|
47
|
+
4. Write `$AB_CONTEXT_DIR/code-review.md`, then exactly one verdict:
|
|
39
48
|
|
|
40
49
|
```
|
|
41
|
-
ab verdict approve --notes
|
|
42
|
-
ab verdict revise --findings
|
|
43
|
-
ab verdict escalate --reason "…" --notes
|
|
50
|
+
ab verdict approve --notes "$AB_CONTEXT_DIR/code-review.md"
|
|
51
|
+
ab verdict revise --findings "$AB_CONTEXT_DIR/findings.json" --notes "$AB_CONTEXT_DIR/code-review.md"
|
|
52
|
+
ab verdict escalate --reason "…" --notes "$AB_CONTEXT_DIR/code-review.md"
|
|
44
53
|
```
|
|
45
54
|
|
|
46
55
|
## Writing findings
|
|
@@ -102,3 +111,8 @@ reason to withhold approval — record them with `ab observe` and approve.
|
|
|
102
111
|
Escalate only genuine judgment calls a human must make (the spec itself is
|
|
103
112
|
wrong, a security tradeoff outside your authority). Out-of-scope discoveries
|
|
104
113
|
are `ab observe`, never findings.
|
|
114
|
+
|
|
115
|
+
Read the manifest path printed by `ab context`. Its `materialized` keys are
|
|
116
|
+
relative to `contextDir`: join them to locate collision-adjusted inputs.
|
|
117
|
+
Manifest path fields are workspace-relative; use `notesPath` for producer notes.
|
|
118
|
+
Run commands from the workspace root.
|
package/skills/finalize/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: Prepare a green build's pull request description. Invoked by the bu
|
|
|
5
5
|
|
|
6
6
|
# /ab-finalize <build>
|
|
7
7
|
|
|
8
|
-
The build is green: plan approved, code approved, every verify
|
|
8
|
+
The build is green: plan approved, code approved, every current verify gate passed or was explicitly skipped.
|
|
9
9
|
You write the PR description; the kernel opens the PR when you finish (you
|
|
10
10
|
never touch the forge).
|
|
11
11
|
|
|
@@ -13,34 +13,42 @@ Guidance is an external operator answer, from the operator agent or a human.
|
|
|
13
13
|
|
|
14
14
|
## Session shape
|
|
15
15
|
|
|
16
|
-
1. Run `ab context`. You get
|
|
16
|
+
1. Run `ab context`. You get `$AB_CONTEXT_DIR/spec.md`, `$AB_CONTEXT_DIR/plan.md`, every verify report (including earlier failed cycles),
|
|
17
17
|
the repo's PR template config if one exists, and — when a human answered an
|
|
18
|
-
escalation this phase raised on an earlier attempt —
|
|
18
|
+
escalation this phase raised on an earlier attempt — `$AB_CONTEXT_DIR/guidance.json`,
|
|
19
19
|
their answer to it.
|
|
20
|
-
2. Write
|
|
20
|
+
2. Write `$AB_CONTEXT_DIR/pr-description.md`:
|
|
21
21
|
- **Title line first** — imperative, ≤ 70 chars, from the spec's what.
|
|
22
22
|
- **What & why** — from the spec, compressed for a human reviewer who
|
|
23
23
|
hasn't read it.
|
|
24
24
|
- **How** — the approach actually taken (from the plan and the implement
|
|
25
25
|
notes), including deviations from the plan.
|
|
26
26
|
- **Verification** — which verify steps ran and what they proved; note
|
|
27
|
-
anything a human should re-check by hand.
|
|
27
|
+
anything a human should re-check by hand. Historical cancelled steps are
|
|
28
|
+
not-run evidence, never passes; describe the satisfied current cycle. The
|
|
29
|
+
finalize manifest omits `cancelledVerify`; earlier reports are historical,
|
|
30
|
+
not a list of unfinished current gates.
|
|
28
31
|
- Follow the PR template if the context includes one.
|
|
29
32
|
Do not paste the audit trail — the kernel's summary comment appends verdict
|
|
30
33
|
history and links into the store.
|
|
31
34
|
3. Finish:
|
|
32
35
|
|
|
33
36
|
```
|
|
34
|
-
ab artifact put pr-description
|
|
37
|
+
ab artifact put pr-description "$AB_CONTEXT_DIR/pr-description.md"
|
|
35
38
|
ab done
|
|
36
39
|
```
|
|
37
40
|
|
|
38
41
|
`ab done` validates the deposit; the kernel opens the PR from it. One
|
|
39
42
|
terminal command; if validation fails, fix what it names and rerun.
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
`$AB_CONTEXT_DIR/guidance.json`, when present, is an operator's answer to the
|
|
42
45
|
escalation that blocked this build: the escalation id and the answer text. It
|
|
43
46
|
is authoritative feedback for this attempt and the PR description must act on
|
|
44
47
|
it, while the spec remains the contract this phase is measured against — if the
|
|
45
48
|
two cannot both be satisfied, escalate instead of guessing. Finalize has no
|
|
46
49
|
review round of its own, so guidance is the only feedback it ever receives.
|
|
50
|
+
|
|
51
|
+
Read the manifest path printed by `ab context`. Its `materialized` keys are
|
|
52
|
+
relative to `contextDir`: join them to locate collision-adjusted inputs.
|
|
53
|
+
Manifest path fields are workspace-relative; use `notesPath` for producer notes.
|
|
54
|
+
Run commands from the workspace root.
|