@smithery/cli 1.0.1 → 1.0.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.
@@ -4,15 +4,8 @@ import path from "node:path";
4
4
  // biome-ignore lint/complexity/noStaticOnlyClass: <explanation>
5
5
  export class ConfigManager {
6
6
  static getConfigPath(client) {
7
- const baseDir = path.dirname(ConfigManager.configPath);
8
- // Default to Claude if no client specified or if explicitly Claude
9
- if (!client || client.toLowerCase() === "claude") {
10
- return ConfigManager.configPath;
11
- }
12
- // Support for future AI clients
13
- // Currently only Claude is officially supported
14
- // 'jan' and others are placeholders for future integrations
15
- return path.join(baseDir, "..", client, `${client.toLowerCase()}_config.json`);
7
+ const normalizedClient = client?.toLowerCase() || "claude";
8
+ return ConfigManager.clientPaths[normalizedClient] || path.join(path.dirname(ConfigManager.configPath), "..", client || "claude", `${normalizedClient}_config.json`);
16
9
  }
17
10
  static readConfig(client) {
18
11
  try {
@@ -97,19 +90,30 @@ export class ConfigManager {
97
90
  }
98
91
  }
99
92
  (() => {
100
- if (process.platform === "win32") {
101
- const appData = process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming");
102
- ConfigManager.configPath = path.join(appData, "Claude", "claude_desktop_config.json");
103
- }
104
- else if (process.platform === "darwin") {
105
- // macOS
106
- const homeDir = os.homedir();
107
- ConfigManager.configPath = path.join(homeDir, "Library", "Application Support", "Claude", "claude_desktop_config.json");
108
- }
109
- else {
110
- // Linux
111
- const homeDir = os.homedir();
112
- const configDir = process.env.XDG_CONFIG_HOME || path.join(homeDir, ".config");
113
- ConfigManager.configPath = path.join(configDir, "Claude", "claude_desktop_config.json");
114
- }
93
+ const homeDir = os.homedir();
94
+ // Define platform-specific base directories
95
+ const platformPaths = {
96
+ win32: {
97
+ baseDir: process.env.APPDATA || path.join(homeDir, "AppData", "Roaming"),
98
+ vscodePath: path.join("Code", "User", "globalStorage")
99
+ },
100
+ darwin: {
101
+ baseDir: path.join(homeDir, "Library", "Application Support"),
102
+ vscodePath: path.join("Code", "User", "globalStorage")
103
+ },
104
+ linux: {
105
+ baseDir: process.env.XDG_CONFIG_HOME || path.join(homeDir, ".config"),
106
+ vscodePath: path.join("Code/User/globalStorage")
107
+ }
108
+ };
109
+ const platform = process.platform;
110
+ const { baseDir, vscodePath } = platformPaths[platform];
111
+ // Define client paths using the platform-specific base directories
112
+ const clientPaths = {
113
+ claude: path.join(baseDir, "Claude", "claude_desktop_config.json"),
114
+ cline: path.join(baseDir, vscodePath, "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"),
115
+ "roo-cline": path.join(baseDir, vscodePath, "rooveterinaryinc.roo-cline", "settings", "cline_mcp_settings.json")
116
+ };
117
+ ConfigManager.configPath = clientPaths.claude;
118
+ ConfigManager.clientPaths = clientPaths;
115
119
  })();
@@ -23,7 +23,7 @@ export async function resolveServer(serverId, client) {
23
23
  try {
24
24
  // Check if server is installed first
25
25
  // const config = ConfigManager.readConfig()
26
- const isInstalled = ConfigManager.isServerInstalled(serverId);
26
+ const isInstalled = ConfigManager.isServerInstalled(serverId, client);
27
27
  const response = await fetch(`${REGISTRY_ENDPOINT}/servers/${serverId}`);
28
28
  if (!response.ok) {
29
29
  // If server is installed but not in registry, return basic info
@@ -2,11 +2,11 @@ import chalk from "chalk";
2
2
  import { ServerManager } from "./server-manager.js";
3
3
  import { displayServerDetails, confirmUninstall } from "./server-display.js";
4
4
  const serverManager = new ServerManager();
5
- export async function handleServerAction(server, action, handlers, showActionsAfter = true) {
5
+ export async function handleServerAction(server, action, handlers, showActionsAfter = true, client = "claude") {
6
6
  switch (action) {
7
7
  case "install":
8
8
  console.log(chalk.cyan(`\nPreparing to install ${server.name}...`));
9
- await serverManager.installServer(server);
9
+ await serverManager.installServer(server, client);
10
10
  server.isInstalled = true;
11
11
  if (handlers.onInstall) {
12
12
  await handlers.onInstall(server);
@@ -15,7 +15,7 @@ export async function handleServerAction(server, action, handlers, showActionsAf
15
15
  return; // Exit after successful installation
16
16
  case "uninstall":
17
17
  if (await confirmUninstall(server.name)) {
18
- await serverManager.uninstallServer(server.id);
18
+ await serverManager.uninstallServer(server.id, client);
19
19
  console.log(chalk.green(`Successfully uninstalled ${server.name}`));
20
20
  server.isInstalled = false;
21
21
  if (handlers.onUninstall) {
@@ -38,6 +38,6 @@ export async function handleServerAction(server, action, handlers, showActionsAf
38
38
  // Show actions again after completing an action (except for exit/back)
39
39
  if (showActionsAfter) {
40
40
  const nextAction = await displayServerDetails(server);
41
- await handleServerAction(server, nextAction, handlers);
41
+ await handleServerAction(server, nextAction, handlers, showActionsAfter, client);
42
42
  }
43
43
  }
@@ -13,15 +13,15 @@ export class ServerManager {
13
13
  }
14
14
  return connection;
15
15
  }
16
- async installServer(server) {
16
+ async installServer(server, client) {
17
17
  const connection = this.validateConnection(server);
18
18
  const values = await collectConfigValues(connection);
19
19
  const serverConfig = await getServerConfiguration(server.id, values, connection.type);
20
20
  if (!serverConfig) {
21
21
  throw new Error(`Unable to fetch server configuration for server ${server.id}`);
22
22
  }
23
- await this.configManager.installServer(server.id, serverConfig, server.client);
24
- await promptForRestart(server.client);
23
+ await this.configManager.installServer(server.id, serverConfig, client);
24
+ await promptForRestart(client);
25
25
  }
26
26
  async uninstallServer(serverId, client) {
27
27
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithery/cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "commonjs",
5
5
  "private": false,
6
6
  "homepage": "https://smithery.ai/",