Skip to content

An agentic skills framework & software development methodology that works.

refactor: convert skills-core and plugin to pure ESM for module compatibility

Jesse Vincentd92de2815033
diff --git a/.opencode/plugin/superpowers.js b/.opencode/plugin/superpowers.js
index a9c7467f7..015dc282b 100644
--- a/.opencode/plugin/superpowers.js
+++ b/.opencode/plugin/superpowers.js
@@ -8,18 +8,14 @@
import path from 'path';
import fs from 'fs';
import os from 'os';
-import { createRequire } from 'module';
import { fileURLToPath } from 'url';
+import * as skillsCore from '../../lib/skills-core.js';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export const SuperpowersPlugin = async ({ project, client, $, directory, worktree }) => {
const { z } = await import('zod');
- // Load CommonJS skills-core using require inside the async function
- const require = createRequire(import.meta.url);
- const skillsCore = require(path.join(__dirname, '../../lib/skills-core.js'));
-
const homeDir = os.homedir();
const superpowersSkillsDir = path.join(homeDir, '.config/opencode/superpowers/skills');
const personalSkillsDir = path.join(homeDir, '.config/opencode/skills');
diff --git a/lib/skills-core.js b/lib/skills-core.js
index c77c26ff4..5e5bb7012 100644
--- a/lib/skills-core.js
+++ b/lib/skills-core.js
@@ -1,6 +1,6 @@
-const fs = require('fs');
-const path = require('path');
-const { execSync } = require('child_process');
+import fs from 'fs';
+import path from 'path';
+import { execSync } from 'child_process';
/**
* Extract YAML frontmatter from a skill file.
@@ -199,7 +199,7 @@ function stripFrontmatter(content) {
return contentLines.join('\n').trim();
}
-module.exports = {
+export {
extractFrontmatter,
findSkillsInDir,
resolveSkillPath,