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
@@ -1,53 +1,53 @@
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 { runPlan } = require("../lib/workflow-plan");
7
-
8
- const FLAG_DEFS = {
9
- "feature-key": { type: "string" },
10
- "project-path": { type: "string" },
11
- "in-scope": { type: "string", multiple: true },
12
- "out-scope": { type: "string", multiple: true },
13
- slice: { type: "string", multiple: true },
14
- "use-seeded-candidates": { type: "boolean" },
15
- assumption: { type: "string", multiple: true },
16
- risk: { type: "string", multiple: true },
17
- note: { type: "string", multiple: true },
18
- };
19
-
20
- const FEATURE_KEY_RE = /^[A-Z0-9_]+$/;
21
-
22
- function cmdPlan(args) {
23
- const { flags, positional } = parseFlags(args, FLAG_DEFS);
24
- if (positional.length > 0) {
25
- throw new ValidationError('Unexpected positional arguments. Use flags only for "plan".');
26
- }
27
-
28
- const featureKey = requireFlag(flags, "feature-key", "feature-key");
29
- validatePattern(
30
- featureKey,
31
- FEATURE_KEY_RE,
32
- "feature-key",
33
- "Must use UPPER_SNAKE_CASE, for example ORDER_MGMT."
34
- );
35
-
36
- const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
37
- const result = runPlan(projectPath, featureKey, flags);
38
-
39
- console.log("SDTK-CODE workflow plan");
40
- console.log(` Feature key: ${featureKey}`);
41
- console.log(` Lane: ${result.lane}`);
42
- console.log(` Mode: ${result.planningMode}`);
43
- console.log(` Artifact: ${result.artifactPath}`);
44
- console.log(` Slices: ${result.sliceCount}`);
45
- console.log(` Next phase: ${result.nextPhase}`);
46
- console.log(` Engine: ${result.suggestedEngineSkills.join(", ")}`);
47
-
48
- return 0;
49
- }
50
-
51
- module.exports = {
52
- cmdPlan,
53
- };
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 { runPlan } = require("../lib/workflow-plan");
7
+
8
+ const FLAG_DEFS = {
9
+ "feature-key": { type: "string" },
10
+ "project-path": { type: "string" },
11
+ "in-scope": { type: "string", multiple: true },
12
+ "out-scope": { type: "string", multiple: true },
13
+ slice: { type: "string", multiple: true },
14
+ "use-seeded-candidates": { type: "boolean" },
15
+ assumption: { type: "string", multiple: true },
16
+ risk: { type: "string", multiple: true },
17
+ note: { type: "string", multiple: true },
18
+ };
19
+
20
+ const FEATURE_KEY_RE = /^[A-Z0-9_]+$/;
21
+
22
+ function cmdPlan(args) {
23
+ const { flags, positional } = parseFlags(args, FLAG_DEFS);
24
+ if (positional.length > 0) {
25
+ throw new ValidationError('Unexpected positional arguments. Use flags only for "plan".');
26
+ }
27
+
28
+ const featureKey = requireFlag(flags, "feature-key", "feature-key");
29
+ validatePattern(
30
+ featureKey,
31
+ FEATURE_KEY_RE,
32
+ "feature-key",
33
+ "Must use UPPER_SNAKE_CASE, for example ORDER_MGMT."
34
+ );
35
+
36
+ const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
37
+ const result = runPlan(projectPath, featureKey, flags);
38
+
39
+ console.log("SDTK-CODE workflow plan");
40
+ console.log(` Feature key: ${featureKey}`);
41
+ console.log(` Lane: ${result.lane}`);
42
+ console.log(` Mode: ${result.planningMode}`);
43
+ console.log(` Artifact: ${result.artifactPath}`);
44
+ console.log(` Slices: ${result.sliceCount}`);
45
+ console.log(` Next phase: ${result.nextPhase}`);
46
+ console.log(` Engine: ${result.suggestedEngineSkills.join(", ")}`);
47
+
48
+ return 0;
49
+ }
50
+
51
+ module.exports = {
52
+ cmdPlan,
53
+ };
@@ -0,0 +1,77 @@
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 { computeReadiness, gatherSignals } = require("../lib/ship-readiness");
7
+ const { appendEvent } = require("../lib/trust-events");
8
+
9
+ const FLAG_DEFS = {
10
+ "feature-key": { type: "string" },
11
+ "project-path": { type: "string" },
12
+ };
13
+
14
+ const FEATURE_KEY_RE = /^[A-Z0-9_]+$/;
15
+
16
+ function verdictStatus(verdict) {
17
+ if (verdict === "FAIL") return "blocked";
18
+ if (verdict === "ENV_BLOCKED") return "blocked";
19
+ return "info";
20
+ }
21
+
22
+ function cmdReadiness(args) {
23
+ const { flags, positional } = parseFlags(args, FLAG_DEFS);
24
+ if (positional.length > 0) {
25
+ throw new ValidationError('Unexpected positional arguments. Use flags only for "readiness".');
26
+ }
27
+
28
+ const featureKey = requireFlag(flags, "feature-key", "feature-key");
29
+ validatePattern(
30
+ featureKey,
31
+ FEATURE_KEY_RE,
32
+ "feature-key",
33
+ "Must use UPPER_SNAKE_CASE, for example ORDER_MGMT."
34
+ );
35
+
36
+ const projectPath = flags["project-path"]
37
+ ? path.resolve(flags["project-path"])
38
+ : process.cwd();
39
+
40
+ const signals = gatherSignals(projectPath, featureKey);
41
+ const result = computeReadiness(signals);
42
+
43
+ // Record a trust event for observability (command is safe to always record).
44
+ appendEvent(projectPath, {
45
+ toolkit: "sdtk-code",
46
+ event_type: "readiness_check",
47
+ command: `sdtk-code readiness --feature-key ${featureKey}`,
48
+ status: verdictStatus(result.verdict),
49
+ });
50
+
51
+ // Founder-readable one-line summary
52
+ console.log(`Ship Readiness: ${result.score}/${result.max} — ${result.verdict}`);
53
+ console.log("");
54
+
55
+ // Component table
56
+ console.log(" Components:");
57
+ for (const comp of result.components) {
58
+ const bar = comp.max > 0 ? `${comp.points}/${comp.max}` : "n/a";
59
+ console.log(` ${comp.name.padEnd(12)} ${bar.padStart(5)} ${comp.note}`);
60
+ }
61
+
62
+ if (result.blockers.length > 0) {
63
+ console.log("");
64
+ console.log(" Blockers:");
65
+ result.blockers.forEach((b) => console.log(` [FAIL] ${b}`));
66
+ }
67
+
68
+ if (result.warnings.length > 0) {
69
+ console.log("");
70
+ console.log(" Warnings:");
71
+ result.warnings.forEach((w) => console.log(` [WARN] ${w}`));
72
+ }
73
+
74
+ return 0;
75
+ }
76
+
77
+ module.exports = { cmdReadiness };
@@ -0,0 +1,62 @@
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 { runBuild } = require("../lib/workflow-build");
7
+ const { loadWorkflowState } = require("../lib/workflow-state");
8
+
9
+ const FLAG_DEFS = {
10
+ "feature-key": { type: "string" },
11
+ "project-path": { type: "string" },
12
+ };
13
+
14
+ const FEATURE_KEY_RE = /^[A-Z0-9_]+$/;
15
+
16
+ function cmdResume(args) {
17
+ const { flags, positional } = parseFlags(args, FLAG_DEFS);
18
+ if (positional.length > 0) {
19
+ throw new ValidationError('Unexpected positional arguments. Use flags only for "resume".');
20
+ }
21
+
22
+ const featureKey = requireFlag(flags, "feature-key", "feature-key");
23
+ validatePattern(
24
+ featureKey,
25
+ FEATURE_KEY_RE,
26
+ "feature-key",
27
+ "Must use UPPER_SNAKE_CASE, for example ORDER_MGMT."
28
+ );
29
+
30
+ const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
31
+ const state = loadWorkflowState(projectPath, featureKey);
32
+ const decision = state.resumeDecision;
33
+
34
+ if (!decision || !decision.allowed) {
35
+ const lines = [decision ? decision.reason : "Resume is unavailable for this workflow state."];
36
+ if (decision && decision.nextCommand) {
37
+ lines.push(`Next command: ${decision.nextCommand}`);
38
+ }
39
+ throw new ValidationError(lines.join("\n"));
40
+ }
41
+
42
+ const resumeBuildSlices = Array.isArray(decision.resumeBuildSlices) ? decision.resumeBuildSlices : [];
43
+ const result = runBuild(projectPath, featureKey, {
44
+ "active-slice": resumeBuildSlices,
45
+ });
46
+
47
+ console.log("SDTK-CODE workflow resume");
48
+ console.log(` Feature key: ${featureKey}`);
49
+ console.log(" Decision: auto-dispatch build");
50
+ console.log(` Command: ${decision.dispatchCommand}`);
51
+ console.log(` Slices: ${resumeBuildSlices.length}`);
52
+ console.log(` Artifact: ${result.artifactPath}`);
53
+ console.log(` Status: ${result.phaseStatus}`);
54
+ console.log(` Next phase: ${result.nextPhase}`);
55
+ console.log(` Engine: ${result.suggestedEngineSkills.join(", ")}`);
56
+
57
+ return 0;
58
+ }
59
+
60
+ module.exports = {
61
+ cmdResume,
62
+ };