mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-12 20:57:59 +02:00
fix(install): harden ECC installer lifecycle
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>
This commit is contained in:
co-authored by
lorencifernando-coder
Suliman Abdulrazzaq
Wu Shuwen
parent
eb49702651
commit
1db5c8ab4a
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
const {
|
||||
beginLegacySyncState,
|
||||
finalizeLegacySyncState,
|
||||
recordLegacySyncPath,
|
||||
rollbackLegacyCodexSync,
|
||||
} = require('../lib/codex-legacy-sync');
|
||||
|
||||
function readFlag(args, name) {
|
||||
const index = args.indexOf(name);
|
||||
return index === -1 ? null : args[index + 1] || null;
|
||||
}
|
||||
|
||||
function main(argv = process.argv.slice(2)) {
|
||||
const command = argv[0];
|
||||
if (command === 'begin') {
|
||||
const codexHome = readFlag(argv, '--codex-home');
|
||||
const backupDir = readFlag(argv, '--backup-dir');
|
||||
if (!codexHome || !backupDir) throw new Error('begin requires --codex-home and --backup-dir');
|
||||
process.stdout.write(`${beginLegacySyncState({
|
||||
codexHome,
|
||||
backupDir,
|
||||
previousHooksPath: readFlag(argv, '--previous-hooks-path') || '',
|
||||
installedHooksPath: readFlag(argv, '--installed-hooks-path'),
|
||||
})}\n`);
|
||||
return;
|
||||
}
|
||||
if (command === 'record') {
|
||||
const statePath = readFlag(argv, '--state');
|
||||
const filePath = readFlag(argv, '--path');
|
||||
if (!statePath || !filePath) throw new Error('record requires --state and --path');
|
||||
recordLegacySyncPath({ statePath, filePath });
|
||||
return;
|
||||
}
|
||||
if (command === 'finalize') {
|
||||
const statePath = readFlag(argv, '--state');
|
||||
if (!statePath) throw new Error('finalize requires --state');
|
||||
finalizeLegacySyncState({ statePath });
|
||||
return;
|
||||
}
|
||||
if (command === 'rollback') {
|
||||
const statePath = readFlag(argv, '--state');
|
||||
if (!statePath) throw new Error('rollback requires --state');
|
||||
const result = rollbackLegacyCodexSync({ statePath });
|
||||
process.stdout.write(`${JSON.stringify(result)}\n`);
|
||||
if (result.status !== 'rolled-back') process.exitCode = 1;
|
||||
return;
|
||||
}
|
||||
throw new Error('Usage: legacy-sync-state.js <begin|record|finalize|rollback> [options]');
|
||||
}
|
||||
|
||||
try {
|
||||
main();
|
||||
} catch (error) {
|
||||
process.stderr.write(`[ecc-sync] ERROR: ${error.message}\n`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
module.exports = { main, readFlag };
|
||||
Reference in New Issue
Block a user