@yemi33/minions 0.1.142 → 0.1.143

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.143 (2026-04-01)
4
+
5
+ ### Engine
6
+ - engine/shared.js
7
+
8
+ ### Other
9
+ - test/unit.test.js
10
+
3
11
  ## 0.1.142 (2026-04-01)
4
12
 
5
13
  ### Engine
package/engine/shared.js CHANGED
@@ -43,7 +43,21 @@ function safeReadDir(dir) {
43
43
  }
44
44
 
45
45
  function safeJson(p) {
46
- try { return JSON.parse(fs.readFileSync(p, 'utf8')); } catch { return null; }
46
+ try {
47
+ return JSON.parse(fs.readFileSync(p, 'utf8'));
48
+ } catch {
49
+ // Primary file missing or corrupted — try restoring from .backup sidecar
50
+ const backupPath = p + '.backup';
51
+ try {
52
+ const backupData = JSON.parse(fs.readFileSync(backupPath, 'utf8'));
53
+ // Backup is valid — restore it to the primary file (atomic via safeWrite)
54
+ console.log(`[safeJson] restored ${path.basename(p)} from .backup sidecar`);
55
+ try { safeWrite(p, backupData); } catch { /* best-effort restore */ }
56
+ return backupData;
57
+ } catch {
58
+ return null;
59
+ }
60
+ }
47
61
  }
48
62
 
49
63
  let _tmpCounter = 0;
@@ -140,7 +154,7 @@ function mutateJsonFileLocked(filePath, mutateFn, {
140
154
  let data = safeJson(filePath);
141
155
  if (data === null || typeof data !== 'object') data = Array.isArray(defaultValue) ? [...defaultValue] : { ...defaultValue };
142
156
  // Back up last-known-good state before mutation (best-effort)
143
- const backupPath = filePath + '.bak';
157
+ const backupPath = filePath + '.backup';
144
158
  try { if (fs.existsSync(filePath)) fs.copyFileSync(filePath, backupPath); } catch { /* backup is best-effort */ }
145
159
  const next = mutateFn(data);
146
160
  const finalData = next === undefined ? data : next;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yemi33/minions",
3
- "version": "0.1.142",
3
+ "version": "0.1.143",
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"