mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-25 11:05:16 +02:00
Make Antigravity 2.0 installs native and safely migrate legacy state. Ensure doctor, repair, status projection, repeat installs, legacy Codex sync, and uninstall converge without losing user files. Exclude Python bytecode and harden repo-scan bootstrap guidance. Gate publishing and pull-request merges on one exact packed artifact completing install, repeat, drift, repair, status, and uninstall across Linux, macOS, and Windows. Co-authored-by: lorencifernando-coder <lorenci.fernando@gmail.com> Co-authored-by: Suliman Abdulrazzaq <suliman9000a@gmail.com> Co-authored-by: Wu Shuwen <mikewushuwen@outlook.com>
119 lines
3.7 KiB
JavaScript
119 lines
3.7 KiB
JavaScript
const path = require('path');
|
|
|
|
const {
|
|
createFlatRuleOperations,
|
|
createInstallTargetAdapter,
|
|
createManagedOperation,
|
|
createManagedScaffoldOperation,
|
|
normalizeRelativePath,
|
|
} = require('./helpers');
|
|
|
|
const SUPPORTED_SOURCE_PREFIXES = ['rules', 'commands', 'agents', 'skills'];
|
|
|
|
function supportsAntigravitySourcePath(sourceRelativePath) {
|
|
const normalizedPath = normalizeRelativePath(sourceRelativePath);
|
|
return SUPPORTED_SOURCE_PREFIXES.some(prefix => (
|
|
normalizedPath === prefix || normalizedPath.startsWith(`${prefix}/`)
|
|
));
|
|
}
|
|
|
|
module.exports = createInstallTargetAdapter({
|
|
id: 'antigravity-project',
|
|
target: 'antigravity',
|
|
kind: 'project',
|
|
rootSegments: ['.agents'],
|
|
installStatePathSegments: ['ecc-install-state.json'],
|
|
supportsModule(module) {
|
|
const paths = Array.isArray(module && module.paths) ? module.paths : [];
|
|
return paths.length > 0;
|
|
},
|
|
planOperations(input, adapter) {
|
|
const modules = Array.isArray(input.modules)
|
|
? input.modules
|
|
: (input.module ? [input.module] : []);
|
|
const {
|
|
repoRoot,
|
|
projectRoot,
|
|
homeDir,
|
|
} = input;
|
|
const planningInput = {
|
|
repoRoot,
|
|
projectRoot,
|
|
homeDir,
|
|
};
|
|
const targetRoot = adapter.resolveRoot(planningInput);
|
|
|
|
return modules.flatMap(module => {
|
|
const paths = Array.isArray(module.paths) ? module.paths : [];
|
|
return paths
|
|
.filter(supportsAntigravitySourcePath)
|
|
.flatMap(sourceRelativePath => {
|
|
const normalizedSourcePath = normalizeRelativePath(sourceRelativePath);
|
|
|
|
if (normalizedSourcePath === 'rules') {
|
|
return createFlatRuleOperations({
|
|
moduleId: module.id,
|
|
repoRoot,
|
|
sourceRelativePath: normalizedSourcePath,
|
|
destinationDir: path.join(targetRoot, 'rules'),
|
|
});
|
|
}
|
|
|
|
if (
|
|
normalizedSourcePath === 'commands'
|
|
|| normalizedSourcePath.startsWith('commands/')
|
|
) {
|
|
const commandRelativePath = normalizedSourcePath === 'commands'
|
|
? ''
|
|
: normalizedSourcePath.slice('commands/'.length);
|
|
return [
|
|
createManagedScaffoldOperation(
|
|
module.id,
|
|
normalizedSourcePath,
|
|
path.join(targetRoot, 'workflows', commandRelativePath),
|
|
'preserve-relative-path'
|
|
),
|
|
];
|
|
}
|
|
|
|
if (
|
|
normalizedSourcePath === 'agents'
|
|
|| normalizedSourcePath.startsWith('agents/')
|
|
) {
|
|
const agentRelativePath = normalizedSourcePath === 'agents'
|
|
? ''
|
|
: normalizedSourcePath.slice('agents/'.length);
|
|
return [
|
|
createManagedOperation({
|
|
moduleId: module.id,
|
|
sourceRelativePath: normalizedSourcePath,
|
|
destinationPath: path.join(targetRoot, 'agents', agentRelativePath),
|
|
strategy: 'preserve-relative-path',
|
|
contentTransform: 'antigravity-agent-frontmatter',
|
|
}),
|
|
];
|
|
}
|
|
|
|
if (
|
|
normalizedSourcePath === 'skills'
|
|
|| normalizedSourcePath.startsWith('skills/')
|
|
) {
|
|
const skillRelativePath = normalizedSourcePath === 'skills'
|
|
? ''
|
|
: normalizedSourcePath.slice('skills/'.length);
|
|
return [
|
|
createManagedScaffoldOperation(
|
|
module.id,
|
|
normalizedSourcePath,
|
|
path.join(targetRoot, 'skills', skillRelativePath),
|
|
'preserve-relative-path'
|
|
),
|
|
];
|
|
}
|
|
|
|
return [];
|
|
});
|
|
});
|
|
},
|
|
});
|