ronds-mcp-tracker 0.1.8 → 0.1.9

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.
Files changed (2) hide show
  1. package/dist/server.js +23 -25
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -189,6 +189,24 @@ function loadSnapshot(snapshotId) {
189
189
  const raw = fs.readFileSync(filePath, 'utf8');
190
190
  return JSON.parse(raw);
191
191
  }
192
+ function loadLatestSnapshotForFile(filePath) {
193
+ const dir = ensureSnapshotsDirExists();
194
+ const snapshots = fs.readdirSync(dir)
195
+ .map((name) => path.join(dir, name))
196
+ .filter((snapshotPath) => fs.statSync(snapshotPath).isFile())
197
+ .map((snapshotPath) => {
198
+ try {
199
+ const raw = fs.readFileSync(snapshotPath, 'utf8');
200
+ return JSON.parse(raw);
201
+ }
202
+ catch {
203
+ return null;
204
+ }
205
+ })
206
+ .filter((snapshot) => snapshot !== null && snapshot.file_path === filePath)
207
+ .sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
208
+ return snapshots[0] ?? null;
209
+ }
192
210
  function deleteSnapshot(snapshotId) {
193
211
  const filePath = getSnapshotPath(snapshotId);
194
212
  if (fs.existsSync(filePath)) {
@@ -297,21 +315,12 @@ async function handleAfterEdit(input, config) {
297
315
  if (!snapshotId) {
298
316
  throw new Error('snapshot_id is required');
299
317
  }
300
- const snapshot = loadSnapshot(snapshotId);
318
+ const snapshot = loadSnapshot(snapshotId) ?? loadLatestSnapshotForFile(filePath);
301
319
  if (!snapshot) {
302
- return JSON.stringify({
303
- status: 'snapshot_not_found',
304
- snapshot_id: snapshotId,
305
- file_path: filePath
306
- });
320
+ return JSON.stringify({ success: false });
307
321
  }
308
322
  if (snapshot.file_path !== filePath) {
309
- return JSON.stringify({
310
- status: 'snapshot_file_path_mismatch',
311
- snapshot_id: snapshotId,
312
- file_path: filePath,
313
- snapshot_file_path: snapshot.file_path
314
- });
323
+ return JSON.stringify({ success: false });
315
324
  }
316
325
  const oldStr = snapshot.content;
317
326
  const newStr = readFileContent(filePath);
@@ -327,21 +336,10 @@ async function handleAfterEdit(input, config) {
327
336
  });
328
337
  await publishToKafka(config, event);
329
338
  if (fs.existsSync(getFailedEventPath(event.event_id))) {
330
- return JSON.stringify({
331
- status: 'queued_for_retry',
332
- event_id: event.event_id,
333
- snapshot_id: snapshotId,
334
- lines_changed: diffStats.added + diffStats.removed,
335
- added_content: addedLines
336
- });
339
+ return JSON.stringify({ success: false });
337
340
  }
338
341
  deleteSnapshot(snapshotId);
339
- return JSON.stringify({
340
- status: 'recorded',
341
- event_id: event.event_id,
342
- lines_changed: diffStats.added + diffStats.removed,
343
- added_content: addedLines
344
- });
342
+ return JSON.stringify({ success: true });
345
343
  }
346
344
  async function handleDirectAdd(input, config) {
347
345
  const filePath = validateFilePath(input.file_path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ronds-mcp-tracker",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "ronds-mcp-tracker": "./bin/cli.js"