cclaw-cli 0.51.30 → 0.55.2
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 +22 -16
- package/dist/artifact-linter/brainstorm.d.ts +2 -0
- package/dist/artifact-linter/brainstorm.js +245 -0
- package/dist/artifact-linter/design.d.ts +2 -0
- package/dist/artifact-linter/design.js +323 -0
- package/dist/artifact-linter/plan.d.ts +2 -0
- package/dist/artifact-linter/plan.js +162 -0
- package/dist/artifact-linter/review-army.d.ts +24 -0
- package/dist/artifact-linter/review-army.js +365 -0
- package/dist/artifact-linter/review.d.ts +2 -0
- package/dist/artifact-linter/review.js +65 -0
- package/dist/artifact-linter/scope.d.ts +2 -0
- package/dist/artifact-linter/scope.js +115 -0
- package/dist/artifact-linter/shared.d.ts +246 -0
- package/dist/artifact-linter/shared.js +1488 -0
- package/dist/artifact-linter/ship.d.ts +2 -0
- package/dist/artifact-linter/ship.js +46 -0
- package/dist/artifact-linter/spec.d.ts +2 -0
- package/dist/artifact-linter/spec.js +108 -0
- package/dist/artifact-linter/tdd.d.ts +2 -0
- package/dist/artifact-linter/tdd.js +124 -0
- package/dist/artifact-linter.d.ts +4 -76
- package/dist/artifact-linter.js +56 -2949
- package/dist/cli.d.ts +1 -6
- package/dist/cli.js +4 -159
- package/dist/codex-feature-flag.d.ts +1 -1
- package/dist/codex-feature-flag.js +1 -1
- package/dist/config.d.ts +3 -2
- package/dist/config.js +67 -3
- package/dist/constants.d.ts +1 -7
- package/dist/constants.js +9 -15
- package/dist/content/cancel-command.js +2 -2
- package/dist/content/closeout-guidance.js +10 -7
- package/dist/content/core-agents.d.ts +18 -0
- package/dist/content/core-agents.js +46 -2
- package/dist/content/decision-protocol.d.ts +1 -1
- package/dist/content/decision-protocol.js +1 -1
- package/dist/content/examples.js +6 -6
- package/dist/content/harness-doc.js +20 -2
- package/dist/content/hook-inline-snippets.d.ts +17 -4
- package/dist/content/hook-inline-snippets.js +218 -5
- package/dist/content/hook-manifest.d.ts +2 -2
- package/dist/content/hook-manifest.js +2 -2
- package/dist/content/hooks.d.ts +1 -0
- package/dist/content/hooks.js +32 -137
- package/dist/content/idea-command.d.ts +8 -0
- package/dist/content/{ideate-command.js → idea-command.js} +57 -50
- package/dist/content/idea-frames.d.ts +31 -0
- package/dist/content/{ideate-frames.js → idea-frames.js} +9 -9
- package/dist/content/idea-ranking.d.ts +25 -0
- package/dist/content/{ideate-ranking.js → idea-ranking.js} +5 -5
- package/dist/content/iron-laws.d.ts +0 -1
- package/dist/content/iron-laws.js +31 -16
- package/dist/content/learnings.js +1 -1
- package/dist/content/meta-skill.js +7 -7
- package/dist/content/node-hooks.d.ts +10 -0
- package/dist/content/node-hooks.js +43 -9
- package/dist/content/opencode-plugin.js +3 -3
- package/dist/content/skills.js +19 -7
- package/dist/content/stage-schema.js +44 -2
- package/dist/content/stages/_lint-metadata/index.js +26 -2
- package/dist/content/stages/brainstorm.js +13 -7
- package/dist/content/stages/design.js +16 -11
- package/dist/content/stages/plan.js +7 -4
- package/dist/content/stages/review.js +4 -4
- package/dist/content/stages/schema-types.d.ts +1 -1
- package/dist/content/stages/scope.js +15 -12
- package/dist/content/stages/ship.js +2 -2
- package/dist/content/stages/spec.js +9 -3
- package/dist/content/stages/tdd.js +14 -4
- package/dist/content/start-command.js +11 -10
- package/dist/content/status-command.js +3 -3
- package/dist/content/subagents.js +60 -6
- package/dist/content/templates.d.ts +1 -1
- package/dist/content/templates.js +102 -150
- package/dist/content/tree-command.js +2 -2
- package/dist/content/utility-skills.d.ts +2 -2
- package/dist/content/utility-skills.js +2 -2
- package/dist/content/view-command.js +4 -2
- package/dist/delegation.d.ts +2 -0
- package/dist/delegation.js +2 -1
- package/dist/early-loop.d.ts +66 -0
- package/dist/early-loop.js +275 -0
- package/dist/gate-evidence.d.ts +8 -0
- package/dist/gate-evidence.js +141 -5
- package/dist/harness-adapters.d.ts +2 -2
- package/dist/harness-adapters.js +47 -18
- package/dist/install.js +153 -29
- package/dist/internal/advance-stage/advance.d.ts +50 -0
- package/dist/internal/advance-stage/advance.js +480 -0
- package/dist/internal/advance-stage/cancel-run.d.ts +8 -0
- package/dist/internal/advance-stage/cancel-run.js +19 -0
- package/dist/internal/advance-stage/flow-state-coercion.d.ts +3 -0
- package/dist/internal/advance-stage/flow-state-coercion.js +81 -0
- package/dist/internal/advance-stage/helpers.d.ts +14 -0
- package/dist/internal/advance-stage/helpers.js +145 -0
- package/dist/internal/advance-stage/hook.d.ts +8 -0
- package/dist/internal/advance-stage/hook.js +40 -0
- package/dist/internal/advance-stage/parsers.d.ts +54 -0
- package/dist/internal/advance-stage/parsers.js +307 -0
- package/dist/internal/advance-stage/review-loop.d.ts +7 -0
- package/dist/internal/advance-stage/review-loop.js +170 -0
- package/dist/internal/advance-stage/rewind.d.ts +14 -0
- package/dist/internal/advance-stage/rewind.js +108 -0
- package/dist/internal/advance-stage/start-flow.d.ts +11 -0
- package/dist/internal/advance-stage/start-flow.js +136 -0
- package/dist/internal/advance-stage/verify.d.ts +29 -0
- package/dist/internal/advance-stage/verify.js +225 -0
- package/dist/internal/advance-stage.js +21 -1470
- package/dist/internal/compound-readiness.d.ts +1 -1
- package/dist/internal/compound-readiness.js +2 -2
- package/dist/internal/early-loop-status.d.ts +7 -0
- package/dist/internal/early-loop-status.js +90 -0
- package/dist/internal/runtime-integrity.d.ts +7 -0
- package/dist/internal/runtime-integrity.js +288 -0
- package/dist/internal/tdd-red-evidence.js +1 -1
- package/dist/knowledge-store.d.ts +3 -8
- package/dist/knowledge-store.js +16 -29
- package/dist/managed-resources.js +24 -2
- package/dist/policy.js +4 -6
- package/dist/run-archive.d.ts +1 -1
- package/dist/run-archive.js +12 -12
- package/dist/run-persistence.js +111 -11
- package/dist/tdd-cycle.d.ts +3 -3
- package/dist/tdd-cycle.js +1 -1
- package/dist/types.d.ts +18 -10
- package/package.json +1 -1
- package/dist/content/ideate-command.d.ts +0 -8
- package/dist/content/ideate-frames.d.ts +0 -31
- package/dist/content/ideate-ranking.d.ts +0 -25
- package/dist/content/next-command.d.ts +0 -20
- package/dist/content/next-command.js +0 -298
- package/dist/content/seed-shelf.d.ts +0 -36
- package/dist/content/seed-shelf.js +0 -301
- package/dist/content/stage-common-guidance.d.ts +0 -1
- package/dist/content/stage-common-guidance.js +0 -106
- package/dist/doctor-registry.d.ts +0 -10
- package/dist/doctor-registry.js +0 -186
- package/dist/doctor.d.ts +0 -17
- package/dist/doctor.js +0 -2201
- package/dist/internal/hook-manifest.d.ts +0 -16
- package/dist/internal/hook-manifest.js +0 -77
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { resolveArtifactPath } from "../../artifact-paths.js";
|
|
4
|
+
import { appendDelegation, checkMandatoryDelegations, readDelegationEvents, readDelegationLedger } from "../../delegation.js";
|
|
5
|
+
import { verifyCompletedStagesGateClosure, verifyCurrentStageGateEvidence } from "../../gate-evidence.js";
|
|
6
|
+
import { extractMarkdownSectionBody, parseLearningsSection } from "../../artifact-linter.js";
|
|
7
|
+
import { getAvailableTransitions, getTransitionGuards } from "../../flow-state.js";
|
|
8
|
+
import { appendKnowledge } from "../../knowledge-store.js";
|
|
9
|
+
import { readFlowState, writeFlowState } from "../../runs.js";
|
|
10
|
+
import { stageSchema } from "../../content/stage-schema.js";
|
|
11
|
+
import { extractReviewLoopEnvelopeFromArtifact } from "../../content/review-loop.js";
|
|
12
|
+
import { unique } from "./helpers.js";
|
|
13
|
+
import { AUTO_REVIEW_LOOP_GATE_BY_STAGE, reviewLoopArtifactFixHint, validateGateEvidenceShape } from "./review-loop.js";
|
|
14
|
+
import { ensureProactiveDelegationTrace } from "./verify.js";
|
|
15
|
+
function resolveSuccessorTransition(stage, track, transitionTargets, satisfiedGuards, selectedTransitionGuards) {
|
|
16
|
+
const natural = transitionTargets[0] ?? null;
|
|
17
|
+
const specialTargets = transitionTargets.filter((target) => target !== natural);
|
|
18
|
+
for (const target of specialTargets) {
|
|
19
|
+
const guards = getTransitionGuards(stage, target, track);
|
|
20
|
+
if (guards.length === 0)
|
|
21
|
+
continue;
|
|
22
|
+
const selectedSpecial = guards.some((guard) => selectedTransitionGuards.has(guard));
|
|
23
|
+
if (!selectedSpecial)
|
|
24
|
+
continue;
|
|
25
|
+
if (guards.every((guard) => satisfiedGuards.has(guard))) {
|
|
26
|
+
return target;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (natural) {
|
|
30
|
+
const guards = getTransitionGuards(stage, natural, track);
|
|
31
|
+
if (guards.every((guard) => satisfiedGuards.has(guard))) {
|
|
32
|
+
return natural;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
for (const target of specialTargets) {
|
|
36
|
+
const guards = getTransitionGuards(stage, target, track);
|
|
37
|
+
if (guards.every((guard) => satisfiedGuards.has(guard))) {
|
|
38
|
+
return target;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return natural;
|
|
42
|
+
}
|
|
43
|
+
export async function hydrateReviewLoopEvidenceFromArtifact(projectRoot, stage, track, selectedGateIds, evidenceByGate) {
|
|
44
|
+
const gateId = AUTO_REVIEW_LOOP_GATE_BY_STAGE[stage];
|
|
45
|
+
if (!gateId)
|
|
46
|
+
return;
|
|
47
|
+
if (!selectedGateIds.includes(gateId))
|
|
48
|
+
return;
|
|
49
|
+
const reviewStage = stage === "scope" || stage === "design" ? stage : null;
|
|
50
|
+
if (!reviewStage)
|
|
51
|
+
return;
|
|
52
|
+
const existing = evidenceByGate[gateId];
|
|
53
|
+
if (typeof existing === "string" && existing.trim().length > 0) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const resolved = await resolveArtifactPath(stage, {
|
|
57
|
+
projectRoot,
|
|
58
|
+
track,
|
|
59
|
+
intent: "read"
|
|
60
|
+
});
|
|
61
|
+
let raw = "";
|
|
62
|
+
try {
|
|
63
|
+
raw = await fs.readFile(resolved.absPath, "utf8");
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const envelope = extractReviewLoopEnvelopeFromArtifact(raw, reviewStage, resolved.relPath);
|
|
69
|
+
if (!envelope)
|
|
70
|
+
return;
|
|
71
|
+
evidenceByGate[gateId] = JSON.stringify(envelope);
|
|
72
|
+
}
|
|
73
|
+
export async function buildValidationReport(projectRoot, flowState, options = {}) {
|
|
74
|
+
const delegation = await checkMandatoryDelegations(projectRoot, flowState.currentStage);
|
|
75
|
+
const gates = await verifyCurrentStageGateEvidence(projectRoot, flowState);
|
|
76
|
+
const completedStages = verifyCompletedStagesGateClosure(flowState);
|
|
77
|
+
const blockedReviewRouteComplete = options.allowBlockedReviewRoute === true
|
|
78
|
+
&& flowState.currentStage === "review"
|
|
79
|
+
&& typeof flowState.guardEvidence.review_verdict_blocked === "string"
|
|
80
|
+
&& flowState.guardEvidence.review_verdict_blocked.trim().length > 0
|
|
81
|
+
&& !flowState.stageGateCatalog.review.passed.includes("review_criticals_resolved");
|
|
82
|
+
const ok = delegation.satisfied && gates.ok && (gates.complete || blockedReviewRouteComplete) && completedStages.ok;
|
|
83
|
+
return {
|
|
84
|
+
ok,
|
|
85
|
+
stage: flowState.currentStage,
|
|
86
|
+
delegation: {
|
|
87
|
+
satisfied: delegation.satisfied,
|
|
88
|
+
missing: delegation.missing,
|
|
89
|
+
waived: delegation.waived,
|
|
90
|
+
missingEvidence: delegation.missingEvidence,
|
|
91
|
+
missingDispatchProof: delegation.missingDispatchProof,
|
|
92
|
+
legacyInferredCompletions: delegation.legacyInferredCompletions,
|
|
93
|
+
corruptEventLines: delegation.corruptEventLines,
|
|
94
|
+
staleWorkers: delegation.staleWorkers,
|
|
95
|
+
expectedMode: delegation.expectedMode
|
|
96
|
+
},
|
|
97
|
+
gates: {
|
|
98
|
+
ok: gates.ok,
|
|
99
|
+
complete: gates.complete,
|
|
100
|
+
issues: gates.issues,
|
|
101
|
+
missingRequired: gates.missingRequired,
|
|
102
|
+
missingTriggeredConditional: gates.missingTriggeredConditional
|
|
103
|
+
},
|
|
104
|
+
completedStages: {
|
|
105
|
+
ok: completedStages.ok,
|
|
106
|
+
issues: completedStages.issues
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const LEARNINGS_HARVEST_MARKER_PREFIX = "<!-- cclaw:learnings-harvested:";
|
|
111
|
+
export function withLearningsHarvestMarker(artifactMarkdown, appendedEntries, skippedDuplicates) {
|
|
112
|
+
const suffix = artifactMarkdown.endsWith("\n") ? "" : "\n";
|
|
113
|
+
return `${artifactMarkdown}${suffix}${LEARNINGS_HARVEST_MARKER_PREFIX}${new Date().toISOString()} appended=${appendedEntries} skipped=${skippedDuplicates} -->\n`;
|
|
114
|
+
}
|
|
115
|
+
export async function harvestStageLearnings(projectRoot, stage, track) {
|
|
116
|
+
const resolvedArtifact = await resolveArtifactPath(stage, {
|
|
117
|
+
projectRoot,
|
|
118
|
+
track,
|
|
119
|
+
intent: "read"
|
|
120
|
+
});
|
|
121
|
+
const artifactPath = resolvedArtifact.absPath;
|
|
122
|
+
let raw = "";
|
|
123
|
+
try {
|
|
124
|
+
raw = await fs.readFile(artifactPath, "utf8");
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
return {
|
|
128
|
+
ok: false,
|
|
129
|
+
markerWritten: false,
|
|
130
|
+
parsedEntries: 0,
|
|
131
|
+
appendedEntries: 0,
|
|
132
|
+
skippedDuplicates: 0,
|
|
133
|
+
details: `Unable to read artifact for learnings harvest (${artifactPath}): ${err instanceof Error ? err.message : String(err)}`
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
if (raw.includes(LEARNINGS_HARVEST_MARKER_PREFIX)) {
|
|
137
|
+
return {
|
|
138
|
+
ok: true,
|
|
139
|
+
markerWritten: false,
|
|
140
|
+
parsedEntries: 0,
|
|
141
|
+
appendedEntries: 0,
|
|
142
|
+
skippedDuplicates: 0,
|
|
143
|
+
details: "Learnings already harvested for this artifact."
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
const learningsBody = extractMarkdownSectionBody(raw, "Learnings");
|
|
147
|
+
if (learningsBody === null) {
|
|
148
|
+
return {
|
|
149
|
+
ok: false,
|
|
150
|
+
markerWritten: false,
|
|
151
|
+
parsedEntries: 0,
|
|
152
|
+
appendedEntries: 0,
|
|
153
|
+
skippedDuplicates: 0,
|
|
154
|
+
details: 'Artifact is missing required "## Learnings" section.'
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const parsed = parseLearningsSection(learningsBody);
|
|
158
|
+
if (!parsed.ok) {
|
|
159
|
+
return {
|
|
160
|
+
ok: false,
|
|
161
|
+
markerWritten: false,
|
|
162
|
+
parsedEntries: 0,
|
|
163
|
+
appendedEntries: 0,
|
|
164
|
+
skippedDuplicates: 0,
|
|
165
|
+
details: parsed.details
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
const appendResult = await appendKnowledge(projectRoot, parsed.entries, {
|
|
169
|
+
stage,
|
|
170
|
+
originStage: stage,
|
|
171
|
+
originRun: null,
|
|
172
|
+
project: path.basename(projectRoot)
|
|
173
|
+
});
|
|
174
|
+
if (appendResult.invalid > 0) {
|
|
175
|
+
return {
|
|
176
|
+
ok: false,
|
|
177
|
+
markerWritten: false,
|
|
178
|
+
parsedEntries: parsed.entries.length,
|
|
179
|
+
appendedEntries: appendResult.appended,
|
|
180
|
+
skippedDuplicates: appendResult.skippedDuplicates,
|
|
181
|
+
details: `Learnings append failed schema checks: ${appendResult.errors.join(" | ")}`
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
const withMarker = withLearningsHarvestMarker(raw, appendResult.appended, appendResult.skippedDuplicates);
|
|
185
|
+
await fs.writeFile(artifactPath, withMarker, "utf8");
|
|
186
|
+
return {
|
|
187
|
+
ok: true,
|
|
188
|
+
markerWritten: true,
|
|
189
|
+
parsedEntries: parsed.entries.length,
|
|
190
|
+
appendedEntries: appendResult.appended,
|
|
191
|
+
skippedDuplicates: appendResult.skippedDuplicates,
|
|
192
|
+
details: parsed.none
|
|
193
|
+
? "Learnings section marked none; harvest marker recorded."
|
|
194
|
+
: `Harvested ${appendResult.appended} learning entr${appendResult.appended === 1 ? "y" : "ies"} (${appendResult.skippedDuplicates} duplicate skipped).`
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
export async function runAdvanceStage(projectRoot, args, io) {
|
|
198
|
+
const flowState = await readFlowState(projectRoot);
|
|
199
|
+
if (flowState.currentStage !== args.stage) {
|
|
200
|
+
io.stderr.write(`cclaw internal advance-stage: current stage is "${flowState.currentStage}", not "${args.stage}".\n`);
|
|
201
|
+
return 1;
|
|
202
|
+
}
|
|
203
|
+
const schema = stageSchema(args.stage, flowState.track);
|
|
204
|
+
const requiredGateIds = schema.requiredGates
|
|
205
|
+
.filter((gate) => gate.tier === "required")
|
|
206
|
+
.map((gate) => gate.id);
|
|
207
|
+
const transitionTargets = getAvailableTransitions(args.stage, flowState.track).map((rule) => rule.to);
|
|
208
|
+
const allowedGateIds = new Set(schema.requiredGates.map((gate) => gate.id));
|
|
209
|
+
const transitionGuardIds = new Set(transitionTargets
|
|
210
|
+
.flatMap((target) => getTransitionGuards(args.stage, target, flowState.track))
|
|
211
|
+
.filter((guardId) => !allowedGateIds.has(guardId)));
|
|
212
|
+
const selectableGateIds = new Set([...allowedGateIds, ...transitionGuardIds]);
|
|
213
|
+
const selectedGateIds = args.passedGateIds.length > 0
|
|
214
|
+
? args.passedGateIds.filter((gateId) => selectableGateIds.has(gateId))
|
|
215
|
+
: requiredGateIds;
|
|
216
|
+
const selectedGateIdSet = new Set(selectedGateIds);
|
|
217
|
+
const selectedTransitionGuards = selectedGateIds.filter((gateId) => transitionGuardIds.has(gateId));
|
|
218
|
+
const blockedReviewRoute = args.stage === "review" && selectedGateIdSet.has("review_verdict_blocked");
|
|
219
|
+
const requiredForSelectedRoute = blockedReviewRoute
|
|
220
|
+
? requiredGateIds.filter((gateId) => gateId !== "review_criticals_resolved")
|
|
221
|
+
: requiredGateIds;
|
|
222
|
+
const missingRequired = requiredForSelectedRoute.filter((gateId) => !selectedGateIdSet.has(gateId));
|
|
223
|
+
if (missingRequired.length > 0) {
|
|
224
|
+
io.stderr.write(`cclaw internal advance-stage: required gates not selected as passed: ${missingRequired.join(", ")}.\n`);
|
|
225
|
+
return 1;
|
|
226
|
+
}
|
|
227
|
+
const mandatory = new Set(schema.mandatoryDelegations);
|
|
228
|
+
for (const agent of args.waiveDelegations) {
|
|
229
|
+
if (!mandatory.has(agent)) {
|
|
230
|
+
io.stderr.write(`cclaw internal advance-stage: cannot waive "${agent}" for stage "${args.stage}" (not mandatory).\n`);
|
|
231
|
+
return 1;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (args.waiveDelegations.length > 0) {
|
|
235
|
+
const waiverReason = args.waiverReason?.trim();
|
|
236
|
+
if (!waiverReason) {
|
|
237
|
+
io.stderr.write("cclaw internal advance-stage: --waive-delegation requires an explicit non-empty --waiver-reason.\n");
|
|
238
|
+
return 1;
|
|
239
|
+
}
|
|
240
|
+
for (const agent of args.waiveDelegations) {
|
|
241
|
+
await appendDelegation(projectRoot, {
|
|
242
|
+
stage: args.stage,
|
|
243
|
+
agent,
|
|
244
|
+
mode: "mandatory",
|
|
245
|
+
status: "waived",
|
|
246
|
+
waiverReason,
|
|
247
|
+
fulfillmentMode: "role-switch",
|
|
248
|
+
ts: new Date().toISOString()
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
await hydrateReviewLoopEvidenceFromArtifact(projectRoot, args.stage, flowState.track, selectedGateIds, args.evidenceByGate);
|
|
253
|
+
const catalog = flowState.stageGateCatalog[args.stage];
|
|
254
|
+
const nextPassed = unique([...catalog.passed, ...selectedGateIds]).filter((gateId) => allowedGateIds.has(gateId));
|
|
255
|
+
const nextPassedSet = new Set(nextPassed);
|
|
256
|
+
const nextBlocked = unique(catalog.blocked.filter((gateId) => !nextPassedSet.has(gateId))).filter((gateId) => allowedGateIds.has(gateId));
|
|
257
|
+
const conditional = new Set(catalog.conditional);
|
|
258
|
+
const nextTriggered = unique([
|
|
259
|
+
...catalog.triggered.filter((gateId) => conditional.has(gateId)),
|
|
260
|
+
...nextPassed.filter((gateId) => conditional.has(gateId)),
|
|
261
|
+
...nextBlocked.filter((gateId) => conditional.has(gateId))
|
|
262
|
+
]);
|
|
263
|
+
const guardEvidenceGateIds = unique([...nextPassed, ...selectedTransitionGuards]);
|
|
264
|
+
const missingGuardEvidence = guardEvidenceGateIds.filter((gateId) => {
|
|
265
|
+
const existing = flowState.guardEvidence[gateId];
|
|
266
|
+
if (typeof existing === "string" && existing.trim().length > 0) {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
const provided = args.evidenceByGate[gateId];
|
|
270
|
+
return !(typeof provided === "string" && provided.trim().length > 0);
|
|
271
|
+
});
|
|
272
|
+
if (missingGuardEvidence.length > 0) {
|
|
273
|
+
io.stderr.write(`cclaw internal advance-stage: missing --evidence-json entries for passed gates: ${missingGuardEvidence.join(", ")}.\n`);
|
|
274
|
+
return 1;
|
|
275
|
+
}
|
|
276
|
+
const malformedGateEvidence = [];
|
|
277
|
+
for (const gateId of nextPassed) {
|
|
278
|
+
const provided = args.evidenceByGate[gateId];
|
|
279
|
+
const existing = flowState.guardEvidence[gateId];
|
|
280
|
+
const effectiveEvidence = typeof provided === "string" && provided.trim().length > 0
|
|
281
|
+
? provided
|
|
282
|
+
: typeof existing === "string" && existing.trim().length > 0
|
|
283
|
+
? existing
|
|
284
|
+
: "";
|
|
285
|
+
const issue = await validateGateEvidenceShape(projectRoot, args.stage, gateId, effectiveEvidence);
|
|
286
|
+
if (issue) {
|
|
287
|
+
malformedGateEvidence.push(`${gateId}: ${issue}${reviewLoopArtifactFixHint(args.stage, gateId)}`);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (malformedGateEvidence.length > 0) {
|
|
291
|
+
io.stderr.write(`cclaw internal advance-stage: gate evidence format check failed: ${malformedGateEvidence.join(" | ")}.\n`);
|
|
292
|
+
return 1;
|
|
293
|
+
}
|
|
294
|
+
const nextGuardEvidence = { ...flowState.guardEvidence };
|
|
295
|
+
for (const gateId of guardEvidenceGateIds) {
|
|
296
|
+
const provided = args.evidenceByGate[gateId];
|
|
297
|
+
if (typeof provided === "string" && provided.trim().length > 0) {
|
|
298
|
+
nextGuardEvidence[gateId] = provided.trim();
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
const nextStageCatalog = {
|
|
302
|
+
required: [...catalog.required],
|
|
303
|
+
recommended: [...catalog.recommended],
|
|
304
|
+
conditional: [...catalog.conditional],
|
|
305
|
+
triggered: nextTriggered,
|
|
306
|
+
passed: nextPassed,
|
|
307
|
+
blocked: nextBlocked
|
|
308
|
+
};
|
|
309
|
+
const candidateState = {
|
|
310
|
+
...flowState,
|
|
311
|
+
guardEvidence: nextGuardEvidence,
|
|
312
|
+
stageGateCatalog: {
|
|
313
|
+
...flowState.stageGateCatalog,
|
|
314
|
+
[args.stage]: nextStageCatalog
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
const validation = await buildValidationReport(projectRoot, candidateState, {
|
|
318
|
+
allowBlockedReviewRoute: blockedReviewRoute
|
|
319
|
+
});
|
|
320
|
+
if (!validation.ok) {
|
|
321
|
+
const ledgerForDiag = await readDelegationLedger(projectRoot).catch(() => ({ entries: [] }));
|
|
322
|
+
const eventsForDiag = await readDelegationEvents(projectRoot).catch(() => ({ events: [], corruptLines: [] }));
|
|
323
|
+
const ledgerEntriesText = await fs.readFile(path.join(projectRoot, ".cclaw/state/delegation-events.jsonl"), "utf8").catch(() => "");
|
|
324
|
+
const corruptSnippets = (() => {
|
|
325
|
+
if (validation.delegation.corruptEventLines.length === 0)
|
|
326
|
+
return [];
|
|
327
|
+
const lines = ledgerEntriesText.split(/\r?\n/u);
|
|
328
|
+
return validation.delegation.corruptEventLines.slice(0, 3).map((lineNo) => {
|
|
329
|
+
const line = lines[lineNo - 1] ?? "";
|
|
330
|
+
const sample = line.length > 120 ? `${line.slice(0, 117)}...` : line;
|
|
331
|
+
return `line ${lineNo}: ${sample}`;
|
|
332
|
+
});
|
|
333
|
+
})();
|
|
334
|
+
const dispatchProofDetails = validation.delegation.missingDispatchProof.flatMap((agent) => {
|
|
335
|
+
const rows = ledgerForDiag.entries.filter((entry) => entry.agent === agent && entry.status === "completed");
|
|
336
|
+
return rows.map((row) => `${agent}(spanId=${row.spanId ?? "unknown"})`);
|
|
337
|
+
});
|
|
338
|
+
const nextActions = [];
|
|
339
|
+
if (validation.delegation.missing.length > 0) {
|
|
340
|
+
nextActions.push(`Run mandatory delegation(s) for stage "${args.stage}": ${validation.delegation.missing.join(", ")}. These roles are required by the stage schema before advance. If dispatch is impossible, use the waiver fallback only with a user-visible reason: \`node .cclaw/hooks/stage-complete.mjs ${args.stage} --waive-delegation=${validation.delegation.missing.join(",")} --waiver-reason="<why safe>"\`.`);
|
|
341
|
+
}
|
|
342
|
+
if (validation.delegation.missingEvidence.length > 0) {
|
|
343
|
+
nextActions.push(`Role-switch fallback completion needs artifact evidenceRefs naming what the role proved; rerun completion with --evidence-ref=<artifact#anchor> or escalate to a real isolated dispatch surface.`);
|
|
344
|
+
}
|
|
345
|
+
if (validation.delegation.missingDispatchProof.length > 0) {
|
|
346
|
+
nextActions.push(`Isolated completion(s) ${dispatchProofDetails.join(", ") || validation.delegation.missingDispatchProof.join(", ")} lack event-log dispatch proof. The ledger says completed, but .cclaw/state/delegation-events.jsonl must show scheduled -> launched -> acknowledged -> completed with --span-id, --dispatch-id, --dispatch-surface, --agent-definition-path, ackTs, and completedTs before advancing.`);
|
|
347
|
+
}
|
|
348
|
+
if (validation.delegation.legacyInferredCompletions.length > 0) {
|
|
349
|
+
nextActions.push(`Pre-v3 ledger entries found: ${validation.delegation.legacyInferredCompletions.join(", ")}. Run \`node .cclaw/hooks/delegation-record.mjs --rerecord --span-id=<id> --dispatch-id=<id> --dispatch-surface=<surface> --agent-definition-path=<path>\` to upgrade the row to dispatch-proof shape.`);
|
|
350
|
+
}
|
|
351
|
+
if (validation.delegation.corruptEventLines.length > 0) {
|
|
352
|
+
nextActions.push(`delegation-events.jsonl has ${validation.delegation.corruptEventLines.length} corrupt line(s) at ${validation.delegation.corruptEventLines.slice(0, 3).join(", ")}${validation.delegation.corruptEventLines.length > 3 ? ", ..." : ""}; remove or fix them before advancing.`);
|
|
353
|
+
}
|
|
354
|
+
if (validation.delegation.staleWorkers.length > 0) {
|
|
355
|
+
nextActions.push(`Stale scheduled delegations ${validation.delegation.staleWorkers.join(", ")} have no terminal row sharing the same spanId; emit launched/acknowledged/completed (or failed/stale) before advancing.`);
|
|
356
|
+
}
|
|
357
|
+
if (validation.gates.issues.length > 0) {
|
|
358
|
+
nextActions.push("Fix the artifact/gate issue shown in gates.issues, then rerun stage-complete.");
|
|
359
|
+
}
|
|
360
|
+
if (validation.completedStages.issues.length > 0) {
|
|
361
|
+
nextActions.push("Repair previously completed stage gate closure before advancing.");
|
|
362
|
+
}
|
|
363
|
+
if (args.json) {
|
|
364
|
+
io.stdout.write(`${JSON.stringify({
|
|
365
|
+
ok: false,
|
|
366
|
+
command: "advance-stage",
|
|
367
|
+
stage: args.stage,
|
|
368
|
+
kind: "validation-failed",
|
|
369
|
+
delegation: validation.delegation,
|
|
370
|
+
gates: validation.gates,
|
|
371
|
+
completedStages: validation.completedStages,
|
|
372
|
+
diagnostics: {
|
|
373
|
+
dispatchProofRows: dispatchProofDetails,
|
|
374
|
+
corruptEventSamples: corruptSnippets,
|
|
375
|
+
unawareEvents: eventsForDiag.corruptLines.length
|
|
376
|
+
},
|
|
377
|
+
nextActions
|
|
378
|
+
})}\n`);
|
|
379
|
+
}
|
|
380
|
+
io.stderr.write(`cclaw internal advance-stage: validation failed for stage "${args.stage}".\n`);
|
|
381
|
+
if (validation.delegation.missing.length > 0) {
|
|
382
|
+
io.stderr.write(`- missing delegations: ${validation.delegation.missing.join(", ")}\n`);
|
|
383
|
+
io.stderr.write(` next action: run the named agent(s) for this stage, or rerun with --waive-delegation=${validation.delegation.missing.join(",")} --waiver-reason="<why safe>" only when the user accepts the safety trade-off.\n`);
|
|
384
|
+
}
|
|
385
|
+
if (validation.delegation.missingEvidence.length > 0) {
|
|
386
|
+
io.stderr.write(`- role-switch evidence missing: ${validation.delegation.missingEvidence.join(", ")}\n`);
|
|
387
|
+
io.stderr.write(` next action: include --evidence-ref=<artifact#anchor> when emitting the completed event so the artifact shows what was reviewed/proved, or escalate to a true isolated dispatch surface.\n`);
|
|
388
|
+
}
|
|
389
|
+
if (validation.delegation.missingDispatchProof.length > 0) {
|
|
390
|
+
io.stderr.write(`- isolated completion lacks dispatch proof: ${dispatchProofDetails.join(", ") || validation.delegation.missingDispatchProof.join(", ")}\n`);
|
|
391
|
+
io.stderr.write(` next action: repair the event log proof by emitting scheduled -> launched -> acknowledged -> completed with --span-id, --dispatch-id, --dispatch-surface, --agent-definition-path, ackTs, and completedTs before advancing.\n`);
|
|
392
|
+
}
|
|
393
|
+
if (validation.delegation.legacyInferredCompletions.length > 0) {
|
|
394
|
+
io.stderr.write(`- legacy-inferred completions need rerecord: ${validation.delegation.legacyInferredCompletions.join(", ")}\n`);
|
|
395
|
+
io.stderr.write(` next action: \`node .cclaw/hooks/delegation-record.mjs --rerecord --span-id=<id> --dispatch-id=<id> --dispatch-surface=<surface> --agent-definition-path=<path>\`.\n`);
|
|
396
|
+
}
|
|
397
|
+
if (validation.delegation.corruptEventLines.length > 0) {
|
|
398
|
+
io.stderr.write(`- corrupt delegation-events.jsonl line(s): ${validation.delegation.corruptEventLines.slice(0, 3).join(", ")}${validation.delegation.corruptEventLines.length > 3 ? `, ... (+${validation.delegation.corruptEventLines.length - 3})` : ""}\n`);
|
|
399
|
+
for (const snippet of corruptSnippets) {
|
|
400
|
+
io.stderr.write(` sample: ${snippet}\n`);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
if (validation.delegation.staleWorkers.length > 0) {
|
|
404
|
+
io.stderr.write(`- stale scheduled delegations: ${validation.delegation.staleWorkers.join(", ")}\n`);
|
|
405
|
+
io.stderr.write(` next action: emit a terminal row (completed/failed/stale) for the same span before advancing.\n`);
|
|
406
|
+
}
|
|
407
|
+
if (validation.gates.issues.length > 0) {
|
|
408
|
+
io.stderr.write(`- gate issues: ${validation.gates.issues.join(" | ")}\n`);
|
|
409
|
+
}
|
|
410
|
+
if (validation.completedStages.issues.length > 0) {
|
|
411
|
+
io.stderr.write(`- completed-stage closure issues: ${validation.completedStages.issues.join(" | ")}\n`);
|
|
412
|
+
}
|
|
413
|
+
return 1;
|
|
414
|
+
}
|
|
415
|
+
const proactiveTrace = await ensureProactiveDelegationTrace(projectRoot, args.stage, {
|
|
416
|
+
acceptWaiver: args.acceptProactiveWaiver,
|
|
417
|
+
waiverReason: args.acceptProactiveWaiverReason
|
|
418
|
+
});
|
|
419
|
+
if (proactiveTrace.missingRules.length > 0) {
|
|
420
|
+
const missingSummary = proactiveTrace.missingRules
|
|
421
|
+
.map((rule) => `${rule.agent} (when: ${rule.when})`)
|
|
422
|
+
.join(", ");
|
|
423
|
+
const nextAction = "Run the proactive delegations listed above, or rerun stage-complete with " +
|
|
424
|
+
"--accept-proactive-waiver [--accept-proactive-waiver-reason=\"<why safe>\"] " +
|
|
425
|
+
"after explicit user approval.";
|
|
426
|
+
if (args.json) {
|
|
427
|
+
io.stdout.write(`${JSON.stringify({
|
|
428
|
+
ok: false,
|
|
429
|
+
command: "advance-stage",
|
|
430
|
+
stage: args.stage,
|
|
431
|
+
kind: "proactive-delegations-missing",
|
|
432
|
+
proactiveDelegations: proactiveTrace.missingRules.map((rule) => ({
|
|
433
|
+
agent: rule.agent,
|
|
434
|
+
when: rule.when,
|
|
435
|
+
skill: rule.skill ?? null
|
|
436
|
+
})),
|
|
437
|
+
nextActions: [nextAction]
|
|
438
|
+
})}\n`);
|
|
439
|
+
}
|
|
440
|
+
io.stderr.write(`cclaw internal advance-stage: proactive delegation evidence is missing for stage "${args.stage}": ${missingSummary}.\n`);
|
|
441
|
+
io.stderr.write(` next action: ${nextAction}\n`);
|
|
442
|
+
return 1;
|
|
443
|
+
}
|
|
444
|
+
const learningsHarvest = await harvestStageLearnings(projectRoot, args.stage, flowState.track);
|
|
445
|
+
if (!learningsHarvest.ok) {
|
|
446
|
+
io.stderr.write(`cclaw internal advance-stage: learnings harvest failed for "${schema.artifactFile}". ${learningsHarvest.details}\n`);
|
|
447
|
+
return 1;
|
|
448
|
+
}
|
|
449
|
+
const satisfiedGuards = new Set([...nextPassed, ...selectedTransitionGuards]);
|
|
450
|
+
const successor = resolveSuccessorTransition(args.stage, flowState.track, transitionTargets, satisfiedGuards, new Set(selectedTransitionGuards));
|
|
451
|
+
const completedStages = blockedReviewRoute
|
|
452
|
+
? flowState.completedStages.filter((stage) => stage !== args.stage)
|
|
453
|
+
: flowState.completedStages.includes(args.stage)
|
|
454
|
+
? [...flowState.completedStages]
|
|
455
|
+
: [...flowState.completedStages, args.stage];
|
|
456
|
+
const finalState = {
|
|
457
|
+
...candidateState,
|
|
458
|
+
completedStages,
|
|
459
|
+
currentStage: successor ?? args.stage
|
|
460
|
+
};
|
|
461
|
+
await writeFlowState(projectRoot, finalState);
|
|
462
|
+
if (!args.quiet) {
|
|
463
|
+
io.stdout.write(`${JSON.stringify({
|
|
464
|
+
ok: true,
|
|
465
|
+
command: "advance-stage",
|
|
466
|
+
stage: args.stage,
|
|
467
|
+
nextStage: successor,
|
|
468
|
+
currentStage: finalState.currentStage,
|
|
469
|
+
completedStages: finalState.completedStages,
|
|
470
|
+
learnings: {
|
|
471
|
+
parsed: learningsHarvest.parsedEntries,
|
|
472
|
+
appended: learningsHarvest.appendedEntries,
|
|
473
|
+
skippedDuplicates: learningsHarvest.skippedDuplicates,
|
|
474
|
+
markerWritten: learningsHarvest.markerWritten,
|
|
475
|
+
details: learningsHarvest.details
|
|
476
|
+
}
|
|
477
|
+
}, null, 2)}\n`);
|
|
478
|
+
}
|
|
479
|
+
return 0;
|
|
480
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CancelRunArgs } from "./parsers.js";
|
|
2
|
+
import type { Writable } from "node:stream";
|
|
3
|
+
interface InternalIo {
|
|
4
|
+
stdout: Writable;
|
|
5
|
+
stderr: Writable;
|
|
6
|
+
}
|
|
7
|
+
export declare function runCancelRun(projectRoot: string, args: CancelRunArgs, io: InternalIo): Promise<number>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { archiveRun } from "../../runs.js";
|
|
2
|
+
export async function runCancelRun(projectRoot, args, io) {
|
|
3
|
+
const archived = await archiveRun(projectRoot, args.name, {
|
|
4
|
+
disposition: args.disposition,
|
|
5
|
+
dispositionReason: args.reason
|
|
6
|
+
});
|
|
7
|
+
if (!args.quiet) {
|
|
8
|
+
io.stdout.write(`${JSON.stringify({
|
|
9
|
+
ok: true,
|
|
10
|
+
command: "cancel-run",
|
|
11
|
+
disposition: archived.disposition,
|
|
12
|
+
reason: archived.dispositionReason ?? args.reason,
|
|
13
|
+
archiveId: archived.archiveId,
|
|
14
|
+
archivePath: archived.archivePath,
|
|
15
|
+
resetRunId: archived.resetState.activeRunId
|
|
16
|
+
}, null, 2)}\n`);
|
|
17
|
+
}
|
|
18
|
+
return 0;
|
|
19
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type FlowState } from "../../flow-state.js";
|
|
2
|
+
export declare function parseCandidateGateCatalog(value: unknown, fallback: FlowState["stageGateCatalog"]): FlowState["stageGateCatalog"];
|
|
3
|
+
export declare function coerceCandidateFlowState(raw: unknown, fallback: FlowState): FlowState;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { FLOW_STAGES } from "../../types.js";
|
|
2
|
+
import { isFlowTrack } from "../../flow-state.js";
|
|
3
|
+
import { emptyGateState, isFlowStageValue, parseGuardEvidence, parseStringList, unique } from "./helpers.js";
|
|
4
|
+
export function parseCandidateGateCatalog(value, fallback) {
|
|
5
|
+
const next = {};
|
|
6
|
+
for (const stage of FLOW_STAGES) {
|
|
7
|
+
// Guard against stale on-disk flow-state files that persisted a partial
|
|
8
|
+
// stageGateCatalog (missing a stage key). Previously `fallback[stage]`
|
|
9
|
+
// could be undefined and the spread below would throw at runtime.
|
|
10
|
+
const base = fallback[stage] ?? emptyGateState();
|
|
11
|
+
next[stage] = {
|
|
12
|
+
required: [...base.required],
|
|
13
|
+
recommended: [...base.recommended],
|
|
14
|
+
conditional: [...base.conditional],
|
|
15
|
+
triggered: [...base.triggered],
|
|
16
|
+
passed: [...base.passed],
|
|
17
|
+
blocked: [...base.blocked]
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
21
|
+
return next;
|
|
22
|
+
}
|
|
23
|
+
const rawCatalog = value;
|
|
24
|
+
for (const stage of FLOW_STAGES) {
|
|
25
|
+
const rawStage = rawCatalog[stage];
|
|
26
|
+
if (!rawStage || typeof rawStage !== "object" || Array.isArray(rawStage)) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const typed = rawStage;
|
|
30
|
+
const base = fallback[stage] ?? emptyGateState();
|
|
31
|
+
const allowed = new Set([...base.required, ...base.recommended, ...base.conditional]);
|
|
32
|
+
const conditional = new Set(base.conditional);
|
|
33
|
+
const passed = unique(parseStringList(typed.passed)).filter((gateId) => allowed.has(gateId));
|
|
34
|
+
const blocked = unique(parseStringList(typed.blocked)).filter((gateId) => allowed.has(gateId));
|
|
35
|
+
const triggered = unique([
|
|
36
|
+
...parseStringList(typed.triggered).filter((gateId) => conditional.has(gateId)),
|
|
37
|
+
...passed.filter((gateId) => conditional.has(gateId)),
|
|
38
|
+
...blocked.filter((gateId) => conditional.has(gateId))
|
|
39
|
+
]);
|
|
40
|
+
next[stage] = {
|
|
41
|
+
required: [...base.required],
|
|
42
|
+
recommended: [...base.recommended],
|
|
43
|
+
conditional: [...base.conditional],
|
|
44
|
+
triggered,
|
|
45
|
+
passed,
|
|
46
|
+
blocked
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return next;
|
|
50
|
+
}
|
|
51
|
+
export function coerceCandidateFlowState(raw, fallback) {
|
|
52
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
53
|
+
return fallback;
|
|
54
|
+
}
|
|
55
|
+
const typed = raw;
|
|
56
|
+
const track = isFlowTrack(typed.track) ? typed.track : fallback.track;
|
|
57
|
+
const currentStage = isFlowStageValue(typed.currentStage)
|
|
58
|
+
? typed.currentStage
|
|
59
|
+
: fallback.currentStage;
|
|
60
|
+
const completedStages = unique(parseStringList(typed.completedStages).filter((stage) => isFlowStageValue(stage)));
|
|
61
|
+
const skippedStagesRaw = parseStringList(typed.skippedStages).filter((stage) => isFlowStageValue(stage));
|
|
62
|
+
const skippedStages = skippedStagesRaw.length > 0 ? skippedStagesRaw : fallback.skippedStages;
|
|
63
|
+
// When the candidate payload omits `guardEvidence` entirely we must keep
|
|
64
|
+
// the on-disk fallback — otherwise a partial update (e.g. a tooling call
|
|
65
|
+
// that only passes stage + passedGateIds) would silently wipe every
|
|
66
|
+
// previously recorded evidence string and fail the next
|
|
67
|
+
// `verifyCurrentStageGateEvidence` check.
|
|
68
|
+
const candidateEvidence = parseGuardEvidence(typed.guardEvidence);
|
|
69
|
+
const guardEvidence = typed.guardEvidence === undefined
|
|
70
|
+
? { ...fallback.guardEvidence }
|
|
71
|
+
: candidateEvidence;
|
|
72
|
+
return {
|
|
73
|
+
...fallback,
|
|
74
|
+
currentStage,
|
|
75
|
+
completedStages,
|
|
76
|
+
track,
|
|
77
|
+
skippedStages,
|
|
78
|
+
guardEvidence,
|
|
79
|
+
stageGateCatalog: parseCandidateGateCatalog(typed.stageGateCatalog, fallback.stageGateCatalog)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type FlowStage } from "../../types.js";
|
|
2
|
+
import { type StageGateState } from "../../flow-state.js";
|
|
3
|
+
export declare function unique<T extends string>(values: T[]): T[];
|
|
4
|
+
export declare function asRecord(value: unknown): Record<string, unknown> | null;
|
|
5
|
+
export declare function parseStringList(raw: unknown): string[];
|
|
6
|
+
export declare function isFlowStageValue(value: unknown): value is FlowStage;
|
|
7
|
+
export declare function parseGuardEvidence(value: unknown): Record<string, string>;
|
|
8
|
+
export declare function emptyGateState(): StageGateState;
|
|
9
|
+
export declare function stringifyGateEvidenceValue(value: unknown): string;
|
|
10
|
+
export declare function parseEvidenceByGate(raw: string | undefined): Record<string, string>;
|
|
11
|
+
export declare function parseCsv(raw: string | undefined): string[];
|
|
12
|
+
export declare function pathExists(projectRoot: string, relPath: string): Promise<boolean>;
|
|
13
|
+
export declare function listExistingFiles(projectRoot: string, relPaths: string[]): Promise<string[]>;
|
|
14
|
+
export declare function listFilesUnder(projectRoot: string, relDir: string, limit?: number): Promise<string[]>;
|