opencode-antigravity-config 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/main.js +17 -1
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -220,7 +220,23 @@ ipcMain.on('start-install', async (ev, config) => {
220
220
  const ds = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
221
221
  const bd = path.join(configDir, `.backup-${ds}`);
222
222
  const ef = fs.readdirSync(configDir).filter(f => f.endsWith('.json') || f.endsWith('.jsonc'));
223
- if (ef.length) { sendLog('info', 'Backing up...'); fs.mkdirSync(bd); for (const f of ef) { fs.copyFileSync(path.join(configDir, f), path.join(bd, f)); sendLog('info', `Backed up: ${f}`); await new Promise(r => setTimeout(r, 60)); } sendLog('success', `Backup: ${path.basename(bd)}`); }
223
+ if (ef.length) {
224
+ sendLog('info', 'Backing up...'); fs.mkdirSync(bd);
225
+ for (const f of ef) { fs.copyFileSync(path.join(configDir, f), path.join(bd, f)); sendLog('info', `Backed up: ${f}`); await new Promise(r => setTimeout(r, 60)); }
226
+ sendLog('success', `Backup: ${path.basename(bd)}`);
227
+ // Auto-cleanup old backups (Keep last 3)
228
+ try {
229
+ const backups = fs.readdirSync(configDir).filter(d => (d.startsWith('.backup-') || d.startsWith('.uninstall-backup-')) && fs.statSync(path.join(configDir, d)).isDirectory()).sort((a, b) => b.localeCompare(a));
230
+ if (backups.length > 3) {
231
+ const toRemove = backups.slice(3);
232
+ sendLog('info', `Cleaning ${toRemove.length} old backup(s)...`);
233
+ toRemove.forEach(rmBase => {
234
+ fs.rmSync(path.join(configDir, rmBase), { recursive: true, force: true });
235
+ sendLog('info', `Deleted: ${rmBase}`);
236
+ });
237
+ }
238
+ } catch (ce) { sendLog('warn', `Cleanup skipped: ${ce.message}`); }
239
+ }
224
240
  }
225
241
  sendProgress(25); await new Promise(r => setTimeout(r, 100));
226
242
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-antigravity-config",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "GUI installer for Antigravity OpenCode configuration",
5
5
  "main": "main.js",
6
6
  "bin": {