sdtk-code-kit 0.3.0 → 0.3.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 (56) hide show
  1. package/README.md +204 -204
  2. package/assets/manifest/toolkit-bundle.manifest.json +147 -147
  3. package/assets/manifest/toolkit-bundle.sha256.txt +5 -5
  4. package/bin/sdtk-code.js +14 -14
  5. package/package.json +44 -44
  6. package/src/commands/agent-team.js +425 -174
  7. package/src/commands/build.js +53 -53
  8. package/src/commands/doctor.js +51 -51
  9. package/src/commands/generate.js +11 -11
  10. package/src/commands/guardrails.js +215 -215
  11. package/src/commands/help.js +264 -257
  12. package/src/commands/init.js +98 -98
  13. package/src/commands/plan.js +53 -53
  14. package/src/commands/readiness.js +77 -77
  15. package/src/commands/resume.js +61 -61
  16. package/src/commands/runtime.js +224 -224
  17. package/src/commands/ship.js +59 -59
  18. package/src/commands/sleep.js +132 -132
  19. package/src/commands/start.js +89 -89
  20. package/src/commands/status.js +77 -77
  21. package/src/commands/update.js +11 -11
  22. package/src/commands/verify.js +71 -71
  23. package/src/index.js +112 -112
  24. package/src/lib/agent-team-author.js +521 -0
  25. package/src/lib/agent-team-evidence.js +302 -0
  26. package/src/lib/agent-team-execute.js +892 -0
  27. package/src/lib/agent-team-export.js +411 -409
  28. package/src/lib/agent-team-plan.js +514 -514
  29. package/src/lib/agent-team-readiness.js +161 -0
  30. package/src/lib/agent-team-report.js +165 -0
  31. package/src/lib/args.js +107 -107
  32. package/src/lib/errors.js +41 -41
  33. package/src/lib/model-provider.js +219 -0
  34. package/src/lib/powershell.js +65 -65
  35. package/src/lib/project-target-guard.js +53 -53
  36. package/src/lib/scope.js +72 -72
  37. package/src/lib/ship-readiness.js +281 -281
  38. package/src/lib/sleep-plan.js +175 -175
  39. package/src/lib/sleep-report.js +229 -229
  40. package/src/lib/toolkit-payload.js +72 -72
  41. package/src/lib/trust-events.js +252 -185
  42. package/src/lib/trust-file-scope.js +154 -154
  43. package/src/lib/trust-policy.js +212 -212
  44. package/src/lib/trust-redact.js +58 -35
  45. package/src/lib/trust-trace.js +179 -179
  46. package/src/lib/update.js +344 -344
  47. package/src/lib/workflow-artifact.js +503 -503
  48. package/src/lib/workflow-build.js +127 -127
  49. package/src/lib/workflow-doctor.js +83 -83
  50. package/src/lib/workflow-handoff.js +1029 -1029
  51. package/src/lib/workflow-intake.js +101 -101
  52. package/src/lib/workflow-plan.js +193 -193
  53. package/src/lib/workflow-review-packet.js +650 -650
  54. package/src/lib/workflow-ship.js +213 -213
  55. package/src/lib/workflow-state.js +438 -438
  56. package/src/lib/workflow-verify.js +393 -393
@@ -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
+ };
@@ -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
+ };