@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 +8 -0
- package/engine/shared.js +16 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/engine/shared.js
CHANGED
|
@@ -43,7 +43,21 @@ function safeReadDir(dir) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function safeJson(p) {
|
|
46
|
-
try {
|
|
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 + '.
|
|
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.
|
|
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"
|