@nordsym/apiclaw 2.2.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 (176) 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/gateway-client.d.ts.map +1 -1
  5. package/dist/gateway-client.js +24 -2
  6. package/dist/gateway-client.js.map +1 -1
  7. package/dist/index.bundled.js +61263 -0
  8. package/dist/index.js +2 -2
  9. package/dist/index.js.map +1 -1
  10. package/package.json +7 -2
  11. package/.claude/settings.local.json +0 -13
  12. package/.env.prod +0 -1
  13. package/apiclaw-README.md +0 -494
  14. package/convex/_generated/api.d.ts +0 -145
  15. package/convex/_generated/api.js +0 -23
  16. package/convex/_generated/dataModel.d.ts +0 -60
  17. package/convex/_generated/server.d.ts +0 -143
  18. package/convex/_generated/server.js +0 -93
  19. package/convex/_listWorkspaces.ts +0 -13
  20. package/convex/adminActivate.ts +0 -53
  21. package/convex/adminStats.ts +0 -306
  22. package/convex/agents.ts +0 -939
  23. package/convex/analytics.ts +0 -187
  24. package/convex/apiKeys.ts +0 -220
  25. package/convex/backfillAnalytics.ts +0 -272
  26. package/convex/backfillSearchLogs.ts +0 -35
  27. package/convex/billing.ts +0 -834
  28. package/convex/capabilities.ts +0 -157
  29. package/convex/chains.ts +0 -1318
  30. package/convex/credits.ts +0 -211
  31. package/convex/crons.ts +0 -65
  32. package/convex/debugFilestackLogs.ts +0 -16
  33. package/convex/debugGetToken.ts +0 -18
  34. package/convex/directCall.ts +0 -713
  35. package/convex/earnProgress.ts +0 -753
  36. package/convex/email.ts +0 -329
  37. package/convex/feedback.ts +0 -265
  38. package/convex/funnel.ts +0 -431
  39. package/convex/guards.ts +0 -174
  40. package/convex/http.ts +0 -3756
  41. package/convex/inbound.ts +0 -32
  42. package/convex/logs.ts +0 -701
  43. package/convex/migrateFilestack.ts +0 -81
  44. package/convex/migratePartnersProd.ts +0 -174
  45. package/convex/migratePratham.ts +0 -126
  46. package/convex/migrateProviderWorkspaces.ts +0 -175
  47. package/convex/mou.ts +0 -91
  48. package/convex/nurture.ts +0 -355
  49. package/convex/providerKeys.ts +0 -289
  50. package/convex/providers.ts +0 -1135
  51. package/convex/purchases.ts +0 -183
  52. package/convex/ratelimit.ts +0 -104
  53. package/convex/schema.ts +0 -926
  54. package/convex/searchLogs.ts +0 -265
  55. package/convex/seedAPILayerAPIs.ts +0 -191
  56. package/convex/seedDirectCallConfigs.ts +0 -336
  57. package/convex/seedPratham.ts +0 -149
  58. package/convex/spendAlerts.ts +0 -442
  59. package/convex/stripeActions.ts +0 -607
  60. package/convex/teams.ts +0 -243
  61. package/convex/telemetry.ts +0 -81
  62. package/convex/tsconfig.json +0 -25
  63. package/convex/updateAPIStatus.ts +0 -44
  64. package/convex/usage.ts +0 -260
  65. package/convex/usageReports.ts +0 -357
  66. package/convex/waitlist.ts +0 -55
  67. package/convex/webhooks.ts +0 -494
  68. package/convex/workspaceSettings.ts +0 -143
  69. package/convex/workspaces.ts +0 -1331
  70. package/convex.json +0 -3
  71. package/direct-test.mjs +0 -51
  72. package/email-templates/filestack-provider-outreach.html +0 -162
  73. package/email-templates/partnership-template.html +0 -116
  74. package/email-templates/pratham-draft-preview.txt +0 -57
  75. package/email-templates/pratham-partnership-draft.html +0 -141
  76. package/reports/APIClaw-Session-Report-2026-04-05.pdf +0 -0
  77. package/reports/pipeline/PIPELINE-REPORT.json +0 -153
  78. package/reports/pipeline/acquire_apisguru.json +0 -17
  79. package/reports/pipeline/capabilities.json +0 -38
  80. package/reports/pipeline/discover_azure_recursive.json +0 -1551
  81. package/reports/pipeline/discover_github.json +0 -25
  82. package/reports/pipeline/discover_github_repos.json +0 -49
  83. package/reports/pipeline/discover_swaggerhub.json +0 -24
  84. package/reports/pipeline/discover_well_known.json +0 -23
  85. package/reports/pipeline/fetch_specs.json +0 -19
  86. package/reports/pipeline/generate_providers.json +0 -14
  87. package/reports/pipeline/match_registry.json +0 -11
  88. package/reports/pipeline/parse_specs.json +0 -17
  89. package/reports/pipeline/promote_candidates.json +0 -34
  90. package/reports/pipeline/validate.json +0 -30
  91. package/reports/pipeline/validate_smoke_details.json +0 -3835
  92. package/reports/session-report-2026-04-05.html +0 -433
  93. package/seed-apis-direct.mjs +0 -106
  94. package/src/access-control.ts +0 -174
  95. package/src/adapters/base.ts +0 -364
  96. package/src/adapters/claude-desktop.ts +0 -41
  97. package/src/adapters/cline.ts +0 -88
  98. package/src/adapters/continue.ts +0 -91
  99. package/src/adapters/cursor.ts +0 -43
  100. package/src/adapters/custom.ts +0 -188
  101. package/src/adapters/detect.ts +0 -202
  102. package/src/adapters/index.ts +0 -47
  103. package/src/adapters/windsurf.ts +0 -44
  104. package/src/bin-http.ts +0 -45
  105. package/src/bin.ts +0 -34
  106. package/src/capability-router.ts +0 -331
  107. package/src/chainExecutor.ts +0 -730
  108. package/src/chainResolver.test.ts +0 -246
  109. package/src/chainResolver.ts +0 -658
  110. package/src/cli/commands/demo.ts +0 -109
  111. package/src/cli/commands/doctor.ts +0 -435
  112. package/src/cli/commands/index.ts +0 -9
  113. package/src/cli/commands/login.ts +0 -203
  114. package/src/cli/commands/mcp-install.ts +0 -373
  115. package/src/cli/commands/restore.ts +0 -333
  116. package/src/cli/commands/setup.ts +0 -297
  117. package/src/cli/commands/uninstall.ts +0 -240
  118. package/src/cli/index.ts +0 -148
  119. package/src/cli.ts +0 -370
  120. package/src/confirmation.ts +0 -296
  121. package/src/credentials.ts +0 -455
  122. package/src/credits.ts +0 -329
  123. package/src/crypto.ts +0 -75
  124. package/src/discovery.ts +0 -568
  125. package/src/enterprise/env.ts +0 -156
  126. package/src/enterprise/index.ts +0 -7
  127. package/src/enterprise/script-generator.ts +0 -481
  128. package/src/execute-dynamic.ts +0 -617
  129. package/src/execute.ts +0 -2386
  130. package/src/funnel-client.ts +0 -168
  131. package/src/funnel.test.ts +0 -187
  132. package/src/gateway-client.ts +0 -192
  133. package/src/hivr-whitelist.ts +0 -110
  134. package/src/http-api.ts +0 -286
  135. package/src/http-server-minimal.ts +0 -154
  136. package/src/index.ts +0 -2702
  137. package/src/intelligent-gateway.ts +0 -339
  138. package/src/mcp-analytics.ts +0 -156
  139. package/src/metered.ts +0 -149
  140. package/src/open-apis-generated.ts +0 -157
  141. package/src/open-apis.ts +0 -558
  142. package/src/postinstall.ts +0 -40
  143. package/src/product-whitelist.ts +0 -246
  144. package/src/proxy.ts +0 -36
  145. package/src/registration-guard.ts +0 -117
  146. package/src/session.ts +0 -129
  147. package/src/stripe.ts +0 -497
  148. package/src/telemetry.ts +0 -71
  149. package/src/test.ts +0 -135
  150. package/src/types/convex-api.d.ts +0 -20
  151. package/src/types/convex-api.ts +0 -21
  152. package/src/types.ts +0 -109
  153. package/src/ui/colors.ts +0 -219
  154. package/src/ui/errors.ts +0 -394
  155. package/src/ui/index.ts +0 -17
  156. package/src/ui/prompts.ts +0 -390
  157. package/src/ui/spinner.ts +0 -325
  158. package/src/utils/backup.ts +0 -224
  159. package/src/utils/config.ts +0 -318
  160. package/src/utils/os.ts +0 -124
  161. package/src/utils/paths.ts +0 -203
  162. package/src/webhook.ts +0 -107
  163. package/test-10-working.cjs +0 -97
  164. package/test-14-final.cjs +0 -96
  165. package/test-actual-handlers.ts +0 -92
  166. package/test-apilayer-all-14.ts +0 -249
  167. package/test-apilayer-fixed.ts +0 -248
  168. package/test-direct-endpoints.ts +0 -174
  169. package/test-exact-endpoints.ts +0 -144
  170. package/test-final.ts +0 -83
  171. package/test-full-routing.ts +0 -100
  172. package/test-handlers-correct.ts +0 -217
  173. package/test-numverify-key.ts +0 -41
  174. package/test-via-handlers.ts +0 -92
  175. package/test-worldnews.mjs +0 -26
  176. 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';