@nordsym/apiclaw 1.3.7 → 1.3.9

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 (203) hide show
  1. package/README.md +436 -200
  2. package/convex/_generated/api.d.ts +4 -0
  3. package/convex/agents.ts +403 -0
  4. package/convex/directCall.ts +80 -0
  5. package/convex/earnProgress.ts +753 -0
  6. package/convex/logs.ts +17 -0
  7. package/convex/providerKeys.ts +82 -2
  8. package/convex/schema.ts +71 -2
  9. package/convex/workspaces.ts +84 -2
  10. package/dist/adapters/base.d.ts +112 -0
  11. package/dist/adapters/base.d.ts.map +1 -0
  12. package/dist/adapters/base.js +247 -0
  13. package/dist/adapters/base.js.map +1 -0
  14. package/dist/adapters/claude-desktop.d.ts +12 -0
  15. package/dist/adapters/claude-desktop.d.ts.map +1 -0
  16. package/dist/adapters/claude-desktop.js +36 -0
  17. package/dist/adapters/claude-desktop.js.map +1 -0
  18. package/dist/adapters/cline.d.ts +20 -0
  19. package/dist/adapters/cline.d.ts.map +1 -0
  20. package/dist/adapters/cline.js +77 -0
  21. package/dist/adapters/cline.js.map +1 -0
  22. package/dist/adapters/continue.d.ts +26 -0
  23. package/dist/adapters/continue.d.ts.map +1 -0
  24. package/dist/adapters/continue.js +68 -0
  25. package/dist/adapters/continue.js.map +1 -0
  26. package/dist/adapters/cursor.d.ts +12 -0
  27. package/dist/adapters/cursor.d.ts.map +1 -0
  28. package/dist/adapters/cursor.js +38 -0
  29. package/dist/adapters/cursor.js.map +1 -0
  30. package/dist/adapters/custom.d.ts +47 -0
  31. package/dist/adapters/custom.d.ts.map +1 -0
  32. package/dist/adapters/custom.js +146 -0
  33. package/dist/adapters/custom.js.map +1 -0
  34. package/dist/adapters/detect.d.ts +69 -0
  35. package/dist/adapters/detect.d.ts.map +1 -0
  36. package/dist/adapters/detect.js +158 -0
  37. package/dist/adapters/detect.js.map +1 -0
  38. package/dist/adapters/index.d.ts +21 -0
  39. package/dist/adapters/index.d.ts.map +1 -0
  40. package/dist/adapters/index.js +23 -0
  41. package/dist/adapters/index.js.map +1 -0
  42. package/dist/adapters/windsurf.d.ts +12 -0
  43. package/dist/adapters/windsurf.d.ts.map +1 -0
  44. package/dist/adapters/windsurf.js +39 -0
  45. package/dist/adapters/windsurf.js.map +1 -0
  46. package/dist/bin.d.ts +9 -0
  47. package/dist/bin.d.ts.map +1 -0
  48. package/dist/bin.js +19 -0
  49. package/dist/bin.js.map +1 -0
  50. package/dist/cli/commands/doctor.d.ts +34 -0
  51. package/dist/cli/commands/doctor.d.ts.map +1 -0
  52. package/dist/cli/commands/doctor.js +312 -0
  53. package/dist/cli/commands/doctor.js.map +1 -0
  54. package/dist/cli/commands/index.d.ts +9 -0
  55. package/dist/cli/commands/index.d.ts.map +1 -0
  56. package/dist/cli/commands/index.js +9 -0
  57. package/dist/cli/commands/index.js.map +1 -0
  58. package/dist/cli/commands/mcp-install.d.ts +14 -0
  59. package/dist/cli/commands/mcp-install.d.ts.map +1 -0
  60. package/dist/cli/commands/mcp-install.js +246 -0
  61. package/dist/cli/commands/mcp-install.js.map +1 -0
  62. package/dist/cli/commands/restore.d.ts +50 -0
  63. package/dist/cli/commands/restore.d.ts.map +1 -0
  64. package/dist/cli/commands/restore.js +260 -0
  65. package/dist/cli/commands/restore.js.map +1 -0
  66. package/dist/cli/commands/setup.d.ts +19 -0
  67. package/dist/cli/commands/setup.d.ts.map +1 -0
  68. package/dist/cli/commands/setup.js +206 -0
  69. package/dist/cli/commands/setup.js.map +1 -0
  70. package/dist/cli/commands/uninstall.d.ts +37 -0
  71. package/dist/cli/commands/uninstall.d.ts.map +1 -0
  72. package/dist/cli/commands/uninstall.js +189 -0
  73. package/dist/cli/commands/uninstall.js.map +1 -0
  74. package/dist/cli/index.d.ts +7 -0
  75. package/dist/cli/index.d.ts.map +1 -0
  76. package/dist/cli/index.js +105 -0
  77. package/dist/cli/index.js.map +1 -0
  78. package/dist/discovery.d.ts +6 -2
  79. package/dist/discovery.d.ts.map +1 -1
  80. package/dist/discovery.js +296 -2
  81. package/dist/discovery.js.map +1 -1
  82. package/dist/enterprise/env.d.ts +56 -0
  83. package/dist/enterprise/env.d.ts.map +1 -0
  84. package/dist/enterprise/env.js +124 -0
  85. package/dist/enterprise/env.js.map +1 -0
  86. package/dist/enterprise/index.d.ts +7 -0
  87. package/dist/enterprise/index.d.ts.map +1 -0
  88. package/dist/enterprise/index.js +7 -0
  89. package/dist/enterprise/index.js.map +1 -0
  90. package/dist/enterprise/script-generator.d.ts +32 -0
  91. package/dist/enterprise/script-generator.d.ts.map +1 -0
  92. package/dist/enterprise/script-generator.js +461 -0
  93. package/dist/enterprise/script-generator.js.map +1 -0
  94. package/dist/execute.d.ts +21 -0
  95. package/dist/execute.d.ts.map +1 -1
  96. package/dist/execute.js +231 -0
  97. package/dist/execute.js.map +1 -1
  98. package/dist/index.js +79 -7
  99. package/dist/index.js.map +1 -1
  100. package/dist/stripe.d.ts +1 -1
  101. package/dist/stripe.js +1 -1
  102. package/dist/stripe.js.map +1 -1
  103. package/dist/types.d.ts +29 -0
  104. package/dist/types.d.ts.map +1 -1
  105. package/dist/ui/colors.d.ts +111 -0
  106. package/dist/ui/colors.d.ts.map +1 -0
  107. package/dist/ui/colors.js +185 -0
  108. package/dist/ui/colors.js.map +1 -0
  109. package/dist/ui/errors.d.ts +69 -0
  110. package/dist/ui/errors.d.ts.map +1 -0
  111. package/dist/ui/errors.js +334 -0
  112. package/dist/ui/errors.js.map +1 -0
  113. package/dist/ui/index.d.ts +10 -0
  114. package/dist/ui/index.d.ts.map +1 -0
  115. package/dist/ui/index.js +14 -0
  116. package/dist/ui/index.js.map +1 -0
  117. package/dist/ui/prompts.d.ts +88 -0
  118. package/dist/ui/prompts.d.ts.map +1 -0
  119. package/dist/ui/prompts.js +295 -0
  120. package/dist/ui/prompts.js.map +1 -0
  121. package/dist/ui/spinner.d.ts +112 -0
  122. package/dist/ui/spinner.d.ts.map +1 -0
  123. package/dist/ui/spinner.js +229 -0
  124. package/dist/ui/spinner.js.map +1 -0
  125. package/dist/utils/backup.d.ts +48 -0
  126. package/dist/utils/backup.d.ts.map +1 -0
  127. package/dist/utils/backup.js +182 -0
  128. package/dist/utils/backup.js.map +1 -0
  129. package/dist/utils/config.d.ts +80 -0
  130. package/dist/utils/config.d.ts.map +1 -0
  131. package/dist/utils/config.js +221 -0
  132. package/dist/utils/config.js.map +1 -0
  133. package/dist/utils/os.d.ts +45 -0
  134. package/dist/utils/os.d.ts.map +1 -0
  135. package/dist/utils/os.js +106 -0
  136. package/dist/utils/os.js.map +1 -0
  137. package/dist/utils/paths.d.ts +38 -0
  138. package/dist/utils/paths.d.ts.map +1 -0
  139. package/dist/utils/paths.js +160 -0
  140. package/dist/utils/paths.js.map +1 -0
  141. package/docs/PRD-BILLING.md +226 -0
  142. package/docs/PRD-EARN-SYSTEM.md +261 -0
  143. package/docs/PRD-MCP-AUTO-SETUP.md +623 -0
  144. package/docs/enterprise-deployment.md +728 -0
  145. package/landing/next.config.mjs +14 -0
  146. package/landing/public/book/index.html +24 -5
  147. package/landing/public/demo-product.jpg +0 -0
  148. package/landing/public/stats.json +4 -2
  149. package/landing/scripts/generate-stats.js +13 -0
  150. package/landing/src/app/api/og/route.tsx +1 -3
  151. package/landing/src/app/api/workspace-auth/magic-link/route.ts +6 -3
  152. package/landing/src/app/auth/verify/page.tsx +11 -4
  153. package/landing/src/app/docs/page.tsx +1 -1
  154. package/landing/src/app/join/page.tsx +49 -0
  155. package/landing/src/app/layout.tsx +1 -1
  156. package/landing/src/app/login/page.tsx +7 -1
  157. package/landing/src/app/page.tsx +50 -38
  158. package/landing/src/app/providers/register/page.tsx +1 -1
  159. package/landing/src/app/workspace/page.tsx +484 -806
  160. package/landing/src/components/CheckoutButton.tsx +1 -1
  161. package/landing/src/components/EarnCreditsTab.tsx +842 -0
  162. package/landing/src/components/HeroTabs.tsx +2 -2
  163. package/landing/src/components/demo/PhoneDemo.tsx +423 -0
  164. package/landing/src/components/demo/index.ts +1 -0
  165. package/landing/src/lib/stats.json +3 -1
  166. package/landing/tailwind.config.ts +10 -0
  167. package/package.json +9 -2
  168. package/src/adapters/base.ts +363 -0
  169. package/src/adapters/claude-desktop.ts +41 -0
  170. package/src/adapters/cline.ts +88 -0
  171. package/src/adapters/continue.ts +91 -0
  172. package/src/adapters/cursor.ts +43 -0
  173. package/src/adapters/custom.ts +188 -0
  174. package/src/adapters/detect.ts +202 -0
  175. package/src/adapters/index.ts +47 -0
  176. package/src/adapters/windsurf.ts +44 -0
  177. package/src/bin.ts +19 -0
  178. package/src/cli/commands/doctor.ts +367 -0
  179. package/src/cli/commands/index.ts +9 -0
  180. package/src/cli/commands/mcp-install.ts +291 -0
  181. package/src/cli/commands/restore.ts +333 -0
  182. package/src/cli/commands/setup.ts +276 -0
  183. package/src/cli/commands/uninstall.ts +240 -0
  184. package/src/cli/index.ts +116 -0
  185. package/src/discovery.ts +328 -3
  186. package/src/enterprise/env.ts +156 -0
  187. package/src/enterprise/index.ts +7 -0
  188. package/src/enterprise/script-generator.ts +481 -0
  189. package/src/execute.ts +256 -0
  190. package/src/index.ts +85 -7
  191. package/src/stripe.ts +1 -1
  192. package/src/types.ts +32 -0
  193. package/src/ui/colors.ts +219 -0
  194. package/src/ui/errors.ts +394 -0
  195. package/src/ui/index.ts +17 -0
  196. package/src/ui/prompts.ts +390 -0
  197. package/src/ui/spinner.ts +325 -0
  198. package/src/utils/backup.ts +224 -0
  199. package/src/utils/config.ts +315 -0
  200. package/src/utils/os.ts +124 -0
  201. package/src/utils/paths.ts +203 -0
  202. package/STATUS.md +0 -160
  203. package/landing/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,363 @@
1
+ /**
2
+ * MCP Client Adapter - Base Interface & Abstract Class
3
+ * Defines the contract for all MCP client adapters
4
+ */
5
+
6
+ import { existsSync } from 'fs';
7
+ import { dirname } from 'path';
8
+ import { MCPClient, getConfigPath, getClientConfig } from '../utils/paths.js';
9
+ import { detectOS, Platform } from '../utils/os.js';
10
+ import { createBackup, BackupResult } from '../utils/backup.js';
11
+ import {
12
+ readConfig,
13
+ writeConfig,
14
+ mergeApiclawConfig,
15
+ mergeApiclawContinueConfig,
16
+ hasApiclawConfig,
17
+ MCPConfig,
18
+ ContinueConfig,
19
+ isContinueFormat,
20
+ } from '../utils/config.js';
21
+
22
+ export interface ConfigResult {
23
+ success: boolean;
24
+ message: string;
25
+ configPath: string;
26
+ backupPath?: string | null;
27
+ isNew?: boolean;
28
+ alreadyConfigured?: boolean;
29
+ error?: string;
30
+ }
31
+
32
+ export interface VerifyResult {
33
+ success: boolean;
34
+ hasConfig: boolean;
35
+ configValid: boolean;
36
+ message: string;
37
+ }
38
+
39
+ export interface InstallInfo {
40
+ installed: boolean;
41
+ appPath?: string;
42
+ configExists: boolean;
43
+ configPath: string;
44
+ }
45
+
46
+ export interface ConfigureOptions {
47
+ workspaceId?: string;
48
+ serverName?: string;
49
+ force?: boolean;
50
+ }
51
+
52
+ /**
53
+ * MCP Client Adapter Interface
54
+ */
55
+ export interface MCPClientAdapter {
56
+ /** Internal client name */
57
+ name: MCPClient | 'custom';
58
+
59
+ /** Human-readable display name */
60
+ displayName: string;
61
+
62
+ /** Check if the client is installed on the system */
63
+ isInstalled(): Promise<boolean>;
64
+
65
+ /** Get the config file path for this client */
66
+ getConfigPath(): string;
67
+
68
+ /** Configure APIClaw MCP server for this client */
69
+ configure(options?: ConfigureOptions): Promise<ConfigResult>;
70
+
71
+ /** Verify the current configuration */
72
+ verify(): Promise<VerifyResult>;
73
+
74
+ /** Get detailed installation info */
75
+ getInstallInfo(): Promise<InstallInfo>;
76
+
77
+ /** Remove APIClaw configuration */
78
+ unconfigure(serverName?: string): Promise<ConfigResult>;
79
+ }
80
+
81
+ /**
82
+ * Abstract base class for MCP client adapters
83
+ * Provides common functionality for all adapters
84
+ */
85
+ export abstract class BaseAdapter implements MCPClientAdapter {
86
+ abstract name: MCPClient | 'custom';
87
+ abstract displayName: string;
88
+
89
+ protected os: Platform;
90
+
91
+ constructor() {
92
+ this.os = detectOS();
93
+ }
94
+
95
+ /**
96
+ * Get the config file path
97
+ */
98
+ getConfigPath(): string {
99
+ if (this.name === 'custom') {
100
+ throw new Error('Custom adapter must override getConfigPath()');
101
+ }
102
+ return getConfigPath(this.name, this.os);
103
+ }
104
+
105
+ /**
106
+ * Check if config file exists
107
+ */
108
+ protected configExists(): boolean {
109
+ try {
110
+ return existsSync(this.getConfigPath());
111
+ } catch {
112
+ return false;
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Get application paths to check for installation
118
+ * Override in subclasses for specific clients
119
+ */
120
+ protected abstract getAppPaths(): string[];
121
+
122
+ /**
123
+ * Check if the client application is installed
124
+ */
125
+ async isInstalled(): Promise<boolean> {
126
+ // Check if config file exists
127
+ if (this.configExists()) {
128
+ return true;
129
+ }
130
+
131
+ // Check if app is installed
132
+ const appPaths = this.getAppPaths();
133
+ for (const path of appPaths) {
134
+ if (existsSync(path)) {
135
+ return true;
136
+ }
137
+ }
138
+
139
+ return false;
140
+ }
141
+
142
+ /**
143
+ * Get detailed installation information
144
+ */
145
+ async getInstallInfo(): Promise<InstallInfo> {
146
+ const configPath = this.getConfigPath();
147
+ const configExists = this.configExists();
148
+
149
+ let appPath: string | undefined;
150
+ const appPaths = this.getAppPaths();
151
+ for (const path of appPaths) {
152
+ if (existsSync(path)) {
153
+ appPath = path;
154
+ break;
155
+ }
156
+ }
157
+
158
+ return {
159
+ installed: configExists || appPath !== undefined,
160
+ appPath,
161
+ configExists,
162
+ configPath,
163
+ };
164
+ }
165
+
166
+ /**
167
+ * Configure APIClaw MCP server
168
+ */
169
+ async configure(options: ConfigureOptions = {}): Promise<ConfigResult> {
170
+ const configPath = this.getConfigPath();
171
+
172
+ try {
173
+ // Read existing config
174
+ const readResult = readConfig(configPath);
175
+ if (!readResult.success) {
176
+ return {
177
+ success: false,
178
+ message: `Failed to read config: ${readResult.error}`,
179
+ configPath,
180
+ error: readResult.error,
181
+ };
182
+ }
183
+
184
+ const config = readResult.config!;
185
+ const serverName = options.serverName || 'apiclaw';
186
+
187
+ // Check if already configured
188
+ if (!options.force && hasApiclawConfig(config, serverName)) {
189
+ return {
190
+ success: true,
191
+ message: `APIClaw already configured in ${this.displayName}`,
192
+ configPath,
193
+ alreadyConfigured: true,
194
+ };
195
+ }
196
+
197
+ // Merge APIClaw config
198
+ const mergeOptions = {
199
+ workspace: options.workspaceId,
200
+ serverName,
201
+ force: options.force,
202
+ };
203
+
204
+ const newConfig = this.mergeConfig(config, mergeOptions);
205
+
206
+ // Write config
207
+ const writeResult = writeConfig(configPath, newConfig);
208
+ if (!writeResult.success) {
209
+ return {
210
+ success: false,
211
+ message: `Failed to write config: ${writeResult.error}`,
212
+ configPath,
213
+ error: writeResult.error,
214
+ };
215
+ }
216
+
217
+ return {
218
+ success: true,
219
+ message: `Successfully configured APIClaw in ${this.displayName}`,
220
+ configPath,
221
+ backupPath: writeResult.backupPath,
222
+ isNew: readResult.isNew,
223
+ };
224
+ } catch (error) {
225
+ return {
226
+ success: false,
227
+ message: `Configuration failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
228
+ configPath,
229
+ error: error instanceof Error ? error.message : 'Unknown error',
230
+ };
231
+ }
232
+ }
233
+
234
+ /**
235
+ * Merge APIClaw config into existing config
236
+ * Override in subclasses for special formats (e.g., Continue)
237
+ */
238
+ protected mergeConfig(
239
+ config: MCPConfig | ContinueConfig,
240
+ options: { workspace?: string; serverName?: string; force?: boolean }
241
+ ): MCPConfig | ContinueConfig {
242
+ return mergeApiclawConfig(config as MCPConfig, options);
243
+ }
244
+
245
+ /**
246
+ * Verify the current configuration
247
+ */
248
+ async verify(): Promise<VerifyResult> {
249
+ const configPath = this.getConfigPath();
250
+
251
+ if (!this.configExists()) {
252
+ return {
253
+ success: false,
254
+ hasConfig: false,
255
+ configValid: false,
256
+ message: `Config file not found: ${configPath}`,
257
+ };
258
+ }
259
+
260
+ const readResult = readConfig(configPath);
261
+ if (!readResult.success) {
262
+ return {
263
+ success: false,
264
+ hasConfig: true,
265
+ configValid: false,
266
+ message: `Invalid config file: ${readResult.error}`,
267
+ };
268
+ }
269
+
270
+ const hasApiclaw = hasApiclawConfig(readResult.config!);
271
+
272
+ return {
273
+ success: hasApiclaw,
274
+ hasConfig: true,
275
+ configValid: true,
276
+ message: hasApiclaw
277
+ ? `APIClaw is configured in ${this.displayName}`
278
+ : `APIClaw is not configured in ${this.displayName}`,
279
+ };
280
+ }
281
+
282
+ /**
283
+ * Remove APIClaw configuration
284
+ */
285
+ async unconfigure(serverName = 'apiclaw'): Promise<ConfigResult> {
286
+ const configPath = this.getConfigPath();
287
+
288
+ try {
289
+ if (!this.configExists()) {
290
+ return {
291
+ success: true,
292
+ message: `No config file found for ${this.displayName}`,
293
+ configPath,
294
+ };
295
+ }
296
+
297
+ const readResult = readConfig(configPath);
298
+ if (!readResult.success) {
299
+ return {
300
+ success: false,
301
+ message: `Failed to read config: ${readResult.error}`,
302
+ configPath,
303
+ error: readResult.error,
304
+ };
305
+ }
306
+
307
+ const config = readResult.config!;
308
+
309
+ if (!hasApiclawConfig(config, serverName)) {
310
+ return {
311
+ success: true,
312
+ message: `APIClaw not found in ${this.displayName} config`,
313
+ configPath,
314
+ };
315
+ }
316
+
317
+ // Remove APIClaw config
318
+ const newConfig = this.removeFromConfig(config, serverName);
319
+
320
+ // Write config
321
+ const writeResult = writeConfig(configPath, newConfig);
322
+ if (!writeResult.success) {
323
+ return {
324
+ success: false,
325
+ message: `Failed to write config: ${writeResult.error}`,
326
+ configPath,
327
+ error: writeResult.error,
328
+ };
329
+ }
330
+
331
+ return {
332
+ success: true,
333
+ message: `Successfully removed APIClaw from ${this.displayName}`,
334
+ configPath,
335
+ backupPath: writeResult.backupPath,
336
+ };
337
+ } catch (error) {
338
+ return {
339
+ success: false,
340
+ message: `Unconfigure failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
341
+ configPath,
342
+ error: error instanceof Error ? error.message : 'Unknown error',
343
+ };
344
+ }
345
+ }
346
+
347
+ /**
348
+ * Remove APIClaw from config
349
+ * Override in subclasses for special formats
350
+ */
351
+ protected removeFromConfig(
352
+ config: MCPConfig | ContinueConfig,
353
+ serverName: string
354
+ ): MCPConfig | ContinueConfig {
355
+ const mcpConfig = config as MCPConfig;
356
+ const { [serverName]: _, ...remainingServers } = mcpConfig.mcpServers || {};
357
+
358
+ return {
359
+ ...mcpConfig,
360
+ mcpServers: remainingServers,
361
+ };
362
+ }
363
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Claude Desktop Adapter
3
+ * Handles MCP configuration for Claude Desktop app
4
+ */
5
+
6
+ import { join } from 'path';
7
+ import { BaseAdapter } from './base.js';
8
+ import { MCPClient } from '../utils/paths.js';
9
+ import { getHomeDir } from '../utils/os.js';
10
+
11
+ export class ClaudeDesktopAdapter extends BaseAdapter {
12
+ name: MCPClient = 'claude-desktop';
13
+ displayName = 'Claude Desktop';
14
+
15
+ protected getAppPaths(): string[] {
16
+ switch (this.os) {
17
+ case 'mac':
18
+ return [
19
+ '/Applications/Claude.app',
20
+ join(getHomeDir(), 'Applications', 'Claude.app'),
21
+ ];
22
+
23
+ case 'win':
24
+ const localAppData = process.env.LOCALAPPDATA || join(getHomeDir(), 'AppData', 'Local');
25
+ const programFiles = process.env.PROGRAMFILES || 'C:\\Program Files';
26
+ return [
27
+ join(localAppData, 'Programs', 'Claude', 'Claude.exe'),
28
+ join(programFiles, 'Claude', 'Claude.exe'),
29
+ ];
30
+
31
+ case 'linux':
32
+ return [
33
+ '/usr/bin/claude',
34
+ '/usr/local/bin/claude',
35
+ join(getHomeDir(), '.local', 'bin', 'claude'),
36
+ '/snap/bin/claude',
37
+ '/var/lib/flatpak/exports/bin/com.anthropic.claude',
38
+ ];
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Cline Adapter
3
+ * Handles MCP configuration for Cline VS Code extension
4
+ */
5
+
6
+ import { join } from 'path';
7
+ import { BaseAdapter } from './base.js';
8
+ import { MCPClient } from '../utils/paths.js';
9
+ import { getHomeDir, getAppDataDir } from '../utils/os.js';
10
+
11
+ export class ClineAdapter extends BaseAdapter {
12
+ name: MCPClient = 'cline';
13
+ displayName = 'Cline';
14
+
15
+ protected getAppPaths(): string[] {
16
+ // Cline is a VS Code extension, so we check for VS Code
17
+ // and the extension directory
18
+ const home = getHomeDir();
19
+ const appData = getAppDataDir();
20
+
21
+ switch (this.os) {
22
+ case 'mac':
23
+ return [
24
+ '/Applications/Visual Studio Code.app',
25
+ join(home, 'Applications', 'Visual Studio Code.app'),
26
+ // Also check for extension directory
27
+ join(home, '.vscode', 'extensions'),
28
+ join(appData, 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev'),
29
+ ];
30
+
31
+ case 'win':
32
+ const localAppData = process.env.LOCALAPPDATA || join(home, 'AppData', 'Local');
33
+ const programFiles = process.env.PROGRAMFILES || 'C:\\Program Files';
34
+ return [
35
+ join(localAppData, 'Programs', 'Microsoft VS Code', 'Code.exe'),
36
+ join(programFiles, 'Microsoft VS Code', 'Code.exe'),
37
+ // Extension directory
38
+ join(home, '.vscode', 'extensions'),
39
+ join(appData, 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev'),
40
+ ];
41
+
42
+ case 'linux':
43
+ return [
44
+ '/usr/bin/code',
45
+ '/usr/local/bin/code',
46
+ '/snap/bin/code',
47
+ join(home, '.local', 'bin', 'code'),
48
+ // Extension directory
49
+ join(home, '.vscode', 'extensions'),
50
+ join(home, '.config', 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev'),
51
+ ];
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Override isInstalled to also check for the Cline extension specifically
57
+ */
58
+ async isInstalled(): Promise<boolean> {
59
+ // First check base implementation
60
+ if (await super.isInstalled()) {
61
+ return true;
62
+ }
63
+
64
+ // Check if Cline extension is installed
65
+ const extensionPaths = this.getClineExtensionPaths();
66
+ for (const path of extensionPaths) {
67
+ const { existsSync } = await import('fs');
68
+ if (existsSync(path)) {
69
+ return true;
70
+ }
71
+ }
72
+
73
+ return false;
74
+ }
75
+
76
+ /**
77
+ * Get possible Cline extension installation paths
78
+ */
79
+ private getClineExtensionPaths(): string[] {
80
+ const home = getHomeDir();
81
+ const extensionsDir = join(home, '.vscode', 'extensions');
82
+
83
+ // Extension directories are named like: saoudrizwan.claude-dev-x.x.x
84
+ return [
85
+ extensionsDir, // We'll check for pattern in isInstalled
86
+ ];
87
+ }
88
+ }
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Continue Adapter
3
+ * Handles MCP configuration for Continue extension
4
+ * Note: Continue uses array format for mcpServers, not object format
5
+ */
6
+
7
+ import { join } from 'path';
8
+ import { BaseAdapter, ConfigureOptions, ConfigResult } from './base.js';
9
+ import { MCPClient } from '../utils/paths.js';
10
+ import { getHomeDir, getAppDataDir } from '../utils/os.js';
11
+ import {
12
+ readConfig,
13
+ writeConfig,
14
+ mergeApiclawContinueConfig,
15
+ hasApiclawConfig,
16
+ MCPConfig,
17
+ ContinueConfig,
18
+ ContinueServerConfig,
19
+ } from '../utils/config.js';
20
+
21
+ export class ContinueAdapter extends BaseAdapter {
22
+ name: MCPClient = 'continue';
23
+ displayName = 'Continue';
24
+
25
+ protected getAppPaths(): string[] {
26
+ const home = getHomeDir();
27
+ const appData = getAppDataDir();
28
+
29
+ switch (this.os) {
30
+ case 'mac':
31
+ return [
32
+ // VS Code with Continue extension
33
+ '/Applications/Visual Studio Code.app',
34
+ join(home, 'Applications', 'Visual Studio Code.app'),
35
+ // Continue config directory
36
+ join(home, '.continue'),
37
+ // Extension directory
38
+ join(home, '.vscode', 'extensions'),
39
+ ];
40
+
41
+ case 'win':
42
+ const localAppData = process.env.LOCALAPPDATA || join(home, 'AppData', 'Local');
43
+ const programFiles = process.env.PROGRAMFILES || 'C:\\Program Files';
44
+ const userProfile = process.env.USERPROFILE || home;
45
+ return [
46
+ join(localAppData, 'Programs', 'Microsoft VS Code', 'Code.exe'),
47
+ join(programFiles, 'Microsoft VS Code', 'Code.exe'),
48
+ // Continue config directory
49
+ join(userProfile, '.continue'),
50
+ // Extension directory
51
+ join(home, '.vscode', 'extensions'),
52
+ ];
53
+
54
+ case 'linux':
55
+ return [
56
+ '/usr/bin/code',
57
+ '/usr/local/bin/code',
58
+ '/snap/bin/code',
59
+ // Continue config directory
60
+ join(home, '.continue'),
61
+ // Extension directory
62
+ join(home, '.vscode', 'extensions'),
63
+ ];
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Override mergeConfig for Continue's array format
69
+ */
70
+ protected mergeConfig(
71
+ config: MCPConfig | ContinueConfig,
72
+ options: { workspace?: string; serverName?: string; force?: boolean }
73
+ ): MCPConfig | ContinueConfig {
74
+ return mergeApiclawContinueConfig(config as ContinueConfig, options);
75
+ }
76
+
77
+ /**
78
+ * Override removeFromConfig for Continue's array format
79
+ */
80
+ protected removeFromConfig(
81
+ config: MCPConfig | ContinueConfig,
82
+ serverName: string
83
+ ): MCPConfig | ContinueConfig {
84
+ const continueConfig = config as ContinueConfig;
85
+
86
+ return {
87
+ ...continueConfig,
88
+ mcpServers: continueConfig.mcpServers?.filter(s => s.name !== serverName) || [],
89
+ };
90
+ }
91
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Cursor Adapter
3
+ * Handles MCP configuration for Cursor IDE
4
+ */
5
+
6
+ import { join } from 'path';
7
+ import { BaseAdapter } from './base.js';
8
+ import { MCPClient } from '../utils/paths.js';
9
+ import { getHomeDir } from '../utils/os.js';
10
+
11
+ export class CursorAdapter extends BaseAdapter {
12
+ name: MCPClient = 'cursor';
13
+ displayName = 'Cursor';
14
+
15
+ protected getAppPaths(): string[] {
16
+ switch (this.os) {
17
+ case 'mac':
18
+ return [
19
+ '/Applications/Cursor.app',
20
+ join(getHomeDir(), 'Applications', 'Cursor.app'),
21
+ ];
22
+
23
+ case 'win':
24
+ const localAppData = process.env.LOCALAPPDATA || join(getHomeDir(), 'AppData', 'Local');
25
+ const programFiles = process.env.PROGRAMFILES || 'C:\\Program Files';
26
+ return [
27
+ join(localAppData, 'Programs', 'Cursor', 'Cursor.exe'),
28
+ join(programFiles, 'Cursor', 'Cursor.exe'),
29
+ ];
30
+
31
+ case 'linux':
32
+ return [
33
+ '/usr/bin/cursor',
34
+ '/usr/local/bin/cursor',
35
+ join(getHomeDir(), '.local', 'bin', 'cursor'),
36
+ '/snap/bin/cursor',
37
+ '/opt/Cursor/cursor',
38
+ // AppImage common location
39
+ join(getHomeDir(), 'Applications', 'Cursor.AppImage'),
40
+ ];
41
+ }
42
+ }
43
+ }