sdtk-code-kit 0.3.0 → 0.3.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 +204 -204
- package/assets/manifest/toolkit-bundle.manifest.json +147 -147
- package/assets/manifest/toolkit-bundle.sha256.txt +5 -5
- package/bin/sdtk-code.js +14 -14
- package/package.json +44 -44
- package/src/commands/agent-team.js +479 -174
- package/src/commands/build.js +53 -53
- package/src/commands/doctor.js +51 -51
- package/src/commands/generate.js +11 -11
- package/src/commands/guardrails.js +215 -215
- package/src/commands/help.js +266 -257
- package/src/commands/init.js +98 -98
- package/src/commands/plan.js +53 -53
- package/src/commands/readiness.js +77 -77
- package/src/commands/resume.js +61 -61
- package/src/commands/runtime.js +224 -224
- package/src/commands/ship.js +59 -59
- package/src/commands/sleep.js +132 -132
- package/src/commands/start.js +89 -89
- package/src/commands/status.js +77 -77
- package/src/commands/update.js +11 -11
- package/src/commands/verify.js +71 -71
- package/src/index.js +112 -112
- package/src/lib/agent-team-author.js +552 -0
- package/src/lib/agent-team-evidence.js +302 -0
- package/src/lib/agent-team-execute.js +892 -0
- package/src/lib/agent-team-export.js +411 -409
- package/src/lib/agent-team-plan.js +514 -514
- package/src/lib/agent-team-readiness.js +161 -0
- package/src/lib/agent-team-report.js +165 -0
- package/src/lib/agent-team-sleep-execute.js +524 -0
- package/src/lib/agent-team-sleep-session.js +278 -0
- package/src/lib/args.js +107 -107
- package/src/lib/errors.js +41 -41
- package/src/lib/model-provider.js +219 -0
- package/src/lib/powershell.js +65 -65
- package/src/lib/project-target-guard.js +53 -53
- package/src/lib/scope.js +72 -72
- package/src/lib/ship-readiness.js +281 -281
- package/src/lib/sleep-plan.js +175 -175
- package/src/lib/sleep-report.js +229 -229
- package/src/lib/toolkit-payload.js +72 -72
- package/src/lib/trust-events.js +264 -185
- package/src/lib/trust-file-scope.js +154 -154
- package/src/lib/trust-policy.js +212 -212
- package/src/lib/trust-redact.js +58 -35
- package/src/lib/trust-trace.js +179 -179
- package/src/lib/update.js +344 -344
- package/src/lib/workflow-artifact.js +503 -503
- package/src/lib/workflow-build.js +127 -127
- package/src/lib/workflow-doctor.js +83 -83
- package/src/lib/workflow-handoff.js +1029 -1029
- package/src/lib/workflow-intake.js +101 -101
- package/src/lib/workflow-plan.js +193 -193
- package/src/lib/workflow-review-packet.js +650 -650
- package/src/lib/workflow-ship.js +213 -213
- package/src/lib/workflow-state.js +438 -438
- package/src/lib/workflow-verify.js +393 -393
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { ValidationError } = require("./errors");
|
|
4
|
-
const { createOrUpdateWorkflowArtifact, loadWorkflowArtifactState } = require("./workflow-artifact");
|
|
5
|
-
|
|
6
|
-
function normalizeEntries(entries) {
|
|
7
|
-
return (entries || []).map((entry) => entry.trim()).filter(Boolean);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function resolveBuildStatus(flags, state) {
|
|
11
|
-
if (flags.complete && flags.blocked) {
|
|
12
|
-
throw new ValidationError('Use either "--complete" or "--blocked", not both.');
|
|
13
|
-
}
|
|
14
|
-
if (flags.complete) {
|
|
15
|
-
return "completed";
|
|
16
|
-
}
|
|
17
|
-
if (flags.blocked) {
|
|
18
|
-
return "blocked";
|
|
19
|
-
}
|
|
20
|
-
if (state.currentPhase === "build" && state.phaseStatus === "completed") {
|
|
21
|
-
return state.phaseStatus;
|
|
22
|
-
}
|
|
23
|
-
return "in_progress";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function getSuggestedEngineSkills(lane, flags, phaseStatus) {
|
|
27
|
-
if (lane === "bugfix") {
|
|
28
|
-
const skills = ["code-debug (if failure reproduction is needed)", "code-tdd", "code-execute"];
|
|
29
|
-
if (phaseStatus === "blocked" && !skills.includes("code-debug")) {
|
|
30
|
-
skills.unshift("code-debug");
|
|
31
|
-
}
|
|
32
|
-
return skills;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const skills = ["code-worktree", "code-tdd", "code-execute"];
|
|
36
|
-
if (flags["parallel-reason"]) {
|
|
37
|
-
skills.push("code-parallel");
|
|
38
|
-
}
|
|
39
|
-
if (phaseStatus === "blocked") {
|
|
40
|
-
skills.push("code-debug");
|
|
41
|
-
}
|
|
42
|
-
return skills;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function validateBuildState(state) {
|
|
46
|
-
if (state.intakeOutcome === "BLOCKED_MISSING_INPUTS") {
|
|
47
|
-
throw new ValidationError(
|
|
48
|
-
"Workflow artifact is blocked by missing upstream inputs. Re-run \"sdtk-code start\" after the handoff inputs are ready."
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (state.lane === "feature") {
|
|
53
|
-
if (state.currentPhase === "start") {
|
|
54
|
-
throw new ValidationError(
|
|
55
|
-
'Feature-lane workflow must complete "plan" before "build". Run "sdtk-code plan" first.'
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
if (state.currentPhase !== "plan" && state.currentPhase !== "build") {
|
|
59
|
-
throw new ValidationError(
|
|
60
|
-
`Cannot run "build" from current phase "${state.currentPhase}". Re-run the next legal workflow step instead.`
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
if (state.intakeOutcome !== "READY_FOR_PLAN") {
|
|
64
|
-
throw new ValidationError(
|
|
65
|
-
`Feature-lane workflow is not ready for "build". Current intake outcome: ${state.intakeOutcome}.`
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (state.currentPhase !== "start" && state.currentPhase !== "plan" && state.currentPhase !== "build") {
|
|
72
|
-
throw new ValidationError(
|
|
73
|
-
`Cannot run "build" from current phase "${state.currentPhase}". Re-run the next legal workflow step instead.`
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (state.intakeOutcome !== "READY_FOR_BUILD_BUGFIX") {
|
|
78
|
-
throw new ValidationError(
|
|
79
|
-
`Bugfix-lane workflow is not ready for "build". Current intake outcome: ${state.intakeOutcome}.`
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function runBuild(projectPath, featureKey, flags) {
|
|
85
|
-
const state = loadWorkflowArtifactState(projectPath, featureKey);
|
|
86
|
-
validateBuildState(state);
|
|
87
|
-
|
|
88
|
-
if (state.lane === "bugfix" && flags["parallel-reason"]) {
|
|
89
|
-
throw new ValidationError('Bugfix-lane build does not support "--parallel-reason" in v1.');
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const phaseStatus = resolveBuildStatus(flags, state);
|
|
93
|
-
const suggestedEngineSkills = getSuggestedEngineSkills(state.lane, flags, phaseStatus);
|
|
94
|
-
const nextPhase = phaseStatus === "completed" ? "verify" : "build";
|
|
95
|
-
const blockingState = phaseStatus === "blocked" ? "blocked_build_issue" : "clear";
|
|
96
|
-
|
|
97
|
-
const artifactPath = createOrUpdateWorkflowArtifact({
|
|
98
|
-
projectPath,
|
|
99
|
-
featureKey,
|
|
100
|
-
lane: state.lane,
|
|
101
|
-
currentPhase: "build",
|
|
102
|
-
phaseStatus,
|
|
103
|
-
intakeOutcome: state.intakeOutcome,
|
|
104
|
-
nextPhase,
|
|
105
|
-
blockingState,
|
|
106
|
-
suggestedEngineSkills,
|
|
107
|
-
managedBlocks: ["METADATA", "BUILD", "STATUS"],
|
|
108
|
-
activeSlices: normalizeEntries(flags["active-slice"]),
|
|
109
|
-
buildNotes: normalizeEntries(flags.note),
|
|
110
|
-
debugNotes: normalizeEntries(flags["debug-note"]),
|
|
111
|
-
parallelReason: flags["parallel-reason"] || null,
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
return {
|
|
115
|
-
artifactPath,
|
|
116
|
-
lane: state.lane,
|
|
117
|
-
phaseStatus,
|
|
118
|
-
nextPhase,
|
|
119
|
-
suggestedEngineSkills,
|
|
120
|
-
executionMode: flags["parallel-reason"] ? "parallel" : "sequential",
|
|
121
|
-
activeSliceCount: normalizeEntries(flags["active-slice"]).length,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
module.exports = {
|
|
126
|
-
runBuild,
|
|
127
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { ValidationError } = require("./errors");
|
|
4
|
+
const { createOrUpdateWorkflowArtifact, loadWorkflowArtifactState } = require("./workflow-artifact");
|
|
5
|
+
|
|
6
|
+
function normalizeEntries(entries) {
|
|
7
|
+
return (entries || []).map((entry) => entry.trim()).filter(Boolean);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function resolveBuildStatus(flags, state) {
|
|
11
|
+
if (flags.complete && flags.blocked) {
|
|
12
|
+
throw new ValidationError('Use either "--complete" or "--blocked", not both.');
|
|
13
|
+
}
|
|
14
|
+
if (flags.complete) {
|
|
15
|
+
return "completed";
|
|
16
|
+
}
|
|
17
|
+
if (flags.blocked) {
|
|
18
|
+
return "blocked";
|
|
19
|
+
}
|
|
20
|
+
if (state.currentPhase === "build" && state.phaseStatus === "completed") {
|
|
21
|
+
return state.phaseStatus;
|
|
22
|
+
}
|
|
23
|
+
return "in_progress";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getSuggestedEngineSkills(lane, flags, phaseStatus) {
|
|
27
|
+
if (lane === "bugfix") {
|
|
28
|
+
const skills = ["code-debug (if failure reproduction is needed)", "code-tdd", "code-execute"];
|
|
29
|
+
if (phaseStatus === "blocked" && !skills.includes("code-debug")) {
|
|
30
|
+
skills.unshift("code-debug");
|
|
31
|
+
}
|
|
32
|
+
return skills;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const skills = ["code-worktree", "code-tdd", "code-execute"];
|
|
36
|
+
if (flags["parallel-reason"]) {
|
|
37
|
+
skills.push("code-parallel");
|
|
38
|
+
}
|
|
39
|
+
if (phaseStatus === "blocked") {
|
|
40
|
+
skills.push("code-debug");
|
|
41
|
+
}
|
|
42
|
+
return skills;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function validateBuildState(state) {
|
|
46
|
+
if (state.intakeOutcome === "BLOCKED_MISSING_INPUTS") {
|
|
47
|
+
throw new ValidationError(
|
|
48
|
+
"Workflow artifact is blocked by missing upstream inputs. Re-run \"sdtk-code start\" after the handoff inputs are ready."
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (state.lane === "feature") {
|
|
53
|
+
if (state.currentPhase === "start") {
|
|
54
|
+
throw new ValidationError(
|
|
55
|
+
'Feature-lane workflow must complete "plan" before "build". Run "sdtk-code plan" first.'
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
if (state.currentPhase !== "plan" && state.currentPhase !== "build") {
|
|
59
|
+
throw new ValidationError(
|
|
60
|
+
`Cannot run "build" from current phase "${state.currentPhase}". Re-run the next legal workflow step instead.`
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
if (state.intakeOutcome !== "READY_FOR_PLAN") {
|
|
64
|
+
throw new ValidationError(
|
|
65
|
+
`Feature-lane workflow is not ready for "build". Current intake outcome: ${state.intakeOutcome}.`
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (state.currentPhase !== "start" && state.currentPhase !== "plan" && state.currentPhase !== "build") {
|
|
72
|
+
throw new ValidationError(
|
|
73
|
+
`Cannot run "build" from current phase "${state.currentPhase}". Re-run the next legal workflow step instead.`
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (state.intakeOutcome !== "READY_FOR_BUILD_BUGFIX") {
|
|
78
|
+
throw new ValidationError(
|
|
79
|
+
`Bugfix-lane workflow is not ready for "build". Current intake outcome: ${state.intakeOutcome}.`
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function runBuild(projectPath, featureKey, flags) {
|
|
85
|
+
const state = loadWorkflowArtifactState(projectPath, featureKey);
|
|
86
|
+
validateBuildState(state);
|
|
87
|
+
|
|
88
|
+
if (state.lane === "bugfix" && flags["parallel-reason"]) {
|
|
89
|
+
throw new ValidationError('Bugfix-lane build does not support "--parallel-reason" in v1.');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const phaseStatus = resolveBuildStatus(flags, state);
|
|
93
|
+
const suggestedEngineSkills = getSuggestedEngineSkills(state.lane, flags, phaseStatus);
|
|
94
|
+
const nextPhase = phaseStatus === "completed" ? "verify" : "build";
|
|
95
|
+
const blockingState = phaseStatus === "blocked" ? "blocked_build_issue" : "clear";
|
|
96
|
+
|
|
97
|
+
const artifactPath = createOrUpdateWorkflowArtifact({
|
|
98
|
+
projectPath,
|
|
99
|
+
featureKey,
|
|
100
|
+
lane: state.lane,
|
|
101
|
+
currentPhase: "build",
|
|
102
|
+
phaseStatus,
|
|
103
|
+
intakeOutcome: state.intakeOutcome,
|
|
104
|
+
nextPhase,
|
|
105
|
+
blockingState,
|
|
106
|
+
suggestedEngineSkills,
|
|
107
|
+
managedBlocks: ["METADATA", "BUILD", "STATUS"],
|
|
108
|
+
activeSlices: normalizeEntries(flags["active-slice"]),
|
|
109
|
+
buildNotes: normalizeEntries(flags.note),
|
|
110
|
+
debugNotes: normalizeEntries(flags["debug-note"]),
|
|
111
|
+
parallelReason: flags["parallel-reason"] || null,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
artifactPath,
|
|
116
|
+
lane: state.lane,
|
|
117
|
+
phaseStatus,
|
|
118
|
+
nextPhase,
|
|
119
|
+
suggestedEngineSkills,
|
|
120
|
+
executionMode: flags["parallel-reason"] ? "parallel" : "sequential",
|
|
121
|
+
activeSliceCount: normalizeEntries(flags["active-slice"]).length,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
module.exports = {
|
|
126
|
+
runBuild,
|
|
127
|
+
};
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { loadWorkflowState } = require("./workflow-state");
|
|
4
|
-
|
|
5
|
-
function pushIfMissing(issues, value, message) {
|
|
6
|
-
if (!value) {
|
|
7
|
-
issues.push(message);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function runWorkflowDoctor(projectPath, featureKey) {
|
|
12
|
-
const state = loadWorkflowState(projectPath, featureKey);
|
|
13
|
-
const issues = [];
|
|
14
|
-
|
|
15
|
-
if (!state.exists) {
|
|
16
|
-
issues.push("Workflow artifact is missing. Run start before workflow recovery commands.");
|
|
17
|
-
} else {
|
|
18
|
-
pushIfMissing(issues, state.blocks.METADATA, "Workflow artifact is missing required managed block METADATA.");
|
|
19
|
-
pushIfMissing(issues, state.blocks.STATUS, "Workflow artifact is missing required managed block STATUS.");
|
|
20
|
-
|
|
21
|
-
if (state.currentPhase === "verify" || state.currentPhase === "ship" || state.nextPhase === "ship") {
|
|
22
|
-
pushIfMissing(
|
|
23
|
-
issues,
|
|
24
|
-
state.blocks.VERIFY,
|
|
25
|
-
"Workflow state requires VERIFY surface, but the VERIFY managed block is missing."
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (state.currentPhase === "ship") {
|
|
30
|
-
pushIfMissing(
|
|
31
|
-
issues,
|
|
32
|
-
state.blocks.SHIP,
|
|
33
|
-
"Workflow state requires SHIP surface, but the SHIP managed block is missing."
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (state.blocks.METADATA) {
|
|
38
|
-
if (!state.lane || state.lane === "unknown") {
|
|
39
|
-
issues.push("METADATA lane is missing or unreadable.");
|
|
40
|
-
}
|
|
41
|
-
if (!state.currentPhase || state.currentPhase === "unknown") {
|
|
42
|
-
issues.push("METADATA current phase is missing or unreadable.");
|
|
43
|
-
}
|
|
44
|
-
if (!state.phaseStatus || state.phaseStatus === "unknown") {
|
|
45
|
-
issues.push("METADATA phase status is missing or unreadable.");
|
|
46
|
-
}
|
|
47
|
-
if (!state.intakeOutcome || state.intakeOutcome === "unknown") {
|
|
48
|
-
issues.push("METADATA intake outcome is missing or unreadable.");
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (state.blocks.STATUS) {
|
|
53
|
-
if (!state.nextPhase || state.nextPhase === "unknown") {
|
|
54
|
-
issues.push("STATUS next recommended phase is missing or unreadable.");
|
|
55
|
-
}
|
|
56
|
-
if (!state.blockingState || state.blockingState === "unknown") {
|
|
57
|
-
issues.push("STATUS blocking state is missing or unreadable.");
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (
|
|
62
|
-
state.currentPhase === "verify" &&
|
|
63
|
-
state.phaseStatus === "completed" &&
|
|
64
|
-
Array.isArray(state.evidenceEntries) &&
|
|
65
|
-
state.evidenceEntries.length === 0
|
|
66
|
-
) {
|
|
67
|
-
issues.push("Workflow claims verify completed, but no evidence entries are recorded in VERIFY.");
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
issues.push(...state.contradictions);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const uniqueIssues = [...new Set(issues)];
|
|
74
|
-
return {
|
|
75
|
-
state,
|
|
76
|
-
issues: uniqueIssues,
|
|
77
|
-
healthy: uniqueIssues.length === 0,
|
|
78
|
-
result: uniqueIssues.length === 0 ? "healthy" : "invalid",
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
module.exports = {
|
|
83
|
-
runWorkflowDoctor,
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { loadWorkflowState } = require("./workflow-state");
|
|
4
|
+
|
|
5
|
+
function pushIfMissing(issues, value, message) {
|
|
6
|
+
if (!value) {
|
|
7
|
+
issues.push(message);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function runWorkflowDoctor(projectPath, featureKey) {
|
|
12
|
+
const state = loadWorkflowState(projectPath, featureKey);
|
|
13
|
+
const issues = [];
|
|
14
|
+
|
|
15
|
+
if (!state.exists) {
|
|
16
|
+
issues.push("Workflow artifact is missing. Run start before workflow recovery commands.");
|
|
17
|
+
} else {
|
|
18
|
+
pushIfMissing(issues, state.blocks.METADATA, "Workflow artifact is missing required managed block METADATA.");
|
|
19
|
+
pushIfMissing(issues, state.blocks.STATUS, "Workflow artifact is missing required managed block STATUS.");
|
|
20
|
+
|
|
21
|
+
if (state.currentPhase === "verify" || state.currentPhase === "ship" || state.nextPhase === "ship") {
|
|
22
|
+
pushIfMissing(
|
|
23
|
+
issues,
|
|
24
|
+
state.blocks.VERIFY,
|
|
25
|
+
"Workflow state requires VERIFY surface, but the VERIFY managed block is missing."
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (state.currentPhase === "ship") {
|
|
30
|
+
pushIfMissing(
|
|
31
|
+
issues,
|
|
32
|
+
state.blocks.SHIP,
|
|
33
|
+
"Workflow state requires SHIP surface, but the SHIP managed block is missing."
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (state.blocks.METADATA) {
|
|
38
|
+
if (!state.lane || state.lane === "unknown") {
|
|
39
|
+
issues.push("METADATA lane is missing or unreadable.");
|
|
40
|
+
}
|
|
41
|
+
if (!state.currentPhase || state.currentPhase === "unknown") {
|
|
42
|
+
issues.push("METADATA current phase is missing or unreadable.");
|
|
43
|
+
}
|
|
44
|
+
if (!state.phaseStatus || state.phaseStatus === "unknown") {
|
|
45
|
+
issues.push("METADATA phase status is missing or unreadable.");
|
|
46
|
+
}
|
|
47
|
+
if (!state.intakeOutcome || state.intakeOutcome === "unknown") {
|
|
48
|
+
issues.push("METADATA intake outcome is missing or unreadable.");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (state.blocks.STATUS) {
|
|
53
|
+
if (!state.nextPhase || state.nextPhase === "unknown") {
|
|
54
|
+
issues.push("STATUS next recommended phase is missing or unreadable.");
|
|
55
|
+
}
|
|
56
|
+
if (!state.blockingState || state.blockingState === "unknown") {
|
|
57
|
+
issues.push("STATUS blocking state is missing or unreadable.");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (
|
|
62
|
+
state.currentPhase === "verify" &&
|
|
63
|
+
state.phaseStatus === "completed" &&
|
|
64
|
+
Array.isArray(state.evidenceEntries) &&
|
|
65
|
+
state.evidenceEntries.length === 0
|
|
66
|
+
) {
|
|
67
|
+
issues.push("Workflow claims verify completed, but no evidence entries are recorded in VERIFY.");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
issues.push(...state.contradictions);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const uniqueIssues = [...new Set(issues)];
|
|
74
|
+
return {
|
|
75
|
+
state,
|
|
76
|
+
issues: uniqueIssues,
|
|
77
|
+
healthy: uniqueIssues.length === 0,
|
|
78
|
+
result: uniqueIssues.length === 0 ? "healthy" : "invalid",
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
module.exports = {
|
|
83
|
+
runWorkflowDoctor,
|
|
84
84
|
};
|