cf-memory-mcp 3.45.0 → 3.47.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,14 @@ 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;
3980
+ } else if (a === '--branch-only') {
3981
+ flags.branch_only = true;
3982
+ } else if (a === '--repo-only') {
3983
+ flags.repo_only = true;
3976
3984
  } else if (a === '--older-than') {
3977
3985
  // Accept "7d" / "30d" / "12h" / raw number (days).
3978
3986
  const raw = rest[++i] || '';
@@ -4135,6 +4143,38 @@ async function runResumeCli() {
4135
4143
  process.exit(0);
4136
4144
  }
4137
4145
 
4146
+ // --goal-only: print just the goal (single line).
4147
+ if (flags.goal_only) {
4148
+ const goal = payload.resume_handoff?.handoff?.goal;
4149
+ if (!goal) process.exit(3);
4150
+ process.stdout.write(goal + '\n');
4151
+ process.exit(0);
4152
+ }
4153
+
4154
+ // --status-only: print just the status string.
4155
+ if (flags.status_only) {
4156
+ const status = payload.resume_handoff?.handoff?.status;
4157
+ if (!status) process.exit(3);
4158
+ process.stdout.write(status + '\n');
4159
+ process.exit(0);
4160
+ }
4161
+
4162
+ // --branch-only: print just the branch.
4163
+ if (flags.branch_only) {
4164
+ const branch = payload.resume_handoff?.handoff?.branch;
4165
+ if (!branch) process.exit(3);
4166
+ process.stdout.write(branch + '\n');
4167
+ process.exit(0);
4168
+ }
4169
+
4170
+ // --repo-only: print just the repo_path.
4171
+ if (flags.repo_only) {
4172
+ const repo = payload.resume_handoff?.handoff?.repo_path;
4173
+ if (!repo) process.exit(3);
4174
+ process.stdout.write(repo + '\n');
4175
+ process.exit(0);
4176
+ }
4177
+
4138
4178
  // --age: print just handoff_age_minutes (single integer).
4139
4179
  if (flags.age) {
4140
4180
  const ageMin = payload.resume_handoff?.handoff_age_minutes;
@@ -4945,6 +4985,10 @@ const PER_COMMAND_HELP = {
4945
4985
  --raw Print just the raw handoff JSON (no envelope metadata).
4946
4986
  --age Print handoff_age_minutes (single integer).
4947
4987
  --quality Print quality_score (single float, 0-1).
4988
+ --goal-only Print just the goal text (single line).
4989
+ --status-only Print just the status string.
4990
+ --branch-only Print just the branch.
4991
+ --repo-only Print just the repo_path.
4948
4992
  --json, -j Full bootstrap payload as JSON.
4949
4993
  Exit codes: 0 = found, 3 = no handoff / no data, 4 = --validate found missing files.`,
4950
4994
  list: `cf-memory-mcp list [--status S] [--since ISO] [--repo PATH] [--limit N] [--json]
@@ -4979,10 +5023,11 @@ const PER_COMMAND_HELP = {
4979
5023
  <session-id> Full UUID or short prefix (>=8 chars).
4980
5024
  --md <path> Write the JSON to a file (single-handoff mode).
4981
5025
  --all Stream all handoffs as NDJSON.`,
4982
- import: `cf-memory-mcp import [<file>|-] [--json]
5026
+ import: `cf-memory-mcp import [<file>|-] [--all] [--json]
4983
5027
  Restore a handoff bundle into a NEW session (keep_open). Cross-machine
4984
5028
  sync. Use "-" to read from stdin.
4985
5029
  <file> Bundle file path; "-" for stdin.
5030
+ --all Input is NDJSON (one bundle per line). Imports each.
4986
5031
  --json, -j Emit a JSON status object.`,
4987
5032
  doctor: `cf-memory-mcp doctor [--json]
4988
5033
  Diagnose common setup issues. Checks API key, git repo/branch, disk-
@@ -5286,6 +5331,7 @@ async function runImportCli() {
5286
5331
  process.exit(1);
5287
5332
  }
5288
5333
  const { positional, flags } = parseCliArgs(process.argv.slice(3));
5334
+ const bulk = process.argv.includes('--all');
5289
5335
  const sourcePath = positional[0];
5290
5336
  let raw;
5291
5337
  try {
@@ -5299,6 +5345,64 @@ async function runImportCli() {
5299
5345
  console.error('import: cannot read input:', err.message);
5300
5346
  process.exit(1);
5301
5347
  }
5348
+
5349
+ // Bulk: parse NDJSON (one bundle per line) and import each.
5350
+ if (bulk) {
5351
+ const lines = raw.split('\n').filter(l => l.trim());
5352
+ const server = new CFMemoryMCP();
5353
+ server.logDebug = () => {};
5354
+ const results = { imported: 0, failed: 0, errors: [] };
5355
+ const meta = server.getRepoMetadata();
5356
+ for (const line of lines) {
5357
+ let bundle;
5358
+ try { bundle = JSON.parse(line); } catch (err) {
5359
+ results.failed++;
5360
+ results.errors.push(`line skip: not valid JSON`);
5361
+ continue;
5362
+ }
5363
+ if (bundle.kind !== 'cf-memory-handoff' || !bundle.handoff) {
5364
+ results.failed++;
5365
+ results.errors.push(`line skip: not a cf-memory-handoff bundle`);
5366
+ continue;
5367
+ }
5368
+ try {
5369
+ const startArgs = { context: 'main' };
5370
+ if (meta.repo_path) startArgs.repo_path = meta.repo_path;
5371
+ if (meta.branch) startArgs.branch = meta.branch;
5372
+ const startRes = await server.makeRequest({
5373
+ jsonrpc: '2.0', id: `cli-import-all-start-${Date.now()}`,
5374
+ method: 'tools/call', params: { name: 'start_session', arguments: startArgs },
5375
+ });
5376
+ const sp = JSON.parse(startRes?.result?.content?.[0]?.text || '{}');
5377
+ const newId = sp.session_id;
5378
+ if (!newId) { results.failed++; continue; }
5379
+ const handoff = {
5380
+ ...bundle.handoff,
5381
+ parent_session_id: bundle.session_id,
5382
+ notes: (bundle.handoff.notes || '') + `\n\n[bulk-imported from ${bundle.session_id}]`,
5383
+ };
5384
+ await server.makeRequest({
5385
+ jsonrpc: '2.0', id: `cli-import-all-end-${Date.now()}`,
5386
+ method: 'tools/call', params: { name: 'end_session', arguments: {
5387
+ session_id: newId, keep_open: true, handoff,
5388
+ } },
5389
+ });
5390
+ results.imported++;
5391
+ } catch (err) {
5392
+ results.failed++;
5393
+ results.errors.push(`${bundle.session_id}: ${err.message}`);
5394
+ }
5395
+ }
5396
+ if (flags.json) {
5397
+ process.stdout.write(JSON.stringify(results, null, 2) + '\n');
5398
+ } else {
5399
+ process.stderr.write(`Imported ${results.imported} handoffs.`);
5400
+ if (results.failed > 0) process.stderr.write(` Failed: ${results.failed}.`);
5401
+ process.stderr.write('\n');
5402
+ }
5403
+ process.exit(results.imported > 0 ? 0 : 3);
5404
+ }
5405
+
5302
5406
  let bundle;
5303
5407
  try { bundle = JSON.parse(raw); } catch (err) {
5304
5408
  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.47.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": {