@yemi33/minions 0.1.2333 → 0.1.2334

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/engine/projects.js +34 -1
  2. package/package.json +1 -1
@@ -125,7 +125,10 @@ function _requeueProjectlessCentralWorkItems(itemIds) {
125
125
  * @param {object} [options]
126
126
  * @param {'archive'|'keep'|'purge'} [options.dataMode='archive']
127
127
  * archive: move projects/<name>/ to projects/.archived/<name>-YYYYMMDD/
128
- * keep: leave projects/<name>/ in place
128
+ * keep: leave projects/<name>/ in place, but tombstone work-items.json /
129
+ * pull-requests.json into projects/<name>/.dropped/ so dropScope()
130
+ * (step 9) isn't immediately undone by the *-store.js resync-on-
131
+ * read path re-hydrating the still-present JSON (W-mr96oira000g979a)
129
132
  * purge: rm -rf projects/<name>/
130
133
  * @returns {object} summary { ok, project, cancelledItems, killedAgents,
131
134
  * drainedDispatches, cleanedWorktrees, disabledSchedules, archivedTo,
@@ -145,6 +148,7 @@ function removeProject(target, options = {}) {
145
148
  pipelineRefs: [],
146
149
  archivedTo: null,
147
150
  purgedDataDir: false,
151
+ tombstonedDataFiles: false,
148
152
  // P-bfa2d-remove-project-cleanup — soft-delete tag counts for entries in
149
153
  // the three central state files that survived the hard-cancel passes
150
154
  // (steps 1, 2). See step 7.5 for the orphan-tag policy rationale.
@@ -427,6 +431,35 @@ function removeProject(target, options = {}) {
427
431
  summary.archiveError = e.code ? `${e.code}: ${e.message}` : e.message;
428
432
  summary.warnings.push('archive data dir: ' + e.message);
429
433
  }
434
+ } else if (dataMode === 'keep') {
435
+ // W-mr96oira000g979a — 'keep' leaves projects/<name>/ (and therefore
436
+ // work-items.json / pull-requests.json) at its normal, live-resolving
437
+ // path. dropScope() below DELETEs the SQL rows for this scope, but the
438
+ // *-store.js resync-on-read path (_resyncScopeIfJsonDiverged) treats a
439
+ // scope with an empty SQL table + a still-present JSON file as a
440
+ // fresh-install first-touch and re-hydrates straight from that JSON —
441
+ // silently undoing the drop the very next time anything reads this
442
+ // scope. Tombstone the two live-state files into a `.dropped/`
443
+ // subdirectory so `_filePathForScope(scope)` (and the read-side
444
+ // resync/fallback logic keyed off it) no longer resolves to them,
445
+ // while keeping the historical data on disk for manual inspection —
446
+ // exactly what 'keep' promises, minus the auto-resurrection.
447
+ try {
448
+ const droppedDir = path.join(dataDir, '.dropped');
449
+ const stamp = new Date().toISOString().replace(/[:.]/g, '-');
450
+ for (const fname of ['work-items.json', 'pull-requests.json']) {
451
+ const src = path.join(dataDir, fname);
452
+ if (!fs.existsSync(src)) continue;
453
+ fs.mkdirSync(droppedDir, { recursive: true });
454
+ let dest = path.join(droppedDir, `${fname}.${stamp}`);
455
+ let n = 1;
456
+ while (fs.existsSync(dest)) dest = path.join(droppedDir, `${fname}.${stamp}-${++n}`);
457
+ _renameWithRetry(src, dest);
458
+ summary.tombstonedDataFiles = true;
459
+ }
460
+ } catch (e) {
461
+ summary.warnings.push('tombstone kept data files: ' + e.message);
462
+ }
430
463
  }
431
464
  }
432
465
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.2333",
3
+ "version": "0.1.2334",
4
4
  "description": "Multi-agent AI dev team that runs from ~/.minions/ — five autonomous agents share a single engine, dashboard, and knowledge base",
5
5
  "bin": {
6
6
  "minions": "bin/minions.js"