clawspec 1.0.11 → 1.0.12
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/package.json
CHANGED
|
@@ -2467,12 +2467,8 @@ export class ClawSpecService {
|
|
|
2467
2467
|
}
|
|
2468
2468
|
}
|
|
2469
2469
|
|
|
2470
|
-
await journalStore.writeSnapshot(repoStatePaths.planningJournalSnapshotFile, project.changeName, timestamp);
|
|
2471
|
-
|
|
2472
|
-
const currentDigest = await journalStore.digest(project.changeName);
|
|
2473
|
-
this.logger.info(`[clawspec] Planning snapshot written for ${project.changeName}:`);
|
|
2474
|
-
this.logger.info(` - Snapshot: entryCount=${writtenSnapshot?.entryCount}, lastEntryAt=${writtenSnapshot?.lastEntryAt}, hash=${writtenSnapshot?.contentHash?.slice(0, 8)}`);
|
|
2475
|
-
this.logger.info(` - Current digest: entryCount=${currentDigest.entryCount}, lastEntryAt=${currentDigest.lastEntryAt}, hash=${currentDigest.contentHash.slice(0, 8)}`);
|
|
2470
|
+
const snapshot = await journalStore.writeSnapshot(repoStatePaths.planningJournalSnapshotFile, project.changeName, timestamp);
|
|
2471
|
+
this.logger.info(`[clawspec] Planning snapshot written for ${project.changeName}: entryCount=${snapshot.entryCount}, lastEntryAt=${snapshot.lastEntryAt}`);
|
|
2476
2472
|
await this.writeLatestSummary(repoStatePaths, latestSummary);
|
|
2477
2473
|
|
|
2478
2474
|
const finalized = await this.stateStore.updateProject(project.channelKey, (current) => ({
|
|
@@ -2489,8 +2485,8 @@ export class ClawSpecService {
|
|
|
2489
2485
|
boundSessionKey: current.boundSessionKey,
|
|
2490
2486
|
planningJournal: {
|
|
2491
2487
|
dirty: journalDirty,
|
|
2492
|
-
entryCount:
|
|
2493
|
-
lastEntryAt:
|
|
2488
|
+
entryCount: snapshot.entryCount,
|
|
2489
|
+
lastEntryAt: snapshot.lastEntryAt,
|
|
2494
2490
|
lastSyncedAt,
|
|
2495
2491
|
},
|
|
2496
2492
|
}));
|
|
@@ -122,3 +122,34 @@ test("snapshot correctly captures all journal entries including assistant messag
|
|
|
122
122
|
assert.equal(snapshot.lastEntryAt, digest.lastEntryAt);
|
|
123
123
|
assert.equal(snapshot.contentHash, digest.contentHash);
|
|
124
124
|
});
|
|
125
|
+
|
|
126
|
+
test("snapshot sync after cs-plan, add requirement, cs-plan again", async () => {
|
|
127
|
+
const tempRoot = await mkdtemp(path.join(os.tmpdir(), "clawspec-replan-"));
|
|
128
|
+
const journalPath = path.join(tempRoot, "planning-journal.jsonl");
|
|
129
|
+
const snapshotPath = path.join(tempRoot, "planning-journal.snapshot.json");
|
|
130
|
+
const store = new PlanningJournalStore(journalPath);
|
|
131
|
+
|
|
132
|
+
await store.append({
|
|
133
|
+
timestamp: "2026-03-27T06:00:00.000Z",
|
|
134
|
+
changeName: "test",
|
|
135
|
+
role: "user",
|
|
136
|
+
text: "initial requirement",
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const snapshot1 = await store.writeSnapshot(snapshotPath, "test", "2026-03-27T06:05:00.000Z");
|
|
140
|
+
assert.equal(snapshot1.entryCount, 1);
|
|
141
|
+
assert.equal(await store.hasUnsyncedChanges("test", snapshotPath), false);
|
|
142
|
+
|
|
143
|
+
await store.append({
|
|
144
|
+
timestamp: "2026-03-27T06:10:00.000Z",
|
|
145
|
+
changeName: "test",
|
|
146
|
+
role: "user",
|
|
147
|
+
text: "additional requirement",
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
assert.equal(await store.hasUnsyncedChanges("test", snapshotPath), true);
|
|
151
|
+
|
|
152
|
+
const snapshot2 = await store.writeSnapshot(snapshotPath, "test", "2026-03-27T06:15:00.000Z");
|
|
153
|
+
assert.equal(snapshot2.entryCount, 2);
|
|
154
|
+
assert.equal(await store.hasUnsyncedChanges("test", snapshotPath), false);
|
|
155
|
+
});
|