@qazuor/claude-code-config 0.3.1 → 0.4.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.
package/dist/bin.cjs CHANGED
@@ -9695,6 +9695,10 @@ async function promptMcpConfig(options) {
9695
9695
  skippedConfigs: []
9696
9696
  };
9697
9697
  }
9698
+ const projectPath = options?.projectPath || process.cwd();
9699
+ const installedServers = await getInstalledMcpServers(projectPath);
9700
+ const userInstalledSet = new Set(installedServers.user);
9701
+ const projectInstalledSet = new Set(installedServers.project);
9698
9702
  const level = await select({
9699
9703
  message: "Where should MCP servers be configured?",
9700
9704
  choices: [
@@ -9715,13 +9719,44 @@ async function promptMcpConfig(options) {
9715
9719
  const selectedServerIds = [];
9716
9720
  logger.newline();
9717
9721
  logger.info("Select MCP servers to install:");
9722
+ const totalInstalled = userInstalledSet.size + projectInstalledSet.size;
9723
+ if (totalInstalled > 0) {
9724
+ const parts = [];
9725
+ if (userInstalledSet.size > 0) {
9726
+ parts.push(`${userInstalledSet.size} at user level`);
9727
+ }
9728
+ if (projectInstalledSet.size > 0) {
9729
+ parts.push(`${projectInstalledSet.size} at project level`);
9730
+ }
9731
+ logger.info(colors.muted(` (${parts.join(", ")} already installed)`));
9732
+ }
9718
9733
  logger.newline();
9719
9734
  for (const [category, servers] of Object.entries(serversByCategory)) {
9720
- const choices = servers.map((s) => ({
9721
- name: `${s.name} - ${s.description}`,
9722
- value: s.id,
9723
- checked: options?.defaults?.servers?.some((i) => i.serverId === s.id) ?? false
9724
- }));
9735
+ const choices = servers.map((s) => {
9736
+ const isInstalledAtUserLevel = userInstalledSet.has(s.id);
9737
+ const isInstalledAtProjectLevel = projectInstalledSet.has(s.id);
9738
+ if (isInstalledAtUserLevel) {
9739
+ return {
9740
+ name: `${s.name} - ${s.description} ${colors.muted("(already installed at user level)")}`,
9741
+ value: s.id,
9742
+ checked: false,
9743
+ disabled: "already installed at user level"
9744
+ };
9745
+ }
9746
+ if (isInstalledAtProjectLevel) {
9747
+ return {
9748
+ name: `${s.name} - ${s.description} ${colors.muted("(already installed at project level)")}`,
9749
+ value: s.id,
9750
+ checked: false,
9751
+ disabled: "already installed at project level"
9752
+ };
9753
+ }
9754
+ return {
9755
+ name: `${s.name} - ${s.description}`,
9756
+ value: s.id,
9757
+ checked: options?.defaults?.servers?.some((i) => i.serverId === s.id) ?? false
9758
+ };
9759
+ });
9725
9760
  const categoryLabel = formatCategory(category);
9726
9761
  const selected = await checkbox({
9727
9762
  message: `${categoryLabel}:`,
@@ -11219,7 +11254,7 @@ function createMcpConfigStep() {
11219
11254
  required: false
11220
11255
  },
11221
11256
  computeDefaults: (ctx) => ctx.mcpConfig,
11222
- execute: async (_ctx, defaults) => {
11257
+ execute: async (ctx, defaults) => {
11223
11258
  const goBack = await promptBackOption(5, "Configure MCP servers or go back?");
11224
11259
  if (goBack) {
11225
11260
  return createResult(
@@ -11227,7 +11262,7 @@ function createMcpConfigStep() {
11227
11262
  "back"
11228
11263
  );
11229
11264
  }
11230
- const result = await promptMcpConfig();
11265
+ const result = await promptMcpConfig({ projectPath: ctx.projectPath });
11231
11266
  return createResult(result, "next");
11232
11267
  }
11233
11268
  };
@@ -12936,7 +12971,8 @@ async function handleConfigUpdates(projectPath, config, _options) {
12936
12971
  }
12937
12972
  if (reconfigureOptions.includes("mcp")) {
12938
12973
  const mcpResult = await promptMcpConfig({
12939
- defaults: config.mcp
12974
+ defaults: config.mcp,
12975
+ projectPath
12940
12976
  });
12941
12977
  config.mcp = mcpResult.config;
12942
12978
  await installMcpServers(projectPath, mcpResult.config);