@nordsym/apiclaw 2.1.0 → 2.2.1

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 (185) hide show
  1. package/README.md +15 -2
  2. package/dist/bin-http.js +0 -0
  3. package/dist/bin.bundled.js +79288 -0
  4. package/dist/funnel-client.d.ts +24 -0
  5. package/dist/funnel-client.d.ts.map +1 -0
  6. package/dist/funnel-client.js +131 -0
  7. package/dist/funnel-client.js.map +1 -0
  8. package/dist/funnel.test.d.ts +2 -0
  9. package/dist/funnel.test.d.ts.map +1 -0
  10. package/dist/funnel.test.js +145 -0
  11. package/dist/funnel.test.js.map +1 -0
  12. package/dist/gateway-client.d.ts.map +1 -1
  13. package/dist/gateway-client.js +24 -2
  14. package/dist/gateway-client.js.map +1 -1
  15. package/dist/index.bundled.js +61263 -0
  16. package/dist/index.js +161 -74
  17. package/dist/index.js.map +1 -1
  18. package/dist/postinstall.d.ts +0 -5
  19. package/dist/postinstall.d.ts.map +1 -1
  20. package/dist/postinstall.js +24 -3
  21. package/dist/postinstall.js.map +1 -1
  22. package/dist/registration-guard.d.ts +29 -0
  23. package/dist/registration-guard.d.ts.map +1 -0
  24. package/dist/registration-guard.js +87 -0
  25. package/dist/registration-guard.js.map +1 -0
  26. package/package.json +7 -2
  27. package/.claude/settings.local.json +0 -9
  28. package/.env.prod +0 -1
  29. package/apiclaw-README.md +0 -494
  30. package/convex/_generated/api.d.ts +0 -137
  31. package/convex/_generated/api.js +0 -23
  32. package/convex/_generated/dataModel.d.ts +0 -60
  33. package/convex/_generated/server.d.ts +0 -143
  34. package/convex/_generated/server.js +0 -93
  35. package/convex/adminActivate.ts +0 -53
  36. package/convex/adminStats.ts +0 -306
  37. package/convex/agents.ts +0 -939
  38. package/convex/analytics.ts +0 -187
  39. package/convex/apiKeys.ts +0 -220
  40. package/convex/backfillAnalytics.ts +0 -272
  41. package/convex/backfillSearchLogs.ts +0 -35
  42. package/convex/billing.ts +0 -834
  43. package/convex/capabilities.ts +0 -157
  44. package/convex/chains.ts +0 -1318
  45. package/convex/credits.ts +0 -211
  46. package/convex/crons.ts +0 -50
  47. package/convex/debugFilestackLogs.ts +0 -16
  48. package/convex/debugGetToken.ts +0 -18
  49. package/convex/directCall.ts +0 -713
  50. package/convex/earnProgress.ts +0 -753
  51. package/convex/email.ts +0 -329
  52. package/convex/feedback.ts +0 -265
  53. package/convex/http.ts +0 -3430
  54. package/convex/inbound.ts +0 -32
  55. package/convex/logs.ts +0 -701
  56. package/convex/migrateFilestack.ts +0 -81
  57. package/convex/migratePartnersProd.ts +0 -174
  58. package/convex/migratePratham.ts +0 -126
  59. package/convex/migrateProviderWorkspaces.ts +0 -175
  60. package/convex/mou.ts +0 -91
  61. package/convex/providerKeys.ts +0 -289
  62. package/convex/providers.ts +0 -1135
  63. package/convex/purchases.ts +0 -183
  64. package/convex/ratelimit.ts +0 -104
  65. package/convex/schema.ts +0 -869
  66. package/convex/searchLogs.ts +0 -265
  67. package/convex/seedAPILayerAPIs.ts +0 -191
  68. package/convex/seedDirectCallConfigs.ts +0 -336
  69. package/convex/seedPratham.ts +0 -149
  70. package/convex/spendAlerts.ts +0 -442
  71. package/convex/stripeActions.ts +0 -607
  72. package/convex/teams.ts +0 -243
  73. package/convex/telemetry.ts +0 -81
  74. package/convex/tsconfig.json +0 -25
  75. package/convex/updateAPIStatus.ts +0 -44
  76. package/convex/usage.ts +0 -260
  77. package/convex/usageReports.ts +0 -357
  78. package/convex/waitlist.ts +0 -55
  79. package/convex/webhooks.ts +0 -494
  80. package/convex/workspaceSettings.ts +0 -143
  81. package/convex/workspaces.ts +0 -1331
  82. package/convex.json +0 -3
  83. package/direct-test.mjs +0 -51
  84. package/email-templates/filestack-provider-outreach.html +0 -162
  85. package/email-templates/partnership-template.html +0 -116
  86. package/email-templates/pratham-draft-preview.txt +0 -57
  87. package/email-templates/pratham-partnership-draft.html +0 -141
  88. package/reports/APIClaw-Session-Report-2026-04-05.pdf +0 -0
  89. package/reports/pipeline/PIPELINE-REPORT.json +0 -153
  90. package/reports/pipeline/acquire_apisguru.json +0 -17
  91. package/reports/pipeline/capabilities.json +0 -38
  92. package/reports/pipeline/discover_azure_recursive.json +0 -1551
  93. package/reports/pipeline/discover_github.json +0 -25
  94. package/reports/pipeline/discover_github_repos.json +0 -49
  95. package/reports/pipeline/discover_swaggerhub.json +0 -24
  96. package/reports/pipeline/discover_well_known.json +0 -23
  97. package/reports/pipeline/fetch_specs.json +0 -19
  98. package/reports/pipeline/generate_providers.json +0 -14
  99. package/reports/pipeline/match_registry.json +0 -11
  100. package/reports/pipeline/parse_specs.json +0 -17
  101. package/reports/pipeline/promote_candidates.json +0 -34
  102. package/reports/pipeline/validate.json +0 -30
  103. package/reports/pipeline/validate_smoke_details.json +0 -3835
  104. package/reports/session-report-2026-04-05.html +0 -433
  105. package/seed-apis-direct.mjs +0 -106
  106. package/src/access-control.ts +0 -174
  107. package/src/adapters/base.ts +0 -364
  108. package/src/adapters/claude-desktop.ts +0 -41
  109. package/src/adapters/cline.ts +0 -88
  110. package/src/adapters/continue.ts +0 -91
  111. package/src/adapters/cursor.ts +0 -43
  112. package/src/adapters/custom.ts +0 -188
  113. package/src/adapters/detect.ts +0 -202
  114. package/src/adapters/index.ts +0 -47
  115. package/src/adapters/windsurf.ts +0 -44
  116. package/src/bin-http.ts +0 -45
  117. package/src/bin.ts +0 -34
  118. package/src/capability-router.ts +0 -331
  119. package/src/chainExecutor.ts +0 -730
  120. package/src/chainResolver.test.ts +0 -246
  121. package/src/chainResolver.ts +0 -658
  122. package/src/cli/commands/demo.ts +0 -109
  123. package/src/cli/commands/doctor.ts +0 -435
  124. package/src/cli/commands/index.ts +0 -9
  125. package/src/cli/commands/login.ts +0 -203
  126. package/src/cli/commands/mcp-install.ts +0 -373
  127. package/src/cli/commands/restore.ts +0 -333
  128. package/src/cli/commands/setup.ts +0 -297
  129. package/src/cli/commands/uninstall.ts +0 -240
  130. package/src/cli/index.ts +0 -148
  131. package/src/cli.ts +0 -370
  132. package/src/confirmation.ts +0 -296
  133. package/src/credentials.ts +0 -455
  134. package/src/credits.ts +0 -329
  135. package/src/crypto.ts +0 -75
  136. package/src/discovery.ts +0 -568
  137. package/src/enterprise/env.ts +0 -156
  138. package/src/enterprise/index.ts +0 -7
  139. package/src/enterprise/script-generator.ts +0 -481
  140. package/src/execute-dynamic.ts +0 -617
  141. package/src/execute.ts +0 -2386
  142. package/src/gateway-client.ts +0 -192
  143. package/src/hivr-whitelist.ts +0 -110
  144. package/src/http-api.ts +0 -286
  145. package/src/http-server-minimal.ts +0 -154
  146. package/src/index.ts +0 -2611
  147. package/src/intelligent-gateway.ts +0 -339
  148. package/src/mcp-analytics.ts +0 -156
  149. package/src/metered.ts +0 -149
  150. package/src/open-apis-generated.ts +0 -157
  151. package/src/open-apis.ts +0 -558
  152. package/src/postinstall.ts +0 -18
  153. package/src/product-whitelist.ts +0 -246
  154. package/src/proxy.ts +0 -36
  155. package/src/session.ts +0 -129
  156. package/src/stripe.ts +0 -497
  157. package/src/telemetry.ts +0 -71
  158. package/src/test.ts +0 -135
  159. package/src/types/convex-api.d.ts +0 -20
  160. package/src/types/convex-api.ts +0 -21
  161. package/src/types.ts +0 -109
  162. package/src/ui/colors.ts +0 -219
  163. package/src/ui/errors.ts +0 -394
  164. package/src/ui/index.ts +0 -17
  165. package/src/ui/prompts.ts +0 -390
  166. package/src/ui/spinner.ts +0 -325
  167. package/src/utils/backup.ts +0 -224
  168. package/src/utils/config.ts +0 -318
  169. package/src/utils/os.ts +0 -124
  170. package/src/utils/paths.ts +0 -203
  171. package/src/webhook.ts +0 -107
  172. package/test-10-working.cjs +0 -97
  173. package/test-14-final.cjs +0 -96
  174. package/test-actual-handlers.ts +0 -92
  175. package/test-apilayer-all-14.ts +0 -249
  176. package/test-apilayer-fixed.ts +0 -248
  177. package/test-direct-endpoints.ts +0 -174
  178. package/test-exact-endpoints.ts +0 -144
  179. package/test-final.ts +0 -83
  180. package/test-full-routing.ts +0 -100
  181. package/test-handlers-correct.ts +0 -217
  182. package/test-numverify-key.ts +0 -41
  183. package/test-via-handlers.ts +0 -92
  184. package/test-worldnews.mjs +0 -26
  185. package/tsconfig.json +0 -20
@@ -1,174 +0,0 @@
1
- /**
2
- * Access Control System
3
- * Controls which products/agents can access which providers
4
- *
5
- * Rules format:
6
- * - Wildcard: "hivr:*" = all Hivr agents
7
- * - Specific: "hivr:bytebee" = only ByteBee
8
- * - Product-level: "nordsym:*" = all NordSym agents
9
- *
10
- * Provider wildcards:
11
- * - "*" = all providers
12
- * - "brave_*" = all Brave providers
13
- * - Specific: ["brave_search", "groq"]
14
- */
15
-
16
- interface AccessRule {
17
- agentPattern: string;
18
- allowedProviders: string[];
19
- description?: string;
20
- }
21
-
22
- // Default access rules
23
- // These can be moved to Convex table for dynamic updates
24
- const DEFAULT_RULES: AccessRule[] = [
25
- {
26
- agentPattern: 'hivr:*',
27
- allowedProviders: ['*'], // Hivr gets everything
28
- description: 'All Hivr bees get full access',
29
- },
30
- {
31
- agentPattern: 'nordsym:*',
32
- allowedProviders: ['brave_search', 'groq', 'replicate'],
33
- description: 'NordSym team gets selected providers',
34
- },
35
- // Add more rules as needed
36
- ];
37
-
38
- // Cache for compiled rules
39
- let compiledRules: {
40
- pattern: RegExp;
41
- providers: string[];
42
- }[] | null = null;
43
-
44
- /**
45
- * Compile agentPattern to RegExp
46
- */
47
- function compilePattern(pattern: string): RegExp {
48
- // Convert wildcard pattern to regex
49
- // "hivr:*" → /^hivr:.+$/
50
- // "hivr:byte*" → /^hivr:byte.+$/
51
- const escaped = pattern
52
- .replace(/[.+^${}()|[\]\\]/g, '\\$&') // Escape regex chars
53
- .replace(/\*/g, '.+'); // Replace * with .+
54
-
55
- return new RegExp(`^${escaped}$`, 'i');
56
- }
57
-
58
- /**
59
- * Compile all rules (cache for performance)
60
- */
61
- function compileRules(): void {
62
- compiledRules = DEFAULT_RULES.map(rule => ({
63
- pattern: compilePattern(rule.agentPattern),
64
- providers: rule.allowedProviders,
65
- }));
66
- }
67
-
68
- /**
69
- * Check if provider matches pattern
70
- */
71
- function matchesProvider(provider: string, pattern: string): boolean {
72
- if (pattern === '*') return true;
73
- if (pattern.endsWith('*')) {
74
- const prefix = pattern.slice(0, -1);
75
- return provider.startsWith(prefix);
76
- }
77
- return provider === pattern;
78
- }
79
-
80
- /**
81
- * Check if agentId is allowed to access provider
82
- */
83
- export function canAccessProvider(agentId: string, provider: string): boolean {
84
- if (!compiledRules) {
85
- compileRules();
86
- }
87
-
88
- const normalized = agentId.toLowerCase().trim();
89
- const normalizedProvider = provider.toLowerCase().trim();
90
-
91
- // Find matching rule
92
- for (const rule of compiledRules!) {
93
- if (rule.pattern.test(normalized)) {
94
- // Check if provider is allowed
95
- for (const providerPattern of rule.providers) {
96
- if (matchesProvider(normalizedProvider, providerPattern)) {
97
- return true;
98
- }
99
- }
100
- // Rule matched but provider not in allowlist
101
- return false;
102
- }
103
- }
104
-
105
- // No rule matched = deny by default
106
- console.warn(`[Access Control] No rule for ${normalized}`);
107
- return false;
108
- }
109
-
110
- /**
111
- * Get allowed providers for agentId
112
- */
113
- export function getAllowedProviders(agentId: string): string[] {
114
- if (!compiledRules) {
115
- compileRules();
116
- }
117
-
118
- const normalized = agentId.toLowerCase().trim();
119
-
120
- // Find matching rule
121
- for (const rule of compiledRules!) {
122
- if (rule.pattern.test(normalized)) {
123
- return rule.providers;
124
- }
125
- }
126
-
127
- return [];
128
- }
129
-
130
- /**
131
- * Add new access rule (runtime)
132
- */
133
- export function addAccessRule(rule: AccessRule): void {
134
- DEFAULT_RULES.push(rule);
135
- compiledRules = null; // Force recompile
136
- console.log(`[Access Control] Added rule for ${rule.agentPattern}`);
137
- }
138
-
139
- /**
140
- * Get all access rules (for debugging/admin)
141
- */
142
- export function getAccessRules(): AccessRule[] {
143
- return [...DEFAULT_RULES];
144
- }
145
-
146
- /**
147
- * Check if agentId + provider combination is allowed
148
- * Combines whitelist check + access control
149
- */
150
- export async function isAllowed(
151
- agentId: string | undefined,
152
- provider: string
153
- ): Promise<{ allowed: boolean; reason?: string }> {
154
- if (!agentId) {
155
- return { allowed: false, reason: 'No agentId provided' };
156
- }
157
-
158
- // First check: Is agent whitelisted?
159
- const { isAuthorized } = await import('./product-whitelist.js');
160
- const whitelisted = await isAuthorized(agentId);
161
-
162
- if (!whitelisted) {
163
- return { allowed: false, reason: 'Agent not whitelisted' };
164
- }
165
-
166
- // Second check: Does agent have access to this provider?
167
- const hasAccess = canAccessProvider(agentId, provider);
168
-
169
- if (!hasAccess) {
170
- return { allowed: false, reason: 'Provider not in access list' };
171
- }
172
-
173
- return { allowed: true };
174
- }
@@ -1,364 +0,0 @@
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
- clientName: this.name === 'custom' ? undefined : this.name,
203
- };
204
-
205
- const newConfig = this.mergeConfig(config, mergeOptions);
206
-
207
- // Write config
208
- const writeResult = writeConfig(configPath, newConfig);
209
- if (!writeResult.success) {
210
- return {
211
- success: false,
212
- message: `Failed to write config: ${writeResult.error}`,
213
- configPath,
214
- error: writeResult.error,
215
- };
216
- }
217
-
218
- return {
219
- success: true,
220
- message: `Successfully configured APIClaw in ${this.displayName}`,
221
- configPath,
222
- backupPath: writeResult.backupPath,
223
- isNew: readResult.isNew,
224
- };
225
- } catch (error) {
226
- return {
227
- success: false,
228
- message: `Configuration failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
229
- configPath,
230
- error: error instanceof Error ? error.message : 'Unknown error',
231
- };
232
- }
233
- }
234
-
235
- /**
236
- * Merge APIClaw config into existing config
237
- * Override in subclasses for special formats (e.g., Continue)
238
- */
239
- protected mergeConfig(
240
- config: MCPConfig | ContinueConfig,
241
- options: { workspace?: string; serverName?: string; force?: boolean }
242
- ): MCPConfig | ContinueConfig {
243
- return mergeApiclawConfig(config as MCPConfig, options);
244
- }
245
-
246
- /**
247
- * Verify the current configuration
248
- */
249
- async verify(): Promise<VerifyResult> {
250
- const configPath = this.getConfigPath();
251
-
252
- if (!this.configExists()) {
253
- return {
254
- success: false,
255
- hasConfig: false,
256
- configValid: false,
257
- message: `Config file not found: ${configPath}`,
258
- };
259
- }
260
-
261
- const readResult = readConfig(configPath);
262
- if (!readResult.success) {
263
- return {
264
- success: false,
265
- hasConfig: true,
266
- configValid: false,
267
- message: `Invalid config file: ${readResult.error}`,
268
- };
269
- }
270
-
271
- const hasApiclaw = hasApiclawConfig(readResult.config!);
272
-
273
- return {
274
- success: hasApiclaw,
275
- hasConfig: true,
276
- configValid: true,
277
- message: hasApiclaw
278
- ? `APIClaw is configured in ${this.displayName}`
279
- : `APIClaw is not configured in ${this.displayName}`,
280
- };
281
- }
282
-
283
- /**
284
- * Remove APIClaw configuration
285
- */
286
- async unconfigure(serverName = 'apiclaw'): Promise<ConfigResult> {
287
- const configPath = this.getConfigPath();
288
-
289
- try {
290
- if (!this.configExists()) {
291
- return {
292
- success: true,
293
- message: `No config file found for ${this.displayName}`,
294
- configPath,
295
- };
296
- }
297
-
298
- const readResult = readConfig(configPath);
299
- if (!readResult.success) {
300
- return {
301
- success: false,
302
- message: `Failed to read config: ${readResult.error}`,
303
- configPath,
304
- error: readResult.error,
305
- };
306
- }
307
-
308
- const config = readResult.config!;
309
-
310
- if (!hasApiclawConfig(config, serverName)) {
311
- return {
312
- success: true,
313
- message: `APIClaw not found in ${this.displayName} config`,
314
- configPath,
315
- };
316
- }
317
-
318
- // Remove APIClaw config
319
- const newConfig = this.removeFromConfig(config, serverName);
320
-
321
- // Write config
322
- const writeResult = writeConfig(configPath, newConfig);
323
- if (!writeResult.success) {
324
- return {
325
- success: false,
326
- message: `Failed to write config: ${writeResult.error}`,
327
- configPath,
328
- error: writeResult.error,
329
- };
330
- }
331
-
332
- return {
333
- success: true,
334
- message: `Successfully removed APIClaw from ${this.displayName}`,
335
- configPath,
336
- backupPath: writeResult.backupPath,
337
- };
338
- } catch (error) {
339
- return {
340
- success: false,
341
- message: `Unconfigure failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
342
- configPath,
343
- error: error instanceof Error ? error.message : 'Unknown error',
344
- };
345
- }
346
- }
347
-
348
- /**
349
- * Remove APIClaw from config
350
- * Override in subclasses for special formats
351
- */
352
- protected removeFromConfig(
353
- config: MCPConfig | ContinueConfig,
354
- serverName: string
355
- ): MCPConfig | ContinueConfig {
356
- const mcpConfig = config as MCPConfig;
357
- const { [serverName]: _, ...remainingServers } = mcpConfig.mcpServers || {};
358
-
359
- return {
360
- ...mcpConfig,
361
- mcpServers: remainingServers,
362
- };
363
- }
364
- }
@@ -1,41 +0,0 @@
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
- }
@@ -1,88 +0,0 @@
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
- }