sdtk-code-kit 0.2.0 → 0.2.1

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 (75) hide show
  1. package/README.md +201 -201
  2. package/assets/manifest/toolkit-bundle.manifest.json +147 -147
  3. package/assets/manifest/toolkit-bundle.sha256.txt +28 -28
  4. package/assets/toolkit/toolkit/AGENTS.md +219 -219
  5. package/assets/toolkit/toolkit/install.ps1 +156 -156
  6. package/assets/toolkit/toolkit/scripts/install-claude-skills.ps1 +78 -78
  7. package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +150 -150
  8. package/assets/toolkit/toolkit/scripts/uninstall-claude-skills.ps1 +62 -62
  9. package/assets/toolkit/toolkit/scripts/uninstall-codex-skills.ps1 +82 -82
  10. package/assets/toolkit/toolkit/sdtk-spec.config.json +6 -6
  11. package/assets/toolkit/toolkit/sdtk-spec.config.profiles.example.json +12 -12
  12. package/assets/toolkit/toolkit/skills/code-brainstorm/SKILL.md +55 -55
  13. package/assets/toolkit/toolkit/skills/code-debug/SKILL.md +296 -296
  14. package/assets/toolkit/toolkit/skills/code-debug/references/root-cause-tracing.md +68 -68
  15. package/assets/toolkit/toolkit/skills/code-discover/SKILL.md +54 -54
  16. package/assets/toolkit/toolkit/skills/code-execute/SKILL.md +74 -74
  17. package/assets/toolkit/toolkit/skills/code-finish/SKILL.md +205 -205
  18. package/assets/toolkit/toolkit/skills/code-parallel/SKILL.md +64 -64
  19. package/assets/toolkit/toolkit/skills/code-parallel/references/code-quality-reviewer-prompt.md +26 -26
  20. package/assets/toolkit/toolkit/skills/code-parallel/references/implementer-prompt.md +113 -113
  21. package/assets/toolkit/toolkit/skills/code-parallel/references/spec-reviewer-prompt.md +61 -61
  22. package/assets/toolkit/toolkit/skills/code-plan/SKILL.md +85 -85
  23. package/assets/toolkit/toolkit/skills/code-review/SKILL.md +79 -79
  24. package/assets/toolkit/toolkit/skills/code-review/references/checklist.md +125 -125
  25. package/assets/toolkit/toolkit/skills/code-review/references/code-reviewer.md +146 -146
  26. package/assets/toolkit/toolkit/skills/code-ship/SKILL.md +52 -52
  27. package/assets/toolkit/toolkit/skills/code-tdd/SKILL.md +378 -378
  28. package/assets/toolkit/toolkit/skills/code-tdd/references/testing-anti-patterns.md +299 -299
  29. package/assets/toolkit/toolkit/skills/code-verify/SKILL.md +144 -144
  30. package/assets/toolkit/toolkit/skills/code-worktree/SKILL.md +228 -228
  31. package/assets/toolkit/toolkit/templates/CODE_WORKFLOW_TEMPLATE.md +140 -140
  32. package/bin/sdtk-code.js +14 -14
  33. package/package.json +44 -44
  34. package/src/commands/build.js +53 -53
  35. package/src/commands/doctor.js +51 -51
  36. package/src/commands/generate.js +11 -11
  37. package/src/commands/guardrails.js +215 -123
  38. package/src/commands/help.js +244 -244
  39. package/src/commands/init.js +98 -98
  40. package/src/commands/plan.js +53 -53
  41. package/src/commands/readiness.js +77 -77
  42. package/src/commands/resume.js +61 -61
  43. package/src/commands/runtime.js +224 -224
  44. package/src/commands/ship.js +59 -59
  45. package/src/commands/sleep.js +132 -0
  46. package/src/commands/start.js +89 -89
  47. package/src/commands/status.js +77 -77
  48. package/src/commands/update.js +11 -11
  49. package/src/commands/verify.js +71 -71
  50. package/src/index.js +108 -104
  51. package/src/lib/args.js +107 -107
  52. package/src/lib/errors.js +41 -41
  53. package/src/lib/powershell.js +65 -65
  54. package/src/lib/project-target-guard.js +53 -53
  55. package/src/lib/scope.js +72 -72
  56. package/src/lib/ship-readiness.js +281 -281
  57. package/src/lib/sleep-plan.js +175 -0
  58. package/src/lib/sleep-report.js +229 -0
  59. package/src/lib/toolkit-payload.js +72 -72
  60. package/src/lib/trust-events.js +166 -166
  61. package/src/lib/trust-file-scope.js +154 -154
  62. package/src/lib/trust-policy.js +212 -212
  63. package/src/lib/trust-redact.js +35 -35
  64. package/src/lib/trust-trace.js +179 -179
  65. package/src/lib/update.js +344 -344
  66. package/src/lib/workflow-artifact.js +503 -503
  67. package/src/lib/workflow-build.js +127 -127
  68. package/src/lib/workflow-doctor.js +83 -83
  69. package/src/lib/workflow-handoff.js +1029 -1029
  70. package/src/lib/workflow-intake.js +101 -101
  71. package/src/lib/workflow-plan.js +193 -193
  72. package/src/lib/workflow-review-packet.js +650 -650
  73. package/src/lib/workflow-ship.js +213 -213
  74. package/src/lib/workflow-state.js +438 -438
  75. package/src/lib/workflow-verify.js +393 -393
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+
3
+ const path = require("path");
4
+ const { parseFlags, requireFlag } = require("../lib/args");
5
+ const { ValidationError } = require("../lib/errors");
6
+ const { assembleSleepPlan, writeSleepPlan } = require("../lib/sleep-plan");
7
+ const {
8
+ loadSleepPlan,
9
+ gatherReportSignals,
10
+ projectSleepReport,
11
+ renderSleepReportMarkdown,
12
+ writeSleepReport,
13
+ } = require("../lib/sleep-report");
14
+ const { appendEvent } = require("../lib/trust-events");
15
+
16
+ const FLAG_DEFS = {
17
+ "feature-key": { type: "string" },
18
+ "project-path": { type: "string" },
19
+ "max-actions": { type: "string" },
20
+ "max-iterations": { type: "string" },
21
+ };
22
+
23
+ function cmdSleepPlan(args) {
24
+ const { flags, positional } = parseFlags(args, FLAG_DEFS);
25
+ if (positional.length > 0) {
26
+ throw new ValidationError(
27
+ 'Unexpected positional arguments. Use flags only for "sleep plan".'
28
+ );
29
+ }
30
+
31
+ const featureKey = requireFlag(flags, "feature-key", "feature-key");
32
+ const projectPath = flags["project-path"]
33
+ ? path.resolve(flags["project-path"])
34
+ : process.cwd();
35
+
36
+ const opts = {};
37
+ if (flags["max-actions"] !== undefined) {
38
+ opts.maxActions = flags["max-actions"];
39
+ }
40
+ if (flags["max-iterations"] !== undefined) {
41
+ opts.maxIterations = flags["max-iterations"];
42
+ }
43
+
44
+ const plan = assembleSleepPlan(projectPath, featureKey, opts);
45
+ const outPath = writeSleepPlan(projectPath, plan);
46
+
47
+ appendEvent(projectPath, {
48
+ event_type: "sleep_plan",
49
+ feature_key: featureKey,
50
+ status: "ok",
51
+ output_path: outPath,
52
+ steps_count: plan.ordered_steps.length,
53
+ scope_declared: plan.scope.declared,
54
+ stop_conditions_count: plan.stop_conditions.length,
55
+ });
56
+
57
+ console.log(`sleep-plan written: ${outPath}`);
58
+ console.log(` feature_key: ${plan.feature_key}`);
59
+ console.log(` steps: ${plan.ordered_steps.length}`);
60
+ console.log(` scope: ${plan.scope.declared ? "declared" : "undeclared"}`);
61
+ console.log(
62
+ ` budgets: max_actions=${plan.budgets.max_actions}, max_iterations=${plan.budgets.max_iterations}`
63
+ );
64
+ console.log(` stop_conditions: ${plan.stop_conditions.length}`);
65
+ console.log(` policy_profile: ${plan.policy_profile}`);
66
+ console.log(` runtime: ${plan.runtime}`);
67
+ return 0;
68
+ }
69
+
70
+ function cmdSleepReport(args) {
71
+ const { flags, positional } = parseFlags(args, FLAG_DEFS);
72
+ if (positional.length > 0) {
73
+ throw new ValidationError(
74
+ 'Unexpected positional arguments. Use flags only for "sleep report".'
75
+ );
76
+ }
77
+
78
+ const featureKey = requireFlag(flags, "feature-key", "feature-key");
79
+ const projectPath = flags["project-path"]
80
+ ? path.resolve(flags["project-path"])
81
+ : process.cwd();
82
+
83
+ const plan = loadSleepPlan(projectPath);
84
+ if (plan.feature_key !== featureKey) {
85
+ throw new ValidationError(
86
+ `sleep-plan feature_key "${plan.feature_key}" does not match --feature-key "${featureKey}".`
87
+ );
88
+ }
89
+
90
+ const signals = gatherReportSignals(projectPath, featureKey);
91
+ const report = projectSleepReport(plan, signals);
92
+ const markdown = renderSleepReportMarkdown(report);
93
+ const outPath = writeSleepReport(projectPath, featureKey, markdown);
94
+
95
+ appendEvent(projectPath, {
96
+ toolkit: "sdtk-code",
97
+ event_type: "sleep_report",
98
+ command: `sdtk-code sleep report --feature-key ${featureKey}`,
99
+ status: report.verdict,
100
+ output_path: outPath,
101
+ feature_key: featureKey,
102
+ });
103
+
104
+ console.log(`Sleep Readiness: ${report.verdict}`);
105
+ console.log(` reason: ${report.reason}`);
106
+ console.log(` readiness: ${report.readiness.score}/${report.readiness.max} — ${report.readiness.verdict}`);
107
+ console.log(` report: ${outPath}`);
108
+ return 0;
109
+ }
110
+
111
+ function cmdSleep(args) {
112
+ if (!args || args.length === 0) {
113
+ throw new ValidationError(
114
+ 'Usage: sdtk-code sleep <subcommand> [flags]\nSubcommands: plan, report'
115
+ );
116
+ }
117
+
118
+ const [subcommand, ...rest] = args;
119
+
120
+ switch (subcommand) {
121
+ case "plan":
122
+ return cmdSleepPlan(rest);
123
+ case "report":
124
+ return cmdSleepReport(rest);
125
+ default:
126
+ throw new ValidationError(
127
+ `Unknown sleep subcommand: "${subcommand}". Available: plan, report`
128
+ );
129
+ }
130
+ }
131
+
132
+ module.exports = { cmdSleep };
@@ -1,89 +1,89 @@
1
- "use strict";
2
-
3
- const path = require("path");
4
- const { parseFlags, requireFlag, validateChoice, validatePattern } = require("../lib/args");
5
- const { ValidationError } = require("../lib/errors");
6
- const { runIntake } = require("../lib/workflow-intake");
7
- const { createOrUpdateWorkflowArtifact } = require("../lib/workflow-artifact");
8
-
9
- const FLAG_DEFS = {
10
- lane: { type: "string" },
11
- "feature-key": { type: "string" },
12
- "project-path": { type: "string" },
13
- force: { type: "boolean" },
14
- };
15
-
16
- const VALID_LANES = ["feature", "bugfix"];
17
- const FEATURE_KEY_RE = /^[A-Z0-9_]+$/;
18
-
19
- function formatIntakeSource(intake) {
20
- return intake.intakeSource === "formal_handoff"
21
- ? "formal SDTK-SPEC handoff"
22
- : "legacy compatibility intake";
23
- }
24
-
25
- function buildBlockedIntakeMessage(intake, artifactPath) {
26
- if (intake.blockingState === "blocked_upstream_handoff") {
27
- const details = intake.blockingDetails.map((entry) => `- ${entry}`).join("\n");
28
- return `${intake.blockingMessage}\n${details}\nArtifact written to: ${artifactPath}`;
29
- }
30
-
31
- if (intake.blockingState === "invalid_handoff_contract") {
32
- return `${intake.blockingMessage}\nArtifact written to: ${artifactPath}`;
33
- }
34
-
35
- const details = intake.missingInputs.map((entry) => `- ${entry.key}: ${entry.path}`).join("\n");
36
- return `Workflow intake blocked. Missing required inputs:\n${details}\nArtifact written to: ${artifactPath}`;
37
- }
38
-
39
- function cmdStart(args) {
40
- const { flags, positional } = parseFlags(args, FLAG_DEFS);
41
- if (positional.length > 0) {
42
- throw new ValidationError('Unexpected positional arguments. Use flags only for "start".');
43
- }
44
-
45
- const lane = requireFlag(flags, "lane", "lane");
46
- validateChoice(lane, VALID_LANES, "lane");
47
-
48
- const featureKey = requireFlag(flags, "feature-key", "feature-key");
49
- validatePattern(
50
- featureKey,
51
- FEATURE_KEY_RE,
52
- "feature-key",
53
- "Must use UPPER_SNAKE_CASE, for example ORDER_MGMT."
54
- );
55
-
56
- const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
57
- const intake = runIntake(projectPath, featureKey, lane);
58
- const artifactPath = createOrUpdateWorkflowArtifact({
59
- featureKey,
60
- lane,
61
- projectPath,
62
- force: flags.force,
63
- managedBlocks: ["METADATA", "INPUTS", "STATUS"],
64
- ...intake,
65
- });
66
-
67
- console.log("SDTK-CODE workflow start");
68
- console.log(` Feature key: ${featureKey}`);
69
- console.log(` Lane: ${lane}`);
70
- console.log(` Intake: ${formatIntakeSource(intake)}`);
71
- console.log(` Handoff: ${intake.handoffStatus}`);
72
- console.log(` Outcome: ${intake.intakeOutcome}`);
73
- console.log(` Artifact: ${artifactPath}`);
74
- console.log(` Next phase: ${intake.nextPhase}`);
75
- console.log(` Engine: ${intake.suggestedEngineSkills.join(", ")}`);
76
- for (const warning of intake.compatibilityWarnings || []) {
77
- console.log(` Note: ${warning}`);
78
- }
79
-
80
- if (intake.blocked) {
81
- throw new ValidationError(buildBlockedIntakeMessage(intake, artifactPath));
82
- }
83
-
84
- return 0;
85
- }
86
-
87
- module.exports = {
88
- cmdStart,
89
- };
1
+ "use strict";
2
+
3
+ const path = require("path");
4
+ const { parseFlags, requireFlag, validateChoice, validatePattern } = require("../lib/args");
5
+ const { ValidationError } = require("../lib/errors");
6
+ const { runIntake } = require("../lib/workflow-intake");
7
+ const { createOrUpdateWorkflowArtifact } = require("../lib/workflow-artifact");
8
+
9
+ const FLAG_DEFS = {
10
+ lane: { type: "string" },
11
+ "feature-key": { type: "string" },
12
+ "project-path": { type: "string" },
13
+ force: { type: "boolean" },
14
+ };
15
+
16
+ const VALID_LANES = ["feature", "bugfix"];
17
+ const FEATURE_KEY_RE = /^[A-Z0-9_]+$/;
18
+
19
+ function formatIntakeSource(intake) {
20
+ return intake.intakeSource === "formal_handoff"
21
+ ? "formal SDTK-SPEC handoff"
22
+ : "legacy compatibility intake";
23
+ }
24
+
25
+ function buildBlockedIntakeMessage(intake, artifactPath) {
26
+ if (intake.blockingState === "blocked_upstream_handoff") {
27
+ const details = intake.blockingDetails.map((entry) => `- ${entry}`).join("\n");
28
+ return `${intake.blockingMessage}\n${details}\nArtifact written to: ${artifactPath}`;
29
+ }
30
+
31
+ if (intake.blockingState === "invalid_handoff_contract") {
32
+ return `${intake.blockingMessage}\nArtifact written to: ${artifactPath}`;
33
+ }
34
+
35
+ const details = intake.missingInputs.map((entry) => `- ${entry.key}: ${entry.path}`).join("\n");
36
+ return `Workflow intake blocked. Missing required inputs:\n${details}\nArtifact written to: ${artifactPath}`;
37
+ }
38
+
39
+ function cmdStart(args) {
40
+ const { flags, positional } = parseFlags(args, FLAG_DEFS);
41
+ if (positional.length > 0) {
42
+ throw new ValidationError('Unexpected positional arguments. Use flags only for "start".');
43
+ }
44
+
45
+ const lane = requireFlag(flags, "lane", "lane");
46
+ validateChoice(lane, VALID_LANES, "lane");
47
+
48
+ const featureKey = requireFlag(flags, "feature-key", "feature-key");
49
+ validatePattern(
50
+ featureKey,
51
+ FEATURE_KEY_RE,
52
+ "feature-key",
53
+ "Must use UPPER_SNAKE_CASE, for example ORDER_MGMT."
54
+ );
55
+
56
+ const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
57
+ const intake = runIntake(projectPath, featureKey, lane);
58
+ const artifactPath = createOrUpdateWorkflowArtifact({
59
+ featureKey,
60
+ lane,
61
+ projectPath,
62
+ force: flags.force,
63
+ managedBlocks: ["METADATA", "INPUTS", "STATUS"],
64
+ ...intake,
65
+ });
66
+
67
+ console.log("SDTK-CODE workflow start");
68
+ console.log(` Feature key: ${featureKey}`);
69
+ console.log(` Lane: ${lane}`);
70
+ console.log(` Intake: ${formatIntakeSource(intake)}`);
71
+ console.log(` Handoff: ${intake.handoffStatus}`);
72
+ console.log(` Outcome: ${intake.intakeOutcome}`);
73
+ console.log(` Artifact: ${artifactPath}`);
74
+ console.log(` Next phase: ${intake.nextPhase}`);
75
+ console.log(` Engine: ${intake.suggestedEngineSkills.join(", ")}`);
76
+ for (const warning of intake.compatibilityWarnings || []) {
77
+ console.log(` Note: ${warning}`);
78
+ }
79
+
80
+ if (intake.blocked) {
81
+ throw new ValidationError(buildBlockedIntakeMessage(intake, artifactPath));
82
+ }
83
+
84
+ return 0;
85
+ }
86
+
87
+ module.exports = {
88
+ cmdStart,
89
+ };
@@ -1,78 +1,78 @@
1
- "use strict";
2
-
3
- const path = require("path");
4
- const { parseFlags, requireFlag, validatePattern } = require("../lib/args");
5
- const { ValidationError } = require("../lib/errors");
6
- const { loadWorkflowState } = require("../lib/workflow-state");
7
-
8
- const FLAG_DEFS = {
9
- "feature-key": { type: "string" },
10
- "project-path": { type: "string" },
11
- };
12
-
13
- const FEATURE_KEY_RE = /^[A-Z0-9_]+$/;
14
-
15
- function formatNextPhase(nextPhase) {
16
- return nextPhase === "none" ? "none (workflow closed)" : nextPhase;
17
- }
18
-
19
- function cmdStatus(args) {
20
- const { flags, positional } = parseFlags(args, FLAG_DEFS);
21
- if (positional.length > 0) {
22
- throw new ValidationError('Unexpected positional arguments. Use flags only for "status".');
23
- }
24
-
25
- const featureKey = requireFlag(flags, "feature-key", "feature-key");
26
- validatePattern(
27
- featureKey,
28
- FEATURE_KEY_RE,
29
- "feature-key",
30
- "Must use UPPER_SNAKE_CASE, for example ORDER_MGMT."
31
- );
32
-
33
- const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
34
- const state = loadWorkflowState(projectPath, featureKey);
35
-
36
- console.log("SDTK-CODE workflow status");
37
- console.log(` Feature key: ${featureKey}`);
38
- console.log(` Artifact: ${state.exists ? state.artifactPath : "missing"}`);
39
-
40
- if (!state.exists) {
41
- console.log(" Lifecycle: not_started");
42
- console.log(` Next action: ${state.commandTemplates.start}`);
43
- console.log(" Resume: unavailable");
44
- return 0;
45
- }
46
-
47
- console.log(` Lane: ${state.lane}`);
48
- console.log(` Current: ${state.currentPhase}`);
49
- console.log(` Status: ${state.phaseStatus}`);
50
- console.log(` Next: ${formatNextPhase(state.nextPhase)}`);
51
- console.log(` Blocking: ${state.blockingState}`);
52
-
53
- if (state.contradictions.length > 0) {
54
- console.log(" Health: invalid");
55
- state.contradictions.forEach((issue) => {
56
- console.log(` Warning: ${issue}`);
57
- });
58
- } else {
59
- console.log(" Health: valid");
60
- }
61
-
62
- if (state.resumeDecision && state.resumeDecision.allowed) {
63
- console.log(" Resume: auto_build");
64
- console.log(` Action: ${state.resumeDecision.dispatchCommand}`);
65
- } else if (state.resumeDecision) {
66
- console.log(` Resume: ${state.resumeDecision.mode}`);
67
- console.log(` Resume note: ${state.resumeDecision.reason}`);
68
- if (state.resumeDecision.nextCommand) {
69
- console.log(` Action: ${state.resumeDecision.nextCommand}`);
70
- }
71
- }
72
-
73
- return 0;
74
- }
75
-
76
- module.exports = {
77
- cmdStatus,
1
+ "use strict";
2
+
3
+ const path = require("path");
4
+ const { parseFlags, requireFlag, validatePattern } = require("../lib/args");
5
+ const { ValidationError } = require("../lib/errors");
6
+ const { loadWorkflowState } = require("../lib/workflow-state");
7
+
8
+ const FLAG_DEFS = {
9
+ "feature-key": { type: "string" },
10
+ "project-path": { type: "string" },
11
+ };
12
+
13
+ const FEATURE_KEY_RE = /^[A-Z0-9_]+$/;
14
+
15
+ function formatNextPhase(nextPhase) {
16
+ return nextPhase === "none" ? "none (workflow closed)" : nextPhase;
17
+ }
18
+
19
+ function cmdStatus(args) {
20
+ const { flags, positional } = parseFlags(args, FLAG_DEFS);
21
+ if (positional.length > 0) {
22
+ throw new ValidationError('Unexpected positional arguments. Use flags only for "status".');
23
+ }
24
+
25
+ const featureKey = requireFlag(flags, "feature-key", "feature-key");
26
+ validatePattern(
27
+ featureKey,
28
+ FEATURE_KEY_RE,
29
+ "feature-key",
30
+ "Must use UPPER_SNAKE_CASE, for example ORDER_MGMT."
31
+ );
32
+
33
+ const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
34
+ const state = loadWorkflowState(projectPath, featureKey);
35
+
36
+ console.log("SDTK-CODE workflow status");
37
+ console.log(` Feature key: ${featureKey}`);
38
+ console.log(` Artifact: ${state.exists ? state.artifactPath : "missing"}`);
39
+
40
+ if (!state.exists) {
41
+ console.log(" Lifecycle: not_started");
42
+ console.log(` Next action: ${state.commandTemplates.start}`);
43
+ console.log(" Resume: unavailable");
44
+ return 0;
45
+ }
46
+
47
+ console.log(` Lane: ${state.lane}`);
48
+ console.log(` Current: ${state.currentPhase}`);
49
+ console.log(` Status: ${state.phaseStatus}`);
50
+ console.log(` Next: ${formatNextPhase(state.nextPhase)}`);
51
+ console.log(` Blocking: ${state.blockingState}`);
52
+
53
+ if (state.contradictions.length > 0) {
54
+ console.log(" Health: invalid");
55
+ state.contradictions.forEach((issue) => {
56
+ console.log(` Warning: ${issue}`);
57
+ });
58
+ } else {
59
+ console.log(" Health: valid");
60
+ }
61
+
62
+ if (state.resumeDecision && state.resumeDecision.allowed) {
63
+ console.log(" Resume: auto_build");
64
+ console.log(` Action: ${state.resumeDecision.dispatchCommand}`);
65
+ } else if (state.resumeDecision) {
66
+ console.log(` Resume: ${state.resumeDecision.mode}`);
67
+ console.log(` Resume note: ${state.resumeDecision.reason}`);
68
+ if (state.resumeDecision.nextCommand) {
69
+ console.log(` Action: ${state.resumeDecision.nextCommand}`);
70
+ }
71
+ }
72
+
73
+ return 0;
74
+ }
75
+
76
+ module.exports = {
77
+ cmdStatus,
78
78
  };
@@ -1,11 +1,11 @@
1
- "use strict";
2
-
3
- const { executeUpdate } = require("../lib/update");
4
-
5
- async function cmdUpdate(args) {
6
- return executeUpdate(args);
7
- }
8
-
9
- module.exports = {
10
- cmdUpdate,
11
- };
1
+ "use strict";
2
+
3
+ const { executeUpdate } = require("../lib/update");
4
+
5
+ async function cmdUpdate(args) {
6
+ return executeUpdate(args);
7
+ }
8
+
9
+ module.exports = {
10
+ cmdUpdate,
11
+ };
@@ -1,71 +1,71 @@
1
- "use strict";
2
-
3
- const path = require("path");
4
- const { parseFlags, requireFlag, validatePattern } = require("../lib/args");
5
- const { ValidationError } = require("../lib/errors");
6
- const { runVerify } = require("../lib/workflow-verify");
7
-
8
- const FLAG_DEFS = {
9
- "feature-key": { type: "string" },
10
- "project-path": { type: "string" },
11
- evidence: { type: "string", multiple: true },
12
- "batch-summary": { type: "string" },
13
- "changed-file": { type: "string", multiple: true },
14
- "exclude-file": { type: "string", multiple: true },
15
- "truth-sync-target": { type: "string", multiple: true },
16
- "commit-include": { type: "string", multiple: true },
17
- "commit-exclude": { type: "string", multiple: true },
18
- caveat: { type: "string", multiple: true },
19
- "reviewer-guidance": { type: "string", multiple: true },
20
- "spec-status": { type: "string" },
21
- "spec-note": { type: "string", multiple: true },
22
- "quality-status": { type: "string" },
23
- "quality-note": { type: "string", multiple: true },
24
- "debug-note": { type: "string", multiple: true },
25
- complete: { type: "boolean" },
26
- blocked: { type: "boolean" },
27
- };
28
-
29
- const FEATURE_KEY_RE = /^[A-Z0-9_]+$/;
30
-
31
- function cmdVerify(args) {
32
- const { flags, positional } = parseFlags(args, FLAG_DEFS);
33
- if (positional.length > 0) {
34
- throw new ValidationError('Unexpected positional arguments. Use flags only for "verify".');
35
- }
36
-
37
- const featureKey = requireFlag(flags, "feature-key", "feature-key");
38
- validatePattern(
39
- featureKey,
40
- FEATURE_KEY_RE,
41
- "feature-key",
42
- "Must use UPPER_SNAKE_CASE, for example ORDER_MGMT."
43
- );
44
-
45
- const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
46
- const result = runVerify(projectPath, featureKey, flags);
47
-
48
- console.log("SDTK-CODE workflow verify");
49
- console.log(` Feature key: ${featureKey}`);
50
- console.log(` Lane: ${result.lane}`);
51
- console.log(` Status: ${result.phaseStatus}`);
52
- console.log(` Artifact: ${result.artifactPath}`);
53
- console.log(` Review: ${result.reviewPacketPath}`);
54
- console.log(` Evidence: ${result.evidenceCount}`);
55
- console.log(
56
- ` Gates: evidence=${result.evidenceGate}, spec=${result.specGateStatus}, quality=${result.qualityGateStatus}`
57
- );
58
- console.log(` Next phase: ${result.nextPhase}`);
59
- console.log(` Engine: ${result.suggestedEngineSkills.join(", ")}`);
60
- if (Array.isArray(result.provenanceWarnings) && result.provenanceWarnings.length > 0) {
61
- result.provenanceWarnings.forEach((warning) => {
62
- console.log(` Warning: provenance: ${warning}`);
63
- });
64
- }
65
-
66
- return 0;
67
- }
68
-
69
- module.exports = {
70
- cmdVerify,
71
- };
1
+ "use strict";
2
+
3
+ const path = require("path");
4
+ const { parseFlags, requireFlag, validatePattern } = require("../lib/args");
5
+ const { ValidationError } = require("../lib/errors");
6
+ const { runVerify } = require("../lib/workflow-verify");
7
+
8
+ const FLAG_DEFS = {
9
+ "feature-key": { type: "string" },
10
+ "project-path": { type: "string" },
11
+ evidence: { type: "string", multiple: true },
12
+ "batch-summary": { type: "string" },
13
+ "changed-file": { type: "string", multiple: true },
14
+ "exclude-file": { type: "string", multiple: true },
15
+ "truth-sync-target": { type: "string", multiple: true },
16
+ "commit-include": { type: "string", multiple: true },
17
+ "commit-exclude": { type: "string", multiple: true },
18
+ caveat: { type: "string", multiple: true },
19
+ "reviewer-guidance": { type: "string", multiple: true },
20
+ "spec-status": { type: "string" },
21
+ "spec-note": { type: "string", multiple: true },
22
+ "quality-status": { type: "string" },
23
+ "quality-note": { type: "string", multiple: true },
24
+ "debug-note": { type: "string", multiple: true },
25
+ complete: { type: "boolean" },
26
+ blocked: { type: "boolean" },
27
+ };
28
+
29
+ const FEATURE_KEY_RE = /^[A-Z0-9_]+$/;
30
+
31
+ function cmdVerify(args) {
32
+ const { flags, positional } = parseFlags(args, FLAG_DEFS);
33
+ if (positional.length > 0) {
34
+ throw new ValidationError('Unexpected positional arguments. Use flags only for "verify".');
35
+ }
36
+
37
+ const featureKey = requireFlag(flags, "feature-key", "feature-key");
38
+ validatePattern(
39
+ featureKey,
40
+ FEATURE_KEY_RE,
41
+ "feature-key",
42
+ "Must use UPPER_SNAKE_CASE, for example ORDER_MGMT."
43
+ );
44
+
45
+ const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
46
+ const result = runVerify(projectPath, featureKey, flags);
47
+
48
+ console.log("SDTK-CODE workflow verify");
49
+ console.log(` Feature key: ${featureKey}`);
50
+ console.log(` Lane: ${result.lane}`);
51
+ console.log(` Status: ${result.phaseStatus}`);
52
+ console.log(` Artifact: ${result.artifactPath}`);
53
+ console.log(` Review: ${result.reviewPacketPath}`);
54
+ console.log(` Evidence: ${result.evidenceCount}`);
55
+ console.log(
56
+ ` Gates: evidence=${result.evidenceGate}, spec=${result.specGateStatus}, quality=${result.qualityGateStatus}`
57
+ );
58
+ console.log(` Next phase: ${result.nextPhase}`);
59
+ console.log(` Engine: ${result.suggestedEngineSkills.join(", ")}`);
60
+ if (Array.isArray(result.provenanceWarnings) && result.provenanceWarnings.length > 0) {
61
+ result.provenanceWarnings.forEach((warning) => {
62
+ console.log(` Warning: provenance: ${warning}`);
63
+ });
64
+ }
65
+
66
+ return 0;
67
+ }
68
+
69
+ module.exports = {
70
+ cmdVerify,
71
+ };