{"version":3,"file":"index.mjs","names":[],"sources":["../src/plugins/skill-loader.ts"],"sourcesContent":["/**\n * Plugin Path Utilities\n *\n * Locates the bundled connector-building plugin and lists its skills.\n * `stackone agent sync` copies the plugin into a project, where Claude Code\n * loads the skills natively.\n */\n\nimport { existsSync, readdirSync, statSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\n/**\n * Get the path to the bundled plugin directory.\n *\n * This plugin contains all bundled skills; `stackone agent sync` copies it\n * into a project for Claude Code to load.\n *\n * @returns Absolute path to the plugin directory\n */\nexport function getBundledPluginPath(): string {\n    // Handle both ESM and CJS module resolution\n    const currentFile = fileURLToPath(import.meta.url);\n    const currentDir = dirname(currentFile);\n\n    // When bundled, output is in dist/index.mjs - go up one level to package root\n    // When running from source, we're in src/plugins - go up two levels\n    const distPath = join(currentDir, '..', 'plugin');\n    const srcPath = join(currentDir, '..', '..', 'plugin');\n\n    // Check which path exists\n    if (existsSync(distPath)) {\n        return distPath;\n    }\n    return srcPath;\n}\n\n/**\n * Get the path to bundled skills directory (inside the plugin).\n *\n * @returns Absolute path to the skills directory\n */\nexport function getBundledSkillsPath(): string {\n    return join(getBundledPluginPath(), 'skills');\n}\n\n/**\n * Get all available bundled skill names.\n *\n * @returns Array of skill directory names\n */\nexport function getAvailableSkillNames(): string[] {\n    const skillsPath = getBundledSkillsPath();\n\n    if (!existsSync(skillsPath)) {\n        return [];\n    }\n\n    try {\n        const entries = readdirSync(skillsPath);\n        return entries.filter((entry) => {\n            const fullPath = join(skillsPath, entry);\n            try {\n                const stat = statSync(fullPath);\n                if (!stat.isDirectory()) {\n                    return false;\n                }\n                // Check if it has a SKILL.md\n                return existsSync(join(fullPath, 'SKILL.md'));\n            } catch {\n                return false;\n            }\n        });\n    } catch {\n        return [];\n    }\n}\n\n/**\n * Skills available for each mode.\n *\n * Claude Code loads every skill and invokes them by context, so this\n * mapping filters nothing; it only backs the recommendations that\n * `stackone agent skills --mode` prints.\n */\nconst MODE_SKILLS: Record<string, string[]> = {\n    build: [\n        'research-provider',\n        'discover-actions',\n        'version-validation',\n        'build-connector',\n        'validate-config',\n    ],\n    test: ['test-connector', 'test-mcp-connector', 'scramble-credentials'],\n    research: ['research-provider', 'discover-actions'],\n};\n\n/**\n * Get recommended skills for a given mode.\n *\n * @param mode - The `stackone agent skills --mode` value (build, test, research)\n * @returns Array of skill names relevant to the mode\n */\nexport function getSkillsForMode(mode: string): string[] {\n    return MODE_SKILLS[mode] || [];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,uBAA+B;CAG3C,MAAM,aAAa,QADC,cAAc,OAAO,KAAK,IAAI,CACX;CAIvC,MAAM,WAAW,KAAK,YAAY,MAAM,SAAS;CACjD,MAAM,UAAU,KAAK,YAAY,MAAM,MAAM,SAAS;AAGtD,KAAI,WAAW,SAAS,CACpB,QAAO;AAEX,QAAO;;;;;;;AAQX,SAAgB,uBAA+B;AAC3C,QAAO,KAAK,sBAAsB,EAAE,SAAS;;;;;;;AAQjD,SAAgB,yBAAmC;CAC/C,MAAM,aAAa,sBAAsB;AAEzC,KAAI,CAAC,WAAW,WAAW,CACvB,QAAO,EAAE;AAGb,KAAI;AAEA,SADgB,YAAY,WAAW,CACxB,QAAQ,UAAU;GAC7B,MAAM,WAAW,KAAK,YAAY,MAAM;AACxC,OAAI;AAEA,QAAI,CADS,SAAS,SAAS,CACrB,aAAa,CACnB,QAAO;AAGX,WAAO,WAAW,KAAK,UAAU,WAAW,CAAC;WACzC;AACJ,WAAO;;IAEb;SACE;AACJ,SAAO,EAAE;;;;;;;;;;AAWjB,MAAM,cAAwC;CAC1C,OAAO;EACH;EACA;EACA;EACA;EACA;EACH;CACD,MAAM;EAAC;EAAkB;EAAsB;EAAuB;CACtE,UAAU,CAAC,qBAAqB,mBAAmB;CACtD;;;;;;;AAQD,SAAgB,iBAAiB,MAAwB;AACrD,QAAO,YAAY,SAAS,EAAE"}