34 lines
1.2 KiB
PowerShell
34 lines
1.2 KiB
PowerShell
|
|
# uninstall.ps1 — remove OpenSpec skills + /opsx commands from ZCode user directory.
|
||
|
|
[CmdletBinding()]
|
||
|
|
param(
|
||
|
|
[string]$ZCodeHome = (Join-Path $env:USERPROFILE ".zcode")
|
||
|
|
)
|
||
|
|
|
||
|
|
$ErrorActionPreference = "Stop"
|
||
|
|
|
||
|
|
$SkillsDest = Join-Path $ZCodeHome "skills"
|
||
|
|
$CommandsDest = Join-Path $ZCodeHome "commands\opsx"
|
||
|
|
|
||
|
|
$removedSkills = 0
|
||
|
|
if (Test-Path -LiteralPath $SkillsDest) {
|
||
|
|
Get-ChildItem -LiteralPath $SkillsDest -Directory -Filter "openspec-*" -ErrorAction SilentlyContinue | ForEach-Object {
|
||
|
|
Remove-Item -LiteralPath $_.FullName -Recurse -Force
|
||
|
|
$removedSkills++
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
$removedCmds = 0
|
||
|
|
if (Test-Path -LiteralPath $CommandsDest) {
|
||
|
|
Get-ChildItem -LiteralPath $CommandsDest -Filter "*.md" -File -ErrorAction SilentlyContinue | ForEach-Object {
|
||
|
|
Remove-Item -LiteralPath $_.FullName -Force
|
||
|
|
$removedCmds++
|
||
|
|
}
|
||
|
|
# Remove empty opsx commands dir if nothing is left.
|
||
|
|
if (-not (Get-ChildItem -LiteralPath $CommandsDest -Force -ErrorAction SilentlyContinue)) {
|
||
|
|
Remove-Item -LiteralPath $CommandsDest -Force -ErrorAction SilentlyContinue
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
Write-Host "✓ Removed $removedSkills skills + $removedCmds commands from $ZCodeHome"
|
||
|
|
Write-Host "Restart ZCode for the change to take effect."
|