@kuznai/inception-engine 0.25.0 → 0.25.1
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/dist/src/core/revert.js
CHANGED
|
@@ -186,7 +186,18 @@ export async function executeRevert(actions, dryRun, verbose, home, deps = {}, s
|
|
|
186
186
|
registry: runRegistry,
|
|
187
187
|
};
|
|
188
188
|
if (!dryRun) {
|
|
189
|
-
|
|
189
|
+
try {
|
|
190
|
+
await runRegistry.preflight(home);
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
194
|
+
return {
|
|
195
|
+
succeeded: 0,
|
|
196
|
+
skipped: 0,
|
|
197
|
+
failed: actions.map((action) => ({ action, error: message })),
|
|
198
|
+
planned,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
190
201
|
}
|
|
191
202
|
for (const action of actions) {
|
|
192
203
|
if (signal?.aborted)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import {
|
|
2
|
+
import { mkdir, rm, writeFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { describe, it } from "node:test";
|
|
5
5
|
import { executeDeploy, planDeploy } from "../../../src/core/deploy.js";
|
|
6
|
-
import { lookupDeployment, registerDeployment, } from "../../../src/core/ownership.js";
|
|
6
|
+
import { defaultRegistryPersistence, lookupDeployment, registerDeployment, } from "../../../src/core/ownership.js";
|
|
7
7
|
import { UserError } from "../../../src/errors.js";
|
|
8
8
|
import { exists, makeTmpDir } from "../../helpers/fs.js";
|
|
9
9
|
import { createSkillSource, testSkillManifest, } from "../../helpers/skill-dir.js";
|
|
@@ -215,9 +215,16 @@ describe("atomic redeploy behavior (Windows)", {
|
|
|
215
215
|
const backupPath = `${target}.inception-backup`;
|
|
216
216
|
const { succeeded: firstSucceeded } = await executeDeploy(actions, false, false, home);
|
|
217
217
|
assert.equal(firstSucceeded, 1);
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
// Simulate an unwritable registry via a failing RegistryPersistence
|
|
219
|
+
// instead of relying on chmod, which is not enforced for admin processes
|
|
220
|
+
// on Windows (e.g. GitHub Actions windows-latest runners).
|
|
221
|
+
const failingRegistry = {
|
|
222
|
+
load: (h) => defaultRegistryPersistence.load(h),
|
|
223
|
+
save: async () => {
|
|
224
|
+
throw Object.assign(new Error("EACCES: permission denied, open 'registry.json'"), { code: "EACCES" });
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
const { succeeded, failed } = await executeDeploy(actions, false, false, home, { registry: failingRegistry });
|
|
221
228
|
assert.equal(succeeded, 0);
|
|
222
229
|
assert.equal(failed.length, 1);
|
|
223
230
|
assert.ok(!(await exists(backupPath)));
|
|
@@ -225,12 +232,6 @@ describe("atomic redeploy behavior (Windows)", {
|
|
|
225
232
|
assert.ok(await exists(path.join(target, "SKILL.md")));
|
|
226
233
|
}
|
|
227
234
|
finally {
|
|
228
|
-
try {
|
|
229
|
-
await chmod(path.join(home, ".inception-engine", "registry.json"), 0o666);
|
|
230
|
-
}
|
|
231
|
-
catch {
|
|
232
|
-
// best effort
|
|
233
|
-
}
|
|
234
235
|
await rm(sourceDir, { recursive: true, force: true });
|
|
235
236
|
await rm(home, { recursive: true, force: true });
|
|
236
237
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import {
|
|
2
|
+
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { describe, it } from "node:test";
|
|
5
|
-
import { lookupDeployment, registerDeployment, } from "../../src/core/ownership.js";
|
|
5
|
+
import { defaultRegistryPersistence, lookupDeployment, registerDeployment, } from "../../src/core/ownership.js";
|
|
6
6
|
import { executeRevert, planRevert, planRevertAll, } from "../../src/core/revert.js";
|
|
7
7
|
import { logger } from "../../src/logger.js";
|
|
8
8
|
import { exists, makeTmpDir } from "../helpers/fs.js";
|
|
@@ -257,20 +257,21 @@ describe("executeRevert — copy method (cross-platform)", () => {
|
|
|
257
257
|
agent: "claude-code",
|
|
258
258
|
method: "copy",
|
|
259
259
|
});
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
// Simulate an unwritable registry via a failing RegistryPersistence
|
|
261
|
+
// instead of relying on chmod, which is not enforced for admin processes
|
|
262
|
+
// on Windows (e.g. GitHub Actions windows-latest runners).
|
|
263
|
+
const failingRegistry = {
|
|
264
|
+
load: (h) => defaultRegistryPersistence.load(h),
|
|
265
|
+
save: async () => {
|
|
266
|
+
throw Object.assign(new Error("EACCES: permission denied, open 'registry.json'"), { code: "EACCES" });
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
const { succeeded, skipped, failed } = await executeRevert(actions, false, false, home, { registry: failingRegistry });
|
|
263
270
|
assert.equal(succeeded, 0);
|
|
264
271
|
assert.equal(skipped, 0);
|
|
265
272
|
assert.equal(failed.length, 1);
|
|
266
273
|
}
|
|
267
274
|
finally {
|
|
268
|
-
try {
|
|
269
|
-
await chmod(path.join(home, ".inception-engine", "registry.json"), 0o666);
|
|
270
|
-
}
|
|
271
|
-
catch {
|
|
272
|
-
/* best effort */
|
|
273
|
-
}
|
|
274
275
|
await rm(home, { recursive: true, force: true });
|
|
275
276
|
await rm(sourceDir, { recursive: true, force: true });
|
|
276
277
|
}
|