sdtk-spec-kit 0.3.11 → 0.3.13
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 +79 -39
- package/assets/manifest/toolkit-bundle.sha256.txt +27 -19
- package/assets/toolkit/toolkit/AGENTS.md +1 -1
- package/assets/toolkit/toolkit/README.md +1 -1
- package/assets/toolkit/toolkit/SDTK_TOOLKIT.md +1 -1
- package/assets/toolkit/toolkit/install.ps1 +347 -310
- package/assets/toolkit/toolkit/scripts/agents/run-claude-task.ps1 +52 -0
- package/assets/toolkit/toolkit/scripts/agents/run-codex-task.ps1 +44 -0
- package/assets/toolkit/toolkit/scripts/generate-code-handoff.ps1 +308 -246
- package/assets/toolkit/toolkit/scripts/install-claude-skills.ps1 +1 -1
- package/assets/toolkit/toolkit/skills/sdtk-api-design-spec/scripts/generate_api_design_detail.py +1 -1
- package/assets/toolkit/toolkit/skills/sdtk-ba/SKILL.md +10 -0
- package/assets/toolkit/toolkit/skills/sdtk-dev/SKILL.md +28 -4
- package/assets/toolkit/toolkit/skills/sdtk-mailbox-dispatch/SKILL.md +70 -0
- package/assets/toolkit/toolkit/skills/sdtk-orchestrator/SKILL.md +8 -0
- package/assets/toolkit/toolkit/skills/sdtk-pm/SKILL.md +28 -0
- package/assets/toolkit/toolkit/skills/skills.catalog.yaml +25 -0
- package/assets/toolkit/toolkit/skills-claude/ba/SKILL.md +9 -0
- package/assets/toolkit/toolkit/skills-claude/dev/SKILL.md +58 -57
- package/assets/toolkit/toolkit/skills-claude/mailbox-dispatch/SKILL.md +70 -0
- package/assets/toolkit/toolkit/skills-claude/orchestrator/SKILL.md +7 -0
- package/assets/toolkit/toolkit/skills-claude/pm/SKILL.md +29 -2
- package/assets/toolkit/toolkit/templates/docs/dev/FEATURE_IMPL_PLAN_TEMPLATE.md +13 -2
- package/assets/toolkit/toolkit/templates/docs/dev/OPS_HANDOFF_CREATION_RULES.md +369 -0
- package/assets/toolkit/toolkit/templates/docs/product/CONDENSED_UPSTREAM_INPUT_TEMPLATE.md +136 -0
- package/assets/toolkit/toolkit/templates/handoffs/DEV_TO_SDTK_CODE.md +34 -29
- package/assets/toolkit/toolkit/templates/handoffs/PM_TO_BA.md +4 -0
- package/assets/toolkit/toolkit/templates/mailbox/AGENT_REPORT_TEMPLATE.md +46 -0
- package/assets/toolkit/toolkit/templates/mailbox/AGENT_TASK_TEMPLATE.md +59 -0
- package/package.json +48 -48
- 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,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
|
+
}
|