coding-friend-cli 1.32.0 → 1.32.2

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.
@@ -7,16 +7,16 @@ import {
7
7
  } from "./chunk-DMJCO6LJ.js";
8
8
  import {
9
9
  resolveScope
10
- } from "./chunk-HPNRQYLM.js";
10
+ } from "./chunk-Z5Q533UG.js";
11
+ import {
12
+ claudeSettingsPath
13
+ } from "./chunk-TWKNGPBO.js";
11
14
  import {
12
15
  commandExists,
13
16
  run,
14
17
  runWithStderr,
15
18
  sleepSync
16
19
  } from "./chunk-EVGXUDX4.js";
17
- import {
18
- claudeSettingsPath
19
- } from "./chunk-TWKNGPBO.js";
20
20
  import {
21
21
  log,
22
22
  printBanner
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  memoryConfigMenu
3
- } from "./chunk-U7IVVN45.js";
4
- import "./chunk-RZRT7NGT.js";
3
+ } from "./chunk-3QK6S74O.js";
5
4
  import "./chunk-GTX6I57V.js";
5
+ import "./chunk-RZRT7NGT.js";
6
6
  import {
7
7
  findStatuslineHookPath,
8
8
  getCurrentAccountEmail,
@@ -32,10 +32,7 @@ import {
32
32
  getScopeLabel,
33
33
  injectBackChoice,
34
34
  showConfigHint
35
- } from "./chunk-HPNRQYLM.js";
36
- import {
37
- run
38
- } from "./chunk-EVGXUDX4.js";
35
+ } from "./chunk-Z5Q533UG.js";
39
36
  import {
40
37
  claudeLocalSettingsPath,
41
38
  claudeProjectSettingsPath,
@@ -44,6 +41,9 @@ import {
44
41
  localConfigPath,
45
42
  resolvePath
46
43
  } from "./chunk-TWKNGPBO.js";
44
+ import {
45
+ run
46
+ } from "./chunk-EVGXUDX4.js";
47
47
  import {
48
48
  log,
49
49
  printBanner
@@ -593,7 +593,7 @@ async function editPermissions() {
593
593
  )
594
594
  });
595
595
  if (choice === BACK) return;
596
- const { permissionCommand } = await import("./permission-C5R3LMZQ.js");
596
+ const { permissionCommand } = await import("./permission-DNW7DE24.js");
597
597
  switch (choice) {
598
598
  case "interactive":
599
599
  await permissionCommand({});
@@ -4,9 +4,9 @@ import {
4
4
  } from "./chunk-R6HDMRYL.js";
5
5
  import {
6
6
  resolveScope
7
- } from "./chunk-HPNRQYLM.js";
8
- import "./chunk-EVGXUDX4.js";
7
+ } from "./chunk-Z5Q533UG.js";
9
8
  import "./chunk-TWKNGPBO.js";
9
+ import "./chunk-EVGXUDX4.js";
10
10
  import {
11
11
  log
12
12
  } from "./chunk-NREZK463.js";
@@ -4,9 +4,9 @@ import {
4
4
  } from "./chunk-R6HDMRYL.js";
5
5
  import {
6
6
  resolveScope
7
- } from "./chunk-HPNRQYLM.js";
8
- import "./chunk-EVGXUDX4.js";
7
+ } from "./chunk-Z5Q533UG.js";
9
8
  import "./chunk-TWKNGPBO.js";
9
+ import "./chunk-EVGXUDX4.js";
10
10
  import {
11
11
  log
12
12
  } from "./chunk-NREZK463.js";
package/dist/index.js CHANGED
@@ -14,54 +14,62 @@ program.name("cf").description(
14
14
  "coding-friend CLI \u2014 host learning docs, setup MCP, init projects"
15
15
  ).version(pkg.version, "-v, --version");
16
16
  program.command("install").description("Install the Coding Friend plugin into Claude Code").option("--user", "Install at user scope (all projects)").option("--global", "Install at user scope (all projects)").option("--project", "Install at project scope (shared via git)").option("--local", "Install at local scope (this machine only)").action(async (opts) => {
17
- const { installCommand } = await import("./install-JR4ITJVU.js");
17
+ const { installCommand } = await import("./install-22BLHQ6D.js");
18
18
  await installCommand(opts);
19
19
  });
20
20
  program.command("uninstall").description("Uninstall the Coding Friend plugin from Claude Code").option("--user", "Uninstall from user scope (all projects)").option("--global", "Uninstall from user scope (all projects)").option("--project", "Uninstall from project scope").option("--local", "Uninstall from local scope").action(async (opts) => {
21
- const { uninstallCommand } = await import("./uninstall-BOVKPNYN.js");
21
+ const { uninstallCommand } = await import("./uninstall-6ZJRS2H4.js");
22
22
  await uninstallCommand(opts);
23
23
  });
24
24
  program.command("disable").description("Disable the Coding Friend plugin without uninstalling").option("--user", "Disable at user scope (all projects)").option("--global", "Disable at user scope (all projects)").option("--project", "Disable at project scope").option("--local", "Disable at local scope").action(async (opts) => {
25
- const { disableCommand } = await import("./disable-CDOM7SSI.js");
25
+ const { disableCommand } = await import("./disable-ZWQVU3QZ.js");
26
26
  await disableCommand(opts);
27
27
  });
28
28
  program.command("enable").description("Re-enable the Coding Friend plugin").option("--user", "Enable at user scope (all projects)").option("--global", "Enable at user scope (all projects)").option("--project", "Enable at project scope").option("--local", "Enable at local scope").action(async (opts) => {
29
- const { enableCommand } = await import("./enable-SF7742UR.js");
29
+ const { enableCommand } = await import("./enable-NXP6APNI.js");
30
30
  await enableCommand(opts);
31
31
  });
32
32
  program.command("init").description("Initialize coding-friend in current project").action(async () => {
33
- const { initCommand } = await import("./init-H2EOLWJ5.js");
33
+ const { initCommand } = await import("./init-F2NO6NCJ.js");
34
34
  await initCommand();
35
35
  });
36
36
  program.command("config").description("Manage Coding Friend configuration").action(async () => {
37
- const { configCommand } = await import("./config-OBCZNDKV.js");
37
+ const { configCommand } = await import("./config-RE4SQ6Y7.js");
38
38
  await configCommand();
39
39
  });
40
40
  program.command("host").description("Build and serve learning docs as a static website").argument("[path]", "path to docs folder").option("-p, --port <port>", "port number", "3333").action(async (path, opts) => {
41
- const { hostCommand } = await import("./host-N3GQ6OJM.js");
41
+ const { hostCommand } = await import("./host-XZZEMMMI.js");
42
42
  await hostCommand(path, opts);
43
43
  });
44
44
  program.command("mcp").description("Setup MCP server for learning docs").argument("[path]", "path to docs folder").action(async (path) => {
45
- const { mcpCommand } = await import("./mcp-G4FEXMZW.js");
45
+ const { mcpCommand } = await import("./mcp-VQ5OXXU7.js");
46
46
  await mcpCommand(path);
47
47
  });
48
+ program.command("mcp-serve").description("Start the cf-memory MCP server (used internally by npx)").argument("<memoryDir>", "path to memory directory").action(async (memoryDir) => {
49
+ const { mcpServeCommand } = await import("./mcp-serve-3FEPFVVQ.js");
50
+ await mcpServeCommand(memoryDir);
51
+ });
52
+ program.command("mcp-serve-learn").description("Start the learn MCP server (used internally by npx)").argument("<docsDir>", "path to docs directory").action(async (docsDir) => {
53
+ const { mcpServeLearnCommand } = await import("./mcp-serve-learn-UNW6VH5M.js");
54
+ await mcpServeLearnCommand(docsDir);
55
+ });
48
56
  program.command("permission").description("Manage Claude Code permission rules for Coding Friend").option("--all", "Apply all recommended permissions without prompts").option("--user", "Save to user-level settings (~/.claude/settings.json)").option(
49
57
  "--project",
50
58
  "Save to project-level settings (.claude/settings.local.json)"
51
59
  ).action(async (opts) => {
52
- const { permissionCommand } = await import("./permission-C5R3LMZQ.js");
60
+ const { permissionCommand } = await import("./permission-DNW7DE24.js");
53
61
  await permissionCommand(opts);
54
62
  });
55
63
  program.command("statusline").description("Setup coding-friend statusline in Claude Code").action(async () => {
56
- const { statuslineCommand } = await import("./statusline-5X7FZGRU.js");
64
+ const { statuslineCommand } = await import("./statusline-GKVAX7GR.js");
57
65
  await statuslineCommand();
58
66
  });
59
67
  program.command("update").description("Update coding-friend plugin, CLI, and statusline").option("--cli", "Update only the CLI (npm package)").option("--plugin", "Update only the Claude Code plugin").option("--statusline", "Update only the statusline").option("--user", "Update plugin at user scope (all projects)").option("--global", "Update plugin at user scope (all projects)").option("--project", "Update plugin at project scope").option("--local", "Update plugin at local scope").action(async (opts) => {
60
- const { updateCommand } = await import("./update-JBCG4CY2.js");
68
+ const { updateCommand } = await import("./update-P5ZR2JVQ.js");
61
69
  await updateCommand(opts);
62
70
  });
63
71
  program.command("status").description("Show comprehensive Coding Friend status").action(async () => {
64
- const { statusCommand } = await import("./status-EFEXM3ZM.js");
72
+ const { statusCommand } = await import("./status-7YW3YV2Y.js");
65
73
  await statusCommand();
66
74
  });
67
75
  var session = program.command("session").description("Save and load Claude Code sessions across machines");
@@ -100,43 +108,43 @@ Memory subcommands:
100
108
  memory mcp Show MCP server setup instructions`
101
109
  );
102
110
  memory.command("status").description("Show memory system status").action(async () => {
103
- const { memoryStatusCommand } = await import("./memory-SO33RAI5.js");
111
+ const { memoryStatusCommand } = await import("./memory-GKANJJXU.js");
104
112
  await memoryStatusCommand();
105
113
  });
106
114
  memory.command("search").description("Search memories by query").argument("<query>", "search query").action(async (query) => {
107
- const { memorySearchCommand } = await import("./memory-SO33RAI5.js");
115
+ const { memorySearchCommand } = await import("./memory-GKANJJXU.js");
108
116
  await memorySearchCommand(query);
109
117
  });
110
118
  memory.command("list").description(
111
119
  "List memories in current project, or all projects with --projects"
112
120
  ).option("--projects", "List all project databases with size and metadata").action(async (opts) => {
113
- const { memoryListCommand } = await import("./memory-SO33RAI5.js");
121
+ const { memoryListCommand } = await import("./memory-GKANJJXU.js");
114
122
  await memoryListCommand(opts);
115
123
  });
116
124
  memory.command("init").description(
117
125
  "Initialize memory system \u2014 interactive wizard (first time) or config menu"
118
126
  ).action(async () => {
119
- const { memoryInitCommand } = await import("./memory-SO33RAI5.js");
127
+ const { memoryInitCommand } = await import("./memory-GKANJJXU.js");
120
128
  await memoryInitCommand();
121
129
  });
122
130
  memory.command("config").description("Configure memory system settings").action(async () => {
123
- const { memoryConfigCommand } = await import("./memory-SO33RAI5.js");
131
+ const { memoryConfigCommand } = await import("./memory-GKANJJXU.js");
124
132
  await memoryConfigCommand();
125
133
  });
126
134
  memory.command("start-daemon").description("Start the memory daemon (Tier 2 \u2014 MiniSearch)").action(async () => {
127
- const { memoryStartDaemonCommand } = await import("./memory-SO33RAI5.js");
135
+ const { memoryStartDaemonCommand } = await import("./memory-GKANJJXU.js");
128
136
  await memoryStartDaemonCommand();
129
137
  });
130
138
  memory.command("stop-daemon").description("Stop the memory daemon").action(async () => {
131
- const { memoryStopDaemonCommand } = await import("./memory-SO33RAI5.js");
139
+ const { memoryStopDaemonCommand } = await import("./memory-GKANJJXU.js");
132
140
  await memoryStopDaemonCommand();
133
141
  });
134
142
  memory.command("rebuild").description("Rebuild the daemon search index").action(async () => {
135
- const { memoryRebuildCommand } = await import("./memory-SO33RAI5.js");
143
+ const { memoryRebuildCommand } = await import("./memory-GKANJJXU.js");
136
144
  await memoryRebuildCommand();
137
145
  });
138
146
  memory.command("mcp").description("Show MCP server setup instructions").action(async () => {
139
- const { memoryMcpCommand } = await import("./memory-SO33RAI5.js");
147
+ const { memoryMcpCommand } = await import("./memory-GKANJJXU.js");
140
148
  await memoryMcpCommand();
141
149
  });
142
150
  memory.command("rm").description("Remove a project database").option("--project-id <id>", "Project ID to remove").option("--all", "Remove all project databases").option(
@@ -144,7 +152,7 @@ memory.command("rm").description("Remove a project database").option("--project-
144
152
  "Remove orphaned projects (source dir missing or 0 memories)"
145
153
  ).action(
146
154
  async (opts) => {
147
- const { memoryRmCommand } = await import("./memory-SO33RAI5.js");
155
+ const { memoryRmCommand } = await import("./memory-GKANJJXU.js");
148
156
  await memoryRmCommand(opts);
149
157
  }
150
158
  );
@@ -170,41 +178,41 @@ Dev subcommands:
170
178
  dev update [path] Update local dev plugin to latest version`
171
179
  );
172
180
  dev.command("on").description("Switch to local plugin source").argument("[path]", "path to local coding-friend repo (default: cwd)").action(async (path) => {
173
- const { devOnCommand } = await import("./dev-VNDV6R24.js");
181
+ const { devOnCommand } = await import("./dev-QXVERU42.js");
174
182
  await devOnCommand(path);
175
183
  });
176
184
  dev.command("off").description("Switch back to remote marketplace").action(async () => {
177
- const { devOffCommand } = await import("./dev-VNDV6R24.js");
185
+ const { devOffCommand } = await import("./dev-QXVERU42.js");
178
186
  await devOffCommand();
179
187
  });
180
188
  dev.command("status").description("Show current dev mode").action(async () => {
181
- const { devStatusCommand } = await import("./dev-VNDV6R24.js");
189
+ const { devStatusCommand } = await import("./dev-QXVERU42.js");
182
190
  await devStatusCommand();
183
191
  });
184
192
  dev.command("sync").description(
185
193
  "Copy local source files to plugin cache (no version bump needed)"
186
194
  ).action(async () => {
187
- const { devSyncCommand } = await import("./dev-VNDV6R24.js");
195
+ const { devSyncCommand } = await import("./dev-QXVERU42.js");
188
196
  await devSyncCommand();
189
197
  });
190
198
  dev.command("restart").description("Reinstall local dev plugin (off + on)").argument(
191
199
  "[path]",
192
200
  "path to local coding-friend repo (default: saved path or cwd)"
193
201
  ).action(async (path) => {
194
- const { devRestartCommand } = await import("./dev-VNDV6R24.js");
202
+ const { devRestartCommand } = await import("./dev-QXVERU42.js");
195
203
  await devRestartCommand(path);
196
204
  });
197
205
  dev.command("update").description("Update local dev plugin to latest version (off + on)").argument(
198
206
  "[path]",
199
207
  "path to local coding-friend repo (default: saved path or cwd)"
200
208
  ).action(async (path) => {
201
- const { devUpdateCommand } = await import("./dev-VNDV6R24.js");
209
+ const { devUpdateCommand } = await import("./dev-QXVERU42.js");
202
210
  await devUpdateCommand(path);
203
211
  });
204
212
  program.hook("postAction", async () => {
205
213
  const topCmd = process.argv[2];
206
214
  if (topCmd === "update") return;
207
- const { checkAndNotifyCliUpdate } = await import("./update-check-BPCQ25AR.js");
215
+ const { checkAndNotifyCliUpdate } = await import("./update-check-5SCD2JR2.js");
208
216
  checkAndNotifyCliUpdate(pkg.version);
209
217
  });
210
218
  await program.parseAsync();
@@ -2,14 +2,14 @@ import {
2
2
  ensureMemoryBuilt,
3
3
  isMemoryInitialized,
4
4
  memoryInitWizard
5
- } from "./chunk-5OXEUKOE.js";
5
+ } from "./chunk-66EDSJ6W.js";
6
6
  import {
7
7
  memoryConfigMenu
8
- } from "./chunk-U7IVVN45.js";
8
+ } from "./chunk-3QK6S74O.js";
9
+ import "./chunk-GTX6I57V.js";
9
10
  import {
10
11
  getLibPath
11
12
  } from "./chunk-RZRT7NGT.js";
12
- import "./chunk-GTX6I57V.js";
13
13
  import {
14
14
  findStatuslineHookPath,
15
15
  getCurrentAccountEmail,
@@ -38,11 +38,7 @@ import {
38
38
  getScopeLabel,
39
39
  injectBackChoice,
40
40
  showConfigHint
41
- } from "./chunk-HPNRQYLM.js";
42
- import {
43
- commandExists,
44
- run
45
- } from "./chunk-EVGXUDX4.js";
41
+ } from "./chunk-Z5Q533UG.js";
46
42
  import {
47
43
  claudeLocalSettingsPath,
48
44
  claudeProjectSettingsPath,
@@ -51,6 +47,10 @@ import {
51
47
  localConfigPath,
52
48
  resolvePath
53
49
  } from "./chunk-TWKNGPBO.js";
50
+ import {
51
+ commandExists,
52
+ run
53
+ } from "./chunk-EVGXUDX4.js";
54
54
  import {
55
55
  log,
56
56
  printBanner
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getLatestVersion,
3
3
  semverCompare
4
- } from "./chunk-4IUUWBZG.js";
4
+ } from "./chunk-G4QGJEV7.js";
5
5
  import {
6
6
  getInstalledVersion
7
7
  } from "./chunk-LXZ47XCD.js";
@@ -16,14 +16,14 @@ import {
16
16
  } from "./chunk-R6HDMRYL.js";
17
17
  import {
18
18
  resolveScope
19
- } from "./chunk-HPNRQYLM.js";
19
+ } from "./chunk-Z5Q533UG.js";
20
+ import {
21
+ devStatePath
22
+ } from "./chunk-TWKNGPBO.js";
20
23
  import {
21
24
  commandExists,
22
25
  run
23
26
  } from "./chunk-EVGXUDX4.js";
24
- import {
25
- devStatePath
26
- } from "./chunk-TWKNGPBO.js";
27
27
  import {
28
28
  log,
29
29
  printBanner
@@ -1,21 +1,23 @@
1
1
  import {
2
+ detectMemoryMcpState,
2
3
  ensureMemoryBuilt,
3
- printMemoryMcpConfig
4
- } from "./chunk-5OXEUKOE.js";
5
- import "./chunk-U7IVVN45.js";
6
- import {
7
- getLibPath
8
- } from "./chunk-RZRT7NGT.js";
4
+ printMemoryMcpConfig,
5
+ warnStaleMcpJson
6
+ } from "./chunk-66EDSJ6W.js";
7
+ import "./chunk-3QK6S74O.js";
9
8
  import {
10
9
  resolveDocsDir,
11
10
  resolveMemoryDir
12
11
  } from "./chunk-GTX6I57V.js";
12
+ import {
13
+ getLibPath
14
+ } from "./chunk-RZRT7NGT.js";
13
15
  import "./chunk-DHH6SRXV.js";
14
- import "./chunk-HPNRQYLM.js";
16
+ import "./chunk-Z5Q533UG.js";
17
+ import "./chunk-TWKNGPBO.js";
15
18
  import {
16
19
  run
17
20
  } from "./chunk-EVGXUDX4.js";
18
- import "./chunk-TWKNGPBO.js";
19
21
  import {
20
22
  log,
21
23
  printBanner
@@ -38,6 +40,7 @@ function countMdFiles(dir) {
38
40
  return count;
39
41
  }
40
42
  async function mcpCommand(path) {
43
+ warnStaleMcpJson(resolveMemoryDir());
41
44
  const docsDir = resolveDocsDir(path);
42
45
  const mcpDir = getLibPath("learn-mcp");
43
46
  if (!existsSync(docsDir)) {
@@ -54,7 +57,6 @@ async function mcpCommand(path) {
54
57
  printBanner("\u{1F4DA} Learn MCP");
55
58
  log.info(`Docs folder: ${chalk.cyan(docsDir)}`);
56
59
  log.info(`Found: ${chalk.green(docCount)} docs`);
57
- console.log();
58
60
  if (!existsSync(join(mcpDir, "node_modules"))) {
59
61
  log.step("Installing MCP server dependencies (one-time setup)...");
60
62
  const result = run("npm", ["install", "--silent"], { cwd: mcpDir });
@@ -74,60 +76,24 @@ async function mcpCommand(path) {
74
76
  log.success("Done.");
75
77
  }
76
78
  console.log();
77
- const serverPath = join(mcpDir, "dist", "index.js");
78
79
  console.log(chalk.dim("Add this to your MCP client config:"));
79
80
  console.log();
80
- console.log(
81
- chalk.yellow.bold(
82
- "--- Claude Desktop / Claude Chat (claude_desktop_config.json) ---"
83
- )
84
- );
85
- console.log(`
86
- {
81
+ console.log(`{
87
82
  "mcpServers": {
88
83
  "coding-friend-learn": {
89
- "command": "node",
90
- "args": ["${serverPath}", "${docsDir}"]
84
+ "command": "npx",
85
+ "args": [
86
+ "-y",
87
+ "coding-friend-cli",
88
+ "mcp-serve-learn",
89
+ "${docsDir}"
90
+ ]
91
91
  }
92
92
  }
93
93
  }`);
94
94
  console.log();
95
- console.log(chalk.yellow.bold("--- Generic MCP client ---"));
96
- console.log(`
97
- Server command: node ${serverPath} ${docsDir}
98
- Transport: stdio`);
99
- console.log();
100
- console.log(chalk.yellow.bold("--- Available tools ---"));
101
- console.log();
102
- console.log(chalk.cyan.bold("Read:"));
103
- console.log(
104
- ` ${chalk.white("list-categories")} ${chalk.dim("List all categories with doc counts")}`
105
- );
106
- console.log(
107
- ` ${chalk.white("list-docs")} ${chalk.dim("List docs, filter by category/tag")}`
108
- );
109
- console.log(
110
- ` ${chalk.white("read-doc")} ${chalk.dim("Read full content of a doc")}`
111
- );
112
- console.log(
113
- ` ${chalk.white("search-docs")} ${chalk.dim("Full-text search across all docs")}`
114
- );
115
- console.log(
116
- ` ${chalk.white("get-review-list")} ${chalk.dim("Docs that need review")}`
117
- );
118
- console.log();
119
- console.log(chalk.cyan.bold("Write:"));
120
- console.log(
121
- ` ${chalk.white("create-doc")} ${chalk.dim("Create new learning doc")}`
122
- );
123
- console.log(
124
- ` ${chalk.white("update-doc")} ${chalk.dim("Append content or update tags")}`
125
- );
126
- console.log(
127
- ` ${chalk.white("improve-doc")} ${chalk.dim("Get improvement suggestions")}`
128
- );
129
- console.log(
130
- ` ${chalk.white("track-knowledge")} ${chalk.dim("Record understanding level (remembered/needs-review/new)")}`
95
+ log.dim(
96
+ "Available tools & resources: https://cf.dinhanhthi.com/docs/cli/cf-mcp/"
131
97
  );
132
98
  console.log();
133
99
  printMemoryMcp();
@@ -144,13 +110,13 @@ function printMemoryMcp() {
144
110
  return;
145
111
  }
146
112
  ensureMemoryBuilt(mcpDir);
147
- const serverPath = join(mcpDir, "dist", "index.js");
148
113
  console.log();
149
114
  printBanner("\u{1F9E0} Memory MCP", { color: chalk.magenta });
150
115
  log.info(`Memory dir: ${chalk.cyan(memoryDir)}`);
151
116
  console.log();
152
- printMemoryMcpConfig(serverPath, memoryDir);
117
+ printMemoryMcpConfig(memoryDir);
153
118
  }
154
119
  export {
120
+ detectMemoryMcpState,
155
121
  mcpCommand
156
122
  };
@@ -0,0 +1,27 @@
1
+ import {
2
+ getLibPath
3
+ } from "./chunk-RZRT7NGT.js";
4
+ import {
5
+ log
6
+ } from "./chunk-NREZK463.js";
7
+
8
+ // src/commands/mcp-serve.ts
9
+ import { spawn } from "child_process";
10
+ import { join } from "path";
11
+ async function mcpServeCommand(memoryDir) {
12
+ const mcpDir = getLibPath("cf-memory");
13
+ const serverPath = join(mcpDir, "dist", "index.js");
14
+ const child = spawn("node", [serverPath, memoryDir], {
15
+ stdio: "inherit"
16
+ });
17
+ child.on("error", (err) => {
18
+ log.error(`Failed to start memory MCP server: ${err.message}`);
19
+ process.exit(1);
20
+ });
21
+ child.on("exit", (code) => {
22
+ process.exit(code ?? 0);
23
+ });
24
+ }
25
+ export {
26
+ mcpServeCommand
27
+ };
@@ -0,0 +1,59 @@
1
+ import {
2
+ getLibPath
3
+ } from "./chunk-RZRT7NGT.js";
4
+ import {
5
+ runWithStderr
6
+ } from "./chunk-EVGXUDX4.js";
7
+ import {
8
+ log
9
+ } from "./chunk-NREZK463.js";
10
+
11
+ // src/commands/mcp-serve-learn.ts
12
+ import { spawn } from "child_process";
13
+ import { existsSync, statSync } from "fs";
14
+ import { join } from "path";
15
+ function ensureLearnBuilt(mcpDir) {
16
+ if (!existsSync(join(mcpDir, "node_modules"))) {
17
+ log.step("Installing learn server dependencies (one-time setup)...");
18
+ const result = runWithStderr("npm", ["install"], { cwd: mcpDir });
19
+ if (result.exitCode !== 0) {
20
+ log.error("Failed to install dependencies");
21
+ if (result.stderr) log.error(result.stderr);
22
+ process.exit(1);
23
+ }
24
+ log.success("Done.");
25
+ }
26
+ if (!existsSync(join(mcpDir, "dist"))) {
27
+ log.step("Building learn server...");
28
+ const result = runWithStderr("npm", ["run", "build"], { cwd: mcpDir });
29
+ if (result.exitCode !== 0) {
30
+ log.error("Failed to build learn server");
31
+ if (result.stderr) log.error(result.stderr);
32
+ process.exit(1);
33
+ }
34
+ log.success("Done.");
35
+ }
36
+ }
37
+ async function mcpServeLearnCommand(docsDir) {
38
+ if (!existsSync(docsDir) || !statSync(docsDir).isDirectory()) {
39
+ log.error(`Docs directory not found: ${docsDir}`);
40
+ process.exit(1);
41
+ return;
42
+ }
43
+ const mcpDir = getLibPath("learn-mcp");
44
+ ensureLearnBuilt(mcpDir);
45
+ const serverPath = join(mcpDir, "dist", "index.js");
46
+ const child = spawn("node", [serverPath, docsDir], {
47
+ stdio: "inherit"
48
+ });
49
+ child.on("error", (err) => {
50
+ log.error(`Failed to start learn MCP server: ${err.message}`);
51
+ process.exit(1);
52
+ });
53
+ child.on("exit", (code) => {
54
+ process.exit(code ?? 0);
55
+ });
56
+ }
57
+ export {
58
+ mcpServeLearnCommand
59
+ };
@@ -13,14 +13,14 @@ import {
13
13
  memoryStatusCommand,
14
14
  memoryStopDaemonCommand,
15
15
  printMemoryMcpConfig
16
- } from "./chunk-5OXEUKOE.js";
17
- import "./chunk-U7IVVN45.js";
18
- import "./chunk-RZRT7NGT.js";
16
+ } from "./chunk-66EDSJ6W.js";
17
+ import "./chunk-3QK6S74O.js";
19
18
  import "./chunk-GTX6I57V.js";
19
+ import "./chunk-RZRT7NGT.js";
20
20
  import "./chunk-DHH6SRXV.js";
21
- import "./chunk-HPNRQYLM.js";
22
- import "./chunk-EVGXUDX4.js";
21
+ import "./chunk-Z5Q533UG.js";
23
22
  import "./chunk-TWKNGPBO.js";
23
+ import "./chunk-EVGXUDX4.js";
24
24
  import "./chunk-NREZK463.js";
25
25
  import "./chunk-5UVDWG5L.js";
26
26
  export {
@@ -3,8 +3,7 @@ import {
3
3
  formatScopeLabel,
4
4
  getMergedValue,
5
5
  getScopeLabel
6
- } from "./chunk-HPNRQYLM.js";
7
- import "./chunk-EVGXUDX4.js";
6
+ } from "./chunk-Z5Q533UG.js";
8
7
  import {
9
8
  claudeLocalSettingsPath,
10
9
  claudeProjectSettingsPath,
@@ -12,6 +11,7 @@ import {
12
11
  globalConfigPath,
13
12
  localConfigPath
14
13
  } from "./chunk-TWKNGPBO.js";
14
+ import "./chunk-EVGXUDX4.js";
15
15
  import {
16
16
  log,
17
17
  printBanner
@@ -1,15 +1,15 @@
1
- import {
2
- getLibPath
3
- } from "./chunk-RZRT7NGT.js";
4
1
  import {
5
2
  resolveMemoryDir
6
3
  } from "./chunk-GTX6I57V.js";
4
+ import {
5
+ getLibPath
6
+ } from "./chunk-RZRT7NGT.js";
7
7
  import {
8
8
  getCliVersion,
9
9
  getLatestCliVersion,
10
10
  getLatestVersion,
11
11
  semverCompare
12
- } from "./chunk-4IUUWBZG.js";
12
+ } from "./chunk-G4QGJEV7.js";
13
13
  import {
14
14
  getInstalledVersion
15
15
  } from "./chunk-LXZ47XCD.js";
@@ -19,14 +19,14 @@ import {
19
19
  detectPluginScope,
20
20
  isPluginDisabled
21
21
  } from "./chunk-R6HDMRYL.js";
22
- import "./chunk-HPNRQYLM.js";
23
- import "./chunk-EVGXUDX4.js";
22
+ import "./chunk-Z5Q533UG.js";
24
23
  import {
25
24
  claudeSettingsPath,
26
25
  devStatePath,
27
26
  globalConfigPath,
28
27
  localConfigPath
29
28
  } from "./chunk-TWKNGPBO.js";
29
+ import "./chunk-EVGXUDX4.js";
30
30
  import "./chunk-NREZK463.js";
31
31
  import {
32
32
  getExistingRules
@@ -8,11 +8,7 @@ import {
8
8
  } from "./chunk-R6HDMRYL.js";
9
9
  import {
10
10
  resolveScope
11
- } from "./chunk-HPNRQYLM.js";
12
- import {
13
- commandExists,
14
- run
15
- } from "./chunk-EVGXUDX4.js";
11
+ } from "./chunk-Z5Q533UG.js";
16
12
  import {
17
13
  claudeSettingsPath,
18
14
  devStatePath,
@@ -21,6 +17,10 @@ import {
21
17
  marketplaceClonePath,
22
18
  memoryDepsDir
23
19
  } from "./chunk-TWKNGPBO.js";
20
+ import {
21
+ commandExists,
22
+ run
23
+ } from "./chunk-EVGXUDX4.js";
24
24
  import {
25
25
  log,
26
26
  printBanner