Files
ECC/scripts/lib/install-state-store-sync.js
T
1db5c8ab4a 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>
2026-08-13 16:42:51 -04:00

64 lines
1.5 KiB
JavaScript

'use strict';
const {
createStateStore,
projectInstallState,
reconcileCurrentInstallState,
} = require('./state-store');
function openFailure(error) {
return {
status: 'warning',
warningCount: 1,
warnings: [{
code: 'projection-open-failed',
message: error.message,
}],
warning: {
code: 'projection-open-failed',
message: error.message,
},
};
}
async function withStateStore(options, operation) {
const openStore = options.createStore || createStateStore;
let store;
try {
store = await openStore({
dbPath: options.dbPath,
homeDir: options.homeDir,
});
return operation(store);
} catch (error) {
return openFailure(error);
} finally {
if (store) {
try {
store.close();
} catch (_error) {
// Projection is a derived cache. A close failure must not invalidate
// the canonical JSON install-state or a completed file operation.
}
}
}
}
async function projectCanonicalInstallState(state, options = {}) {
return withStateStore(options, store => projectInstallState(store, state));
}
async function reconcileCanonicalInstallStates(options = {}) {
return withStateStore(options, store => reconcileCurrentInstallState(store, {
homeDir: options.homeDir,
projectRoot: options.projectRoot,
targets: options.targets,
discoverInstalledStates: options.discoverInstalledStates,
}));
}
module.exports = {
projectCanonicalInstallState,
reconcileCanonicalInstallStates,
};