@nordsym/apiclaw 1.3.7 → 1.3.8

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 (189) hide show
  1. package/README.md +420 -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/restore.d.ts +50 -0
  59. package/dist/cli/commands/restore.d.ts.map +1 -0
  60. package/dist/cli/commands/restore.js +260 -0
  61. package/dist/cli/commands/restore.js.map +1 -0
  62. package/dist/cli/commands/setup.d.ts +19 -0
  63. package/dist/cli/commands/setup.d.ts.map +1 -0
  64. package/dist/cli/commands/setup.js +206 -0
  65. package/dist/cli/commands/setup.js.map +1 -0
  66. package/dist/cli/commands/uninstall.d.ts +37 -0
  67. package/dist/cli/commands/uninstall.d.ts.map +1 -0
  68. package/dist/cli/commands/uninstall.js +189 -0
  69. package/dist/cli/commands/uninstall.js.map +1 -0
  70. package/dist/cli/index.d.ts +7 -0
  71. package/dist/cli/index.d.ts.map +1 -0
  72. package/dist/cli/index.js +97 -0
  73. package/dist/cli/index.js.map +1 -0
  74. package/dist/discovery.d.ts +6 -2
  75. package/dist/discovery.d.ts.map +1 -1
  76. package/dist/discovery.js +296 -2
  77. package/dist/discovery.js.map +1 -1
  78. package/dist/enterprise/env.d.ts +56 -0
  79. package/dist/enterprise/env.d.ts.map +1 -0
  80. package/dist/enterprise/env.js +124 -0
  81. package/dist/enterprise/env.js.map +1 -0
  82. package/dist/enterprise/index.d.ts +7 -0
  83. package/dist/enterprise/index.d.ts.map +1 -0
  84. package/dist/enterprise/index.js +7 -0
  85. package/dist/enterprise/index.js.map +1 -0
  86. package/dist/enterprise/script-generator.d.ts +32 -0
  87. package/dist/enterprise/script-generator.d.ts.map +1 -0
  88. package/dist/enterprise/script-generator.js +461 -0
  89. package/dist/enterprise/script-generator.js.map +1 -0
  90. package/dist/execute.d.ts +21 -0
  91. package/dist/execute.d.ts.map +1 -1
  92. package/dist/execute.js +231 -0
  93. package/dist/execute.js.map +1 -1
  94. package/dist/index.js +79 -7
  95. package/dist/index.js.map +1 -1
  96. package/dist/stripe.d.ts +1 -1
  97. package/dist/stripe.js +1 -1
  98. package/dist/stripe.js.map +1 -1
  99. package/dist/types.d.ts +29 -0
  100. package/dist/types.d.ts.map +1 -1
  101. package/dist/ui/colors.d.ts +111 -0
  102. package/dist/ui/colors.d.ts.map +1 -0
  103. package/dist/ui/colors.js +185 -0
  104. package/dist/ui/colors.js.map +1 -0
  105. package/dist/ui/errors.d.ts +69 -0
  106. package/dist/ui/errors.d.ts.map +1 -0
  107. package/dist/ui/errors.js +334 -0
  108. package/dist/ui/errors.js.map +1 -0
  109. package/dist/ui/index.d.ts +10 -0
  110. package/dist/ui/index.d.ts.map +1 -0
  111. package/dist/ui/index.js +14 -0
  112. package/dist/ui/index.js.map +1 -0
  113. package/dist/ui/prompts.d.ts +88 -0
  114. package/dist/ui/prompts.d.ts.map +1 -0
  115. package/dist/ui/prompts.js +295 -0
  116. package/dist/ui/prompts.js.map +1 -0
  117. package/dist/ui/spinner.d.ts +112 -0
  118. package/dist/ui/spinner.d.ts.map +1 -0
  119. package/dist/ui/spinner.js +229 -0
  120. package/dist/ui/spinner.js.map +1 -0
  121. package/dist/utils/backup.d.ts +48 -0
  122. package/dist/utils/backup.d.ts.map +1 -0
  123. package/dist/utils/backup.js +182 -0
  124. package/dist/utils/backup.js.map +1 -0
  125. package/dist/utils/config.d.ts +80 -0
  126. package/dist/utils/config.d.ts.map +1 -0
  127. package/dist/utils/config.js +221 -0
  128. package/dist/utils/config.js.map +1 -0
  129. package/dist/utils/os.d.ts +45 -0
  130. package/dist/utils/os.d.ts.map +1 -0
  131. package/dist/utils/os.js +106 -0
  132. package/dist/utils/os.js.map +1 -0
  133. package/dist/utils/paths.d.ts +38 -0
  134. package/dist/utils/paths.d.ts.map +1 -0
  135. package/dist/utils/paths.js +160 -0
  136. package/dist/utils/paths.js.map +1 -0
  137. package/docs/PRD-BILLING.md +226 -0
  138. package/docs/PRD-EARN-SYSTEM.md +261 -0
  139. package/docs/PRD-MCP-AUTO-SETUP.md +623 -0
  140. package/docs/enterprise-deployment.md +728 -0
  141. package/landing/next.config.mjs +14 -0
  142. package/landing/public/stats.json +4 -2
  143. package/landing/scripts/generate-stats.js +12 -0
  144. package/landing/src/app/api/workspace-auth/magic-link/route.ts +6 -3
  145. package/landing/src/app/auth/verify/page.tsx +11 -4
  146. package/landing/src/app/docs/page.tsx +1 -1
  147. package/landing/src/app/join/page.tsx +49 -0
  148. package/landing/src/app/login/page.tsx +7 -1
  149. package/landing/src/app/page.tsx +13 -28
  150. package/landing/src/app/providers/register/page.tsx +1 -1
  151. package/landing/src/app/workspace/page.tsx +483 -710
  152. package/landing/src/components/CheckoutButton.tsx +1 -1
  153. package/landing/src/components/EarnCreditsTab.tsx +842 -0
  154. package/landing/src/lib/stats.json +3 -1
  155. package/package.json +9 -2
  156. package/src/adapters/base.ts +363 -0
  157. package/src/adapters/claude-desktop.ts +41 -0
  158. package/src/adapters/cline.ts +88 -0
  159. package/src/adapters/continue.ts +91 -0
  160. package/src/adapters/cursor.ts +43 -0
  161. package/src/adapters/custom.ts +188 -0
  162. package/src/adapters/detect.ts +202 -0
  163. package/src/adapters/index.ts +47 -0
  164. package/src/adapters/windsurf.ts +44 -0
  165. package/src/bin.ts +19 -0
  166. package/src/cli/commands/doctor.ts +367 -0
  167. package/src/cli/commands/index.ts +9 -0
  168. package/src/cli/commands/restore.ts +333 -0
  169. package/src/cli/commands/setup.ts +276 -0
  170. package/src/cli/commands/uninstall.ts +240 -0
  171. package/src/cli/index.ts +107 -0
  172. package/src/discovery.ts +328 -3
  173. package/src/enterprise/env.ts +156 -0
  174. package/src/enterprise/index.ts +7 -0
  175. package/src/enterprise/script-generator.ts +481 -0
  176. package/src/execute.ts +256 -0
  177. package/src/index.ts +85 -7
  178. package/src/stripe.ts +1 -1
  179. package/src/types.ts +32 -0
  180. package/src/ui/colors.ts +219 -0
  181. package/src/ui/errors.ts +394 -0
  182. package/src/ui/index.ts +17 -0
  183. package/src/ui/prompts.ts +390 -0
  184. package/src/ui/spinner.ts +325 -0
  185. package/src/utils/backup.ts +224 -0
  186. package/src/utils/config.ts +315 -0
  187. package/src/utils/os.ts +124 -0
  188. package/src/utils/paths.ts +203 -0
  189. package/landing/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Custom Adapter
3
+ * Handles MCP configuration for user-specified config paths
4
+ */
5
+
6
+ import { existsSync } from 'fs';
7
+ import { dirname, basename } from 'path';
8
+ import { BaseAdapter, ConfigureOptions, ConfigResult, VerifyResult, InstallInfo } from './base.js';
9
+ import { expandHome } from '../utils/os.js';
10
+ import {
11
+ readConfig,
12
+ writeConfig,
13
+ mergeApiclawConfig,
14
+ mergeApiclawContinueConfig,
15
+ hasApiclawConfig,
16
+ isContinueFormat,
17
+ MCPConfig,
18
+ ContinueConfig,
19
+ } from '../utils/config.js';
20
+
21
+ export interface CustomAdapterOptions {
22
+ configPath: string;
23
+ displayName?: string;
24
+ useContinueFormat?: boolean;
25
+ }
26
+
27
+ export class CustomAdapter extends BaseAdapter {
28
+ name: 'custom' = 'custom';
29
+ displayName: string;
30
+
31
+ private customConfigPath: string;
32
+ private useContinueFormat: boolean;
33
+
34
+ constructor(options: CustomAdapterOptions) {
35
+ super();
36
+ this.customConfigPath = expandHome(options.configPath);
37
+ this.displayName = options.displayName || `Custom (${basename(this.customConfigPath)})`;
38
+ this.useContinueFormat = options.useContinueFormat || false;
39
+ }
40
+
41
+ /**
42
+ * Override getConfigPath to use custom path
43
+ */
44
+ getConfigPath(): string {
45
+ return this.customConfigPath;
46
+ }
47
+
48
+ /**
49
+ * No app paths for custom adapter
50
+ */
51
+ protected getAppPaths(): string[] {
52
+ return [];
53
+ }
54
+
55
+ /**
56
+ * Custom adapter is "installed" if the path is valid
57
+ */
58
+ async isInstalled(): Promise<boolean> {
59
+ // Check if the directory exists or config file exists
60
+ const configDir = dirname(this.customConfigPath);
61
+ return existsSync(configDir) || existsSync(this.customConfigPath);
62
+ }
63
+
64
+ /**
65
+ * Get installation info
66
+ */
67
+ async getInstallInfo(): Promise<InstallInfo> {
68
+ const configExists = existsSync(this.customConfigPath);
69
+ const dirExists = existsSync(dirname(this.customConfigPath));
70
+
71
+ return {
72
+ installed: dirExists,
73
+ configExists,
74
+ configPath: this.customConfigPath,
75
+ };
76
+ }
77
+
78
+ /**
79
+ * Configure with auto-detection of format
80
+ */
81
+ async configure(options: ConfigureOptions = {}): Promise<ConfigResult> {
82
+ const configPath = this.getConfigPath();
83
+
84
+ try {
85
+ // Read existing config
86
+ const readResult = readConfig(configPath);
87
+ if (!readResult.success) {
88
+ return {
89
+ success: false,
90
+ message: `Failed to read config: ${readResult.error}`,
91
+ configPath,
92
+ error: readResult.error,
93
+ };
94
+ }
95
+
96
+ const config = readResult.config!;
97
+ const serverName = options.serverName || 'apiclaw';
98
+
99
+ // Check if already configured
100
+ if (!options.force && hasApiclawConfig(config, serverName)) {
101
+ return {
102
+ success: true,
103
+ message: `APIClaw already configured in ${this.displayName}`,
104
+ configPath,
105
+ alreadyConfigured: true,
106
+ };
107
+ }
108
+
109
+ // Auto-detect format or use specified
110
+ const useContinue = this.useContinueFormat || isContinueFormat(config);
111
+
112
+ const mergeOptions = {
113
+ workspace: options.workspaceId,
114
+ serverName,
115
+ force: options.force,
116
+ };
117
+
118
+ const newConfig = useContinue
119
+ ? mergeApiclawContinueConfig(config as ContinueConfig, mergeOptions)
120
+ : mergeApiclawConfig(config as MCPConfig, mergeOptions);
121
+
122
+ // Write config
123
+ const writeResult = writeConfig(configPath, newConfig);
124
+ if (!writeResult.success) {
125
+ return {
126
+ success: false,
127
+ message: `Failed to write config: ${writeResult.error}`,
128
+ configPath,
129
+ error: writeResult.error,
130
+ };
131
+ }
132
+
133
+ return {
134
+ success: true,
135
+ message: `Successfully configured APIClaw in ${this.displayName}`,
136
+ configPath,
137
+ backupPath: writeResult.backupPath,
138
+ isNew: readResult.isNew,
139
+ };
140
+ } catch (error) {
141
+ return {
142
+ success: false,
143
+ message: `Configuration failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
144
+ configPath,
145
+ error: error instanceof Error ? error.message : 'Unknown error',
146
+ };
147
+ }
148
+ }
149
+
150
+ /**
151
+ * Override removeFromConfig with format auto-detection
152
+ */
153
+ protected removeFromConfig(
154
+ config: MCPConfig | ContinueConfig,
155
+ serverName: string
156
+ ): MCPConfig | ContinueConfig {
157
+ if (this.useContinueFormat || isContinueFormat(config)) {
158
+ const continueConfig = config as ContinueConfig;
159
+ return {
160
+ ...continueConfig,
161
+ mcpServers: continueConfig.mcpServers?.filter(s => s.name !== serverName) || [],
162
+ };
163
+ }
164
+
165
+ const mcpConfig = config as MCPConfig;
166
+ const { [serverName]: _, ...remainingServers } = mcpConfig.mcpServers || {};
167
+
168
+ return {
169
+ ...mcpConfig,
170
+ mcpServers: remainingServers,
171
+ };
172
+ }
173
+ }
174
+
175
+ /**
176
+ * Create a custom adapter for a specific path
177
+ */
178
+ export function createCustomAdapter(
179
+ configPath: string,
180
+ displayName?: string,
181
+ useContinueFormat?: boolean
182
+ ): CustomAdapter {
183
+ return new CustomAdapter({
184
+ configPath,
185
+ displayName,
186
+ useContinueFormat,
187
+ });
188
+ }
@@ -0,0 +1,202 @@
1
+ /**
2
+ * Client Detection
3
+ * Auto-detect which MCP clients are installed on the system
4
+ */
5
+
6
+ import { MCPClientAdapter, InstallInfo } from './base.js';
7
+ import { ClaudeDesktopAdapter } from './claude-desktop.js';
8
+ import { CursorAdapter } from './cursor.js';
9
+ import { WindsurfAdapter } from './windsurf.js';
10
+ import { ClineAdapter } from './cline.js';
11
+ import { ContinueAdapter } from './continue.js';
12
+ import { MCPClient } from '../utils/paths.js';
13
+
14
+ export interface DetectedClient {
15
+ adapter: MCPClientAdapter;
16
+ info: InstallInfo;
17
+ }
18
+
19
+ export interface DetectionResult {
20
+ installed: DetectedClient[];
21
+ notInstalled: MCPClientAdapter[];
22
+ total: number;
23
+ installedCount: number;
24
+ }
25
+
26
+ /**
27
+ * Get all available adapters
28
+ */
29
+ export function getAllAdapters(): MCPClientAdapter[] {
30
+ return [
31
+ new ClaudeDesktopAdapter(),
32
+ new CursorAdapter(),
33
+ new WindsurfAdapter(),
34
+ new ClineAdapter(),
35
+ new ContinueAdapter(),
36
+ ];
37
+ }
38
+
39
+ /**
40
+ * Get adapter by client name
41
+ */
42
+ export function getAdapter(client: MCPClient): MCPClientAdapter {
43
+ switch (client) {
44
+ case 'claude-desktop':
45
+ return new ClaudeDesktopAdapter();
46
+ case 'cursor':
47
+ return new CursorAdapter();
48
+ case 'windsurf':
49
+ return new WindsurfAdapter();
50
+ case 'cline':
51
+ return new ClineAdapter();
52
+ case 'continue':
53
+ return new ContinueAdapter();
54
+ default:
55
+ throw new Error(`Unknown client: ${client}`);
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Detect all installed MCP clients
61
+ */
62
+ export async function detectInstalledClients(): Promise<DetectionResult> {
63
+ const adapters = getAllAdapters();
64
+ const installed: DetectedClient[] = [];
65
+ const notInstalled: MCPClientAdapter[] = [];
66
+
67
+ await Promise.all(
68
+ adapters.map(async (adapter) => {
69
+ try {
70
+ const isInstalled = await adapter.isInstalled();
71
+ if (isInstalled) {
72
+ const info = await adapter.getInstallInfo();
73
+ installed.push({ adapter, info });
74
+ } else {
75
+ notInstalled.push(adapter);
76
+ }
77
+ } catch {
78
+ // If detection fails, assume not installed
79
+ notInstalled.push(adapter);
80
+ }
81
+ })
82
+ );
83
+
84
+ // Sort installed clients by name for consistent output
85
+ installed.sort((a, b) => a.adapter.displayName.localeCompare(b.adapter.displayName));
86
+ notInstalled.sort((a, b) => a.displayName.localeCompare(b.displayName));
87
+
88
+ return {
89
+ installed,
90
+ notInstalled,
91
+ total: adapters.length,
92
+ installedCount: installed.length,
93
+ };
94
+ }
95
+
96
+ /**
97
+ * Detect clients that already have APIClaw configured
98
+ */
99
+ export async function detectConfiguredClients(): Promise<{
100
+ configured: DetectedClient[];
101
+ notConfigured: DetectedClient[];
102
+ }> {
103
+ const detection = await detectInstalledClients();
104
+ const configured: DetectedClient[] = [];
105
+ const notConfigured: DetectedClient[] = [];
106
+
107
+ for (const client of detection.installed) {
108
+ const verification = await client.adapter.verify();
109
+ if (verification.success) {
110
+ configured.push(client);
111
+ } else {
112
+ notConfigured.push(client);
113
+ }
114
+ }
115
+
116
+ return { configured, notConfigured };
117
+ }
118
+
119
+ /**
120
+ * Quick check: is any MCP client installed?
121
+ */
122
+ export async function hasAnyClient(): Promise<boolean> {
123
+ const adapters = getAllAdapters();
124
+
125
+ for (const adapter of adapters) {
126
+ if (await adapter.isInstalled()) {
127
+ return true;
128
+ }
129
+ }
130
+
131
+ return false;
132
+ }
133
+
134
+ /**
135
+ * Quick check: is a specific client installed?
136
+ */
137
+ export async function isClientInstalled(client: MCPClient): Promise<boolean> {
138
+ const adapter = getAdapter(client);
139
+ return adapter.isInstalled();
140
+ }
141
+
142
+ /**
143
+ * Get installation summary as string (for CLI output)
144
+ */
145
+ export function formatDetectionResult(result: DetectionResult): string {
146
+ const lines: string[] = [];
147
+
148
+ lines.push(`Found ${result.installedCount}/${result.total} MCP clients installed:\n`);
149
+
150
+ if (result.installed.length > 0) {
151
+ lines.push('✅ Installed:');
152
+ for (const client of result.installed) {
153
+ const configStatus = client.info.configExists ? '(config exists)' : '(no config)';
154
+ lines.push(` • ${client.adapter.displayName} ${configStatus}`);
155
+ lines.push(` Path: ${client.info.configPath}`);
156
+ }
157
+ }
158
+
159
+ if (result.notInstalled.length > 0) {
160
+ lines.push('\n❌ Not installed:');
161
+ for (const adapter of result.notInstalled) {
162
+ lines.push(` • ${adapter.displayName}`);
163
+ }
164
+ }
165
+
166
+ return lines.join('\n');
167
+ }
168
+
169
+ /**
170
+ * Get simple list of installed client names
171
+ */
172
+ export async function getInstalledClientNames(): Promise<string[]> {
173
+ const result = await detectInstalledClients();
174
+ return result.installed.map(c => c.adapter.name);
175
+ }
176
+
177
+ /**
178
+ * Configure all detected clients
179
+ */
180
+ export async function configureAllDetected(options?: {
181
+ workspaceId?: string;
182
+ serverName?: string;
183
+ force?: boolean;
184
+ }): Promise<{
185
+ success: { adapter: MCPClientAdapter; result: Awaited<ReturnType<MCPClientAdapter['configure']>> }[];
186
+ failed: { adapter: MCPClientAdapter; result: Awaited<ReturnType<MCPClientAdapter['configure']>> }[];
187
+ }> {
188
+ const detection = await detectInstalledClients();
189
+ const success: { adapter: MCPClientAdapter; result: Awaited<ReturnType<MCPClientAdapter['configure']>> }[] = [];
190
+ const failed: { adapter: MCPClientAdapter; result: Awaited<ReturnType<MCPClientAdapter['configure']>> }[] = [];
191
+
192
+ for (const client of detection.installed) {
193
+ const result = await client.adapter.configure(options);
194
+ if (result.success) {
195
+ success.push({ adapter: client.adapter, result });
196
+ } else {
197
+ failed.push({ adapter: client.adapter, result });
198
+ }
199
+ }
200
+
201
+ return { success, failed };
202
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * MCP Client Adapters - Main Export
3
+ *
4
+ * Provides adapters for all supported MCP clients:
5
+ * - Claude Desktop
6
+ * - Cursor
7
+ * - Windsurf
8
+ * - Cline (VS Code extension)
9
+ * - Continue (VS Code extension)
10
+ * - Custom (user-specified paths)
11
+ */
12
+
13
+ // Base types and classes
14
+ export {
15
+ MCPClientAdapter,
16
+ BaseAdapter,
17
+ ConfigResult,
18
+ VerifyResult,
19
+ InstallInfo,
20
+ ConfigureOptions,
21
+ } from './base.js';
22
+
23
+ // Individual adapters
24
+ export { ClaudeDesktopAdapter } from './claude-desktop.js';
25
+ export { CursorAdapter } from './cursor.js';
26
+ export { WindsurfAdapter } from './windsurf.js';
27
+ export { ClineAdapter } from './cline.js';
28
+ export { ContinueAdapter } from './continue.js';
29
+ export { CustomAdapter, createCustomAdapter, CustomAdapterOptions } from './custom.js';
30
+
31
+ // Detection utilities
32
+ export {
33
+ getAllAdapters,
34
+ getAdapter,
35
+ detectInstalledClients,
36
+ detectConfiguredClients,
37
+ hasAnyClient,
38
+ isClientInstalled,
39
+ formatDetectionResult,
40
+ getInstalledClientNames,
41
+ configureAllDetected,
42
+ DetectedClient,
43
+ DetectionResult,
44
+ } from './detect.js';
45
+
46
+ // Re-export types from paths for convenience
47
+ export { MCPClient } from '../utils/paths.js';
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Windsurf Adapter
3
+ * Handles MCP configuration for Windsurf (Codeium) 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 WindsurfAdapter extends BaseAdapter {
12
+ name: MCPClient = 'windsurf';
13
+ displayName = 'Windsurf';
14
+
15
+ protected getAppPaths(): string[] {
16
+ switch (this.os) {
17
+ case 'mac':
18
+ return [
19
+ '/Applications/Windsurf.app',
20
+ join(getHomeDir(), 'Applications', 'Windsurf.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', 'Windsurf', 'Windsurf.exe'),
28
+ join(programFiles, 'Windsurf', 'Windsurf.exe'),
29
+ join(programFiles, 'Codeium', 'Windsurf', 'Windsurf.exe'),
30
+ ];
31
+
32
+ case 'linux':
33
+ return [
34
+ '/usr/bin/windsurf',
35
+ '/usr/local/bin/windsurf',
36
+ join(getHomeDir(), '.local', 'bin', 'windsurf'),
37
+ '/opt/Windsurf/windsurf',
38
+ '/snap/bin/windsurf',
39
+ // AppImage
40
+ join(getHomeDir(), 'Applications', 'Windsurf.AppImage'),
41
+ ];
42
+ }
43
+ }
44
+ }
package/src/bin.ts ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * APIClaw Entry Point
4
+ *
5
+ * - No args or MCP-related args → Run MCP server
6
+ * - setup/doctor/restore/uninstall → Run CLI
7
+ */
8
+
9
+ const cliCommands = ['setup', 'doctor', 'restore', 'uninstall', 'help', '--help', '-h', '--version', '-V'];
10
+
11
+ const firstArg = process.argv[2];
12
+
13
+ if (!firstArg || !cliCommands.includes(firstArg)) {
14
+ // Run MCP server
15
+ import('./index.js');
16
+ } else {
17
+ // Run CLI
18
+ import('./cli/index.js');
19
+ }