openspec-zcode/install.ps1
keboss-m 163483eb50 feat: initial OpenSpec skills + /opsx commands for ZCode
Port of @fission-ai/openspec@1.4.1 workflow templates into ZCode-native
skills and slash commands.

- 11 skills (skills/openspec-*/SKILL.md): auto-trigger + /skill force-load
- 11 commands (commands/opsx/*.md): /opsx:explore, /opsx:propose, /opsx:apply,
  /opsx:sync, /opsx:archive, /opsx:new, /opsx:continue, /opsx:ff, /opsx:verify,
  /opsx:bulk-archive, /opsx:onboard
- install.sh / install.ps1 (idempotent, copies to ~/.zcode/)
- uninstall.sh / uninstall.ps1
- README.md with command table, install/update/uninstall, upstream mapping

Skill instruction text is ported verbatim from the upstream
get…SkillTemplate().instructions fields, with three ZCode adaptations:
1. /opsx:<cmd> cross-refs inside skill bodies → /skill openspec-<name>
2. Task tool → Agent tool (one occurrence in openspec-archive-change)
3. Source-version comment header in each SKILL.md
2026-07-06 15:36:43 +03:00

55 lines
1.9 KiB
PowerShell

# 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:<name>"
Write-Host ""
Write-Host "Restart ZCode (or start a new session) to pick up the new skills and commands."