sdtk-spec-kit 0.3.9 → 0.3.11

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 (52) hide show
  1. package/README.md +136 -106
  2. package/assets/manifest/toolkit-bundle.manifest.json +94 -80
  3. package/assets/manifest/toolkit-bundle.sha256.txt +41 -38
  4. package/assets/toolkit/toolkit/AGENTS.md +5 -4
  5. package/assets/toolkit/toolkit/README.md +50 -0
  6. package/assets/toolkit/toolkit/SDTK_TOOLKIT.md +185 -0
  7. package/assets/toolkit/toolkit/install.ps1 +2 -2
  8. package/assets/toolkit/toolkit/scripts/init-feature.ps1 +4 -3
  9. package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +32 -12
  10. package/assets/toolkit/toolkit/scripts/uninstall-codex-skills.ps1 +33 -6
  11. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/SKILL.md +84 -84
  12. package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
  13. package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
  14. package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/YAML_CREATION_RULES.md +127 -127
  15. package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +85 -83
  16. package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
  17. package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOW_ACTION_SPEC_CREATION_RULES.md +220 -220
  18. package/assets/toolkit/toolkit/skills/sdtk-arch/references/YAML_CREATION_RULES.md +127 -127
  19. package/assets/toolkit/toolkit/skills/sdtk-dev/SKILL.md +108 -98
  20. package/assets/toolkit/toolkit/skills/sdtk-dev-backend/SKILL.md +7 -4
  21. package/assets/toolkit/toolkit/skills/sdtk-dev-frontend/SKILL.md +7 -4
  22. package/assets/toolkit/toolkit/skills/sdtk-orchestrator/SKILL.md +97 -81
  23. package/assets/toolkit/toolkit/skills/sdtk-pm/SKILL.md +37 -30
  24. package/assets/toolkit/toolkit/skills/sdtk-qa/SKILL.md +75 -52
  25. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/FLOW_ACTION_SPEC_CREATION_RULES.md +220 -220
  26. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/excel-image-export.md +30 -30
  27. package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/figma-mcp.md +25 -25
  28. package/assets/toolkit/toolkit/skills/skills.catalog.yaml +4 -2
  29. package/assets/toolkit/toolkit/skills-claude/api-design-spec/SKILL.md +90 -90
  30. package/assets/toolkit/toolkit/skills-claude/dev/SKILL.md +3 -0
  31. package/assets/toolkit/toolkit/skills-claude/orchestrator/SKILL.md +25 -53
  32. package/assets/toolkit/toolkit/skills-claude/qa/SKILL.md +16 -8
  33. package/assets/toolkit/toolkit/templates/QUALITY_CHECKLIST.md +124 -121
  34. package/assets/toolkit/toolkit/templates/README.md +1 -0
  35. package/assets/toolkit/toolkit/templates/SHARED_PLANNING.md +81 -81
  36. package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
  37. package/assets/toolkit/toolkit/templates/docs/api/YAML_CREATION_RULES.md +127 -127
  38. package/assets/toolkit/toolkit/templates/docs/database/DATABASE_SPEC_TEMPLATE.md +174 -174
  39. package/assets/toolkit/toolkit/templates/docs/dev/FEATURE_IMPL_PLAN_TEMPLATE.md +106 -93
  40. package/assets/toolkit/toolkit/templates/docs/qa/CONTROLLER_ACCEPTANCE_TEMPLATE.md +90 -0
  41. package/assets/toolkit/toolkit/templates/docs/qa/QA_RELEASE_REPORT_TEMPLATE.md +162 -61
  42. package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md +220 -220
  43. package/assets/toolkit/toolkit/templates/handoffs/DEV_TO_QA.md +4 -0
  44. package/assets/toolkit/toolkit/templates/handoffs/QA_RELEASE_DECISION.md +5 -0
  45. package/package.json +16 -16
  46. package/src/commands/help.js +123 -101
  47. package/src/commands/init.js +10 -2
  48. package/src/commands/runtime.js +27 -5
  49. package/src/commands/update.js +11 -0
  50. package/src/index.js +62 -59
  51. package/src/lib/scope.js +19 -4
  52. package/src/lib/update.js +326 -0
@@ -1,101 +1,123 @@
1
- "use strict";
2
-
3
- function cmdHelp() {
4
- const text = [
5
- "SDTK-SPEC CLI -- deterministic documentation toolkit",
6
- "",
7
- "Usage:",
8
- " sdtk-spec <command> [options]",
9
- "",
10
- "Commands:",
11
- " init Initialize SDTK-SPEC workspace (runtime adapter + config)",
12
- " runtime Manage runtime asset installation (install, uninstall, status)",
13
- " auth Manage GitHub authentication and entitlement",
14
- " generate Scaffold feature documentation from templates (17 files)",
15
- "",
16
- "Init options:",
17
- " --runtime <codex|claude> Runtime adapter (default: codex)",
18
- " --runtime-scope <project|user> Install scope (default: project for claude, user for codex)",
19
- " --project-path <path> Target project directory (default: cwd)",
20
- " --force Overwrite existing files",
21
- " --skip-runtime-assets Skip runtime asset installation",
22
- " --skip-skills (deprecated, use --skip-runtime-assets)",
23
- " --verbose Show detailed PowerShell script output",
24
- "",
25
- "Runtime subcommands:",
26
- " sdtk-spec runtime install --runtime <codex|claude> [--scope <project|user>]",
27
- " sdtk-spec runtime uninstall --runtime <codex|claude> [--scope <project|user>] [--all]",
28
- " sdtk-spec runtime status --runtime <codex|claude>",
29
- "",
30
- "Runtime options:",
31
- " --runtime <codex|claude> Target runtime (required)",
32
- " --scope <project|user> Install scope (default: project for claude, user for codex)",
33
- " --project-path <path> Target project directory (default: cwd)",
34
- " --force Overwrite existing skills",
35
- " --all Uninstall all managed skills",
36
- " --verbose Show detailed script output",
37
- "",
38
- "Scope behavior:",
39
- " project Skills are installed inside the repo (Claude only: .claude/skills/)",
40
- " user Skills are installed in the runtime home (~/.claude/skills/ or ~/.codex/skills/)",
41
- " Note: Codex supports user scope only. Project scope is not available for Codex.",
42
- "",
43
- "Auth options:",
44
- " --token <value> Store GitHub PAT",
45
- " --verify Check private repo access",
46
- " --status Show authentication status",
47
- " --logout Clear stored credentials",
48
- "",
49
- "Generate options:",
50
- " --feature-key <KEY> Feature identifier (UPPER_SNAKE_CASE, required)",
51
- " --feature-name \"<text>\" Human-readable feature name (required)",
52
- " --project-path <path> Target project directory (default: cwd)",
53
- " --force Overwrite existing files",
54
- " --validate-only Validate templates without writing files",
55
- " --verbose Show detailed PowerShell script output",
56
- "",
57
- "Generate behavior:",
58
- " The generate command creates 17 scaffold files with TBD placeholders.",
59
- " Scaffolds define document structure for each SDLC phase.",
60
- " Content is filled in by agents or manually (PM -> BA -> ARCH -> DEV -> QA).",
61
- " Output is written to docs/ subdirectories under the project path.",
62
- "",
63
- "Global options:",
64
- " -h, --help Show this help",
65
- " -v, --version Show version",
66
- "",
67
- "Exit codes:",
68
- " 0 Success",
69
- " 1 Validation or user error",
70
- " 2 Dependency error (e.g., PowerShell not found)",
71
- " 3 Integrity error (payload hash mismatch)",
72
- " 4 Unexpected internal error",
73
- "",
74
- "Environment variables:",
75
- " SDTK_ENTITLEMENT_REPO Override default entitlement repo (owner/repo format)",
76
- "",
77
- "Examples:",
78
- " sdtk-spec init --runtime codex",
79
- " sdtk-spec init --runtime claude --project-path ./my-project",
80
- " sdtk-spec auth --token ghp_xxxxxxxxxxxx",
81
- " sdtk-spec auth --verify",
82
- ' sdtk-spec generate --feature-key USER_PROFILE --feature-name "User Profile"',
83
- " sdtk-spec generate --feature-key ORDER_MGMT --feature-name \"Order Management\" --validate-only",
84
- " sdtk-spec init --runtime claude --runtime-scope user",
85
- " sdtk-spec runtime install --runtime claude --scope project",
86
- " sdtk-spec runtime install --runtime codex --scope user",
87
- " sdtk-spec runtime status --runtime claude",
88
- " sdtk-spec runtime uninstall --runtime claude --scope project --all",
89
- "",
90
- " # Override entitlement repo (bash/zsh):",
91
- " export SDTK_ENTITLEMENT_REPO=owner/repo",
92
- " # Override entitlement repo (PowerShell):",
93
- ' $env:SDTK_ENTITLEMENT_REPO="owner/repo"',
94
- ];
95
- console.log(text.join("\n"));
96
- return 0;
97
- }
98
-
99
- module.exports = {
100
- cmdHelp,
101
- };
1
+ "use strict";
2
+
3
+ function cmdHelp() {
4
+ const text = [
5
+ "SDTK-SPEC CLI -- deterministic documentation toolkit",
6
+ "",
7
+ "Usage:",
8
+ " sdtk-spec <command> [options]",
9
+ "",
10
+ "Commands:",
11
+ " init Initialize SDTK-SPEC workspace (runtime adapter + config)",
12
+ " runtime Manage runtime asset installation (install, uninstall, status)",
13
+ " update Refresh the npm package and optionally re-apply managed project/runtime assets",
14
+ " auth Manage GitHub authentication and entitlement",
15
+ " generate Scaffold feature documentation from templates (17 files)",
16
+ "",
17
+ "Init options:",
18
+ " --runtime <codex|claude> Runtime adapter (default: codex)",
19
+ " --runtime-scope <project|user> Install scope (default: project for claude, user for codex)",
20
+ " --project-path <path> Target project directory (default: cwd)",
21
+ " --force Overwrite existing files",
22
+ " --skip-runtime-assets Skip runtime asset installation",
23
+ " --skip-skills (deprecated, use --skip-runtime-assets)",
24
+ " --verbose Show detailed PowerShell script output",
25
+ "",
26
+ "Runtime subcommands:",
27
+ " sdtk-spec runtime install --runtime <codex|claude> [--scope <project|user>]",
28
+ " sdtk-spec runtime uninstall --runtime <codex|claude> [--scope <project|user>] [--all]",
29
+ " sdtk-spec runtime status --runtime <codex|claude>",
30
+ "",
31
+ "Update options:",
32
+ " --version <latest|x.y.z> Target published npm package version (default: latest)",
33
+ " --runtime <codex|claude> Optional runtime refresh target after npm update",
34
+ " --scope <project|user> Runtime asset scope when --runtime is provided",
35
+ " --project-path <path> Target project directory for managed file refresh (default: cwd)",
36
+ " --check-only Print the planned npm/init refresh steps without making changes",
37
+ " --skip-project-files Skip sdtk-spec init --force during update",
38
+ " --skip-runtime-assets Skip runtime asset refresh during update",
39
+ " --verbose Show detailed command output",
40
+ "",
41
+ "Runtime options:",
42
+ " --runtime <codex|claude> Target runtime (required)",
43
+ " --scope <project|user> Install scope (default: project for claude, user for codex)",
44
+ " --project-path <path> Target project directory (default: cwd)",
45
+ " --force Overwrite existing skills",
46
+ " --all Uninstall all managed skills",
47
+ " --verbose Show detailed script output",
48
+ "",
49
+ "Scope behavior:",
50
+ " project Claude installs to <project>/.claude/skills and Codex installs to <project>/.codex/skills",
51
+ " user Skills are installed in the runtime home (~/.claude/skills/ or $CODEX_HOME/skills / ~/.codex/skills)",
52
+ " Note: Codex project scope is supported only via the explicit local CODEX_HOME=<project>/.codex contract.",
53
+ " Note: This CLI does not claim native .codex/skills auto-discovery.",
54
+ "",
55
+ "Uninstall behavior:",
56
+ " runtime uninstall removes only SDTK-managed skill folders for the selected runtime/scope.",
57
+ " It does not delete parent runtime roots such as .claude/, .claude/skills/, $CODEX_HOME/, or $CODEX_HOME/skills/.",
58
+ " npm uninstall -g sdtk-spec-kit removes the CLI package only. Runtime assets remain until runtime uninstall or manual cleanup.",
59
+ "",
60
+ "Auth options:",
61
+ " --token <value> Store GitHub PAT",
62
+ " --verify Check private repo access",
63
+ " --status Show authentication status",
64
+ " --logout Clear stored credentials",
65
+ "",
66
+ "Generate options:",
67
+ " --feature-key <KEY> Feature identifier (UPPER_SNAKE_CASE, required)",
68
+ " --feature-name \"<text>\" Human-readable feature name (required)",
69
+ " --project-path <path> Target project directory (default: cwd)",
70
+ " --force Overwrite existing files",
71
+ " --validate-only Validate templates without writing files",
72
+ " --verbose Show detailed PowerShell script output",
73
+ "",
74
+ "Generate behavior:",
75
+ " The generate command creates 17 scaffold files with TBD placeholders.",
76
+ " Scaffolds define document structure for each SDLC phase.",
77
+ " Content is filled in by agents or manually (PM -> BA -> ARCH -> DEV -> QA).",
78
+ " Output is written to docs/ subdirectories under the project path.",
79
+ "",
80
+ "Global options:",
81
+ " -h, --help Show this help",
82
+ " -v, --version Show version",
83
+ "",
84
+ "Exit codes:",
85
+ " 0 Success",
86
+ " 1 Validation or user error",
87
+ " 2 Dependency error (e.g., PowerShell not found)",
88
+ " 3 Integrity error (payload hash mismatch)",
89
+ " 4 Unexpected internal error",
90
+ "",
91
+ "Environment variables:",
92
+ " SDTK_ENTITLEMENT_REPO Override default entitlement repo (owner/repo format)",
93
+ "",
94
+ "Examples:",
95
+ " sdtk-spec init --runtime codex",
96
+ " sdtk-spec init --runtime codex --runtime-scope project --project-path ./my-project",
97
+ " sdtk-spec init --runtime claude --project-path ./my-project",
98
+ " sdtk-spec update --check-only",
99
+ " sdtk-spec update --runtime claude --project-path ./my-project",
100
+ " sdtk-spec update --version 1.2.3 --runtime codex --scope user",
101
+ " sdtk-spec auth --token ghp_xxxxxxxxxxxx",
102
+ " sdtk-spec auth --verify",
103
+ ' sdtk-spec generate --feature-key USER_PROFILE --feature-name "User Profile"',
104
+ " sdtk-spec generate --feature-key ORDER_MGMT --feature-name \"Order Management\" --validate-only",
105
+ " sdtk-spec init --runtime claude --runtime-scope user",
106
+ " sdtk-spec runtime install --runtime claude --scope project",
107
+ " sdtk-spec runtime install --runtime codex --scope user",
108
+ " sdtk-spec runtime install --runtime codex --scope project --project-path ./my-project",
109
+ " sdtk-spec runtime status --runtime claude",
110
+ " sdtk-spec runtime uninstall --runtime claude --scope project --all",
111
+ "",
112
+ " # Override entitlement repo (bash/zsh):",
113
+ " export SDTK_ENTITLEMENT_REPO=owner/repo",
114
+ " # Override entitlement repo (PowerShell):",
115
+ ' $env:SDTK_ENTITLEMENT_REPO="owner/repo"',
116
+ ];
117
+ console.log(text.join("\n"));
118
+ return 0;
119
+ }
120
+
121
+ module.exports = {
122
+ cmdHelp,
123
+ };
@@ -30,10 +30,9 @@ async function cmdInit(args) {
30
30
  const scope = flags["runtime-scope"] || defaultScope(runtime);
31
31
  validateChoice(scope, VALID_SCOPES, "runtime-scope");
32
32
 
33
- // Gate C0: Codex does not support project-local skills
34
33
  if (scope === "project" && !isProjectScopeSupported(runtime)) {
35
34
  throw new ValidationError(
36
- "Codex does not support project-local skills. Use --runtime-scope user instead."
35
+ `${runtime} does not support project-local runtime assets. Use --runtime-scope user instead.`
37
36
  );
38
37
  }
39
38
 
@@ -70,6 +69,11 @@ async function cmdInit(args) {
70
69
  console.log(` Runtime: ${runtime}`);
71
70
  console.log(` Scope: ${scope}`);
72
71
  console.log(` Project: ${projectPath}`);
72
+ if (runtime === "codex" && scope === "project") {
73
+ console.log(` Codex home contract: ${path.join(projectPath, ".codex")}`);
74
+ console.log(" Note: Launch Codex with CODEX_HOME=<project>/.codex to use project-local skills.");
75
+ console.log(" Note: This CLI does not claim native .codex/skills auto-discovery.");
76
+ }
73
77
  console.log("");
74
78
 
75
79
  const result = await runScript(installScript, params, { silent: !flags.verbose });
@@ -85,6 +89,10 @@ async function cmdInit(args) {
85
89
 
86
90
  console.log("");
87
91
  console.log("SDTK-SPEC workspace initialized successfully.");
92
+ if (runtime === "codex" && scope === "project") {
93
+ console.log(`Project-local Codex skills were installed into ${path.join(projectPath, ".codex", "skills")}.`);
94
+ console.log("Launch Codex with CODEX_HOME=<project>/.codex to activate that local runtime home.");
95
+ }
88
96
  console.log("");
89
97
  console.log("Next steps:");
90
98
  console.log(" 1. Review and customize sdtk-spec.config.json for your project stack.");
@@ -10,6 +10,8 @@ const {
10
10
  VALID_SCOPES,
11
11
  defaultScope,
12
12
  isProjectScopeSupported,
13
+ resolveCodexProjectHome,
14
+ resolveCodexUserHome,
13
15
  resolveSkillsDir,
14
16
  managedSkillNames,
15
17
  } = require("../lib/scope");
@@ -29,7 +31,7 @@ const SUBCOMMANDS = ["install", "uninstall", "status"];
29
31
  function validateScopeForRuntime(runtime, scope) {
30
32
  if (scope === "project" && !isProjectScopeSupported(runtime)) {
31
33
  throw new ValidationError(
32
- `Codex does not support project-local skills. Use --scope user instead.`
34
+ `${runtime} does not support project-local runtime assets. Use --scope user instead.`
33
35
  );
34
36
  }
35
37
  }
@@ -55,7 +57,7 @@ async function cmdRuntimeInstall(flags) {
55
57
  const script = resolvePayloadFile(scriptName);
56
58
 
57
59
  const params = { Scope: scope };
58
- if (runtime === "claude") {
60
+ if (scope === "project") {
59
61
  params.ProjectPath = projectPath;
60
62
  }
61
63
  if (flags.force) params.Force = true;
@@ -66,6 +68,11 @@ async function cmdRuntimeInstall(flags) {
66
68
  if (scope === "project") {
67
69
  console.log(` Project: ${projectPath}`);
68
70
  }
71
+ if (runtime === "codex" && scope === "project") {
72
+ console.log(` Codex home contract: ${resolveCodexProjectHome(projectPath)}`);
73
+ console.log(" Note: Launch Codex with CODEX_HOME=<project>/.codex to activate this project-local install.");
74
+ console.log(" Note: Native .codex/skills auto-discovery is not claimed.");
75
+ }
69
76
  console.log("");
70
77
 
71
78
  const result = await runScript(script, params, {
@@ -105,8 +112,8 @@ async function cmdRuntimeUninstall(flags) {
105
112
  const script = resolvePayloadFile(scriptName);
106
113
 
107
114
  const params = {};
108
- if (runtime === "claude") {
109
- params.Scope = scope;
115
+ params.Scope = scope;
116
+ if (scope === "project") {
110
117
  params.ProjectPath = projectPath;
111
118
  }
112
119
  if (flags.all) params.All = true;
@@ -114,6 +121,9 @@ async function cmdRuntimeUninstall(flags) {
114
121
  console.log(`Uninstalling ${runtime} runtime assets...`);
115
122
  console.log(` Runtime: ${runtime}`);
116
123
  console.log(` Scope: ${scope}`);
124
+ if (scope === "project") {
125
+ console.log(` Project: ${projectPath}`);
126
+ }
117
127
  console.log("");
118
128
 
119
129
  const result = await runScript(script, params, {
@@ -144,7 +154,16 @@ function cmdRuntimeStatus(flags) {
144
154
  console.log("");
145
155
 
146
156
  // Check both scopes
147
- const scopes = runtime === "claude" ? ["project", "user"] : ["user"];
157
+ const scopes = ["project", "user"];
158
+
159
+ if (runtime === "codex") {
160
+ console.log("Codex scope truth:");
161
+ console.log(` Project-local root: ${resolveCodexProjectHome(projectPath)}`);
162
+ console.log(` User/global root: ${resolveCodexUserHome()}`);
163
+ console.log(" Project-local Codex support requires launching Codex with CODEX_HOME=<project>/.codex.");
164
+ console.log(" Native .codex/skills auto-discovery is not claimed.");
165
+ console.log("");
166
+ }
148
167
 
149
168
  for (const scope of scopes) {
150
169
  const skillsDir = resolveSkillsDir(runtime, scope, projectPath);
@@ -170,6 +189,9 @@ function cmdRuntimeStatus(flags) {
170
189
 
171
190
  console.log(` Scope: ${scope}`);
172
191
  console.log(` Path: ${skillsDir}`);
192
+ if (runtime === "codex" && scope === "project") {
193
+ console.log(" Activation: explicit CODEX_HOME=<project>/.codex contract required");
194
+ }
173
195
  const statusLabel = !exists
174
196
  ? "not installed"
175
197
  : allInstalled
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ const { executeUpdate } = require("../lib/update");
4
+
5
+ async function cmdUpdate(args) {
6
+ return executeUpdate(args);
7
+ }
8
+
9
+ module.exports = {
10
+ cmdUpdate,
11
+ };
package/src/index.js CHANGED
@@ -1,59 +1,62 @@
1
- "use strict";
2
-
3
- const { cmdHelp } = require("./commands/help");
4
- const { cmdInit } = require("./commands/init");
5
- const { cmdAuth } = require("./commands/auth");
6
- const { cmdGenerate } = require("./commands/generate");
7
- const { cmdRuntime } = require("./commands/runtime");
8
- const { ValidationError, CliError } = require("./lib/errors");
9
-
10
- function getVersion() {
11
- const pkg = require("../package.json");
12
- return pkg.version;
13
- }
14
-
15
- function parseCommand(argv) {
16
- if (!argv || argv.length === 0) {
17
- return { command: "help", args: [] };
18
- }
19
- const [first, ...rest] = argv;
20
- if (first === "-h" || first === "--help") {
21
- return { command: "help", args: [] };
22
- }
23
- if (first === "-v" || first === "--version") {
24
- return { command: "version", args: [] };
25
- }
26
- return { command: first, args: rest };
27
- }
28
-
29
- const COMMANDS = new Set(["help", "version", "init", "auth", "generate", "runtime"]);
30
-
31
- async function run(argv) {
32
- const { command, args } = parseCommand(argv);
33
-
34
- if (!COMMANDS.has(command)) {
35
- throw new ValidationError(
36
- `Unknown command: "${command}". Run "sdtk-spec --help" for available commands.`
37
- );
38
- }
39
-
40
- switch (command) {
41
- case "help":
42
- return cmdHelp();
43
- case "version":
44
- console.log(`sdtk-spec-kit ${getVersion()}`);
45
- return 0;
46
- case "init":
47
- return cmdInit(args);
48
- case "auth":
49
- return cmdAuth(args);
50
- case "generate":
51
- return cmdGenerate(args);
52
- case "runtime":
53
- return cmdRuntime(args);
54
- }
55
- }
56
-
57
- module.exports = {
58
- run,
59
- };
1
+ "use strict";
2
+
3
+ const { cmdHelp } = require("./commands/help");
4
+ const { cmdInit } = require("./commands/init");
5
+ const { cmdAuth } = require("./commands/auth");
6
+ const { cmdGenerate } = require("./commands/generate");
7
+ const { cmdRuntime } = require("./commands/runtime");
8
+ const { cmdUpdate } = require("./commands/update");
9
+ const { ValidationError, CliError } = require("./lib/errors");
10
+
11
+ function getVersion() {
12
+ const pkg = require("../package.json");
13
+ return pkg.version;
14
+ }
15
+
16
+ function parseCommand(argv) {
17
+ if (!argv || argv.length === 0) {
18
+ return { command: "help", args: [] };
19
+ }
20
+ const [first, ...rest] = argv;
21
+ if (first === "-h" || first === "--help") {
22
+ return { command: "help", args: [] };
23
+ }
24
+ if (first === "-v" || first === "--version") {
25
+ return { command: "version", args: [] };
26
+ }
27
+ return { command: first, args: rest };
28
+ }
29
+
30
+ const COMMANDS = new Set(["help", "version", "init", "auth", "generate", "runtime", "update"]);
31
+
32
+ async function run(argv) {
33
+ const { command, args } = parseCommand(argv);
34
+
35
+ if (!COMMANDS.has(command)) {
36
+ throw new ValidationError(
37
+ `Unknown command: "${command}". Run "sdtk-spec --help" for available commands.`
38
+ );
39
+ }
40
+
41
+ switch (command) {
42
+ case "help":
43
+ return cmdHelp();
44
+ case "version":
45
+ console.log(`sdtk-spec-kit ${getVersion()}`);
46
+ return 0;
47
+ case "init":
48
+ return cmdInit(args);
49
+ case "auth":
50
+ return cmdAuth(args);
51
+ case "generate":
52
+ return cmdGenerate(args);
53
+ case "runtime":
54
+ return cmdRuntime(args);
55
+ case "update":
56
+ return cmdUpdate(args);
57
+ }
58
+ }
59
+
60
+ module.exports = {
61
+ run,
62
+ };
package/src/lib/scope.js CHANGED
@@ -15,10 +15,23 @@ function defaultScope(runtime) {
15
15
 
16
16
  /**
17
17
  * Returns true if the given runtime supports project-local scope.
18
- * Gate C0: Codex does not support project-local skills.
19
18
  */
20
19
  function isProjectScopeSupported(runtime) {
21
- return runtime === "claude";
20
+ return runtime === "claude" || runtime === "codex";
21
+ }
22
+
23
+ function resolveCodexProjectHome(projectPath) {
24
+ return path.join(projectPath || process.cwd(), ".codex");
25
+ }
26
+
27
+ function resolveCodexUserHome() {
28
+ return process.env.CODEX_HOME || path.join(os.homedir(), ".codex");
29
+ }
30
+
31
+ function resolveCodexHome(scope, projectPath) {
32
+ return scope === "project"
33
+ ? resolveCodexProjectHome(projectPath)
34
+ : resolveCodexUserHome();
22
35
  }
23
36
 
24
37
  /**
@@ -32,8 +45,7 @@ function resolveSkillsDir(runtime, scope, projectPath) {
32
45
  return path.join(projectPath || process.cwd(), ".claude", "skills");
33
46
  }
34
47
 
35
- // Codex: always user/global scope
36
- const codexHome = process.env.CODEX_HOME || path.join(os.homedir(), ".codex");
48
+ const codexHome = resolveCodexHome(scope, projectPath);
37
49
  return path.join(codexHome, "skills");
38
50
  }
39
51
 
@@ -63,6 +75,9 @@ module.exports = {
63
75
  VALID_SCOPES,
64
76
  defaultScope,
65
77
  isProjectScopeSupported,
78
+ resolveCodexHome,
79
+ resolveCodexProjectHome,
80
+ resolveCodexUserHome,
66
81
  resolveSkillsDir,
67
82
  managedSkillNames,
68
83
  };