{"version":3,"file":"skill-migration.d.ts","sourceRoot":"","sources":["../../src/core/skill-migration.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,qBAAqB;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACpB;AAMD,wBAAgB,qBAAqB,CAAC,GAAG,SAAgB,EAAE,QAAQ,SAAgB,GAAG,qBAAqB,EAAE,CAsB5G;AAED,wBAAgB,mBAAmB,CAClC,GAAG,SAAgB,EACnB,QAAQ,SAAgB,GACtB;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,qBAAqB,EAAE,CAAA;CAAE,CAEvD;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhE","sourcesContent":["import { createHash } from \"node:crypto\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { getAgentDir } from \"../config.js\";\nimport { loadSkills } from \"./skills.js\";\nimport { validateSkillAgentReferences } from \"./subagent-registry.js\";\n\nexport interface SkillMigrationPreview {\n\tsourceSkillPath: string;\n\teffectivePrecedence: string;\n\treferencedAgents: string[];\n\tunresolvedReferences: string[];\n\tstaleAliases: string[];\n\tmodelChanges: string[];\n\tpermissionChanges: string[];\n\tproposedEdits: string[];\n\tcontentHash: string;\n}\n\nfunction hash(content: string): string {\n\treturn createHash(\"sha256\").update(content).digest(\"hex\");\n}\n\nexport function previewSkillMigration(cwd = process.cwd(), agentDir = getAgentDir()): SkillMigrationPreview[] {\n\tconst loaded = loadSkills({ cwd, agentDir });\n\treturn loaded.skills\n\t\t.filter((skill) => skill.name === \"cavecrew\" || skill.filePath.includes(\"cavecrew\"))\n\t\t.map((skill) => {\n\t\t\tconst content = readFileSync(skill.filePath, \"utf8\");\n\t\t\tconst diagnostics = validateSkillAgentReferences(skill.name, skill.filePath, content);\n\t\t\tconst referencedAgents = [...new Set(content.match(/cavecrew-[a-z0-9-]+|planner|worker/gu) ?? [])];\n\t\t\treturn {\n\t\t\t\tsourceSkillPath: skill.filePath,\n\t\t\t\teffectivePrecedence: skill.source === \"user\" ? \"user shadows packaged\" : skill.source,\n\t\t\t\treferencedAgents,\n\t\t\t\tunresolvedReferences: diagnostics.map((diagnostic) => diagnostic.missingAgent ?? \"unknown\"),\n\t\t\t\tstaleAliases: referencedAgents.filter(\n\t\t\t\t\t(agent) => agent === \"cavecrew-investigate\" || agent === \"cavecrew-build\",\n\t\t\t\t),\n\t\t\t\tmodelChanges: [],\n\t\t\t\tpermissionChanges: [],\n\t\t\t\tproposedEdits: [],\n\t\t\t\tcontentHash: hash(content),\n\t\t\t};\n\t\t});\n}\n\nexport function applySkillMigration(\n\tcwd = process.cwd(),\n\tagentDir = getAgentDir(),\n): { applied: false; previews: SkillMigrationPreview[] } {\n\treturn { applied: false, previews: previewSkillMigration(cwd, agentDir) };\n}\n\nexport function packagedCavecrewPath(packageRoot: string): string {\n\treturn join(packageRoot, \"skills\", \"cavecrew\", \"SKILL.md\");\n}\n\nexport function skillMigrationSourceExists(path: string): boolean {\n\treturn existsSync(path);\n}\n"]}