openspec-zcode/install.sh
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

53 lines
1.6 KiB
Bash

#!/usr/bin/env bash
# install.sh — install OpenSpec skills + /opsx commands into ZCode user directory.
# Works on Linux, macOS, and Git Bash on Windows. Idempotent: safe to re-run.
set -euo pipefail
# Resolve repo root (directory of this script).
SRC="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Target ZCode home (override with ZCODE_HOME if needed).
DEST="${ZCODE_HOME:-$HOME/.zcode}"
SKILLS_SRC="$SRC/skills"
COMMANDS_SRC="$SRC/commands/opsx"
SKILLS_DEST="$DEST/skills"
COMMANDS_DEST="$DEST/commands/opsx"
# Sanity checks.
if [ ! -d "$SKILLS_SRC" ]; then
echo "✗ Source skills directory not found at: $SKILLS_SRC" >&2
exit 1
fi
if [ ! -d "$COMMANDS_SRC" ]; then
echo "✗ Source commands directory not found at: $COMMANDS_SRC" >&2
exit 1
fi
# Create destination dirs.
mkdir -p "$SKILLS_DEST" "$COMMANDS_DEST"
# Copy each openspec-* skill directory, replacing if it already exists.
skill_count=0
for skill_dir in "$SKILLS_SRC"/openspec-*; do
[ -d "$skill_dir" ] || continue
name="$(basename "$skill_dir")"
rm -rf "$SKILLS_DEST/$name"
cp -r "$skill_dir" "$SKILLS_DEST/$name"
skill_count=$((skill_count + 1))
done
# Copy each /opsx command file.
cmd_count=0
for cmd_file in "$COMMANDS_SRC"/*.md; do
[ -f "$cmd_file" ] || continue
cp -f "$cmd_file" "$COMMANDS_DEST/"
cmd_count=$((cmd_count + 1))
done
echo "✓ Installed $skill_count skills + $cmd_count commands to $DEST"
echo " Skills: $SKILLS_DEST/openspec-*/SKILL.md"
echo " Commands: $COMMANDS_DEST/*.md → /opsx:<name>"
echo ""
echo "Restart ZCode (or start a new session) to pick up the new skills and commands."