@lmzhen/dsh-evolution-merge 0.30.6 → 0.30.8
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/lib/index.js +13 -5
- package/lib/types/commit-recovery.js +6 -0
- package/lib/types/domain/errors.js +7 -1
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -814,10 +814,15 @@ async function recoverCommitJournals(io, home, now, skillRoot, restoreSource, is
|
|
|
814
814
|
}
|
|
815
815
|
if (!restoredArchived) for (const source of snapshot.sourceBodies) await io.writeText(skillBodyPath(skillRoot, source.name), source.body);
|
|
816
816
|
}
|
|
817
|
-
if (snapshot.create && snapshot.targetBody === null)
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
817
|
+
if (snapshot.create && snapshot.targetBody === null) {
|
|
818
|
+
try {
|
|
819
|
+
await io.remove(skillBodyPath(skillRoot, snapshot.target));
|
|
820
|
+
} catch {}
|
|
821
|
+
try {
|
|
822
|
+
const dir = join(skillRoot, snapshot.target);
|
|
823
|
+
if ((await io.list(dir)).length === 0) await io.remove(dir);
|
|
824
|
+
} catch {}
|
|
825
|
+
} else if (snapshot.targetBody !== null) await io.writeText(skillBodyPath(skillRoot, snapshot.target), snapshot.targetBody);
|
|
821
826
|
const oldPaths = new Set((snapshot.targetSupport ?? []).map((file) => file.path));
|
|
822
827
|
for (const file of snapshot.targetSupport ?? []) await io.writeText(skillFilePath(skillRoot, snapshot.target, file.path), file.content);
|
|
823
828
|
for (const file of snapshot.targetSupportAfter ?? []) if (!oldPaths.has(file.path)) try {
|
|
@@ -1556,10 +1561,13 @@ function mergeCommandHelp() {
|
|
|
1556
1561
|
}
|
|
1557
1562
|
//#endregion
|
|
1558
1563
|
//#region lib/types/domain/errors.js
|
|
1564
|
+
function redact(text) {
|
|
1565
|
+
return text.replace(/sk-[A-Za-z0-9_-]{16,}/g, "[redacted]").replace(/Bearer\s+\S+/gi, "Bearer [redacted]").replace(/(api[_-]?key\s*[:=]\s*)\S+/gi, "$1[redacted]");
|
|
1566
|
+
}
|
|
1559
1567
|
function formatMergeError(error) {
|
|
1560
1568
|
if (error.kind === "parameter") return "merge: " + error.message + " (" + error.code + ")";
|
|
1561
1569
|
const where = error.stage === void 0 && error.runId === void 0 ? error.detail ?? "no additional detail" : [error.stage === void 0 ? void 0 : "stage=" + error.stage, error.runId === void 0 ? void 0 : "run=" + error.runId].filter(Boolean).join(" ");
|
|
1562
|
-
return "merge failed: " + error.message + " (" + error.code + ")\n" + where + "\nnext: fix the target or rerun after the cause is gone";
|
|
1570
|
+
return redact("merge failed: " + error.message + " (" + error.code + ")\n" + where + "\nnext: fix the target or rerun after the cause is gone");
|
|
1563
1571
|
}
|
|
1564
1572
|
//#endregion
|
|
1565
1573
|
//#region lib/types/merge-command.js
|
|
@@ -72,6 +72,12 @@ export async function recoverCommitJournals(io, home, now, skillRoot, restoreSou
|
|
|
72
72
|
await io.remove(skillBodyPath(skillRoot, snapshot.target));
|
|
73
73
|
}
|
|
74
74
|
catch { /* already gone */ }
|
|
75
|
+
try {
|
|
76
|
+
const dir = join(skillRoot, snapshot.target);
|
|
77
|
+
if ((await io.list(dir)).length === 0)
|
|
78
|
+
await io.remove(dir);
|
|
79
|
+
}
|
|
80
|
+
catch { /* absent or non-empty */ }
|
|
75
81
|
}
|
|
76
82
|
else if (snapshot.targetBody !== null) {
|
|
77
83
|
await io.writeText(skillBodyPath(skillRoot, snapshot.target), snapshot.targetBody);
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
function redact(text) {
|
|
2
|
+
return text
|
|
3
|
+
.replace(/sk-[A-Za-z0-9_-]{16,}/g, '[redacted]')
|
|
4
|
+
.replace(/Bearer\s+\S+/gi, 'Bearer [redacted]')
|
|
5
|
+
.replace(/(api[_-]?key\s*[:=]\s*)\S+/gi, '$1[redacted]');
|
|
6
|
+
}
|
|
1
7
|
export function formatMergeError(error) {
|
|
2
8
|
if (error.kind === 'parameter')
|
|
3
9
|
return 'merge: ' + error.message + ' (' + error.code + ')';
|
|
4
10
|
const where = error.stage === undefined && error.runId === undefined
|
|
5
11
|
? (error.detail ?? 'no additional detail')
|
|
6
12
|
: [error.stage === undefined ? undefined : 'stage=' + error.stage, error.runId === undefined ? undefined : 'run=' + error.runId].filter(Boolean).join(' ');
|
|
7
|
-
return 'merge failed: ' + error.message + ' (' + error.code + ')\n' + where + '\nnext: fix the target or rerun after the cause is gone';
|
|
13
|
+
return redact('merge failed: ' + error.message + ' (' + error.code + ')\n' + where + '\nnext: fix the target or rerun after the cause is gone');
|
|
8
14
|
}
|
|
9
15
|
//# sourceMappingURL=errors.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-merge",
|
|
3
3
|
"description": "Skill auto-merge domain: screening, two-round authoring, queues and commit orchestration (community build)",
|
|
4
|
-
"version": "0.30.
|
|
4
|
+
"version": "0.30.8",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@deepseek-ai/schemastery": "^3.18.5",
|
|
30
|
-
"@lmzhen/dsh-evolution-core": "^0.30.
|
|
31
|
-
"@lmzhen/dsh-evolution-merge-engine": "^0.30.
|
|
30
|
+
"@lmzhen/dsh-evolution-core": "^0.30.8",
|
|
31
|
+
"@lmzhen/dsh-evolution-merge-engine": "^0.30.8"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@deepseek-ai/cordis": "^4.0.5"
|