cf-memory-mcp 3.45.0 → 3.46.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.
@@ -3973,6 +3973,10 @@ function parseCliArgs(rest) {
3973
3973
  flags.age = true;
3974
3974
  } else if (a === '--quality') {
3975
3975
  flags.quality = true;
3976
+ } else if (a === '--goal-only') {
3977
+ flags.goal_only = true;
3978
+ } else if (a === '--status-only') {
3979
+ flags.status_only = true;
3976
3980
  } else if (a === '--older-than') {
3977
3981
  // Accept "7d" / "30d" / "12h" / raw number (days).
3978
3982
  const raw = rest[++i] || '';
@@ -4135,6 +4139,22 @@ async function runResumeCli() {
4135
4139
  process.exit(0);
4136
4140
  }
4137
4141
 
4142
+ // --goal-only: print just the goal (single line).
4143
+ if (flags.goal_only) {
4144
+ const goal = payload.resume_handoff?.handoff?.goal;
4145
+ if (!goal) process.exit(3);
4146
+ process.stdout.write(goal + '\n');
4147
+ process.exit(0);
4148
+ }
4149
+
4150
+ // --status-only: print just the status string.
4151
+ if (flags.status_only) {
4152
+ const status = payload.resume_handoff?.handoff?.status;
4153
+ if (!status) process.exit(3);
4154
+ process.stdout.write(status + '\n');
4155
+ process.exit(0);
4156
+ }
4157
+
4138
4158
  // --age: print just handoff_age_minutes (single integer).
4139
4159
  if (flags.age) {
4140
4160
  const ageMin = payload.resume_handoff?.handoff_age_minutes;
@@ -4945,6 +4965,8 @@ const PER_COMMAND_HELP = {
4945
4965
  --raw Print just the raw handoff JSON (no envelope metadata).
4946
4966
  --age Print handoff_age_minutes (single integer).
4947
4967
  --quality Print quality_score (single float, 0-1).
4968
+ --goal-only Print just the goal text (single line).
4969
+ --status-only Print just the status string.
4948
4970
  --json, -j Full bootstrap payload as JSON.
4949
4971
  Exit codes: 0 = found, 3 = no handoff / no data, 4 = --validate found missing files.`,
4950
4972
  list: `cf-memory-mcp list [--status S] [--since ISO] [--repo PATH] [--limit N] [--json]
@@ -4979,10 +5001,11 @@ const PER_COMMAND_HELP = {
4979
5001
  <session-id> Full UUID or short prefix (>=8 chars).
4980
5002
  --md <path> Write the JSON to a file (single-handoff mode).
4981
5003
  --all Stream all handoffs as NDJSON.`,
4982
- import: `cf-memory-mcp import [<file>|-] [--json]
5004
+ import: `cf-memory-mcp import [<file>|-] [--all] [--json]
4983
5005
  Restore a handoff bundle into a NEW session (keep_open). Cross-machine
4984
5006
  sync. Use "-" to read from stdin.
4985
5007
  <file> Bundle file path; "-" for stdin.
5008
+ --all Input is NDJSON (one bundle per line). Imports each.
4986
5009
  --json, -j Emit a JSON status object.`,
4987
5010
  doctor: `cf-memory-mcp doctor [--json]
4988
5011
  Diagnose common setup issues. Checks API key, git repo/branch, disk-
@@ -5286,6 +5309,7 @@ async function runImportCli() {
5286
5309
  process.exit(1);
5287
5310
  }
5288
5311
  const { positional, flags } = parseCliArgs(process.argv.slice(3));
5312
+ const bulk = process.argv.includes('--all');
5289
5313
  const sourcePath = positional[0];
5290
5314
  let raw;
5291
5315
  try {
@@ -5299,6 +5323,64 @@ async function runImportCli() {
5299
5323
  console.error('import: cannot read input:', err.message);
5300
5324
  process.exit(1);
5301
5325
  }
5326
+
5327
+ // Bulk: parse NDJSON (one bundle per line) and import each.
5328
+ if (bulk) {
5329
+ const lines = raw.split('\n').filter(l => l.trim());
5330
+ const server = new CFMemoryMCP();
5331
+ server.logDebug = () => {};
5332
+ const results = { imported: 0, failed: 0, errors: [] };
5333
+ const meta = server.getRepoMetadata();
5334
+ for (const line of lines) {
5335
+ let bundle;
5336
+ try { bundle = JSON.parse(line); } catch (err) {
5337
+ results.failed++;
5338
+ results.errors.push(`line skip: not valid JSON`);
5339
+ continue;
5340
+ }
5341
+ if (bundle.kind !== 'cf-memory-handoff' || !bundle.handoff) {
5342
+ results.failed++;
5343
+ results.errors.push(`line skip: not a cf-memory-handoff bundle`);
5344
+ continue;
5345
+ }
5346
+ try {
5347
+ const startArgs = { context: 'main' };
5348
+ if (meta.repo_path) startArgs.repo_path = meta.repo_path;
5349
+ if (meta.branch) startArgs.branch = meta.branch;
5350
+ const startRes = await server.makeRequest({
5351
+ jsonrpc: '2.0', id: `cli-import-all-start-${Date.now()}`,
5352
+ method: 'tools/call', params: { name: 'start_session', arguments: startArgs },
5353
+ });
5354
+ const sp = JSON.parse(startRes?.result?.content?.[0]?.text || '{}');
5355
+ const newId = sp.session_id;
5356
+ if (!newId) { results.failed++; continue; }
5357
+ const handoff = {
5358
+ ...bundle.handoff,
5359
+ parent_session_id: bundle.session_id,
5360
+ notes: (bundle.handoff.notes || '') + `\n\n[bulk-imported from ${bundle.session_id}]`,
5361
+ };
5362
+ await server.makeRequest({
5363
+ jsonrpc: '2.0', id: `cli-import-all-end-${Date.now()}`,
5364
+ method: 'tools/call', params: { name: 'end_session', arguments: {
5365
+ session_id: newId, keep_open: true, handoff,
5366
+ } },
5367
+ });
5368
+ results.imported++;
5369
+ } catch (err) {
5370
+ results.failed++;
5371
+ results.errors.push(`${bundle.session_id}: ${err.message}`);
5372
+ }
5373
+ }
5374
+ if (flags.json) {
5375
+ process.stdout.write(JSON.stringify(results, null, 2) + '\n');
5376
+ } else {
5377
+ process.stderr.write(`Imported ${results.imported} handoffs.`);
5378
+ if (results.failed > 0) process.stderr.write(` Failed: ${results.failed}.`);
5379
+ process.stderr.write('\n');
5380
+ }
5381
+ process.exit(results.imported > 0 ? 0 : 3);
5382
+ }
5383
+
5302
5384
  let bundle;
5303
5385
  try { bundle = JSON.parse(raw); } catch (err) {
5304
5386
  console.error('import: input is not valid JSON:', err.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cf-memory-mcp",
3
- "version": "3.45.0",
3
+ "version": "3.46.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": {