cf-memory-mcp 3.33.0 → 3.35.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.
@@ -3870,6 +3870,14 @@ function parseCliArgs(rest) {
3870
3870
  flags.md_path = rest[++i];
3871
3871
  } else if (a.startsWith('--md=')) {
3872
3872
  flags.md_path = a.slice('--md='.length);
3873
+ } else if (a === '--next-only') {
3874
+ flags.next_only = true;
3875
+ } else if (a === '--next-steps') {
3876
+ flags.next_steps = true;
3877
+ } else if (a === '--files-only') {
3878
+ flags.files_only = true;
3879
+ } else if (a === '--anchors-only') {
3880
+ flags.anchors_only = true;
3873
3881
  } else if (a === '--older-than') {
3874
3882
  // Accept "7d" / "30d" / "12h" / raw number (days).
3875
3883
  const raw = rest[++i] || '';
@@ -3952,6 +3960,60 @@ async function runResumeCli() {
3952
3960
  // offline-fallback cache, not just MCP-stdio usage.
3953
3961
  if (found) server.saveResumeToDisk(response);
3954
3962
 
3963
+ // --next-only: print just the first next_step. Useful for
3964
+ // shell prompts, status bars, one-liner scripting:
3965
+ // $ cf-memory-mcp resume --next-only
3966
+ if (flags.next_only) {
3967
+ const next = (payload.next_actions && payload.next_actions[0])
3968
+ || (payload.resume_handoff?.handoff?.next_steps && payload.resume_handoff.handoff.next_steps[0])
3969
+ || '';
3970
+ if (next) {
3971
+ process.stdout.write(next + '\n');
3972
+ process.exit(0);
3973
+ } else {
3974
+ process.exit(3);
3975
+ }
3976
+ }
3977
+
3978
+ // --next-steps: print all next_steps, numbered. Good for piping
3979
+ // to a task tracker or quick visual scan.
3980
+ if (flags.next_steps) {
3981
+ const steps = payload.next_actions
3982
+ || payload.resume_handoff?.handoff?.next_steps
3983
+ || [];
3984
+ if (steps.length === 0) process.exit(3);
3985
+ steps.forEach((s, i) => process.stdout.write(`${i + 1}. ${s}\n`));
3986
+ process.exit(0);
3987
+ }
3988
+
3989
+ // --files-only: list files_touched paths, one per line. Designed
3990
+ // for xargs / cat pipelines:
3991
+ // $ cat $(cf-memory-mcp resume --files-only)
3992
+ if (flags.files_only) {
3993
+ const files = payload.resume_handoff?.handoff?.files_touched || [];
3994
+ if (files.length === 0) process.exit(3);
3995
+ for (const f of files) {
3996
+ if (f.path) process.stdout.write(f.path + '\n');
3997
+ }
3998
+ process.exit(0);
3999
+ }
4000
+
4001
+ // --anchors-only: list code_anchors as "file:lines symbol".
4002
+ // Useful for jump-to-line tooling.
4003
+ if (flags.anchors_only) {
4004
+ const anchors = payload.active_code_context
4005
+ || payload.resume_handoff?.handoff?.code_anchors
4006
+ || [];
4007
+ if (anchors.length === 0) process.exit(3);
4008
+ for (const a of anchors) {
4009
+ const where = a.lines ? `${a.file_path}:${a.lines}` : a.file_path;
4010
+ const sym = a.name ? ` ${a.name}` : '';
4011
+ const staleMarker = a.stale ? ' [STALE]' : '';
4012
+ process.stdout.write(`${where}${sym}${staleMarker}\n`);
4013
+ }
4014
+ process.exit(0);
4015
+ }
4016
+
3955
4017
  // --md <path>: write the rendered markdown to a file instead of
3956
4018
  // (or in addition to) stdout. Useful for piping to a markdown
3957
4019
  // viewer or saving to the project.
@@ -4145,9 +4207,37 @@ async function runDeleteCli() {
4145
4207
  if (previewIds.length > 10) {
4146
4208
  process.stderr.write(` ... and ${preview.deleted_count - 10} more\n`);
4147
4209
  }
4148
- process.stderr.write(`\nRe-run with --yes to confirm:\n`);
4149
- process.stderr.write(` cf-memory-mcp delete ${process.argv.slice(3).join(' ')} --yes\n`);
4150
- process.exit(2);
4210
+ // Interactive TTY: prompt for confirmation instead of
4211
+ // requiring --yes. Piped/non-TTY stdin falls through to
4212
+ // the "re-run with --yes" path (avoids hangs in scripts).
4213
+ if (process.stdin.isTTY && process.stderr.isTTY) {
4214
+ process.stderr.write(`\nProceed with deletion? [y/N] `);
4215
+ const answer = await new Promise((resolve) => {
4216
+ process.stdin.setEncoding('utf8');
4217
+ let buf = '';
4218
+ const onData = (chunk) => {
4219
+ buf += chunk;
4220
+ const nl = buf.indexOf('\n');
4221
+ if (nl !== -1) {
4222
+ process.stdin.removeListener('data', onData);
4223
+ process.stdin.pause();
4224
+ resolve(buf.slice(0, nl).trim().toLowerCase());
4225
+ }
4226
+ };
4227
+ process.stdin.on('data', onData);
4228
+ process.stdin.resume();
4229
+ });
4230
+ if (answer === 'y' || answer === 'yes') {
4231
+ // Fall through to the actual delete below.
4232
+ } else {
4233
+ process.stderr.write(`Aborted.\n`);
4234
+ process.exit(2);
4235
+ }
4236
+ } else {
4237
+ process.stderr.write(`\nRe-run with --yes to confirm:\n`);
4238
+ process.stderr.write(` cf-memory-mcp delete ${process.argv.slice(3).join(' ')} --yes\n`);
4239
+ process.exit(2);
4240
+ }
4151
4241
  }
4152
4242
 
4153
4243
  const deleteRes = await server.makeRequest({
@@ -4322,12 +4412,16 @@ complete -c cf-memory-mcp -l version -s v -d 'Show version'
4322
4412
 
4323
4413
  // Per-command help texts. Used when "cf-memory-mcp <cmd> --help" is invoked.
4324
4414
  const PER_COMMAND_HELP = {
4325
- resume: `cf-memory-mcp resume [<session-id-prefix>] [--md path] [--json]
4415
+ resume: `cf-memory-mcp resume [<session-id-prefix>] [--md path] [--next-only|--next-steps|--files-only|--anchors-only] [--json]
4326
4416
  Print the prior resume handoff (markdown by default).
4327
4417
  <session-id-prefix> Optional: pick a specific session (>=8 char prefix or full UUID).
4328
4418
  --md <path> Write the markdown to a file instead of stdout.
4419
+ --next-only Print just the first next_step (for shell prompts).
4420
+ --next-steps Print ALL next_steps, numbered.
4421
+ --files-only Print files_touched paths, one per line (xargs-friendly).
4422
+ --anchors-only Print code_anchors as "file:lines symbol".
4329
4423
  --json, -j Emit the full bootstrap payload as JSON for scripts.
4330
- Exit codes: 0 = handoff found, 3 = no handoff found.`,
4424
+ Exit codes: 0 = handoff found, 3 = no handoff or no data for the flag.`,
4331
4425
  list: `cf-memory-mcp list [--status S] [--since ISO] [--repo PATH] [--limit N] [--json]
4332
4426
  List recent handoffs for the current cwd, status-ranked. Header shows
4333
4427
  a status-count summary.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cf-memory-mcp",
3
- "version": "3.33.0",
3
+ "version": "3.35.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": {