Compare commits

..

1 Commits

Author SHA1 Message Date
jesse
911fa1d6c5 test: add package.json for opencode npm plugin test 2026-03-15 20:08:51 +00:00
3 changed files with 69 additions and 90 deletions

View File

@@ -7,13 +7,10 @@
## Installation Steps ## Installation Steps
> **Custom config directory:** If you've set `OPENCODE_CONFIG_DIR`, the commands below will use it automatically. Otherwise they default to `~/.config/opencode`.
### 1. Clone Superpowers ### 1. Clone Superpowers
```bash ```bash
OPENCODE_CONFIG_DIR="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}" git clone https://github.com/obra/superpowers.git ~/.config/opencode/superpowers
git clone https://github.com/obra/superpowers.git "$OPENCODE_CONFIG_DIR/superpowers"
``` ```
### 2. Register the Plugin ### 2. Register the Plugin
@@ -21,10 +18,9 @@ git clone https://github.com/obra/superpowers.git "$OPENCODE_CONFIG_DIR/superpow
Create a symlink so OpenCode discovers the plugin: Create a symlink so OpenCode discovers the plugin:
```bash ```bash
OPENCODE_CONFIG_DIR="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}" mkdir -p ~/.config/opencode/plugins
mkdir -p "$OPENCODE_CONFIG_DIR/plugins" rm -f ~/.config/opencode/plugins/superpowers.js
rm -f "$OPENCODE_CONFIG_DIR/plugins/superpowers.js" ln -s ~/.config/opencode/superpowers/.opencode/plugins/superpowers.js ~/.config/opencode/plugins/superpowers.js
ln -s "$OPENCODE_CONFIG_DIR/superpowers/.opencode/plugins/superpowers.js" "$OPENCODE_CONFIG_DIR/plugins/superpowers.js"
``` ```
### 3. Symlink Skills ### 3. Symlink Skills
@@ -32,10 +28,9 @@ ln -s "$OPENCODE_CONFIG_DIR/superpowers/.opencode/plugins/superpowers.js" "$OPEN
Create a symlink so OpenCode's native skill tool discovers superpowers skills: Create a symlink so OpenCode's native skill tool discovers superpowers skills:
```bash ```bash
OPENCODE_CONFIG_DIR="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}" mkdir -p ~/.config/opencode/skills
mkdir -p "$OPENCODE_CONFIG_DIR/skills" rm -rf ~/.config/opencode/skills/superpowers
rm -rf "$OPENCODE_CONFIG_DIR/skills/superpowers" ln -s ~/.config/opencode/superpowers/skills ~/.config/opencode/skills/superpowers
ln -s "$OPENCODE_CONFIG_DIR/superpowers/skills" "$OPENCODE_CONFIG_DIR/skills/superpowers"
``` ```
### 4. Restart OpenCode ### 4. Restart OpenCode
@@ -64,14 +59,13 @@ use skill tool to load superpowers/brainstorming
### Personal Skills ### Personal Skills
Create your own skills in your OpenCode skills directory: Create your own skills in `~/.config/opencode/skills/`:
```bash ```bash
OPENCODE_CONFIG_DIR="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}" mkdir -p ~/.config/opencode/skills/my-skill
mkdir -p "$OPENCODE_CONFIG_DIR/skills/my-skill"
``` ```
Create a `SKILL.md` in that directory: Create `~/.config/opencode/skills/my-skill/SKILL.md`:
```markdown ```markdown
--- ---
@@ -93,8 +87,7 @@ Create project-specific skills in `.opencode/skills/` within your project.
## Updating ## Updating
```bash ```bash
OPENCODE_CONFIG_DIR="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}" cd ~/.config/opencode/superpowers
cd "$OPENCODE_CONFIG_DIR/superpowers"
git pull git pull
``` ```
@@ -102,20 +95,15 @@ git pull
### Plugin not loading ### Plugin not loading
```bash 1. Check plugin symlink: `ls -l ~/.config/opencode/plugins/superpowers.js`
OPENCODE_CONFIG_DIR="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}" 2. Check source exists: `ls ~/.config/opencode/superpowers/.opencode/plugins/superpowers.js`
ls -l "$OPENCODE_CONFIG_DIR/plugins/superpowers.js" 3. Check OpenCode logs for errors
ls "$OPENCODE_CONFIG_DIR/superpowers/.opencode/plugins/superpowers.js"
```
### Skills not found ### Skills not found
```bash 1. Check skills symlink: `ls -l ~/.config/opencode/skills/superpowers`
OPENCODE_CONFIG_DIR="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}" 2. Verify it points to: `~/.config/opencode/superpowers/skills`
ls -l "$OPENCODE_CONFIG_DIR/skills/superpowers" 3. Use `skill` tool to list what's discovered
```
Verify the symlink points to `$OPENCODE_CONFIG_DIR/superpowers/skills`. Use `skill` tool to list what's discovered.
### Tool mapping ### Tool mapping

View File

@@ -7,7 +7,7 @@ Complete guide for using Superpowers with [OpenCode.ai](https://opencode.ai).
Tell OpenCode: Tell OpenCode:
``` ```
Clone https://github.com/obra/superpowers to my OpenCode config directory under superpowers/, then create a plugins/ directory there, then symlink superpowers/.opencode/plugins/superpowers.js to plugins/superpowers.js, then symlink superpowers/skills to skills/superpowers, then restart opencode. Clone https://github.com/obra/superpowers to ~/.config/opencode/superpowers, then create directory ~/.config/opencode/plugins, then symlink ~/.config/opencode/superpowers/.opencode/plugins/superpowers.js to ~/.config/opencode/plugins/superpowers.js, then symlink ~/.config/opencode/superpowers/skills to ~/.config/opencode/skills/superpowers, then restart opencode.
``` ```
## Manual Installation ## Manual Installation
@@ -17,30 +17,26 @@ Clone https://github.com/obra/superpowers to my OpenCode config directory under
- [OpenCode.ai](https://opencode.ai) installed - [OpenCode.ai](https://opencode.ai) installed
- Git installed - Git installed
> **Custom config directory:** If you've set `OPENCODE_CONFIG_DIR`, the commands below will use it automatically. Otherwise they default to `~/.config/opencode` (macOS/Linux) or `%USERPROFILE%\.config\opencode` (Windows).
### macOS / Linux ### macOS / Linux
```bash ```bash
OPENCODE_CONFIG_DIR="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}"
# 1. Install Superpowers (or update existing) # 1. Install Superpowers (or update existing)
if [ -d "$OPENCODE_CONFIG_DIR/superpowers" ]; then if [ -d ~/.config/opencode/superpowers ]; then
cd "$OPENCODE_CONFIG_DIR/superpowers" && git pull cd ~/.config/opencode/superpowers && git pull
else else
git clone https://github.com/obra/superpowers.git "$OPENCODE_CONFIG_DIR/superpowers" git clone https://github.com/obra/superpowers.git ~/.config/opencode/superpowers
fi fi
# 2. Create directories # 2. Create directories
mkdir -p "$OPENCODE_CONFIG_DIR/plugins" "$OPENCODE_CONFIG_DIR/skills" mkdir -p ~/.config/opencode/plugins ~/.config/opencode/skills
# 3. Remove old symlinks/directories if they exist # 3. Remove old symlinks/directories if they exist
rm -f "$OPENCODE_CONFIG_DIR/plugins/superpowers.js" rm -f ~/.config/opencode/plugins/superpowers.js
rm -rf "$OPENCODE_CONFIG_DIR/skills/superpowers" rm -rf ~/.config/opencode/skills/superpowers
# 4. Create symlinks # 4. Create symlinks
ln -s "$OPENCODE_CONFIG_DIR/superpowers/.opencode/plugins/superpowers.js" "$OPENCODE_CONFIG_DIR/plugins/superpowers.js" ln -s ~/.config/opencode/superpowers/.opencode/plugins/superpowers.js ~/.config/opencode/plugins/superpowers.js
ln -s "$OPENCODE_CONFIG_DIR/superpowers/skills" "$OPENCODE_CONFIG_DIR/skills/superpowers" ln -s ~/.config/opencode/superpowers/skills ~/.config/opencode/skills/superpowers
# 5. Restart OpenCode # 5. Restart OpenCode
``` ```
@@ -48,9 +44,8 @@ ln -s "$OPENCODE_CONFIG_DIR/superpowers/skills" "$OPENCODE_CONFIG_DIR/skills/sup
#### Verify Installation #### Verify Installation
```bash ```bash
OPENCODE_CONFIG_DIR="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}" ls -l ~/.config/opencode/plugins/superpowers.js
ls -l "$OPENCODE_CONFIG_DIR/plugins/superpowers.js" ls -l ~/.config/opencode/skills/superpowers
ls -l "$OPENCODE_CONFIG_DIR/skills/superpowers"
``` ```
Both should show symlinks pointing to the superpowers directory. Both should show symlinks pointing to the superpowers directory.
@@ -70,24 +65,22 @@ Pick your shell below: [Command Prompt](#command-prompt) | [PowerShell](#powersh
Run as Administrator, or with Developer Mode enabled: Run as Administrator, or with Developer Mode enabled:
```cmd ```cmd
if not defined OPENCODE_CONFIG_DIR set OPENCODE_CONFIG_DIR=%USERPROFILE%\.config\opencode
:: 1. Install Superpowers :: 1. Install Superpowers
git clone https://github.com/obra/superpowers.git "%OPENCODE_CONFIG_DIR%\superpowers" git clone https://github.com/obra/superpowers.git "%USERPROFILE%\.config\opencode\superpowers"
:: 2. Create directories :: 2. Create directories
mkdir "%OPENCODE_CONFIG_DIR%\plugins" 2>nul mkdir "%USERPROFILE%\.config\opencode\plugins" 2>nul
mkdir "%OPENCODE_CONFIG_DIR%\skills" 2>nul mkdir "%USERPROFILE%\.config\opencode\skills" 2>nul
:: 3. Remove existing links (safe for reinstalls) :: 3. Remove existing links (safe for reinstalls)
del "%OPENCODE_CONFIG_DIR%\plugins\superpowers.js" 2>nul del "%USERPROFILE%\.config\opencode\plugins\superpowers.js" 2>nul
rmdir "%OPENCODE_CONFIG_DIR%\skills\superpowers" 2>nul rmdir "%USERPROFILE%\.config\opencode\skills\superpowers" 2>nul
:: 4. Create plugin symlink (requires Developer Mode or Admin) :: 4. Create plugin symlink (requires Developer Mode or Admin)
mklink "%OPENCODE_CONFIG_DIR%\plugins\superpowers.js" "%OPENCODE_CONFIG_DIR%\superpowers\.opencode\plugins\superpowers.js" mklink "%USERPROFILE%\.config\opencode\plugins\superpowers.js" "%USERPROFILE%\.config\opencode\superpowers\.opencode\plugins\superpowers.js"
:: 5. Create skills junction (works without special privileges) :: 5. Create skills junction (works without special privileges)
mklink /J "%OPENCODE_CONFIG_DIR%\skills\superpowers" "%OPENCODE_CONFIG_DIR%\superpowers\skills" mklink /J "%USERPROFILE%\.config\opencode\skills\superpowers" "%USERPROFILE%\.config\opencode\superpowers\skills"
:: 6. Restart OpenCode :: 6. Restart OpenCode
``` ```
@@ -97,24 +90,22 @@ mklink /J "%OPENCODE_CONFIG_DIR%\skills\superpowers" "%OPENCODE_CONFIG_DIR%\supe
Run as Administrator, or with Developer Mode enabled: Run as Administrator, or with Developer Mode enabled:
```powershell ```powershell
if (-not $env:OPENCODE_CONFIG_DIR) { $env:OPENCODE_CONFIG_DIR = "$env:USERPROFILE\.config\opencode" }
# 1. Install Superpowers # 1. Install Superpowers
git clone https://github.com/obra/superpowers.git "$env:OPENCODE_CONFIG_DIR\superpowers" git clone https://github.com/obra/superpowers.git "$env:USERPROFILE\.config\opencode\superpowers"
# 2. Create directories # 2. Create directories
New-Item -ItemType Directory -Force -Path "$env:OPENCODE_CONFIG_DIR\plugins" New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.config\opencode\plugins"
New-Item -ItemType Directory -Force -Path "$env:OPENCODE_CONFIG_DIR\skills" New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.config\opencode\skills"
# 3. Remove existing links (safe for reinstalls) # 3. Remove existing links (safe for reinstalls)
Remove-Item "$env:OPENCODE_CONFIG_DIR\plugins\superpowers.js" -Force -ErrorAction SilentlyContinue Remove-Item "$env:USERPROFILE\.config\opencode\plugins\superpowers.js" -Force -ErrorAction SilentlyContinue
Remove-Item "$env:OPENCODE_CONFIG_DIR\skills\superpowers" -Force -ErrorAction SilentlyContinue Remove-Item "$env:USERPROFILE\.config\opencode\skills\superpowers" -Force -ErrorAction SilentlyContinue
# 4. Create plugin symlink (requires Developer Mode or Admin) # 4. Create plugin symlink (requires Developer Mode or Admin)
New-Item -ItemType SymbolicLink -Path "$env:OPENCODE_CONFIG_DIR\plugins\superpowers.js" -Target "$env:OPENCODE_CONFIG_DIR\superpowers\.opencode\plugins\superpowers.js" New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\.config\opencode\plugins\superpowers.js" -Target "$env:USERPROFILE\.config\opencode\superpowers\.opencode\plugins\superpowers.js"
# 5. Create skills junction (works without special privileges) # 5. Create skills junction (works without special privileges)
New-Item -ItemType Junction -Path "$env:OPENCODE_CONFIG_DIR\skills\superpowers" -Target "$env:OPENCODE_CONFIG_DIR\superpowers\skills" New-Item -ItemType Junction -Path "$env:USERPROFILE\.config\opencode\skills\superpowers" -Target "$env:USERPROFILE\.config\opencode\superpowers\skills"
# 6. Restart OpenCode # 6. Restart OpenCode
``` ```
@@ -124,23 +115,21 @@ New-Item -ItemType Junction -Path "$env:OPENCODE_CONFIG_DIR\skills\superpowers"
Note: Git Bash's native `ln` command copies files instead of creating symlinks. Use `cmd //c mklink` instead (the `//c` is Git Bash syntax for `/c`). Note: Git Bash's native `ln` command copies files instead of creating symlinks. Use `cmd //c mklink` instead (the `//c` is Git Bash syntax for `/c`).
```bash ```bash
OPENCODE_CONFIG_DIR="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}"
# 1. Install Superpowers # 1. Install Superpowers
git clone https://github.com/obra/superpowers.git "$OPENCODE_CONFIG_DIR/superpowers" git clone https://github.com/obra/superpowers.git ~/.config/opencode/superpowers
# 2. Create directories # 2. Create directories
mkdir -p "$OPENCODE_CONFIG_DIR/plugins" "$OPENCODE_CONFIG_DIR/skills" mkdir -p ~/.config/opencode/plugins ~/.config/opencode/skills
# 3. Remove existing links (safe for reinstalls) # 3. Remove existing links (safe for reinstalls)
rm -f "$OPENCODE_CONFIG_DIR/plugins/superpowers.js" 2>/dev/null rm -f ~/.config/opencode/plugins/superpowers.js 2>/dev/null
rm -rf "$OPENCODE_CONFIG_DIR/skills/superpowers" 2>/dev/null rm -rf ~/.config/opencode/skills/superpowers 2>/dev/null
# 4. Create plugin symlink (requires Developer Mode or Admin) # 4. Create plugin symlink (requires Developer Mode or Admin)
cmd //c "mklink \"$(cygpath -w "$OPENCODE_CONFIG_DIR/plugins/superpowers.js")\" \"$(cygpath -w "$OPENCODE_CONFIG_DIR/superpowers/.opencode/plugins/superpowers.js")\"" cmd //c "mklink \"$(cygpath -w ~/.config/opencode/plugins/superpowers.js)\" \"$(cygpath -w ~/.config/opencode/superpowers/.opencode/plugins/superpowers.js)\""
# 5. Create skills junction (works without special privileges) # 5. Create skills junction (works without special privileges)
cmd //c "mklink /J \"$(cygpath -w "$OPENCODE_CONFIG_DIR/skills/superpowers")\" \"$(cygpath -w "$OPENCODE_CONFIG_DIR/superpowers/skills")\"" cmd //c "mklink /J \"$(cygpath -w ~/.config/opencode/skills/superpowers)\" \"$(cygpath -w ~/.config/opencode/superpowers/skills)\""
# 6. Restart OpenCode # 6. Restart OpenCode
``` ```
@@ -153,16 +142,14 @@ If running OpenCode inside WSL, use the [macOS / Linux](#macos--linux) instructi
**Command Prompt:** **Command Prompt:**
```cmd ```cmd
if not defined OPENCODE_CONFIG_DIR set OPENCODE_CONFIG_DIR=%USERPROFILE%\.config\opencode dir /AL "%USERPROFILE%\.config\opencode\plugins"
dir /AL "%OPENCODE_CONFIG_DIR%\plugins" dir /AL "%USERPROFILE%\.config\opencode\skills"
dir /AL "%OPENCODE_CONFIG_DIR%\skills"
``` ```
**PowerShell:** **PowerShell:**
```powershell ```powershell
if (-not $env:OPENCODE_CONFIG_DIR) { $env:OPENCODE_CONFIG_DIR = "$env:USERPROFILE\.config\opencode" } Get-ChildItem "$env:USERPROFILE\.config\opencode\plugins" | Where-Object { $_.LinkType }
Get-ChildItem "$env:OPENCODE_CONFIG_DIR\plugins" | Where-Object { $_.LinkType } Get-ChildItem "$env:USERPROFILE\.config\opencode\skills" | Where-Object { $_.LinkType }
Get-ChildItem "$env:OPENCODE_CONFIG_DIR\skills" | Where-Object { $_.LinkType }
``` ```
Look for `<SYMLINK>` or `<JUNCTION>` in the output. Look for `<SYMLINK>` or `<JUNCTION>` in the output.
@@ -199,14 +186,13 @@ use skill tool to load superpowers/brainstorming
### Personal Skills ### Personal Skills
Create your own skills in your OpenCode skills directory: Create your own skills in `~/.config/opencode/skills/`:
```bash ```bash
OPENCODE_CONFIG_DIR="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}" mkdir -p ~/.config/opencode/skills/my-skill
mkdir -p "$OPENCODE_CONFIG_DIR/skills/my-skill"
``` ```
Create a `SKILL.md` in that directory: Create `~/.config/opencode/skills/my-skill/SKILL.md`:
```markdown ```markdown
--- ---
@@ -257,7 +243,7 @@ The plugin automatically injects superpowers context via the `experimental.chat.
### Native Skills Integration ### Native Skills Integration
Superpowers uses OpenCode's native `skill` tool for skill discovery and loading. Skills are symlinked into the skills directory so they appear alongside your personal and project skills. Superpowers uses OpenCode's native `skill` tool for skill discovery and loading. Skills are symlinked into `~/.config/opencode/skills/superpowers/` so they appear alongside your personal and project skills.
### Tool Mapping ### Tool Mapping
@@ -272,7 +258,7 @@ Skills written for Claude Code are automatically adapted for OpenCode. The boots
### Plugin Structure ### Plugin Structure
**Location:** `$OPENCODE_CONFIG_DIR/superpowers/.opencode/plugins/superpowers.js` **Location:** `~/.config/opencode/superpowers/.opencode/plugins/superpowers.js`
**Components:** **Components:**
- `experimental.chat.system.transform` hook for bootstrap injection - `experimental.chat.system.transform` hook for bootstrap injection
@@ -280,15 +266,14 @@ Skills written for Claude Code are automatically adapted for OpenCode. The boots
### Skills ### Skills
**Location:** `$OPENCODE_CONFIG_DIR/skills/superpowers/` (symlink to `$OPENCODE_CONFIG_DIR/superpowers/skills/`) **Location:** `~/.config/opencode/skills/superpowers/` (symlink to `~/.config/opencode/superpowers/skills/`)
Skills are discovered by OpenCode's native skill system. Each skill has a `SKILL.md` file with YAML frontmatter. Skills are discovered by OpenCode's native skill system. Each skill has a `SKILL.md` file with YAML frontmatter.
## Updating ## Updating
```bash ```bash
OPENCODE_CONFIG_DIR="${OPENCODE_CONFIG_DIR:-$HOME/.config/opencode}" cd ~/.config/opencode/superpowers
cd "$OPENCODE_CONFIG_DIR/superpowers"
git pull git pull
``` ```
@@ -298,14 +283,14 @@ Restart OpenCode to load the updates.
### Plugin not loading ### Plugin not loading
1. Check plugin exists: `ls $OPENCODE_CONFIG_DIR/superpowers/.opencode/plugins/superpowers.js` 1. Check plugin exists: `ls ~/.config/opencode/superpowers/.opencode/plugins/superpowers.js`
2. Check symlink/junction: `ls -l $OPENCODE_CONFIG_DIR/plugins/` (macOS/Linux) or `dir /AL "%OPENCODE_CONFIG_DIR%\plugins"` (Windows) 2. Check symlink/junction: `ls -l ~/.config/opencode/plugins/` (macOS/Linux) or `dir /AL %USERPROFILE%\.config\opencode\plugins` (Windows)
3. Check OpenCode logs: `opencode run "test" --print-logs --log-level DEBUG` 3. Check OpenCode logs: `opencode run "test" --print-logs --log-level DEBUG`
4. Look for plugin loading message in logs 4. Look for plugin loading message in logs
### Skills not found ### Skills not found
1. Verify skills symlink: `ls -l $OPENCODE_CONFIG_DIR/skills/superpowers` (should point to superpowers/skills/) 1. Verify skills symlink: `ls -l ~/.config/opencode/skills/superpowers` (should point to superpowers/skills/)
2. Use OpenCode's `skill` tool to list available skills 2. Use OpenCode's `skill` tool to list available skills
3. Check skill structure: each skill needs a `SKILL.md` file with valid frontmatter 3. Check skill structure: each skill needs a `SKILL.md` file with valid frontmatter
@@ -317,7 +302,7 @@ If you see `Cannot find module` errors on Windows:
### Bootstrap not appearing ### Bootstrap not appearing
1. Verify using-superpowers skill exists: `ls $OPENCODE_CONFIG_DIR/superpowers/skills/using-superpowers/SKILL.md` 1. Verify using-superpowers skill exists: `ls ~/.config/opencode/superpowers/skills/using-superpowers/SKILL.md`
2. Check OpenCode version supports `experimental.chat.system.transform` hook 2. Check OpenCode version supports `experimental.chat.system.transform` hook
3. Restart OpenCode after plugin changes 3. Restart OpenCode after plugin changes

6
package.json Normal file
View File

@@ -0,0 +1,6 @@
{
"name": "superpowers",
"version": "5.0.3",
"type": "module",
"main": ".opencode/plugins/superpowers.js"
}