@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,91 +0,0 @@
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
- }
@@ -1,43 +0,0 @@
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
- }
@@ -1,188 +0,0 @@
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
- }
@@ -1,202 +0,0 @@
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
- }
@@ -1,47 +0,0 @@
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';
@@ -1,44 +0,0 @@
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-http.ts DELETED
@@ -1,45 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * APIClaw HTTP API Server - Standalone executable
4
- * Usage: apiclaw-http [--port 3000]
5
- */
6
-
7
- import { startHTTPServer } from './http-api.js';
8
-
9
- const args = process.argv.slice(2);
10
- let port = 3000;
11
-
12
- // Parse args
13
- for (let i = 0; i < args.length; i++) {
14
- if (args[i] === '--port' || args[i] === '-p') {
15
- port = parseInt(args[i + 1] || '3000');
16
- i++;
17
- } else if (args[i] === '--help' || args[i] === '-h') {
18
- console.log(`
19
- 🦞 APIClaw HTTP API Server
20
-
21
- Usage:
22
- apiclaw-http [options]
23
-
24
- Options:
25
- --port, -p <port> Port to listen on (default: 3000)
26
- --help, -h Show this help
27
-
28
- Examples:
29
- apiclaw-http
30
- apiclaw-http --port 8080
31
-
32
- Endpoints:
33
- GET /api/discover?query=...&agentId=...
34
- POST /api/call_api
35
- Body: { provider, action, params, agentId }
36
- GET /health
37
-
38
- Auth:
39
- Whitelist-based for Hivr bees. Contact admin@nordsym.com for access.
40
- `);
41
- process.exit(0);
42
- }
43
- }
44
-
45
- startHTTPServer(port);
package/src/bin.ts DELETED
@@ -1,34 +0,0 @@
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
- import { existsSync } from 'fs';
10
- import { join } from 'path';
11
-
12
- const cliCommands = ['setup', 'login', 'demo', 'mcp-install', 'mcp-uninstall', 'doctor', 'restore', 'uninstall', 'help', '--help', '-h', '--version', '-V'];
13
-
14
- const firstArg = process.argv[2];
15
-
16
- if (!firstArg || !cliCommands.includes(firstArg)) {
17
- // First-run nudge: non-blocking hint if no workspace is configured
18
- try {
19
- const sessionFile = join(process.env.HOME ?? '~', '.apiclaw', 'session');
20
- if (!existsSync(sessionFile)) {
21
- process.stderr.write(
22
- '\x1b[33m💡 No workspace linked. Run: npx @nordsym/apiclaw login\x1b[0m\n'
23
- );
24
- }
25
- } catch {
26
- // Never let this block server startup
27
- }
28
-
29
- // Run MCP server
30
- import('./index.js');
31
- } else {
32
- // Run CLI
33
- import('./cli/index.js');
34
- }