import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const bundledSkillsDir = path.join(__dirname, "skills");
const repoSkillsDir = path.join(__dirname, "..", "skills");
const skillsDir = fs.existsSync(bundledSkillsDir) ? bundledSkillsDir : repoSkillsDir;
const hooks = () => ({
config: async (config) => {
config.skills = config.skills || {};
config.skills.paths = config.skills.paths || [];
if (!config.skills.paths.includes(skillsDir)) {
config.skills.paths.push(skillsDir);
}
config.mcp = config.mcp || {};
if (!config.mcp.basemind) {
config.mcp.basemind = {
type: "local",
command: ["basemind", "serve"],
enabled: true,
};
}
},
});
export const BasemindPlugin = async () => hooks();
export default async () => hooks();