sdtk-spec-kit 0.3.11 → 0.3.12
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/assets/manifest/toolkit-bundle.manifest.json +4 -4
- package/assets/manifest/toolkit-bundle.sha256.txt +1 -1
- package/assets/toolkit/toolkit/install.ps1 +347 -310
- package/package.json +1 -1
- package/src/commands/help.js +2 -0
- package/src/commands/init.js +108 -105
- package/src/lib/project-target-guard.js +53 -0
- package/src/lib/update.js +8 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.3.
|
|
3
|
-
"sourceCommit": "
|
|
2
|
+
"version": "0.3.12",
|
|
3
|
+
"sourceCommit": "fdd187d89b2749677696e024600d94270a2fd8e2",
|
|
4
4
|
"fileCount": 98,
|
|
5
5
|
"files": [
|
|
6
6
|
{
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
"path": "toolkit/install.ps1",
|
|
13
|
-
"sha256": "
|
|
14
|
-
"size":
|
|
13
|
+
"sha256": "39cabad986469a3ec8f0edf1d58039cd302e2a4b19364fde2653ba130f4d5ccc",
|
|
14
|
+
"size": 12496
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"path": "toolkit/README.md",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
f97f4d9c671e0aeaf50b2c43d37f0426fa6ef1d5c20a625b14f794893d199ce2 toolkit/AGENTS.md
|
|
2
|
-
|
|
2
|
+
39cabad986469a3ec8f0edf1d58039cd302e2a4b19364fde2653ba130f4d5ccc toolkit/install.ps1
|
|
3
3
|
938f5b5b8b33b0656cad5f6a14037ee369f92ae469341e5210d10dca12bda0e1 toolkit/README.md
|
|
4
4
|
5864881f4f59d634b2570b4f1d69c3bb092fd08dab531c9da470f1560e7d004f toolkit/runtimes/claude/CLAUDE_TEMPLATE.md
|
|
5
5
|
4453f452a6ac99f123d734f66d608e0c3d931262f3b51ea32307ef327911e938 toolkit/runtimes/codex/CODEX_TEMPLATE.md
|
|
@@ -1,310 +1,347 @@
|
|
|
1
|
-
param(
|
|
2
|
-
[string]$ProjectPath,
|
|
3
|
-
[switch]$Force,
|
|
4
|
-
[switch]$SkipSkills,
|
|
5
|
-
[switch]$SkipRuntimeAssets,
|
|
6
|
-
[switch]$Quiet,
|
|
7
|
-
[ValidateSet('codex', 'claude')]
|
|
8
|
-
[string]$Runtime = 'codex',
|
|
9
|
-
[ValidateSet('project', 'user', '')]
|
|
10
|
-
[string]$Scope = ''
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
$ErrorActionPreference = 'Stop'
|
|
14
|
-
Set-StrictMode -Version Latest
|
|
15
|
-
|
|
16
|
-
function Get-FileSha256 {
|
|
17
|
-
param(
|
|
18
|
-
[Parameter(Mandatory = $true)][string]$Path
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
if (-not (Test-Path -LiteralPath $Path)) {
|
|
22
|
-
return $null
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
$stream = [System.IO.File]::OpenRead($Path)
|
|
26
|
-
try {
|
|
27
|
-
$sha = [System.Security.Cryptography.SHA256]::Create()
|
|
28
|
-
$hashBytes = $sha.ComputeHash($stream)
|
|
29
|
-
return [BitConverter]::ToString($hashBytes).Replace('-', '')
|
|
30
|
-
} finally {
|
|
31
|
-
$stream.Close()
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function Copy-File {
|
|
36
|
-
param(
|
|
37
|
-
[Parameter(Mandatory = $true)][string]$SourcePath,
|
|
38
|
-
[Parameter(Mandatory = $true)][string]$DestinationPath,
|
|
39
|
-
[Parameter(Mandatory = $true)][bool]$Overwrite
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
if (-not (Test-Path -LiteralPath $SourcePath)) {
|
|
43
|
-
throw "Missing source: $SourcePath"
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (Test-Path -LiteralPath $DestinationPath) {
|
|
47
|
-
if (-not $Overwrite) {
|
|
48
|
-
Write-Warning "Already exists (skipping). Use -Force to overwrite: $DestinationPath"
|
|
49
|
-
return
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
$parent = Split-Path -Parent $DestinationPath
|
|
54
|
-
if ($parent -and -not (Test-Path -LiteralPath $parent)) {
|
|
55
|
-
New-Item -ItemType Directory -Force -Path $parent | Out-Null
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
Copy-Item -LiteralPath $SourcePath -Destination $DestinationPath -Force
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function Install-ClaudeSkillDirectory {
|
|
62
|
-
param(
|
|
63
|
-
[Parameter(Mandatory = $true)][System.IO.DirectoryInfo]$SkillDir,
|
|
64
|
-
[Parameter(Mandatory = $true)][string]$SkillsDest,
|
|
65
|
-
[Parameter(Mandatory = $true)][string]$ToolkitRoot,
|
|
66
|
-
[Parameter(Mandatory = $true)][bool]$Overwrite
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
$destDir = Join-Path $SkillsDest $SkillDir.Name
|
|
70
|
-
if (Test-Path -LiteralPath $destDir) {
|
|
71
|
-
if (-not $Overwrite) {
|
|
72
|
-
Write-Warning "Already exists (skipping). Use -Force to overwrite: $destDir"
|
|
73
|
-
return $true
|
|
74
|
-
}
|
|
75
|
-
Remove-Item -LiteralPath $destDir -Recurse -Force
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
$parent = Split-Path -Parent $destDir
|
|
79
|
-
if ($parent -and -not (Test-Path -LiteralPath $parent)) {
|
|
80
|
-
New-Item -ItemType Directory -Force -Path $parent | Out-Null
|
|
81
|
-
}
|
|
82
|
-
Copy-Item -LiteralPath $SkillDir.FullName -Destination $destDir -Recurse -Force
|
|
83
|
-
|
|
84
|
-
$canonicalSkillDir = Join-Path $ToolkitRoot "skills/sdtk-$($SkillDir.Name)"
|
|
85
|
-
foreach ($subDirName in @('scripts', 'prompts')) {
|
|
86
|
-
$srcSubDir = Join-Path $canonicalSkillDir $subDirName
|
|
87
|
-
$destSubDir = Join-Path $destDir $subDirName
|
|
88
|
-
if (-not (Test-Path -LiteralPath $srcSubDir)) {
|
|
89
|
-
continue
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (Test-Path -LiteralPath $destSubDir) {
|
|
93
|
-
Remove-Item -LiteralPath $destSubDir -Recurse -Force
|
|
94
|
-
}
|
|
95
|
-
Copy-Item -LiteralPath $srcSubDir -Destination $destSubDir -Recurse -Force
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return $true
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function Install-RuntimeAdapter {
|
|
102
|
-
param(
|
|
103
|
-
[Parameter(Mandatory = $true)][string]$ToolkitRoot,
|
|
104
|
-
[Parameter(Mandatory = $true)][string]$ProjectRoot,
|
|
105
|
-
[Parameter(Mandatory = $true)][string]$RuntimeName,
|
|
106
|
-
[Parameter(Mandatory = $true)][bool]$Overwrite
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
if ($RuntimeName -eq 'codex') {
|
|
110
|
-
$source = Join-Path $ToolkitRoot 'runtimes/codex/CODEX_TEMPLATE.md'
|
|
111
|
-
$dest = Join-Path $ProjectRoot 'CODEX.md'
|
|
112
|
-
Copy-File -SourcePath $source -DestinationPath $dest -Overwrite $Overwrite
|
|
113
|
-
return
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if ($RuntimeName -eq 'claude') {
|
|
117
|
-
$source = Join-Path $ToolkitRoot 'runtimes/claude/CLAUDE_TEMPLATE.md'
|
|
118
|
-
$dest = Join-Path $ProjectRoot 'CLAUDE.md'
|
|
119
|
-
Copy-File -SourcePath $source -DestinationPath $dest -Overwrite $Overwrite
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
throw "Unsupported runtime: $RuntimeName"
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function Install-ClaudeSkills {
|
|
127
|
-
param(
|
|
128
|
-
[Parameter(Mandatory = $true)][string]$ToolkitRoot,
|
|
129
|
-
[Parameter(Mandatory = $true)][string]$ProjectRoot,
|
|
130
|
-
[Parameter(Mandatory = $true)][bool]$Overwrite
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
$skillsSource = Join-Path $ToolkitRoot 'skills-claude'
|
|
134
|
-
$skillsDest = Join-Path $ProjectRoot '.claude/skills'
|
|
135
|
-
|
|
136
|
-
if (-not (Test-Path -LiteralPath $skillsSource)) {
|
|
137
|
-
throw "Claude skills source not found: $skillsSource"
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
$skillCount = 0
|
|
141
|
-
foreach ($skillDir in (Get-ChildItem -Path $skillsSource -Directory)) {
|
|
142
|
-
$srcFile = Join-Path $skillDir.FullName 'SKILL.md'
|
|
143
|
-
if (-not (Test-Path -LiteralPath $srcFile)) { continue }
|
|
144
|
-
|
|
145
|
-
if (Install-ClaudeSkillDirectory -SkillDir $skillDir -SkillsDest $skillsDest -ToolkitRoot $ToolkitRoot -Overwrite $Overwrite) {
|
|
146
|
-
$skillCount++
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
# Install reference files
|
|
151
|
-
$refDest = Join-Path $skillsDest 'references'
|
|
152
|
-
if (-not (Test-Path -LiteralPath $refDest)) {
|
|
153
|
-
New-Item -ItemType Directory -Force -Path $refDest | Out-Null
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
$refCount = 0
|
|
157
|
-
$missingRefs = @()
|
|
158
|
-
|
|
159
|
-
# 6 files from toolkit/templates/docs/
|
|
160
|
-
$templateRefs = @(
|
|
161
|
-
@{ Src = 'templates/docs/api/YAML_CREATION_RULES.md' },
|
|
162
|
-
@{ Src = 'templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md' },
|
|
163
|
-
@{ Src = 'templates/docs/api/FLOWCHART_CREATION_RULES.md' },
|
|
164
|
-
@{ Src = 'templates/docs/api/API_DESIGN_CREATION_RULES.md' },
|
|
165
|
-
@{ Src = 'templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md' },
|
|
166
|
-
@{ Src = 'templates/docs/qa/TEST_CASE_CREATION_RULES.md' }
|
|
167
|
-
)
|
|
168
|
-
|
|
169
|
-
foreach ($ref in $templateRefs) {
|
|
170
|
-
$srcPath = Join-Path $ToolkitRoot $ref.Src
|
|
171
|
-
$fileName = Split-Path -Leaf $srcPath
|
|
172
|
-
$destPath = Join-Path $refDest $fileName
|
|
173
|
-
if (Test-Path -LiteralPath $srcPath) {
|
|
174
|
-
Copy-File -SourcePath $srcPath -DestinationPath $destPath -Overwrite $Overwrite
|
|
175
|
-
$refCount++
|
|
176
|
-
} else {
|
|
177
|
-
$missingRefs += $srcPath
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
# 3 files from toolkit/skills/sdtk-screen-design-spec/references/
|
|
182
|
-
$screenRefs = @('numbering-rules.md', 'figma-mcp.md', 'excel-image-export.md')
|
|
183
|
-
foreach ($fileName in $screenRefs) {
|
|
184
|
-
$srcPath = Join-Path $ToolkitRoot "skills/sdtk-screen-design-spec/references/$fileName"
|
|
185
|
-
$destPath = Join-Path $refDest $fileName
|
|
186
|
-
if (Test-Path -LiteralPath $srcPath) {
|
|
187
|
-
Copy-File -SourcePath $srcPath -DestinationPath $destPath -Overwrite $Overwrite
|
|
188
|
-
$refCount++
|
|
189
|
-
} else {
|
|
190
|
-
$missingRefs += $srcPath
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
# Fail-fast: abort if any reference files are missing
|
|
195
|
-
if ($missingRefs.Count -gt 0) {
|
|
196
|
-
$list = ($missingRefs | ForEach-Object { " - $_" }) -join "`n"
|
|
197
|
-
throw "Claude install failed. Missing reference files:`n$list"
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
# Strict count assertions
|
|
201
|
-
$expectedSkills = 13
|
|
202
|
-
$expectedRefs = 9
|
|
203
|
-
if ($skillCount -ne $expectedSkills) {
|
|
204
|
-
throw "Claude install failed. Expected $expectedSkills skills but installed $skillCount."
|
|
205
|
-
}
|
|
206
|
-
if ($refCount -ne $expectedRefs) {
|
|
207
|
-
throw "Claude install failed. Expected $expectedRefs reference files but installed $refCount."
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
Write-Host " Skills installed: $skillCount"
|
|
211
|
-
Write-Host " Reference files : $refCount"
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
$
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
if (
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
Write-Host "
|
|
285
|
-
|
|
286
|
-
} else {
|
|
287
|
-
Write-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
Write-Host
|
|
309
|
-
Write-Host
|
|
310
|
-
|
|
1
|
+
param(
|
|
2
|
+
[string]$ProjectPath,
|
|
3
|
+
[switch]$Force,
|
|
4
|
+
[switch]$SkipSkills,
|
|
5
|
+
[switch]$SkipRuntimeAssets,
|
|
6
|
+
[switch]$Quiet,
|
|
7
|
+
[ValidateSet('codex', 'claude')]
|
|
8
|
+
[string]$Runtime = 'codex',
|
|
9
|
+
[ValidateSet('project', 'user', '')]
|
|
10
|
+
[string]$Scope = ''
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
$ErrorActionPreference = 'Stop'
|
|
14
|
+
Set-StrictMode -Version Latest
|
|
15
|
+
|
|
16
|
+
function Get-FileSha256 {
|
|
17
|
+
param(
|
|
18
|
+
[Parameter(Mandatory = $true)][string]$Path
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
if (-not (Test-Path -LiteralPath $Path)) {
|
|
22
|
+
return $null
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
$stream = [System.IO.File]::OpenRead($Path)
|
|
26
|
+
try {
|
|
27
|
+
$sha = [System.Security.Cryptography.SHA256]::Create()
|
|
28
|
+
$hashBytes = $sha.ComputeHash($stream)
|
|
29
|
+
return [BitConverter]::ToString($hashBytes).Replace('-', '')
|
|
30
|
+
} finally {
|
|
31
|
+
$stream.Close()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function Copy-File {
|
|
36
|
+
param(
|
|
37
|
+
[Parameter(Mandatory = $true)][string]$SourcePath,
|
|
38
|
+
[Parameter(Mandatory = $true)][string]$DestinationPath,
|
|
39
|
+
[Parameter(Mandatory = $true)][bool]$Overwrite
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
if (-not (Test-Path -LiteralPath $SourcePath)) {
|
|
43
|
+
throw "Missing source: $SourcePath"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (Test-Path -LiteralPath $DestinationPath) {
|
|
47
|
+
if (-not $Overwrite) {
|
|
48
|
+
Write-Warning "Already exists (skipping). Use -Force to overwrite: $DestinationPath"
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
$parent = Split-Path -Parent $DestinationPath
|
|
54
|
+
if ($parent -and -not (Test-Path -LiteralPath $parent)) {
|
|
55
|
+
New-Item -ItemType Directory -Force -Path $parent | Out-Null
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
Copy-Item -LiteralPath $SourcePath -Destination $DestinationPath -Force
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function Install-ClaudeSkillDirectory {
|
|
62
|
+
param(
|
|
63
|
+
[Parameter(Mandatory = $true)][System.IO.DirectoryInfo]$SkillDir,
|
|
64
|
+
[Parameter(Mandatory = $true)][string]$SkillsDest,
|
|
65
|
+
[Parameter(Mandatory = $true)][string]$ToolkitRoot,
|
|
66
|
+
[Parameter(Mandatory = $true)][bool]$Overwrite
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
$destDir = Join-Path $SkillsDest $SkillDir.Name
|
|
70
|
+
if (Test-Path -LiteralPath $destDir) {
|
|
71
|
+
if (-not $Overwrite) {
|
|
72
|
+
Write-Warning "Already exists (skipping). Use -Force to overwrite: $destDir"
|
|
73
|
+
return $true
|
|
74
|
+
}
|
|
75
|
+
Remove-Item -LiteralPath $destDir -Recurse -Force
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
$parent = Split-Path -Parent $destDir
|
|
79
|
+
if ($parent -and -not (Test-Path -LiteralPath $parent)) {
|
|
80
|
+
New-Item -ItemType Directory -Force -Path $parent | Out-Null
|
|
81
|
+
}
|
|
82
|
+
Copy-Item -LiteralPath $SkillDir.FullName -Destination $destDir -Recurse -Force
|
|
83
|
+
|
|
84
|
+
$canonicalSkillDir = Join-Path $ToolkitRoot "skills/sdtk-$($SkillDir.Name)"
|
|
85
|
+
foreach ($subDirName in @('scripts', 'prompts')) {
|
|
86
|
+
$srcSubDir = Join-Path $canonicalSkillDir $subDirName
|
|
87
|
+
$destSubDir = Join-Path $destDir $subDirName
|
|
88
|
+
if (-not (Test-Path -LiteralPath $srcSubDir)) {
|
|
89
|
+
continue
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (Test-Path -LiteralPath $destSubDir) {
|
|
93
|
+
Remove-Item -LiteralPath $destSubDir -Recurse -Force
|
|
94
|
+
}
|
|
95
|
+
Copy-Item -LiteralPath $srcSubDir -Destination $destSubDir -Recurse -Force
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return $true
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function Install-RuntimeAdapter {
|
|
102
|
+
param(
|
|
103
|
+
[Parameter(Mandatory = $true)][string]$ToolkitRoot,
|
|
104
|
+
[Parameter(Mandatory = $true)][string]$ProjectRoot,
|
|
105
|
+
[Parameter(Mandatory = $true)][string]$RuntimeName,
|
|
106
|
+
[Parameter(Mandatory = $true)][bool]$Overwrite
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
if ($RuntimeName -eq 'codex') {
|
|
110
|
+
$source = Join-Path $ToolkitRoot 'runtimes/codex/CODEX_TEMPLATE.md'
|
|
111
|
+
$dest = Join-Path $ProjectRoot 'CODEX.md'
|
|
112
|
+
Copy-File -SourcePath $source -DestinationPath $dest -Overwrite $Overwrite
|
|
113
|
+
return
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if ($RuntimeName -eq 'claude') {
|
|
117
|
+
$source = Join-Path $ToolkitRoot 'runtimes/claude/CLAUDE_TEMPLATE.md'
|
|
118
|
+
$dest = Join-Path $ProjectRoot 'CLAUDE.md'
|
|
119
|
+
Copy-File -SourcePath $source -DestinationPath $dest -Overwrite $Overwrite
|
|
120
|
+
return
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
throw "Unsupported runtime: $RuntimeName"
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function Install-ClaudeSkills {
|
|
127
|
+
param(
|
|
128
|
+
[Parameter(Mandatory = $true)][string]$ToolkitRoot,
|
|
129
|
+
[Parameter(Mandatory = $true)][string]$ProjectRoot,
|
|
130
|
+
[Parameter(Mandatory = $true)][bool]$Overwrite
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
$skillsSource = Join-Path $ToolkitRoot 'skills-claude'
|
|
134
|
+
$skillsDest = Join-Path $ProjectRoot '.claude/skills'
|
|
135
|
+
|
|
136
|
+
if (-not (Test-Path -LiteralPath $skillsSource)) {
|
|
137
|
+
throw "Claude skills source not found: $skillsSource"
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
$skillCount = 0
|
|
141
|
+
foreach ($skillDir in (Get-ChildItem -Path $skillsSource -Directory)) {
|
|
142
|
+
$srcFile = Join-Path $skillDir.FullName 'SKILL.md'
|
|
143
|
+
if (-not (Test-Path -LiteralPath $srcFile)) { continue }
|
|
144
|
+
|
|
145
|
+
if (Install-ClaudeSkillDirectory -SkillDir $skillDir -SkillsDest $skillsDest -ToolkitRoot $ToolkitRoot -Overwrite $Overwrite) {
|
|
146
|
+
$skillCount++
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
# Install reference files
|
|
151
|
+
$refDest = Join-Path $skillsDest 'references'
|
|
152
|
+
if (-not (Test-Path -LiteralPath $refDest)) {
|
|
153
|
+
New-Item -ItemType Directory -Force -Path $refDest | Out-Null
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
$refCount = 0
|
|
157
|
+
$missingRefs = @()
|
|
158
|
+
|
|
159
|
+
# 6 files from toolkit/templates/docs/
|
|
160
|
+
$templateRefs = @(
|
|
161
|
+
@{ Src = 'templates/docs/api/YAML_CREATION_RULES.md' },
|
|
162
|
+
@{ Src = 'templates/docs/api/API_DESIGN_FLOWCHART_CREATION_RULES.md' },
|
|
163
|
+
@{ Src = 'templates/docs/api/FLOWCHART_CREATION_RULES.md' },
|
|
164
|
+
@{ Src = 'templates/docs/api/API_DESIGN_CREATION_RULES.md' },
|
|
165
|
+
@{ Src = 'templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md' },
|
|
166
|
+
@{ Src = 'templates/docs/qa/TEST_CASE_CREATION_RULES.md' }
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
foreach ($ref in $templateRefs) {
|
|
170
|
+
$srcPath = Join-Path $ToolkitRoot $ref.Src
|
|
171
|
+
$fileName = Split-Path -Leaf $srcPath
|
|
172
|
+
$destPath = Join-Path $refDest $fileName
|
|
173
|
+
if (Test-Path -LiteralPath $srcPath) {
|
|
174
|
+
Copy-File -SourcePath $srcPath -DestinationPath $destPath -Overwrite $Overwrite
|
|
175
|
+
$refCount++
|
|
176
|
+
} else {
|
|
177
|
+
$missingRefs += $srcPath
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
# 3 files from toolkit/skills/sdtk-screen-design-spec/references/
|
|
182
|
+
$screenRefs = @('numbering-rules.md', 'figma-mcp.md', 'excel-image-export.md')
|
|
183
|
+
foreach ($fileName in $screenRefs) {
|
|
184
|
+
$srcPath = Join-Path $ToolkitRoot "skills/sdtk-screen-design-spec/references/$fileName"
|
|
185
|
+
$destPath = Join-Path $refDest $fileName
|
|
186
|
+
if (Test-Path -LiteralPath $srcPath) {
|
|
187
|
+
Copy-File -SourcePath $srcPath -DestinationPath $destPath -Overwrite $Overwrite
|
|
188
|
+
$refCount++
|
|
189
|
+
} else {
|
|
190
|
+
$missingRefs += $srcPath
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
# Fail-fast: abort if any reference files are missing
|
|
195
|
+
if ($missingRefs.Count -gt 0) {
|
|
196
|
+
$list = ($missingRefs | ForEach-Object { " - $_" }) -join "`n"
|
|
197
|
+
throw "Claude install failed. Missing reference files:`n$list"
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
# Strict count assertions
|
|
201
|
+
$expectedSkills = 13
|
|
202
|
+
$expectedRefs = 9
|
|
203
|
+
if ($skillCount -ne $expectedSkills) {
|
|
204
|
+
throw "Claude install failed. Expected $expectedSkills skills but installed $skillCount."
|
|
205
|
+
}
|
|
206
|
+
if ($refCount -ne $expectedRefs) {
|
|
207
|
+
throw "Claude install failed. Expected $expectedRefs reference files but installed $refCount."
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
Write-Host " Skills installed: $skillCount"
|
|
211
|
+
Write-Host " Reference files : $refCount"
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function Test-IsMaintainerRoot {
|
|
215
|
+
param(
|
|
216
|
+
[Parameter(Mandatory = $true)][string]$ProjectRoot,
|
|
217
|
+
[Parameter(Mandatory = $true)][string[]]$Markers
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
foreach ($marker in $Markers) {
|
|
221
|
+
if (-not (Test-Path -LiteralPath (Join-Path $ProjectRoot $marker))) {
|
|
222
|
+
return $false
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return $true
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function Get-MaintainerRootInstallMessage {
|
|
230
|
+
param(
|
|
231
|
+
[Parameter(Mandatory = $true)][string]$ProjectRoot
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
return @(
|
|
235
|
+
"Refusing to install managed project files into the SDTK maintainer repo root: $ProjectRoot"
|
|
236
|
+
"This install flow would overwrite repo-owned files such as AGENTS.md, CODEX.md, CLAUDE.md, sdtk-spec.config.json, sdtk-spec.config.profiles.example.json."
|
|
237
|
+
"Target a consumer project path instead of the SDTK maintainer monorepo root."
|
|
238
|
+
"If you only need runtime assets, install them into a separate consumer project path rather than the maintainer repo root."
|
|
239
|
+
) -join "`n"
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
$toolkitRoot = Resolve-Path $PSScriptRoot
|
|
243
|
+
$canonicalRulesPath = Join-Path $toolkitRoot 'templates/docs/api/FLOWCHART_CREATION_RULES.md'
|
|
244
|
+
$canonicalRulesHash = Get-FileSha256 -Path $canonicalRulesPath
|
|
245
|
+
$apiDesignRulesPath = Join-Path $toolkitRoot 'templates/docs/api/API_DESIGN_CREATION_RULES.md'
|
|
246
|
+
$apiDesignRulesHash = Get-FileSha256 -Path $apiDesignRulesPath
|
|
247
|
+
$flowActionRulesPath = Join-Path $toolkitRoot 'templates/docs/specs/FLOW_ACTION_SPEC_CREATION_RULES.md'
|
|
248
|
+
$flowActionRulesHash = Get-FileSha256 -Path $flowActionRulesPath
|
|
249
|
+
|
|
250
|
+
if (-not $ProjectPath) {
|
|
251
|
+
$ProjectPath = (Resolve-Path (Join-Path $toolkitRoot '..')).Path
|
|
252
|
+
}
|
|
253
|
+
$projectRoot = Resolve-Path -LiteralPath $ProjectPath
|
|
254
|
+
|
|
255
|
+
$maintainerRootMarkers = @(
|
|
256
|
+
'governance/ai/core/IMPROVEMENT_BACKLOG.md',
|
|
257
|
+
'products/sdtk-spec/toolkit/install.ps1'
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
if (Test-IsMaintainerRoot -ProjectRoot $projectRoot -Markers $maintainerRootMarkers) {
|
|
261
|
+
throw (Get-MaintainerRootInstallMessage -ProjectRoot $projectRoot)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
# Merge SkipRuntimeAssets and legacy SkipSkills
|
|
265
|
+
if ($SkipRuntimeAssets) { $SkipSkills = $true }
|
|
266
|
+
|
|
267
|
+
# Default scope: project for Claude, user for Codex
|
|
268
|
+
if (-not $Scope -or $Scope -eq '') {
|
|
269
|
+
if ($Runtime -eq 'claude') { $Scope = 'project' }
|
|
270
|
+
else { $Scope = 'user' }
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (-not $Quiet) {
|
|
274
|
+
Write-Host "SDTK toolkit : $toolkitRoot"
|
|
275
|
+
Write-Host "Project root : $projectRoot"
|
|
276
|
+
Write-Host "Runtime : $Runtime"
|
|
277
|
+
if ($canonicalRulesHash) {
|
|
278
|
+
Write-Host "API ruleset : $canonicalRulesPath"
|
|
279
|
+
Write-Host "Ruleset hash : $canonicalRulesHash"
|
|
280
|
+
} else {
|
|
281
|
+
Write-Warning "API ruleset not found: $canonicalRulesPath"
|
|
282
|
+
}
|
|
283
|
+
if ($apiDesignRulesHash) {
|
|
284
|
+
Write-Host "API design ruleset: $apiDesignRulesPath"
|
|
285
|
+
Write-Host "Ruleset hash : $apiDesignRulesHash"
|
|
286
|
+
} else {
|
|
287
|
+
Write-Warning "API design ruleset not found: $apiDesignRulesPath"
|
|
288
|
+
}
|
|
289
|
+
if ($flowActionRulesHash) {
|
|
290
|
+
Write-Host "Flow ruleset : $flowActionRulesPath"
|
|
291
|
+
Write-Host "Ruleset hash : $flowActionRulesHash"
|
|
292
|
+
} else {
|
|
293
|
+
Write-Warning "Flow ruleset not found: $flowActionRulesPath"
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
Copy-File -SourcePath (Join-Path $toolkitRoot 'AGENTS.md') -DestinationPath (Join-Path $projectRoot 'AGENTS.md') -Overwrite ([bool]$Force)
|
|
298
|
+
Copy-File -SourcePath (Join-Path $toolkitRoot 'sdtk-spec.config.json') -DestinationPath (Join-Path $projectRoot 'sdtk-spec.config.json') -Overwrite ([bool]$Force)
|
|
299
|
+
Copy-File -SourcePath (Join-Path $toolkitRoot 'sdtk-spec.config.profiles.example.json') -DestinationPath (Join-Path $projectRoot 'sdtk-spec.config.profiles.example.json') -Overwrite ([bool]$Force)
|
|
300
|
+
Install-RuntimeAdapter -ToolkitRoot $toolkitRoot -ProjectRoot $projectRoot -RuntimeName $Runtime -Overwrite ([bool]$Force)
|
|
301
|
+
|
|
302
|
+
if (($Runtime -eq 'codex') -and (-not $SkipSkills)) {
|
|
303
|
+
$skillInstaller = Join-Path $toolkitRoot 'scripts/install-codex-skills.ps1'
|
|
304
|
+
if (-not (Test-Path -LiteralPath $skillInstaller)) {
|
|
305
|
+
throw "Missing skill installer script: $skillInstaller"
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
Write-Host ""
|
|
309
|
+
Write-Host "Installing Codex skills (scope: $Scope)..."
|
|
310
|
+
if ($Force) {
|
|
311
|
+
& $skillInstaller -Scope $Scope -ProjectPath $projectRoot.ToString() -Force | Out-Host
|
|
312
|
+
} else {
|
|
313
|
+
& $skillInstaller -Scope $Scope -ProjectPath $projectRoot.ToString() | Out-Host
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
elseif (($Runtime -eq 'claude') -and (-not $SkipSkills)) {
|
|
317
|
+
$skillInstaller = Join-Path $toolkitRoot 'scripts/install-claude-skills.ps1'
|
|
318
|
+
if (-not (Test-Path -LiteralPath $skillInstaller)) {
|
|
319
|
+
# Fallback to inline Install-ClaudeSkills for backward compatibility
|
|
320
|
+
Write-Host ""
|
|
321
|
+
Write-Host "Installing Claude Code skills..."
|
|
322
|
+
Install-ClaudeSkills -ToolkitRoot $toolkitRoot -ProjectRoot $projectRoot -Overwrite ([bool]$Force)
|
|
323
|
+
} else {
|
|
324
|
+
Write-Host ""
|
|
325
|
+
Write-Host "Installing Claude Code skills (scope: $Scope)..."
|
|
326
|
+
if ($Force) {
|
|
327
|
+
& $skillInstaller -Scope $Scope -ProjectPath $projectRoot.ToString() -Force | Out-Host
|
|
328
|
+
} else {
|
|
329
|
+
& $skillInstaller -Scope $Scope -ProjectPath $projectRoot.ToString() | Out-Host
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
if (-not $Quiet) {
|
|
335
|
+
Write-Host ""
|
|
336
|
+
Write-Host "Install complete."
|
|
337
|
+
Write-Host "Next:"
|
|
338
|
+
Write-Host "1) Edit project config: $((Join-Path $projectRoot 'sdtk-spec.config.json'))"
|
|
339
|
+
if ($Runtime -eq 'codex') {
|
|
340
|
+
Write-Host "2) Restart Codex (to load runtime adapter and skills)"
|
|
341
|
+
} else {
|
|
342
|
+
Write-Host "2) Restart Claude Code (to load CLAUDE.md + skills)"
|
|
343
|
+
Write-Host " Commands: /orchestrator /pm /ba /arch /dev /qa"
|
|
344
|
+
}
|
|
345
|
+
Write-Host '3) Generate feature docs:'
|
|
346
|
+
Write-Host ' sdtk generate --feature-key YOUR_FEATURE --feature-name "Your Feature"'
|
|
347
|
+
}
|
package/package.json
CHANGED
package/src/commands/help.js
CHANGED
|
@@ -37,6 +37,8 @@ function cmdHelp() {
|
|
|
37
37
|
" --skip-project-files Skip sdtk-spec init --force during update",
|
|
38
38
|
" --skip-runtime-assets Skip runtime asset refresh during update",
|
|
39
39
|
" --verbose Show detailed command output",
|
|
40
|
+
" Maintainer-root guard: init/update refuse the SDTK maintainer monorepo root as a managed project target.",
|
|
41
|
+
" Use a consumer project path, or use --skip-project-files when update should avoid project-file refresh.",
|
|
40
42
|
"",
|
|
41
43
|
"Runtime options:",
|
|
42
44
|
" --runtime <codex|claude> Target runtime (required)",
|
package/src/commands/init.js
CHANGED
|
@@ -1,105 +1,108 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const path = require("path");
|
|
4
|
-
const { parseFlags, validateChoice } = require("../lib/args");
|
|
5
|
-
const { verify, resolvePayloadFile } = require("../lib/toolkit-payload");
|
|
6
|
-
const { runScript } = require("../lib/powershell");
|
|
7
|
-
const { ValidationError } = require("../lib/errors");
|
|
8
|
-
const { VALID_SCOPES, defaultScope, isProjectScopeSupported } = require("../lib/scope");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"skip-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
//
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
console.log(`
|
|
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
|
-
console.log(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const { parseFlags, validateChoice } = require("../lib/args");
|
|
5
|
+
const { verify, resolvePayloadFile } = require("../lib/toolkit-payload");
|
|
6
|
+
const { runScript } = require("../lib/powershell");
|
|
7
|
+
const { ValidationError } = require("../lib/errors");
|
|
8
|
+
const { VALID_SCOPES, defaultScope, isProjectScopeSupported } = require("../lib/scope");
|
|
9
|
+
const { assertProjectRefreshTargetAllowed } = require("../lib/project-target-guard");
|
|
10
|
+
|
|
11
|
+
const FLAG_DEFS = {
|
|
12
|
+
runtime: { type: "string" },
|
|
13
|
+
"project-path": { type: "string" },
|
|
14
|
+
"runtime-scope": { type: "string" },
|
|
15
|
+
force: { type: "boolean" },
|
|
16
|
+
"skip-skills": { type: "boolean" },
|
|
17
|
+
"skip-runtime-assets": { type: "boolean" },
|
|
18
|
+
verbose: { type: "boolean" },
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const VALID_RUNTIMES = ["codex", "claude"];
|
|
22
|
+
|
|
23
|
+
async function cmdInit(args) {
|
|
24
|
+
const { flags } = parseFlags(args, FLAG_DEFS);
|
|
25
|
+
|
|
26
|
+
// Validate runtime
|
|
27
|
+
const runtime = flags.runtime || "codex";
|
|
28
|
+
validateChoice(runtime, VALID_RUNTIMES, "runtime");
|
|
29
|
+
|
|
30
|
+
// Resolve scope
|
|
31
|
+
const scope = flags["runtime-scope"] || defaultScope(runtime);
|
|
32
|
+
validateChoice(scope, VALID_SCOPES, "runtime-scope");
|
|
33
|
+
|
|
34
|
+
if (scope === "project" && !isProjectScopeSupported(runtime)) {
|
|
35
|
+
throw new ValidationError(
|
|
36
|
+
`${runtime} does not support project-local runtime assets. Use --runtime-scope user instead.`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Handle deprecated --skip-skills
|
|
41
|
+
const skipAssets = flags["skip-runtime-assets"] || flags["skip-skills"];
|
|
42
|
+
if (flags["skip-skills"] && !flags["skip-runtime-assets"]) {
|
|
43
|
+
console.warn(
|
|
44
|
+
"Warning: --skip-skills is deprecated. Use --skip-runtime-assets instead."
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Resolve project path
|
|
49
|
+
const projectPath = flags["project-path"]
|
|
50
|
+
? path.resolve(flags["project-path"])
|
|
51
|
+
: process.cwd();
|
|
52
|
+
|
|
53
|
+
assertProjectRefreshTargetAllowed("sdtk-spec", "init", projectPath);
|
|
54
|
+
|
|
55
|
+
// Verify payload integrity before proceeding
|
|
56
|
+
verify();
|
|
57
|
+
|
|
58
|
+
// Resolve bundled install.ps1
|
|
59
|
+
const installScript = resolvePayloadFile("toolkit/install.ps1");
|
|
60
|
+
|
|
61
|
+
// Build PowerShell parameters
|
|
62
|
+
const params = {
|
|
63
|
+
ProjectPath: projectPath,
|
|
64
|
+
Runtime: runtime,
|
|
65
|
+
Scope: scope,
|
|
66
|
+
};
|
|
67
|
+
if (flags.force) params.Force = true;
|
|
68
|
+
if (skipAssets) params.SkipRuntimeAssets = true;
|
|
69
|
+
if (!flags.verbose) params.Quiet = true;
|
|
70
|
+
|
|
71
|
+
console.log(`Initializing SDTK-SPEC workspace...`);
|
|
72
|
+
console.log(` Runtime: ${runtime}`);
|
|
73
|
+
console.log(` Scope: ${scope}`);
|
|
74
|
+
console.log(` Project: ${projectPath}`);
|
|
75
|
+
if (runtime === "codex" && scope === "project") {
|
|
76
|
+
console.log(` Codex home contract: ${path.join(projectPath, ".codex")}`);
|
|
77
|
+
console.log(" Note: Launch Codex with CODEX_HOME=<project>/.codex to use project-local skills.");
|
|
78
|
+
console.log(" Note: This CLI does not claim native .codex/skills auto-discovery.");
|
|
79
|
+
}
|
|
80
|
+
console.log("");
|
|
81
|
+
|
|
82
|
+
const result = await runScript(installScript, params, { silent: !flags.verbose });
|
|
83
|
+
|
|
84
|
+
if (result.exitCode !== 0) {
|
|
85
|
+
if (result.stderr) {
|
|
86
|
+
console.error(result.stderr);
|
|
87
|
+
}
|
|
88
|
+
throw new ValidationError(
|
|
89
|
+
`Initialization failed (exit code ${result.exitCode}).`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
console.log("");
|
|
94
|
+
console.log("SDTK-SPEC workspace initialized successfully.");
|
|
95
|
+
if (runtime === "codex" && scope === "project") {
|
|
96
|
+
console.log(`Project-local Codex skills were installed into ${path.join(projectPath, ".codex", "skills")}.`);
|
|
97
|
+
console.log("Launch Codex with CODEX_HOME=<project>/.codex to activate that local runtime home.");
|
|
98
|
+
}
|
|
99
|
+
console.log("");
|
|
100
|
+
console.log("Next steps:");
|
|
101
|
+
console.log(" 1. Review and customize sdtk-spec.config.json for your project stack.");
|
|
102
|
+
console.log(' 2. Run "sdtk-spec generate --feature-key <KEY> --feature-name <name>" to scaffold docs.');
|
|
103
|
+
return 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
module.exports = {
|
|
107
|
+
cmdInit,
|
|
108
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { ValidationError } = require("./errors");
|
|
6
|
+
|
|
7
|
+
const MAINTAINER_ROOT_MARKERS = [
|
|
8
|
+
"governance/ai/core/IMPROVEMENT_BACKLOG.md",
|
|
9
|
+
"products/sdtk-spec/toolkit/install.ps1",
|
|
10
|
+
];
|
|
11
|
+
const PROTECTED_FILES = [
|
|
12
|
+
"AGENTS.md",
|
|
13
|
+
"CODEX.md",
|
|
14
|
+
"CLAUDE.md",
|
|
15
|
+
"sdtk-spec.config.json",
|
|
16
|
+
"sdtk-spec.config.profiles.example.json"
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
function isMaintainerRoot(projectPath) {
|
|
20
|
+
const resolved = path.resolve(projectPath);
|
|
21
|
+
return MAINTAINER_ROOT_MARKERS.every((marker) => fs.existsSync(path.join(resolved, marker)));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function buildMaintainerRootMessage(cliName, action, projectPath) {
|
|
25
|
+
const lines = [
|
|
26
|
+
`Refusing to refresh managed project files into the SDTK maintainer repo root: ${projectPath}`,
|
|
27
|
+
`The ${action} flow would overwrite repo-owned files such as ${PROTECTED_FILES.join(", ")}.`,
|
|
28
|
+
"Target a consumer project path instead of the SDTK maintainer monorepo root.",
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
if (action === "update") {
|
|
32
|
+
lines.push(`If you only need package/runtime refresh, rerun ${cliName} update with --skip-project-files.`);
|
|
33
|
+
} else {
|
|
34
|
+
lines.push(`If you only need runtime assets, use ${cliName} runtime install against the desired consumer project path instead of ${cliName} init.`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return lines.join("\n");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function assertProjectRefreshTargetAllowed(cliName, action, projectPath) {
|
|
41
|
+
if (!isMaintainerRoot(projectPath)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
throw new ValidationError(buildMaintainerRootMessage(cliName, action, projectPath));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = {
|
|
49
|
+
assertProjectRefreshTargetAllowed,
|
|
50
|
+
buildMaintainerRootMessage,
|
|
51
|
+
isMaintainerRoot,
|
|
52
|
+
};
|
|
53
|
+
|
package/src/lib/update.js
CHANGED
|
@@ -5,6 +5,7 @@ const { spawn } = require("child_process");
|
|
|
5
5
|
const { parseFlags, validateChoice } = require("./args");
|
|
6
6
|
const { CliError, DependencyError, ValidationError } = require("./errors");
|
|
7
7
|
const { VALID_SCOPES, defaultScope, isProjectScopeSupported } = require("./scope");
|
|
8
|
+
const { assertProjectRefreshTargetAllowed } = require("./project-target-guard");
|
|
8
9
|
|
|
9
10
|
const PACKAGE_NAME = "sdtk-spec-kit";
|
|
10
11
|
const CLI_NAME = "sdtk-spec";
|
|
@@ -231,11 +232,17 @@ function parseUpdateOptions(args) {
|
|
|
231
232
|
}
|
|
232
233
|
}
|
|
233
234
|
|
|
235
|
+
const projectPath = path.resolve(flags["project-path"] || process.cwd());
|
|
236
|
+
|
|
237
|
+
if (runtime && !flags["skip-project-files"]) {
|
|
238
|
+
assertProjectRefreshTargetAllowed("sdtk-spec", "update", projectPath);
|
|
239
|
+
}
|
|
240
|
+
|
|
234
241
|
return {
|
|
235
242
|
requestedVersion,
|
|
236
243
|
runtime,
|
|
237
244
|
scope,
|
|
238
|
-
projectPath
|
|
245
|
+
projectPath,
|
|
239
246
|
checkOnly: flags["check-only"],
|
|
240
247
|
skipProjectFiles: flags["skip-project-files"],
|
|
241
248
|
skipRuntimeAssets: flags["skip-runtime-assets"],
|