cf-memory-mcp 3.34.0 → 3.36.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.
@@ -3872,6 +3872,16 @@ function parseCliArgs(rest) {
3872
3872
  flags.md_path = a.slice('--md='.length);
3873
3873
  } else if (a === '--next-only') {
3874
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;
3881
+ } else if (a === '--decisions-only') {
3882
+ flags.decisions_only = true;
3883
+ } else if (a === '--blockers-only') {
3884
+ flags.blockers_only = true;
3875
3885
  } else if (a === '--older-than') {
3876
3886
  // Accept "7d" / "30d" / "12h" / raw number (days).
3877
3887
  const raw = rest[++i] || '';
@@ -3969,6 +3979,62 @@ async function runResumeCli() {
3969
3979
  }
3970
3980
  }
3971
3981
 
3982
+ // --next-steps: print all next_steps, numbered. Good for piping
3983
+ // to a task tracker or quick visual scan.
3984
+ if (flags.next_steps) {
3985
+ const steps = payload.next_actions
3986
+ || payload.resume_handoff?.handoff?.next_steps
3987
+ || [];
3988
+ if (steps.length === 0) process.exit(3);
3989
+ steps.forEach((s, i) => process.stdout.write(`${i + 1}. ${s}\n`));
3990
+ process.exit(0);
3991
+ }
3992
+
3993
+ // --files-only: list files_touched paths, one per line. Designed
3994
+ // for xargs / cat pipelines:
3995
+ // $ cat $(cf-memory-mcp resume --files-only)
3996
+ if (flags.files_only) {
3997
+ const files = payload.resume_handoff?.handoff?.files_touched || [];
3998
+ if (files.length === 0) process.exit(3);
3999
+ for (const f of files) {
4000
+ if (f.path) process.stdout.write(f.path + '\n');
4001
+ }
4002
+ process.exit(0);
4003
+ }
4004
+
4005
+ // --anchors-only: list code_anchors as "file:lines symbol".
4006
+ // Useful for jump-to-line tooling.
4007
+ if (flags.anchors_only) {
4008
+ const anchors = payload.active_code_context
4009
+ || payload.resume_handoff?.handoff?.code_anchors
4010
+ || [];
4011
+ if (anchors.length === 0) process.exit(3);
4012
+ for (const a of anchors) {
4013
+ const where = a.lines ? `${a.file_path}:${a.lines}` : a.file_path;
4014
+ const sym = a.name ? ` ${a.name}` : '';
4015
+ const staleMarker = a.stale ? ' [STALE]' : '';
4016
+ process.stdout.write(`${where}${sym}${staleMarker}\n`);
4017
+ }
4018
+ process.exit(0);
4019
+ }
4020
+
4021
+ // --decisions-only: list decisions from the handoff, one per line.
4022
+ if (flags.decisions_only) {
4023
+ const decisions = payload.resume_handoff?.handoff?.decisions || [];
4024
+ if (decisions.length === 0) process.exit(3);
4025
+ for (const d of decisions) process.stdout.write(`- ${d}\n`);
4026
+ process.exit(0);
4027
+ }
4028
+
4029
+ // --blockers-only: list open blockers, one per line. Empty list
4030
+ // exits 3 so scripts can branch on "no blockers".
4031
+ if (flags.blockers_only) {
4032
+ const blockers = payload.resume_handoff?.handoff?.blockers || [];
4033
+ if (blockers.length === 0) process.exit(3);
4034
+ for (const b of blockers) process.stdout.write(`- ${b}\n`);
4035
+ process.exit(0);
4036
+ }
4037
+
3972
4038
  // --md <path>: write the rendered markdown to a file instead of
3973
4039
  // (or in addition to) stdout. Useful for piping to a markdown
3974
4040
  // viewer or saving to the project.
@@ -4367,13 +4433,19 @@ complete -c cf-memory-mcp -l version -s v -d 'Show version'
4367
4433
 
4368
4434
  // Per-command help texts. Used when "cf-memory-mcp <cmd> --help" is invoked.
4369
4435
  const PER_COMMAND_HELP = {
4370
- resume: `cf-memory-mcp resume [<session-id-prefix>] [--md path] [--next-only] [--json]
4436
+ resume: `cf-memory-mcp resume [<session-id-prefix>] [--md path] [<extract-flag>] [--json]
4371
4437
  Print the prior resume handoff (markdown by default).
4372
4438
  <session-id-prefix> Optional: pick a specific session (>=8 char prefix or full UUID).
4373
4439
  --md <path> Write the markdown to a file instead of stdout.
4374
- --next-only Print just the first next_step (for shell prompts / one-liners).
4375
- --json, -j Emit the full bootstrap payload as JSON for scripts.
4376
- Exit codes: 0 = handoff found, 3 = no handoff found.`,
4440
+ Extract flags (pick one; each exits 3 if the section is empty):
4441
+ --next-only First next_step only (for shell prompts).
4442
+ --next-steps All next_steps, numbered.
4443
+ --files-only files_touched paths, one per line (xargs-friendly).
4444
+ --anchors-only code_anchors as "file:lines symbol".
4445
+ --decisions-only decisions, one per line.
4446
+ --blockers-only open blockers, one per line.
4447
+ --json, -j Full bootstrap payload as JSON.
4448
+ Exit codes: 0 = found, 3 = no handoff / no data.`,
4377
4449
  list: `cf-memory-mcp list [--status S] [--since ISO] [--repo PATH] [--limit N] [--json]
4378
4450
  List recent handoffs for the current cwd, status-ranked. Header shows
4379
4451
  a status-count summary.
@@ -4842,11 +4914,14 @@ async function runCheckpointCli() {
4842
4914
  // Optional positional goal argument: `cf-memory-mcp checkpoint "<goal text>"`
4843
4915
  const goalArg = positional.filter(p => p !== '--force' && p !== '-f').join(' ').trim();
4844
4916
 
4845
- // Duplicate detection: before creating a new implicit session,
4846
- // check if there's a recent in_progress handoff for the same
4847
- // repo/branch. If so, suggest resuming it instead of churning a
4848
- // new one. Skipped with --force.
4849
- if (!force) {
4917
+ // Duplicate detection + parent linking: before creating a new
4918
+ // implicit session, check if there's a recent in_progress handoff
4919
+ // for the same repo/branch. If so, suggest resuming it instead
4920
+ // of churning a new one. With --force, proceed but record the
4921
+ // existing session id as the new handoff's parent_session_id so
4922
+ // the chain can be traced later.
4923
+ let parentSessionId = null;
4924
+ if (true) { // always probe to capture parent; --force only bypasses the abort
4850
4925
  const meta = server.getRepoMetadata();
4851
4926
  if (meta.repo_path) {
4852
4927
  const probeArgs = { resume: true, repo_path: meta.repo_path, status_filter: 'in_progress', max_age_minutes: 60 };
@@ -4864,7 +4939,7 @@ async function runCheckpointCli() {
4864
4939
  // Same-cwd implicit session won't be in the worker yet
4865
4940
  // unless someone called start_session — we look for
4866
4941
  // OTHER active threads on the same repo.
4867
- if (recent) {
4942
+ if (recent && !force) {
4868
4943
  const shortId = (recent.session_id || '').slice(0, 8);
4869
4944
  const ageMin = recent.handoff_age_minutes ?? '?';
4870
4945
  const status = recent.handoff?.status || '?';
@@ -4885,6 +4960,9 @@ async function runCheckpointCli() {
4885
4960
  process.stderr.write(`Resume it: cf-memory-mcp resume ${shortId}\n`);
4886
4961
  process.stderr.write(`Or re-run with --force to create a new session anyway.\n`);
4887
4962
  process.exit(4);
4963
+ } else if (recent && force) {
4964
+ // --force: proceed, but record the parent link.
4965
+ parentSessionId = recent.session_id;
4888
4966
  }
4889
4967
  } catch (_) { /* probe failure is non-fatal */ }
4890
4968
  }
@@ -4902,6 +4980,7 @@ async function runCheckpointCli() {
4902
4980
  // this is a fresh process).
4903
4981
  const handoff = server.synthesizeMinimalHandoff();
4904
4982
  if (goalArg) handoff.goal = goalArg;
4983
+ if (parentSessionId) handoff.parent_session_id = parentSessionId;
4905
4984
  if (meta.repo_path) handoff.repo_path = meta.repo_path;
4906
4985
  if (meta.branch) handoff.branch = meta.branch;
4907
4986
  const fake = { params: { name: 'retrieve_context', arguments: {} } };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cf-memory-mcp",
3
- "version": "3.34.0",
3
+ "version": "3.36.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": {