Files
superpowers-lite/.opencode/plugins/superpowers.js
2026-05-12 16:05:03 +08:00

30 lines
1.0 KiB
JavaScript

/**
* Superpowers Lite plugin for OpenCode.ai
*
* Auto-registers the skills directory via config hook (no symlinks needed).
* Does not inject bootstrap context; this fork is manual-only.
*/
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export const SuperpowersPlugin = async () => {
const superpowersSkillsDir = path.resolve(__dirname, '../../skills');
return {
// Inject skills path into live config so OpenCode discovers superpowers skills
// without requiring manual symlinks or config file edits.
// This works because Config.get() returns a cached singleton — modifications
// here are visible when skills are lazily discovered later.
config: async (config) => {
config.skills = config.skills || {};
config.skills.paths = config.skills.paths || [];
if (!config.skills.paths.includes(superpowersSkillsDir)) {
config.skills.paths.push(superpowersSkillsDir);
}
}
};
};