@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
package/src/ui/errors.ts DELETED
@@ -1,394 +0,0 @@
1
- /**
2
- * APIClaw MCP Auto-Setup - Error Handling
3
- *
4
- * Comprehensive error formatting with actionable help.
5
- * Every error includes context, suggestions, and help links.
6
- */
7
-
8
- import { colors, icons, box, numberedList, command, helpLink } from './colors.js';
9
-
10
- /**
11
- * Error codes for APIClaw setup
12
- */
13
- export enum ErrorCode {
14
- // File system errors
15
- CONFIG_NOT_FOUND = 'CONFIG_NOT_FOUND',
16
- PERMISSION_DENIED = 'PERMISSION_DENIED',
17
- INVALID_JSON = 'INVALID_JSON',
18
- WRITE_FAILED = 'WRITE_FAILED',
19
- BACKUP_FAILED = 'BACKUP_FAILED',
20
-
21
- // Configuration errors
22
- ALREADY_CONFIGURED = 'ALREADY_CONFIGURED',
23
- INVALID_CONFIG = 'INVALID_CONFIG',
24
- MERGE_CONFLICT = 'MERGE_CONFLICT',
25
-
26
- // Client errors
27
- CLIENT_NOT_FOUND = 'CLIENT_NOT_FOUND',
28
- UNSUPPORTED_CLIENT = 'UNSUPPORTED_CLIENT',
29
-
30
- // Network errors
31
- NETWORK_ERROR = 'NETWORK_ERROR',
32
- AUTH_FAILED = 'AUTH_FAILED',
33
-
34
- // System errors
35
- UNSUPPORTED_OS = 'UNSUPPORTED_OS',
36
- NODE_VERSION = 'NODE_VERSION',
37
-
38
- // Generic
39
- UNKNOWN = 'UNKNOWN',
40
- }
41
-
42
- /**
43
- * APIClaw error with rich context
44
- */
45
- export class ApiclawError extends Error {
46
- constructor(
47
- public readonly code: ErrorCode,
48
- message: string,
49
- public readonly context?: Record<string, unknown>
50
- ) {
51
- super(message);
52
- this.name = 'ApiclawError';
53
- }
54
- }
55
-
56
- /**
57
- * Error metadata with help information
58
- */
59
- interface ErrorMeta {
60
- title: string;
61
- description: string;
62
- suggestions: string[];
63
- commands?: string[];
64
- helpUrl?: string;
65
- }
66
-
67
- /**
68
- * Error metadata registry
69
- */
70
- const errorMeta: Record<ErrorCode, ErrorMeta> = {
71
- [ErrorCode.CONFIG_NOT_FOUND]: {
72
- title: 'Config file not found',
73
- description: 'The MCP client config file does not exist at the expected location.',
74
- suggestions: [
75
- 'Make sure the MCP client is installed',
76
- 'The client may not have created its config yet - try opening and closing it',
77
- 'Use --config to specify a custom path',
78
- ],
79
- commands: [
80
- 'npx @nordsym/apiclaw setup --client cursor',
81
- 'npx @nordsym/apiclaw setup --config /path/to/config.json',
82
- ],
83
- helpUrl: 'https://apiclaw.cloud/docs/setup/config-not-found',
84
- },
85
-
86
- [ErrorCode.PERMISSION_DENIED]: {
87
- title: 'Permission denied',
88
- description: 'Unable to write to the config file due to insufficient permissions.',
89
- suggestions: [
90
- 'The config file may be owned by another user',
91
- 'You may need elevated permissions',
92
- 'Check if the file is locked by another process',
93
- ],
94
- commands: [
95
- 'sudo npx @nordsym/apiclaw setup',
96
- 'chmod 644 <config-path>',
97
- ],
98
- helpUrl: 'https://apiclaw.cloud/docs/setup/permissions',
99
- },
100
-
101
- [ErrorCode.INVALID_JSON]: {
102
- title: 'Invalid JSON in config file',
103
- description: 'The existing config file contains malformed JSON.',
104
- suggestions: [
105
- 'Check for trailing commas or missing brackets',
106
- 'Restore from a backup if available',
107
- 'Manually fix the JSON syntax errors',
108
- ],
109
- commands: [
110
- 'npx @nordsym/apiclaw restore --list',
111
- 'npx @nordsym/apiclaw restore',
112
- ],
113
- helpUrl: 'https://apiclaw.cloud/docs/setup/invalid-json',
114
- },
115
-
116
- [ErrorCode.WRITE_FAILED]: {
117
- title: 'Failed to write config file',
118
- description: 'An error occurred while writing the updated configuration.',
119
- suggestions: [
120
- 'Check available disk space',
121
- 'Ensure the config directory exists',
122
- 'Verify write permissions',
123
- ],
124
- helpUrl: 'https://apiclaw.cloud/docs/setup/write-failed',
125
- },
126
-
127
- [ErrorCode.BACKUP_FAILED]: {
128
- title: 'Failed to create backup',
129
- description: 'Could not create a backup of the existing config.',
130
- suggestions: [
131
- 'Check available disk space',
132
- 'Verify write permissions in config directory',
133
- 'Use --no-backup to skip backup (not recommended)',
134
- ],
135
- helpUrl: 'https://apiclaw.cloud/docs/setup/backup-failed',
136
- },
137
-
138
- [ErrorCode.ALREADY_CONFIGURED]: {
139
- title: 'Already configured',
140
- description: 'APIClaw is already configured in this MCP client.',
141
- suggestions: [
142
- 'Use --force to update the existing configuration',
143
- 'Use npx @nordsym/apiclaw doctor to verify the setup',
144
- ],
145
- commands: [
146
- 'npx @nordsym/apiclaw setup --force',
147
- 'npx @nordsym/apiclaw doctor',
148
- ],
149
- helpUrl: 'https://apiclaw.cloud/docs/setup/already-configured',
150
- },
151
-
152
- [ErrorCode.INVALID_CONFIG]: {
153
- title: 'Invalid configuration',
154
- description: 'The configuration structure is invalid or missing required fields.',
155
- suggestions: [
156
- 'Ensure the config follows the MCP specification',
157
- 'Check for required fields like "mcpServers"',
158
- ],
159
- helpUrl: 'https://apiclaw.cloud/docs/setup/invalid-config',
160
- },
161
-
162
- [ErrorCode.MERGE_CONFLICT]: {
163
- title: 'Configuration merge conflict',
164
- description: 'Could not safely merge APIClaw into the existing configuration.',
165
- suggestions: [
166
- 'Review the existing config manually',
167
- 'Use --force to overwrite',
168
- 'Create a backup and try again',
169
- ],
170
- helpUrl: 'https://apiclaw.cloud/docs/setup/merge-conflict',
171
- },
172
-
173
- [ErrorCode.CLIENT_NOT_FOUND]: {
174
- title: 'MCP client not found',
175
- description: 'The specified MCP client could not be detected on this system.',
176
- suggestions: [
177
- 'Install the MCP client first',
178
- 'Specify a different client with --client',
179
- 'Use --config for custom config paths',
180
- ],
181
- commands: [
182
- 'npx @nordsym/apiclaw setup --client claude-desktop',
183
- 'npx @nordsym/apiclaw doctor',
184
- ],
185
- helpUrl: 'https://apiclaw.cloud/docs/setup/client-not-found',
186
- },
187
-
188
- [ErrorCode.UNSUPPORTED_CLIENT]: {
189
- title: 'Unsupported MCP client',
190
- description: 'This MCP client is not yet supported by APIClaw auto-setup.',
191
- suggestions: [
192
- 'Check for updates: npm update @nordsym/apiclaw',
193
- 'Use --config to manually specify the config path',
194
- 'Request support at github.com/nordsym/apiclaw',
195
- ],
196
- helpUrl: 'https://apiclaw.cloud/docs/setup/supported-clients',
197
- },
198
-
199
- [ErrorCode.NETWORK_ERROR]: {
200
- title: 'Network error',
201
- description: 'Could not connect to APIClaw services.',
202
- suggestions: [
203
- 'Check your internet connection',
204
- 'Setup works offline - verify connectivity later',
205
- 'Check if APIClaw is reachable',
206
- ],
207
- commands: [
208
- 'curl -I https://apiclaw.cloud',
209
- 'npx @nordsym/apiclaw doctor',
210
- ],
211
- helpUrl: 'https://apiclaw.cloud/docs/setup/network-error',
212
- },
213
-
214
- [ErrorCode.AUTH_FAILED]: {
215
- title: 'Authentication failed',
216
- description: 'Could not authenticate with APIClaw.',
217
- suggestions: [
218
- 'Check your workspace ID',
219
- 'Verify your API key is valid',
220
- 'Setup works without auth - configure credentials later',
221
- ],
222
- helpUrl: 'https://apiclaw.cloud/docs/setup/auth-failed',
223
- },
224
-
225
- [ErrorCode.UNSUPPORTED_OS]: {
226
- title: 'Unsupported operating system',
227
- description: 'APIClaw auto-setup is not available for this operating system.',
228
- suggestions: [
229
- 'Supported: macOS, Windows 10/11, Linux',
230
- 'Manual setup instructions available',
231
- ],
232
- helpUrl: 'https://apiclaw.cloud/docs/setup/manual',
233
- },
234
-
235
- [ErrorCode.NODE_VERSION]: {
236
- title: 'Unsupported Node.js version',
237
- description: 'APIClaw requires Node.js 18 or higher.',
238
- suggestions: [
239
- 'Upgrade Node.js to version 18 or later',
240
- 'Use nvm to manage Node.js versions',
241
- ],
242
- commands: [
243
- 'nvm install 18',
244
- 'nvm use 18',
245
- ],
246
- helpUrl: 'https://apiclaw.cloud/docs/setup/node-version',
247
- },
248
-
249
- [ErrorCode.UNKNOWN]: {
250
- title: 'Unknown error',
251
- description: 'An unexpected error occurred.',
252
- suggestions: [
253
- 'Try running with --verbose for more details',
254
- 'Check the logs for more information',
255
- 'Report this issue if it persists',
256
- ],
257
- commands: [
258
- 'npx @nordsym/apiclaw setup --verbose',
259
- ],
260
- helpUrl: 'https://apiclaw.cloud/docs/support',
261
- },
262
- };
263
-
264
- /**
265
- * Format an error for terminal output
266
- */
267
- export function formatError(error: Error | ApiclawError): string {
268
- const code = error instanceof ApiclawError ? error.code : ErrorCode.UNKNOWN;
269
- const meta = errorMeta[code];
270
- const context = error instanceof ApiclawError ? error.context : undefined;
271
-
272
- const lines: string[] = [];
273
-
274
- // Header
275
- lines.push(`${icons.cross} ${colors.error(`Error: ${meta.title}`)}`);
276
- lines.push('');
277
-
278
- // Description
279
- lines.push(colors.secondary(meta.description));
280
-
281
- // Context (if available)
282
- if (context) {
283
- lines.push('');
284
- for (const [key, value] of Object.entries(context)) {
285
- if (value !== undefined) {
286
- lines.push(colors.muted(` ${key}: ${String(value)}`));
287
- }
288
- }
289
- }
290
-
291
- // Original error message (if different from description)
292
- if (error.message && error.message !== meta.description) {
293
- lines.push('');
294
- lines.push(colors.muted(`Details: ${error.message}`));
295
- }
296
-
297
- // Suggestions
298
- lines.push('');
299
- lines.push(colors.secondary('This usually means:'));
300
- lines.push(numberedList(meta.suggestions, 0));
301
-
302
- // Commands
303
- if (meta.commands && meta.commands.length > 0) {
304
- lines.push('');
305
- lines.push(colors.secondary('Try:'));
306
- for (const cmd of meta.commands) {
307
- lines.push(command(cmd));
308
- }
309
- }
310
-
311
- // Help link
312
- if (meta.helpUrl) {
313
- lines.push('');
314
- lines.push(`Need help? ${helpLink(meta.helpUrl)}`);
315
- }
316
-
317
- return lines.join('\n');
318
- }
319
-
320
- /**
321
- * Print an error to stderr
322
- */
323
- export function printError(error: Error | ApiclawError): void {
324
- console.error(formatError(error));
325
- }
326
-
327
- /**
328
- * Create a typed error
329
- */
330
- export function createError(
331
- code: ErrorCode,
332
- message?: string,
333
- context?: Record<string, unknown>
334
- ): ApiclawError {
335
- const meta = errorMeta[code];
336
- return new ApiclawError(code, message || meta.description, context);
337
- }
338
-
339
- /**
340
- * Wrap a function with error handling
341
- */
342
- export async function withErrorHandling<T>(
343
- fn: () => Promise<T>,
344
- options: { exitOnError?: boolean } = {}
345
- ): Promise<T | undefined> {
346
- try {
347
- return await fn();
348
- } catch (error) {
349
- printError(error instanceof Error ? error : new Error(String(error)));
350
-
351
- if (options.exitOnError) {
352
- process.exit(1);
353
- }
354
-
355
- return undefined;
356
- }
357
- }
358
-
359
- /**
360
- * Format a warning message
361
- */
362
- export function formatWarning(message: string, suggestions?: string[]): string {
363
- const lines: string[] = [];
364
-
365
- lines.push(`${icons.warning} ${colors.warning(`Warning: ${message}`)}`);
366
-
367
- if (suggestions && suggestions.length > 0) {
368
- lines.push('');
369
- lines.push(numberedList(suggestions, 0));
370
- }
371
-
372
- return lines.join('\n');
373
- }
374
-
375
- /**
376
- * Print a warning to stderr
377
- */
378
- export function printWarning(message: string, suggestions?: string[]): void {
379
- console.error(formatWarning(message, suggestions));
380
- }
381
-
382
- /**
383
- * Format an info message
384
- */
385
- export function formatInfo(message: string): string {
386
- return `${icons.info} ${colors.info(message)}`;
387
- }
388
-
389
- /**
390
- * Format a success message
391
- */
392
- export function formatSuccess(message: string): string {
393
- return `${icons.check} ${colors.success(message)}`;
394
- }
package/src/ui/index.ts DELETED
@@ -1,17 +0,0 @@
1
- /**
2
- * APIClaw MCP Auto-Setup - UI Module
3
- *
4
- * Exports all UI utilities for the CLI.
5
- */
6
-
7
- // Color utilities
8
- export * from './colors.js';
9
-
10
- // Spinner utilities
11
- export * from './spinner.js';
12
-
13
- // Interactive prompts
14
- export * from './prompts.js';
15
-
16
- // Error handling
17
- export * from './errors.js';