coding-friend-cli 1.21.1 → 1.23.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.
Files changed (40) hide show
  1. package/dist/{chunk-PDVSGGH6.js → chunk-2ETE7NEL.js} +32 -28
  2. package/dist/{chunk-PYTEAC6K.js → chunk-DMJCO6LJ.js} +1 -1
  3. package/dist/{chunk-3KXYEC2T.js → chunk-LTHJTWJ6.js} +82 -3
  4. package/dist/chunk-NREZK463.js +41 -0
  5. package/dist/{chunk-BIX7AJU3.js → chunk-O4CNZB5H.js} +1 -1
  6. package/dist/{memory-27ZSRPM7.js → chunk-WCSNAEOF.js} +155 -73
  7. package/dist/{config-5I3XJEEL.js → config-5DKOGWWJ.js} +9 -14
  8. package/dist/{dev-4A5CTBGK.js → dev-S7S3SFKI.js} +19 -18
  9. package/dist/{disable-FNMRPUO7.js → disable-V7OLXEUH.js} +2 -2
  10. package/dist/{enable-HUKTMK5U.js → enable-OLHRKZCV.js} +2 -2
  11. package/dist/{host-V5O3PDCF.js → host-RR6FT7AX.js} +7 -6
  12. package/dist/index.js +31 -31
  13. package/dist/{init-3XMC6YJI.js → init-6B2OHKFX.js} +22 -40
  14. package/dist/{install-5ZBHH2OM.js → install-BURZ5QEM.js} +7 -6
  15. package/dist/mcp-CB4PUUES.js +156 -0
  16. package/dist/memory-TJZNGTOA.js +37 -0
  17. package/dist/{permission-BEC6YZQA.js → permission-QIJLEMJ6.js} +4 -3
  18. package/dist/postinstall.js +2 -2
  19. package/dist/{session-ZDJ2APGL.js → session-IECOM63R.js} +1 -1
  20. package/dist/{status-F6WASK7N.js → status-ZZRJ3VGF.js} +7 -7
  21. package/dist/{statusline-AISH77XP.js → statusline-YL44XYGF.js} +4 -3
  22. package/dist/{uninstall-RJ6SBB76.js → uninstall-OXWRPWYF.js} +7 -6
  23. package/dist/{update-536C3YG7.js → update-6N7EASFT.js} +4 -4
  24. package/dist/{update-check-L5TNWT2J.js → update-check-XSETLRVR.js} +1 -1
  25. package/lib/cf-memory/README.md +4 -1
  26. package/lib/cf-memory/package.json +0 -1
  27. package/lib/cf-memory/src/__tests__/daemon-client.test.ts +146 -0
  28. package/lib/cf-memory/src/daemon/process.ts +7 -0
  29. package/lib/cf-memory/src/index.ts +21 -2
  30. package/lib/cf-memory/src/lib/daemon-client.ts +54 -3
  31. package/lib/cf-memory/src/lib/tier.ts +27 -3
  32. package/lib/learn-host/package.json +0 -1
  33. package/lib/learn-mcp/package.json +0 -1
  34. package/lib/learn-mcp/src/index.ts +8 -1
  35. package/package.json +1 -1
  36. package/dist/chunk-W5CD7WTX.js +0 -15
  37. package/dist/mcp-U34LFD34.js +0 -106
  38. package/lib/cf-memory/CHANGELOG.md +0 -42
  39. package/lib/learn-host/CHANGELOG.md +0 -35
  40. package/lib/learn-mcp/CHANGELOG.md +0 -16
package/dist/index.js CHANGED
@@ -14,54 +14,54 @@ 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-5ZBHH2OM.js");
17
+ const { installCommand } = await import("./install-BURZ5QEM.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-RJ6SBB76.js");
21
+ const { uninstallCommand } = await import("./uninstall-OXWRPWYF.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-FNMRPUO7.js");
25
+ const { disableCommand } = await import("./disable-V7OLXEUH.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-HUKTMK5U.js");
29
+ const { enableCommand } = await import("./enable-OLHRKZCV.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-3XMC6YJI.js");
33
+ const { initCommand } = await import("./init-6B2OHKFX.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-5I3XJEEL.js");
37
+ const { configCommand } = await import("./config-5DKOGWWJ.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-V5O3PDCF.js");
41
+ const { hostCommand } = await import("./host-RR6FT7AX.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-U34LFD34.js");
45
+ const { mcpCommand } = await import("./mcp-CB4PUUES.js");
46
46
  await mcpCommand(path);
47
47
  });
48
48
  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
49
  "--project",
50
50
  "Save to project-level settings (.claude/settings.local.json)"
51
51
  ).action(async (opts) => {
52
- const { permissionCommand } = await import("./permission-BEC6YZQA.js");
52
+ const { permissionCommand } = await import("./permission-QIJLEMJ6.js");
53
53
  await permissionCommand(opts);
54
54
  });
55
55
  program.command("statusline").description("Setup coding-friend statusline in Claude Code").action(async () => {
56
- const { statuslineCommand } = await import("./statusline-AISH77XP.js");
56
+ const { statuslineCommand } = await import("./statusline-YL44XYGF.js");
57
57
  await statuslineCommand();
58
58
  });
59
59
  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-536C3YG7.js");
60
+ const { updateCommand } = await import("./update-6N7EASFT.js");
61
61
  await updateCommand(opts);
62
62
  });
63
63
  program.command("status").description("Show comprehensive Coding Friend status").action(async () => {
64
- const { statusCommand } = await import("./status-F6WASK7N.js");
64
+ const { statusCommand } = await import("./status-ZZRJ3VGF.js");
65
65
  await statusCommand();
66
66
  });
67
67
  var session = program.command("session").description("Save and load Claude Code sessions across machines");
@@ -76,11 +76,11 @@ session.command("save").description("Save current Claude Code session to sync fo
76
76
  "-s, --session-id <id>",
77
77
  "session UUID to save (default: auto-detect newest)"
78
78
  ).option("-l, --label <label>", "label for this session").action(async (opts) => {
79
- const { sessionSaveCommand } = await import("./session-ZDJ2APGL.js");
79
+ const { sessionSaveCommand } = await import("./session-IECOM63R.js");
80
80
  await sessionSaveCommand(opts);
81
81
  });
82
82
  session.command("load").description("Load a saved session from sync folder").action(async () => {
83
- const { sessionLoadCommand } = await import("./session-ZDJ2APGL.js");
83
+ const { sessionLoadCommand } = await import("./session-IECOM63R.js");
84
84
  await sessionLoadCommand();
85
85
  });
86
86
  var memory = program.command("memory").description("AI memory system \u2014 store and search project knowledge");
@@ -100,43 +100,43 @@ Memory subcommands:
100
100
  memory mcp Show MCP server setup instructions`
101
101
  );
102
102
  memory.command("status").description("Show memory system status").action(async () => {
103
- const { memoryStatusCommand } = await import("./memory-27ZSRPM7.js");
103
+ const { memoryStatusCommand } = await import("./memory-TJZNGTOA.js");
104
104
  await memoryStatusCommand();
105
105
  });
106
106
  memory.command("search").description("Search memories by query").argument("<query>", "search query").action(async (query) => {
107
- const { memorySearchCommand } = await import("./memory-27ZSRPM7.js");
107
+ const { memorySearchCommand } = await import("./memory-TJZNGTOA.js");
108
108
  await memorySearchCommand(query);
109
109
  });
110
110
  memory.command("list").description(
111
111
  "List memories in current project, or all projects with --projects"
112
112
  ).option("--projects", "List all project databases with size and metadata").action(async (opts) => {
113
- const { memoryListCommand } = await import("./memory-27ZSRPM7.js");
113
+ const { memoryListCommand } = await import("./memory-TJZNGTOA.js");
114
114
  await memoryListCommand(opts);
115
115
  });
116
116
  memory.command("init").description(
117
117
  "Initialize memory system \u2014 interactive wizard (first time) or config menu"
118
118
  ).action(async () => {
119
- const { memoryInitCommand } = await import("./memory-27ZSRPM7.js");
119
+ const { memoryInitCommand } = await import("./memory-TJZNGTOA.js");
120
120
  await memoryInitCommand();
121
121
  });
122
122
  memory.command("config").description("Configure memory system settings").action(async () => {
123
- const { memoryConfigCommand } = await import("./memory-27ZSRPM7.js");
123
+ const { memoryConfigCommand } = await import("./memory-TJZNGTOA.js");
124
124
  await memoryConfigCommand();
125
125
  });
126
126
  memory.command("start-daemon").description("Start the memory daemon (Tier 2 \u2014 MiniSearch)").action(async () => {
127
- const { memoryStartDaemonCommand } = await import("./memory-27ZSRPM7.js");
127
+ const { memoryStartDaemonCommand } = await import("./memory-TJZNGTOA.js");
128
128
  await memoryStartDaemonCommand();
129
129
  });
130
130
  memory.command("stop-daemon").description("Stop the memory daemon").action(async () => {
131
- const { memoryStopDaemonCommand } = await import("./memory-27ZSRPM7.js");
131
+ const { memoryStopDaemonCommand } = await import("./memory-TJZNGTOA.js");
132
132
  await memoryStopDaemonCommand();
133
133
  });
134
134
  memory.command("rebuild").description("Rebuild the daemon search index").action(async () => {
135
- const { memoryRebuildCommand } = await import("./memory-27ZSRPM7.js");
135
+ const { memoryRebuildCommand } = await import("./memory-TJZNGTOA.js");
136
136
  await memoryRebuildCommand();
137
137
  });
138
138
  memory.command("mcp").description("Show MCP server setup instructions").action(async () => {
139
- const { memoryMcpCommand } = await import("./memory-27ZSRPM7.js");
139
+ const { memoryMcpCommand } = await import("./memory-TJZNGTOA.js");
140
140
  await memoryMcpCommand();
141
141
  });
142
142
  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 +144,7 @@ memory.command("rm").description("Remove a project database").option("--project-
144
144
  "Remove orphaned projects (source dir missing or 0 memories)"
145
145
  ).action(
146
146
  async (opts) => {
147
- const { memoryRmCommand } = await import("./memory-27ZSRPM7.js");
147
+ const { memoryRmCommand } = await import("./memory-TJZNGTOA.js");
148
148
  await memoryRmCommand(opts);
149
149
  }
150
150
  );
@@ -161,41 +161,41 @@ Dev subcommands:
161
161
  dev update [path] Update local dev plugin to latest version`
162
162
  );
163
163
  dev.command("on").description("Switch to local plugin source").argument("[path]", "path to local coding-friend repo (default: cwd)").action(async (path) => {
164
- const { devOnCommand } = await import("./dev-4A5CTBGK.js");
164
+ const { devOnCommand } = await import("./dev-S7S3SFKI.js");
165
165
  await devOnCommand(path);
166
166
  });
167
167
  dev.command("off").description("Switch back to remote marketplace").action(async () => {
168
- const { devOffCommand } = await import("./dev-4A5CTBGK.js");
168
+ const { devOffCommand } = await import("./dev-S7S3SFKI.js");
169
169
  await devOffCommand();
170
170
  });
171
171
  dev.command("status").description("Show current dev mode").action(async () => {
172
- const { devStatusCommand } = await import("./dev-4A5CTBGK.js");
172
+ const { devStatusCommand } = await import("./dev-S7S3SFKI.js");
173
173
  await devStatusCommand();
174
174
  });
175
175
  dev.command("sync").description(
176
176
  "Copy local source files to plugin cache (no version bump needed)"
177
177
  ).action(async () => {
178
- const { devSyncCommand } = await import("./dev-4A5CTBGK.js");
178
+ const { devSyncCommand } = await import("./dev-S7S3SFKI.js");
179
179
  await devSyncCommand();
180
180
  });
181
181
  dev.command("restart").description("Reinstall local dev plugin (off + on)").argument(
182
182
  "[path]",
183
183
  "path to local coding-friend repo (default: saved path or cwd)"
184
184
  ).action(async (path) => {
185
- const { devRestartCommand } = await import("./dev-4A5CTBGK.js");
185
+ const { devRestartCommand } = await import("./dev-S7S3SFKI.js");
186
186
  await devRestartCommand(path);
187
187
  });
188
188
  dev.command("update").description("Update local dev plugin to latest version (off + on)").argument(
189
189
  "[path]",
190
190
  "path to local coding-friend repo (default: saved path or cwd)"
191
191
  ).action(async (path) => {
192
- const { devUpdateCommand } = await import("./dev-4A5CTBGK.js");
192
+ const { devUpdateCommand } = await import("./dev-S7S3SFKI.js");
193
193
  await devUpdateCommand(path);
194
194
  });
195
195
  program.hook("postAction", async () => {
196
196
  const topCmd = process.argv[2];
197
197
  if (topCmd === "update") return;
198
- const { checkAndNotifyCliUpdate } = await import("./update-check-L5TNWT2J.js");
198
+ const { checkAndNotifyCliUpdate } = await import("./update-check-XSETLRVR.js");
199
199
  checkAndNotifyCliUpdate(pkg.version);
200
200
  });
201
201
  await program.parseAsync();
@@ -1,3 +1,7 @@
1
+ import {
2
+ getMemoryMcpStatus,
3
+ writeMemoryMcpEntry
4
+ } from "./chunk-LTHJTWJ6.js";
1
5
  import {
2
6
  applyPermissions,
3
7
  buildLearnDirRules,
@@ -10,6 +14,7 @@ import {
10
14
  import {
11
15
  getLibPath
12
16
  } from "./chunk-RZRT7NGT.js";
17
+ import "./chunk-SIQJPT47.js";
13
18
  import {
14
19
  findStatuslineHookPath,
15
20
  isStatuslineConfigured,
@@ -23,7 +28,7 @@ import {
23
28
  import {
24
29
  ensureShellCompletion,
25
30
  hasShellCompletion
26
- } from "./chunk-PYTEAC6K.js";
31
+ } from "./chunk-DMJCO6LJ.js";
27
32
  import {
28
33
  BACK,
29
34
  applyDocsDirChange,
@@ -34,7 +39,7 @@ import {
34
39
  getScopeLabel,
35
40
  injectBackChoice,
36
41
  showConfigHint
37
- } from "./chunk-BIX7AJU3.js";
42
+ } from "./chunk-O4CNZB5H.js";
38
43
  import {
39
44
  commandExists,
40
45
  run
@@ -52,8 +57,9 @@ import {
52
57
  resolvePath
53
58
  } from "./chunk-DO6FV6BL.js";
54
59
  import {
55
- log
56
- } from "./chunk-W5CD7WTX.js";
60
+ log,
61
+ printBanner
62
+ } from "./chunk-NREZK463.js";
57
63
 
58
64
  // src/commands/init.ts
59
65
  import { checkbox, confirm, input, select } from "@inquirer/prompts";
@@ -65,17 +71,6 @@ var GITIGNORE_START = "# >>> coding-friend managed";
65
71
  var GITIGNORE_END = "# <<< coding-friend managed";
66
72
  var em = chalk.hex("#10b981");
67
73
  var dk = chalk.hex("#064e3b");
68
- function printBanner() {
69
- console.log();
70
- console.log(em(" \u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E"));
71
- console.log(
72
- em(" \u2502 ") + "\u2726" + em(" ") + chalk.bold.white("Coding Friend") + em(" \u2726 \u2502")
73
- );
74
- console.log(em(" \u2502 ") + chalk.dim("Setup Wizard") + em(" \u2502"));
75
- console.log(em(" \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"));
76
- console.log(em(" \u2570\u2500\u25B8"));
77
- console.log();
78
- }
79
74
  var _stepIndex = 0;
80
75
  var _suppressStepHeaders = false;
81
76
  function printStepHeader(label, description) {
@@ -167,7 +162,11 @@ function printSetupStatus(globalCfg, localCfg, gitAvailable) {
167
162
  },
168
163
  { label: "Shell completion", done: hasShellCompletion(), skipped: false },
169
164
  { label: "Statusline", done: isStatuslineConfigured(), skipped: false },
170
- { label: "CF Memory MCP", done: isMemoryMcpConfigured(), skipped: false },
165
+ {
166
+ label: "CF Memory MCP",
167
+ done: getMemoryMcpStatus().configured,
168
+ skipped: false
169
+ },
171
170
  {
172
171
  label: `Permissions (${configuredRuleCount}/${allRules.length} rules)`,
173
172
  done: configuredRuleCount > 0,
@@ -587,15 +586,9 @@ async function stepStatusline() {
587
586
  writeStatuslineSettings(hookResult.hookPath);
588
587
  log.success("Statusline configured!");
589
588
  }
590
- function isMemoryMcpConfigured() {
591
- const mcpPath = join(process.cwd(), ".mcp.json");
592
- const config = readJson(mcpPath);
593
- if (!config) return false;
594
- const servers = config.mcpServers;
595
- return servers != null && "coding-friend-memory" in servers;
596
- }
597
589
  async function stepMemory(docsDir) {
598
- if (isMemoryMcpConfigured()) {
590
+ const mcpStatus = getMemoryMcpStatus();
591
+ if (mcpStatus.configured) {
599
592
  printStepHeader(
600
593
  `CF Memory MCP ${chalk.green("[done]")}`,
601
594
  "Connects the memory system to Claude Code via MCP."
@@ -642,20 +635,7 @@ async function stepMemory(docsDir) {
642
635
  return;
643
636
  }
644
637
  const memoryDir = join(process.cwd(), docsDir, "memory");
645
- const mcpPath = join(process.cwd(), ".mcp.json");
646
- const existing = readJson(mcpPath) ?? {};
647
- const servers = existing.mcpServers ?? {};
648
- writeJson(mcpPath, {
649
- ...existing,
650
- mcpServers: {
651
- ...servers,
652
- "coding-friend-memory": {
653
- command: "node",
654
- args: [serverPath, memoryDir]
655
- }
656
- }
657
- });
658
- log.success(`Added coding-friend-memory to .mcp.json`);
638
+ writeMemoryMcpEntry(serverPath, memoryDir);
659
639
  const autoCapture = await confirm({
660
640
  message: "Enable auto-capture? (saves session summaries to memory before context compaction)",
661
641
  default: false
@@ -754,7 +734,7 @@ async function initMenu(gitAvailable) {
754
734
  const gitignoreStatus = !gitAvailable ? chalk.dim("skipped") : hasGitignoreBlock() ? chalk.green("configured") : chalk.yellow("not configured");
755
735
  const completionStatus = hasShellCompletion() ? chalk.green("installed") : chalk.yellow("not installed");
756
736
  const statuslineStatus = isStatuslineConfigured() ? chalk.green("configured") : chalk.yellow("not configured");
757
- const memoryStatus = isMemoryMcpConfigured() ? chalk.green("configured") : chalk.yellow("not configured");
737
+ const memoryStatus = getMemoryMcpStatus().configured ? chalk.green("configured") : chalk.yellow("not configured");
758
738
  const projectRules = getExistingRules(claudeLocalSettingsPath());
759
739
  const userRules = getExistingRules(claudeSettingsPath());
760
740
  const allRules = getAllRules();
@@ -856,7 +836,9 @@ async function initMenu(gitAvailable) {
856
836
  }
857
837
  async function initCommand() {
858
838
  _stepIndex = 0;
859
- printBanner();
839
+ console.log();
840
+ printBanner("\u2728 Coding Friend Setup Wizard \u2728");
841
+ console.log();
860
842
  showConfigHint();
861
843
  const gitAvailable = isGitRepo();
862
844
  if (!gitAvailable) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getLatestVersion,
3
3
  semverCompare
4
- } from "./chunk-PDVSGGH6.js";
4
+ } from "./chunk-2ETE7NEL.js";
5
5
  import {
6
6
  enableMarketplaceAutoUpdate,
7
7
  isMarketplaceRegistered,
@@ -13,10 +13,10 @@ import {
13
13
  import "./chunk-PRIH34UB.js";
14
14
  import {
15
15
  ensureShellCompletion
16
- } from "./chunk-PYTEAC6K.js";
16
+ } from "./chunk-DMJCO6LJ.js";
17
17
  import {
18
18
  resolveScope
19
- } from "./chunk-BIX7AJU3.js";
19
+ } from "./chunk-O4CNZB5H.js";
20
20
  import {
21
21
  commandExists,
22
22
  run
@@ -26,14 +26,15 @@ import {
26
26
  devStatePath
27
27
  } from "./chunk-DO6FV6BL.js";
28
28
  import {
29
- log
30
- } from "./chunk-W5CD7WTX.js";
29
+ log,
30
+ printBanner
31
+ } from "./chunk-NREZK463.js";
31
32
 
32
33
  // src/commands/install.ts
33
34
  import { existsSync } from "fs";
34
35
  import chalk from "chalk";
35
36
  async function installCommand(opts = {}) {
36
- console.log("=== \u{1F33F} Coding Friend Install \u{1F33F} ===");
37
+ printBanner("\u2728 Coding Friend Install \u2728");
37
38
  console.log();
38
39
  if (!commandExists("claude")) {
39
40
  log.error(
@@ -0,0 +1,156 @@
1
+ import {
2
+ ensureMemoryBuilt,
3
+ printMemoryMcpConfig
4
+ } from "./chunk-WCSNAEOF.js";
5
+ import "./chunk-LTHJTWJ6.js";
6
+ import {
7
+ getLibPath
8
+ } from "./chunk-RZRT7NGT.js";
9
+ import {
10
+ resolveDocsDir,
11
+ resolveMemoryDir
12
+ } from "./chunk-SIQJPT47.js";
13
+ import "./chunk-PRIH34UB.js";
14
+ import "./chunk-O4CNZB5H.js";
15
+ import {
16
+ run
17
+ } from "./chunk-EVGXUDX4.js";
18
+ import "./chunk-5UVDWG5L.js";
19
+ import "./chunk-DO6FV6BL.js";
20
+ import {
21
+ log,
22
+ printBanner
23
+ } from "./chunk-NREZK463.js";
24
+
25
+ // src/commands/mcp.ts
26
+ import { existsSync, readdirSync } from "fs";
27
+ import { join } from "path";
28
+ import chalk from "chalk";
29
+ function countMdFiles(dir) {
30
+ let count = 0;
31
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
32
+ if (entry.isDirectory()) {
33
+ count += countMdFiles(join(dir, entry.name));
34
+ } else if (entry.name.endsWith(".md") && entry.name !== "README.md") {
35
+ count++;
36
+ }
37
+ }
38
+ return count;
39
+ }
40
+ async function mcpCommand(path) {
41
+ const docsDir = resolveDocsDir(path);
42
+ const mcpDir = getLibPath("learn-mcp");
43
+ if (!existsSync(docsDir)) {
44
+ log.error(`Docs folder not found: ${docsDir}`);
45
+ log.dim("Run /cf-learn first to generate some docs.");
46
+ process.exit(1);
47
+ }
48
+ const docCount = countMdFiles(docsDir);
49
+ if (docCount === 0) {
50
+ log.error(`No .md files found in ${docsDir}`);
51
+ log.dim("Run /cf-learn first to generate some docs.");
52
+ process.exit(1);
53
+ }
54
+ printBanner("\u{1F4DA} Learn MCP");
55
+ log.info(`Docs folder: ${chalk.cyan(docsDir)}`);
56
+ log.info(`Found: ${chalk.green(docCount)} docs`);
57
+ console.log();
58
+ if (!existsSync(join(mcpDir, "node_modules"))) {
59
+ log.step("Installing MCP server dependencies (one-time setup)...");
60
+ const result = run("npm", ["install", "--silent"], { cwd: mcpDir });
61
+ if (result === null) {
62
+ log.error("Failed to install dependencies");
63
+ process.exit(1);
64
+ }
65
+ log.success("Done.");
66
+ }
67
+ if (!existsSync(join(mcpDir, "dist"))) {
68
+ log.step("Building MCP server...");
69
+ const result = run("npm", ["run", "build", "--silent"], { cwd: mcpDir });
70
+ if (result === null) {
71
+ log.error("Failed to build MCP server");
72
+ process.exit(1);
73
+ }
74
+ log.success("Done.");
75
+ }
76
+ console.log();
77
+ const serverPath = join(mcpDir, "dist", "index.js");
78
+ console.log(chalk.dim("Add this to your MCP client config:"));
79
+ console.log();
80
+ console.log(
81
+ chalk.yellow.bold(
82
+ "--- Claude Desktop / Claude Chat (claude_desktop_config.json) ---"
83
+ )
84
+ );
85
+ console.log(`
86
+ {
87
+ "mcpServers": {
88
+ "coding-friend-learn": {
89
+ "command": "node",
90
+ "args": ["${serverPath}", "${docsDir}"]
91
+ }
92
+ }
93
+ }`);
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)")}`
131
+ );
132
+ console.log();
133
+ printMemoryMcp();
134
+ }
135
+ function printMemoryMcp() {
136
+ const memoryDir = resolveMemoryDir();
137
+ let mcpDir;
138
+ try {
139
+ mcpDir = getLibPath("cf-memory");
140
+ } catch {
141
+ log.dim(
142
+ 'Memory MCP: cf-memory package not found. Run "cf memory init" to set it up.'
143
+ );
144
+ return;
145
+ }
146
+ ensureMemoryBuilt(mcpDir);
147
+ const serverPath = join(mcpDir, "dist", "index.js");
148
+ console.log();
149
+ printBanner("\u{1F9E0} Memory MCP", { color: chalk.magenta });
150
+ log.info(`Memory dir: ${chalk.cyan(memoryDir)}`);
151
+ console.log();
152
+ printMemoryMcpConfig(serverPath, memoryDir);
153
+ }
154
+ export {
155
+ mcpCommand
156
+ };
@@ -0,0 +1,37 @@
1
+ import {
2
+ ensureMemoryBuilt,
3
+ memoryConfigCommand,
4
+ memoryInitCommand,
5
+ memoryListCommand,
6
+ memoryMcpCommand,
7
+ memoryRebuildCommand,
8
+ memoryRmCommand,
9
+ memorySearchCommand,
10
+ memoryStartDaemonCommand,
11
+ memoryStatusCommand,
12
+ memoryStopDaemonCommand,
13
+ printMemoryMcpConfig
14
+ } from "./chunk-WCSNAEOF.js";
15
+ import "./chunk-LTHJTWJ6.js";
16
+ import "./chunk-RZRT7NGT.js";
17
+ import "./chunk-SIQJPT47.js";
18
+ import "./chunk-PRIH34UB.js";
19
+ import "./chunk-O4CNZB5H.js";
20
+ import "./chunk-EVGXUDX4.js";
21
+ import "./chunk-5UVDWG5L.js";
22
+ import "./chunk-DO6FV6BL.js";
23
+ import "./chunk-NREZK463.js";
24
+ export {
25
+ ensureMemoryBuilt,
26
+ memoryConfigCommand,
27
+ memoryInitCommand,
28
+ memoryListCommand,
29
+ memoryMcpCommand,
30
+ memoryRebuildCommand,
31
+ memoryRmCommand,
32
+ memorySearchCommand,
33
+ memoryStartDaemonCommand,
34
+ memoryStatusCommand,
35
+ memoryStopDaemonCommand,
36
+ printMemoryMcpConfig
37
+ };
@@ -14,8 +14,9 @@ import {
14
14
  claudeSettingsPath
15
15
  } from "./chunk-DO6FV6BL.js";
16
16
  import {
17
- log
18
- } from "./chunk-W5CD7WTX.js";
17
+ log,
18
+ printBanner
19
+ } from "./chunk-NREZK463.js";
19
20
 
20
21
  // src/commands/permission.ts
21
22
  import { checkbox, confirm, select } from "@inquirer/prompts";
@@ -140,7 +141,7 @@ async function interactiveFlow(allRules, existing) {
140
141
  return { toAdd, toRemove };
141
142
  }
142
143
  async function permissionCommand(opts) {
143
- console.log("=== \u{1F33F} Coding Friend Permissions \u{1F33F} ===");
144
+ printBanner("\u2728 Coding Friend Permissions \u2728");
144
145
  console.log();
145
146
  const {
146
147
  path: settingsPath,
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ensureShellCompletion
4
- } from "./chunk-PYTEAC6K.js";
5
- import "./chunk-W5CD7WTX.js";
4
+ } from "./chunk-DMJCO6LJ.js";
5
+ import "./chunk-NREZK463.js";
6
6
 
7
7
  // src/postinstall.ts
8
8
  ensureShellCompletion();
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-DO6FV6BL.js";
14
14
  import {
15
15
  log
16
- } from "./chunk-W5CD7WTX.js";
16
+ } from "./chunk-NREZK463.js";
17
17
 
18
18
  // src/commands/session.ts
19
19
  import { input, select } from "@inquirer/prompts";
@@ -1,12 +1,9 @@
1
- import {
2
- resolveMemoryDir
3
- } from "./chunk-SIQJPT47.js";
4
1
  import {
5
2
  getCliVersion,
6
3
  getLatestCliVersion,
7
4
  getLatestVersion,
8
5
  semverCompare
9
- } from "./chunk-PDVSGGH6.js";
6
+ } from "./chunk-2ETE7NEL.js";
10
7
  import {
11
8
  detectPluginScope,
12
9
  isPluginDisabled
@@ -17,12 +14,15 @@ import {
17
14
  import {
18
15
  getLibPath
19
16
  } from "./chunk-RZRT7NGT.js";
17
+ import {
18
+ resolveMemoryDir
19
+ } from "./chunk-SIQJPT47.js";
20
20
  import {
21
21
  getInstalledVersion
22
22
  } from "./chunk-TRIALFOQ.js";
23
23
  import "./chunk-PRIH34UB.js";
24
- import "./chunk-PYTEAC6K.js";
25
- import "./chunk-BIX7AJU3.js";
24
+ import "./chunk-DMJCO6LJ.js";
25
+ import "./chunk-O4CNZB5H.js";
26
26
  import "./chunk-EVGXUDX4.js";
27
27
  import {
28
28
  readJson
@@ -33,7 +33,7 @@ import {
33
33
  globalConfigPath,
34
34
  localConfigPath
35
35
  } from "./chunk-DO6FV6BL.js";
36
- import "./chunk-W5CD7WTX.js";
36
+ import "./chunk-NREZK463.js";
37
37
 
38
38
  // src/commands/status.ts
39
39
  import { existsSync, readdirSync } from "fs";
@@ -14,14 +14,15 @@ import {
14
14
  import "./chunk-5UVDWG5L.js";
15
15
  import "./chunk-DO6FV6BL.js";
16
16
  import {
17
- log
18
- } from "./chunk-W5CD7WTX.js";
17
+ log,
18
+ printBanner
19
+ } from "./chunk-NREZK463.js";
19
20
 
20
21
  // src/commands/statusline.ts
21
22
  import { confirm } from "@inquirer/prompts";
22
23
  import chalk from "chalk";
23
24
  async function statuslineCommand() {
24
- console.log("=== \u{1F33F} Coding Friend Statusline \u{1F33F} ===");
25
+ printBanner("\u2728 Coding Friend Statusline \u2728");
25
26
  console.log();
26
27
  const result = findStatuslineHookPath();
27
28
  if (!result) {