@cleocode/contracts 2026.9.20 → 2026.9.22
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/dist/__tests__/decide.test.d.ts +7 -0
- package/dist/__tests__/decide.test.d.ts.map +1 -0
- package/dist/__tests__/decide.test.js +91 -0
- package/dist/__tests__/decide.test.js.map +1 -0
- package/dist/__tests__/evidence-atom-schema.test.js +19 -1
- package/dist/__tests__/evidence-atom-schema.test.js.map +1 -1
- package/dist/__tests__/memory-wire-shapes.test.js.map +1 -1
- package/dist/acceptance-gate-schema.d.ts +5 -0
- package/dist/acceptance-gate-schema.d.ts.map +1 -1
- package/dist/acceptance-gate-schema.js +26 -0
- package/dist/acceptance-gate-schema.js.map +1 -1
- package/dist/acceptance-gate.d.ts +70 -3
- package/dist/acceptance-gate.d.ts.map +1 -1
- package/dist/backup-manifest.d.ts +13 -2
- package/dist/backup-manifest.d.ts.map +1 -1
- package/dist/branch-lock.d.ts +11 -0
- package/dist/branch-lock.d.ts.map +1 -1
- package/dist/branch-lock.js +31 -4
- package/dist/branch-lock.js.map +1 -1
- package/dist/cloud/api.d.ts +607 -0
- package/dist/cloud/api.d.ts.map +1 -0
- package/dist/cloud/api.js +417 -0
- package/dist/cloud/api.js.map +1 -0
- package/dist/cloud/envelope.d.ts +84 -0
- package/dist/cloud/envelope.d.ts.map +1 -0
- package/dist/cloud/envelope.js +54 -0
- package/dist/cloud/envelope.js.map +1 -0
- package/dist/cloud/ids.d.ts +30 -0
- package/dist/cloud/ids.d.ts.map +1 -0
- package/dist/cloud/ids.js +32 -0
- package/dist/cloud/ids.js.map +1 -0
- package/dist/cloud/index.d.ts +17 -0
- package/dist/cloud/index.d.ts.map +1 -0
- package/dist/cloud/index.js +17 -0
- package/dist/cloud/index.js.map +1 -0
- package/dist/data-accessor.d.ts +23 -3
- package/dist/data-accessor.d.ts.map +1 -1
- package/dist/data-accessor.js.map +1 -1
- package/dist/decide.d.ts +333 -0
- package/dist/decide.d.ts.map +1 -0
- package/dist/decide.js +184 -0
- package/dist/decide.js.map +1 -0
- package/dist/dispatch/operations-registry.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.js +56 -0
- package/dist/dispatch/operations-registry.js.map +1 -1
- package/dist/done-plan.d.ts +330 -0
- package/dist/done-plan.d.ts.map +1 -0
- package/dist/done-plan.js +17 -0
- package/dist/done-plan.js.map +1 -0
- package/dist/evidence-atom-schema.d.ts +29 -44
- package/dist/evidence-atom-schema.d.ts.map +1 -1
- package/dist/evidence-atom-schema.js +48 -8
- package/dist/evidence-atom-schema.js.map +1 -1
- package/dist/exit-codes.d.ts +40 -0
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +41 -0
- package/dist/exit-codes.js.map +1 -1
- package/dist/graph.d.ts +40 -0
- package/dist/graph.d.ts.map +1 -1
- package/dist/index.d.ts +13 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/memory/observe.d.ts +16 -0
- package/dist/memory/observe.d.ts.map +1 -1
- package/dist/operations/__tests__/release-shared-surface.test.d.ts +10 -0
- package/dist/operations/__tests__/release-shared-surface.test.d.ts.map +1 -0
- package/dist/operations/__tests__/release-shared-surface.test.js +84 -0
- package/dist/operations/__tests__/release-shared-surface.test.js.map +1 -0
- package/dist/operations/dialectic.d.ts +16 -0
- package/dist/operations/dialectic.d.ts.map +1 -1
- package/dist/operations/docs.d.ts +5 -2
- package/dist/operations/docs.d.ts.map +1 -1
- package/dist/operations/docs.js.map +1 -1
- package/dist/operations/memory.d.ts +48 -0
- package/dist/operations/memory.d.ts.map +1 -1
- package/dist/operations/nexus-scope-map.d.ts +8 -0
- package/dist/operations/nexus-scope-map.d.ts.map +1 -1
- package/dist/operations/nexus-scope-map.js +8 -0
- package/dist/operations/nexus-scope-map.js.map +1 -1
- package/dist/operations/nexus-user-profile.d.ts +27 -1
- package/dist/operations/nexus-user-profile.d.ts.map +1 -1
- package/dist/operations/nexus-user-profile.js +11 -1
- package/dist/operations/nexus-user-profile.js.map +1 -1
- package/dist/operations/nexus.d.ts +394 -3
- package/dist/operations/nexus.d.ts.map +1 -1
- package/dist/operations/release.d.ts +259 -0
- package/dist/operations/release.d.ts.map +1 -1
- package/dist/operations/release.js +130 -1
- package/dist/operations/release.js.map +1 -1
- package/dist/operations/session.d.ts +6 -4
- package/dist/operations/session.d.ts.map +1 -1
- package/dist/operations/tasks.d.ts +6 -0
- package/dist/operations/tasks.d.ts.map +1 -1
- package/dist/operations/tasks.js +1 -0
- package/dist/operations/tasks.js.map +1 -1
- package/dist/operations/validate.d.ts +5 -0
- package/dist/operations/validate.d.ts.map +1 -1
- package/dist/operations/worktree.d.ts +125 -1
- package/dist/operations/worktree.d.ts.map +1 -1
- package/dist/process-probe.d.ts +17 -0
- package/dist/process-probe.d.ts.map +1 -0
- package/dist/process-probe.js +21 -0
- package/dist/process-probe.js.map +1 -0
- package/dist/project-context.d.ts +44 -2
- package/dist/project-context.d.ts.map +1 -1
- package/dist/project-lifecycle.d.ts +143 -0
- package/dist/project-lifecycle.d.ts.map +1 -0
- package/dist/project-lifecycle.js +21 -0
- package/dist/project-lifecycle.js.map +1 -0
- package/dist/release/plan.d.ts +6 -2
- package/dist/release/plan.d.ts.map +1 -1
- package/dist/release/plan.js +8 -2
- package/dist/release/plan.js.map +1 -1
- package/dist/release/plan.test.js +6 -1
- package/dist/release/plan.test.js.map +1 -1
- package/dist/table-classification.d.ts +208 -0
- package/dist/table-classification.d.ts.map +1 -0
- package/dist/table-classification.js +23 -0
- package/dist/table-classification.js.map +1 -0
- package/dist/task.d.ts +97 -1
- package/dist/task.d.ts.map +1 -1
- package/package.json +6 -2
- package/schemas/gate-result.schema.json +43 -0
- package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +1 -1
- package/src/__tests__/decide.test.ts +139 -0
- package/src/__tests__/evidence-atom-schema.test.ts +24 -1
- package/src/__tests__/memory-wire-shapes.test.ts +3 -0
- package/src/acceptance-gate-schema.ts +29 -0
- package/src/acceptance-gate.ts +68 -3
- package/src/backup-manifest.ts +13 -2
- package/src/branch-lock.ts +36 -4
- package/src/cloud/api.ts +512 -0
- package/src/cloud/envelope.ts +63 -0
- package/src/cloud/ids.ts +51 -0
- package/src/cloud/index.ts +16 -0
- package/src/data-accessor.ts +24 -3
- package/src/decide.ts +355 -0
- package/src/dispatch/operations-registry.ts +59 -0
- package/src/done-plan.ts +370 -0
- package/src/evidence-atom-schema.ts +51 -9
- package/src/exit-codes.ts +42 -0
- package/src/graph.ts +44 -0
- package/src/index.ts +118 -0
- package/src/memory/observe.ts +16 -0
- package/src/operations/__tests__/release-shared-surface.test.ts +112 -0
- package/src/operations/dialectic.ts +17 -0
- package/src/operations/docs.ts +5 -2
- package/src/operations/memory.ts +48 -0
- package/src/operations/nexus-scope-map.ts +9 -0
- package/src/operations/nexus-user-profile.ts +29 -1
- package/src/operations/nexus.ts +416 -3
- package/src/operations/release.ts +197 -0
- package/src/operations/session.ts +6 -4
- package/src/operations/tasks.ts +7 -0
- package/src/operations/validate.ts +5 -0
- package/src/operations/worktree.ts +133 -1
- package/src/process-probe.ts +21 -0
- package/src/project-context.ts +42 -2
- package/src/project-lifecycle.ts +149 -0
- package/src/release/plan.test.ts +6 -1
- package/src/release/plan.ts +8 -2
- package/src/table-classification.ts +232 -0
- package/src/task.ts +102 -2
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contracts for the read-only `cleo done --plan` evidence planner.
|
|
3
|
+
*
|
|
4
|
+
* The planner derives, without executing a tool or writing a row, the
|
|
5
|
+
* evidence `cleo done` would record for each required verification gate:
|
|
6
|
+
* the implemented change set and where it came from, the tool runs and
|
|
7
|
+
* whether each already has a fresh cached result, which acceptance criteria
|
|
8
|
+
* map to evidence deterministically, and the blockers in the order an agent
|
|
9
|
+
* must clear them.
|
|
10
|
+
*
|
|
11
|
+
* Spec: `verify-streamlined-design` §3.2 and §7 step 1-2.
|
|
12
|
+
*
|
|
13
|
+
* @task T12623
|
|
14
|
+
* @task T12624
|
|
15
|
+
*/
|
|
16
|
+
import type { VerificationGate } from './task.js';
|
|
17
|
+
/**
|
|
18
|
+
* Where a task's implemented change set was found, first match wins.
|
|
19
|
+
*
|
|
20
|
+
* - `pr` — a merged PR that cites the task; files read from its merge commit.
|
|
21
|
+
* - `branch` — the unmerged task branch diffed against its merge-base with
|
|
22
|
+
* origin's default branch.
|
|
23
|
+
* - `docs` — attached documents and linked decisions of a research, spike or
|
|
24
|
+
* documentation task.
|
|
25
|
+
* - `none` — nothing references the task yet.
|
|
26
|
+
*/
|
|
27
|
+
export type ChangeSetSource = 'pr' | 'branch' | 'docs' | 'none';
|
|
28
|
+
/**
|
|
29
|
+
* How the repository the change set was read from was chosen.
|
|
30
|
+
*
|
|
31
|
+
* - `declared` — `CLEO_EVIDENCE_GIT_ROOT`, `GIT_WORK_TREE` or
|
|
32
|
+
* `evidence.gitRoot`; outranks every inference.
|
|
33
|
+
* - `invocation-worktree` — the caller's own worktree of this project.
|
|
34
|
+
* - `task-worktree` — the task's registered worktree, used when invoked from
|
|
35
|
+
* the main checkout.
|
|
36
|
+
* - `store` — the CLEO store root or its single child checkout.
|
|
37
|
+
*/
|
|
38
|
+
export type ChangeSetRootSource = 'declared' | 'invocation-worktree' | 'task-worktree' | 'store';
|
|
39
|
+
/** One concrete, runnable next step. */
|
|
40
|
+
export interface DoneNextStep {
|
|
41
|
+
/** Shell command the agent runs next. */
|
|
42
|
+
command: string;
|
|
43
|
+
/** Why this step clears the blocker. */
|
|
44
|
+
why: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Blocker vocabulary, in the order the planner reports them.
|
|
48
|
+
*
|
|
49
|
+
* @see DONE_PLAN_BLOCKER_ORDER in core for the ranking.
|
|
50
|
+
*/
|
|
51
|
+
export type DonePlanBlockerCode = 'git-root' | 'dirty-tree' | 'no-change-set' | 'pr-ambiguous' | 'pr-unverified' | 'pr-stacked' | 'pr-reverted' | 'merge-commit-missing' | 'decision-missing' | 'tool-unresolved' | 'tool-failed' | 'typed-gate-failed' | 'ac-mapping-needed' | 'manual-gate' | 'epic-rollup' | 'run-from-worktree' | 'checkout-required' | 'evidence-refused' | 'completion-refused';
|
|
52
|
+
/** A reason `cleo done` would stop, with exactly one next step. */
|
|
53
|
+
export interface DonePlanBlocker {
|
|
54
|
+
/** Stable machine code. */
|
|
55
|
+
code: DonePlanBlockerCode;
|
|
56
|
+
/** Human-readable statement of what is missing. */
|
|
57
|
+
message: string;
|
|
58
|
+
/** The one next step that clears it. */
|
|
59
|
+
next: DoneNextStep;
|
|
60
|
+
/** Original evidence error code when the blocker wraps a validator refusal. */
|
|
61
|
+
cause?: string;
|
|
62
|
+
}
|
|
63
|
+
/** A merged PR that cites the task. */
|
|
64
|
+
export interface ChangeSetPrCandidate {
|
|
65
|
+
/** PR number. */
|
|
66
|
+
prNumber: number;
|
|
67
|
+
/** PR title. */
|
|
68
|
+
title: string;
|
|
69
|
+
/** Head branch the PR merged from. */
|
|
70
|
+
headRefName: string;
|
|
71
|
+
}
|
|
72
|
+
/** A document attached to a research, spike or documentation task. */
|
|
73
|
+
export interface ChangeSetDoc {
|
|
74
|
+
/** Attachment or blob identifier. */
|
|
75
|
+
id: string;
|
|
76
|
+
/** Stable slug, when the doc has one. */
|
|
77
|
+
slug: string | null;
|
|
78
|
+
/** Store-relative path of the bytes the `files:` atom will hash. */
|
|
79
|
+
path: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The implemented change set derived for one task.
|
|
83
|
+
*
|
|
84
|
+
* `implementedEvidence` is the atom string the existing ADR-051 validators
|
|
85
|
+
* receive unchanged; there is no second validation path.
|
|
86
|
+
*/
|
|
87
|
+
export interface TaskChangeSet {
|
|
88
|
+
/** Where the change set came from. */
|
|
89
|
+
source: ChangeSetSource;
|
|
90
|
+
/** Absolute path of the repository every git and gh call ran in. */
|
|
91
|
+
executionRoot: string;
|
|
92
|
+
/** Why {@link executionRoot} was chosen. */
|
|
93
|
+
rootSource: ChangeSetRootSource;
|
|
94
|
+
/**
|
|
95
|
+
* Component PR whose change the (integration) `prNumber` landed on the
|
|
96
|
+
* default branch (T12671). Evidence is then `pr:<component>@<prNumber>`.
|
|
97
|
+
*/
|
|
98
|
+
componentPrNumber?: number;
|
|
99
|
+
/** Merged PR number (`source === 'pr'`). */
|
|
100
|
+
prNumber?: number;
|
|
101
|
+
/**
|
|
102
|
+
* Verified merge commit the files were read from (`source === 'pr'`). For a
|
|
103
|
+
* stacked PR this is the BASE PR's merge into the default branch.
|
|
104
|
+
*/
|
|
105
|
+
mergeCommitSha?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Set when the task's PR merged into another branch (a stacked PR) and the
|
|
108
|
+
* task is attributed to that branch's own PR once it reached the default
|
|
109
|
+
* branch.
|
|
110
|
+
*/
|
|
111
|
+
stackedOn?: {
|
|
112
|
+
baseRef: string;
|
|
113
|
+
basePrNumber?: number;
|
|
114
|
+
};
|
|
115
|
+
/** Branch tip commit (`source === 'branch'`). */
|
|
116
|
+
commitSha?: string;
|
|
117
|
+
/** Ref that was diffed (`HEAD` or `task/<id>`), for `source === 'branch'`. */
|
|
118
|
+
headRef?: string;
|
|
119
|
+
/** Origin default branch the merge-base was taken against. */
|
|
120
|
+
baseRef?: string;
|
|
121
|
+
/** Merge-base commit between {@link baseRef} and {@link headRef}. */
|
|
122
|
+
mergeBase?: string;
|
|
123
|
+
/** Repo-relative paths that still exist in the change set (the `files:` atom). */
|
|
124
|
+
files: string[];
|
|
125
|
+
/** Repo-relative paths the change set deleted; listed in the receipt, never in `files:`. */
|
|
126
|
+
deletedFiles: string[];
|
|
127
|
+
/** Attached docs (`source === 'docs'`). */
|
|
128
|
+
docs: ChangeSetDoc[];
|
|
129
|
+
/** Decision IDs linked to the task (`source === 'docs'`). */
|
|
130
|
+
decisions: string[];
|
|
131
|
+
/** Every merged PR that cited the task, before disambiguation. */
|
|
132
|
+
candidates: ChangeSetPrCandidate[];
|
|
133
|
+
/**
|
|
134
|
+
* D11151: the task's OTHER own-branch PRs when it shipped across several,
|
|
135
|
+
* oldest first. Each is recorded as its own `implemented` attempt before the
|
|
136
|
+
* primary (latest) PR, which is what the stored gate evidence ends up citing.
|
|
137
|
+
*/
|
|
138
|
+
additionalPrs?: Array<{
|
|
139
|
+
prNumber: number;
|
|
140
|
+
mergeCommitSha?: string;
|
|
141
|
+
files: string[];
|
|
142
|
+
deletedFiles: string[];
|
|
143
|
+
implementedEvidence: string | null;
|
|
144
|
+
}>;
|
|
145
|
+
/** Planned `implemented` atoms (without `satisfies:`), or null when none derive. */
|
|
146
|
+
implementedEvidence: string | null;
|
|
147
|
+
/** Blockers found while deriving the change set. */
|
|
148
|
+
blockers: DonePlanBlocker[];
|
|
149
|
+
/** Non-blocking observations, e.g. PR discovery that could not reach `gh`. */
|
|
150
|
+
warnings: string[];
|
|
151
|
+
/**
|
|
152
|
+
* The merged-PR lookup failed (e.g. `gh` unavailable), so a non-PR change set
|
|
153
|
+
* does not prove the change is unmerged (T12656).
|
|
154
|
+
*/
|
|
155
|
+
prDiscoveryFailed?: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Whether the task's PR has merged to the default branch, as the PR lookup
|
|
158
|
+
* found it — independent of `source` (T12656 review): a merged PR whose
|
|
159
|
+
* `pr:` check was refused still falls back to the task branch, and the
|
|
160
|
+
* branch outlives a squash merge. Absent when no PR was examined.
|
|
161
|
+
*/
|
|
162
|
+
mergeState?: ChangeSetMergeState;
|
|
163
|
+
}
|
|
164
|
+
/** Whether a task's change has merged to the default branch. */
|
|
165
|
+
export type ChangeSetMergeState = 'merged' | 'unmerged' | 'unknown';
|
|
166
|
+
/** Planned state of one verification gate. */
|
|
167
|
+
export interface DonePlanGate {
|
|
168
|
+
/** Gate name. */
|
|
169
|
+
gate: VerificationGate;
|
|
170
|
+
/** Whether the project's verification policy requires it. */
|
|
171
|
+
required: boolean;
|
|
172
|
+
/** Whether the task already has the gate recorded as passed. */
|
|
173
|
+
passed: boolean;
|
|
174
|
+
/** Planned `--evidence` string (with `satisfies:`), or null when nothing is planned. */
|
|
175
|
+
evidence: string | null;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Cache state of a tool run the plan needs.
|
|
179
|
+
*
|
|
180
|
+
* - `fresh-pass` / `fresh-fail` — an ADR-061 cache entry exists for the
|
|
181
|
+
* current HEAD, dirty fingerprint and execution root.
|
|
182
|
+
* - `miss` — `cleo done` would run the tool.
|
|
183
|
+
* - `not-applicable` — the resolver says the tool does not apply here.
|
|
184
|
+
* - `unresolved` — no command resolves for the tool.
|
|
185
|
+
*/
|
|
186
|
+
export type DonePlanToolCacheState = 'fresh-pass' | 'fresh-fail' | 'miss' | 'not-applicable' | 'unresolved';
|
|
187
|
+
/** One tool run a gate needs. The planner never executes it. */
|
|
188
|
+
export interface DonePlanToolRun {
|
|
189
|
+
/** Canonical tool name used in the `tool:` atom. */
|
|
190
|
+
tool: string;
|
|
191
|
+
/** Gate the result satisfies. */
|
|
192
|
+
gate: VerificationGate;
|
|
193
|
+
/** Resolved command line, or null when unresolved. */
|
|
194
|
+
command: string | null;
|
|
195
|
+
/** Resolver source (`project-context`, `language-default`, …). */
|
|
196
|
+
source: string | null;
|
|
197
|
+
/** Cache state for the current tree. */
|
|
198
|
+
cache: DonePlanToolCacheState;
|
|
199
|
+
/** Cached exit code, when an entry exists. */
|
|
200
|
+
exitCode?: number;
|
|
201
|
+
/** When the cached result was captured. */
|
|
202
|
+
capturedAt?: string;
|
|
203
|
+
/** Resolver refusal reason, when unresolved or not applicable. */
|
|
204
|
+
reason?: string;
|
|
205
|
+
}
|
|
206
|
+
/** Stored result of a typed acceptance gate. The planner never runs it. */
|
|
207
|
+
export interface DonePlanTypedGate {
|
|
208
|
+
/** Criterion alias (`AC<n>`). */
|
|
209
|
+
alias: string;
|
|
210
|
+
/** Typed gate kind. */
|
|
211
|
+
kind: string;
|
|
212
|
+
/** Requirement id, when the gate declares one. */
|
|
213
|
+
req?: string;
|
|
214
|
+
/** Latest stored result; `not-run` when none is stored. */
|
|
215
|
+
status: 'pass' | 'fail' | 'not-run';
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Why an acceptance criterion is (or is not) linked automatically.
|
|
219
|
+
*
|
|
220
|
+
* - `typed-gate` — the criterion is a typed gate with a stored passing result.
|
|
221
|
+
* - `files-in-diff` — every repo path the criterion names is in the change set.
|
|
222
|
+
* - `agent` — the agent named it with `--satisfies`.
|
|
223
|
+
* - `recorded` — already linked by gate evidence the task has recorded.
|
|
224
|
+
* - `none` — no deterministic coverage; the agent must answer.
|
|
225
|
+
*/
|
|
226
|
+
export type DonePlanAcBasis = 'typed-gate' | 'files-in-diff' | 'agent' | 'recorded' | 'none';
|
|
227
|
+
/** Mapping of one acceptance criterion to gate evidence. */
|
|
228
|
+
export interface DonePlanAcMapping {
|
|
229
|
+
/** Criterion alias (`AC<n>`). */
|
|
230
|
+
alias: string;
|
|
231
|
+
/** Canonical criterion UUID. */
|
|
232
|
+
id: string;
|
|
233
|
+
/** Criterion text. */
|
|
234
|
+
text: string;
|
|
235
|
+
/** Whether the criterion is linked, by any {@link DonePlanAcBasis} other than `none`. */
|
|
236
|
+
mapped: boolean;
|
|
237
|
+
/** Gates whose planned evidence carries `satisfies:` for this criterion. */
|
|
238
|
+
gates: VerificationGate[];
|
|
239
|
+
/** Why it is or is not linked. */
|
|
240
|
+
basis: DonePlanAcBasis;
|
|
241
|
+
/** Repo paths the criterion names (for `files-in-diff` and its misses). */
|
|
242
|
+
files?: string[];
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Result of `deriveTaskEvidence` / `cleo done <id> --plan`.
|
|
246
|
+
*
|
|
247
|
+
* Read-only by construction: the planner records nothing and executes no tool
|
|
248
|
+
* or typed gate. `commands` are the calls `cleo done` would issue, spelled as
|
|
249
|
+
* the existing verbs so every one is runnable today.
|
|
250
|
+
*/
|
|
251
|
+
export interface DonePlan {
|
|
252
|
+
/** Task the plan is for. */
|
|
253
|
+
taskId: string;
|
|
254
|
+
/** Directory the commands must run from (the change set's execution root). */
|
|
255
|
+
runFrom: string;
|
|
256
|
+
/** The derived change set. */
|
|
257
|
+
changeSet: TaskChangeSet;
|
|
258
|
+
/** Every evidence gate the plan covers, required or already passed. */
|
|
259
|
+
gates: DonePlanGate[];
|
|
260
|
+
/** Tool runs the required gates need. */
|
|
261
|
+
toolRuns: DonePlanToolRun[];
|
|
262
|
+
/** Typed acceptance gates and their stored results. */
|
|
263
|
+
typedGates: DonePlanTypedGate[];
|
|
264
|
+
/** Per-criterion mapping. */
|
|
265
|
+
acMapping: DonePlanAcMapping[];
|
|
266
|
+
/** Aliases of criteria that need `--satisfies` from the agent. */
|
|
267
|
+
needsSatisfies: string[];
|
|
268
|
+
/** Blockers, ordered: the first is the one to clear first. */
|
|
269
|
+
blockers: DonePlanBlocker[];
|
|
270
|
+
/**
|
|
271
|
+
* D11151: `implemented` evidence (with its criterion links) for each of the
|
|
272
|
+
* task's earlier own-branch PRs, recorded as separate attempts before the
|
|
273
|
+
* primary gate write.
|
|
274
|
+
*/
|
|
275
|
+
additionalImplemented?: string[];
|
|
276
|
+
/** Runnable commands, in order, that record the gates and complete the task. */
|
|
277
|
+
commands: string[];
|
|
278
|
+
/** True when no blocker remains and `commands` would succeed as planned. */
|
|
279
|
+
ready: boolean;
|
|
280
|
+
/** The single next step: the first blocker's, or the first command. */
|
|
281
|
+
next: DoneNextStep | null;
|
|
282
|
+
}
|
|
283
|
+
/** One tool `cleo done` ran (or reused from the ADR-061 cache) before recording. */
|
|
284
|
+
export interface DoneToolResult {
|
|
285
|
+
/** Canonical tool name. */
|
|
286
|
+
tool: string;
|
|
287
|
+
/** Gate the result satisfies. */
|
|
288
|
+
gate: VerificationGate;
|
|
289
|
+
/** Exit code of the run. */
|
|
290
|
+
exitCode: number | null;
|
|
291
|
+
/** Whether the result came from the ADR-061 cache. */
|
|
292
|
+
cacheHit: boolean;
|
|
293
|
+
/** Wall-clock duration of the run (0 for a cache hit). */
|
|
294
|
+
durationMs: number;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Successful `cleo done` / `cleo verify --auto` write: every required gate the
|
|
298
|
+
* task lacked, recorded in one transaction through the existing validators.
|
|
299
|
+
* Completion (for `cleo done`) is reported by the caller alongside it.
|
|
300
|
+
*/
|
|
301
|
+
export interface DoneRecordResult {
|
|
302
|
+
/** Task the gates were recorded for. */
|
|
303
|
+
taskId: string;
|
|
304
|
+
/** Gates this call recorded, in gate order. */
|
|
305
|
+
recordedGates: VerificationGate[];
|
|
306
|
+
/** Required gates that were already passed and left untouched. */
|
|
307
|
+
alreadyPassed: VerificationGate[];
|
|
308
|
+
/** Tool runs performed or reused before the write. */
|
|
309
|
+
toolResults: DoneToolResult[];
|
|
310
|
+
/** Typed acceptance gates executed before the write (0 when the task has none). */
|
|
311
|
+
typedGateCount: number;
|
|
312
|
+
/** Whether all required gates are now passed. */
|
|
313
|
+
verificationPassed: boolean;
|
|
314
|
+
/** The plan the write was derived from. */
|
|
315
|
+
plan: DonePlan;
|
|
316
|
+
}
|
|
317
|
+
/** Details of an `E_DONE_BLOCKED` failure: one blocker, one next step. */
|
|
318
|
+
export interface DoneBlockedDetails {
|
|
319
|
+
/** The blocker that stopped `cleo done`. */
|
|
320
|
+
blocker: DonePlanBlockerCode;
|
|
321
|
+
/** Original error code (e.g. `E_EVIDENCE_TOOL_FAILED`), when one exists. */
|
|
322
|
+
cause?: string;
|
|
323
|
+
/** The one next step. */
|
|
324
|
+
next: DoneNextStep;
|
|
325
|
+
/** Gates already recorded before a completion refusal (empty otherwise). */
|
|
326
|
+
recordedGates: VerificationGate[];
|
|
327
|
+
/** The plan, for tooling. */
|
|
328
|
+
plan: DonePlan;
|
|
329
|
+
}
|
|
330
|
+
//# sourceMappingURL=done-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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
|
+
/**
|
|
2
|
+
* Contracts for the read-only `cleo done --plan` evidence planner.
|
|
3
|
+
*
|
|
4
|
+
* The planner derives, without executing a tool or writing a row, the
|
|
5
|
+
* evidence `cleo done` would record for each required verification gate:
|
|
6
|
+
* the implemented change set and where it came from, the tool runs and
|
|
7
|
+
* whether each already has a fresh cached result, which acceptance criteria
|
|
8
|
+
* map to evidence deterministically, and the blockers in the order an agent
|
|
9
|
+
* must clear them.
|
|
10
|
+
*
|
|
11
|
+
* Spec: `verify-streamlined-design` §3.2 and §7 step 1-2.
|
|
12
|
+
*
|
|
13
|
+
* @task T12623
|
|
14
|
+
* @task T12624
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=done-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"done-plan.js","sourceRoot":"","sources":["../src/done-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -45,7 +45,7 @@ import type { VerificationGate } from './task.js';
|
|
|
45
45
|
*
|
|
46
46
|
* @task T12030
|
|
47
47
|
*/
|
|
48
|
-
export declare const EVIDENCE_ATOM_KINDS: readonly ["commit", "files", "test-run", "tool", "url", "note", "decision", "pr", "loc-drop", "callsite-coverage", "satisfies"];
|
|
48
|
+
export declare const EVIDENCE_ATOM_KINDS: readonly ["commit", "files", "test-run", "tool", "url", "note", "decision", "pr", "ci", "loc-drop", "callsite-coverage", "satisfies"];
|
|
49
49
|
/**
|
|
50
50
|
* `commit:<sha>` atom — references a git commit by full or short SHA.
|
|
51
51
|
*
|
|
@@ -147,7 +147,11 @@ export declare const decisionAtomSchema: z.ZodObject<{
|
|
|
147
147
|
* checks task relationship and changed artifacts. Implementation also needs
|
|
148
148
|
* inspected file evidence; testing and review require actual result atoms.
|
|
149
149
|
*
|
|
150
|
-
* Format: `pr:<positive integer>` (e.g. `pr:357`)
|
|
150
|
+
* Format: `pr:<positive integer>` (e.g. `pr:357`), or
|
|
151
|
+
* `pr:<component>@<integration>` (e.g. `pr:356@357`, T12671): component PR
|
|
152
|
+
* #356 merged into an integration branch that PR #357 landed on the default
|
|
153
|
+
* branch. The integration PR supplies the merge commit; the component PR
|
|
154
|
+
* supplies the task linkage and the changed files.
|
|
151
155
|
*
|
|
152
156
|
* @task T9764
|
|
153
157
|
* @task T9838
|
|
@@ -155,6 +159,24 @@ export declare const decisionAtomSchema: z.ZodObject<{
|
|
|
155
159
|
export declare const prAtomSchema: z.ZodObject<{
|
|
156
160
|
kind: z.ZodLiteral<"pr">;
|
|
157
161
|
prNumber: z.ZodNumber;
|
|
162
|
+
componentPrNumber: z.ZodOptional<z.ZodNumber>;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
/**
|
|
165
|
+
* `ci:<number>` atom — the required CI checks of a merged PR, judged on the
|
|
166
|
+
* PR's actual MERGE COMMIT (never its head). Satisfies `testsPassed` and
|
|
167
|
+
* `qaPassed` only when the project opts in with `evidence.ciSatisfies`
|
|
168
|
+
* (owner decision D11149).
|
|
169
|
+
*
|
|
170
|
+
* Format: `ci:<positive integer>` (e.g. `ci:357`), or
|
|
171
|
+
* `ci:<component>@<integration>` (e.g. `ci:356@357`, T12671): the integration
|
|
172
|
+
* PR's merge-commit CI, for a task linked through its component PR.
|
|
173
|
+
*
|
|
174
|
+
* @task T12634
|
|
175
|
+
*/
|
|
176
|
+
export declare const ciAtomSchema: z.ZodObject<{
|
|
177
|
+
kind: z.ZodLiteral<"ci">;
|
|
178
|
+
prNumber: z.ZodNumber;
|
|
179
|
+
componentPrNumber: z.ZodOptional<z.ZodNumber>;
|
|
158
180
|
}, z.core.$strip>;
|
|
159
181
|
/**
|
|
160
182
|
* `loc-drop:<fromLines>:<toLines>` atom — proves that a migrated engine shed
|
|
@@ -317,6 +339,11 @@ export declare const EvidenceAtomSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
317
339
|
}, z.core.$strip>, z.ZodObject<{
|
|
318
340
|
kind: z.ZodLiteral<"pr">;
|
|
319
341
|
prNumber: z.ZodNumber;
|
|
342
|
+
componentPrNumber: z.ZodOptional<z.ZodNumber>;
|
|
343
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
344
|
+
kind: z.ZodLiteral<"ci">;
|
|
345
|
+
prNumber: z.ZodNumber;
|
|
346
|
+
componentPrNumber: z.ZodOptional<z.ZodNumber>;
|
|
320
347
|
}, z.core.$strip>, z.ZodObject<{
|
|
321
348
|
kind: z.ZodLiteral<"loc-drop">;
|
|
322
349
|
fromLines: z.ZodNumber;
|
|
@@ -513,47 +540,5 @@ export declare class EvidenceParseError extends Error {
|
|
|
513
540
|
readonly fix: string;
|
|
514
541
|
constructor(message: string, fix: string);
|
|
515
542
|
}
|
|
516
|
-
/**
|
|
517
|
-
* Parse the raw CLI `--evidence` string into structured atoms.
|
|
518
|
-
*
|
|
519
|
-
* Syntax:
|
|
520
|
-
* ```
|
|
521
|
-
* evidence-list := atom (';' atom)*
|
|
522
|
-
* atom := kind ':' payload
|
|
523
|
-
* ```
|
|
524
|
-
*
|
|
525
|
-
* The payload format depends on `kind`:
|
|
526
|
-
*
|
|
527
|
-
* - `files` — comma-separated paths
|
|
528
|
-
* - `loc-drop` — `<fromLines>:<toLines>` (two integers)
|
|
529
|
-
* - `callsite-coverage` — `<symbolName>:<relativeSourcePath>`
|
|
530
|
-
* - `pr` — positive integer
|
|
531
|
-
* - everything else — opaque payload string until the next `;`
|
|
532
|
-
*
|
|
533
|
-
* A `state:MERGED` modifier may follow a `pr:<num>` atom and is consumed
|
|
534
|
-
* in-place (no separate atom is emitted) — see T9838. Any other usage of
|
|
535
|
-
* `state:` is rejected.
|
|
536
|
-
*
|
|
537
|
-
* Whitespace surrounding the `;` separators and around `kind`/`payload` is
|
|
538
|
-
* trimmed. Empty chunks are skipped (consecutive `;;` is tolerated).
|
|
539
|
-
*
|
|
540
|
-
* @param raw - Raw `--evidence` string.
|
|
541
|
-
* @returns Parsed atoms ready for {@link validateEvidenceForGate} or for
|
|
542
|
-
* the runtime validator in `packages/core/src/tasks/evidence.ts`.
|
|
543
|
-
* @throws {@link EvidenceParseError} when the input is malformed.
|
|
544
|
-
*
|
|
545
|
-
* @example
|
|
546
|
-
* ```ts
|
|
547
|
-
* parseEvidenceString('commit:abc1234;files:src/foo.ts,src/bar.ts;tool:lint');
|
|
548
|
-
* // [
|
|
549
|
-
* // { kind: 'commit', sha: 'abc1234' },
|
|
550
|
-
* // { kind: 'files', paths: ['src/foo.ts', 'src/bar.ts'] },
|
|
551
|
-
* // { kind: 'tool', tool: 'lint' },
|
|
552
|
-
* // ]
|
|
553
|
-
* ```
|
|
554
|
-
*
|
|
555
|
-
* @task T10337
|
|
556
|
-
* @adr ADR-051
|
|
557
|
-
*/
|
|
558
543
|
export declare function parseEvidenceString(raw: string): EvidenceAtom[];
|
|
559
544
|
//# sourceMappingURL=evidence-atom-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evidence-atom-schema.d.ts","sourceRoot":"","sources":["../src/evidence-atom-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAOlD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"evidence-atom-schema.d.ts","sourceRoot":"","sources":["../src/evidence-atom-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAOlD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,uIAawB,CAAC;AAkBzD;;;;;;;;GAQG;AACH,eAAO,MAAM,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gB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,EAAE,CA4O/D"}
|
|
@@ -57,6 +57,7 @@ export const EVIDENCE_ATOM_KINDS = [
|
|
|
57
57
|
'note',
|
|
58
58
|
'decision',
|
|
59
59
|
'pr',
|
|
60
|
+
'ci',
|
|
60
61
|
'loc-drop',
|
|
61
62
|
'callsite-coverage',
|
|
62
63
|
'satisfies',
|
|
@@ -181,7 +182,11 @@ export const decisionAtomSchema = z.object({
|
|
|
181
182
|
* checks task relationship and changed artifacts. Implementation also needs
|
|
182
183
|
* inspected file evidence; testing and review require actual result atoms.
|
|
183
184
|
*
|
|
184
|
-
* Format: `pr:<positive integer>` (e.g. `pr:357`)
|
|
185
|
+
* Format: `pr:<positive integer>` (e.g. `pr:357`), or
|
|
186
|
+
* `pr:<component>@<integration>` (e.g. `pr:356@357`, T12671): component PR
|
|
187
|
+
* #356 merged into an integration branch that PR #357 landed on the default
|
|
188
|
+
* branch. The integration PR supplies the merge commit; the component PR
|
|
189
|
+
* supplies the task linkage and the changed files.
|
|
185
190
|
*
|
|
186
191
|
* @task T9764
|
|
187
192
|
* @task T9838
|
|
@@ -189,6 +194,24 @@ export const decisionAtomSchema = z.object({
|
|
|
189
194
|
export const prAtomSchema = z.object({
|
|
190
195
|
kind: z.literal('pr'),
|
|
191
196
|
prNumber: z.number().int().positive('pr atom requires a positive integer PR number'),
|
|
197
|
+
componentPrNumber: z.number().int().positive().optional(),
|
|
198
|
+
});
|
|
199
|
+
/**
|
|
200
|
+
* `ci:<number>` atom — the required CI checks of a merged PR, judged on the
|
|
201
|
+
* PR's actual MERGE COMMIT (never its head). Satisfies `testsPassed` and
|
|
202
|
+
* `qaPassed` only when the project opts in with `evidence.ciSatisfies`
|
|
203
|
+
* (owner decision D11149).
|
|
204
|
+
*
|
|
205
|
+
* Format: `ci:<positive integer>` (e.g. `ci:357`), or
|
|
206
|
+
* `ci:<component>@<integration>` (e.g. `ci:356@357`, T12671): the integration
|
|
207
|
+
* PR's merge-commit CI, for a task linked through its component PR.
|
|
208
|
+
*
|
|
209
|
+
* @task T12634
|
|
210
|
+
*/
|
|
211
|
+
export const ciAtomSchema = z.object({
|
|
212
|
+
kind: z.literal('ci'),
|
|
213
|
+
prNumber: z.number().int().positive('ci atom requires a positive integer PR number'),
|
|
214
|
+
componentPrNumber: z.number().int().positive().optional(),
|
|
192
215
|
});
|
|
193
216
|
/**
|
|
194
217
|
* `loc-drop:<fromLines>:<toLines>` atom — proves that a migrated engine shed
|
|
@@ -359,6 +382,7 @@ export const EvidenceAtomSchema = z.discriminatedUnion('kind', [
|
|
|
359
382
|
noteAtomSchema,
|
|
360
383
|
decisionAtomSchema,
|
|
361
384
|
prAtomSchema,
|
|
385
|
+
ciAtomSchema,
|
|
362
386
|
locDropAtomSchema,
|
|
363
387
|
callsiteCoverageAtomSchema,
|
|
364
388
|
satisfiesAtomSchema,
|
|
@@ -407,8 +431,8 @@ export const GATE_EVIDENCE_REQUIREMENTS = Object.freeze({
|
|
|
407
431
|
['pr', 'files'],
|
|
408
432
|
],
|
|
409
433
|
},
|
|
410
|
-
testsPassed: { oneOf: [['test-run'], ['tool']] },
|
|
411
|
-
qaPassed: { oneOf: [['tool']] },
|
|
434
|
+
testsPassed: { oneOf: [['test-run'], ['tool'], ['ci']] },
|
|
435
|
+
qaPassed: { oneOf: [['tool'], ['ci']] },
|
|
412
436
|
documented: { oneOf: [['files'], ['url']] },
|
|
413
437
|
securityPassed: { oneOf: [['tool'], ['note']] },
|
|
414
438
|
cleanupDone: { oneOf: [['note']] },
|
|
@@ -442,6 +466,7 @@ const ATOM_EXAMPLES = Object.freeze({
|
|
|
442
466
|
note: 'note:<short description>',
|
|
443
467
|
decision: 'decision:D-arch-001',
|
|
444
468
|
pr: 'pr:357',
|
|
469
|
+
ci: 'ci:357',
|
|
445
470
|
'loc-drop': 'loc-drop:<fromLines>:<toLines>',
|
|
446
471
|
'callsite-coverage': 'callsite-coverage:<symbolName>:<relativeSourcePath>',
|
|
447
472
|
satisfies: 'satisfies:T1234#AC2',
|
|
@@ -631,6 +656,20 @@ export class EvidenceParseError extends Error {
|
|
|
631
656
|
* @task T10337
|
|
632
657
|
* @adr ADR-051
|
|
633
658
|
*/
|
|
659
|
+
/**
|
|
660
|
+
* `<n>` or `<component>@<integration>` (T12671), each a positive integer.
|
|
661
|
+
* The integration PR is the atom's `prNumber`.
|
|
662
|
+
*/
|
|
663
|
+
function parsePrReference(payload) {
|
|
664
|
+
const match = /^(\d+)(?:@(\d+))?$/.exec(payload);
|
|
665
|
+
if (!match)
|
|
666
|
+
return null;
|
|
667
|
+
const first = Number(match[1]);
|
|
668
|
+
const second = match[2] === undefined ? null : Number(match[2]);
|
|
669
|
+
if (first <= 0 || (second !== null && (second <= 0 || second === first)))
|
|
670
|
+
return null;
|
|
671
|
+
return second === null ? { prNumber: first } : { prNumber: second, componentPrNumber: first };
|
|
672
|
+
}
|
|
634
673
|
export function parseEvidenceString(raw) {
|
|
635
674
|
if (!raw || typeof raw !== 'string') {
|
|
636
675
|
throw new EvidenceParseError('Evidence string is empty', "Pass evidence like '--evidence commit:<sha>;files:<path>;...'");
|
|
@@ -687,12 +726,13 @@ export function parseEvidenceString(raw) {
|
|
|
687
726
|
atoms.push({ kind: 'decision', decisionId: payload });
|
|
688
727
|
break;
|
|
689
728
|
}
|
|
690
|
-
case 'pr':
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
729
|
+
case 'pr':
|
|
730
|
+
case 'ci': {
|
|
731
|
+
const ref = parsePrReference(payload);
|
|
732
|
+
if (!ref) {
|
|
733
|
+
throw new EvidenceParseError(`${kind} atom requires a positive integer PR number, got "${payload}" in "${chunk}"`, `Use format: ${kind}:<number> e.g. ${kind}:357, or ${kind}:<component>@<integration> e.g. ${kind}:356@357`);
|
|
694
734
|
}
|
|
695
|
-
atoms.push({ kind: 'pr',
|
|
735
|
+
atoms.push(kind === 'pr' ? { kind: 'pr', ...ref } : { kind: 'ci', ...ref });
|
|
696
736
|
break;
|
|
697
737
|
}
|
|
698
738
|
case 'loc-drop': {
|