cf-memory-mcp 3.54.0 → 3.55.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.
@@ -4474,25 +4474,54 @@ async function runResumeCli() {
4474
4474
 
4475
4475
  const aShort = (payload.resume_handoff.session_id || '').slice(0, 8);
4476
4476
  const bShort = (otherPayload.resume_handoff.session_id || '').slice(0, 8);
4477
- const lines = [`Diff: ${aShort} (this) vs ${bShort} (other)`, ''];
4478
- // Scalar fields
4479
- const scalars = ['goal', 'status', 'branch', 'repo_path'];
4480
- for (const f of scalars) {
4477
+
4478
+ // Build a structured diff first; render either as JSON or
4479
+ // as the human-readable +/- output.
4480
+ const scalarDiff = {};
4481
+ for (const f of ['goal', 'status', 'branch', 'repo_path']) {
4481
4482
  if (h[f] !== otherHandoff[f]) {
4482
- lines.push(` ~ ${f}: "${otherHandoff[f] || ''}" "${h[f] || ''}"`);
4483
+ scalarDiff[f] = { from: otherHandoff[f] ?? null, to: h[f] ?? null };
4483
4484
  }
4484
4485
  }
4485
- // Array fields
4486
- const arrDiff = diffArr('next_steps', h.next_steps, otherHandoff.next_steps);
4487
- if (arrDiff) lines.push(arrDiff);
4488
- const blockerDiff = diffArr('blockers', h.blockers, otherHandoff.blockers);
4489
- if (blockerDiff) lines.push(blockerDiff);
4490
- const decisionDiff = diffArr('decisions', h.decisions, otherHandoff.decisions);
4491
- if (decisionDiff) lines.push(decisionDiff);
4492
- const fileDiff = diffArr('files_touched', h.files_touched, otherHandoff.files_touched, 'path');
4493
- if (fileDiff) lines.push(fileDiff);
4494
- const anchorDiff = diffArr('code_anchors', h.code_anchors, otherHandoff.code_anchors, 'file_path');
4495
- if (anchorDiff) lines.push(anchorDiff);
4486
+ const arrayDiffObj = (a, b, key) => {
4487
+ const A = setOf(a, key); const B = setOf(b, key);
4488
+ return {
4489
+ added: [...A].filter(x => !B.has(x)),
4490
+ removed: [...B].filter(x => !A.has(x)),
4491
+ };
4492
+ };
4493
+ const arrayDiffs = {
4494
+ next_steps: arrayDiffObj(h.next_steps, otherHandoff.next_steps),
4495
+ blockers: arrayDiffObj(h.blockers, otherHandoff.blockers),
4496
+ decisions: arrayDiffObj(h.decisions, otherHandoff.decisions),
4497
+ files_touched: arrayDiffObj(h.files_touched, otherHandoff.files_touched, 'path'),
4498
+ code_anchors: arrayDiffObj(h.code_anchors, otherHandoff.code_anchors, 'file_path'),
4499
+ };
4500
+
4501
+ if (flags.json) {
4502
+ // Strip empty arrays from arrayDiffs for compactness.
4503
+ const compactArrays = Object.fromEntries(
4504
+ Object.entries(arrayDiffs)
4505
+ .filter(([, v]) => v.added.length > 0 || v.removed.length > 0)
4506
+ );
4507
+ process.stdout.write(JSON.stringify({
4508
+ this: payload.resume_handoff.session_id,
4509
+ other: otherPayload.resume_handoff.session_id,
4510
+ scalars: scalarDiff,
4511
+ arrays: compactArrays,
4512
+ unchanged: Object.keys(scalarDiff).length === 0 && Object.keys(compactArrays).length === 0,
4513
+ }, null, 2) + '\n');
4514
+ process.exit(0);
4515
+ }
4516
+
4517
+ const lines = [`Diff: ${aShort} (this) vs ${bShort} (other)`, ''];
4518
+ for (const [f, v] of Object.entries(scalarDiff)) {
4519
+ lines.push(` ~ ${f}: "${v.from || ''}" → "${v.to || ''}"`);
4520
+ }
4521
+ for (const [label, v] of Object.entries(arrayDiffs)) {
4522
+ if (v.added.length > 0) lines.push(` + ${label}: ${v.added.join(', ')}`);
4523
+ if (v.removed.length > 0) lines.push(` - ${label}: ${v.removed.join(', ')}`);
4524
+ }
4496
4525
  if (lines.length === 2) lines.push(' (no differences)');
4497
4526
  process.stdout.write(lines.join('\n') + '\n');
4498
4527
  process.exit(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cf-memory-mcp",
3
- "version": "3.54.0",
3
+ "version": "3.55.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": {