cf-memory-mcp 3.48.0 → 3.49.0

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.
@@ -4061,6 +4061,10 @@ function parseCliArgs(rest) {
4061
4061
  flags.fields = rest[++i];
4062
4062
  } else if (a.startsWith('--fields=')) {
4063
4063
  flags.fields = a.slice('--fields='.length);
4064
+ } else if (a === '--diff') {
4065
+ flags.diff = rest[++i];
4066
+ } else if (a.startsWith('--diff=')) {
4067
+ flags.diff = a.slice('--diff='.length);
4064
4068
  } else if (a === '--older-than') {
4065
4069
  // Accept "7d" / "30d" / "12h" / raw number (days).
4066
4070
  const raw = rest[++i] || '';
@@ -4392,6 +4396,65 @@ async function runResumeCli() {
4392
4396
  process.exit(0);
4393
4397
  }
4394
4398
 
4399
+ // --diff <other-id>: compare two handoffs. Shows added/removed
4400
+ // next_steps, branch shift, status change, files diff. Useful
4401
+ // for "what changed between yesterday's session and today's?".
4402
+ if (flags.diff) {
4403
+ if (!found) {
4404
+ process.stderr.write('No source handoff available to diff against.\n');
4405
+ process.exit(3);
4406
+ }
4407
+ const otherRes = await server.makeRequest({
4408
+ jsonrpc: '2.0', id: `cli-diff-${Date.now()}`,
4409
+ method: 'tools/call',
4410
+ params: { name: 'get_context_bootstrap', arguments: { resume: true, session_id_hint: flags.diff } },
4411
+ });
4412
+ const otherText = otherRes?.result?.content?.[0]?.text;
4413
+ const otherPayload = JSON.parse(otherText || '{}');
4414
+ const otherHandoff = otherPayload.resume_handoff?.handoff;
4415
+ if (!otherHandoff) {
4416
+ process.stderr.write(`Could not fetch handoff "${flags.diff}" to diff against.\n`);
4417
+ process.exit(3);
4418
+ }
4419
+ const h = payload.resume_handoff.handoff;
4420
+ const setOf = (arr, key) =>
4421
+ new Set((arr || []).map(x => typeof x === 'string' ? x : x[key]).filter(Boolean));
4422
+ const diffArr = (label, a, b, key) => {
4423
+ const A = setOf(a, key); const B = setOf(b, key);
4424
+ const added = [...A].filter(x => !B.has(x));
4425
+ const removed = [...B].filter(x => !A.has(x));
4426
+ const lines = [];
4427
+ if (added.length) lines.push(` + ${label}: ${added.join(', ')}`);
4428
+ if (removed.length) lines.push(` - ${label}: ${removed.join(', ')}`);
4429
+ return lines.join('\n');
4430
+ };
4431
+
4432
+ const aShort = (payload.resume_handoff.session_id || '').slice(0, 8);
4433
+ const bShort = (otherPayload.resume_handoff.session_id || '').slice(0, 8);
4434
+ const lines = [`Diff: ${aShort} (this) vs ${bShort} (other)`, ''];
4435
+ // Scalar fields
4436
+ const scalars = ['goal', 'status', 'branch', 'repo_path'];
4437
+ for (const f of scalars) {
4438
+ if (h[f] !== otherHandoff[f]) {
4439
+ lines.push(` ~ ${f}: "${otherHandoff[f] || ''}" → "${h[f] || ''}"`);
4440
+ }
4441
+ }
4442
+ // Array fields
4443
+ const arrDiff = diffArr('next_steps', h.next_steps, otherHandoff.next_steps);
4444
+ if (arrDiff) lines.push(arrDiff);
4445
+ const blockerDiff = diffArr('blockers', h.blockers, otherHandoff.blockers);
4446
+ if (blockerDiff) lines.push(blockerDiff);
4447
+ const decisionDiff = diffArr('decisions', h.decisions, otherHandoff.decisions);
4448
+ if (decisionDiff) lines.push(decisionDiff);
4449
+ const fileDiff = diffArr('files_touched', h.files_touched, otherHandoff.files_touched, 'path');
4450
+ if (fileDiff) lines.push(fileDiff);
4451
+ const anchorDiff = diffArr('code_anchors', h.code_anchors, otherHandoff.code_anchors, 'file_path');
4452
+ if (anchorDiff) lines.push(anchorDiff);
4453
+ if (lines.length === 2) lines.push(' (no differences)');
4454
+ process.stdout.write(lines.join('\n') + '\n');
4455
+ process.exit(0);
4456
+ }
4457
+
4395
4458
  // --validate: verify the handoff's file references still exist
4396
4459
  // on disk. Resolves each path relative to the handoff's repo_path
4397
4460
  // (or cwd). Reports per-path status. Useful before resuming to
@@ -5098,6 +5161,7 @@ const PER_COMMAND_HELP = {
5098
5161
  --decisions-only decisions, one per line.
5099
5162
  --blockers-only open blockers, one per line.
5100
5163
  --chain Walk parent_session_id back; show the thread history.
5164
+ --diff <other-id> Compare this handoff against another (added/removed/changed fields).
5101
5165
  --validate Check that files_touched + code_anchors still exist locally.
5102
5166
  --raw Print just the raw handoff JSON (no envelope metadata).
5103
5167
  --age Print handoff_age_minutes (single integer).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cf-memory-mcp",
3
- "version": "3.48.0",
3
+ "version": "3.49.0",
4
4
  "description": "Cloudflare-hosted MCP server for code indexing, retrieval, and assistant memory with a direct remote MCP endpoint and local stdio bridge.",
5
5
  "main": "bin/cf-memory-mcp.js",
6
6
  "bin": {