coding-friend-cli 1.36.2 → 1.36.3

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.
@@ -145,7 +145,7 @@ async function editLearnOutputDir(globalCfg) {
145
145
  const locationChoices = [];
146
146
  if (hasDistinctCurrent) {
147
147
  locationChoices.push({
148
- name: `Keep current (${oldOutputDir})`,
148
+ name: `Keep global (${oldOutputDir})`,
149
149
  value: "current"
150
150
  });
151
151
  }
@@ -256,14 +256,15 @@ async function editLearnLanguage(globalCfg) {
256
256
  }
257
257
  async function editLearnCategories(globalCfg) {
258
258
  const existingCats = globalCfg?.learn?.categories;
259
- const defaultNames = DEFAULT_CONFIG.learn.categories.map((c) => c.name).join(", ");
259
+ const defaultCats = DEFAULT_CONFIG.learn.categories;
260
+ const defaultNames = defaultCats.map((c) => c.name).join(", ");
260
261
  const catChoices = [
261
262
  { name: `Use defaults (${defaultNames})`, value: "defaults" }
262
263
  ];
263
- if (existingCats && existingCats.length > 0) {
264
+ if (existingCats && existingCats.length > 0 && JSON.stringify(existingCats) !== JSON.stringify(defaultCats)) {
264
265
  const existingNames = existingCats.map((c) => c.name).join(", ");
265
266
  catChoices.push({
266
- name: `Keep current (${existingNames})`,
267
+ name: `Keep global (${existingNames})`,
267
268
  value: "existing"
268
269
  });
269
270
  }
@@ -278,7 +279,7 @@ async function editLearnCategories(globalCfg) {
278
279
  } else if (catChoice === "custom") {
279
280
  console.log();
280
281
  if (existingCats && existingCats.length > 0) {
281
- console.log("Current categories:");
282
+ console.log("Global categories:");
282
283
  for (const c of existingCats) {
283
284
  log.dim(` ${c.name}: ${c.description}`);
284
285
  }
@@ -375,6 +376,7 @@ async function learnSubMenu() {
375
376
  const langVal = globalCfg?.learn?.language;
376
377
  const autoCommitVal = globalCfg?.learn?.autoCommit;
377
378
  const readmeVal = globalCfg?.learn?.readmeIndex;
379
+ const catsVal = (globalCfg?.learn?.categories ?? DEFAULT_CONFIG.learn.categories).map((c) => c.name).join(", ");
378
380
  const isDisabled = globalCfg?.learn?.disabled ?? false;
379
381
  const disabledLabel = isDisabled ? chalk.yellow(" [disabled]") : "";
380
382
  const choice = await select({
@@ -390,7 +392,7 @@ async function learnSubMenu() {
390
392
  value: "language"
391
393
  },
392
394
  {
393
- name: "Categories",
395
+ name: `Categories (${catsVal})`,
394
396
  value: "categories"
395
397
  },
396
398
  {
package/dist/index.js CHANGED
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ installedPluginsPath
4
+ } from "./chunk-X2H7JJMR.js";
2
5
 
3
6
  // src/index.ts
4
7
  import { Command } from "commander";
@@ -9,10 +12,36 @@ var __dirname = dirname(fileURLToPath(import.meta.url));
9
12
  var pkg = JSON.parse(
10
13
  readFileSync(join(__dirname, "..", "package.json"), "utf-8")
11
14
  );
15
+ function getInstalledPluginVersion() {
16
+ try {
17
+ const data = JSON.parse(readFileSync(installedPluginsPath(), "utf-8"));
18
+ const plugins = data.plugins ?? data;
19
+ for (const [key, value] of Object.entries(plugins)) {
20
+ if (!key.includes("coding-friend")) continue;
21
+ if (Array.isArray(value) && value.length > 0) {
22
+ const entry = value[0];
23
+ if (typeof entry.version === "string") return entry.version;
24
+ }
25
+ if (typeof value === "object" && value !== null && "version" in value) {
26
+ return value.version;
27
+ }
28
+ }
29
+ } catch {
30
+ }
31
+ return null;
32
+ }
33
+ function buildVersionString() {
34
+ const pluginVersion = getInstalledPluginVersion();
35
+ return [
36
+ `CLI ${pkg.version}`,
37
+ `plugin ${pluginVersion ?? "(not installed)"}`
38
+ ].join("\n");
39
+ }
40
+ var wantsVersion = process.argv.includes("-v") || process.argv.includes("--version");
12
41
  var program = new Command();
13
42
  program.name("cf").description(
14
43
  "coding-friend CLI \u2014 host learning docs, setup MCP, init projects"
15
- ).version(pkg.version, "-v, --version");
44
+ ).version(wantsVersion ? buildVersionString() : pkg.version, "-v, --version");
16
45
  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
46
  const { installCommand } = await import("./install-VFMO45SP.js");
18
47
  await installCommand(opts);
@@ -30,11 +59,11 @@ program.command("enable").description("Re-enable the Coding Friend plugin").opti
30
59
  await enableCommand(opts);
31
60
  });
32
61
  program.command("init").description("Initialize coding-friend in current project").action(async () => {
33
- const { initCommand } = await import("./init-GJ5II4WB.js");
62
+ const { initCommand } = await import("./init-M5JJP5YO.js");
34
63
  await initCommand();
35
64
  });
36
65
  program.command("config").description("Manage Coding Friend configuration").action(async () => {
37
- const { configCommand } = await import("./config-U3UYCC7M.js");
66
+ const { configCommand } = await import("./config-B2P7TXL4.js");
38
67
  await configCommand();
39
68
  });
40
69
  var learn = program.command("learn").description("Manage learning docs \u2014 host as a website or push to git");
@@ -408,7 +408,7 @@ async function stepLearnConfig(globalCfg) {
408
408
  const locationChoices = [];
409
409
  if (hasDistinctCurrent) {
410
410
  locationChoices.push({
411
- name: `Keep current (${currentOutputDir})`,
411
+ name: `Keep global (${currentOutputDir})`,
412
412
  value: "current"
413
413
  });
414
414
  }
@@ -449,14 +449,15 @@ async function stepLearnConfig(globalCfg) {
449
449
  }
450
450
  }
451
451
  const existingCats = globalLearn?.categories;
452
- const defaultNames = DEFAULT_CONFIG.learn.categories.map((c) => c.name).join(", ");
452
+ const defaultCats = DEFAULT_CONFIG.learn.categories;
453
+ const defaultNames = defaultCats.map((c) => c.name).join(", ");
453
454
  const catChoices = [
454
455
  { name: `Use defaults (${defaultNames})`, value: "defaults" }
455
456
  ];
456
- if (existingCats && existingCats.length > 0) {
457
+ if (existingCats && existingCats.length > 0 && JSON.stringify(existingCats) !== JSON.stringify(defaultCats)) {
457
458
  const existingNames = existingCats.map((c) => c.name).join(", ");
458
459
  catChoices.push({
459
- name: `Keep current (${existingNames})`,
460
+ name: `Keep global (${existingNames})`,
460
461
  value: "existing"
461
462
  });
462
463
  }
@@ -472,7 +473,7 @@ async function stepLearnConfig(globalCfg) {
472
473
  } else if (catChoice === "custom") {
473
474
  console.log();
474
475
  if (existingCats && existingCats.length > 0) {
475
- console.log("Current categories in config.json:");
476
+ console.log("Global categories in config.json:");
476
477
  for (const c of existingCats) {
477
478
  log.dim(` ${c.name}: ${c.description}`);
478
479
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coding-friend-cli",
3
- "version": "1.36.2",
3
+ "version": "1.36.3",
4
4
  "description": "CLI for coding-friend — host learning docs, setup MCP server, initialize projects",
5
5
  "type": "module",
6
6
  "bin": {