sdtk-code-kit 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +201 -201
  2. package/assets/manifest/toolkit-bundle.manifest.json +147 -147
  3. package/assets/manifest/toolkit-bundle.sha256.txt +28 -28
  4. package/assets/toolkit/toolkit/AGENTS.md +219 -219
  5. package/assets/toolkit/toolkit/install.ps1 +156 -156
  6. package/assets/toolkit/toolkit/scripts/install-claude-skills.ps1 +78 -78
  7. package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +150 -150
  8. package/assets/toolkit/toolkit/scripts/uninstall-claude-skills.ps1 +62 -62
  9. package/assets/toolkit/toolkit/scripts/uninstall-codex-skills.ps1 +82 -82
  10. package/assets/toolkit/toolkit/sdtk-spec.config.json +6 -6
  11. package/assets/toolkit/toolkit/sdtk-spec.config.profiles.example.json +12 -12
  12. package/assets/toolkit/toolkit/skills/code-brainstorm/SKILL.md +55 -55
  13. package/assets/toolkit/toolkit/skills/code-debug/SKILL.md +296 -296
  14. package/assets/toolkit/toolkit/skills/code-debug/references/root-cause-tracing.md +68 -68
  15. package/assets/toolkit/toolkit/skills/code-discover/SKILL.md +54 -54
  16. package/assets/toolkit/toolkit/skills/code-execute/SKILL.md +74 -74
  17. package/assets/toolkit/toolkit/skills/code-finish/SKILL.md +205 -205
  18. package/assets/toolkit/toolkit/skills/code-parallel/SKILL.md +64 -64
  19. package/assets/toolkit/toolkit/skills/code-parallel/references/code-quality-reviewer-prompt.md +26 -26
  20. package/assets/toolkit/toolkit/skills/code-parallel/references/implementer-prompt.md +113 -113
  21. package/assets/toolkit/toolkit/skills/code-parallel/references/spec-reviewer-prompt.md +61 -61
  22. package/assets/toolkit/toolkit/skills/code-plan/SKILL.md +85 -85
  23. package/assets/toolkit/toolkit/skills/code-review/SKILL.md +79 -79
  24. package/assets/toolkit/toolkit/skills/code-review/references/checklist.md +125 -125
  25. package/assets/toolkit/toolkit/skills/code-review/references/code-reviewer.md +146 -146
  26. package/assets/toolkit/toolkit/skills/code-ship/SKILL.md +52 -52
  27. package/assets/toolkit/toolkit/skills/code-tdd/SKILL.md +378 -378
  28. package/assets/toolkit/toolkit/skills/code-tdd/references/testing-anti-patterns.md +299 -299
  29. package/assets/toolkit/toolkit/skills/code-verify/SKILL.md +144 -144
  30. package/assets/toolkit/toolkit/skills/code-worktree/SKILL.md +228 -228
  31. package/assets/toolkit/toolkit/templates/CODE_WORKFLOW_TEMPLATE.md +140 -140
  32. package/bin/sdtk-code.js +14 -14
  33. package/package.json +44 -44
  34. package/src/commands/build.js +53 -53
  35. package/src/commands/doctor.js +51 -51
  36. package/src/commands/generate.js +11 -11
  37. package/src/commands/guardrails.js +215 -123
  38. package/src/commands/help.js +244 -244
  39. package/src/commands/init.js +98 -98
  40. package/src/commands/plan.js +53 -53
  41. package/src/commands/readiness.js +77 -77
  42. package/src/commands/resume.js +61 -61
  43. package/src/commands/runtime.js +224 -224
  44. package/src/commands/ship.js +59 -59
  45. package/src/commands/sleep.js +132 -0
  46. package/src/commands/start.js +89 -89
  47. package/src/commands/status.js +77 -77
  48. package/src/commands/update.js +11 -11
  49. package/src/commands/verify.js +71 -71
  50. package/src/index.js +108 -104
  51. package/src/lib/args.js +107 -107
  52. package/src/lib/errors.js +41 -41
  53. package/src/lib/powershell.js +65 -65
  54. package/src/lib/project-target-guard.js +53 -53
  55. package/src/lib/scope.js +72 -72
  56. package/src/lib/ship-readiness.js +281 -281
  57. package/src/lib/sleep-plan.js +175 -0
  58. package/src/lib/sleep-report.js +229 -0
  59. package/src/lib/toolkit-payload.js +72 -72
  60. package/src/lib/trust-events.js +166 -166
  61. package/src/lib/trust-file-scope.js +154 -154
  62. package/src/lib/trust-policy.js +212 -212
  63. package/src/lib/trust-redact.js +35 -35
  64. package/src/lib/trust-trace.js +179 -179
  65. package/src/lib/update.js +344 -344
  66. package/src/lib/workflow-artifact.js +503 -503
  67. package/src/lib/workflow-build.js +127 -127
  68. package/src/lib/workflow-doctor.js +83 -83
  69. package/src/lib/workflow-handoff.js +1029 -1029
  70. package/src/lib/workflow-intake.js +101 -101
  71. package/src/lib/workflow-plan.js +193 -193
  72. package/src/lib/workflow-review-packet.js +650 -650
  73. package/src/lib/workflow-ship.js +213 -213
  74. package/src/lib/workflow-state.js +438 -438
  75. package/src/lib/workflow-verify.js +393 -393
@@ -1,150 +1,150 @@
1
- param(
2
- [ValidateSet('project', 'user')]
3
- [string]$Scope = 'user',
4
- [string]$ProjectPath,
5
- [switch]$Force,
6
- [switch]$Quiet
7
- )
8
-
9
- $ErrorActionPreference = 'Stop'
10
- Set-StrictMode -Version Latest
11
-
12
- function Resolve-CodexHome {
13
- param(
14
- [Parameter(Mandatory = $true)][string]$TargetScope,
15
- [string]$TargetProjectPath
16
- )
17
-
18
- if ($TargetScope -eq 'project') {
19
- if (-not $TargetProjectPath -or $TargetProjectPath.Trim().Length -eq 0) {
20
- throw "Project-local Codex install requires -ProjectPath."
21
- }
22
- if (-not (Test-Path -LiteralPath $TargetProjectPath)) {
23
- New-Item -ItemType Directory -Force -Path $TargetProjectPath | Out-Null
24
- }
25
- $projectRoot = (Resolve-Path -LiteralPath $TargetProjectPath).Path
26
- return (Join-Path $projectRoot '.codex')
27
- }
28
-
29
- if ($env:CODEX_HOME) {
30
- return $env:CODEX_HOME
31
- }
32
- return (Join-Path $HOME '.codex')
33
- }
34
-
35
- function Write-Utf8NoBomFile {
36
- param(
37
- [Parameter(Mandatory = $true)][string]$Path,
38
- [Parameter(Mandatory = $true)][string]$Content
39
- )
40
-
41
- $utf8NoBom = New-Object System.Text.UTF8Encoding($false)
42
- [System.IO.File]::WriteAllText($Path, $Content, $utf8NoBom)
43
- }
44
-
45
- function Rewrite-SkillFrontmatterName {
46
- param(
47
- [Parameter(Mandatory = $true)][string]$SkillFilePath,
48
- [Parameter(Mandatory = $true)][string]$ExpectedName
49
- )
50
-
51
- $content = Get-Content -LiteralPath $SkillFilePath -Raw -Encoding UTF8
52
- $newline = if ($content.Contains("`r`n")) { "`r`n" } else { "`n" }
53
- $match = [regex]::Match(
54
- $content,
55
- '\A(?<prefix>\s*(?:<!--[\s\S]*?-->\s*)?)---\r?\n(?<frontmatter>[\s\S]*?)\r?\n---(?<suffix>[\s\S]*)\z'
56
- )
57
- if (-not $match.Success) {
58
- throw "Skill file is missing a valid YAML frontmatter block: $SkillFilePath"
59
- }
60
-
61
- $frontmatter = $match.Groups['frontmatter'].Value
62
- if ($frontmatter -notmatch '(?m)^name:\s*(?<name>[^\r\n]+)\s*$') {
63
- throw "Skill file is missing a frontmatter name field: $SkillFilePath"
64
- }
65
-
66
- $updatedFrontmatter = [regex]::Replace(
67
- $frontmatter,
68
- '(?m)^name:\s*[^\r\n]+\s*$',
69
- "name: $ExpectedName",
70
- 1
71
- )
72
-
73
- $updatedContent = $match.Groups['prefix'].Value + '---' + $newline + $updatedFrontmatter + $newline + '---' + $match.Groups['suffix'].Value
74
- Write-Utf8NoBomFile -Path $SkillFilePath -Content $updatedContent
75
- }
76
-
77
- $toolkitRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
78
- $skillsSource = Join-Path $toolkitRoot 'skills'
79
- if (-not (Test-Path -LiteralPath $skillsSource)) {
80
- throw "Missing toolkit skills source directory: $skillsSource"
81
- }
82
-
83
- $managedSkills = @(Get-ChildItem -LiteralPath $skillsSource -Directory | Sort-Object Name)
84
- if ($managedSkills.Count -ne 12) {
85
- throw "Expected 12 managed SDTK-CODE skills but found $($managedSkills.Count)."
86
- }
87
-
88
- $codexHome = Resolve-CodexHome -TargetScope $Scope -TargetProjectPath $ProjectPath
89
- $skillsDest = Join-Path $codexHome 'skills'
90
- New-Item -ItemType Directory -Force -Path $skillsDest | Out-Null
91
-
92
- $copied = 0
93
- $skipped = 0
94
- foreach ($skillDir in $managedSkills) {
95
- $skillFile = Join-Path $skillDir.FullName 'SKILL.md'
96
- if (-not (Test-Path -LiteralPath $skillFile)) {
97
- throw "Managed skill is missing SKILL.md: $($skillDir.FullName)"
98
- }
99
-
100
- $destName = "sdtk-$($skillDir.Name)"
101
- $destDir = Join-Path $skillsDest $destName
102
- if (Test-Path -LiteralPath $destDir) {
103
- if (-not $Force) {
104
- $skipped++
105
- if (-not $Quiet) {
106
- Write-Warning "Skill already installed (skipping). Use -Force to overwrite: $destName"
107
- }
108
- continue
109
- }
110
- Remove-Item -LiteralPath $destDir -Recurse -Force
111
- }
112
-
113
- Copy-Item -LiteralPath $skillDir.FullName -Destination $destDir -Recurse -Force
114
- try {
115
- Rewrite-SkillFrontmatterName -SkillFilePath (Join-Path $destDir 'SKILL.md') -ExpectedName $destName
116
- } catch {
117
- if (Test-Path -LiteralPath $destDir) {
118
- Remove-Item -LiteralPath $destDir -Recurse -Force
119
- }
120
- throw
121
- }
122
-
123
- $copied++
124
- if (-not $Quiet) {
125
- Write-Host "Installed: $destName"
126
- }
127
- }
128
-
129
- $expectedNames = $managedSkills.Name | ForEach-Object { "sdtk-$_" }
130
- $installedNow = @(
131
- Get-ChildItem -LiteralPath $skillsDest -Directory -ErrorAction SilentlyContinue |
132
- Where-Object { $expectedNames -contains $_.Name } |
133
- Select-Object -ExpandProperty Name
134
- )
135
- if ($installedNow.Count -ne 12) {
136
- throw "Codex skill install incomplete. Expected 12 managed skills at $skillsDest but found $($installedNow.Count)."
137
- }
138
-
139
- if (-not $Quiet) {
140
- Write-Host ""
141
- Write-Host "Install summary:"
142
- Write-Host "- Scope: $Scope"
143
- Write-Host "- Destination: $skillsDest"
144
- Write-Host "- Copied: $copied"
145
- Write-Host "- Skipped: $skipped"
146
- if ($Scope -eq 'project') {
147
- Write-Host "- Project-local Codex support requires launching Codex with CODEX_HOME=<project>/.codex."
148
- Write-Host "- Native .codex/skills auto-discovery is not claimed."
149
- }
150
- }
1
+ param(
2
+ [ValidateSet('project', 'user')]
3
+ [string]$Scope = 'user',
4
+ [string]$ProjectPath,
5
+ [switch]$Force,
6
+ [switch]$Quiet
7
+ )
8
+
9
+ $ErrorActionPreference = 'Stop'
10
+ Set-StrictMode -Version Latest
11
+
12
+ function Resolve-CodexHome {
13
+ param(
14
+ [Parameter(Mandatory = $true)][string]$TargetScope,
15
+ [string]$TargetProjectPath
16
+ )
17
+
18
+ if ($TargetScope -eq 'project') {
19
+ if (-not $TargetProjectPath -or $TargetProjectPath.Trim().Length -eq 0) {
20
+ throw "Project-local Codex install requires -ProjectPath."
21
+ }
22
+ if (-not (Test-Path -LiteralPath $TargetProjectPath)) {
23
+ New-Item -ItemType Directory -Force -Path $TargetProjectPath | Out-Null
24
+ }
25
+ $projectRoot = (Resolve-Path -LiteralPath $TargetProjectPath).Path
26
+ return (Join-Path $projectRoot '.codex')
27
+ }
28
+
29
+ if ($env:CODEX_HOME) {
30
+ return $env:CODEX_HOME
31
+ }
32
+ return (Join-Path $HOME '.codex')
33
+ }
34
+
35
+ function Write-Utf8NoBomFile {
36
+ param(
37
+ [Parameter(Mandatory = $true)][string]$Path,
38
+ [Parameter(Mandatory = $true)][string]$Content
39
+ )
40
+
41
+ $utf8NoBom = New-Object System.Text.UTF8Encoding($false)
42
+ [System.IO.File]::WriteAllText($Path, $Content, $utf8NoBom)
43
+ }
44
+
45
+ function Rewrite-SkillFrontmatterName {
46
+ param(
47
+ [Parameter(Mandatory = $true)][string]$SkillFilePath,
48
+ [Parameter(Mandatory = $true)][string]$ExpectedName
49
+ )
50
+
51
+ $content = Get-Content -LiteralPath $SkillFilePath -Raw -Encoding UTF8
52
+ $newline = if ($content.Contains("`r`n")) { "`r`n" } else { "`n" }
53
+ $match = [regex]::Match(
54
+ $content,
55
+ '\A(?<prefix>\s*(?:<!--[\s\S]*?-->\s*)?)---\r?\n(?<frontmatter>[\s\S]*?)\r?\n---(?<suffix>[\s\S]*)\z'
56
+ )
57
+ if (-not $match.Success) {
58
+ throw "Skill file is missing a valid YAML frontmatter block: $SkillFilePath"
59
+ }
60
+
61
+ $frontmatter = $match.Groups['frontmatter'].Value
62
+ if ($frontmatter -notmatch '(?m)^name:\s*(?<name>[^\r\n]+)\s*$') {
63
+ throw "Skill file is missing a frontmatter name field: $SkillFilePath"
64
+ }
65
+
66
+ $updatedFrontmatter = [regex]::Replace(
67
+ $frontmatter,
68
+ '(?m)^name:\s*[^\r\n]+\s*$',
69
+ "name: $ExpectedName",
70
+ 1
71
+ )
72
+
73
+ $updatedContent = $match.Groups['prefix'].Value + '---' + $newline + $updatedFrontmatter + $newline + '---' + $match.Groups['suffix'].Value
74
+ Write-Utf8NoBomFile -Path $SkillFilePath -Content $updatedContent
75
+ }
76
+
77
+ $toolkitRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
78
+ $skillsSource = Join-Path $toolkitRoot 'skills'
79
+ if (-not (Test-Path -LiteralPath $skillsSource)) {
80
+ throw "Missing toolkit skills source directory: $skillsSource"
81
+ }
82
+
83
+ $managedSkills = @(Get-ChildItem -LiteralPath $skillsSource -Directory | Sort-Object Name)
84
+ if ($managedSkills.Count -ne 12) {
85
+ throw "Expected 12 managed SDTK-CODE skills but found $($managedSkills.Count)."
86
+ }
87
+
88
+ $codexHome = Resolve-CodexHome -TargetScope $Scope -TargetProjectPath $ProjectPath
89
+ $skillsDest = Join-Path $codexHome 'skills'
90
+ New-Item -ItemType Directory -Force -Path $skillsDest | Out-Null
91
+
92
+ $copied = 0
93
+ $skipped = 0
94
+ foreach ($skillDir in $managedSkills) {
95
+ $skillFile = Join-Path $skillDir.FullName 'SKILL.md'
96
+ if (-not (Test-Path -LiteralPath $skillFile)) {
97
+ throw "Managed skill is missing SKILL.md: $($skillDir.FullName)"
98
+ }
99
+
100
+ $destName = "sdtk-$($skillDir.Name)"
101
+ $destDir = Join-Path $skillsDest $destName
102
+ if (Test-Path -LiteralPath $destDir) {
103
+ if (-not $Force) {
104
+ $skipped++
105
+ if (-not $Quiet) {
106
+ Write-Warning "Skill already installed (skipping). Use -Force to overwrite: $destName"
107
+ }
108
+ continue
109
+ }
110
+ Remove-Item -LiteralPath $destDir -Recurse -Force
111
+ }
112
+
113
+ Copy-Item -LiteralPath $skillDir.FullName -Destination $destDir -Recurse -Force
114
+ try {
115
+ Rewrite-SkillFrontmatterName -SkillFilePath (Join-Path $destDir 'SKILL.md') -ExpectedName $destName
116
+ } catch {
117
+ if (Test-Path -LiteralPath $destDir) {
118
+ Remove-Item -LiteralPath $destDir -Recurse -Force
119
+ }
120
+ throw
121
+ }
122
+
123
+ $copied++
124
+ if (-not $Quiet) {
125
+ Write-Host "Installed: $destName"
126
+ }
127
+ }
128
+
129
+ $expectedNames = $managedSkills.Name | ForEach-Object { "sdtk-$_" }
130
+ $installedNow = @(
131
+ Get-ChildItem -LiteralPath $skillsDest -Directory -ErrorAction SilentlyContinue |
132
+ Where-Object { $expectedNames -contains $_.Name } |
133
+ Select-Object -ExpandProperty Name
134
+ )
135
+ if ($installedNow.Count -ne 12) {
136
+ throw "Codex skill install incomplete. Expected 12 managed skills at $skillsDest but found $($installedNow.Count)."
137
+ }
138
+
139
+ if (-not $Quiet) {
140
+ Write-Host ""
141
+ Write-Host "Install summary:"
142
+ Write-Host "- Scope: $Scope"
143
+ Write-Host "- Destination: $skillsDest"
144
+ Write-Host "- Copied: $copied"
145
+ Write-Host "- Skipped: $skipped"
146
+ if ($Scope -eq 'project') {
147
+ Write-Host "- Project-local Codex support requires launching Codex with CODEX_HOME=<project>/.codex."
148
+ Write-Host "- Native .codex/skills auto-discovery is not claimed."
149
+ }
150
+ }
@@ -1,62 +1,62 @@
1
- param(
2
- [string]$ProjectPath,
3
- [ValidateSet('project', 'user')]
4
- [string]$Scope = 'project',
5
- [switch]$All,
6
- [switch]$Quiet
7
- )
8
-
9
- $ErrorActionPreference = 'Stop'
10
- Set-StrictMode -Version Latest
11
-
12
- $toolkitRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
13
- $skillsSource = Join-Path $toolkitRoot 'skills'
14
- if (-not (Test-Path -LiteralPath $skillsSource)) {
15
- throw "Missing toolkit skills source directory: $skillsSource"
16
- }
17
-
18
- $managedSkillNames = @(
19
- Get-ChildItem -LiteralPath $skillsSource -Directory | Sort-Object Name | Select-Object -ExpandProperty Name
20
- )
21
- if ($managedSkillNames.Count -ne 12) {
22
- throw "Expected 12 managed SDTK-CODE skills but found $($managedSkillNames.Count)."
23
- }
24
-
25
- if ($Scope -eq 'user') {
26
- $skillsDest = Join-Path $HOME '.claude/skills'
27
- } else {
28
- if (-not $ProjectPath) {
29
- throw "ProjectPath is required for Claude project scope uninstall."
30
- }
31
- $projectRoot = (Resolve-Path -LiteralPath $ProjectPath).Path
32
- $skillsDest = Join-Path $projectRoot '.claude/skills'
33
- }
34
-
35
- if (-not (Test-Path -LiteralPath $skillsDest)) {
36
- if (-not $Quiet) {
37
- Write-Host "Claude skills directory not found: $skillsDest"
38
- }
39
- exit 0
40
- }
41
-
42
- $removed = New-Object System.Collections.Generic.List[string]
43
- $missing = New-Object System.Collections.Generic.List[string]
44
- foreach ($name in $managedSkillNames) {
45
- $dest = Join-Path $skillsDest $name
46
- if (-not (Test-Path -LiteralPath $dest)) {
47
- $missing.Add($name) | Out-Null
48
- continue
49
- }
50
-
51
- Remove-Item -LiteralPath $dest -Recurse -Force
52
- $removed.Add($name) | Out-Null
53
- }
54
-
55
- if (-not $Quiet) {
56
- Write-Host ""
57
- Write-Host "Uninstall summary:"
58
- Write-Host "- Scope: $Scope"
59
- Write-Host "- Destination: $skillsDest"
60
- Write-Host "- Removed: $($removed.Count)"
61
- Write-Host "- Missing/Skipped: $($missing.Count)"
62
- }
1
+ param(
2
+ [string]$ProjectPath,
3
+ [ValidateSet('project', 'user')]
4
+ [string]$Scope = 'project',
5
+ [switch]$All,
6
+ [switch]$Quiet
7
+ )
8
+
9
+ $ErrorActionPreference = 'Stop'
10
+ Set-StrictMode -Version Latest
11
+
12
+ $toolkitRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
13
+ $skillsSource = Join-Path $toolkitRoot 'skills'
14
+ if (-not (Test-Path -LiteralPath $skillsSource)) {
15
+ throw "Missing toolkit skills source directory: $skillsSource"
16
+ }
17
+
18
+ $managedSkillNames = @(
19
+ Get-ChildItem -LiteralPath $skillsSource -Directory | Sort-Object Name | Select-Object -ExpandProperty Name
20
+ )
21
+ if ($managedSkillNames.Count -ne 12) {
22
+ throw "Expected 12 managed SDTK-CODE skills but found $($managedSkillNames.Count)."
23
+ }
24
+
25
+ if ($Scope -eq 'user') {
26
+ $skillsDest = Join-Path $HOME '.claude/skills'
27
+ } else {
28
+ if (-not $ProjectPath) {
29
+ throw "ProjectPath is required for Claude project scope uninstall."
30
+ }
31
+ $projectRoot = (Resolve-Path -LiteralPath $ProjectPath).Path
32
+ $skillsDest = Join-Path $projectRoot '.claude/skills'
33
+ }
34
+
35
+ if (-not (Test-Path -LiteralPath $skillsDest)) {
36
+ if (-not $Quiet) {
37
+ Write-Host "Claude skills directory not found: $skillsDest"
38
+ }
39
+ exit 0
40
+ }
41
+
42
+ $removed = New-Object System.Collections.Generic.List[string]
43
+ $missing = New-Object System.Collections.Generic.List[string]
44
+ foreach ($name in $managedSkillNames) {
45
+ $dest = Join-Path $skillsDest $name
46
+ if (-not (Test-Path -LiteralPath $dest)) {
47
+ $missing.Add($name) | Out-Null
48
+ continue
49
+ }
50
+
51
+ Remove-Item -LiteralPath $dest -Recurse -Force
52
+ $removed.Add($name) | Out-Null
53
+ }
54
+
55
+ if (-not $Quiet) {
56
+ Write-Host ""
57
+ Write-Host "Uninstall summary:"
58
+ Write-Host "- Scope: $Scope"
59
+ Write-Host "- Destination: $skillsDest"
60
+ Write-Host "- Removed: $($removed.Count)"
61
+ Write-Host "- Missing/Skipped: $($missing.Count)"
62
+ }
@@ -1,82 +1,82 @@
1
- param(
2
- [ValidateSet('project', 'user')]
3
- [string]$Scope = 'user',
4
- [string]$ProjectPath,
5
- [switch]$All,
6
- [switch]$Quiet
7
- )
8
-
9
- $ErrorActionPreference = 'Stop'
10
- Set-StrictMode -Version Latest
11
-
12
- function Resolve-CodexHome {
13
- param(
14
- [Parameter(Mandatory = $true)][string]$TargetScope,
15
- [string]$TargetProjectPath
16
- )
17
-
18
- if ($TargetScope -eq 'project') {
19
- if (-not $TargetProjectPath -or $TargetProjectPath.Trim().Length -eq 0) {
20
- throw "Project-local Codex uninstall requires -ProjectPath."
21
- }
22
- if (-not (Test-Path -LiteralPath $TargetProjectPath)) {
23
- New-Item -ItemType Directory -Force -Path $TargetProjectPath | Out-Null
24
- }
25
- $projectRoot = (Resolve-Path -LiteralPath $TargetProjectPath).Path
26
- return (Join-Path $projectRoot '.codex')
27
- }
28
-
29
- if ($env:CODEX_HOME) {
30
- return $env:CODEX_HOME
31
- }
32
- return (Join-Path $HOME '.codex')
33
- }
34
-
35
- $toolkitRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
36
- $skillsSource = Join-Path $toolkitRoot 'skills'
37
- if (-not (Test-Path -LiteralPath $skillsSource)) {
38
- throw "Missing toolkit skills source directory: $skillsSource"
39
- }
40
-
41
- $managedSkillNames = @(
42
- Get-ChildItem -LiteralPath $skillsSource -Directory |
43
- Sort-Object Name |
44
- ForEach-Object { "sdtk-$($_.Name)" }
45
- )
46
- if ($managedSkillNames.Count -ne 12) {
47
- throw "Expected 12 managed SDTK-CODE skills but found $($managedSkillNames.Count)."
48
- }
49
-
50
- $codexHome = Resolve-CodexHome -TargetScope $Scope -TargetProjectPath $ProjectPath
51
- $skillsDest = Join-Path $codexHome 'skills'
52
- if (-not (Test-Path -LiteralPath $skillsDest)) {
53
- if (-not $Quiet) {
54
- Write-Host "Codex skills directory not found: $skillsDest"
55
- }
56
- exit 0
57
- }
58
-
59
- $removed = New-Object System.Collections.Generic.List[string]
60
- $missing = New-Object System.Collections.Generic.List[string]
61
- foreach ($name in $managedSkillNames) {
62
- $dest = Join-Path $skillsDest $name
63
- if (-not (Test-Path -LiteralPath $dest)) {
64
- $missing.Add($name) | Out-Null
65
- continue
66
- }
67
-
68
- Remove-Item -LiteralPath $dest -Recurse -Force
69
- $removed.Add($name) | Out-Null
70
- }
71
-
72
- if (-not $Quiet) {
73
- Write-Host ""
74
- Write-Host "Uninstall summary:"
75
- Write-Host "- Scope: $Scope"
76
- Write-Host "- Destination: $skillsDest"
77
- Write-Host "- Removed: $($removed.Count)"
78
- Write-Host "- Missing/Skipped: $($missing.Count)"
79
- if ($Scope -eq 'project') {
80
- Write-Host "- Project-local Codex uninstall touched only SDTK-CODE-managed assets under <project>/.codex/skills."
81
- }
82
- }
1
+ param(
2
+ [ValidateSet('project', 'user')]
3
+ [string]$Scope = 'user',
4
+ [string]$ProjectPath,
5
+ [switch]$All,
6
+ [switch]$Quiet
7
+ )
8
+
9
+ $ErrorActionPreference = 'Stop'
10
+ Set-StrictMode -Version Latest
11
+
12
+ function Resolve-CodexHome {
13
+ param(
14
+ [Parameter(Mandatory = $true)][string]$TargetScope,
15
+ [string]$TargetProjectPath
16
+ )
17
+
18
+ if ($TargetScope -eq 'project') {
19
+ if (-not $TargetProjectPath -or $TargetProjectPath.Trim().Length -eq 0) {
20
+ throw "Project-local Codex uninstall requires -ProjectPath."
21
+ }
22
+ if (-not (Test-Path -LiteralPath $TargetProjectPath)) {
23
+ New-Item -ItemType Directory -Force -Path $TargetProjectPath | Out-Null
24
+ }
25
+ $projectRoot = (Resolve-Path -LiteralPath $TargetProjectPath).Path
26
+ return (Join-Path $projectRoot '.codex')
27
+ }
28
+
29
+ if ($env:CODEX_HOME) {
30
+ return $env:CODEX_HOME
31
+ }
32
+ return (Join-Path $HOME '.codex')
33
+ }
34
+
35
+ $toolkitRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
36
+ $skillsSource = Join-Path $toolkitRoot 'skills'
37
+ if (-not (Test-Path -LiteralPath $skillsSource)) {
38
+ throw "Missing toolkit skills source directory: $skillsSource"
39
+ }
40
+
41
+ $managedSkillNames = @(
42
+ Get-ChildItem -LiteralPath $skillsSource -Directory |
43
+ Sort-Object Name |
44
+ ForEach-Object { "sdtk-$($_.Name)" }
45
+ )
46
+ if ($managedSkillNames.Count -ne 12) {
47
+ throw "Expected 12 managed SDTK-CODE skills but found $($managedSkillNames.Count)."
48
+ }
49
+
50
+ $codexHome = Resolve-CodexHome -TargetScope $Scope -TargetProjectPath $ProjectPath
51
+ $skillsDest = Join-Path $codexHome 'skills'
52
+ if (-not (Test-Path -LiteralPath $skillsDest)) {
53
+ if (-not $Quiet) {
54
+ Write-Host "Codex skills directory not found: $skillsDest"
55
+ }
56
+ exit 0
57
+ }
58
+
59
+ $removed = New-Object System.Collections.Generic.List[string]
60
+ $missing = New-Object System.Collections.Generic.List[string]
61
+ foreach ($name in $managedSkillNames) {
62
+ $dest = Join-Path $skillsDest $name
63
+ if (-not (Test-Path -LiteralPath $dest)) {
64
+ $missing.Add($name) | Out-Null
65
+ continue
66
+ }
67
+
68
+ Remove-Item -LiteralPath $dest -Recurse -Force
69
+ $removed.Add($name) | Out-Null
70
+ }
71
+
72
+ if (-not $Quiet) {
73
+ Write-Host ""
74
+ Write-Host "Uninstall summary:"
75
+ Write-Host "- Scope: $Scope"
76
+ Write-Host "- Destination: $skillsDest"
77
+ Write-Host "- Removed: $($removed.Count)"
78
+ Write-Host "- Missing/Skipped: $($missing.Count)"
79
+ if ($Scope -eq 'project') {
80
+ Write-Host "- Project-local Codex uninstall touched only SDTK-CODE-managed assets under <project>/.codex/skills."
81
+ }
82
+ }
@@ -1,6 +1,6 @@
1
- {
2
- "toolkit": "SDTK-CODE",
3
- "version": "0.1.3",
4
- "skills_path": "toolkit/skills",
5
- "skill_prefix": "code-"
6
- }
1
+ {
2
+ "toolkit": "SDTK-CODE",
3
+ "version": "0.1.3",
4
+ "skills_path": "toolkit/skills",
5
+ "skill_prefix": "code-"
6
+ }
@@ -1,12 +1,12 @@
1
- {
2
- "$comment": "SCAFFOLD: Example profiles config for SDTKCODE. Copy to sdtk-spec.config.profiles.json and customize.",
3
- "profiles": {
4
- "default": {
5
- "stack": {
6
- "backend": "UPDATE_ME",
7
- "frontend": "UPDATE_ME",
8
- "database": "UPDATE_ME"
9
- }
10
- }
11
- }
12
- }
1
+ {
2
+ "$comment": "SCAFFOLD: Example profiles config for SDTKCODE. Copy to sdtk-spec.config.profiles.json and customize.",
3
+ "profiles": {
4
+ "default": {
5
+ "stack": {
6
+ "backend": "UPDATE_ME",
7
+ "frontend": "UPDATE_ME",
8
+ "database": "UPDATE_ME"
9
+ }
10
+ }
11
+ }
12
+ }