sdtk-code-kit 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +202 -185
  2. package/assets/manifest/toolkit-bundle.manifest.json +54 -54
  3. package/assets/manifest/toolkit-bundle.sha256.txt +26 -26
  4. package/assets/toolkit/toolkit/install.ps1 +156 -119
  5. package/assets/toolkit/toolkit/scripts/install-claude-skills.ps1 +78 -78
  6. package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +150 -150
  7. package/assets/toolkit/toolkit/scripts/uninstall-claude-skills.ps1 +62 -62
  8. package/assets/toolkit/toolkit/scripts/uninstall-codex-skills.ps1 +82 -82
  9. package/assets/toolkit/toolkit/sdtk-spec.config.json +6 -6
  10. package/assets/toolkit/toolkit/sdtk-spec.config.profiles.example.json +12 -12
  11. package/assets/toolkit/toolkit/skills/code-brainstorm/SKILL.md +55 -55
  12. package/assets/toolkit/toolkit/skills/code-debug/SKILL.md +1 -1
  13. package/assets/toolkit/toolkit/skills/code-debug/references/root-cause-tracing.md +68 -68
  14. package/assets/toolkit/toolkit/skills/code-execute/SKILL.md +74 -74
  15. package/assets/toolkit/toolkit/skills/code-finish/SKILL.md +205 -205
  16. package/assets/toolkit/toolkit/skills/code-parallel/SKILL.md +64 -64
  17. package/assets/toolkit/toolkit/skills/code-parallel/references/code-quality-reviewer-prompt.md +26 -26
  18. package/assets/toolkit/toolkit/skills/code-parallel/references/implementer-prompt.md +113 -113
  19. package/assets/toolkit/toolkit/skills/code-parallel/references/spec-reviewer-prompt.md +61 -61
  20. package/assets/toolkit/toolkit/skills/code-plan/SKILL.md +85 -85
  21. package/assets/toolkit/toolkit/skills/code-review/SKILL.md +79 -79
  22. package/assets/toolkit/toolkit/skills/code-review/references/checklist.md +125 -125
  23. package/assets/toolkit/toolkit/skills/code-review/references/code-reviewer.md +146 -146
  24. package/assets/toolkit/toolkit/skills/code-ship/SKILL.md +52 -52
  25. package/assets/toolkit/toolkit/skills/code-tdd/SKILL.md +1 -1
  26. package/assets/toolkit/toolkit/skills/code-tdd/references/testing-anti-patterns.md +299 -299
  27. package/assets/toolkit/toolkit/skills/code-verify/SKILL.md +144 -144
  28. package/assets/toolkit/toolkit/skills/code-worktree/SKILL.md +13 -13
  29. package/assets/toolkit/toolkit/templates/CODE_WORKFLOW_TEMPLATE.md +140 -112
  30. package/bin/sdtk-code.js +14 -14
  31. package/package.json +4 -4
  32. package/src/commands/build.js +53 -53
  33. package/src/commands/doctor.js +52 -0
  34. package/src/commands/generate.js +11 -11
  35. package/src/commands/guardrails.js +123 -0
  36. package/src/commands/help.js +30 -4
  37. package/src/commands/init.js +98 -95
  38. package/src/commands/plan.js +53 -53
  39. package/src/commands/readiness.js +77 -0
  40. package/src/commands/resume.js +62 -0
  41. package/src/commands/runtime.js +224 -224
  42. package/src/commands/ship.js +59 -59
  43. package/src/commands/start.js +89 -89
  44. package/src/commands/status.js +78 -0
  45. package/src/commands/verify.js +71 -66
  46. package/src/index.js +32 -1
  47. package/src/lib/args.js +107 -107
  48. package/src/lib/errors.js +41 -41
  49. package/src/lib/powershell.js +65 -65
  50. package/src/lib/project-target-guard.js +53 -0
  51. package/src/lib/scope.js +72 -72
  52. package/src/lib/ship-readiness.js +281 -0
  53. package/src/lib/toolkit-payload.js +72 -72
  54. package/src/lib/trust-events.js +166 -0
  55. package/src/lib/trust-file-scope.js +154 -0
  56. package/src/lib/trust-policy.js +212 -0
  57. package/src/lib/trust-redact.js +35 -0
  58. package/src/lib/trust-trace.js +179 -0
  59. package/src/lib/update.js +8 -1
  60. package/src/lib/workflow-artifact.js +503 -496
  61. package/src/lib/workflow-build.js +127 -127
  62. package/src/lib/workflow-doctor.js +84 -0
  63. package/src/lib/workflow-handoff.js +1029 -937
  64. package/src/lib/workflow-intake.js +101 -101
  65. package/src/lib/workflow-plan.js +193 -193
  66. package/src/lib/workflow-review-packet.js +89 -0
  67. package/src/lib/workflow-ship.js +213 -213
  68. package/src/lib/workflow-state.js +439 -0
  69. package/src/lib/workflow-verify.js +43 -6
@@ -0,0 +1,439 @@
1
+ "use strict";
2
+
3
+ const fs = require("fs");
4
+ const {
5
+ extractManagedBlock,
6
+ getWorkflowArtifactPath,
7
+ parseManagedField,
8
+ } = require("./workflow-artifact");
9
+
10
+ const VALID_PHASES = new Set(["start", "plan", "build", "verify", "ship"]);
11
+ const VALID_PHASE_STATUSES = new Set(["pending", "in_progress", "completed", "blocked"]);
12
+ const VALID_NEXT_PHASES = new Set(["plan", "build", "verify", "ship", "none", "blocked"]);
13
+ const PLACEHOLDER_SLICES = new Set([
14
+ "Pending confirmation during workflow planning.",
15
+ "Pending lane-specific planning or build guidance.",
16
+ "Lightweight bugfix planning not recorded yet.",
17
+ "No active build slices recorded yet.",
18
+ "Pending build-phase execution.",
19
+ ]);
20
+
21
+ function quotePathForCommand(projectPath) {
22
+ const normalized = String(projectPath || ".");
23
+ return /\s/.test(normalized) ? `"${normalized}"` : normalized;
24
+ }
25
+
26
+ function normalizeNextPhase(rawValue) {
27
+ const normalized = String(rawValue || "").trim();
28
+ if (!normalized) {
29
+ return "unknown";
30
+ }
31
+ if (/^none\s*\(workflow closed\)$/i.test(normalized)) {
32
+ return "none";
33
+ }
34
+ return normalized;
35
+ }
36
+
37
+ function parseBulletSection(blockText, heading) {
38
+ if (!blockText) {
39
+ return [];
40
+ }
41
+
42
+ const escapedHeading = heading.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
43
+ const match = blockText.match(new RegExp(`### ${escapedHeading}\\r?\\n([\\s\\S]*?)(?=\\r?\\n### |$)`));
44
+ if (!match) {
45
+ return [];
46
+ }
47
+
48
+ return match[1]
49
+ .split(/\r?\n/)
50
+ .map((line) => line.trim())
51
+ .filter((line) => line.startsWith("- "))
52
+ .map((line) => line.slice(2).trim())
53
+ .filter(Boolean);
54
+ }
55
+
56
+ function parseInlinePlanSlices(planBlock) {
57
+ if (!planBlock) {
58
+ return [];
59
+ }
60
+
61
+ const match = planBlock.match(/## 4\. Plan \/ Slices\r?\n([\s\S]*?)(?=\r?\n### Planning Notes)/);
62
+ if (!match) {
63
+ return [];
64
+ }
65
+
66
+ return match[1]
67
+ .split(/\r?\n/)
68
+ .map((line) => line.trim())
69
+ .filter((line) => line.startsWith("- "))
70
+ .map((line) => line.slice(2).trim())
71
+ .filter(Boolean);
72
+ }
73
+
74
+ function uniqueNonPlaceholder(values) {
75
+ const seen = new Set();
76
+ const result = [];
77
+ for (const value of values || []) {
78
+ const normalized = String(value || "").trim();
79
+ if (!normalized || PLACEHOLDER_SLICES.has(normalized) || seen.has(normalized)) {
80
+ continue;
81
+ }
82
+ seen.add(normalized);
83
+ result.push(normalized);
84
+ }
85
+ return result;
86
+ }
87
+
88
+ function parsePlanSlices(planBlock) {
89
+ const finalized = parseBulletSection(planBlock, "Finalized Slices After `plan`");
90
+ if (finalized.length > 0) {
91
+ return uniqueNonPlaceholder(finalized);
92
+ }
93
+ return uniqueNonPlaceholder(parseInlinePlanSlices(planBlock));
94
+ }
95
+
96
+ function parseBuildActiveSlices(buildBlock) {
97
+ return uniqueNonPlaceholder(parseBulletSection(buildBlock, "Active Slices"));
98
+ }
99
+
100
+ function buildCommandTemplates(featureKey, projectPath, lane) {
101
+ const projectPathArg = quotePathForCommand(projectPath);
102
+ return {
103
+ start: `sdtk-code start --lane <feature|bugfix> --feature-key ${featureKey} --project-path ${projectPathArg}`,
104
+ plan:
105
+ lane === "feature"
106
+ ? `sdtk-code plan --feature-key ${featureKey} --project-path ${projectPathArg} --slice "<approved-slice>"`
107
+ : `sdtk-code plan --feature-key ${featureKey} --project-path ${projectPathArg} --note "<planning-note>"`,
108
+ build: `sdtk-code build --feature-key ${featureKey} --project-path ${projectPathArg} --active-slice "<active-slice>"`,
109
+ verify:
110
+ `sdtk-code verify --feature-key ${featureKey} --project-path ${projectPathArg}` +
111
+ ` --evidence "check|summary|pass|docs/dev/evidence/${featureKey}/file.txt" --spec-status <pending|pass|partial|fail>` +
112
+ " --quality-status <pending|pass|partial|fail>",
113
+ ship:
114
+ `sdtk-code ship --feature-key ${featureKey} --project-path ${projectPathArg}` +
115
+ ` --decision <ship|finish> --preflight "check|summary|pass|docs/dev/evidence/${featureKey}/file.txt"`,
116
+ doctor: `sdtk-code doctor --feature-key ${featureKey} --project-path ${projectPathArg}`,
117
+ };
118
+ }
119
+
120
+ function deriveExpectedNextPhase(lane, currentPhase, phaseStatus) {
121
+ if (!VALID_PHASES.has(currentPhase) || !VALID_PHASE_STATUSES.has(phaseStatus)) {
122
+ return null;
123
+ }
124
+
125
+ if (currentPhase === "start") {
126
+ if (phaseStatus === "blocked") {
127
+ return "blocked";
128
+ }
129
+ if (phaseStatus === "completed") {
130
+ return lane === "bugfix" ? "build" : "plan";
131
+ }
132
+ return "start";
133
+ }
134
+
135
+ if (currentPhase === "plan") {
136
+ return phaseStatus === "completed" ? "build" : "plan";
137
+ }
138
+ if (currentPhase === "build") {
139
+ return phaseStatus === "completed" ? "verify" : "build";
140
+ }
141
+ if (currentPhase === "verify") {
142
+ return phaseStatus === "completed" ? "ship" : "verify";
143
+ }
144
+ if (currentPhase === "ship") {
145
+ return phaseStatus === "completed" ? "none" : "ship";
146
+ }
147
+
148
+ return null;
149
+ }
150
+
151
+ function deriveExpectedBlockingState(currentPhase, phaseStatus, intakeOutcome) {
152
+ if (phaseStatus === "blocked") {
153
+ if (currentPhase === "start") {
154
+ if (intakeOutcome === "BLOCKED_MISSING_INPUTS") {
155
+ return "blocked_missing_inputs";
156
+ }
157
+ if (intakeOutcome === "BLOCKED_UPSTREAM_HANDOFF") {
158
+ return "blocked_upstream_handoff|invalid_handoff_contract";
159
+ }
160
+ return "blocked_missing_inputs|blocked_upstream_handoff|invalid_handoff_contract";
161
+ }
162
+ if (currentPhase === "build") {
163
+ return "blocked_build_issue";
164
+ }
165
+ if (currentPhase === "verify") {
166
+ return "blocked_verify_issue";
167
+ }
168
+ if (currentPhase === "ship") {
169
+ return "blocked_ship_issue";
170
+ }
171
+ }
172
+
173
+ if (phaseStatus === "in_progress") {
174
+ if (currentPhase === "verify") {
175
+ return "review_in_progress";
176
+ }
177
+ if (currentPhase === "ship") {
178
+ return "ship_preflight_in_progress";
179
+ }
180
+ return "clear";
181
+ }
182
+
183
+ if (phaseStatus === "completed" || phaseStatus === "pending") {
184
+ return "clear";
185
+ }
186
+
187
+ return null;
188
+ }
189
+
190
+ function parseEvidenceEntries(verifyBlock) {
191
+ const entries = [];
192
+ if (!verifyBlock) {
193
+ return entries;
194
+ }
195
+
196
+ const pattern = /^- `([^`]+)` \| `([^`]+)` \| ([^\r\n]+?) \| Raw output: `([^`]+)`$/gm;
197
+ let match;
198
+ while ((match = pattern.exec(verifyBlock)) !== null) {
199
+ entries.push({
200
+ checkName: match[1],
201
+ result: match[2],
202
+ summary: match[3].trim(),
203
+ rawOutputRef: match[4],
204
+ });
205
+ }
206
+
207
+ return entries;
208
+ }
209
+
210
+ function evaluateContradictions(snapshot) {
211
+ const issues = [];
212
+ const expectedNext = deriveExpectedNextPhase(snapshot.lane, snapshot.currentPhase, snapshot.phaseStatus);
213
+ const expectedBlocking = deriveExpectedBlockingState(
214
+ snapshot.currentPhase,
215
+ snapshot.phaseStatus,
216
+ snapshot.intakeOutcome
217
+ );
218
+
219
+ if (snapshot.currentPhase && !VALID_PHASES.has(snapshot.currentPhase)) {
220
+ issues.push(`Current phase is invalid: ${snapshot.currentPhase}`);
221
+ }
222
+ if (snapshot.phaseStatus && !VALID_PHASE_STATUSES.has(snapshot.phaseStatus)) {
223
+ issues.push(`Phase status is invalid: ${snapshot.phaseStatus}`);
224
+ }
225
+ if (snapshot.nextPhase && !VALID_NEXT_PHASES.has(snapshot.nextPhase)) {
226
+ issues.push(`Next recommended phase is invalid: ${snapshot.nextPhase}`);
227
+ }
228
+
229
+ if (expectedNext && snapshot.nextPhase && expectedNext !== snapshot.nextPhase) {
230
+ issues.push(
231
+ `Current phase/status expects next phase "${expectedNext}", but STATUS block reports "${snapshot.nextPhaseRaw}".`
232
+ );
233
+ }
234
+
235
+ if (
236
+ snapshot.currentPhase === "verify" &&
237
+ snapshot.phaseStatus === "completed" &&
238
+ snapshot.evidenceEntries.length === 0
239
+ ) {
240
+ issues.push("Workflow claims verify completed, but VERIFY evidence summary has no recorded evidence entries.");
241
+ }
242
+
243
+ if (snapshot.nextPhase === "none" && snapshot.currentPhase !== "ship") {
244
+ issues.push("STATUS reports workflow closed (next phase none), but current phase is not ship.");
245
+ }
246
+
247
+ if (snapshot.phaseStatus === "blocked" && snapshot.blockingState === "clear") {
248
+ issues.push("Phase status is blocked, but blocking state is clear.");
249
+ }
250
+
251
+ if (snapshot.phaseStatus !== "blocked" && /^blocked_/.test(snapshot.blockingState || "")) {
252
+ issues.push(`Blocking state "${snapshot.blockingState}" is blocked_* while phase status is not blocked.`);
253
+ }
254
+
255
+ if (expectedBlocking && snapshot.blockingState) {
256
+ if (expectedBlocking.includes("|")) {
257
+ const allowed = expectedBlocking.split("|");
258
+ if (!allowed.includes(snapshot.blockingState)) {
259
+ issues.push(
260
+ `Blocking state "${snapshot.blockingState}" is not legal for ${snapshot.currentPhase}/${snapshot.phaseStatus}. Expected one of: ${allowed.join(
261
+ ", "
262
+ )}.`
263
+ );
264
+ }
265
+ } else if (expectedBlocking !== snapshot.blockingState) {
266
+ issues.push(
267
+ `Blocking state "${snapshot.blockingState}" does not match expected "${expectedBlocking}" for ${snapshot.currentPhase}/${snapshot.phaseStatus}.`
268
+ );
269
+ }
270
+ }
271
+
272
+ return [...new Set(issues)];
273
+ }
274
+
275
+ function evaluateResumeDecision(state) {
276
+ const templates = state.commandTemplates;
277
+
278
+ if (!state.exists) {
279
+ return {
280
+ allowed: false,
281
+ mode: "not_started",
282
+ reason: "Workflow artifact is missing. Resume is unavailable until start initializes the workflow.",
283
+ nextCommand: templates.start,
284
+ };
285
+ }
286
+
287
+ if (state.contradictions.length > 0) {
288
+ return {
289
+ allowed: false,
290
+ mode: "invalid",
291
+ reason: "Workflow state is contradictory. Resume is fail-closed until doctor reports a clean state.",
292
+ nextCommand: templates.doctor,
293
+ };
294
+ }
295
+
296
+ if (state.phaseStatus === "blocked" || state.nextPhase === "blocked") {
297
+ return {
298
+ allowed: false,
299
+ mode: "blocked",
300
+ reason: "Workflow is blocked. Resume is fail-closed for blocked states in BK-047-lite.",
301
+ nextCommand: templates.doctor,
302
+ };
303
+ }
304
+
305
+ if (state.nextPhase === "none") {
306
+ return {
307
+ allowed: false,
308
+ mode: "closed",
309
+ reason: "Workflow is already closed (next phase is none). There is nothing to resume.",
310
+ nextCommand: null,
311
+ };
312
+ }
313
+
314
+ if (
315
+ state.nextPhase === "build" &&
316
+ state.phaseStatus === "completed" &&
317
+ (state.currentPhase === "start" || state.currentPhase === "plan")
318
+ ) {
319
+ const resumeBuildSlices =
320
+ Array.isArray(state.buildActiveSlices) && state.buildActiveSlices.length > 0
321
+ ? state.buildActiveSlices
322
+ : state.planSlices;
323
+
324
+ if (!Array.isArray(resumeBuildSlices) || resumeBuildSlices.length === 0) {
325
+ return {
326
+ allowed: false,
327
+ mode: "manual",
328
+ reason:
329
+ "Resume cannot auto-dispatch build because no slice context was found in the workflow artifact. Provide explicit --active-slice entries manually.",
330
+ nextCommand: templates.build,
331
+ };
332
+ }
333
+
334
+ return {
335
+ allowed: true,
336
+ mode: "auto_build",
337
+ reason: "Safe auto-resume is available for build from a completed pre-build phase.",
338
+ dispatchCommand: templates.build,
339
+ resumeBuildSlices,
340
+ };
341
+ }
342
+
343
+ if (state.nextPhase === "plan") {
344
+ return {
345
+ allowed: false,
346
+ mode: "manual",
347
+ reason: "Resume is fail-closed for plan because operator slice confirmation is still required.",
348
+ nextCommand: templates.plan,
349
+ };
350
+ }
351
+
352
+ if (state.nextPhase === "verify") {
353
+ return {
354
+ allowed: false,
355
+ mode: "manual",
356
+ reason: "Resume is fail-closed for verify because operator evidence and gate inputs are required.",
357
+ nextCommand: templates.verify,
358
+ };
359
+ }
360
+
361
+ if (state.nextPhase === "ship") {
362
+ return {
363
+ allowed: false,
364
+ mode: "manual",
365
+ reason: "Resume is fail-closed for ship because operator decision and preflight inputs are required.",
366
+ nextCommand: templates.ship,
367
+ };
368
+ }
369
+
370
+ return {
371
+ allowed: false,
372
+ mode: "manual",
373
+ reason: "Resume is fail-closed because the next legal action still requires explicit operator input.",
374
+ nextCommand: templates.build,
375
+ };
376
+ }
377
+
378
+ function loadWorkflowState(projectPath, featureKey) {
379
+ const artifactPath = getWorkflowArtifactPath(projectPath, featureKey);
380
+ const commandTemplates = buildCommandTemplates(featureKey, projectPath);
381
+
382
+ if (!fs.existsSync(artifactPath)) {
383
+ const missingSnapshot = {
384
+ featureKey,
385
+ projectPath,
386
+ artifactPath,
387
+ exists: false,
388
+ commandTemplates,
389
+ contradictions: [],
390
+ };
391
+ missingSnapshot.resumeDecision = evaluateResumeDecision(missingSnapshot);
392
+ return missingSnapshot;
393
+ }
394
+
395
+ const text = fs.readFileSync(artifactPath, "utf-8");
396
+ const metadataBlock = extractManagedBlock(text, "METADATA");
397
+ const statusBlock = extractManagedBlock(text, "STATUS");
398
+ const planBlock = extractManagedBlock(text, "PLAN");
399
+ const buildBlock = extractManagedBlock(text, "BUILD");
400
+ const verifyBlock = extractManagedBlock(text, "VERIFY");
401
+ const shipBlock = extractManagedBlock(text, "SHIP");
402
+ const lane = parseManagedField(metadataBlock, "Lane") || "unknown";
403
+ const rawNextPhase = parseManagedField(statusBlock, "Next recommended phase") || "unknown";
404
+
405
+ const snapshot = {
406
+ featureKey,
407
+ projectPath,
408
+ artifactPath,
409
+ exists: true,
410
+ text,
411
+ blocks: {
412
+ METADATA: metadataBlock,
413
+ STATUS: statusBlock,
414
+ PLAN: planBlock,
415
+ BUILD: buildBlock,
416
+ VERIFY: verifyBlock,
417
+ SHIP: shipBlock,
418
+ },
419
+ lane,
420
+ currentPhase: parseManagedField(metadataBlock, "Current phase") || "unknown",
421
+ phaseStatus: parseManagedField(metadataBlock, "Phase status") || "unknown",
422
+ intakeOutcome: parseManagedField(metadataBlock, "Intake outcome") || "unknown",
423
+ nextPhaseRaw: rawNextPhase,
424
+ nextPhase: normalizeNextPhase(rawNextPhase),
425
+ blockingState: parseManagedField(statusBlock, "Blocking state") || "unknown",
426
+ planSlices: parsePlanSlices(planBlock),
427
+ buildActiveSlices: parseBuildActiveSlices(buildBlock),
428
+ evidenceEntries: parseEvidenceEntries(verifyBlock),
429
+ commandTemplates: buildCommandTemplates(featureKey, projectPath, lane),
430
+ };
431
+
432
+ snapshot.contradictions = evaluateContradictions(snapshot);
433
+ snapshot.resumeDecision = evaluateResumeDecision(snapshot);
434
+ return snapshot;
435
+ }
436
+
437
+ module.exports = {
438
+ loadWorkflowState,
439
+ };
@@ -265,6 +265,34 @@ function getSuggestedEngineSkills(phaseStatus, evidenceGate, specGateStatus, qua
265
265
  return skills;
266
266
  }
267
267
 
268
+ function evaluateProvenanceConsistency(reviewPacket) {
269
+ const warnings = [];
270
+ if (!reviewPacket || !reviewPacket.hasReferenceDisclosure) {
271
+ warnings.push("review packet did not render the required Reference Disclosure section");
272
+ return warnings;
273
+ }
274
+
275
+ if (reviewPacket.provenanceMode === "missing") {
276
+ warnings.push("workflow plan is missing the required Provenance section or declaration");
277
+ }
278
+
279
+ if (
280
+ reviewPacket.provenanceMode === "external" &&
281
+ reviewPacket.referenceDisclosureMode !== "external"
282
+ ) {
283
+ warnings.push("workflow plan reports external references, but review packet disclosure mode is not external");
284
+ }
285
+
286
+ if (
287
+ reviewPacket.provenanceMode === "no_reference" &&
288
+ reviewPacket.referenceDisclosureMode !== "no_reference"
289
+ ) {
290
+ warnings.push("workflow plan reports no-reference declaration, but review packet disclosure does not mirror it");
291
+ }
292
+
293
+ return warnings;
294
+ }
295
+
268
296
  function runVerify(projectPath, featureKey, flags) {
269
297
  const state = loadWorkflowArtifactState(projectPath, featureKey);
270
298
  validateVerifyState(state);
@@ -293,6 +321,9 @@ function runVerify(projectPath, featureKey, flags) {
293
321
  specGateStatus,
294
322
  qualityGateStatus
295
323
  );
324
+ const specNotes = normalizeEntries(flags["spec-note"]);
325
+ const qualityNotes = normalizeEntries(flags["quality-note"]);
326
+ const debugNotes = normalizeEntries(flags["debug-note"]);
296
327
  const reviewPacket = createReviewPacket({
297
328
  projectPath,
298
329
  featureKey,
@@ -300,9 +331,9 @@ function runVerify(projectPath, featureKey, flags) {
300
331
  evidenceEntries,
301
332
  specGateStatus,
302
333
  qualityGateStatus,
303
- specNotes: normalizeEntries(flags["spec-note"]),
304
- qualityNotes: normalizeEntries(flags["quality-note"]),
305
- debugNotes: normalizeEntries(flags["debug-note"]),
334
+ specNotes,
335
+ qualityNotes,
336
+ debugNotes,
306
337
  batchSummary: flags["batch-summary"] || "",
307
338
  changedFiles: parseChangedFileEntries(flags["changed-file"]),
308
339
  excludedFiles: parseExcludeFileEntries(flags["exclude-file"]),
@@ -315,6 +346,11 @@ function runVerify(projectPath, featureKey, flags) {
315
346
  const normalizedReviewPacketPath = path
316
347
  .relative(projectPath, reviewPacket.reviewPacketPath)
317
348
  .replace(/\\/g, "/");
349
+ const provenanceWarnings = evaluateProvenanceConsistency(reviewPacket);
350
+ const verifyDebugNotes = [
351
+ ...debugNotes,
352
+ ...provenanceWarnings.map((warning) => `Provenance warning: ${warning}`),
353
+ ];
318
354
 
319
355
  const artifactPath = createOrUpdateWorkflowArtifact({
320
356
  projectPath,
@@ -331,9 +367,9 @@ function runVerify(projectPath, featureKey, flags) {
331
367
  evidenceGate,
332
368
  specGateStatus,
333
369
  qualityGateStatus,
334
- specNotes: normalizeEntries(flags["spec-note"]),
335
- qualityNotes: normalizeEntries(flags["quality-note"]),
336
- verifyDebugNotes: normalizeEntries(flags["debug-note"]),
370
+ specNotes,
371
+ qualityNotes,
372
+ verifyDebugNotes,
337
373
  reviewPacketPath: normalizedReviewPacketPath,
338
374
  });
339
375
 
@@ -348,6 +384,7 @@ function runVerify(projectPath, featureKey, flags) {
348
384
  specGateStatus,
349
385
  qualityGateStatus,
350
386
  reviewPacketPath: normalizedReviewPacketPath,
387
+ provenanceWarnings,
351
388
  };
352
389
  }
353
390