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.
- package/README.md +202 -185
- package/assets/manifest/toolkit-bundle.manifest.json +54 -54
- package/assets/manifest/toolkit-bundle.sha256.txt +26 -26
- package/assets/toolkit/toolkit/install.ps1 +156 -119
- package/assets/toolkit/toolkit/scripts/install-claude-skills.ps1 +78 -78
- package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +150 -150
- package/assets/toolkit/toolkit/scripts/uninstall-claude-skills.ps1 +62 -62
- package/assets/toolkit/toolkit/scripts/uninstall-codex-skills.ps1 +82 -82
- package/assets/toolkit/toolkit/sdtk-spec.config.json +6 -6
- package/assets/toolkit/toolkit/sdtk-spec.config.profiles.example.json +12 -12
- package/assets/toolkit/toolkit/skills/code-brainstorm/SKILL.md +55 -55
- package/assets/toolkit/toolkit/skills/code-debug/SKILL.md +1 -1
- package/assets/toolkit/toolkit/skills/code-debug/references/root-cause-tracing.md +68 -68
- package/assets/toolkit/toolkit/skills/code-execute/SKILL.md +74 -74
- package/assets/toolkit/toolkit/skills/code-finish/SKILL.md +205 -205
- package/assets/toolkit/toolkit/skills/code-parallel/SKILL.md +64 -64
- package/assets/toolkit/toolkit/skills/code-parallel/references/code-quality-reviewer-prompt.md +26 -26
- package/assets/toolkit/toolkit/skills/code-parallel/references/implementer-prompt.md +113 -113
- package/assets/toolkit/toolkit/skills/code-parallel/references/spec-reviewer-prompt.md +61 -61
- package/assets/toolkit/toolkit/skills/code-plan/SKILL.md +85 -85
- package/assets/toolkit/toolkit/skills/code-review/SKILL.md +79 -79
- package/assets/toolkit/toolkit/skills/code-review/references/checklist.md +125 -125
- package/assets/toolkit/toolkit/skills/code-review/references/code-reviewer.md +146 -146
- package/assets/toolkit/toolkit/skills/code-ship/SKILL.md +52 -52
- package/assets/toolkit/toolkit/skills/code-tdd/SKILL.md +1 -1
- package/assets/toolkit/toolkit/skills/code-tdd/references/testing-anti-patterns.md +299 -299
- package/assets/toolkit/toolkit/skills/code-verify/SKILL.md +144 -144
- package/assets/toolkit/toolkit/skills/code-worktree/SKILL.md +13 -13
- package/assets/toolkit/toolkit/templates/CODE_WORKFLOW_TEMPLATE.md +140 -112
- package/bin/sdtk-code.js +14 -14
- package/package.json +4 -4
- package/src/commands/build.js +53 -53
- package/src/commands/doctor.js +52 -0
- package/src/commands/generate.js +11 -11
- package/src/commands/guardrails.js +123 -0
- package/src/commands/help.js +30 -4
- package/src/commands/init.js +98 -95
- package/src/commands/plan.js +53 -53
- package/src/commands/readiness.js +77 -0
- package/src/commands/resume.js +62 -0
- package/src/commands/runtime.js +224 -224
- package/src/commands/ship.js +59 -59
- package/src/commands/start.js +89 -89
- package/src/commands/status.js +78 -0
- package/src/commands/verify.js +71 -66
- package/src/index.js +32 -1
- package/src/lib/args.js +107 -107
- package/src/lib/errors.js +41 -41
- package/src/lib/powershell.js +65 -65
- package/src/lib/project-target-guard.js +53 -0
- package/src/lib/scope.js +72 -72
- package/src/lib/ship-readiness.js +281 -0
- package/src/lib/toolkit-payload.js +72 -72
- package/src/lib/trust-events.js +166 -0
- package/src/lib/trust-file-scope.js +154 -0
- package/src/lib/trust-policy.js +212 -0
- package/src/lib/trust-redact.js +35 -0
- package/src/lib/trust-trace.js +179 -0
- package/src/lib/update.js +8 -1
- package/src/lib/workflow-artifact.js +503 -496
- package/src/lib/workflow-build.js +127 -127
- package/src/lib/workflow-doctor.js +84 -0
- package/src/lib/workflow-handoff.js +1029 -937
- package/src/lib/workflow-intake.js +101 -101
- package/src/lib/workflow-plan.js +193 -193
- package/src/lib/workflow-review-packet.js +89 -0
- package/src/lib/workflow-ship.js +213 -213
- package/src/lib/workflow-state.js +439 -0
- package/src/lib/workflow-verify.js +43 -6
package/src/commands/start.js
CHANGED
|
@@ -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
|
+
};
|
|
@@ -0,0 +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,
|
|
78
|
+
};
|
package/src/commands/verify.js
CHANGED
|
@@ -1,66 +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
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
+
};
|
package/src/index.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const { cmdBuild } = require("./commands/build");
|
|
4
|
+
const { cmdDoctor } = require("./commands/doctor");
|
|
5
|
+
const { cmdGuardrails } = require("./commands/guardrails");
|
|
4
6
|
const { cmdHelp } = require("./commands/help");
|
|
7
|
+
const { cmdReadiness } = require("./commands/readiness");
|
|
5
8
|
const { cmdInit } = require("./commands/init");
|
|
6
9
|
const { cmdPlan } = require("./commands/plan");
|
|
10
|
+
const { cmdResume } = require("./commands/resume");
|
|
7
11
|
const { cmdRuntime } = require("./commands/runtime");
|
|
8
12
|
const { cmdShip } = require("./commands/ship");
|
|
9
13
|
const { cmdStart } = require("./commands/start");
|
|
14
|
+
const { cmdStatus } = require("./commands/status");
|
|
10
15
|
const { cmdUpdate } = require("./commands/update");
|
|
11
16
|
const { cmdVerify } = require("./commands/verify");
|
|
12
17
|
const { ValidationError } = require("./lib/errors");
|
|
@@ -32,7 +37,23 @@ function parseCommand(argv) {
|
|
|
32
37
|
return { command: first, args: rest };
|
|
33
38
|
}
|
|
34
39
|
|
|
35
|
-
const COMMANDS = new Set([
|
|
40
|
+
const COMMANDS = new Set([
|
|
41
|
+
"help",
|
|
42
|
+
"version",
|
|
43
|
+
"init",
|
|
44
|
+
"runtime",
|
|
45
|
+
"start",
|
|
46
|
+
"plan",
|
|
47
|
+
"build",
|
|
48
|
+
"verify",
|
|
49
|
+
"ship",
|
|
50
|
+
"status",
|
|
51
|
+
"doctor",
|
|
52
|
+
"guardrails",
|
|
53
|
+
"readiness",
|
|
54
|
+
"resume",
|
|
55
|
+
"update",
|
|
56
|
+
]);
|
|
36
57
|
|
|
37
58
|
async function run(argv) {
|
|
38
59
|
const { command, args } = parseCommand(argv);
|
|
@@ -63,6 +84,16 @@ async function run(argv) {
|
|
|
63
84
|
return cmdVerify(args);
|
|
64
85
|
case "ship":
|
|
65
86
|
return cmdShip(args);
|
|
87
|
+
case "status":
|
|
88
|
+
return cmdStatus(args);
|
|
89
|
+
case "doctor":
|
|
90
|
+
return cmdDoctor(args);
|
|
91
|
+
case "guardrails":
|
|
92
|
+
return cmdGuardrails(args);
|
|
93
|
+
case "readiness":
|
|
94
|
+
return cmdReadiness(args);
|
|
95
|
+
case "resume":
|
|
96
|
+
return cmdResume(args);
|
|
66
97
|
case "update":
|
|
67
98
|
return cmdUpdate(args);
|
|
68
99
|
}
|
package/src/lib/args.js
CHANGED
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { ValidationError } = require("./errors");
|
|
4
|
-
|
|
5
|
-
function parseFlags(argv, defs) {
|
|
6
|
-
const flags = {};
|
|
7
|
-
const positional = [];
|
|
8
|
-
const aliasMap = {};
|
|
9
|
-
|
|
10
|
-
for (const [name, def] of Object.entries(defs)) {
|
|
11
|
-
if (def.alias) {
|
|
12
|
-
aliasMap[def.alias] = name;
|
|
13
|
-
}
|
|
14
|
-
if (def.type === "boolean") {
|
|
15
|
-
flags[name] = false;
|
|
16
|
-
} else if (def.multiple) {
|
|
17
|
-
flags[name] = [];
|
|
18
|
-
} else {
|
|
19
|
-
flags[name] = undefined;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
let i = 0;
|
|
24
|
-
while (i < argv.length) {
|
|
25
|
-
const arg = argv[i];
|
|
26
|
-
|
|
27
|
-
if (!arg.startsWith("-")) {
|
|
28
|
-
positional.push(arg);
|
|
29
|
-
i++;
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let key;
|
|
34
|
-
let inlineValue;
|
|
35
|
-
if (arg.includes("=")) {
|
|
36
|
-
const eqIdx = arg.indexOf("=");
|
|
37
|
-
key = arg.slice(0, eqIdx);
|
|
38
|
-
inlineValue = arg.slice(eqIdx + 1);
|
|
39
|
-
} else {
|
|
40
|
-
key = arg;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const stripped = key.replace(/^-{1,2}/, "");
|
|
44
|
-
const resolved = aliasMap[stripped] || stripped;
|
|
45
|
-
if (!(resolved in defs)) {
|
|
46
|
-
throw new ValidationError(`Unknown flag: ${key}`);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const def = defs[resolved];
|
|
50
|
-
if (def.type === "boolean") {
|
|
51
|
-
flags[resolved] = true;
|
|
52
|
-
i++;
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
let value = inlineValue;
|
|
57
|
-
if (value === undefined) {
|
|
58
|
-
i++;
|
|
59
|
-
if (i >= argv.length) {
|
|
60
|
-
throw new ValidationError(`Flag ${key} requires a value.`);
|
|
61
|
-
}
|
|
62
|
-
value = argv[i];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (def.multiple) {
|
|
66
|
-
flags[resolved].push(value);
|
|
67
|
-
} else {
|
|
68
|
-
flags[resolved] = value;
|
|
69
|
-
}
|
|
70
|
-
i++;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return { flags, positional };
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function requireFlag(flags, name, label) {
|
|
77
|
-
const value = flags[name];
|
|
78
|
-
if (value === undefined || value === null || value === "") {
|
|
79
|
-
throw new ValidationError(`Missing required flag: --${label || name}`);
|
|
80
|
-
}
|
|
81
|
-
return value;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function validateChoice(value, choices, label) {
|
|
85
|
-
if (!choices.includes(value)) {
|
|
86
|
-
throw new ValidationError(
|
|
87
|
-
`Invalid value for --${label}: "${value}". Must be one of: ${choices.join(", ")}`
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
return value;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function validatePattern(value, regex, label, hint) {
|
|
94
|
-
if (!regex.test(value)) {
|
|
95
|
-
throw new ValidationError(
|
|
96
|
-
`Invalid value for --${label}: "${value}". ${hint || `Must match ${regex}`}`
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
return value;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
module.exports = {
|
|
103
|
-
parseFlags,
|
|
104
|
-
requireFlag,
|
|
105
|
-
validateChoice,
|
|
106
|
-
validatePattern,
|
|
107
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { ValidationError } = require("./errors");
|
|
4
|
+
|
|
5
|
+
function parseFlags(argv, defs) {
|
|
6
|
+
const flags = {};
|
|
7
|
+
const positional = [];
|
|
8
|
+
const aliasMap = {};
|
|
9
|
+
|
|
10
|
+
for (const [name, def] of Object.entries(defs)) {
|
|
11
|
+
if (def.alias) {
|
|
12
|
+
aliasMap[def.alias] = name;
|
|
13
|
+
}
|
|
14
|
+
if (def.type === "boolean") {
|
|
15
|
+
flags[name] = false;
|
|
16
|
+
} else if (def.multiple) {
|
|
17
|
+
flags[name] = [];
|
|
18
|
+
} else {
|
|
19
|
+
flags[name] = undefined;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let i = 0;
|
|
24
|
+
while (i < argv.length) {
|
|
25
|
+
const arg = argv[i];
|
|
26
|
+
|
|
27
|
+
if (!arg.startsWith("-")) {
|
|
28
|
+
positional.push(arg);
|
|
29
|
+
i++;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let key;
|
|
34
|
+
let inlineValue;
|
|
35
|
+
if (arg.includes("=")) {
|
|
36
|
+
const eqIdx = arg.indexOf("=");
|
|
37
|
+
key = arg.slice(0, eqIdx);
|
|
38
|
+
inlineValue = arg.slice(eqIdx + 1);
|
|
39
|
+
} else {
|
|
40
|
+
key = arg;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const stripped = key.replace(/^-{1,2}/, "");
|
|
44
|
+
const resolved = aliasMap[stripped] || stripped;
|
|
45
|
+
if (!(resolved in defs)) {
|
|
46
|
+
throw new ValidationError(`Unknown flag: ${key}`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const def = defs[resolved];
|
|
50
|
+
if (def.type === "boolean") {
|
|
51
|
+
flags[resolved] = true;
|
|
52
|
+
i++;
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let value = inlineValue;
|
|
57
|
+
if (value === undefined) {
|
|
58
|
+
i++;
|
|
59
|
+
if (i >= argv.length) {
|
|
60
|
+
throw new ValidationError(`Flag ${key} requires a value.`);
|
|
61
|
+
}
|
|
62
|
+
value = argv[i];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (def.multiple) {
|
|
66
|
+
flags[resolved].push(value);
|
|
67
|
+
} else {
|
|
68
|
+
flags[resolved] = value;
|
|
69
|
+
}
|
|
70
|
+
i++;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return { flags, positional };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function requireFlag(flags, name, label) {
|
|
77
|
+
const value = flags[name];
|
|
78
|
+
if (value === undefined || value === null || value === "") {
|
|
79
|
+
throw new ValidationError(`Missing required flag: --${label || name}`);
|
|
80
|
+
}
|
|
81
|
+
return value;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function validateChoice(value, choices, label) {
|
|
85
|
+
if (!choices.includes(value)) {
|
|
86
|
+
throw new ValidationError(
|
|
87
|
+
`Invalid value for --${label}: "${value}". Must be one of: ${choices.join(", ")}`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function validatePattern(value, regex, label, hint) {
|
|
94
|
+
if (!regex.test(value)) {
|
|
95
|
+
throw new ValidationError(
|
|
96
|
+
`Invalid value for --${label}: "${value}". ${hint || `Must match ${regex}`}`
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
module.exports = {
|
|
103
|
+
parseFlags,
|
|
104
|
+
requireFlag,
|
|
105
|
+
validateChoice,
|
|
106
|
+
validatePattern,
|
|
107
|
+
};
|