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.
- package/README.md +201 -201
- package/assets/manifest/toolkit-bundle.manifest.json +147 -147
- package/assets/manifest/toolkit-bundle.sha256.txt +28 -28
- package/assets/toolkit/toolkit/AGENTS.md +219 -219
- package/assets/toolkit/toolkit/install.ps1 +156 -156
- 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 +296 -296
- package/assets/toolkit/toolkit/skills/code-debug/references/root-cause-tracing.md +68 -68
- package/assets/toolkit/toolkit/skills/code-discover/SKILL.md +54 -54
- 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 +378 -378
- 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 +228 -228
- package/assets/toolkit/toolkit/templates/CODE_WORKFLOW_TEMPLATE.md +140 -140
- package/bin/sdtk-code.js +14 -14
- package/package.json +44 -44
- package/src/commands/build.js +53 -53
- package/src/commands/doctor.js +51 -51
- package/src/commands/generate.js +11 -11
- package/src/commands/guardrails.js +215 -123
- package/src/commands/help.js +244 -244
- package/src/commands/init.js +98 -98
- package/src/commands/plan.js +53 -53
- package/src/commands/readiness.js +77 -77
- package/src/commands/resume.js +61 -61
- package/src/commands/runtime.js +224 -224
- package/src/commands/ship.js +59 -59
- package/src/commands/sleep.js +132 -0
- package/src/commands/start.js +89 -89
- package/src/commands/status.js +77 -77
- package/src/commands/update.js +11 -11
- package/src/commands/verify.js +71 -71
- package/src/index.js +108 -104
- 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 -53
- package/src/lib/scope.js +72 -72
- package/src/lib/ship-readiness.js +281 -281
- package/src/lib/sleep-plan.js +175 -0
- package/src/lib/sleep-report.js +229 -0
- package/src/lib/toolkit-payload.js +72 -72
- package/src/lib/trust-events.js +166 -166
- package/src/lib/trust-file-scope.js +154 -154
- package/src/lib/trust-policy.js +212 -212
- package/src/lib/trust-redact.js +35 -35
- package/src/lib/trust-trace.js +179 -179
- package/src/lib/update.js +344 -344
- package/src/lib/workflow-artifact.js +503 -503
- package/src/lib/workflow-build.js +127 -127
- package/src/lib/workflow-doctor.js +83 -83
- package/src/lib/workflow-handoff.js +1029 -1029
- package/src/lib/workflow-intake.js +101 -101
- package/src/lib/workflow-plan.js +193 -193
- package/src/lib/workflow-review-packet.js +650 -650
- package/src/lib/workflow-ship.js +213 -213
- package/src/lib/workflow-state.js +438 -438
- package/src/lib/workflow-verify.js +393 -393
package/src/commands/runtime.js
CHANGED
|
@@ -1,224 +1,224 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const { parseFlags, requireFlag, validateChoice } = require("../lib/args");
|
|
6
|
-
const { verify, resolvePayloadFile } = require("../lib/toolkit-payload");
|
|
7
|
-
const { runScript } = require("../lib/powershell");
|
|
8
|
-
const { ValidationError } = require("../lib/errors");
|
|
9
|
-
const {
|
|
10
|
-
VALID_SCOPES,
|
|
11
|
-
defaultScope,
|
|
12
|
-
isProjectScopeSupported,
|
|
13
|
-
managedSkillNames,
|
|
14
|
-
resolveCodexProjectHome,
|
|
15
|
-
resolveCodexUserHome,
|
|
16
|
-
resolveSkillsDir,
|
|
17
|
-
} = require("../lib/scope");
|
|
18
|
-
|
|
19
|
-
const FLAG_DEFS = {
|
|
20
|
-
runtime: { type: "string" },
|
|
21
|
-
scope: { type: "string" },
|
|
22
|
-
"project-path": { type: "string" },
|
|
23
|
-
force: { type: "boolean" },
|
|
24
|
-
all: { type: "boolean" },
|
|
25
|
-
verbose: { type: "boolean" },
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const VALID_RUNTIMES = ["codex", "claude"];
|
|
29
|
-
const SUBCOMMANDS = ["install", "uninstall", "status"];
|
|
30
|
-
|
|
31
|
-
function validateScopeForRuntime(runtime, scope, label) {
|
|
32
|
-
if (scope === "project" && !isProjectScopeSupported(runtime)) {
|
|
33
|
-
throw new ValidationError(
|
|
34
|
-
`${runtime} does not support project-local runtime assets. Use --${label} user instead.`
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async function cmdRuntimeInstall(flags) {
|
|
40
|
-
const runtime = requireFlag(flags, "runtime", "runtime");
|
|
41
|
-
validateChoice(runtime, VALID_RUNTIMES, "runtime");
|
|
42
|
-
|
|
43
|
-
const scope = flags.scope || defaultScope(runtime);
|
|
44
|
-
validateChoice(scope, VALID_SCOPES, "scope");
|
|
45
|
-
validateScopeForRuntime(runtime, scope, "scope");
|
|
46
|
-
|
|
47
|
-
const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
|
|
48
|
-
verify();
|
|
49
|
-
|
|
50
|
-
const scriptName =
|
|
51
|
-
runtime === "claude"
|
|
52
|
-
? "toolkit/scripts/install-claude-skills.ps1"
|
|
53
|
-
: "toolkit/scripts/install-codex-skills.ps1";
|
|
54
|
-
const script = resolvePayloadFile(scriptName);
|
|
55
|
-
const params = { Scope: scope };
|
|
56
|
-
if (scope === "project") {
|
|
57
|
-
params.ProjectPath = projectPath;
|
|
58
|
-
}
|
|
59
|
-
if (flags.force) {
|
|
60
|
-
params.Force = true;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
console.log(`Installing ${runtime} runtime assets...`);
|
|
64
|
-
console.log(` Runtime: ${runtime}`);
|
|
65
|
-
console.log(` Scope: ${scope}`);
|
|
66
|
-
if (scope === "project") {
|
|
67
|
-
console.log(` Project: ${projectPath}`);
|
|
68
|
-
}
|
|
69
|
-
if (runtime === "codex" && scope === "project") {
|
|
70
|
-
console.log(` Codex home contract: ${resolveCodexProjectHome(projectPath)}`);
|
|
71
|
-
console.log(" Note: Launch Codex with CODEX_HOME=<project>/.codex to activate this project-local install.");
|
|
72
|
-
console.log(" Note: Native .codex/skills auto-discovery is not claimed.");
|
|
73
|
-
}
|
|
74
|
-
console.log("");
|
|
75
|
-
|
|
76
|
-
const result = await runScript(script, params, { silent: !flags.verbose });
|
|
77
|
-
if (result.exitCode !== 0) {
|
|
78
|
-
if (result.stderr) {
|
|
79
|
-
console.error(result.stderr);
|
|
80
|
-
}
|
|
81
|
-
throw new ValidationError(`Runtime install failed (exit code ${result.exitCode}).`);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
console.log("");
|
|
85
|
-
console.log(`${runtime} runtime assets installed successfully.`);
|
|
86
|
-
return 0;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
async function cmdRuntimeUninstall(flags) {
|
|
90
|
-
const runtime = requireFlag(flags, "runtime", "runtime");
|
|
91
|
-
validateChoice(runtime, VALID_RUNTIMES, "runtime");
|
|
92
|
-
|
|
93
|
-
const scope = flags.scope || defaultScope(runtime);
|
|
94
|
-
validateChoice(scope, VALID_SCOPES, "scope");
|
|
95
|
-
validateScopeForRuntime(runtime, scope, "scope");
|
|
96
|
-
|
|
97
|
-
const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
|
|
98
|
-
verify();
|
|
99
|
-
|
|
100
|
-
const scriptName =
|
|
101
|
-
runtime === "claude"
|
|
102
|
-
? "toolkit/scripts/uninstall-claude-skills.ps1"
|
|
103
|
-
: "toolkit/scripts/uninstall-codex-skills.ps1";
|
|
104
|
-
const script = resolvePayloadFile(scriptName);
|
|
105
|
-
const params = {};
|
|
106
|
-
params.Scope = scope;
|
|
107
|
-
if (scope === "project") {
|
|
108
|
-
params.ProjectPath = projectPath;
|
|
109
|
-
}
|
|
110
|
-
if (flags.all) {
|
|
111
|
-
params.All = true;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
console.log(`Uninstalling ${runtime} runtime assets...`);
|
|
115
|
-
console.log(` Runtime: ${runtime}`);
|
|
116
|
-
console.log(` Scope: ${scope}`);
|
|
117
|
-
if (scope === "project") {
|
|
118
|
-
console.log(` Project: ${projectPath}`);
|
|
119
|
-
}
|
|
120
|
-
console.log("");
|
|
121
|
-
|
|
122
|
-
const result = await runScript(script, params, { silent: !flags.verbose });
|
|
123
|
-
if (result.exitCode !== 0) {
|
|
124
|
-
if (result.stderr) {
|
|
125
|
-
console.error(result.stderr);
|
|
126
|
-
}
|
|
127
|
-
throw new ValidationError(`Runtime uninstall failed (exit code ${result.exitCode}).`);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
console.log("");
|
|
131
|
-
console.log(`${runtime} runtime assets uninstalled successfully.`);
|
|
132
|
-
return 0;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function cmdRuntimeStatus(flags) {
|
|
136
|
-
const runtime = requireFlag(flags, "runtime", "runtime");
|
|
137
|
-
validateChoice(runtime, VALID_RUNTIMES, "runtime");
|
|
138
|
-
|
|
139
|
-
const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
|
|
140
|
-
const scopes = ["project", "user"];
|
|
141
|
-
|
|
142
|
-
console.log(`Runtime: ${runtime}`);
|
|
143
|
-
console.log("");
|
|
144
|
-
|
|
145
|
-
if (runtime === "codex") {
|
|
146
|
-
console.log("Codex scope truth:");
|
|
147
|
-
console.log(` Project-local root: ${resolveCodexProjectHome(projectPath)}`);
|
|
148
|
-
console.log(` User/global root: ${resolveCodexUserHome()}`);
|
|
149
|
-
console.log(" Project-local Codex support requires launching Codex with CODEX_HOME=<project>/.codex.");
|
|
150
|
-
console.log(" Native .codex/skills auto-discovery is not claimed.");
|
|
151
|
-
console.log("");
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
for (const scope of scopes) {
|
|
155
|
-
const skillsDir = resolveSkillsDir(runtime, scope, projectPath);
|
|
156
|
-
const managed = managedSkillNames(runtime);
|
|
157
|
-
const exists = fs.existsSync(skillsDir);
|
|
158
|
-
let installedNames = [];
|
|
159
|
-
|
|
160
|
-
if (exists) {
|
|
161
|
-
try {
|
|
162
|
-
const entries = fs.readdirSync(skillsDir, { withFileTypes: true });
|
|
163
|
-
installedNames = entries
|
|
164
|
-
.filter((entry) => entry.isDirectory() && managed.includes(entry.name))
|
|
165
|
-
.map((entry) => entry.name)
|
|
166
|
-
.sort();
|
|
167
|
-
} catch {
|
|
168
|
-
installedNames = [];
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const skillCount = installedNames.length;
|
|
173
|
-
const allInstalled = skillCount === managed.length;
|
|
174
|
-
const hasManagedSkills = skillCount > 0;
|
|
175
|
-
const status = !exists || !hasManagedSkills
|
|
176
|
-
? "not installed"
|
|
177
|
-
: allInstalled
|
|
178
|
-
? `installed (${skillCount}/${managed.length} SDTK-CODE skills)`
|
|
179
|
-
: `partial (${skillCount}/${managed.length} SDTK-CODE skills)`;
|
|
180
|
-
|
|
181
|
-
console.log(` Scope: ${scope}`);
|
|
182
|
-
console.log(` Path: ${skillsDir}`);
|
|
183
|
-
if (runtime === "codex" && scope === "project") {
|
|
184
|
-
console.log(" Activation: explicit CODEX_HOME=<project>/.codex contract required");
|
|
185
|
-
}
|
|
186
|
-
console.log(` Status: ${status}`);
|
|
187
|
-
if (exists && hasManagedSkills && skillCount < managed.length) {
|
|
188
|
-
const missing = managed.filter((name) => !installedNames.includes(name));
|
|
189
|
-
console.log(` Missing: ${missing.join(", ")}`);
|
|
190
|
-
}
|
|
191
|
-
console.log("");
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return 0;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
async function cmdRuntime(args) {
|
|
198
|
-
const { flags, positional } = parseFlags(args, FLAG_DEFS);
|
|
199
|
-
const subcommand = positional[0];
|
|
200
|
-
|
|
201
|
-
if (!subcommand) {
|
|
202
|
-
throw new ValidationError(
|
|
203
|
-
`Missing subcommand. Usage: sdtk-code runtime <${SUBCOMMANDS.join("|")}> [options]`
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
if (!SUBCOMMANDS.includes(subcommand)) {
|
|
207
|
-
throw new ValidationError(
|
|
208
|
-
`Unknown subcommand: "${subcommand}". Must be one of: ${SUBCOMMANDS.join(", ")}`
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
switch (subcommand) {
|
|
213
|
-
case "install":
|
|
214
|
-
return cmdRuntimeInstall(flags);
|
|
215
|
-
case "uninstall":
|
|
216
|
-
return cmdRuntimeUninstall(flags);
|
|
217
|
-
case "status":
|
|
218
|
-
return cmdRuntimeStatus(flags);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
module.exports = {
|
|
223
|
-
cmdRuntime,
|
|
224
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { parseFlags, requireFlag, validateChoice } = require("../lib/args");
|
|
6
|
+
const { verify, resolvePayloadFile } = require("../lib/toolkit-payload");
|
|
7
|
+
const { runScript } = require("../lib/powershell");
|
|
8
|
+
const { ValidationError } = require("../lib/errors");
|
|
9
|
+
const {
|
|
10
|
+
VALID_SCOPES,
|
|
11
|
+
defaultScope,
|
|
12
|
+
isProjectScopeSupported,
|
|
13
|
+
managedSkillNames,
|
|
14
|
+
resolveCodexProjectHome,
|
|
15
|
+
resolveCodexUserHome,
|
|
16
|
+
resolveSkillsDir,
|
|
17
|
+
} = require("../lib/scope");
|
|
18
|
+
|
|
19
|
+
const FLAG_DEFS = {
|
|
20
|
+
runtime: { type: "string" },
|
|
21
|
+
scope: { type: "string" },
|
|
22
|
+
"project-path": { type: "string" },
|
|
23
|
+
force: { type: "boolean" },
|
|
24
|
+
all: { type: "boolean" },
|
|
25
|
+
verbose: { type: "boolean" },
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const VALID_RUNTIMES = ["codex", "claude"];
|
|
29
|
+
const SUBCOMMANDS = ["install", "uninstall", "status"];
|
|
30
|
+
|
|
31
|
+
function validateScopeForRuntime(runtime, scope, label) {
|
|
32
|
+
if (scope === "project" && !isProjectScopeSupported(runtime)) {
|
|
33
|
+
throw new ValidationError(
|
|
34
|
+
`${runtime} does not support project-local runtime assets. Use --${label} user instead.`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function cmdRuntimeInstall(flags) {
|
|
40
|
+
const runtime = requireFlag(flags, "runtime", "runtime");
|
|
41
|
+
validateChoice(runtime, VALID_RUNTIMES, "runtime");
|
|
42
|
+
|
|
43
|
+
const scope = flags.scope || defaultScope(runtime);
|
|
44
|
+
validateChoice(scope, VALID_SCOPES, "scope");
|
|
45
|
+
validateScopeForRuntime(runtime, scope, "scope");
|
|
46
|
+
|
|
47
|
+
const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
|
|
48
|
+
verify();
|
|
49
|
+
|
|
50
|
+
const scriptName =
|
|
51
|
+
runtime === "claude"
|
|
52
|
+
? "toolkit/scripts/install-claude-skills.ps1"
|
|
53
|
+
: "toolkit/scripts/install-codex-skills.ps1";
|
|
54
|
+
const script = resolvePayloadFile(scriptName);
|
|
55
|
+
const params = { Scope: scope };
|
|
56
|
+
if (scope === "project") {
|
|
57
|
+
params.ProjectPath = projectPath;
|
|
58
|
+
}
|
|
59
|
+
if (flags.force) {
|
|
60
|
+
params.Force = true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
console.log(`Installing ${runtime} runtime assets...`);
|
|
64
|
+
console.log(` Runtime: ${runtime}`);
|
|
65
|
+
console.log(` Scope: ${scope}`);
|
|
66
|
+
if (scope === "project") {
|
|
67
|
+
console.log(` Project: ${projectPath}`);
|
|
68
|
+
}
|
|
69
|
+
if (runtime === "codex" && scope === "project") {
|
|
70
|
+
console.log(` Codex home contract: ${resolveCodexProjectHome(projectPath)}`);
|
|
71
|
+
console.log(" Note: Launch Codex with CODEX_HOME=<project>/.codex to activate this project-local install.");
|
|
72
|
+
console.log(" Note: Native .codex/skills auto-discovery is not claimed.");
|
|
73
|
+
}
|
|
74
|
+
console.log("");
|
|
75
|
+
|
|
76
|
+
const result = await runScript(script, params, { silent: !flags.verbose });
|
|
77
|
+
if (result.exitCode !== 0) {
|
|
78
|
+
if (result.stderr) {
|
|
79
|
+
console.error(result.stderr);
|
|
80
|
+
}
|
|
81
|
+
throw new ValidationError(`Runtime install failed (exit code ${result.exitCode}).`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
console.log("");
|
|
85
|
+
console.log(`${runtime} runtime assets installed successfully.`);
|
|
86
|
+
return 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function cmdRuntimeUninstall(flags) {
|
|
90
|
+
const runtime = requireFlag(flags, "runtime", "runtime");
|
|
91
|
+
validateChoice(runtime, VALID_RUNTIMES, "runtime");
|
|
92
|
+
|
|
93
|
+
const scope = flags.scope || defaultScope(runtime);
|
|
94
|
+
validateChoice(scope, VALID_SCOPES, "scope");
|
|
95
|
+
validateScopeForRuntime(runtime, scope, "scope");
|
|
96
|
+
|
|
97
|
+
const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
|
|
98
|
+
verify();
|
|
99
|
+
|
|
100
|
+
const scriptName =
|
|
101
|
+
runtime === "claude"
|
|
102
|
+
? "toolkit/scripts/uninstall-claude-skills.ps1"
|
|
103
|
+
: "toolkit/scripts/uninstall-codex-skills.ps1";
|
|
104
|
+
const script = resolvePayloadFile(scriptName);
|
|
105
|
+
const params = {};
|
|
106
|
+
params.Scope = scope;
|
|
107
|
+
if (scope === "project") {
|
|
108
|
+
params.ProjectPath = projectPath;
|
|
109
|
+
}
|
|
110
|
+
if (flags.all) {
|
|
111
|
+
params.All = true;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
console.log(`Uninstalling ${runtime} runtime assets...`);
|
|
115
|
+
console.log(` Runtime: ${runtime}`);
|
|
116
|
+
console.log(` Scope: ${scope}`);
|
|
117
|
+
if (scope === "project") {
|
|
118
|
+
console.log(` Project: ${projectPath}`);
|
|
119
|
+
}
|
|
120
|
+
console.log("");
|
|
121
|
+
|
|
122
|
+
const result = await runScript(script, params, { silent: !flags.verbose });
|
|
123
|
+
if (result.exitCode !== 0) {
|
|
124
|
+
if (result.stderr) {
|
|
125
|
+
console.error(result.stderr);
|
|
126
|
+
}
|
|
127
|
+
throw new ValidationError(`Runtime uninstall failed (exit code ${result.exitCode}).`);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
console.log("");
|
|
131
|
+
console.log(`${runtime} runtime assets uninstalled successfully.`);
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function cmdRuntimeStatus(flags) {
|
|
136
|
+
const runtime = requireFlag(flags, "runtime", "runtime");
|
|
137
|
+
validateChoice(runtime, VALID_RUNTIMES, "runtime");
|
|
138
|
+
|
|
139
|
+
const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
|
|
140
|
+
const scopes = ["project", "user"];
|
|
141
|
+
|
|
142
|
+
console.log(`Runtime: ${runtime}`);
|
|
143
|
+
console.log("");
|
|
144
|
+
|
|
145
|
+
if (runtime === "codex") {
|
|
146
|
+
console.log("Codex scope truth:");
|
|
147
|
+
console.log(` Project-local root: ${resolveCodexProjectHome(projectPath)}`);
|
|
148
|
+
console.log(` User/global root: ${resolveCodexUserHome()}`);
|
|
149
|
+
console.log(" Project-local Codex support requires launching Codex with CODEX_HOME=<project>/.codex.");
|
|
150
|
+
console.log(" Native .codex/skills auto-discovery is not claimed.");
|
|
151
|
+
console.log("");
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
for (const scope of scopes) {
|
|
155
|
+
const skillsDir = resolveSkillsDir(runtime, scope, projectPath);
|
|
156
|
+
const managed = managedSkillNames(runtime);
|
|
157
|
+
const exists = fs.existsSync(skillsDir);
|
|
158
|
+
let installedNames = [];
|
|
159
|
+
|
|
160
|
+
if (exists) {
|
|
161
|
+
try {
|
|
162
|
+
const entries = fs.readdirSync(skillsDir, { withFileTypes: true });
|
|
163
|
+
installedNames = entries
|
|
164
|
+
.filter((entry) => entry.isDirectory() && managed.includes(entry.name))
|
|
165
|
+
.map((entry) => entry.name)
|
|
166
|
+
.sort();
|
|
167
|
+
} catch {
|
|
168
|
+
installedNames = [];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const skillCount = installedNames.length;
|
|
173
|
+
const allInstalled = skillCount === managed.length;
|
|
174
|
+
const hasManagedSkills = skillCount > 0;
|
|
175
|
+
const status = !exists || !hasManagedSkills
|
|
176
|
+
? "not installed"
|
|
177
|
+
: allInstalled
|
|
178
|
+
? `installed (${skillCount}/${managed.length} SDTK-CODE skills)`
|
|
179
|
+
: `partial (${skillCount}/${managed.length} SDTK-CODE skills)`;
|
|
180
|
+
|
|
181
|
+
console.log(` Scope: ${scope}`);
|
|
182
|
+
console.log(` Path: ${skillsDir}`);
|
|
183
|
+
if (runtime === "codex" && scope === "project") {
|
|
184
|
+
console.log(" Activation: explicit CODEX_HOME=<project>/.codex contract required");
|
|
185
|
+
}
|
|
186
|
+
console.log(` Status: ${status}`);
|
|
187
|
+
if (exists && hasManagedSkills && skillCount < managed.length) {
|
|
188
|
+
const missing = managed.filter((name) => !installedNames.includes(name));
|
|
189
|
+
console.log(` Missing: ${missing.join(", ")}`);
|
|
190
|
+
}
|
|
191
|
+
console.log("");
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return 0;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async function cmdRuntime(args) {
|
|
198
|
+
const { flags, positional } = parseFlags(args, FLAG_DEFS);
|
|
199
|
+
const subcommand = positional[0];
|
|
200
|
+
|
|
201
|
+
if (!subcommand) {
|
|
202
|
+
throw new ValidationError(
|
|
203
|
+
`Missing subcommand. Usage: sdtk-code runtime <${SUBCOMMANDS.join("|")}> [options]`
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
if (!SUBCOMMANDS.includes(subcommand)) {
|
|
207
|
+
throw new ValidationError(
|
|
208
|
+
`Unknown subcommand: "${subcommand}". Must be one of: ${SUBCOMMANDS.join(", ")}`
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
switch (subcommand) {
|
|
213
|
+
case "install":
|
|
214
|
+
return cmdRuntimeInstall(flags);
|
|
215
|
+
case "uninstall":
|
|
216
|
+
return cmdRuntimeUninstall(flags);
|
|
217
|
+
case "status":
|
|
218
|
+
return cmdRuntimeStatus(flags);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
module.exports = {
|
|
223
|
+
cmdRuntime,
|
|
224
|
+
};
|
package/src/commands/ship.js
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
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 { runShip } = require("../lib/workflow-ship");
|
|
7
|
-
|
|
8
|
-
const FLAG_DEFS = {
|
|
9
|
-
"feature-key": { type: "string" },
|
|
10
|
-
"project-path": { type: "string" },
|
|
11
|
-
decision: { type: "string" },
|
|
12
|
-
preflight: { type: "string", multiple: true },
|
|
13
|
-
"follow-up": { type: "string", multiple: true },
|
|
14
|
-
note: { type: "string", multiple: true },
|
|
15
|
-
"debug-note": { type: "string", multiple: true },
|
|
16
|
-
blocked: { type: "boolean" },
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const FEATURE_KEY_RE = /^[A-Z0-9_]+$/;
|
|
20
|
-
|
|
21
|
-
function cmdShip(args) {
|
|
22
|
-
const { flags, positional } = parseFlags(args, FLAG_DEFS);
|
|
23
|
-
if (positional.length > 0) {
|
|
24
|
-
throw new ValidationError('Unexpected positional arguments. Use flags only for "ship".');
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const featureKey = requireFlag(flags, "feature-key", "feature-key");
|
|
28
|
-
validatePattern(
|
|
29
|
-
featureKey,
|
|
30
|
-
FEATURE_KEY_RE,
|
|
31
|
-
"feature-key",
|
|
32
|
-
"Must use UPPER_SNAKE_CASE, for example ORDER_MGMT."
|
|
33
|
-
);
|
|
34
|
-
requireFlag(flags, "decision", "decision");
|
|
35
|
-
|
|
36
|
-
const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
|
|
37
|
-
const result = runShip(projectPath, featureKey, flags);
|
|
38
|
-
|
|
39
|
-
console.log("SDTK-CODE workflow ship");
|
|
40
|
-
console.log(` Feature key: ${featureKey}`);
|
|
41
|
-
console.log(` Lane: ${result.lane}`);
|
|
42
|
-
console.log(` Decision: ${result.decision}`);
|
|
43
|
-
console.log(` Status: ${result.phaseStatus}`);
|
|
44
|
-
console.log(` Artifact: ${result.artifactPath}`);
|
|
45
|
-
console.log(` Preflight: ${result.preflightCount}`);
|
|
46
|
-
console.log(` Next phase: ${result.nextPhase}`);
|
|
47
|
-
console.log(` Engine: ${result.suggestedEngineSkills.join(", ")}`);
|
|
48
|
-
if (result.opsHandoff && result.opsHandoff.emitted) {
|
|
49
|
-
console.log(` OPS handoff: ${result.opsHandoff.opsHandoffPath}`);
|
|
50
|
-
} else if (result.opsHandoff && result.opsHandoff.reason) {
|
|
51
|
-
console.log(` OPS handoff: ${result.opsHandoff.reason}`);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return 0;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
module.exports = {
|
|
58
|
-
cmdShip,
|
|
59
|
-
};
|
|
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 { runShip } = require("../lib/workflow-ship");
|
|
7
|
+
|
|
8
|
+
const FLAG_DEFS = {
|
|
9
|
+
"feature-key": { type: "string" },
|
|
10
|
+
"project-path": { type: "string" },
|
|
11
|
+
decision: { type: "string" },
|
|
12
|
+
preflight: { type: "string", multiple: true },
|
|
13
|
+
"follow-up": { type: "string", multiple: true },
|
|
14
|
+
note: { type: "string", multiple: true },
|
|
15
|
+
"debug-note": { type: "string", multiple: true },
|
|
16
|
+
blocked: { type: "boolean" },
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const FEATURE_KEY_RE = /^[A-Z0-9_]+$/;
|
|
20
|
+
|
|
21
|
+
function cmdShip(args) {
|
|
22
|
+
const { flags, positional } = parseFlags(args, FLAG_DEFS);
|
|
23
|
+
if (positional.length > 0) {
|
|
24
|
+
throw new ValidationError('Unexpected positional arguments. Use flags only for "ship".');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const featureKey = requireFlag(flags, "feature-key", "feature-key");
|
|
28
|
+
validatePattern(
|
|
29
|
+
featureKey,
|
|
30
|
+
FEATURE_KEY_RE,
|
|
31
|
+
"feature-key",
|
|
32
|
+
"Must use UPPER_SNAKE_CASE, for example ORDER_MGMT."
|
|
33
|
+
);
|
|
34
|
+
requireFlag(flags, "decision", "decision");
|
|
35
|
+
|
|
36
|
+
const projectPath = flags["project-path"] ? path.resolve(flags["project-path"]) : process.cwd();
|
|
37
|
+
const result = runShip(projectPath, featureKey, flags);
|
|
38
|
+
|
|
39
|
+
console.log("SDTK-CODE workflow ship");
|
|
40
|
+
console.log(` Feature key: ${featureKey}`);
|
|
41
|
+
console.log(` Lane: ${result.lane}`);
|
|
42
|
+
console.log(` Decision: ${result.decision}`);
|
|
43
|
+
console.log(` Status: ${result.phaseStatus}`);
|
|
44
|
+
console.log(` Artifact: ${result.artifactPath}`);
|
|
45
|
+
console.log(` Preflight: ${result.preflightCount}`);
|
|
46
|
+
console.log(` Next phase: ${result.nextPhase}`);
|
|
47
|
+
console.log(` Engine: ${result.suggestedEngineSkills.join(", ")}`);
|
|
48
|
+
if (result.opsHandoff && result.opsHandoff.emitted) {
|
|
49
|
+
console.log(` OPS handoff: ${result.opsHandoff.opsHandoffPath}`);
|
|
50
|
+
} else if (result.opsHandoff && result.opsHandoff.reason) {
|
|
51
|
+
console.log(` OPS handoff: ${result.opsHandoff.reason}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = {
|
|
58
|
+
cmdShip,
|
|
59
|
+
};
|