mirror of
https://github.com/affaan-m/ECC.git
synced 2026-10-30 20:35:18 +00:00
The copilot project target installed only skills and agents, dropping the entire rules/ tree even though Copilot CLI and VS Code read path-specific instructions from .github/instructions/**/*.instructions.md. Plan each rules/**/*.md file into .github/instructions/ecc/ as an .instructions.md file and add a copilot-rule-frontmatter transform that maps the Claude-style `paths:` list onto Copilot's `applyTo:` glob list. Rules without `paths:` become applyTo: "**", matching their always-on semantics in Claude Code. rules/README.md documents the rule set and is not installed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
64 lines
2.8 KiB
JavaScript
64 lines
2.8 KiB
JavaScript
'use strict';
|
|
|
|
const { stripPluginNamespace } = require('./plugin-namespace');
|
|
const { adaptAntigravityAgent } = require('./antigravity-agent');
|
|
const { adaptCopilotAgent } = require('./copilot-agent');
|
|
const { adaptCopilotRule } = require('./copilot-rule');
|
|
const { disableOpenCodeHookPluginRegistration, getDisabledOpenCodePluginContent } = require('./hook-consent');
|
|
|
|
function rewriteCopilotWorkflowPaths(content, sourceRelativePath) {
|
|
if (!/\.md$/i.test(sourceRelativePath)) return content;
|
|
// Commands run from the installed project root. Rewrite only the supported
|
|
// helper entrypoint, leaving unrelated project scripts and URLs untouched.
|
|
return content.replace(/(^|[\s`"'(])scripts\/setup-package-manager\.js\b/g,
|
|
'$1.github/ecc/scripts/setup-package-manager.js');
|
|
}
|
|
|
|
function transformInstallContent(operation, content) {
|
|
if (!operation.contentTransform) {
|
|
return content;
|
|
}
|
|
if (operation.contentTransform === 'claude-manual-plugin-namespace') {
|
|
return stripPluginNamespace(content);
|
|
}
|
|
if (operation.contentTransform === 'qwen-agent-frontmatter') {
|
|
return require('../../qwen-adapt-agents').adaptFrontmatter(content).text;
|
|
}
|
|
if (operation.contentTransform === 'antigravity-agent-frontmatter') {
|
|
return adaptAntigravityAgent(content, operation.sourceRelativePath);
|
|
}
|
|
if (operation.contentTransform === 'copilot-agent-frontmatter') {
|
|
return rewriteCopilotWorkflowPaths(adaptCopilotAgent(content, operation.sourceRelativePath), operation.sourceRelativePath);
|
|
}
|
|
if (operation.contentTransform === 'copilot-workflow-paths') {
|
|
return rewriteCopilotWorkflowPaths(content, operation.sourceRelativePath);
|
|
}
|
|
if (operation.contentTransform === 'copilot-rule-frontmatter') {
|
|
return adaptCopilotRule(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 };
|