diff options
| author | Jesse Vincent <jesse@fsck.com> | 2026-03-25 14:29:45 -0700 |
|---|---|---|
| committer | Jesse Vincent <jesse@fsck.com> | 2026-03-31 11:51:22 -0700 |
| commit | 2d942f3b01cc636e2ef9ebfc50f05925df8ed3f6 (patch) | |
| tree | 188fbf37cc3ecb6c5aa970379b57df60f50c49ce /tests/opencode/setup.sh | |
| parent | 8b1669269c51835168c98fd435a7af1e5f15ec12 (diff) | |
fix(opencode): align skills path across bootstrap, runtime, and tests
The bootstrap text advertised a configDir-based skills path that didn't
match the runtime path (resolved relative to the plugin file). Tests
used yet another hardcoded path and referenced a nonexistent lib/ dir.
- Remove misleading skills path from bootstrap text; the agent should
use the native skill tool, not read files by path
- Fix test setup to create a consistent layout matching the plugin's
../../skills resolution
- Export SUPERPOWERS_SKILLS_DIR from setup.sh so tests use a single
source of truth
- Add regression test that bootstrap doesn't advertise the old path
- Remove broken cp of nonexistent lib/ directory
Fixes #847
Diffstat (limited to 'tests/opencode/setup.sh')
| -rwxr-xr-x | tests/opencode/setup.sh | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/tests/opencode/setup.sh b/tests/opencode/setup.sh index 0defde2..cd2a732 100755 --- a/tests/opencode/setup.sh +++ b/tests/opencode/setup.sh @@ -7,30 +7,39 @@ set -euo pipefail REPO_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-test description: Test personal skill for verification @@ -57,9 +66,12 @@ PROJECT_SKILL_MARKER_67890 EOF echo "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 tests export -f cleanup_test_env export REPO_ROOT +export SUPERPOWERS_DIR +export SUPERPOWERS_SKILLS_DIR +export SUPERPOWERS_PLUGIN_FILE |
