An agentic skills framework & software development methodology that works.
fix(opencode): align skills path across bootstrap, runtime, and tests
Jesse Vincent2d942f3b01cc
diff --git a/.opencode/plugins/superpowers.js b/.opencode/plugins/superpowers.jsindex 5e7833b62..76b235771 100644--- a/.opencode/plugins/superpowers.js+++ b/.opencode/plugins/superpowers.js@@ -68,8 +68,6 @@ When skills reference tools you don't have, substitute OpenCode equivalents:- \`Skill\` tool → OpenCode's native \`skill\` tool- \`Read\`, \`Write\`, \`Edit\`, \`Bash\` → Your native tools-**Skills location:**-Superpowers skills are in \`${configDir}/skills/superpowers/\`Use OpenCode's native \`skill\` tool to list and load skills.`;return `<EXTREMELY_IMPORTANT>diff --git a/tests/opencode/setup.sh b/tests/opencode/setup.shindex 0defde2f0..cd2a732cd 100755--- a/tests/opencode/setup.sh+++ b/tests/opencode/setup.sh@@ -7,30 +7,39 @@ set -euo pipefailREPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"# Create temp home directory for isolation-export TEST_HOME=$(mktemp -d)+export TEST_HOME+TEST_HOME=$(mktemp -d)export HOME="$TEST_HOME"export XDG_CONFIG_HOME="$TEST_HOME/.config"export OPENCODE_CONFIG_DIR="$TEST_HOME/.config/opencode"-# Install plugin to test location-mkdir -p "$HOME/.config/opencode/superpowers"-cp -r "$REPO_ROOT/lib" "$HOME/.config/opencode/superpowers/"-cp -r "$REPO_ROOT/skills" "$HOME/.config/opencode/superpowers/"+# Standard install layout:+# $OPENCODE_CONFIG_DIR/superpowers/ ← package root+# $OPENCODE_CONFIG_DIR/superpowers/skills/ ← skills dir (../../skills from plugin)+# $OPENCODE_CONFIG_DIR/superpowers/.opencode/plugins/superpowers.js ← plugin file+# $OPENCODE_CONFIG_DIR/plugins/superpowers.js ← symlink OpenCode reads-# Copy plugin directory-mkdir -p "$HOME/.config/opencode/superpowers/.opencode/plugins"-cp "$REPO_ROOT/.opencode/plugins/superpowers.js" "$HOME/.config/opencode/superpowers/.opencode/plugins/"+SUPERPOWERS_DIR="$OPENCODE_CONFIG_DIR/superpowers"+SUPERPOWERS_SKILLS_DIR="$SUPERPOWERS_DIR/skills"+SUPERPOWERS_PLUGIN_FILE="$SUPERPOWERS_DIR/.opencode/plugins/superpowers.js"-# Register plugin via symlink-mkdir -p "$HOME/.config/opencode/plugins"-ln -sf "$HOME/.config/opencode/superpowers/.opencode/plugins/superpowers.js" \- "$HOME/.config/opencode/plugins/superpowers.js"+# Install skills+mkdir -p "$SUPERPOWERS_DIR"+cp -r "$REPO_ROOT/skills" "$SUPERPOWERS_DIR/"++# Install plugin+mkdir -p "$(dirname "$SUPERPOWERS_PLUGIN_FILE")"+cp "$REPO_ROOT/.opencode/plugins/superpowers.js" "$SUPERPOWERS_PLUGIN_FILE"++# Register plugin via symlink (what OpenCode actually reads)+mkdir -p "$OPENCODE_CONFIG_DIR/plugins"+ln -sf "$SUPERPOWERS_PLUGIN_FILE" "$OPENCODE_CONFIG_DIR/plugins/superpowers.js"# Create test skills in different locations for testing# Personal test skill-mkdir -p "$HOME/.config/opencode/skills/personal-test"-cat > "$HOME/.config/opencode/skills/personal-test/SKILL.md" <<'EOF'+mkdir -p "$OPENCODE_CONFIG_DIR/skills/personal-test"+cat > "$OPENCODE_CONFIG_DIR/skills/personal-test/SKILL.md" <<'EOF'---name: personal-testdescription: Test personal skill for verification@@ -57,9 +66,12 @@ PROJECT_SKILL_MARKER_67890EOFecho "Setup complete: $TEST_HOME"-echo "Plugin installed to: $HOME/.config/opencode/superpowers/.opencode/plugins/superpowers.js"-echo "Plugin registered at: $HOME/.config/opencode/plugins/superpowers.js"-echo "Test project at: $TEST_HOME/test-project"+echo "OPENCODE_CONFIG_DIR: $OPENCODE_CONFIG_DIR"+echo "Superpowers dir: $SUPERPOWERS_DIR"+echo "Skills dir: $SUPERPOWERS_SKILLS_DIR"+echo "Plugin file: $SUPERPOWERS_PLUGIN_FILE"+echo "Plugin registered at: $OPENCODE_CONFIG_DIR/plugins/superpowers.js"+echo "Test project at: $TEST_HOME/test-project"# Helper function for cleanup (call from tests or trap)cleanup_test_env() {@@ -71,3 +83,6 @@ cleanup_test_env() {# Export for use in testsexport -f cleanup_test_envexport REPO_ROOT+export SUPERPOWERS_DIR+export SUPERPOWERS_SKILLS_DIR+export SUPERPOWERS_PLUGIN_FILEdiff --git a/tests/opencode/test-plugin-loading.sh b/tests/opencode/test-plugin-loading.shindex 008cf5c10..83af3f197 100755--- a/tests/opencode/test-plugin-loading.sh+++ b/tests/opencode/test-plugin-loading.sh@@ -13,17 +13,19 @@ source "$SCRIPT_DIR/setup.sh"# Trap to cleanup on exittrap cleanup_test_env EXIT+plugin_link="$OPENCODE_CONFIG_DIR/plugins/superpowers.js"+# Test 1: Verify plugin file exists and is registeredecho "Test 1: Checking plugin registration..."-if [ -L "$HOME/.config/opencode/plugins/superpowers.js" ]; then+if [ -L "$plugin_link" ]; thenecho " [PASS] Plugin symlink exists"else- echo " [FAIL] Plugin symlink not found at $HOME/.config/opencode/plugins/superpowers.js"+ echo " [FAIL] Plugin symlink not found at $plugin_link"exit 1fi# Verify symlink target exists-if [ -f "$(readlink -f "$HOME/.config/opencode/plugins/superpowers.js")" ]; then+if [ -f "$(readlink -f "$plugin_link")" ]; thenecho " [PASS] Plugin symlink target exists"elseecho " [FAIL] Plugin symlink target does not exist"@@ -32,36 +34,44 @@ fi# Test 2: Verify skills directory is populatedecho "Test 2: Checking skills directory..."-skill_count=$(find "$HOME/.config/opencode/superpowers/skills" -name "SKILL.md" | wc -l)+skill_count=$(find "$SUPERPOWERS_SKILLS_DIR" -name "SKILL.md" | wc -l)if [ "$skill_count" -gt 0 ]; then- echo " [PASS] Found $skill_count skills installed"+ echo " [PASS] Found $skill_count skills"else- echo " [FAIL] No skills found in installed location"+ echo " [FAIL] No skills found in $SUPERPOWERS_SKILLS_DIR"exit 1fi-# Test 4: Check using-superpowers skill exists (critical for bootstrap)-echo "Test 4: Checking using-superpowers skill (required for bootstrap)..."-if [ -f "$HOME/.config/opencode/superpowers/skills/using-superpowers/SKILL.md" ]; then+# Test 3: Check using-superpowers skill exists (critical for bootstrap)+echo "Test 3: Checking using-superpowers skill (required for bootstrap)..."+if [ -f "$SUPERPOWERS_SKILLS_DIR/using-superpowers/SKILL.md" ]; thenecho " [PASS] using-superpowers skill exists"elseecho " [FAIL] using-superpowers skill not found (required for bootstrap)"exit 1fi-# Test 5: Verify plugin JavaScript syntax (basic check)-echo "Test 5: Checking plugin JavaScript syntax..."-plugin_file="$HOME/.config/opencode/superpowers/.opencode/plugins/superpowers.js"-if node --check "$plugin_file" 2>/dev/null; then+# Test 4: Verify plugin JavaScript syntax (basic check)+echo "Test 4: Checking plugin JavaScript syntax..."+if node --check "$SUPERPOWERS_PLUGIN_FILE" 2>/dev/null; thenecho " [PASS] Plugin JavaScript syntax is valid"elseecho " [FAIL] Plugin has JavaScript syntax errors"exit 1fi+# Test 5: Verify bootstrap text does not reference a hardcoded skills path+echo "Test 5: Checking bootstrap does not advertise a wrong skills path..."+if grep -q 'configDir}/skills/superpowers/' "$SUPERPOWERS_PLUGIN_FILE"; then+ echo " [FAIL] Plugin still references old configDir skills path"+ exit 1+else+ echo " [PASS] Plugin does not advertise a misleading skills path"+fi+# Test 6: Verify personal test skill was createdecho "Test 6: Checking test fixtures..."-if [ -f "$HOME/.config/opencode/skills/personal-test/SKILL.md" ]; then+if [ -f "$OPENCODE_CONFIG_DIR/skills/personal-test/SKILL.md" ]; thenecho " [PASS] Personal test skill fixture created"elseecho " [FAIL] Personal test skill fixture not found"diff --git a/tests/opencode/test-priority.sh b/tests/opencode/test-priority.shindex 1c36fa33f..b7de0d614 100755--- a/tests/opencode/test-priority.sh+++ b/tests/opencode/test-priority.sh@@ -18,8 +18,8 @@ trap cleanup_test_env EXITecho "Setting up priority test fixtures..."# 1. Create in superpowers location (lowest priority)-mkdir -p "$HOME/.config/opencode/superpowers/skills/priority-test"-cat > "$HOME/.config/opencode/superpowers/skills/priority-test/SKILL.md" <<'EOF'+mkdir -p "$SUPERPOWERS_SKILLS_DIR/priority-test"+cat > "$SUPERPOWERS_SKILLS_DIR/priority-test/SKILL.md" <<'EOF'---name: priority-testdescription: Superpowers version of priority test skill@@ -32,8 +32,8 @@ PRIORITY_MARKER_SUPERPOWERS_VERSIONEOF# 2. Create in personal location (medium priority)-mkdir -p "$HOME/.config/opencode/skills/priority-test"-cat > "$HOME/.config/opencode/skills/priority-test/SKILL.md" <<'EOF'+mkdir -p "$OPENCODE_CONFIG_DIR/skills/priority-test"+cat > "$OPENCODE_CONFIG_DIR/skills/priority-test/SKILL.md" <<'EOF'---name: priority-testdescription: Personal version of priority test skill@@ -65,14 +65,14 @@ echo " Created priority-test skill in all three locations"echo ""echo "Test 1: Verifying test fixtures..."-if [ -f "$HOME/.config/opencode/superpowers/skills/priority-test/SKILL.md" ]; then+if [ -f "$SUPERPOWERS_SKILLS_DIR/priority-test/SKILL.md" ]; thenecho " [PASS] Superpowers version exists"elseecho " [FAIL] Superpowers version missing"exit 1fi-if [ -f "$HOME/.config/opencode/skills/priority-test/SKILL.md" ]; then+if [ -f "$OPENCODE_CONFIG_DIR/skills/priority-test/SKILL.md" ]; thenecho " [PASS] Personal version exists"elseecho " [FAIL] Personal version missing"