@kuznai/inception-engine 0.24.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/config/manifest.js +7 -5
- package/dist/src/core/adapters/frontmatter.js +3 -22
- package/dist/src/core/adapters/toml.js +3 -22
- package/dist/src/core/atomic-write.d.ts +12 -0
- package/dist/src/core/atomic-write.js +42 -0
- package/dist/src/core/deploy.d.ts +2 -2
- package/dist/src/core/deploy.js +46 -19
- package/dist/src/core/init.d.ts +1 -0
- package/dist/src/core/init.js +30 -13
- package/dist/src/core/ownership.d.ts +24 -0
- package/dist/src/core/ownership.js +47 -3
- package/dist/src/core/preflight.d.ts +1 -1
- package/dist/src/core/preflight.js +9 -1
- package/dist/src/core/resolve.js +1 -1
- package/dist/src/core/revert.d.ts +1 -1
- package/dist/src/core/revert.js +39 -13
- package/dist/src/core/runtime-paths.js +5 -4
- package/dist/src/core/validation.js +4 -2
- package/dist/src/index.js +42 -12
- package/dist/test/os/posix/deploy.test.js +6 -10
- package/dist/test/os/windows/deploy.test.js +12 -11
- package/dist/test/unit/atomic-write.test.d.ts +1 -0
- package/dist/test/unit/atomic-write.test.js +96 -0
- package/dist/test/unit/deploy.test.js +30 -22
- package/dist/test/unit/formatters.test.js +1 -1
- package/dist/test/unit/init-fixture.test.js +1 -1
- package/dist/test/unit/revert.test.js +15 -13
- package/package.json +1 -1
|
@@ -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";
|
|
@@ -159,7 +159,8 @@ describe("executeRevert reserved state protections", () => {
|
|
|
159
159
|
try {
|
|
160
160
|
const target = path.join(home, ".inception-engine", "registry.json");
|
|
161
161
|
await mkdir(path.dirname(target), { recursive: true });
|
|
162
|
-
|
|
162
|
+
const initialContent = '{\n "version": 1,\n "deployments": {}\n}\n';
|
|
163
|
+
await writeFile(target, initialContent);
|
|
163
164
|
const { failed, succeeded } = await executeRevert([
|
|
164
165
|
{
|
|
165
166
|
kind: "file-write",
|
|
@@ -171,7 +172,7 @@ describe("executeRevert reserved state protections", () => {
|
|
|
171
172
|
assert.equal(succeeded, 0);
|
|
172
173
|
assert.equal(failed.length, 1);
|
|
173
174
|
assert.match(failed[0]?.error ?? "", /Refusing to modify inception-engine state directory/);
|
|
174
|
-
assert.equal(await readFile(target, "utf-8"),
|
|
175
|
+
assert.equal(await readFile(target, "utf-8"), initialContent);
|
|
175
176
|
}
|
|
176
177
|
finally {
|
|
177
178
|
await rm(home, { recursive: true, force: true });
|
|
@@ -256,20 +257,21 @@ describe("executeRevert — copy method (cross-platform)", () => {
|
|
|
256
257
|
agent: "claude-code",
|
|
257
258
|
method: "copy",
|
|
258
259
|
});
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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 });
|
|
262
270
|
assert.equal(succeeded, 0);
|
|
263
271
|
assert.equal(skipped, 0);
|
|
264
272
|
assert.equal(failed.length, 1);
|
|
265
273
|
}
|
|
266
274
|
finally {
|
|
267
|
-
try {
|
|
268
|
-
await chmod(path.join(home, ".inception-engine", "registry.json"), 0o666);
|
|
269
|
-
}
|
|
270
|
-
catch {
|
|
271
|
-
/* best effort */
|
|
272
|
-
}
|
|
273
275
|
await rm(home, { recursive: true, force: true });
|
|
274
276
|
await rm(sourceDir, { recursive: true, force: true });
|
|
275
277
|
}
|