opencodekit 0.6.0 → 0.6.1
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/dist/index.js +1 -1
- package/dist/template/.opencode/AGENTS.md +4 -1
- package/dist/template/.opencode/command/skill-create.md +3 -3
- package/dist/template/.opencode/command/skill-optimize.md +1 -1
- package/dist/template/.opencode/opencode.json +493 -535
- package/dist/template/.opencode/pickle-thinker.jsonc +11 -0
- package/dist/template/.opencode/plugin/skill.ts +275 -0
- package/dist/template/.opencode/{skills → skill}/accessibility-audit/SKILL.md +5 -0
- package/dist/template/.opencode/{skills → skill}/brainstorming/SKILL.md +2 -2
- package/dist/template/.opencode/{skills → skill}/design-system-audit/SKILL.md +5 -0
- package/dist/template/.opencode/{skills → skill}/executing-plans/SKILL.md +13 -2
- package/dist/template/.opencode/{skills → skill}/frontend-aesthetics/SKILL.md +5 -0
- package/dist/template/.opencode/{skills → skill}/mockup-to-code/SKILL.md +5 -0
- package/dist/template/.opencode/{skills → skill}/requesting-code-review/SKILL.md +16 -6
- package/dist/template/.opencode/{skills → skill}/subagent-driven-development/SKILL.md +38 -17
- package/dist/template/.opencode/{skills → skill}/systematic-debugging/SKILL.md +28 -18
- package/dist/template/.opencode/{skills → skill}/testing-skills-with-subagents/SKILL.md +1 -1
- package/dist/template/.opencode/{skills → skill}/ui-ux-research/SKILL.md +5 -0
- package/dist/template/.opencode/{skills → skill}/visual-analysis/SKILL.md +5 -0
- package/dist/template/.opencode/{skills → skill}/writing-plans/SKILL.md +3 -3
- package/dist/template/.opencode/{skills → skill}/writing-skills/SKILL.md +101 -41
- package/package.json +1 -1
- package/dist/template/.opencode/plugin/superpowers.ts +0 -271
- package/dist/template/.opencode/superpowers/.claude/settings.local.json +0 -141
- package/dist/template/.opencode/superpowers/.claude-plugin/marketplace.json +0 -20
- package/dist/template/.opencode/superpowers/.claude-plugin/plugin.json +0 -13
- package/dist/template/.opencode/superpowers/.codex/INSTALL.md +0 -35
- package/dist/template/.opencode/superpowers/.codex/superpowers-bootstrap.md +0 -33
- package/dist/template/.opencode/superpowers/.codex/superpowers-codex +0 -267
- package/dist/template/.opencode/superpowers/.github/FUNDING.yml +0 -3
- package/dist/template/.opencode/superpowers/.opencode/INSTALL.md +0 -135
- package/dist/template/.opencode/superpowers/.opencode/plugin/superpowers.js +0 -215
- package/dist/template/.opencode/superpowers/LICENSE +0 -21
- package/dist/template/.opencode/superpowers/README.md +0 -165
- package/dist/template/.opencode/superpowers/RELEASE-NOTES.md +0 -493
- package/dist/template/.opencode/superpowers/agents/code-reviewer.md +0 -48
- package/dist/template/.opencode/superpowers/commands/brainstorm.md +0 -5
- package/dist/template/.opencode/superpowers/commands/execute-plan.md +0 -5
- package/dist/template/.opencode/superpowers/commands/write-plan.md +0 -5
- package/dist/template/.opencode/superpowers/docs/README.codex.md +0 -153
- package/dist/template/.opencode/superpowers/docs/README.opencode.md +0 -234
- package/dist/template/.opencode/superpowers/docs/plans/2025-11-22-opencode-support-design.md +0 -294
- package/dist/template/.opencode/superpowers/docs/plans/2025-11-22-opencode-support-implementation.md +0 -1095
- package/dist/template/.opencode/superpowers/hooks/hooks.json +0 -15
- package/dist/template/.opencode/superpowers/hooks/session-start.sh +0 -34
- package/dist/template/.opencode/superpowers/lib/skills-core.js +0 -208
- package/dist/template/.opencode/superpowers/tests/opencode/run-tests.sh +0 -165
- package/dist/template/.opencode/superpowers/tests/opencode/setup.sh +0 -73
- package/dist/template/.opencode/superpowers/tests/opencode/test-plugin-loading.sh +0 -81
- package/dist/template/.opencode/superpowers/tests/opencode/test-priority.sh +0 -198
- package/dist/template/.opencode/superpowers/tests/opencode/test-skills-core.sh +0 -440
- package/dist/template/.opencode/superpowers/tests/opencode/test-tools.sh +0 -104
- /package/dist/template/.opencode/{skills → skill}/condition-based-waiting/SKILL.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/condition-based-waiting/example.ts +0 -0
- /package/dist/template/.opencode/{skills → skill}/defense-in-depth/SKILL.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/dispatching-parallel-agents/SKILL.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/finishing-a-development-branch/SKILL.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/gemini-large-context/SKILL.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/receiving-code-review/SKILL.md +0 -0
- /package/dist/template/.opencode/{skills/requesting-code-review/code-reviewer.md → skill/requesting-code-review/review.md} +0 -0
- /package/dist/template/.opencode/{skills → skill}/root-cause-tracing/SKILL.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/root-cause-tracing/find-polluter.sh +0 -0
- /package/dist/template/.opencode/{skills → skill}/sharing-skills/SKILL.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/systematic-debugging/CREATION-LOG.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/systematic-debugging/test-academic.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/systematic-debugging/test-pressure-1.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/systematic-debugging/test-pressure-2.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/systematic-debugging/test-pressure-3.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/test-driven-development/SKILL.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/testing-anti-patterns/SKILL.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/testing-skills-with-subagents/examples/CLAUDE_MD_TESTING.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/using-git-worktrees/SKILL.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/using-superpowers/SKILL.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/verification-before-completion/SKILL.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/writing-skills/anthropic-best-practices.md +0 -0
- /package/dist/template/.opencode/{skills → skill}/writing-skills/graphviz-conventions.dot +0 -0
- /package/dist/template/.opencode/{skills → skill}/writing-skills/persuasion-principles.md +0 -0
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# SessionStart hook for superpowers plugin
|
|
3
|
-
|
|
4
|
-
set -euo pipefail
|
|
5
|
-
|
|
6
|
-
# Determine plugin root directory
|
|
7
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
8
|
-
PLUGIN_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
|
9
|
-
|
|
10
|
-
# Check if legacy skills directory exists and build warning
|
|
11
|
-
warning_message=""
|
|
12
|
-
legacy_skills_dir="${HOME}/.config/superpowers/skills"
|
|
13
|
-
if [ -d "$legacy_skills_dir" ]; then
|
|
14
|
-
warning_message="\n\n<important-reminder>IN YOUR FIRST REPLY AFTER SEEING THIS MESSAGE YOU MUST TELL THE USER:⚠️ **WARNING:** Superpowers now uses Claude Code's skills system. Custom skills in ~/.config/superpowers/skills will not be read. Move custom skills to ~/.claude/skills instead. To make this message go away, remove ~/.config/superpowers/skills</important-reminder>"
|
|
15
|
-
fi
|
|
16
|
-
|
|
17
|
-
# Read using-superpowers content
|
|
18
|
-
using_superpowers_content=$(cat "${PLUGIN_ROOT}/skills/using-superpowers/SKILL.md" 2>&1 || echo "Error reading using-superpowers skill")
|
|
19
|
-
|
|
20
|
-
# Escape outputs for JSON
|
|
21
|
-
using_superpowers_escaped=$(echo "$using_superpowers_content" | sed 's/\\/\\\\/g' | sed 's/"/\\"/g' | awk '{printf "%s\\n", $0}')
|
|
22
|
-
warning_escaped=$(echo "$warning_message" | sed 's/\\/\\\\/g' | sed 's/"/\\"/g' | awk '{printf "%s\\n", $0}')
|
|
23
|
-
|
|
24
|
-
# Output context injection as JSON
|
|
25
|
-
cat <<EOF
|
|
26
|
-
{
|
|
27
|
-
"hookSpecificOutput": {
|
|
28
|
-
"hookEventName": "SessionStart",
|
|
29
|
-
"additionalContext": "<EXTREMELY_IMPORTANT>\nYou have superpowers.\n\n**Below is the full content of your 'superpowers:using-superpowers' skill - your introduction to using skills. For all other skills, use the 'Skill' tool:**\n\n${using_superpowers_escaped}\n\n${warning_escaped}\n</EXTREMELY_IMPORTANT>"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
EOF
|
|
33
|
-
|
|
34
|
-
exit 0
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { execSync } from 'child_process';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Extract YAML frontmatter from a skill file.
|
|
7
|
-
* Current format:
|
|
8
|
-
* ---
|
|
9
|
-
* name: skill-name
|
|
10
|
-
* description: Use when [condition] - [what it does]
|
|
11
|
-
* ---
|
|
12
|
-
*
|
|
13
|
-
* @param {string} filePath - Path to SKILL.md file
|
|
14
|
-
* @returns {{name: string, description: string}}
|
|
15
|
-
*/
|
|
16
|
-
function extractFrontmatter(filePath) {
|
|
17
|
-
try {
|
|
18
|
-
const content = fs.readFileSync(filePath, 'utf8');
|
|
19
|
-
const lines = content.split('\n');
|
|
20
|
-
|
|
21
|
-
let inFrontmatter = false;
|
|
22
|
-
let name = '';
|
|
23
|
-
let description = '';
|
|
24
|
-
|
|
25
|
-
for (const line of lines) {
|
|
26
|
-
if (line.trim() === '---') {
|
|
27
|
-
if (inFrontmatter) break;
|
|
28
|
-
inFrontmatter = true;
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (inFrontmatter) {
|
|
33
|
-
const match = line.match(/^(\w+):\s*(.*)$/);
|
|
34
|
-
if (match) {
|
|
35
|
-
const [, key, value] = match;
|
|
36
|
-
switch (key) {
|
|
37
|
-
case 'name':
|
|
38
|
-
name = value.trim();
|
|
39
|
-
break;
|
|
40
|
-
case 'description':
|
|
41
|
-
description = value.trim();
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return { name, description };
|
|
49
|
-
} catch (error) {
|
|
50
|
-
return { name: '', description: '' };
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Find all SKILL.md files in a directory recursively.
|
|
56
|
-
*
|
|
57
|
-
* @param {string} dir - Directory to search
|
|
58
|
-
* @param {string} sourceType - 'personal' or 'superpowers' for namespacing
|
|
59
|
-
* @param {number} maxDepth - Maximum recursion depth (default: 3)
|
|
60
|
-
* @returns {Array<{path: string, name: string, description: string, sourceType: string}>}
|
|
61
|
-
*/
|
|
62
|
-
function findSkillsInDir(dir, sourceType, maxDepth = 3) {
|
|
63
|
-
const skills = [];
|
|
64
|
-
|
|
65
|
-
if (!fs.existsSync(dir)) return skills;
|
|
66
|
-
|
|
67
|
-
function recurse(currentDir, depth) {
|
|
68
|
-
if (depth > maxDepth) return;
|
|
69
|
-
|
|
70
|
-
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
71
|
-
|
|
72
|
-
for (const entry of entries) {
|
|
73
|
-
const fullPath = path.join(currentDir, entry.name);
|
|
74
|
-
|
|
75
|
-
if (entry.isDirectory()) {
|
|
76
|
-
// Check for SKILL.md in this directory
|
|
77
|
-
const skillFile = path.join(fullPath, 'SKILL.md');
|
|
78
|
-
if (fs.existsSync(skillFile)) {
|
|
79
|
-
const { name, description } = extractFrontmatter(skillFile);
|
|
80
|
-
skills.push({
|
|
81
|
-
path: fullPath,
|
|
82
|
-
skillFile: skillFile,
|
|
83
|
-
name: name || entry.name,
|
|
84
|
-
description: description || '',
|
|
85
|
-
sourceType: sourceType
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Recurse into subdirectories
|
|
90
|
-
recurse(fullPath, depth + 1);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
recurse(dir, 0);
|
|
96
|
-
return skills;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Resolve a skill name to its file path, handling shadowing
|
|
101
|
-
* (personal skills override superpowers skills).
|
|
102
|
-
*
|
|
103
|
-
* @param {string} skillName - Name like "superpowers:brainstorming" or "my-skill"
|
|
104
|
-
* @param {string} superpowersDir - Path to superpowers skills directory
|
|
105
|
-
* @param {string} personalDir - Path to personal skills directory
|
|
106
|
-
* @returns {{skillFile: string, sourceType: string, skillPath: string} | null}
|
|
107
|
-
*/
|
|
108
|
-
function resolveSkillPath(skillName, superpowersDir, personalDir) {
|
|
109
|
-
// Strip superpowers: prefix if present
|
|
110
|
-
const forceSuperpowers = skillName.startsWith('superpowers:');
|
|
111
|
-
const actualSkillName = forceSuperpowers ? skillName.replace(/^superpowers:/, '') : skillName;
|
|
112
|
-
|
|
113
|
-
// Try personal skills first (unless explicitly superpowers:)
|
|
114
|
-
if (!forceSuperpowers && personalDir) {
|
|
115
|
-
const personalPath = path.join(personalDir, actualSkillName);
|
|
116
|
-
const personalSkillFile = path.join(personalPath, 'SKILL.md');
|
|
117
|
-
if (fs.existsSync(personalSkillFile)) {
|
|
118
|
-
return {
|
|
119
|
-
skillFile: personalSkillFile,
|
|
120
|
-
sourceType: 'personal',
|
|
121
|
-
skillPath: actualSkillName
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Try superpowers skills
|
|
127
|
-
if (superpowersDir) {
|
|
128
|
-
const superpowersPath = path.join(superpowersDir, actualSkillName);
|
|
129
|
-
const superpowersSkillFile = path.join(superpowersPath, 'SKILL.md');
|
|
130
|
-
if (fs.existsSync(superpowersSkillFile)) {
|
|
131
|
-
return {
|
|
132
|
-
skillFile: superpowersSkillFile,
|
|
133
|
-
sourceType: 'superpowers',
|
|
134
|
-
skillPath: actualSkillName
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Check if a git repository has updates available.
|
|
144
|
-
*
|
|
145
|
-
* @param {string} repoDir - Path to git repository
|
|
146
|
-
* @returns {boolean} - True if updates are available
|
|
147
|
-
*/
|
|
148
|
-
function checkForUpdates(repoDir) {
|
|
149
|
-
try {
|
|
150
|
-
// Quick check with 3 second timeout to avoid delays if network is down
|
|
151
|
-
const output = execSync('git fetch origin && git status --porcelain=v1 --branch', {
|
|
152
|
-
cwd: repoDir,
|
|
153
|
-
timeout: 3000,
|
|
154
|
-
encoding: 'utf8',
|
|
155
|
-
stdio: 'pipe'
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
// Parse git status output to see if we're behind
|
|
159
|
-
const statusLines = output.split('\n');
|
|
160
|
-
for (const line of statusLines) {
|
|
161
|
-
if (line.startsWith('## ') && line.includes('[behind ')) {
|
|
162
|
-
return true; // We're behind remote
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return false; // Up to date
|
|
166
|
-
} catch (error) {
|
|
167
|
-
// Network down, git error, timeout, etc. - don't block bootstrap
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Strip YAML frontmatter from skill content, returning just the content.
|
|
174
|
-
*
|
|
175
|
-
* @param {string} content - Full content including frontmatter
|
|
176
|
-
* @returns {string} - Content without frontmatter
|
|
177
|
-
*/
|
|
178
|
-
function stripFrontmatter(content) {
|
|
179
|
-
const lines = content.split('\n');
|
|
180
|
-
let inFrontmatter = false;
|
|
181
|
-
let frontmatterEnded = false;
|
|
182
|
-
const contentLines = [];
|
|
183
|
-
|
|
184
|
-
for (const line of lines) {
|
|
185
|
-
if (line.trim() === '---') {
|
|
186
|
-
if (inFrontmatter) {
|
|
187
|
-
frontmatterEnded = true;
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
inFrontmatter = true;
|
|
191
|
-
continue;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if (frontmatterEnded || !inFrontmatter) {
|
|
195
|
-
contentLines.push(line);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return contentLines.join('\n').trim();
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export {
|
|
203
|
-
extractFrontmatter,
|
|
204
|
-
findSkillsInDir,
|
|
205
|
-
resolveSkillPath,
|
|
206
|
-
checkForUpdates,
|
|
207
|
-
stripFrontmatter
|
|
208
|
-
};
|
|
@@ -1,165 +0,0 @@
|
|
|
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-skills-core.sh Test skills-core.js library functions"
|
|
48
|
-
echo " test-tools.sh Test use_skill and find_skills tools (integration)"
|
|
49
|
-
echo " test-priority.sh Test skill priority resolution (integration)"
|
|
50
|
-
exit 0
|
|
51
|
-
;;
|
|
52
|
-
*)
|
|
53
|
-
echo "Unknown option: $1"
|
|
54
|
-
echo "Use --help for usage information"
|
|
55
|
-
exit 1
|
|
56
|
-
;;
|
|
57
|
-
esac
|
|
58
|
-
done
|
|
59
|
-
|
|
60
|
-
# List of tests to run (no external dependencies)
|
|
61
|
-
tests=(
|
|
62
|
-
"test-plugin-loading.sh"
|
|
63
|
-
"test-skills-core.sh"
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
# Integration tests (require OpenCode)
|
|
67
|
-
integration_tests=(
|
|
68
|
-
"test-tools.sh"
|
|
69
|
-
"test-priority.sh"
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
# Add integration tests if requested
|
|
73
|
-
if [ "$RUN_INTEGRATION" = true ]; then
|
|
74
|
-
tests+=("${integration_tests[@]}")
|
|
75
|
-
fi
|
|
76
|
-
|
|
77
|
-
# Filter to specific test if requested
|
|
78
|
-
if [ -n "$SPECIFIC_TEST" ]; then
|
|
79
|
-
tests=("$SPECIFIC_TEST")
|
|
80
|
-
fi
|
|
81
|
-
|
|
82
|
-
# Track results
|
|
83
|
-
passed=0
|
|
84
|
-
failed=0
|
|
85
|
-
skipped=0
|
|
86
|
-
|
|
87
|
-
# Run each test
|
|
88
|
-
for test in "${tests[@]}"; do
|
|
89
|
-
echo "----------------------------------------"
|
|
90
|
-
echo "Running: $test"
|
|
91
|
-
echo "----------------------------------------"
|
|
92
|
-
|
|
93
|
-
test_path="$SCRIPT_DIR/$test"
|
|
94
|
-
|
|
95
|
-
if [ ! -f "$test_path" ]; then
|
|
96
|
-
echo " [SKIP] Test file not found: $test"
|
|
97
|
-
skipped=$((skipped + 1))
|
|
98
|
-
continue
|
|
99
|
-
fi
|
|
100
|
-
|
|
101
|
-
if [ ! -x "$test_path" ]; then
|
|
102
|
-
echo " Making $test executable..."
|
|
103
|
-
chmod +x "$test_path"
|
|
104
|
-
fi
|
|
105
|
-
|
|
106
|
-
start_time=$(date +%s)
|
|
107
|
-
|
|
108
|
-
if [ "$VERBOSE" = true ]; then
|
|
109
|
-
if bash "$test_path"; then
|
|
110
|
-
end_time=$(date +%s)
|
|
111
|
-
duration=$((end_time - start_time))
|
|
112
|
-
echo ""
|
|
113
|
-
echo " [PASS] $test (${duration}s)"
|
|
114
|
-
passed=$((passed + 1))
|
|
115
|
-
else
|
|
116
|
-
end_time=$(date +%s)
|
|
117
|
-
duration=$((end_time - start_time))
|
|
118
|
-
echo ""
|
|
119
|
-
echo " [FAIL] $test (${duration}s)"
|
|
120
|
-
failed=$((failed + 1))
|
|
121
|
-
fi
|
|
122
|
-
else
|
|
123
|
-
# Capture output for non-verbose mode
|
|
124
|
-
if output=$(bash "$test_path" 2>&1); then
|
|
125
|
-
end_time=$(date +%s)
|
|
126
|
-
duration=$((end_time - start_time))
|
|
127
|
-
echo " [PASS] (${duration}s)"
|
|
128
|
-
passed=$((passed + 1))
|
|
129
|
-
else
|
|
130
|
-
end_time=$(date +%s)
|
|
131
|
-
duration=$((end_time - start_time))
|
|
132
|
-
echo " [FAIL] (${duration}s)"
|
|
133
|
-
echo ""
|
|
134
|
-
echo " Output:"
|
|
135
|
-
echo "$output" | sed 's/^/ /'
|
|
136
|
-
failed=$((failed + 1))
|
|
137
|
-
fi
|
|
138
|
-
fi
|
|
139
|
-
|
|
140
|
-
echo ""
|
|
141
|
-
done
|
|
142
|
-
|
|
143
|
-
# Print summary
|
|
144
|
-
echo "========================================"
|
|
145
|
-
echo " Test Results Summary"
|
|
146
|
-
echo "========================================"
|
|
147
|
-
echo ""
|
|
148
|
-
echo " Passed: $passed"
|
|
149
|
-
echo " Failed: $failed"
|
|
150
|
-
echo " Skipped: $skipped"
|
|
151
|
-
echo ""
|
|
152
|
-
|
|
153
|
-
if [ "$RUN_INTEGRATION" = false ] && [ ${#integration_tests[@]} -gt 0 ]; then
|
|
154
|
-
echo "Note: Integration tests were not run."
|
|
155
|
-
echo "Use --integration flag to run tests that require OpenCode."
|
|
156
|
-
echo ""
|
|
157
|
-
fi
|
|
158
|
-
|
|
159
|
-
if [ $failed -gt 0 ]; then
|
|
160
|
-
echo "STATUS: FAILED"
|
|
161
|
-
exit 1
|
|
162
|
-
else
|
|
163
|
-
echo "STATUS: PASSED"
|
|
164
|
-
exit 0
|
|
165
|
-
fi
|
|
@@ -1,73 +0,0 @@
|
|
|
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/plugin"
|
|
22
|
-
cp "$REPO_ROOT/.opencode/plugin/superpowers.js" "$HOME/.config/opencode/superpowers/.opencode/plugin/"
|
|
23
|
-
|
|
24
|
-
# Register plugin via symlink
|
|
25
|
-
mkdir -p "$HOME/.config/opencode/plugin"
|
|
26
|
-
ln -sf "$HOME/.config/opencode/superpowers/.opencode/plugin/superpowers.js" \
|
|
27
|
-
"$HOME/.config/opencode/plugin/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/plugin/superpowers.js"
|
|
61
|
-
echo "Plugin registered at: $HOME/.config/opencode/plugin/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
|
|
@@ -1,81 +0,0 @@
|
|
|
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/plugin/superpowers.js" ]; then
|
|
19
|
-
echo " [PASS] Plugin symlink exists"
|
|
20
|
-
else
|
|
21
|
-
echo " [FAIL] Plugin symlink not found at $HOME/.config/opencode/plugin/superpowers.js"
|
|
22
|
-
exit 1
|
|
23
|
-
fi
|
|
24
|
-
|
|
25
|
-
# Verify symlink target exists
|
|
26
|
-
if [ -f "$(readlink -f "$HOME/.config/opencode/plugin/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 lib/skills-core.js is in place
|
|
34
|
-
echo "Test 2: Checking skills-core.js..."
|
|
35
|
-
if [ -f "$HOME/.config/opencode/superpowers/lib/skills-core.js" ]; then
|
|
36
|
-
echo " [PASS] skills-core.js exists"
|
|
37
|
-
else
|
|
38
|
-
echo " [FAIL] skills-core.js not found"
|
|
39
|
-
exit 1
|
|
40
|
-
fi
|
|
41
|
-
|
|
42
|
-
# Test 3: Verify skills directory is populated
|
|
43
|
-
echo "Test 3: Checking skills directory..."
|
|
44
|
-
skill_count=$(find "$HOME/.config/opencode/superpowers/skills" -name "SKILL.md" | wc -l)
|
|
45
|
-
if [ "$skill_count" -gt 0 ]; then
|
|
46
|
-
echo " [PASS] Found $skill_count skills installed"
|
|
47
|
-
else
|
|
48
|
-
echo " [FAIL] No skills found in installed location"
|
|
49
|
-
exit 1
|
|
50
|
-
fi
|
|
51
|
-
|
|
52
|
-
# Test 4: Check using-superpowers skill exists (critical for bootstrap)
|
|
53
|
-
echo "Test 4: Checking using-superpowers skill (required for bootstrap)..."
|
|
54
|
-
if [ -f "$HOME/.config/opencode/superpowers/skills/using-superpowers/SKILL.md" ]; then
|
|
55
|
-
echo " [PASS] using-superpowers skill exists"
|
|
56
|
-
else
|
|
57
|
-
echo " [FAIL] using-superpowers skill not found (required for bootstrap)"
|
|
58
|
-
exit 1
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
# Test 5: Verify plugin JavaScript syntax (basic check)
|
|
62
|
-
echo "Test 5: Checking plugin JavaScript syntax..."
|
|
63
|
-
plugin_file="$HOME/.config/opencode/superpowers/.opencode/plugin/superpowers.js"
|
|
64
|
-
if node --check "$plugin_file" 2>/dev/null; then
|
|
65
|
-
echo " [PASS] Plugin JavaScript syntax is valid"
|
|
66
|
-
else
|
|
67
|
-
echo " [FAIL] Plugin has JavaScript syntax errors"
|
|
68
|
-
exit 1
|
|
69
|
-
fi
|
|
70
|
-
|
|
71
|
-
# Test 6: Verify personal test skill was created
|
|
72
|
-
echo "Test 6: Checking test fixtures..."
|
|
73
|
-
if [ -f "$HOME/.config/opencode/skills/personal-test/SKILL.md" ]; then
|
|
74
|
-
echo " [PASS] Personal test skill fixture created"
|
|
75
|
-
else
|
|
76
|
-
echo " [FAIL] Personal test skill fixture not found"
|
|
77
|
-
exit 1
|
|
78
|
-
fi
|
|
79
|
-
|
|
80
|
-
echo ""
|
|
81
|
-
echo "=== All plugin loading tests passed ==="
|