coding-friend-cli 1.34.0 → 1.35.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 (36) hide show
  1. package/README.md +1 -0
  2. package/dist/chunk-2DTXVMPQ.js +26 -0
  3. package/dist/{chunk-OYPOADCX.js → chunk-57EGAXYI.js} +3 -3
  4. package/dist/{chunk-K6EDQGDN.js → chunk-B2NFXRFP.js} +17 -12
  5. package/dist/{chunk-3UIH5U3Y.js → chunk-C5YWESSF.js} +2 -6
  6. package/dist/chunk-E5J24GD5.js +190 -0
  7. package/dist/{chunk-UGTNIFBH.js → chunk-H5TXJZD7.js} +6 -6
  8. package/dist/{chunk-5X3JZKYW.js → chunk-L53RNEV3.js} +116 -73
  9. package/dist/{chunk-DMJCO6LJ.js → chunk-RLUNNJWJ.js} +2 -1
  10. package/dist/{chunk-XOHLBLN2.js → chunk-WNTMKIKC.js} +1 -1
  11. package/dist/chunk-WSUYLIYX.js +61 -0
  12. package/dist/clean-67ACB4OS.js +95 -0
  13. package/dist/{chunk-CXG6I6ZF.js → config-HTQAALMA.js} +182 -194
  14. package/dist/{dev-S6VZUD33.js → dev-PFUF67SH.js} +7 -7
  15. package/dist/{disable-ZWQVU3QZ.js → disable-CDOM7SSI.js} +2 -2
  16. package/dist/{enable-NXP6APNI.js → enable-SF7742UR.js} +2 -2
  17. package/dist/{host-Y3WIXDSS.js → host-HKA4OHBM.js} +3 -3
  18. package/dist/index.js +38 -34
  19. package/dist/{init-WDFYY5MM.js → init-YM7YEEGK.js} +154 -99
  20. package/dist/{install-FKL6WLIG.js → install-VYZSTXN6.js} +8 -8
  21. package/dist/{mcp-J4SD646S.js → mcp-7MO2MCLE.js} +72 -67
  22. package/dist/{mcp-serve-learn-UNW6VH5M.js → mcp-serve-learn-OKVC5WV3.js} +19 -3
  23. package/dist/{memory-RLZR7XQY.js → memory-XALEMWQF.js} +7 -7
  24. package/dist/{permission-DNW7DE24.js → permission-C5R3LMZQ.js} +2 -2
  25. package/dist/postinstall.js +1 -1
  26. package/dist/{session-6WQGKIRG.js → session-M4KRQ4VU.js} +2 -2
  27. package/dist/{status-BX2SVBBW.js → status-2XM5OZDR.js} +19 -14
  28. package/dist/{statusline-MLLKBHHR.js → statusline-VFIA7OS2.js} +3 -3
  29. package/dist/{uninstall-6ZJRS2H4.js → uninstall-QKEC3O64.js} +6 -6
  30. package/dist/{update-G5HZINBK.js → update-IV4Y3T72.js} +6 -6
  31. package/package.json +1 -1
  32. package/dist/chunk-AYIREX73.js +0 -85
  33. package/dist/chunk-TVAY4OQL.js +0 -118
  34. package/dist/config-MCEQOLE5.js +0 -22
  35. package/dist/{chunk-Z5Q533UG.js → chunk-HPNRQYLM.js} +3 -3
  36. package/dist/{update-check-5SCD2JR2.js → update-check-BPCQ25AR.js} +3 -3
@@ -21,7 +21,7 @@ ${MARKER_START}
21
21
  _cf_completions() {
22
22
  local cur="\${COMP_WORDS[COMP_CWORD]}"
23
23
  local prev="\${COMP_WORDS[COMP_CWORD-1]}"
24
- local commands="install uninstall disable enable init config host mcp memory permission statusline update status dev session"
24
+ local commands="install uninstall disable enable init config host mcp memory permission statusline update status clean dev session"
25
25
  local scope_flags="--user --global --project --local"
26
26
  local update_flags="--cli --plugin --statusline --user --global --project --local"
27
27
 
@@ -89,6 +89,7 @@ var ZSH_FUNCTION_BODY = `_cf() {
89
89
  'update:Update coding-friend plugin and refresh statusline'
90
90
  'dev:Switch between local and remote plugin for development'
91
91
  'status:Show comprehensive Coding Friend status'
92
+ 'clean:Clean files generated by Coding Friend in docs/'
92
93
  'session:Save and load Claude Code sessions across machines'
93
94
  )
94
95
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ALL_COMPONENT_IDS,
3
3
  STATUSLINE_COMPONENTS
4
- } from "./chunk-OYPOADCX.js";
4
+ } from "./chunk-57EGAXYI.js";
5
5
  import {
6
6
  claudeSettingsPath,
7
7
  globalConfigPath,
@@ -0,0 +1,61 @@
1
+ import {
2
+ runWithStderr
3
+ } from "./chunk-EVGXUDX4.js";
4
+ import {
5
+ resolvePath
6
+ } from "./chunk-TWKNGPBO.js";
7
+ import {
8
+ log
9
+ } from "./chunk-NREZK463.js";
10
+
11
+ // src/lib/learn-prompts.ts
12
+ var MCP_NAME = "coding-friend-learn";
13
+ function registerLearnMcp(learnDir) {
14
+ const resolved = resolvePath(learnDir);
15
+ const result = runWithStderr("claude", [
16
+ "mcp",
17
+ "add",
18
+ "--scope",
19
+ "user",
20
+ MCP_NAME,
21
+ "--",
22
+ "npx",
23
+ "-y",
24
+ "coding-friend-cli",
25
+ "mcp-serve-learn",
26
+ resolved
27
+ ]);
28
+ if (result.exitCode !== 0) {
29
+ const stderr = result.stderr ?? "";
30
+ if (stderr.includes("ENOENT") || stderr.includes("command not found")) {
31
+ log.warn(
32
+ `claude CLI not found \u2014 add MCP manually:
33
+ claude mcp add --scope user ${MCP_NAME} -- npx -y coding-friend-cli mcp-serve-learn ${resolved}`
34
+ );
35
+ } else {
36
+ log.warn(`Could not register MCP: ${stderr || "unknown error"}`);
37
+ }
38
+ return false;
39
+ }
40
+ return true;
41
+ }
42
+ function isLearnMcpRegistered() {
43
+ const result = runWithStderr("claude", ["mcp", "get", MCP_NAME]);
44
+ return result.exitCode === 0;
45
+ }
46
+ function unregisterLearnMcp() {
47
+ const result = runWithStderr("claude", [
48
+ "mcp",
49
+ "remove",
50
+ "--scope",
51
+ "user",
52
+ MCP_NAME
53
+ ]);
54
+ return result.exitCode === 0;
55
+ }
56
+
57
+ export {
58
+ registerLearnMcp,
59
+ isLearnMcpRegistered,
60
+ unregisterLearnMcp
61
+ };
@@ -0,0 +1,95 @@
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
+ };