# install.ps1 — install OpenSpec skills + /opsx commands into ZCode user directory. # Native Windows PowerShell. Idempotent: safe to re-run. [CmdletBinding()] param( [string]$ZCodeHome = (Join-Path $env:USERPROFILE ".zcode") ) $ErrorActionPreference = "Stop" # Resolve repo root (directory of this script). $Src = $PSScriptRoot if (-not $Src) { $Src = Split-Path -Parent $MyInvocation.MyCommand.Path } $SkillsSrc = Join-Path $Src "skills" $CommandsSrc = Join-Path $Src "commands\opsx" $SkillsDest = Join-Path $ZCodeHome "skills" $CommandsDest = Join-Path $ZCodeHome "commands\opsx" # Sanity checks. if (-not (Test-Path -LiteralPath $SkillsSrc)) { Write-Error "Source skills directory not found at: $SkillsSrc" exit 1 } if (-not (Test-Path -LiteralPath $CommandsSrc)) { Write-Error "Source commands directory not found at: $CommandsSrc" exit 1 } # Create destination dirs. New-Item -ItemType Directory -Force -Path $SkillsDest | Out-Null New-Item -ItemType Directory -Force -Path $CommandsDest | Out-Null # Copy each openspec-* skill directory, replacing if it already exists. $skillCount = 0 Get-ChildItem -LiteralPath $SkillsSrc -Directory -Filter "openspec-*" | ForEach-Object { $name = $_.Name $target = Join-Path $SkillsDest $name if (Test-Path -LiteralPath $target) { Remove-Item -LiteralPath $target -Recurse -Force } Copy-Item -LiteralPath $_.FullName -Destination $target -Recurse -Force $skillCount++ } # Copy each /opsx command file. $cmdCount = 0 Get-ChildItem -LiteralPath $CommandsSrc -Filter "*.md" -File | ForEach-Object { Copy-Item -LiteralPath $_.FullName -Destination $CommandsDest -Force $cmdCount++ } Write-Host "✓ Installed $skillCount skills + $cmdCount commands to $ZCodeHome" Write-Host " Skills: $SkillsDest\openspec-*\SKILL.md" Write-Host " Commands: $CommandsDest\*.md → /opsx:" Write-Host "" Write-Host "Restart ZCode (or start a new session) to pick up the new skills and commands."