workerssuper 5.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +20 -0
- package/.claude-plugin/plugin.json +13 -0
- package/.codex/INSTALL.md +67 -0
- package/.cursor-plugin/plugin.json +18 -0
- package/.gitattributes +18 -0
- package/.github/FUNDING.yml +3 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +52 -0
- package/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +34 -0
- package/.github/ISSUE_TEMPLATE/platform_support.md +23 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +87 -0
- package/.opencode/INSTALL.md +83 -0
- package/.opencode/plugins/superpowers.js +107 -0
- package/CHANGELOG.md +13 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/GEMINI.md +2 -0
- package/LICENSE +21 -0
- package/README.md +187 -0
- package/RELEASE-NOTES.md +1057 -0
- package/agents/code-reviewer.md +48 -0
- package/commands/brainstorm.md +5 -0
- package/commands/execute-plan.md +5 -0
- package/commands/write-plan.md +5 -0
- package/docs/README.codex.md +126 -0
- package/docs/README.opencode.md +130 -0
- package/docs/plans/2025-11-22-opencode-support-design.md +294 -0
- package/docs/plans/2025-11-22-opencode-support-implementation.md +1095 -0
- package/docs/plans/2025-11-28-skills-improvements-from-user-feedback.md +711 -0
- package/docs/plans/2026-01-17-visual-brainstorming.md +571 -0
- package/docs/superpowers/plans/2026-01-22-document-review-system.md +301 -0
- package/docs/superpowers/plans/2026-02-19-visual-brainstorming-refactor.md +523 -0
- package/docs/superpowers/plans/2026-03-11-zero-dep-brainstorm-server.md +479 -0
- package/docs/superpowers/specs/2026-01-22-document-review-system-design.md +136 -0
- package/docs/superpowers/specs/2026-02-19-visual-brainstorming-refactor-design.md +162 -0
- package/docs/superpowers/specs/2026-03-11-zero-dep-brainstorm-server-design.md +118 -0
- package/docs/testing.md +303 -0
- package/docs/windows/polyglot-hooks.md +212 -0
- package/gemini-extension.json +6 -0
- package/hooks/hooks-cursor.json +10 -0
- package/hooks/hooks.json +16 -0
- package/hooks/run-hook.cmd +46 -0
- package/hooks/session-start +57 -0
- package/package.json +5 -0
- package/skills/brainstorming/SKILL.md +164 -0
- package/skills/brainstorming/scripts/frame-template.html +214 -0
- package/skills/brainstorming/scripts/helper.js +88 -0
- package/skills/brainstorming/scripts/server.cjs +338 -0
- package/skills/brainstorming/scripts/start-server.sh +153 -0
- package/skills/brainstorming/scripts/stop-server.sh +55 -0
- package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/skills/brainstorming/visual-companion.md +286 -0
- package/skills/dispatching-parallel-agents/SKILL.md +182 -0
- package/skills/executing-plans/SKILL.md +70 -0
- package/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/skills/receiving-code-review/SKILL.md +213 -0
- package/skills/requesting-code-review/SKILL.md +105 -0
- package/skills/requesting-code-review/code-reviewer.md +146 -0
- package/skills/subagent-driven-development/SKILL.md +277 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
- package/skills/subagent-driven-development/implementer-prompt.md +113 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/skills/systematic-debugging/SKILL.md +296 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +63 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/systematic-debugging/test-academic.md +14 -0
- package/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/test-driven-development/SKILL.md +371 -0
- package/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/skills/using-git-worktrees/SKILL.md +218 -0
- package/skills/using-superpowers/SKILL.md +115 -0
- package/skills/using-superpowers/references/codex-tools.md +25 -0
- package/skills/using-superpowers/references/gemini-tools.md +33 -0
- package/skills/verification-before-completion/SKILL.md +139 -0
- package/skills/writing-plans/SKILL.md +145 -0
- package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/skills/writing-skills/SKILL.md +655 -0
- package/skills/writing-skills/anthropic-best-practices.md +1150 -0
- package/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/skills/writing-skills/graphviz-conventions.dot +172 -0
- package/skills/writing-skills/persuasion-principles.md +187 -0
- package/skills/writing-skills/render-graphs.js +168 -0
- package/skills/writing-skills/testing-skills-with-subagents.md +384 -0
- package/tests/brainstorm-server/package-lock.json +36 -0
- package/tests/brainstorm-server/package.json +10 -0
- package/tests/brainstorm-server/server.test.js +424 -0
- package/tests/brainstorm-server/windows-lifecycle.test.sh +351 -0
- package/tests/brainstorm-server/ws-protocol.test.js +392 -0
- package/tests/claude-code/README.md +158 -0
- package/tests/claude-code/analyze-token-usage.py +168 -0
- package/tests/claude-code/run-skill-tests.sh +187 -0
- package/tests/claude-code/test-document-review-system.sh +177 -0
- package/tests/claude-code/test-helpers.sh +202 -0
- package/tests/claude-code/test-subagent-driven-development-integration.sh +314 -0
- package/tests/claude-code/test-subagent-driven-development.sh +165 -0
- package/tests/explicit-skill-requests/prompts/action-oriented.txt +3 -0
- package/tests/explicit-skill-requests/prompts/after-planning-flow.txt +17 -0
- package/tests/explicit-skill-requests/prompts/claude-suggested-it.txt +11 -0
- package/tests/explicit-skill-requests/prompts/i-know-what-sdd-means.txt +8 -0
- package/tests/explicit-skill-requests/prompts/mid-conversation-execute-plan.txt +3 -0
- package/tests/explicit-skill-requests/prompts/please-use-brainstorming.txt +1 -0
- package/tests/explicit-skill-requests/prompts/skip-formalities.txt +3 -0
- package/tests/explicit-skill-requests/prompts/subagent-driven-development-please.txt +1 -0
- package/tests/explicit-skill-requests/prompts/use-systematic-debugging.txt +1 -0
- package/tests/explicit-skill-requests/run-all.sh +70 -0
- package/tests/explicit-skill-requests/run-claude-describes-sdd.sh +100 -0
- package/tests/explicit-skill-requests/run-extended-multiturn-test.sh +113 -0
- package/tests/explicit-skill-requests/run-haiku-test.sh +144 -0
- package/tests/explicit-skill-requests/run-multiturn-test.sh +143 -0
- package/tests/explicit-skill-requests/run-test.sh +136 -0
- package/tests/opencode/run-tests.sh +163 -0
- package/tests/opencode/setup.sh +73 -0
- package/tests/opencode/test-plugin-loading.sh +72 -0
- package/tests/opencode/test-priority.sh +198 -0
- package/tests/opencode/test-tools.sh +104 -0
- package/tests/skill-triggering/prompts/dispatching-parallel-agents.txt +8 -0
- package/tests/skill-triggering/prompts/executing-plans.txt +1 -0
- package/tests/skill-triggering/prompts/requesting-code-review.txt +3 -0
- package/tests/skill-triggering/prompts/systematic-debugging.txt +11 -0
- package/tests/skill-triggering/prompts/test-driven-development.txt +7 -0
- package/tests/skill-triggering/prompts/writing-plans.txt +10 -0
- package/tests/skill-triggering/run-all.sh +60 -0
- package/tests/skill-triggering/run-test.sh +88 -0
- package/tests/subagent-driven-dev/go-fractals/design.md +81 -0
- package/tests/subagent-driven-dev/go-fractals/plan.md +172 -0
- package/tests/subagent-driven-dev/go-fractals/scaffold.sh +45 -0
- package/tests/subagent-driven-dev/run-test.sh +106 -0
- package/tests/subagent-driven-dev/svelte-todo/design.md +70 -0
- package/tests/subagent-driven-dev/svelte-todo/plan.md +222 -0
- package/tests/subagent-driven-dev/svelte-todo/scaffold.sh +46 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Test explicit skill requests (user names a skill directly)
|
|
3
|
+
# Usage: ./run-test.sh <skill-name> <prompt-file>
|
|
4
|
+
#
|
|
5
|
+
# Tests whether Claude invokes a skill when the user explicitly requests it by name
|
|
6
|
+
# (without using the plugin namespace prefix)
|
|
7
|
+
#
|
|
8
|
+
# Uses isolated HOME to avoid user context interference
|
|
9
|
+
|
|
10
|
+
set -e
|
|
11
|
+
|
|
12
|
+
SKILL_NAME="$1"
|
|
13
|
+
PROMPT_FILE="$2"
|
|
14
|
+
MAX_TURNS="${3:-3}"
|
|
15
|
+
|
|
16
|
+
if [ -z "$SKILL_NAME" ] || [ -z "$PROMPT_FILE" ]; then
|
|
17
|
+
echo "Usage: $0 <skill-name> <prompt-file> [max-turns]"
|
|
18
|
+
echo "Example: $0 subagent-driven-development ./prompts/subagent-driven-development-please.txt"
|
|
19
|
+
exit 1
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
# Get the directory where this script lives
|
|
23
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
24
|
+
# Get the superpowers plugin root (two levels up)
|
|
25
|
+
PLUGIN_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
26
|
+
|
|
27
|
+
TIMESTAMP=$(date +%s)
|
|
28
|
+
OUTPUT_DIR="/tmp/superpowers-tests/${TIMESTAMP}/explicit-skill-requests/${SKILL_NAME}"
|
|
29
|
+
mkdir -p "$OUTPUT_DIR"
|
|
30
|
+
|
|
31
|
+
# Read prompt from file
|
|
32
|
+
PROMPT=$(cat "$PROMPT_FILE")
|
|
33
|
+
|
|
34
|
+
echo "=== Explicit Skill Request Test ==="
|
|
35
|
+
echo "Skill: $SKILL_NAME"
|
|
36
|
+
echo "Prompt file: $PROMPT_FILE"
|
|
37
|
+
echo "Max turns: $MAX_TURNS"
|
|
38
|
+
echo "Output dir: $OUTPUT_DIR"
|
|
39
|
+
echo ""
|
|
40
|
+
|
|
41
|
+
# Copy prompt for reference
|
|
42
|
+
cp "$PROMPT_FILE" "$OUTPUT_DIR/prompt.txt"
|
|
43
|
+
|
|
44
|
+
# Create a minimal project directory for the test
|
|
45
|
+
PROJECT_DIR="$OUTPUT_DIR/project"
|
|
46
|
+
mkdir -p "$PROJECT_DIR/docs/superpowers/plans"
|
|
47
|
+
|
|
48
|
+
# Create a dummy plan file for mid-conversation tests
|
|
49
|
+
cat > "$PROJECT_DIR/docs/superpowers/plans/auth-system.md" << 'EOF'
|
|
50
|
+
# Auth System Implementation Plan
|
|
51
|
+
|
|
52
|
+
## Task 1: Add User Model
|
|
53
|
+
Create user model with email and password fields.
|
|
54
|
+
|
|
55
|
+
## Task 2: Add Auth Routes
|
|
56
|
+
Create login and register endpoints.
|
|
57
|
+
|
|
58
|
+
## Task 3: Add JWT Middleware
|
|
59
|
+
Protect routes with JWT validation.
|
|
60
|
+
EOF
|
|
61
|
+
|
|
62
|
+
# Run Claude with isolated environment
|
|
63
|
+
LOG_FILE="$OUTPUT_DIR/claude-output.json"
|
|
64
|
+
cd "$PROJECT_DIR"
|
|
65
|
+
|
|
66
|
+
echo "Plugin dir: $PLUGIN_DIR"
|
|
67
|
+
echo "Running claude -p with explicit skill request..."
|
|
68
|
+
echo "Prompt: $PROMPT"
|
|
69
|
+
echo ""
|
|
70
|
+
|
|
71
|
+
timeout 300 claude -p "$PROMPT" \
|
|
72
|
+
--plugin-dir "$PLUGIN_DIR" \
|
|
73
|
+
--dangerously-skip-permissions \
|
|
74
|
+
--max-turns "$MAX_TURNS" \
|
|
75
|
+
--output-format stream-json \
|
|
76
|
+
> "$LOG_FILE" 2>&1 || true
|
|
77
|
+
|
|
78
|
+
echo ""
|
|
79
|
+
echo "=== Results ==="
|
|
80
|
+
|
|
81
|
+
# Check if skill was triggered (look for Skill tool invocation)
|
|
82
|
+
# Match either "skill":"skillname" or "skill":"namespace:skillname"
|
|
83
|
+
SKILL_PATTERN='"skill":"([^"]*:)?'"${SKILL_NAME}"'"'
|
|
84
|
+
if grep -q '"name":"Skill"' "$LOG_FILE" && grep -qE "$SKILL_PATTERN" "$LOG_FILE"; then
|
|
85
|
+
echo "PASS: Skill '$SKILL_NAME' was triggered"
|
|
86
|
+
TRIGGERED=true
|
|
87
|
+
else
|
|
88
|
+
echo "FAIL: Skill '$SKILL_NAME' was NOT triggered"
|
|
89
|
+
TRIGGERED=false
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
# Show what skills WERE triggered
|
|
93
|
+
echo ""
|
|
94
|
+
echo "Skills triggered in this run:"
|
|
95
|
+
grep -o '"skill":"[^"]*"' "$LOG_FILE" 2>/dev/null | sort -u || echo " (none)"
|
|
96
|
+
|
|
97
|
+
# Check if Claude took action BEFORE invoking the skill (the failure mode)
|
|
98
|
+
echo ""
|
|
99
|
+
echo "Checking for premature action..."
|
|
100
|
+
|
|
101
|
+
# Look for tool invocations before the Skill invocation
|
|
102
|
+
# This detects the failure mode where Claude starts doing work without loading the skill
|
|
103
|
+
FIRST_SKILL_LINE=$(grep -n '"name":"Skill"' "$LOG_FILE" | head -1 | cut -d: -f1)
|
|
104
|
+
if [ -n "$FIRST_SKILL_LINE" ]; then
|
|
105
|
+
# Check if any non-Skill, non-system tools were invoked before the first Skill invocation
|
|
106
|
+
# Filter out system messages, TodoWrite (planning is ok), and other non-action tools
|
|
107
|
+
PREMATURE_TOOLS=$(head -n "$FIRST_SKILL_LINE" "$LOG_FILE" | \
|
|
108
|
+
grep '"type":"tool_use"' | \
|
|
109
|
+
grep -v '"name":"Skill"' | \
|
|
110
|
+
grep -v '"name":"TodoWrite"' || true)
|
|
111
|
+
if [ -n "$PREMATURE_TOOLS" ]; then
|
|
112
|
+
echo "WARNING: Tools invoked BEFORE Skill tool:"
|
|
113
|
+
echo "$PREMATURE_TOOLS" | head -5
|
|
114
|
+
echo ""
|
|
115
|
+
echo "This indicates Claude started working before loading the requested skill."
|
|
116
|
+
else
|
|
117
|
+
echo "OK: No premature tool invocations detected"
|
|
118
|
+
fi
|
|
119
|
+
else
|
|
120
|
+
echo "WARNING: No Skill invocation found at all"
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
# Show first assistant message
|
|
124
|
+
echo ""
|
|
125
|
+
echo "First assistant response (truncated):"
|
|
126
|
+
grep '"type":"assistant"' "$LOG_FILE" | head -1 | jq -r '.message.content[0].text // .message.content' 2>/dev/null | head -c 500 || echo " (could not extract)"
|
|
127
|
+
|
|
128
|
+
echo ""
|
|
129
|
+
echo "Full log: $LOG_FILE"
|
|
130
|
+
echo "Timestamp: $TIMESTAMP"
|
|
131
|
+
|
|
132
|
+
if [ "$TRIGGERED" = "true" ]; then
|
|
133
|
+
exit 0
|
|
134
|
+
else
|
|
135
|
+
exit 1
|
|
136
|
+
fi
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Main test runner for OpenCode plugin test suite
|
|
3
|
+
# Runs all tests and reports results
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
7
|
+
cd "$SCRIPT_DIR"
|
|
8
|
+
|
|
9
|
+
echo "========================================"
|
|
10
|
+
echo " OpenCode Plugin Test Suite"
|
|
11
|
+
echo "========================================"
|
|
12
|
+
echo ""
|
|
13
|
+
echo "Repository: $(cd ../.. && pwd)"
|
|
14
|
+
echo "Test time: $(date)"
|
|
15
|
+
echo ""
|
|
16
|
+
|
|
17
|
+
# Parse command line arguments
|
|
18
|
+
RUN_INTEGRATION=false
|
|
19
|
+
VERBOSE=false
|
|
20
|
+
SPECIFIC_TEST=""
|
|
21
|
+
|
|
22
|
+
while [[ $# -gt 0 ]]; do
|
|
23
|
+
case $1 in
|
|
24
|
+
--integration|-i)
|
|
25
|
+
RUN_INTEGRATION=true
|
|
26
|
+
shift
|
|
27
|
+
;;
|
|
28
|
+
--verbose|-v)
|
|
29
|
+
VERBOSE=true
|
|
30
|
+
shift
|
|
31
|
+
;;
|
|
32
|
+
--test|-t)
|
|
33
|
+
SPECIFIC_TEST="$2"
|
|
34
|
+
shift 2
|
|
35
|
+
;;
|
|
36
|
+
--help|-h)
|
|
37
|
+
echo "Usage: $0 [options]"
|
|
38
|
+
echo ""
|
|
39
|
+
echo "Options:"
|
|
40
|
+
echo " --integration, -i Run integration tests (requires OpenCode)"
|
|
41
|
+
echo " --verbose, -v Show verbose output"
|
|
42
|
+
echo " --test, -t NAME Run only the specified test"
|
|
43
|
+
echo " --help, -h Show this help"
|
|
44
|
+
echo ""
|
|
45
|
+
echo "Tests:"
|
|
46
|
+
echo " test-plugin-loading.sh Verify plugin installation and structure"
|
|
47
|
+
echo " test-tools.sh Test use_skill and find_skills tools (integration)"
|
|
48
|
+
echo " test-priority.sh Test skill priority resolution (integration)"
|
|
49
|
+
exit 0
|
|
50
|
+
;;
|
|
51
|
+
*)
|
|
52
|
+
echo "Unknown option: $1"
|
|
53
|
+
echo "Use --help for usage information"
|
|
54
|
+
exit 1
|
|
55
|
+
;;
|
|
56
|
+
esac
|
|
57
|
+
done
|
|
58
|
+
|
|
59
|
+
# List of tests to run (no external dependencies)
|
|
60
|
+
tests=(
|
|
61
|
+
"test-plugin-loading.sh"
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# Integration tests (require OpenCode)
|
|
65
|
+
integration_tests=(
|
|
66
|
+
"test-tools.sh"
|
|
67
|
+
"test-priority.sh"
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Add integration tests if requested
|
|
71
|
+
if [ "$RUN_INTEGRATION" = true ]; then
|
|
72
|
+
tests+=("${integration_tests[@]}")
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
# Filter to specific test if requested
|
|
76
|
+
if [ -n "$SPECIFIC_TEST" ]; then
|
|
77
|
+
tests=("$SPECIFIC_TEST")
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
# Track results
|
|
81
|
+
passed=0
|
|
82
|
+
failed=0
|
|
83
|
+
skipped=0
|
|
84
|
+
|
|
85
|
+
# Run each test
|
|
86
|
+
for test in "${tests[@]}"; do
|
|
87
|
+
echo "----------------------------------------"
|
|
88
|
+
echo "Running: $test"
|
|
89
|
+
echo "----------------------------------------"
|
|
90
|
+
|
|
91
|
+
test_path="$SCRIPT_DIR/$test"
|
|
92
|
+
|
|
93
|
+
if [ ! -f "$test_path" ]; then
|
|
94
|
+
echo " [SKIP] Test file not found: $test"
|
|
95
|
+
skipped=$((skipped + 1))
|
|
96
|
+
continue
|
|
97
|
+
fi
|
|
98
|
+
|
|
99
|
+
if [ ! -x "$test_path" ]; then
|
|
100
|
+
echo " Making $test executable..."
|
|
101
|
+
chmod +x "$test_path"
|
|
102
|
+
fi
|
|
103
|
+
|
|
104
|
+
start_time=$(date +%s)
|
|
105
|
+
|
|
106
|
+
if [ "$VERBOSE" = true ]; then
|
|
107
|
+
if bash "$test_path"; then
|
|
108
|
+
end_time=$(date +%s)
|
|
109
|
+
duration=$((end_time - start_time))
|
|
110
|
+
echo ""
|
|
111
|
+
echo " [PASS] $test (${duration}s)"
|
|
112
|
+
passed=$((passed + 1))
|
|
113
|
+
else
|
|
114
|
+
end_time=$(date +%s)
|
|
115
|
+
duration=$((end_time - start_time))
|
|
116
|
+
echo ""
|
|
117
|
+
echo " [FAIL] $test (${duration}s)"
|
|
118
|
+
failed=$((failed + 1))
|
|
119
|
+
fi
|
|
120
|
+
else
|
|
121
|
+
# Capture output for non-verbose mode
|
|
122
|
+
if output=$(bash "$test_path" 2>&1); then
|
|
123
|
+
end_time=$(date +%s)
|
|
124
|
+
duration=$((end_time - start_time))
|
|
125
|
+
echo " [PASS] (${duration}s)"
|
|
126
|
+
passed=$((passed + 1))
|
|
127
|
+
else
|
|
128
|
+
end_time=$(date +%s)
|
|
129
|
+
duration=$((end_time - start_time))
|
|
130
|
+
echo " [FAIL] (${duration}s)"
|
|
131
|
+
echo ""
|
|
132
|
+
echo " Output:"
|
|
133
|
+
echo "$output" | sed 's/^/ /'
|
|
134
|
+
failed=$((failed + 1))
|
|
135
|
+
fi
|
|
136
|
+
fi
|
|
137
|
+
|
|
138
|
+
echo ""
|
|
139
|
+
done
|
|
140
|
+
|
|
141
|
+
# Print summary
|
|
142
|
+
echo "========================================"
|
|
143
|
+
echo " Test Results Summary"
|
|
144
|
+
echo "========================================"
|
|
145
|
+
echo ""
|
|
146
|
+
echo " Passed: $passed"
|
|
147
|
+
echo " Failed: $failed"
|
|
148
|
+
echo " Skipped: $skipped"
|
|
149
|
+
echo ""
|
|
150
|
+
|
|
151
|
+
if [ "$RUN_INTEGRATION" = false ] && [ ${#integration_tests[@]} -gt 0 ]; then
|
|
152
|
+
echo "Note: Integration tests were not run."
|
|
153
|
+
echo "Use --integration flag to run tests that require OpenCode."
|
|
154
|
+
echo ""
|
|
155
|
+
fi
|
|
156
|
+
|
|
157
|
+
if [ $failed -gt 0 ]; then
|
|
158
|
+
echo "STATUS: FAILED"
|
|
159
|
+
exit 1
|
|
160
|
+
else
|
|
161
|
+
echo "STATUS: PASSED"
|
|
162
|
+
exit 0
|
|
163
|
+
fi
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Setup script for OpenCode plugin tests
|
|
3
|
+
# Creates an isolated test environment with proper plugin installation
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
# Get the repository root (two levels up from tests/opencode/)
|
|
7
|
+
REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
8
|
+
|
|
9
|
+
# Create temp home directory for isolation
|
|
10
|
+
export TEST_HOME=$(mktemp -d)
|
|
11
|
+
export HOME="$TEST_HOME"
|
|
12
|
+
export XDG_CONFIG_HOME="$TEST_HOME/.config"
|
|
13
|
+
export OPENCODE_CONFIG_DIR="$TEST_HOME/.config/opencode"
|
|
14
|
+
|
|
15
|
+
# Install plugin to test location
|
|
16
|
+
mkdir -p "$HOME/.config/opencode/superpowers"
|
|
17
|
+
cp -r "$REPO_ROOT/lib" "$HOME/.config/opencode/superpowers/"
|
|
18
|
+
cp -r "$REPO_ROOT/skills" "$HOME/.config/opencode/superpowers/"
|
|
19
|
+
|
|
20
|
+
# Copy plugin directory
|
|
21
|
+
mkdir -p "$HOME/.config/opencode/superpowers/.opencode/plugins"
|
|
22
|
+
cp "$REPO_ROOT/.opencode/plugins/superpowers.js" "$HOME/.config/opencode/superpowers/.opencode/plugins/"
|
|
23
|
+
|
|
24
|
+
# Register plugin via symlink
|
|
25
|
+
mkdir -p "$HOME/.config/opencode/plugins"
|
|
26
|
+
ln -sf "$HOME/.config/opencode/superpowers/.opencode/plugins/superpowers.js" \
|
|
27
|
+
"$HOME/.config/opencode/plugins/superpowers.js"
|
|
28
|
+
|
|
29
|
+
# Create test skills in different locations for testing
|
|
30
|
+
|
|
31
|
+
# Personal test skill
|
|
32
|
+
mkdir -p "$HOME/.config/opencode/skills/personal-test"
|
|
33
|
+
cat > "$HOME/.config/opencode/skills/personal-test/SKILL.md" <<'EOF'
|
|
34
|
+
---
|
|
35
|
+
name: personal-test
|
|
36
|
+
description: Test personal skill for verification
|
|
37
|
+
---
|
|
38
|
+
# Personal Test Skill
|
|
39
|
+
|
|
40
|
+
This is a personal skill used for testing.
|
|
41
|
+
|
|
42
|
+
PERSONAL_SKILL_MARKER_12345
|
|
43
|
+
EOF
|
|
44
|
+
|
|
45
|
+
# Create a project directory for project-level skill tests
|
|
46
|
+
mkdir -p "$TEST_HOME/test-project/.opencode/skills/project-test"
|
|
47
|
+
cat > "$TEST_HOME/test-project/.opencode/skills/project-test/SKILL.md" <<'EOF'
|
|
48
|
+
---
|
|
49
|
+
name: project-test
|
|
50
|
+
description: Test project skill for verification
|
|
51
|
+
---
|
|
52
|
+
# Project Test Skill
|
|
53
|
+
|
|
54
|
+
This is a project skill used for testing.
|
|
55
|
+
|
|
56
|
+
PROJECT_SKILL_MARKER_67890
|
|
57
|
+
EOF
|
|
58
|
+
|
|
59
|
+
echo "Setup complete: $TEST_HOME"
|
|
60
|
+
echo "Plugin installed to: $HOME/.config/opencode/superpowers/.opencode/plugins/superpowers.js"
|
|
61
|
+
echo "Plugin registered at: $HOME/.config/opencode/plugins/superpowers.js"
|
|
62
|
+
echo "Test project at: $TEST_HOME/test-project"
|
|
63
|
+
|
|
64
|
+
# Helper function for cleanup (call from tests or trap)
|
|
65
|
+
cleanup_test_env() {
|
|
66
|
+
if [ -n "${TEST_HOME:-}" ] && [ -d "$TEST_HOME" ]; then
|
|
67
|
+
rm -rf "$TEST_HOME"
|
|
68
|
+
fi
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
# Export for use in tests
|
|
72
|
+
export -f cleanup_test_env
|
|
73
|
+
export REPO_ROOT
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Test: Plugin Loading
|
|
3
|
+
# Verifies that the superpowers plugin loads correctly in OpenCode
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
7
|
+
|
|
8
|
+
echo "=== Test: Plugin Loading ==="
|
|
9
|
+
|
|
10
|
+
# Source setup to create isolated environment
|
|
11
|
+
source "$SCRIPT_DIR/setup.sh"
|
|
12
|
+
|
|
13
|
+
# Trap to cleanup on exit
|
|
14
|
+
trap cleanup_test_env EXIT
|
|
15
|
+
|
|
16
|
+
# Test 1: Verify plugin file exists and is registered
|
|
17
|
+
echo "Test 1: Checking plugin registration..."
|
|
18
|
+
if [ -L "$HOME/.config/opencode/plugins/superpowers.js" ]; then
|
|
19
|
+
echo " [PASS] Plugin symlink exists"
|
|
20
|
+
else
|
|
21
|
+
echo " [FAIL] Plugin symlink not found at $HOME/.config/opencode/plugins/superpowers.js"
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
# Verify symlink target exists
|
|
26
|
+
if [ -f "$(readlink -f "$HOME/.config/opencode/plugins/superpowers.js")" ]; then
|
|
27
|
+
echo " [PASS] Plugin symlink target exists"
|
|
28
|
+
else
|
|
29
|
+
echo " [FAIL] Plugin symlink target does not exist"
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
# Test 2: Verify skills directory is populated
|
|
34
|
+
echo "Test 2: Checking skills directory..."
|
|
35
|
+
skill_count=$(find "$HOME/.config/opencode/superpowers/skills" -name "SKILL.md" | wc -l)
|
|
36
|
+
if [ "$skill_count" -gt 0 ]; then
|
|
37
|
+
echo " [PASS] Found $skill_count skills installed"
|
|
38
|
+
else
|
|
39
|
+
echo " [FAIL] No skills found in installed location"
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Test 4: Check using-superpowers skill exists (critical for bootstrap)
|
|
44
|
+
echo "Test 4: Checking using-superpowers skill (required for bootstrap)..."
|
|
45
|
+
if [ -f "$HOME/.config/opencode/superpowers/skills/using-superpowers/SKILL.md" ]; then
|
|
46
|
+
echo " [PASS] using-superpowers skill exists"
|
|
47
|
+
else
|
|
48
|
+
echo " [FAIL] using-superpowers skill not found (required for bootstrap)"
|
|
49
|
+
exit 1
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# Test 5: Verify plugin JavaScript syntax (basic check)
|
|
53
|
+
echo "Test 5: Checking plugin JavaScript syntax..."
|
|
54
|
+
plugin_file="$HOME/.config/opencode/superpowers/.opencode/plugins/superpowers.js"
|
|
55
|
+
if node --check "$plugin_file" 2>/dev/null; then
|
|
56
|
+
echo " [PASS] Plugin JavaScript syntax is valid"
|
|
57
|
+
else
|
|
58
|
+
echo " [FAIL] Plugin has JavaScript syntax errors"
|
|
59
|
+
exit 1
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
# Test 6: Verify personal test skill was created
|
|
63
|
+
echo "Test 6: Checking test fixtures..."
|
|
64
|
+
if [ -f "$HOME/.config/opencode/skills/personal-test/SKILL.md" ]; then
|
|
65
|
+
echo " [PASS] Personal test skill fixture created"
|
|
66
|
+
else
|
|
67
|
+
echo " [FAIL] Personal test skill fixture not found"
|
|
68
|
+
exit 1
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
echo ""
|
|
72
|
+
echo "=== All plugin loading tests passed ==="
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Test: Skill Priority Resolution
|
|
3
|
+
# Verifies that skills are resolved with correct priority: project > personal > superpowers
|
|
4
|
+
# NOTE: These tests require OpenCode to be installed and configured
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
8
|
+
|
|
9
|
+
echo "=== Test: Skill Priority Resolution ==="
|
|
10
|
+
|
|
11
|
+
# Source setup to create isolated environment
|
|
12
|
+
source "$SCRIPT_DIR/setup.sh"
|
|
13
|
+
|
|
14
|
+
# Trap to cleanup on exit
|
|
15
|
+
trap cleanup_test_env EXIT
|
|
16
|
+
|
|
17
|
+
# Create same skill "priority-test" in all three locations with different markers
|
|
18
|
+
echo "Setting up priority test fixtures..."
|
|
19
|
+
|
|
20
|
+
# 1. Create in superpowers location (lowest priority)
|
|
21
|
+
mkdir -p "$HOME/.config/opencode/superpowers/skills/priority-test"
|
|
22
|
+
cat > "$HOME/.config/opencode/superpowers/skills/priority-test/SKILL.md" <<'EOF'
|
|
23
|
+
---
|
|
24
|
+
name: priority-test
|
|
25
|
+
description: Superpowers version of priority test skill
|
|
26
|
+
---
|
|
27
|
+
# Priority Test Skill (Superpowers Version)
|
|
28
|
+
|
|
29
|
+
This is the SUPERPOWERS version of the priority test skill.
|
|
30
|
+
|
|
31
|
+
PRIORITY_MARKER_SUPERPOWERS_VERSION
|
|
32
|
+
EOF
|
|
33
|
+
|
|
34
|
+
# 2. Create in personal location (medium priority)
|
|
35
|
+
mkdir -p "$HOME/.config/opencode/skills/priority-test"
|
|
36
|
+
cat > "$HOME/.config/opencode/skills/priority-test/SKILL.md" <<'EOF'
|
|
37
|
+
---
|
|
38
|
+
name: priority-test
|
|
39
|
+
description: Personal version of priority test skill
|
|
40
|
+
---
|
|
41
|
+
# Priority Test Skill (Personal Version)
|
|
42
|
+
|
|
43
|
+
This is the PERSONAL version of the priority test skill.
|
|
44
|
+
|
|
45
|
+
PRIORITY_MARKER_PERSONAL_VERSION
|
|
46
|
+
EOF
|
|
47
|
+
|
|
48
|
+
# 3. Create in project location (highest priority)
|
|
49
|
+
mkdir -p "$TEST_HOME/test-project/.opencode/skills/priority-test"
|
|
50
|
+
cat > "$TEST_HOME/test-project/.opencode/skills/priority-test/SKILL.md" <<'EOF'
|
|
51
|
+
---
|
|
52
|
+
name: priority-test
|
|
53
|
+
description: Project version of priority test skill
|
|
54
|
+
---
|
|
55
|
+
# Priority Test Skill (Project Version)
|
|
56
|
+
|
|
57
|
+
This is the PROJECT version of the priority test skill.
|
|
58
|
+
|
|
59
|
+
PRIORITY_MARKER_PROJECT_VERSION
|
|
60
|
+
EOF
|
|
61
|
+
|
|
62
|
+
echo " Created priority-test skill in all three locations"
|
|
63
|
+
|
|
64
|
+
# Test 1: Verify fixture setup
|
|
65
|
+
echo ""
|
|
66
|
+
echo "Test 1: Verifying test fixtures..."
|
|
67
|
+
|
|
68
|
+
if [ -f "$HOME/.config/opencode/superpowers/skills/priority-test/SKILL.md" ]; then
|
|
69
|
+
echo " [PASS] Superpowers version exists"
|
|
70
|
+
else
|
|
71
|
+
echo " [FAIL] Superpowers version missing"
|
|
72
|
+
exit 1
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
if [ -f "$HOME/.config/opencode/skills/priority-test/SKILL.md" ]; then
|
|
76
|
+
echo " [PASS] Personal version exists"
|
|
77
|
+
else
|
|
78
|
+
echo " [FAIL] Personal version missing"
|
|
79
|
+
exit 1
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
if [ -f "$TEST_HOME/test-project/.opencode/skills/priority-test/SKILL.md" ]; then
|
|
83
|
+
echo " [PASS] Project version exists"
|
|
84
|
+
else
|
|
85
|
+
echo " [FAIL] Project version missing"
|
|
86
|
+
exit 1
|
|
87
|
+
fi
|
|
88
|
+
|
|
89
|
+
# Check if opencode is available for integration tests
|
|
90
|
+
if ! command -v opencode &> /dev/null; then
|
|
91
|
+
echo ""
|
|
92
|
+
echo " [SKIP] OpenCode not installed - skipping integration tests"
|
|
93
|
+
echo " To run these tests, install OpenCode: https://opencode.ai"
|
|
94
|
+
echo ""
|
|
95
|
+
echo "=== Priority fixture tests passed (integration tests skipped) ==="
|
|
96
|
+
exit 0
|
|
97
|
+
fi
|
|
98
|
+
|
|
99
|
+
# Test 2: Test that personal overrides superpowers
|
|
100
|
+
echo ""
|
|
101
|
+
echo "Test 2: Testing personal > superpowers priority..."
|
|
102
|
+
echo " Running from outside project directory..."
|
|
103
|
+
|
|
104
|
+
# Run from HOME (not in project) - should get personal version
|
|
105
|
+
cd "$HOME"
|
|
106
|
+
output=$(timeout 60s opencode run --print-logs "Use the use_skill tool to load the priority-test skill. Show me the exact content including any PRIORITY_MARKER text." 2>&1) || {
|
|
107
|
+
exit_code=$?
|
|
108
|
+
if [ $exit_code -eq 124 ]; then
|
|
109
|
+
echo " [FAIL] OpenCode timed out after 60s"
|
|
110
|
+
exit 1
|
|
111
|
+
fi
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if echo "$output" | grep -qi "PRIORITY_MARKER_PERSONAL_VERSION"; then
|
|
115
|
+
echo " [PASS] Personal version loaded (overrides superpowers)"
|
|
116
|
+
elif echo "$output" | grep -qi "PRIORITY_MARKER_SUPERPOWERS_VERSION"; then
|
|
117
|
+
echo " [FAIL] Superpowers version loaded instead of personal"
|
|
118
|
+
exit 1
|
|
119
|
+
else
|
|
120
|
+
echo " [WARN] Could not verify priority marker in output"
|
|
121
|
+
echo " Output snippet:"
|
|
122
|
+
echo "$output" | grep -i "priority\|personal\|superpowers" | head -10
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
# Test 3: Test that project overrides both personal and superpowers
|
|
126
|
+
echo ""
|
|
127
|
+
echo "Test 3: Testing project > personal > superpowers priority..."
|
|
128
|
+
echo " Running from project directory..."
|
|
129
|
+
|
|
130
|
+
# Run from project directory - should get project version
|
|
131
|
+
cd "$TEST_HOME/test-project"
|
|
132
|
+
output=$(timeout 60s opencode run --print-logs "Use the use_skill tool to load the priority-test skill. Show me the exact content including any PRIORITY_MARKER text." 2>&1) || {
|
|
133
|
+
exit_code=$?
|
|
134
|
+
if [ $exit_code -eq 124 ]; then
|
|
135
|
+
echo " [FAIL] OpenCode timed out after 60s"
|
|
136
|
+
exit 1
|
|
137
|
+
fi
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if echo "$output" | grep -qi "PRIORITY_MARKER_PROJECT_VERSION"; then
|
|
141
|
+
echo " [PASS] Project version loaded (highest priority)"
|
|
142
|
+
elif echo "$output" | grep -qi "PRIORITY_MARKER_PERSONAL_VERSION"; then
|
|
143
|
+
echo " [FAIL] Personal version loaded instead of project"
|
|
144
|
+
exit 1
|
|
145
|
+
elif echo "$output" | grep -qi "PRIORITY_MARKER_SUPERPOWERS_VERSION"; then
|
|
146
|
+
echo " [FAIL] Superpowers version loaded instead of project"
|
|
147
|
+
exit 1
|
|
148
|
+
else
|
|
149
|
+
echo " [WARN] Could not verify priority marker in output"
|
|
150
|
+
echo " Output snippet:"
|
|
151
|
+
echo "$output" | grep -i "priority\|project\|personal" | head -10
|
|
152
|
+
fi
|
|
153
|
+
|
|
154
|
+
# Test 4: Test explicit superpowers: prefix bypasses priority
|
|
155
|
+
echo ""
|
|
156
|
+
echo "Test 4: Testing superpowers: prefix forces superpowers version..."
|
|
157
|
+
|
|
158
|
+
cd "$TEST_HOME/test-project"
|
|
159
|
+
output=$(timeout 60s opencode run --print-logs "Use the use_skill tool to load superpowers:priority-test specifically. Show me the exact content including any PRIORITY_MARKER text." 2>&1) || {
|
|
160
|
+
exit_code=$?
|
|
161
|
+
if [ $exit_code -eq 124 ]; then
|
|
162
|
+
echo " [FAIL] OpenCode timed out after 60s"
|
|
163
|
+
exit 1
|
|
164
|
+
fi
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if echo "$output" | grep -qi "PRIORITY_MARKER_SUPERPOWERS_VERSION"; then
|
|
168
|
+
echo " [PASS] superpowers: prefix correctly forces superpowers version"
|
|
169
|
+
elif echo "$output" | grep -qi "PRIORITY_MARKER_PROJECT_VERSION\|PRIORITY_MARKER_PERSONAL_VERSION"; then
|
|
170
|
+
echo " [FAIL] superpowers: prefix did not force superpowers version"
|
|
171
|
+
exit 1
|
|
172
|
+
else
|
|
173
|
+
echo " [WARN] Could not verify priority marker in output"
|
|
174
|
+
fi
|
|
175
|
+
|
|
176
|
+
# Test 5: Test explicit project: prefix
|
|
177
|
+
echo ""
|
|
178
|
+
echo "Test 5: Testing project: prefix forces project version..."
|
|
179
|
+
|
|
180
|
+
cd "$HOME" # Run from outside project but with project: prefix
|
|
181
|
+
output=$(timeout 60s opencode run --print-logs "Use the use_skill tool to load project:priority-test specifically. Show me the exact content." 2>&1) || {
|
|
182
|
+
exit_code=$?
|
|
183
|
+
if [ $exit_code -eq 124 ]; then
|
|
184
|
+
echo " [FAIL] OpenCode timed out after 60s"
|
|
185
|
+
exit 1
|
|
186
|
+
fi
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
# Note: This may fail since we're not in the project directory
|
|
190
|
+
# The project: prefix only works when in a project context
|
|
191
|
+
if echo "$output" | grep -qi "not found\|error"; then
|
|
192
|
+
echo " [PASS] project: prefix correctly fails when not in project context"
|
|
193
|
+
else
|
|
194
|
+
echo " [INFO] project: prefix behavior outside project context may vary"
|
|
195
|
+
fi
|
|
196
|
+
|
|
197
|
+
echo ""
|
|
198
|
+
echo "=== All priority tests passed ==="
|