coding-friend-cli 1.0.0 → 1.0.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.
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # coding-friend-cli
2
+
3
+ CLI companion for the [coding-friend](https://github.com/dinhanhthi/coding-friend) plugin — a lean toolkit for disciplined engineering workflows with Claude Code.
4
+
5
+ ## Requirements
6
+
7
+ - Node.js >= 18
8
+ - The [coding-friend plugin](https://github.com/dinhanhthi/coding-friend) installed in Claude Code
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm i -g coding-friend-cli
14
+ ```
15
+
16
+ ## Commands
17
+
18
+ ```bash
19
+ cf init # Initialize workspace (interactive)
20
+ # 💡 You can run this anywhere, anytime.
21
+ cf host [path] # Build and serve learning docs at localhost:3333
22
+ # [path] is optional, default is `docs/learn`
23
+ cf mcp [path] # Setup MCP server for LLM integration
24
+ # [path] is optional, default is `docs/learn`
25
+ # This prints a JSON config snippet to add to your client's MCP
26
+ cf statusline # Setup coding-friend statusline
27
+ cf update # Update plugin + fix statusline
28
+ cf help # Show all commands
29
+ ```
30
+
31
+ ## 🐳 CLI Development
32
+
33
+ To work on the CLI locally:
34
+
35
+ ```bash
36
+ cd cli
37
+ npm install
38
+ npm run build
39
+ npm link # Creates global symlink for `cf` binary
40
+ ```
41
+
42
+ Now `cf` is available globally, pointing to your local source. After making changes:
43
+
44
+ ```bash
45
+ npm run build # Rebuild (no need to re-link)
46
+ ```
47
+
48
+ For development without rebuilding:
49
+
50
+ ```bash
51
+ npm run dev -- <command> # e.g. npm run dev -- init
52
+ ```
53
+
54
+ To unlink when done:
55
+
56
+ ```bash
57
+ npm unlink -g coding-friend-cli
58
+ ```
59
+
60
+ ## Publish CLI to npm
61
+
62
+ ```bash
63
+ # From the root of coding-friend project
64
+ cd cli
65
+ npm login # Login if not already
66
+ npm publish # Build + bundle + publish
67
+
68
+ # To bump a version
69
+ npm version patch # 1.0.1 -> 1.0.2
70
+ npm version minor # 1.0.1 -> 1.1.0
71
+ ```
72
+
73
+ `prepublishOnly` runs automatically: builds TypeScript → `dist/` and bundles libs from `lib/`.
74
+
75
+ - Bump `version` in `cli/package.json` before publishing
76
+ - First time or public package: `npm publish --access public`
77
+ - Package name: `coding-friend-cli` → users install with `npm i -g coding-friend-cli`
78
+
79
+ ## License
80
+
81
+ MIT
@@ -21,6 +21,9 @@ function streamExec(cmd, args, opts) {
21
21
  child.on("error", reject);
22
22
  });
23
23
  }
24
+ function sleepSync(ms) {
25
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
26
+ }
24
27
  function commandExists(cmd) {
25
28
  return run("which", [cmd]) !== null;
26
29
  }
@@ -28,5 +31,6 @@ function commandExists(cmd) {
28
31
  export {
29
32
  run,
30
33
  streamExec,
34
+ sleepSync,
31
35
  commandExists
32
36
  };
@@ -6,7 +6,7 @@ import "./chunk-HRVSKMNA.js";
6
6
  import {
7
7
  run,
8
8
  streamExec
9
- } from "./chunk-6CGGT2FD.js";
9
+ } from "./chunk-UFGNO6CW.js";
10
10
  import "./chunk-AQXTNLQD.js";
11
11
  import {
12
12
  log
package/dist/index.js CHANGED
@@ -12,15 +12,15 @@ var pkg = JSON.parse(
12
12
  var program = new Command();
13
13
  program.name("cf").description("coding-friend CLI \u2014 host learning docs, setup MCP, init projects").version(pkg.version);
14
14
  program.command("init").description("Initialize coding-friend in current project").action(async () => {
15
- const { initCommand } = await import("./init-ONRXFOZ5.js");
15
+ const { initCommand } = await import("./init-E6CL3UZQ.js");
16
16
  await initCommand();
17
17
  });
18
18
  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) => {
19
- const { hostCommand } = await import("./host-3GAEZKKJ.js");
19
+ const { hostCommand } = await import("./host-4CEAT6TL.js");
20
20
  await hostCommand(path, opts);
21
21
  });
22
22
  program.command("mcp").description("Setup MCP server for learning docs").argument("[path]", "path to docs folder").action(async (path) => {
23
- const { mcpCommand } = await import("./mcp-LMMIFH4B.js");
23
+ const { mcpCommand } = await import("./mcp-MWESK6UX.js");
24
24
  await mcpCommand(path);
25
25
  });
26
26
  program.command("statusline").description("Setup coding-friend statusline in Claude Code").action(async () => {
@@ -28,7 +28,7 @@ program.command("statusline").description("Setup coding-friend statusline in Cla
28
28
  await statuslineCommand();
29
29
  });
30
30
  program.command("update").description("Update coding-friend plugin and refresh statusline").action(async () => {
31
- const { updateCommand } = await import("./update-K5PYOB52.js");
31
+ const { updateCommand } = await import("./update-6PPVL2KJ.js");
32
32
  await updateCommand();
33
33
  });
34
34
  program.parse();
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-VHZQ6KEU.js";
8
8
  import {
9
9
  run
10
- } from "./chunk-6CGGT2FD.js";
10
+ } from "./chunk-UFGNO6CW.js";
11
11
  import {
12
12
  claudeSettingsPath,
13
13
  globalConfigPath,
@@ -5,7 +5,7 @@ import {
5
5
  import "./chunk-HRVSKMNA.js";
6
6
  import {
7
7
  run
8
- } from "./chunk-6CGGT2FD.js";
8
+ } from "./chunk-UFGNO6CW.js";
9
9
  import "./chunk-AQXTNLQD.js";
10
10
  import {
11
11
  log
@@ -3,8 +3,9 @@ import {
3
3
  } from "./chunk-VHZQ6KEU.js";
4
4
  import {
5
5
  commandExists,
6
- run
7
- } from "./chunk-6CGGT2FD.js";
6
+ run,
7
+ sleepSync
8
+ } from "./chunk-UFGNO6CW.js";
8
9
  import {
9
10
  claudeSettingsPath,
10
11
  installedPluginsPath,
@@ -135,14 +136,19 @@ async function updateCommand() {
135
136
  return;
136
137
  }
137
138
  log.success("Plugin updated!");
138
- const newVersion = getInstalledVersion();
139
- if (newVersion === currentVersion) {
139
+ let newVersion = currentVersion;
140
+ for (let i = 0; i < 5; i++) {
141
+ newVersion = getInstalledVersion();
142
+ if (newVersion !== currentVersion) break;
143
+ if (i < 4) sleepSync(1e3);
144
+ }
145
+ if (newVersion !== currentVersion) {
146
+ log.success(`Updated to ${chalk.green(`v${newVersion}`)}`);
147
+ } else {
140
148
  log.warn(
141
- "Version unchanged after update. Restart Claude Code and try cf update again."
149
+ "Version in installed_plugins.json unchanged. Cache may still have been updated."
142
150
  );
143
- return;
144
151
  }
145
- log.success(`Updated to ${chalk.green(`v${newVersion}`)}`);
146
152
  }
147
153
  const targetVersion = findLatestCacheVersion();
148
154
  if (targetVersion) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coding-friend-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "CLI for coding-friend — host learning docs, setup MCP server, initialize projects",
5
5
  "type": "module",
6
6
  "bin": {