chapterhouse 0.14.2 → 0.14.3
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/memory/scaffold.js
CHANGED
|
@@ -29,7 +29,11 @@ export async function scaffold(paths) {
|
|
|
29
29
|
throw err;
|
|
30
30
|
log.warn({ err }, "memory: domains.yml malformed, skipping reconcile");
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
// Initialize the repo whenever .git is missing — not just when the whole
|
|
33
|
+
// tree is new. An interrupted first run can leave a seeded-but-unversioned
|
|
34
|
+
// memory/ directory; keying off existsSync(memoryRoot) alone would then skip
|
|
35
|
+
// gitInit and the following gitCommitAll would fail with "not a git repository".
|
|
36
|
+
if (!existsSync(join(paths.memoryRoot, ".git"))) {
|
|
33
37
|
await gitInit(paths.memoryRoot);
|
|
34
38
|
}
|
|
35
39
|
await gitCommitAll(paths.memoryRoot, "chore: scaffold memory");
|
|
@@ -49,4 +49,15 @@ test("scaffold is idempotent and never overwrites edited files", async () => {
|
|
|
49
49
|
const manifest = readFileSync(join(second.paths.memoryRoot, "domains.yml"), "utf8");
|
|
50
50
|
assert.equal(manifest.match(/id: personal/g)?.length, 1, "no duplicate domains");
|
|
51
51
|
});
|
|
52
|
+
test("scaffold recovers a seeded-but-unversioned memory tree (no .git)", async () => {
|
|
53
|
+
if (!gitAvailable())
|
|
54
|
+
return;
|
|
55
|
+
// Simulate an interrupted first run: memory/ exists but was never git-init'd.
|
|
56
|
+
const mgr = new MemoryManager(sandbox);
|
|
57
|
+
mkdirSync(mgr.paths.memoryRoot, { recursive: true });
|
|
58
|
+
assert.ok(!existsSync(join(mgr.paths.memoryRoot, ".git")));
|
|
59
|
+
await mgr.ensureReady();
|
|
60
|
+
assert.equal(mgr.isReady(), true, "memory must recover, not stay disabled");
|
|
61
|
+
assert.ok(existsSync(join(mgr.paths.memoryRoot, ".git")), "git repo must be initialized");
|
|
62
|
+
});
|
|
52
63
|
//# sourceMappingURL=scaffold.test.js.map
|
package/package.json
CHANGED