summaryrefslogtreecommitdiff
path: root/.opencode/plugin
diff options
context:
space:
mode:
authorJesse Vincent <jesse@fsck.com>2026-01-23 18:31:45 +0000
committerJesse Vincent <jesse@fsck.com>2026-01-23 18:31:45 +0000
commit03087b13b87a5813bdc96afa8c5468ed2f63d596 (patch)
treef4045330f85b1eb4ab732e9b5b10d8c2cf44ba82 /.opencode/plugin
parent493ac18dfe2d30e34c05277d9e130988ed290f67 (diff)
fix(opencode): standardize on plugins/ directory per official docs
OpenCode officially documents ~/.config/opencode/plugins/ (plural) as the plugin directory. Our docs previously used plugin/ (singular), which also works but caused confusion. Changes: - Renamed .opencode/plugin/ to .opencode/plugins/ in repo structure - Updated INSTALL.md to use plugins/ everywhere - Updated README.opencode.md (all platforms: Linux, macOS, Windows CMD, PowerShell, Git Bash) to use plugins/ - Updated test scripts to match Tested: Both singular and plural forms work, but we now match official docs. Fixes #343 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to '.opencode/plugin')
-rw-r--r--.opencode/plugin/superpowers.js95
1 files changed, 0 insertions, 95 deletions
diff --git a/.opencode/plugin/superpowers.js b/.opencode/plugin/superpowers.js
deleted file mode 100644
index 8ac9934..0000000
--- a/.opencode/plugin/superpowers.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Superpowers plugin for OpenCode.ai
- *
- * Injects superpowers bootstrap context via system prompt transform.
- * Skills are discovered via OpenCode's native skill tool from symlinked directory.
- */
-
-import path from 'path';
-import fs from 'fs';
-import os from 'os';
-import { fileURLToPath } from 'url';
-
-const __dirname = path.dirname(fileURLToPath(import.meta.url));
-
-// Simple frontmatter extraction (avoid dependency on skills-core for bootstrap)
-const extractAndStripFrontmatter = (content) => {
- const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
- if (!match) return { frontmatter: {}, content };
-
- const frontmatterStr = match[1];
- const body = match[2];
- const frontmatter = {};
-
- for (const line of frontmatterStr.split('\n')) {
- const colonIdx = line.indexOf(':');
- if (colonIdx > 0) {
- const key = line.slice(0, colonIdx).trim();
- const value = line.slice(colonIdx + 1).trim().replace(/^["']|["']$/g, '');
- frontmatter[key] = value;
- }
- }
-
- return { frontmatter, content: body };
-};
-
-// Normalize a path: trim whitespace, expand ~, resolve to absolute
-const normalizePath = (p, homeDir) => {
- if (!p || typeof p !== 'string') return null;
- let normalized = p.trim();
- if (!normalized) return null;
- if (normalized.startsWith('~/')) {
- normalized = path.join(homeDir, normalized.slice(2));
- } else if (normalized === '~') {
- normalized = homeDir;
- }
- return path.resolve(normalized);
-};
-
-export const SuperpowersPlugin = async ({ client, directory }) => {
- const homeDir = os.homedir();
- const superpowersSkillsDir = path.resolve(__dirname, '../../skills');
- const envConfigDir = normalizePath(process.env.OPENCODE_CONFIG_DIR, homeDir);
- const configDir = envConfigDir || path.join(homeDir, '.config/opencode');
-
- // Helper to generate bootstrap content
- const getBootstrapContent = () => {
- // Try to load using-superpowers skill
- const skillPath = path.join(superpowersSkillsDir, 'using-superpowers', 'SKILL.md');
- if (!fs.existsSync(skillPath)) return null;
-
- const fullContent = fs.readFileSync(skillPath, 'utf8');
- const { content } = extractAndStripFrontmatter(fullContent);
-
- const toolMapping = `**Tool Mapping for OpenCode:**
-When skills reference tools you don't have, substitute OpenCode equivalents:
-- \`TodoWrite\` → \`update_plan\`
-- \`Task\` tool with subagents → Use OpenCode's subagent system (@mention)
-- \`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>
-You have superpowers.
-
-**IMPORTANT: The using-superpowers skill content is included below. It is ALREADY LOADED - you are currently following it. Do NOT use the skill tool to load "using-superpowers" again - that would be redundant.**
-
-${content}
-
-${toolMapping}
-</EXTREMELY_IMPORTANT>`;
- };
-
- return {
- // Use system prompt transform to inject bootstrap (fixes #226 agent reset bug)
- 'experimental.chat.system.transform': async (_input, output) => {
- const bootstrap = getBootstrapContent();
- if (bootstrap) {
- (output.system ||= []).push(bootstrap);
- }
- }
- };
-};