cf-memory-mcp 3.41.0 → 3.42.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.
@@ -3890,6 +3890,42 @@ For more information, visit: https://github.com/johnlam90/cf-memory-mcp
3890
3890
  process.exit(0);
3891
3891
  }
3892
3892
 
3893
+ /**
3894
+ * Pipe a string to the platform clipboard. Returns true on success.
3895
+ * Detects the right command per platform; falls back gracefully when
3896
+ * none are installed. Bounded by a 2s timeout so a hung clipboard
3897
+ * helper can't lock the CLI.
3898
+ */
3899
+ function copyToClipboard(text) {
3900
+ const { spawnSync } = require('child_process');
3901
+ let cmd, args;
3902
+ if (process.platform === 'darwin') {
3903
+ cmd = 'pbcopy'; args = [];
3904
+ } else if (process.platform === 'win32') {
3905
+ cmd = 'clip'; args = [];
3906
+ } else {
3907
+ // Linux: try xclip first, then wl-copy (Wayland).
3908
+ const which = spawnSync('which', ['xclip']);
3909
+ if (which.status === 0) {
3910
+ cmd = 'xclip'; args = ['-selection', 'clipboard'];
3911
+ } else {
3912
+ const which2 = spawnSync('which', ['wl-copy']);
3913
+ if (which2.status === 0) {
3914
+ cmd = 'wl-copy'; args = [];
3915
+ } else {
3916
+ return { ok: false, error: 'install xclip or wl-copy to use --copy' };
3917
+ }
3918
+ }
3919
+ }
3920
+ try {
3921
+ const res = spawnSync(cmd, args, { input: text, timeout: 2000 });
3922
+ if (res.status === 0) return { ok: true };
3923
+ return { ok: false, error: `${cmd} exited ${res.status}: ${res.stderr?.toString().slice(0, 200) || ''}` };
3924
+ } catch (err) {
3925
+ return { ok: false, error: `${cmd} failed: ${err.message}` };
3926
+ }
3927
+ }
3928
+
3893
3929
  // Parse positional + flag args for CLI subcommands. Returns
3894
3930
  // { positional: string[], flags: { json, limit, md_path, older_than_days, status, repo_path, yes } }.
3895
3931
  function parseCliArgs(rest) {
@@ -3926,6 +3962,8 @@ function parseCliArgs(rest) {
3926
3962
  flags.validate = true;
3927
3963
  } else if (a === '--raw') {
3928
3964
  flags.raw = true;
3965
+ } else if (a === '--copy') {
3966
+ flags.copy = true;
3929
3967
  } else if (a === '--older-than') {
3930
3968
  // Accept "7d" / "30d" / "12h" / raw number (days).
3931
3969
  const raw = rest[++i] || '';
@@ -4205,6 +4243,19 @@ async function runResumeCli() {
4205
4243
  }
4206
4244
  }
4207
4245
 
4246
+ // --copy: pipe rendered markdown to platform clipboard. Quick
4247
+ // paste into another chat client or doc tool.
4248
+ if (found && flags.copy && payload.resume_prompt) {
4249
+ const result = copyToClipboard(payload.resume_prompt);
4250
+ if (result.ok) {
4251
+ process.stdout.write(`Copied ${payload.resume_prompt.length} chars to clipboard.\n`);
4252
+ process.exit(0);
4253
+ } else {
4254
+ process.stderr.write(`Failed to copy to clipboard: ${result.error}\n`);
4255
+ process.exit(1);
4256
+ }
4257
+ }
4258
+
4208
4259
  if (flags.json) {
4209
4260
  process.stdout.write(JSON.stringify(payload, null, 2) + '\n');
4210
4261
  process.exit(found ? 0 : 3);
@@ -4679,6 +4730,7 @@ const PER_COMMAND_HELP = {
4679
4730
  Print the prior resume handoff (markdown by default).
4680
4731
  <session-id-prefix> Optional: pick a specific session (>=8 char prefix or full UUID).
4681
4732
  --md <path> Write the markdown to a file instead of stdout.
4733
+ --copy Pipe the markdown to the platform clipboard (pbcopy/xclip/wl-copy/clip).
4682
4734
  Extract flags (pick one; each exits 3 if the section is empty):
4683
4735
  --next-only First next_step only (for shell prompts).
4684
4736
  --next-steps All next_steps, numbered.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cf-memory-mcp",
3
- "version": "3.41.0",
3
+ "version": "3.42.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": {