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.
- package/README.md +136 -106
- package/assets/manifest/toolkit-bundle.manifest.json +94 -80
- package/assets/manifest/toolkit-bundle.sha256.txt +41 -38
- package/assets/toolkit/toolkit/AGENTS.md +5 -4
- package/assets/toolkit/toolkit/README.md +50 -0
- package/assets/toolkit/toolkit/SDTK_TOOLKIT.md +185 -0
- package/assets/toolkit/toolkit/install.ps1 +2 -2
- package/assets/toolkit/toolkit/scripts/init-feature.ps1 +4 -3
- package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +32 -12
- package/assets/toolkit/toolkit/scripts/uninstall-codex-skills.ps1 +33 -6
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/SKILL.md +84 -84
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
- package/assets/toolkit/toolkit/skills/sdtk-api-doc/references/YAML_CREATION_RULES.md +127 -127
- package/assets/toolkit/toolkit/skills/sdtk-arch/SKILL.md +85 -83
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/FLOW_ACTION_SPEC_CREATION_RULES.md +220 -220
- package/assets/toolkit/toolkit/skills/sdtk-arch/references/YAML_CREATION_RULES.md +127 -127
- package/assets/toolkit/toolkit/skills/sdtk-dev/SKILL.md +108 -98
- package/assets/toolkit/toolkit/skills/sdtk-dev-backend/SKILL.md +7 -4
- package/assets/toolkit/toolkit/skills/sdtk-dev-frontend/SKILL.md +7 -4
- package/assets/toolkit/toolkit/skills/sdtk-orchestrator/SKILL.md +97 -81
- package/assets/toolkit/toolkit/skills/sdtk-pm/SKILL.md +37 -30
- package/assets/toolkit/toolkit/skills/sdtk-qa/SKILL.md +75 -52
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/FLOW_ACTION_SPEC_CREATION_RULES.md +220 -220
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/excel-image-export.md +30 -30
- package/assets/toolkit/toolkit/skills/sdtk-screen-design-spec/references/figma-mcp.md +25 -25
- package/assets/toolkit/toolkit/skills/skills.catalog.yaml +4 -2
- package/assets/toolkit/toolkit/skills-claude/api-design-spec/SKILL.md +90 -90
- package/assets/toolkit/toolkit/skills-claude/dev/SKILL.md +3 -0
- package/assets/toolkit/toolkit/skills-claude/orchestrator/SKILL.md +25 -53
- package/assets/toolkit/toolkit/skills-claude/qa/SKILL.md +16 -8
- package/assets/toolkit/toolkit/templates/QUALITY_CHECKLIST.md +124 -121
- package/assets/toolkit/toolkit/templates/README.md +1 -0
- package/assets/toolkit/toolkit/templates/SHARED_PLANNING.md +81 -81
- package/assets/toolkit/toolkit/templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md +468 -468
- package/assets/toolkit/toolkit/templates/docs/api/YAML_CREATION_RULES.md +127 -127
- package/assets/toolkit/toolkit/templates/docs/database/DATABASE_SPEC_TEMPLATE.md +174 -174
- package/assets/toolkit/toolkit/templates/docs/dev/FEATURE_IMPL_PLAN_TEMPLATE.md +106 -93
- package/assets/toolkit/toolkit/templates/docs/qa/CONTROLLER_ACCEPTANCE_TEMPLATE.md +90 -0
- package/assets/toolkit/toolkit/templates/docs/qa/QA_RELEASE_REPORT_TEMPLATE.md +162 -61
- package/assets/toolkit/toolkit/templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md +220 -220
- package/assets/toolkit/toolkit/templates/handoffs/DEV_TO_QA.md +4 -0
- package/assets/toolkit/toolkit/templates/handoffs/QA_RELEASE_DECISION.md +5 -0
- package/package.json +16 -16
- package/src/commands/help.js +123 -101
- package/src/commands/init.js +10 -2
- package/src/commands/runtime.js +27 -5
- package/src/commands/update.js +11 -0
- package/src/index.js +62 -59
- package/src/lib/scope.js +19 -4
- package/src/lib/update.js +326 -0
package/src/commands/help.js
CHANGED
|
@@ -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
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
" --runtime
|
|
19
|
-
" --
|
|
20
|
-
" --
|
|
21
|
-
" --
|
|
22
|
-
" --skip-
|
|
23
|
-
" --
|
|
24
|
-
"",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
" sdtk-spec runtime
|
|
28
|
-
" sdtk-spec runtime
|
|
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
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"",
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"",
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"",
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
+
};
|
package/src/commands/init.js
CHANGED
|
@@ -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
|
-
|
|
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.");
|
package/src/commands/runtime.js
CHANGED
|
@@ -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
|
-
|
|
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 (
|
|
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
|
-
|
|
109
|
-
|
|
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 =
|
|
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
|
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 {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
};
|