coding-friend-cli 1.35.3 → 1.35.5

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.
@@ -9,7 +9,7 @@ import {
9
9
  askScope,
10
10
  formatScopeLabel,
11
11
  injectBackChoice
12
- } from "./chunk-HPNRQYLM.js";
12
+ } from "./chunk-TAPL6NF3.js";
13
13
  import {
14
14
  globalConfigPath,
15
15
  localConfigPath
@@ -29,13 +29,10 @@ import { confirm, input, select } from "@inquirer/prompts";
29
29
  import chalk from "chalk";
30
30
  import { join } from "path";
31
31
  function getMemoryFieldScope(field, globalCfg, localCfg) {
32
- const globalSection = globalCfg?.memory;
33
32
  const localSection = localCfg?.memory;
34
- const inGlobal = globalSection?.[field] !== void 0;
35
- const inLocal = localSection?.[field] !== void 0;
36
- if (inGlobal && inLocal) return "both";
37
- if (inGlobal) return "global";
38
- if (inLocal) return "local";
33
+ if (localSection?.[field] !== void 0) return "local";
34
+ const globalSection = globalCfg?.memory;
35
+ if (globalSection?.[field] !== void 0) return "global";
39
36
  return "-";
40
37
  }
41
38
  function getMergedMemoryValue(field, globalCfg, localCfg) {
@@ -88,27 +88,22 @@ function showConfigHint() {
88
88
  console.log();
89
89
  console.log(` ${chalk.yellow("[-]")} ${chalk.dim("not set anywhere")}`);
90
90
  console.log(
91
- ` ${chalk.blue("[global]")} ${chalk.dim("set in global config only")}`
91
+ ` ${chalk.blue("[global]")} ${chalk.dim("effective value comes from global config")}`
92
92
  );
93
93
  console.log(
94
- ` ${chalk.green("[local]")} ${chalk.dim("set in this project only")}`
95
- );
96
- console.log(
97
- ` ${chalk.cyan("[both]")} ${chalk.dim("set in both places \u2014 local value takes effect")}`
94
+ ` ${chalk.green("[local]")} ${chalk.dim("effective value comes from this project (overrides global if set)")}`
98
95
  );
99
96
  console.log();
100
97
  }
101
98
  function getScopeLabel(key, globalCfg, localCfg) {
102
- const inGlobal = globalCfg ? globalCfg[key] !== void 0 : false;
103
99
  const inLocal = localCfg ? localCfg[key] !== void 0 : false;
104
- if (inGlobal && inLocal) return "both";
105
- if (inGlobal) return "global";
106
100
  if (inLocal) return "local";
101
+ const inGlobal = globalCfg ? globalCfg[key] !== void 0 : false;
102
+ if (inGlobal) return "global";
107
103
  return "-";
108
104
  }
109
105
  function formatScopeLabel(scope) {
110
106
  if (scope === "-") return chalk.yellow("[-]");
111
- if (scope === "both") return chalk.cyan("[both]");
112
107
  if (scope === "global") return chalk.blue("[global]");
113
108
  if (scope === "local") return chalk.green("[local]");
114
109
  return `[${scope}]`;
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-RLUNNJWJ.js";
8
8
  import {
9
9
  resolveScope
10
- } from "./chunk-HPNRQYLM.js";
10
+ } from "./chunk-TAPL6NF3.js";
11
11
  import {
12
12
  commandExists,
13
13
  run,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  writeMemoryMcpEntry
3
- } from "./chunk-C5YWESSF.js";
3
+ } from "./chunk-DTSWPWPA.js";
4
4
  import {
5
5
  log
6
6
  } from "./chunk-NREZK463.js";
@@ -2,12 +2,12 @@ import {
2
2
  checkMemoryMcpHealth,
3
3
  printHealthSection,
4
4
  warnStaleMcpJson
5
- } from "./chunk-E5J24GD5.js";
5
+ } from "./chunk-XMSSEJYL.js";
6
6
  import {
7
7
  getMemoryMcpStatus,
8
8
  memoryConfigMenu,
9
9
  writeMemoryMcpEntry
10
- } from "./chunk-C5YWESSF.js";
10
+ } from "./chunk-DTSWPWPA.js";
11
11
  import {
12
12
  loadConfig,
13
13
  resolveMemoryDir
@@ -17,7 +17,7 @@ import {
17
17
  } from "./chunk-RZRT7NGT.js";
18
18
  import {
19
19
  showConfigHint
20
- } from "./chunk-HPNRQYLM.js";
20
+ } from "./chunk-TAPL6NF3.js";
21
21
  import {
22
22
  run,
23
23
  runWithStderr
@@ -0,0 +1,200 @@
1
+ import {
2
+ loadConfig,
3
+ resolveMemoryDir
4
+ } from "./chunk-B2NFXRFP.js";
5
+ import "./chunk-57EGAXYI.js";
6
+ import {
7
+ resolvePath
8
+ } from "./chunk-TWKNGPBO.js";
9
+ import {
10
+ log,
11
+ printBanner
12
+ } from "./chunk-NREZK463.js";
13
+ import "./chunk-5UVDWG5L.js";
14
+
15
+ // src/commands/clean.ts
16
+ import { existsSync, readdirSync, rmSync, statSync } from "fs";
17
+ import { join, relative } from "path";
18
+ import { checkbox, confirm, input, select } from "@inquirer/prompts";
19
+ import chalk from "chalk";
20
+ var DATE_PREFIX_RE = /^(\d{4}-\d{2}-\d{2})/;
21
+ var RANGE_LABELS = {
22
+ more_than_1_day: "more than 1 day old",
23
+ more_than_3_days: "more than 3 days old",
24
+ more_than_1_week: "more than 1 week old",
25
+ more_than_1_month: "more than 1 month old",
26
+ more_than_1_year: "more than 1 year old",
27
+ before_date: "before custom date",
28
+ all: "all files"
29
+ };
30
+ function parseDateFromName(name) {
31
+ const m = DATE_PREFIX_RE.exec(name);
32
+ if (!m) return null;
33
+ const d = /* @__PURE__ */ new Date(`${m[1]}T00:00:00.000Z`);
34
+ return isNaN(d.getTime()) ? null : d;
35
+ }
36
+ function getEffectiveDate(entryPath, name) {
37
+ const fromName = parseDateFromName(name);
38
+ if (fromName) return fromName;
39
+ try {
40
+ return new Date(statSync(entryPath).mtime);
41
+ } catch {
42
+ return /* @__PURE__ */ new Date(0);
43
+ }
44
+ }
45
+ function olderThanDays(date, days, now) {
46
+ return now.getTime() - date.getTime() > days * 24 * 60 * 60 * 1e3;
47
+ }
48
+ function matchesRange(entryPath, name, range, cutoff, now) {
49
+ if (range === "all") return true;
50
+ const date = getEffectiveDate(entryPath, name);
51
+ switch (range) {
52
+ case "more_than_1_day":
53
+ return olderThanDays(date, 1, now);
54
+ case "more_than_3_days":
55
+ return olderThanDays(date, 3, now);
56
+ case "more_than_1_week":
57
+ return olderThanDays(date, 7, now);
58
+ case "more_than_1_month":
59
+ return olderThanDays(date, 30, now);
60
+ case "more_than_1_year":
61
+ return olderThanDays(date, 365, now);
62
+ case "before_date":
63
+ return cutoff !== null && date.getTime() < cutoff.getTime();
64
+ }
65
+ }
66
+ function countFiles(dir) {
67
+ if (!existsSync(dir)) return 0;
68
+ let count = 0;
69
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
70
+ const entryPath = join(dir, entry.name);
71
+ if (entry.isDirectory()) {
72
+ count += countFiles(entryPath);
73
+ } else {
74
+ count++;
75
+ }
76
+ }
77
+ return count;
78
+ }
79
+ function deleteMatchingEntries(dir, range, cutoff, now) {
80
+ if (!existsSync(dir)) return { deleted: 0, failed: 0 };
81
+ let deleted = 0;
82
+ let failed = 0;
83
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
84
+ const entryPath = join(dir, entry.name);
85
+ if (matchesRange(entryPath, entry.name, range, cutoff, now)) {
86
+ const filesBefore = entry.isDirectory() ? countFiles(entryPath) : 1;
87
+ try {
88
+ rmSync(entryPath, { recursive: true });
89
+ deleted += filesBefore;
90
+ } catch {
91
+ log.warn(` Could not delete: ${entry.name}`);
92
+ failed++;
93
+ }
94
+ }
95
+ }
96
+ return { deleted, failed };
97
+ }
98
+ async function promptDateRange() {
99
+ const range = await select({
100
+ message: "Delete files older than:",
101
+ choices: [
102
+ { name: "More than 1 day", value: "more_than_1_day" },
103
+ { name: "More than 3 days", value: "more_than_3_days" },
104
+ { name: "More than 1 week", value: "more_than_1_week" },
105
+ { name: "More than 1 month", value: "more_than_1_month" },
106
+ { name: "More than 1 year", value: "more_than_1_year" },
107
+ { name: "Before a specific date (YYYY-MM-DD)", value: "before_date" },
108
+ { name: "Clean all (no date filter)", value: "all" }
109
+ ]
110
+ });
111
+ if (range !== "before_date") return { range, cutoff: null };
112
+ while (true) {
113
+ const raw = await input({ message: "Enter date (YYYY-MM-DD):" });
114
+ const d = /* @__PURE__ */ new Date(`${raw.trim()}T00:00:00.000Z`);
115
+ if (!isNaN(d.getTime())) return { range, cutoff: d };
116
+ log.warn(`Invalid date "${raw}". Use YYYY-MM-DD format.`);
117
+ }
118
+ }
119
+ async function cleanCommand() {
120
+ console.log();
121
+ printBanner("\u{1F9F9} Coding Friend Clean");
122
+ console.log();
123
+ const config = loadConfig();
124
+ const docsDir = resolvePath(config.docsDir ?? "docs");
125
+ const candidates = [
126
+ { key: "context", path: join(docsDir, "context") },
127
+ { key: "memory", path: resolveMemoryDir() },
128
+ { key: "research", path: join(docsDir, "research") },
129
+ { key: "reviews", path: join(docsDir, "reviews") },
130
+ { key: "plans", path: join(docsDir, "plans") },
131
+ { key: "sessions", path: join(docsDir, "sessions") },
132
+ { key: "learn", path: join(docsDir, "learn") }
133
+ ];
134
+ const cleanable = candidates.map((c) => ({ ...c, fileCount: countFiles(c.path) })).filter((c) => existsSync(c.path) && c.fileCount > 0);
135
+ if (cleanable.length === 0) {
136
+ log.info("Nothing to clean.");
137
+ console.log();
138
+ return;
139
+ }
140
+ const selected = await checkbox({
141
+ message: "Select directories to clean:",
142
+ choices: cleanable.map((c) => ({
143
+ name: `${c.key} \u2014 ${c.fileCount} ${c.fileCount === 1 ? "file" : "files"}`,
144
+ value: c.key
145
+ }))
146
+ });
147
+ if (selected.length === 0) {
148
+ log.dim(" Nothing selected.");
149
+ console.log();
150
+ return;
151
+ }
152
+ console.log();
153
+ const { range, cutoff } = await promptDateRange();
154
+ console.log();
155
+ const now = /* @__PURE__ */ new Date();
156
+ const summary = [];
157
+ for (const entry of cleanable.filter((c) => selected.includes(c.key))) {
158
+ const relPath = relative(process.cwd(), entry.path);
159
+ const rangeLabel = range === "before_date" ? `files before ${cutoff.toISOString().slice(0, 10)}` : RANGE_LABELS[range];
160
+ console.log(
161
+ `${chalk.yellow("\u2192")} Clean ${chalk.bold(entry.key)} (${relPath}) \u2014 ${chalk.dim(rangeLabel)}`
162
+ );
163
+ const isMemory = entry.key === "memory";
164
+ const message = isMemory ? `Delete matching contents of ${relPath}/? (includes SQLite databases \u2014 stop memory daemon first if running)` : `Delete matching contents of ${relPath}/?`;
165
+ const ok = await confirm({ message, default: false });
166
+ if (ok) {
167
+ const { deleted, failed } = deleteMatchingEntries(
168
+ entry.path,
169
+ range,
170
+ cutoff,
171
+ now
172
+ );
173
+ summary.push({ key: entry.key, deleted });
174
+ const failNote = failed > 0 ? `, ${failed} failed` : "";
175
+ log.success(
176
+ `Cleared: ${relPath} (${deleted} ${deleted === 1 ? "file" : "files"} removed${failNote})`
177
+ );
178
+ } else {
179
+ log.dim(" Skipped.");
180
+ }
181
+ console.log();
182
+ }
183
+ if (summary.length === 0) {
184
+ log.info("Done. Nothing was deleted.");
185
+ } else {
186
+ const total = summary.reduce((sum, s) => sum + s.deleted, 0);
187
+ const breakdown = summary.map((s) => `${chalk.bold(s.key)}: ${s.deleted}`).join(", ");
188
+ log.info(
189
+ `Done. ${chalk.bold(total)} ${total === 1 ? "file" : "files"} removed \u2014 ${breakdown}`
190
+ );
191
+ }
192
+ console.log();
193
+ }
194
+ export {
195
+ cleanCommand,
196
+ getEffectiveDate,
197
+ matchesRange,
198
+ olderThanDays,
199
+ parseDateFromName
200
+ };
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-WSUYLIYX.js";
8
8
  import {
9
9
  memoryConfigMenu
10
- } from "./chunk-C5YWESSF.js";
10
+ } from "./chunk-DTSWPWPA.js";
11
11
  import {
12
12
  resolveLearnDir
13
13
  } from "./chunk-B2NFXRFP.js";
@@ -41,7 +41,7 @@ import {
41
41
  getScopeLabel,
42
42
  injectBackChoice,
43
43
  showConfigHint
44
- } from "./chunk-HPNRQYLM.js";
44
+ } from "./chunk-TAPL6NF3.js";
45
45
  import "./chunk-EVGXUDX4.js";
46
46
  import {
47
47
  claudeLocalSettingsPath,
@@ -141,18 +141,27 @@ async function editLearnOutputDir(globalCfg) {
141
141
  const defaultLearnDir = DEFAULT_CONFIG.learn.outputDir;
142
142
  const oldOutputDir = globalCfg?.learn?.outputDir ?? defaultLearnDir;
143
143
  log.dim(`Current: ${oldOutputDir}`);
144
+ const hasDistinctCurrent = oldOutputDir !== defaultLearnDir;
145
+ const locationChoices = [];
146
+ if (hasDistinctCurrent) {
147
+ locationChoices.push({
148
+ name: `Keep current (${oldOutputDir})`,
149
+ value: "current"
150
+ });
151
+ }
152
+ locationChoices.push({
153
+ name: `Use default (${defaultLearnDir})`,
154
+ value: "default"
155
+ });
156
+ locationChoices.push({ name: "Custom path\u2026", value: "custom" });
144
157
  const locationChoice = await select({
145
158
  message: "Where to store learning docs?",
146
- choices: [
147
- {
148
- name: `Use default (${defaultLearnDir})`,
149
- value: "default"
150
- },
151
- { name: "Custom path\u2026", value: "custom" }
152
- ]
159
+ choices: locationChoices
153
160
  });
154
161
  let newOutputDir = defaultLearnDir;
155
- if (locationChoice === "custom") {
162
+ if (locationChoice === "current") {
163
+ newOutputDir = oldOutputDir;
164
+ } else if (locationChoice === "custom") {
156
165
  newOutputDir = await input({
157
166
  message: "Enter path (absolute or ~/...):",
158
167
  default: oldOutputDir !== defaultLearnDir ? oldOutputDir : void 0,
@@ -645,7 +654,7 @@ async function editPermissions() {
645
654
  )
646
655
  });
647
656
  if (choice === BACK) return;
648
- const { permissionCommand } = await import("./permission-C5R3LMZQ.js");
657
+ const { permissionCommand } = await import("./permission-KLT2TLZY.js");
649
658
  switch (choice) {
650
659
  case "interactive":
651
660
  await permissionCommand({});
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-R6HDMRYL.js";
5
5
  import {
6
6
  resolveScope
7
- } from "./chunk-HPNRQYLM.js";
7
+ } from "./chunk-TAPL6NF3.js";
8
8
  import "./chunk-EVGXUDX4.js";
9
9
  import "./chunk-TWKNGPBO.js";
10
10
  import {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-R6HDMRYL.js";
5
5
  import {
6
6
  resolveScope
7
- } from "./chunk-HPNRQYLM.js";
7
+ } from "./chunk-TAPL6NF3.js";
8
8
  import "./chunk-EVGXUDX4.js";
9
9
  import "./chunk-TWKNGPBO.js";
10
10
  import {
package/dist/index.js CHANGED
@@ -14,27 +14,27 @@ 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-SNUO2JCX.js");
17
+ const { installCommand } = await import("./install-VFD6C3LZ.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-QKEC3O64.js");
21
+ const { uninstallCommand } = await import("./uninstall-MLSKOCOZ.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-5UK4QINT.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-UQZNZRPI.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-F4SZBKWR.js");
33
+ const { initCommand } = await import("./init-MFUX5INO.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-PTJ4MA4Q.js");
37
+ const { configCommand } = await import("./config-Z3GE6HAP.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) => {
@@ -42,7 +42,7 @@ program.command("host").description("Build and serve learning docs as a static w
42
42
  await hostCommand(path, opts);
43
43
  });
44
44
  program.command("mcp").description("Setup MCP server for learning docs").action(async () => {
45
- const { mcpCommand } = await import("./mcp-7MO2MCLE.js");
45
+ const { mcpCommand } = await import("./mcp-AG7J6CEP.js");
46
46
  await mcpCommand();
47
47
  });
48
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) => {
@@ -57,7 +57,7 @@ program.command("permission").description("Manage Claude Code permission rules f
57
57
  "--project",
58
58
  "Save to project-level settings (.claude/settings.local.json)"
59
59
  ).action(async (opts) => {
60
- const { permissionCommand } = await import("./permission-C5R3LMZQ.js");
60
+ const { permissionCommand } = await import("./permission-KLT2TLZY.js");
61
61
  await permissionCommand(opts);
62
62
  });
63
63
  program.command("statusline").description("Setup coding-friend statusline in Claude Code").action(async () => {
@@ -65,22 +65,22 @@ program.command("statusline").description("Setup coding-friend statusline in Cla
65
65
  await statuslineCommand();
66
66
  });
67
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) => {
68
- const { updateCommand } = await import("./update-IBV2ULWF.js");
68
+ const { updateCommand } = await import("./update-G5YXZRMQ.js");
69
69
  await updateCommand(opts);
70
70
  });
71
71
  program.command("status").description("Show comprehensive Coding Friend status").action(async () => {
72
- const { statusCommand } = await import("./status-XPVHAMBB.js");
72
+ const { statusCommand } = await import("./status-DDNQ5QNJ.js");
73
73
  await statusCommand();
74
74
  });
75
75
  program.command("clean").description("Clean files generated by Coding Friend in docs/").action(async () => {
76
- const { cleanCommand } = await import("./clean-67ACB4OS.js");
76
+ const { cleanCommand } = await import("./clean-MQGVJTMG.js");
77
77
  await cleanCommand();
78
78
  });
79
- var session = program.command("session").description("Save and load Claude Code sessions across machines");
79
+ var session = program.command("session").description("[beta] Save and load Claude Code sessions across machines");
80
80
  program.addHelpText(
81
81
  "after",
82
82
  `
83
- Session subcommands:
83
+ Session subcommands (beta):
84
84
  session save Save current session to sync folder (use /cf-session inside a conversation)
85
85
  session load Load a saved session from sync folder and print resume command`
86
86
  );
@@ -112,43 +112,43 @@ Memory subcommands:
112
112
  memory mcp Show MCP server setup instructions`
113
113
  );
114
114
  memory.command("status").description("Show memory system status").action(async () => {
115
- const { memoryStatusCommand } = await import("./memory-XALEMWQF.js");
115
+ const { memoryStatusCommand } = await import("./memory-RZR672Q7.js");
116
116
  await memoryStatusCommand();
117
117
  });
118
118
  memory.command("search").description("Search memories by query").argument("<query>", "search query").action(async (query) => {
119
- const { memorySearchCommand } = await import("./memory-XALEMWQF.js");
119
+ const { memorySearchCommand } = await import("./memory-RZR672Q7.js");
120
120
  await memorySearchCommand(query);
121
121
  });
122
122
  memory.command("list").description(
123
123
  "List memories in current project, or all projects with --projects"
124
124
  ).option("--projects", "List all project databases with size and metadata").action(async (opts) => {
125
- const { memoryListCommand } = await import("./memory-XALEMWQF.js");
125
+ const { memoryListCommand } = await import("./memory-RZR672Q7.js");
126
126
  await memoryListCommand(opts);
127
127
  });
128
128
  memory.command("init").description(
129
129
  "Initialize memory system \u2014 interactive wizard (first time) or config menu"
130
130
  ).action(async () => {
131
- const { memoryInitCommand } = await import("./memory-XALEMWQF.js");
131
+ const { memoryInitCommand } = await import("./memory-RZR672Q7.js");
132
132
  await memoryInitCommand();
133
133
  });
134
134
  memory.command("config").description("Configure memory system settings").action(async () => {
135
- const { memoryConfigCommand } = await import("./memory-XALEMWQF.js");
135
+ const { memoryConfigCommand } = await import("./memory-RZR672Q7.js");
136
136
  await memoryConfigCommand();
137
137
  });
138
138
  memory.command("start-daemon").description("Start the memory daemon (Tier 2 \u2014 MiniSearch)").action(async () => {
139
- const { memoryStartDaemonCommand } = await import("./memory-XALEMWQF.js");
139
+ const { memoryStartDaemonCommand } = await import("./memory-RZR672Q7.js");
140
140
  await memoryStartDaemonCommand();
141
141
  });
142
142
  memory.command("stop-daemon").description("Stop the memory daemon").action(async () => {
143
- const { memoryStopDaemonCommand } = await import("./memory-XALEMWQF.js");
143
+ const { memoryStopDaemonCommand } = await import("./memory-RZR672Q7.js");
144
144
  await memoryStopDaemonCommand();
145
145
  });
146
146
  memory.command("rebuild").description("Rebuild the daemon search index").action(async () => {
147
- const { memoryRebuildCommand } = await import("./memory-XALEMWQF.js");
147
+ const { memoryRebuildCommand } = await import("./memory-RZR672Q7.js");
148
148
  await memoryRebuildCommand();
149
149
  });
150
150
  memory.command("mcp").description("Show MCP server setup instructions").action(async () => {
151
- const { memoryMcpCommand } = await import("./memory-XALEMWQF.js");
151
+ const { memoryMcpCommand } = await import("./memory-RZR672Q7.js");
152
152
  await memoryMcpCommand();
153
153
  });
154
154
  memory.command("rm").description("Remove a project database").option("--project-id <id>", "Project ID to remove").option("--all", "Remove all project databases").option(
@@ -156,7 +156,7 @@ memory.command("rm").description("Remove a project database").option("--project-
156
156
  "Remove orphaned projects (source dir missing or 0 memories)"
157
157
  ).action(
158
158
  async (opts) => {
159
- const { memoryRmCommand } = await import("./memory-XALEMWQF.js");
159
+ const { memoryRmCommand } = await import("./memory-RZR672Q7.js");
160
160
  await memoryRmCommand(opts);
161
161
  }
162
162
  );
@@ -2,15 +2,15 @@ import {
2
2
  ensureMemoryBuilt,
3
3
  isMemoryInitialized,
4
4
  memoryInitWizard
5
- } from "./chunk-L53RNEV3.js";
6
- import "./chunk-E5J24GD5.js";
5
+ } from "./chunk-YBK44KZM.js";
6
+ import "./chunk-XMSSEJYL.js";
7
7
  import {
8
8
  isLearnMcpRegistered,
9
9
  registerLearnMcp
10
10
  } from "./chunk-WSUYLIYX.js";
11
11
  import {
12
12
  memoryConfigMenu
13
- } from "./chunk-C5YWESSF.js";
13
+ } from "./chunk-DTSWPWPA.js";
14
14
  import "./chunk-B2NFXRFP.js";
15
15
  import {
16
16
  getLibPath
@@ -43,7 +43,7 @@ import {
43
43
  getScopeLabel,
44
44
  injectBackChoice,
45
45
  showConfigHint
46
- } from "./chunk-HPNRQYLM.js";
46
+ } from "./chunk-TAPL6NF3.js";
47
47
  import {
48
48
  commandExists,
49
49
  run
@@ -404,22 +404,28 @@ async function stepLearnConfig(globalCfg) {
404
404
  const language = await selectLanguage(
405
405
  "What language should /cf-learn notes be written in?"
406
406
  );
407
+ const hasDistinctCurrent = currentOutputDir !== defaultLearnDir;
408
+ const locationChoices = [];
409
+ if (hasDistinctCurrent) {
410
+ locationChoices.push({
411
+ name: `Keep current (${currentOutputDir})`,
412
+ value: "current"
413
+ });
414
+ }
415
+ locationChoices.push({
416
+ name: `Use default (${defaultLearnDir})`,
417
+ value: "default"
418
+ });
419
+ locationChoices.push({ name: "Custom path\u2026", value: "custom" });
407
420
  const locationChoice = await select({
408
421
  message: `Current learn folder: ${currentOutputDir}`,
409
- choices: injectBackChoice(
410
- [
411
- {
412
- name: `Use default (${defaultLearnDir})`,
413
- value: "default"
414
- },
415
- { name: "Custom path\u2026", value: "custom" }
416
- ],
417
- "Cancel init"
418
- )
422
+ choices: injectBackChoice(locationChoices, "Cancel init")
419
423
  });
420
424
  handleBack(locationChoice);
421
425
  let outputDir = defaultLearnDir;
422
- if (locationChoice === "custom") {
426
+ if (locationChoice === "current") {
427
+ outputDir = currentOutputDir;
428
+ } else if (locationChoice === "custom") {
423
429
  outputDir = await input({
424
430
  message: "Enter path (absolute or ~/...):",
425
431
  default: currentOutputDir !== defaultLearnDir ? currentOutputDir : void 0,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getLatestVersion,
3
3
  semverCompare
4
- } from "./chunk-X5IYYO4B.js";
4
+ } from "./chunk-UIPLDRGI.js";
5
5
  import {
6
6
  getInstalledVersion
7
7
  } from "./chunk-UCYGDDFS.js";
@@ -16,7 +16,7 @@ import {
16
16
  } from "./chunk-R6HDMRYL.js";
17
17
  import {
18
18
  resolveScope
19
- } from "./chunk-HPNRQYLM.js";
19
+ } from "./chunk-TAPL6NF3.js";
20
20
  import {
21
21
  commandExists,
22
22
  run
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  ensureMemoryBuilt,
3
3
  printMemoryMcpConfig
4
- } from "./chunk-L53RNEV3.js";
4
+ } from "./chunk-YBK44KZM.js";
5
5
  import {
6
6
  checkLearnMcpHealth,
7
7
  checkMemoryMcpHealth,
8
8
  detectMemoryMcpState,
9
9
  printHealthSection,
10
10
  warnStaleMcpJson
11
- } from "./chunk-E5J24GD5.js";
11
+ } from "./chunk-XMSSEJYL.js";
12
12
  import {
13
13
  listMdFilesRecursive
14
14
  } from "./chunk-2DTXVMPQ.js";
@@ -19,7 +19,7 @@ import {
19
19
  import {
20
20
  getMemoryMcpStatus,
21
21
  writeMemoryMcpEntry
22
- } from "./chunk-C5YWESSF.js";
22
+ } from "./chunk-DTSWPWPA.js";
23
23
  import {
24
24
  resolveLearnDir,
25
25
  resolveMemoryDir
@@ -28,7 +28,7 @@ import {
28
28
  getLibPath
29
29
  } from "./chunk-RZRT7NGT.js";
30
30
  import "./chunk-57EGAXYI.js";
31
- import "./chunk-HPNRQYLM.js";
31
+ import "./chunk-TAPL6NF3.js";
32
32
  import {
33
33
  run
34
34
  } from "./chunk-EVGXUDX4.js";
@@ -13,13 +13,13 @@ import {
13
13
  memoryStatusCommand,
14
14
  memoryStopDaemonCommand,
15
15
  printMemoryMcpConfig
16
- } from "./chunk-L53RNEV3.js";
17
- import "./chunk-E5J24GD5.js";
18
- import "./chunk-C5YWESSF.js";
16
+ } from "./chunk-YBK44KZM.js";
17
+ import "./chunk-XMSSEJYL.js";
18
+ import "./chunk-DTSWPWPA.js";
19
19
  import "./chunk-B2NFXRFP.js";
20
20
  import "./chunk-RZRT7NGT.js";
21
21
  import "./chunk-57EGAXYI.js";
22
- import "./chunk-HPNRQYLM.js";
22
+ import "./chunk-TAPL6NF3.js";
23
23
  import "./chunk-EVGXUDX4.js";
24
24
  import "./chunk-TWKNGPBO.js";
25
25
  import "./chunk-NREZK463.js";
@@ -3,7 +3,7 @@ import {
3
3
  formatScopeLabel,
4
4
  getMergedValue,
5
5
  getScopeLabel
6
- } from "./chunk-HPNRQYLM.js";
6
+ } from "./chunk-TAPL6NF3.js";
7
7
  import "./chunk-EVGXUDX4.js";
8
8
  import {
9
9
  claudeLocalSettingsPath,
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  checkLearnMcpHealth,
3
3
  checkMemoryMcpHealth
4
- } from "./chunk-E5J24GD5.js";
4
+ } from "./chunk-XMSSEJYL.js";
5
5
  import {
6
6
  listMdFilesRecursive
7
7
  } from "./chunk-2DTXVMPQ.js";
8
8
  import {
9
9
  isLearnMcpRegistered
10
10
  } from "./chunk-WSUYLIYX.js";
11
- import "./chunk-C5YWESSF.js";
11
+ import "./chunk-DTSWPWPA.js";
12
12
  import {
13
13
  resolveLearnDir,
14
14
  resolveMemoryDir,
@@ -22,7 +22,7 @@ import {
22
22
  getLatestCliVersion,
23
23
  getLatestVersion,
24
24
  semverCompare
25
- } from "./chunk-X5IYYO4B.js";
25
+ } from "./chunk-UIPLDRGI.js";
26
26
  import {
27
27
  getInstalledVersion
28
28
  } from "./chunk-UCYGDDFS.js";
@@ -32,7 +32,7 @@ import {
32
32
  detectPluginScope,
33
33
  isPluginDisabled
34
34
  } from "./chunk-R6HDMRYL.js";
35
- import "./chunk-HPNRQYLM.js";
35
+ import "./chunk-TAPL6NF3.js";
36
36
  import "./chunk-EVGXUDX4.js";
37
37
  import {
38
38
  claudeSettingsPath,
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-R6HDMRYL.js";
9
9
  import {
10
10
  resolveScope
11
- } from "./chunk-HPNRQYLM.js";
11
+ } from "./chunk-TAPL6NF3.js";
12
12
  import {
13
13
  commandExists,
14
14
  run
@@ -4,11 +4,11 @@ import {
4
4
  getLatestVersion,
5
5
  semverCompare,
6
6
  updateCommand
7
- } from "./chunk-X5IYYO4B.js";
7
+ } from "./chunk-UIPLDRGI.js";
8
8
  import "./chunk-UCYGDDFS.js";
9
9
  import "./chunk-57EGAXYI.js";
10
10
  import "./chunk-RLUNNJWJ.js";
11
- import "./chunk-HPNRQYLM.js";
11
+ import "./chunk-TAPL6NF3.js";
12
12
  import "./chunk-EVGXUDX4.js";
13
13
  import "./chunk-TWKNGPBO.js";
14
14
  import "./chunk-NREZK463.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coding-friend-cli",
3
- "version": "1.35.3",
3
+ "version": "1.35.5",
4
4
  "description": "CLI for coding-friend — host learning docs, setup MCP server, initialize projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,95 +0,0 @@
1
- import {
2
- loadConfig,
3
- resolveMemoryDir
4
- } from "./chunk-B2NFXRFP.js";
5
- import "./chunk-57EGAXYI.js";
6
- import {
7
- resolvePath
8
- } from "./chunk-TWKNGPBO.js";
9
- import {
10
- log,
11
- printBanner
12
- } from "./chunk-NREZK463.js";
13
- import "./chunk-5UVDWG5L.js";
14
-
15
- // src/commands/clean.ts
16
- import { existsSync, readdirSync, rmSync } from "fs";
17
- import { join, relative } from "path";
18
- import { checkbox, confirm } from "@inquirer/prompts";
19
- import chalk from "chalk";
20
- function countFiles(dir) {
21
- if (!existsSync(dir)) return 0;
22
- let count = 0;
23
- for (const entry of readdirSync(dir, { withFileTypes: true })) {
24
- const entryPath = join(dir, entry.name);
25
- if (entry.isDirectory()) {
26
- count += countFiles(entryPath);
27
- } else {
28
- count++;
29
- }
30
- }
31
- return count;
32
- }
33
- function clearDirContents(dir) {
34
- for (const entry of readdirSync(dir)) {
35
- rmSync(join(dir, entry), { recursive: true });
36
- }
37
- }
38
- async function cleanCommand() {
39
- console.log();
40
- printBanner("\u{1F9F9} Coding Friend Clean");
41
- console.log();
42
- const config = loadConfig();
43
- const docsDir = resolvePath(config.docsDir ?? "docs");
44
- const candidates = [
45
- { key: "context", path: join(docsDir, "context") },
46
- { key: "memory", path: resolveMemoryDir() },
47
- { key: "research", path: join(docsDir, "research") },
48
- { key: "reviews", path: join(docsDir, "reviews") },
49
- { key: "plans", path: join(docsDir, "plans") },
50
- { key: "sessions", path: join(docsDir, "sessions") },
51
- { key: "learn", path: join(docsDir, "learn") }
52
- ];
53
- const cleanable = candidates.map((c) => ({ ...c, fileCount: countFiles(c.path) })).filter((c) => existsSync(c.path) && c.fileCount > 0);
54
- if (cleanable.length === 0) {
55
- log.info("Nothing to clean.");
56
- console.log();
57
- return;
58
- }
59
- const selected = await checkbox({
60
- message: "Select directories to clean:",
61
- choices: cleanable.map((c) => ({
62
- name: `${c.key} \u2014 ${c.fileCount} ${c.fileCount === 1 ? "file" : "files"}`,
63
- value: c.key
64
- }))
65
- });
66
- if (selected.length === 0) {
67
- log.dim(" Nothing selected.");
68
- console.log();
69
- return;
70
- }
71
- console.log();
72
- let cleared = 0;
73
- for (const entry of cleanable.filter((c) => selected.includes(c.key))) {
74
- const relPath = relative(process.cwd(), entry.path);
75
- console.log(
76
- `${chalk.yellow("\u2192")} Clean ${chalk.bold(entry.key)} (${relPath})`
77
- );
78
- const isMemory = entry.key === "memory";
79
- const message = isMemory ? `Delete all contents of ${relPath}/? (includes SQLite databases \u2014 stop memory daemon first if running)` : `Delete all contents of ${relPath}/?`;
80
- const ok = await confirm({ message, default: false });
81
- if (ok) {
82
- clearDirContents(entry.path);
83
- log.success(`Cleared: ${relPath}`);
84
- cleared++;
85
- } else {
86
- log.dim(" Skipped.");
87
- }
88
- console.log();
89
- }
90
- log.info(`Done. ${cleared} of ${selected.length} directories cleared.`);
91
- console.log();
92
- }
93
- export {
94
- cleanCommand
95
- };