mirror of
https://github.com/affaan-m/ECC.git
synced 2026-10-14 20:25:26 +02:00
42 lines
1.6 KiB
JavaScript
42 lines
1.6 KiB
JavaScript
'use strict';
|
|
|
|
const { adaptAntigravityAgent } = require('./antigravity-agent');
|
|
const { adaptCopilotAgent } = require('./copilot-agent');
|
|
const { disableOpenCodeHookPluginRegistration, getDisabledOpenCodePluginContent } = require('./hook-consent');
|
|
|
|
function transformInstallContent(operation, content) {
|
|
if (!operation.contentTransform) {
|
|
return content;
|
|
}
|
|
if (operation.contentTransform === 'antigravity-agent-frontmatter') {
|
|
return adaptAntigravityAgent(content, operation.sourceRelativePath);
|
|
}
|
|
if (operation.contentTransform === 'copilot-agent-frontmatter') {
|
|
return adaptCopilotAgent(content, operation.sourceRelativePath);
|
|
}
|
|
if (operation.contentTransform === 'opencode-disable-ecc-hooks') {
|
|
return transformInstallContent({ ...operation, contentTransform: 'opencode-home-skills-path' },
|
|
disableOpenCodeHookPluginRegistration(content, operation.sourceRelativePath));
|
|
}
|
|
if (operation.contentTransform === 'opencode-disable-plugin-entrypoint') {
|
|
return getDisabledOpenCodePluginContent();
|
|
}
|
|
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 };
|