sdtk-code-kit 0.1.1 → 0.1.3
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 +164 -123
- package/assets/manifest/toolkit-bundle.manifest.json +8 -8
- package/assets/manifest/toolkit-bundle.sha256.txt +3 -3
- package/assets/toolkit/toolkit/AGENTS.md +219 -217
- package/assets/toolkit/toolkit/install.ps1 +156 -119
- package/assets/toolkit/toolkit/sdtk-spec.config.json +6 -6
- package/package.json +34 -34
- package/src/commands/help.js +70 -37
- package/src/commands/init.js +98 -95
- package/src/commands/update.js +11 -0
- package/src/commands/verify.js +9 -0
- package/src/index.js +73 -70
- package/src/lib/project-target-guard.js +53 -0
- package/src/lib/update.js +344 -0
- package/src/lib/workflow-artifact.js +6 -0
- package/src/lib/workflow-review-packet.js +561 -0
- package/src/lib/workflow-verify.js +356 -212
package/src/commands/init.js
CHANGED
|
@@ -1,95 +1,98 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const path = require("path");
|
|
4
|
-
const { parseFlags, validateChoice } = require("../lib/args");
|
|
5
|
-
const { verify, resolvePayloadFile } = require("../lib/toolkit-payload");
|
|
6
|
-
const { runScript } = require("../lib/powershell");
|
|
7
|
-
const { ValidationError } = require("../lib/errors");
|
|
8
|
-
const { VALID_SCOPES, defaultScope, isProjectScopeSupported } = require("../lib/scope");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"skip-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
if (
|
|
55
|
-
params.
|
|
56
|
-
}
|
|
57
|
-
if (
|
|
58
|
-
params.
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
console.log(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
console.log("
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const { parseFlags, validateChoice } = require("../lib/args");
|
|
5
|
+
const { verify, resolvePayloadFile } = require("../lib/toolkit-payload");
|
|
6
|
+
const { runScript } = require("../lib/powershell");
|
|
7
|
+
const { ValidationError } = require("../lib/errors");
|
|
8
|
+
const { VALID_SCOPES, defaultScope, isProjectScopeSupported } = require("../lib/scope");
|
|
9
|
+
const { assertProjectRefreshTargetAllowed } = require("../lib/project-target-guard");
|
|
10
|
+
|
|
11
|
+
const FLAG_DEFS = {
|
|
12
|
+
runtime: { type: "string" },
|
|
13
|
+
"project-path": { type: "string" },
|
|
14
|
+
"runtime-scope": { type: "string" },
|
|
15
|
+
force: { type: "boolean" },
|
|
16
|
+
"skip-skills": { type: "boolean" },
|
|
17
|
+
"skip-runtime-assets": { type: "boolean" },
|
|
18
|
+
verbose: { type: "boolean" },
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const VALID_RUNTIMES = ["codex", "claude"];
|
|
22
|
+
|
|
23
|
+
async function cmdInit(args) {
|
|
24
|
+
const { flags } = parseFlags(args, FLAG_DEFS);
|
|
25
|
+
|
|
26
|
+
const runtime = flags.runtime || "codex";
|
|
27
|
+
validateChoice(runtime, VALID_RUNTIMES, "runtime");
|
|
28
|
+
|
|
29
|
+
const scope = flags["runtime-scope"] || defaultScope(runtime);
|
|
30
|
+
validateChoice(scope, VALID_SCOPES, "runtime-scope");
|
|
31
|
+
if (scope === "project" && !isProjectScopeSupported(runtime)) {
|
|
32
|
+
throw new ValidationError(
|
|
33
|
+
`${runtime} does not support project-local runtime assets. Use --runtime-scope user instead.`
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const skipAssets = flags["skip-runtime-assets"] || flags["skip-skills"];
|
|
38
|
+
if (flags["skip-skills"] && !flags["skip-runtime-assets"]) {
|
|
39
|
+
console.warn("Warning: --skip-skills is deprecated. Use --skip-runtime-assets instead.");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
|
|
43
|
+
|
|
44
|
+
assertProjectRefreshTargetAllowed("sdtk-code", "init", projectPath);
|
|
45
|
+
|
|
46
|
+
verify();
|
|
47
|
+
|
|
48
|
+
const installScript = resolvePayloadFile("toolkit/install.ps1");
|
|
49
|
+
const params = {
|
|
50
|
+
ProjectPath: projectPath,
|
|
51
|
+
Runtime: runtime,
|
|
52
|
+
Scope: scope,
|
|
53
|
+
};
|
|
54
|
+
if (flags.force) {
|
|
55
|
+
params.Force = true;
|
|
56
|
+
}
|
|
57
|
+
if (skipAssets) {
|
|
58
|
+
params.SkipRuntimeAssets = true;
|
|
59
|
+
}
|
|
60
|
+
if (!flags.verbose) {
|
|
61
|
+
params.Quiet = true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
console.log("Initializing SDTK-CODE workspace...");
|
|
65
|
+
console.log(` Runtime: ${runtime}`);
|
|
66
|
+
console.log(` Scope: ${scope}`);
|
|
67
|
+
console.log(` Project: ${projectPath}`);
|
|
68
|
+
if (runtime === "codex" && scope === "project") {
|
|
69
|
+
console.log(` Codex home contract: ${path.join(projectPath, ".codex")}`);
|
|
70
|
+
console.log(" Note: Launch Codex with CODEX_HOME=<project>/.codex to use project-local skills.");
|
|
71
|
+
console.log(" Note: This CLI does not claim native .codex/skills auto-discovery.");
|
|
72
|
+
}
|
|
73
|
+
console.log("");
|
|
74
|
+
|
|
75
|
+
const result = await runScript(installScript, params, { silent: !flags.verbose });
|
|
76
|
+
if (result.exitCode !== 0) {
|
|
77
|
+
if (result.stderr) {
|
|
78
|
+
console.error(result.stderr);
|
|
79
|
+
}
|
|
80
|
+
throw new ValidationError(`Initialization failed (exit code ${result.exitCode}).`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
console.log("");
|
|
84
|
+
console.log("SDTK-CODE workspace initialized successfully.");
|
|
85
|
+
if (runtime === "codex" && scope === "project") {
|
|
86
|
+
console.log(`Project-local Codex skills were installed into ${path.join(projectPath, ".codex", "skills")}.`);
|
|
87
|
+
console.log("Launch Codex with CODEX_HOME=<project>/.codex to activate that local runtime home.");
|
|
88
|
+
}
|
|
89
|
+
console.log("");
|
|
90
|
+
console.log("Next steps:");
|
|
91
|
+
console.log(" 1. Review and customize sdtk-spec.config.json for your project stack.");
|
|
92
|
+
console.log(" 2. Start the workflow with sdtk-code start once the upstream SDTK-SPEC handoff is ready.");
|
|
93
|
+
return 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
module.exports = {
|
|
97
|
+
cmdInit,
|
|
98
|
+
};
|
package/src/commands/verify.js
CHANGED
|
@@ -9,6 +9,14 @@ const FLAG_DEFS = {
|
|
|
9
9
|
"feature-key": { type: "string" },
|
|
10
10
|
"project-path": { type: "string" },
|
|
11
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 },
|
|
12
20
|
"spec-status": { type: "string" },
|
|
13
21
|
"spec-note": { type: "string", multiple: true },
|
|
14
22
|
"quality-status": { type: "string" },
|
|
@@ -42,6 +50,7 @@ function cmdVerify(args) {
|
|
|
42
50
|
console.log(` Lane: ${result.lane}`);
|
|
43
51
|
console.log(` Status: ${result.phaseStatus}`);
|
|
44
52
|
console.log(` Artifact: ${result.artifactPath}`);
|
|
53
|
+
console.log(` Review: ${result.reviewPacketPath}`);
|
|
45
54
|
console.log(` Evidence: ${result.evidenceCount}`);
|
|
46
55
|
console.log(
|
|
47
56
|
` Gates: evidence=${result.evidenceGate}, spec=${result.specGateStatus}, quality=${result.qualityGateStatus}`
|
package/src/index.js
CHANGED
|
@@ -1,70 +1,73 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const { cmdBuild } = require("./commands/build");
|
|
4
|
-
const { cmdHelp } = require("./commands/help");
|
|
5
|
-
const { cmdInit } = require("./commands/init");
|
|
6
|
-
const { cmdPlan } = require("./commands/plan");
|
|
7
|
-
const { cmdRuntime } = require("./commands/runtime");
|
|
8
|
-
const { cmdShip } = require("./commands/ship");
|
|
9
|
-
const { cmdStart } = require("./commands/start");
|
|
10
|
-
const {
|
|
11
|
-
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { cmdBuild } = require("./commands/build");
|
|
4
|
+
const { cmdHelp } = require("./commands/help");
|
|
5
|
+
const { cmdInit } = require("./commands/init");
|
|
6
|
+
const { cmdPlan } = require("./commands/plan");
|
|
7
|
+
const { cmdRuntime } = require("./commands/runtime");
|
|
8
|
+
const { cmdShip } = require("./commands/ship");
|
|
9
|
+
const { cmdStart } = require("./commands/start");
|
|
10
|
+
const { cmdUpdate } = require("./commands/update");
|
|
11
|
+
const { cmdVerify } = require("./commands/verify");
|
|
12
|
+
const { ValidationError } = require("./lib/errors");
|
|
13
|
+
|
|
14
|
+
function getVersion() {
|
|
15
|
+
const pkg = require("../package.json");
|
|
16
|
+
return pkg.version;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function parseCommand(argv) {
|
|
20
|
+
if (!argv || argv.length === 0) {
|
|
21
|
+
return { command: "help", args: [] };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const [first, ...rest] = argv;
|
|
25
|
+
if (first === "-h" || first === "--help") {
|
|
26
|
+
return { command: "help", args: [] };
|
|
27
|
+
}
|
|
28
|
+
if (first === "-v" || first === "--version") {
|
|
29
|
+
return { command: "version", args: [] };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return { command: first, args: rest };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const COMMANDS = new Set(["help", "version", "init", "runtime", "start", "plan", "build", "verify", "ship", "update"]);
|
|
36
|
+
|
|
37
|
+
async function run(argv) {
|
|
38
|
+
const { command, args } = parseCommand(argv);
|
|
39
|
+
|
|
40
|
+
if (!COMMANDS.has(command)) {
|
|
41
|
+
throw new ValidationError(
|
|
42
|
+
`Unknown command: "${command}". Run "sdtk-code --help" for available commands.`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
switch (command) {
|
|
47
|
+
case "help":
|
|
48
|
+
return cmdHelp();
|
|
49
|
+
case "version":
|
|
50
|
+
console.log(`sdtk-code-kit ${getVersion()}`);
|
|
51
|
+
return 0;
|
|
52
|
+
case "init":
|
|
53
|
+
return cmdInit(args);
|
|
54
|
+
case "runtime":
|
|
55
|
+
return cmdRuntime(args);
|
|
56
|
+
case "start":
|
|
57
|
+
return cmdStart(args);
|
|
58
|
+
case "plan":
|
|
59
|
+
return cmdPlan(args);
|
|
60
|
+
case "build":
|
|
61
|
+
return cmdBuild(args);
|
|
62
|
+
case "verify":
|
|
63
|
+
return cmdVerify(args);
|
|
64
|
+
case "ship":
|
|
65
|
+
return cmdShip(args);
|
|
66
|
+
case "update":
|
|
67
|
+
return cmdUpdate(args);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
module.exports = {
|
|
72
|
+
run,
|
|
73
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { ValidationError } = require("./errors");
|
|
6
|
+
|
|
7
|
+
const MAINTAINER_ROOT_MARKERS = [
|
|
8
|
+
"governance/ai/core/IMPROVEMENT_BACKLOG.md",
|
|
9
|
+
"products/sdtk-code/toolkit/install.ps1",
|
|
10
|
+
];
|
|
11
|
+
const PROTECTED_FILES = [
|
|
12
|
+
"AGENTS.md",
|
|
13
|
+
"CODEX.md",
|
|
14
|
+
"CLAUDE.md",
|
|
15
|
+
"sdtk-spec.config.json",
|
|
16
|
+
"sdtk-spec.config.profiles.example.json"
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
function isMaintainerRoot(projectPath) {
|
|
20
|
+
const resolved = path.resolve(projectPath);
|
|
21
|
+
return MAINTAINER_ROOT_MARKERS.every((marker) => fs.existsSync(path.join(resolved, marker)));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function buildMaintainerRootMessage(cliName, action, projectPath) {
|
|
25
|
+
const lines = [
|
|
26
|
+
`Refusing to refresh managed project files into the SDTK maintainer repo root: ${projectPath}`,
|
|
27
|
+
`The ${action} flow would overwrite repo-owned files such as ${PROTECTED_FILES.join(", ")}.`,
|
|
28
|
+
"Target a consumer project path instead of the SDTK maintainer monorepo root.",
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
if (action === "update") {
|
|
32
|
+
lines.push(`If you only need package/runtime refresh, rerun ${cliName} update with --skip-project-files.`);
|
|
33
|
+
} else {
|
|
34
|
+
lines.push(`If you only need runtime assets, use ${cliName} runtime install against the desired consumer project path instead of ${cliName} init.`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return lines.join("\n");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function assertProjectRefreshTargetAllowed(cliName, action, projectPath) {
|
|
41
|
+
if (!isMaintainerRoot(projectPath)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
throw new ValidationError(buildMaintainerRootMessage(cliName, action, projectPath));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = {
|
|
49
|
+
assertProjectRefreshTargetAllowed,
|
|
50
|
+
buildMaintainerRootMessage,
|
|
51
|
+
isMaintainerRoot,
|
|
52
|
+
};
|
|
53
|
+
|