mirror of
https://github.com/affaan-m/ECC.git
synced 2026-10-15 04:35:29 +02:00
30 lines
988 B
JavaScript
30 lines
988 B
JavaScript
'use strict';
|
|
|
|
const { adaptAntigravityAgent } = require('./antigravity-agent');
|
|
|
|
function transformInstallContent(operation, content) {
|
|
if (!operation.contentTransform) {
|
|
return content;
|
|
}
|
|
if (operation.contentTransform === 'antigravity-agent-frontmatter') {
|
|
return adaptAntigravityAgent(content, operation.sourceRelativePath);
|
|
}
|
|
if (operation.contentTransform === 'opencode-home-skills-path') {
|
|
const config = JSON.parse(content);
|
|
if (!Array.isArray(config?.skills?.paths) || !config.skills.paths.includes('../skills')) {
|
|
return content;
|
|
}
|
|
const installedConfig = {
|
|
...config,
|
|
skills: {
|
|
...config.skills,
|
|
paths: config.skills.paths.map(skillPath => skillPath === '../skills' ? './skills' : skillPath),
|
|
},
|
|
};
|
|
return `${JSON.stringify(installedConfig, null, 2)}\n`;
|
|
}
|
|
throw new Error(`Unknown install content transform: ${operation.contentTransform}`);
|
|
}
|
|
|
|
module.exports = { transformInstallContent };
|