Description
Every time discover runs, a timestamped backup of the manifest is created
(e.g. manifest.json.backup-1234567890) but old backups are never cleaned up.
On long-running systems this causes unbounded disk growth.
Affected File
Expected Behavior
Old backups should be pruned automatically — for example, keep only the last
5 backups or delete backups older than 30 days.
Suggested Fix
After creating a new backup, scan for existing backups and remove all but the
most recent N (e.g. 5):
const backups = fs.readdirSync(manifestDir)
.filter(f => f.startsWith('manifest.json.backup-'))
.sort()
.slice(0, -5); // keep last 5
backups.forEach(f => fs.unlinkSync(path.join(manifestDir, f)));
Description
Every time
discoverruns, a timestamped backup of the manifest is created(e.g.
manifest.json.backup-1234567890) but old backups are never cleaned up.On long-running systems this causes unbounded disk growth.
Affected File
src/commands/discover.jsExpected Behavior
Old backups should be pruned automatically — for example, keep only the last
5 backups or delete backups older than 30 days.
Suggested Fix
After creating a new backup, scan for existing backups and remove all but the
most recent N (e.g. 5):