@nordsym/apiclaw 1.5.17 → 1.5.19

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 (228) hide show
  1. package/convex/http.js.map +1 -1
  2. package/convex/http.ts +516 -0
  3. package/dist/analytics.d.ts +0 -4
  4. package/dist/analytics.d.ts.map +1 -1
  5. package/dist/analytics.js +0 -1
  6. package/dist/analytics.js.map +1 -1
  7. package/dist/bin.js +1 -1
  8. package/dist/cli/commands/mcp-install.d.ts.map +1 -1
  9. package/dist/cli/commands/mcp-install.js +8 -87
  10. package/dist/cli/commands/mcp-install.js.map +1 -1
  11. package/dist/cli/index.js +0 -7
  12. package/dist/credentials.d.ts.map +1 -1
  13. package/dist/credentials.js +38 -43
  14. package/dist/credentials.js.map +1 -1
  15. package/dist/discovery.d.ts.map +1 -1
  16. package/dist/discovery.js +82 -191
  17. package/dist/discovery.js.map +1 -1
  18. package/dist/http-api.d.ts.map +1 -1
  19. package/dist/http-api.js +33 -17
  20. package/dist/http-api.js.map +1 -1
  21. package/dist/proxy.js +1 -1
  22. package/dist/proxy.js.map +1 -1
  23. package/landing/next-env.d.ts +0 -1
  24. package/landing/src/app/api/auth/magic-link/route.ts +1 -1
  25. package/landing/src/app/auth/verify/page.tsx +0 -6
  26. package/landing/src/app/dashboard/verify/page.tsx +0 -6
  27. package/landing/src/app/join/page.tsx +0 -6
  28. package/landing/src/app/layout.tsx +2 -2
  29. package/landing/src/app/login/page.tsx +1 -1
  30. package/landing/src/app/mou/[partnerId]/page.tsx +0 -6
  31. package/landing/src/app/page.tsx +18 -39
  32. package/landing/src/app/providers/dashboard/[apiId]/actions/[actionId]/edit/page.tsx +0 -6
  33. package/landing/src/app/providers/dashboard/[apiId]/actions/new/page.tsx +0 -5
  34. package/landing/src/app/providers/dashboard/[apiId]/actions/page.tsx +0 -5
  35. package/landing/src/app/providers/dashboard/[apiId]/direct-call/page.tsx +1 -6
  36. package/landing/src/app/providers/dashboard/[apiId]/page.tsx +0 -5
  37. package/landing/src/app/providers/dashboard/[apiId]/test/page.tsx +0 -5
  38. package/landing/src/app/providers/dashboard/layout.tsx +6 -6
  39. package/landing/src/app/providers/dashboard/login/page.tsx +1 -1
  40. package/landing/src/app/providers/dashboard/page.tsx +1 -1
  41. package/landing/src/app/providers/dashboard/verify/page.tsx +0 -6
  42. package/landing/src/app/providers/layout.tsx +1 -1
  43. package/landing/src/app/upgrade/page.tsx +0 -6
  44. package/landing/src/app/workspace/page.tsx +0 -6
  45. package/landing/src/components/HeroTabs.tsx +2 -2
  46. package/landing/src/components/{Workspace.tsx → ProviderDashboard.tsx} +2 -2
  47. package/landing/src/components/VideoDemo.tsx +10 -21
  48. package/landing/src/lib/mock-data.ts +1 -1
  49. package/landing/src/lib/stats.json +1 -1
  50. package/package.json +3 -8
  51. package/src/analytics.ts +0 -5
  52. package/src/bin.ts +1 -1
  53. package/src/cli/commands/mcp-install.ts +8 -90
  54. package/src/cli/index.ts +0 -8
  55. package/src/credentials.ts +39 -44
  56. package/src/discovery.ts +82 -191
  57. package/src/http-api.ts +34 -18
  58. package/src/proxy.ts +1 -1
  59. package/APILAYER_STATUS_2026-03-24.md +0 -38
  60. package/CHANGELOG-WHITELIST-V2.md +0 -269
  61. package/HIVR-WHITELIST-STATUS.md +0 -205
  62. package/HIVR-WHITELIST.md +0 -148
  63. package/TERMINOLOGY-AUDIT.md +0 -99
  64. package/TERMINOLOGY-FIXED.md +0 -74
  65. package/VIDEO-DEMO-GUIDE.md +0 -82
  66. package/WHITELIST-ARCHITECTURE.md +0 -379
  67. package/api/discover.ts +0 -71
  68. package/api/health.ts +0 -20
  69. package/convex/adminActivate.d.ts +0 -3
  70. package/convex/adminActivate.js +0 -47
  71. package/convex/adminStats.d.ts +0 -3
  72. package/convex/adminStats.js +0 -42
  73. package/convex/agents.d.ts +0 -54
  74. package/convex/agents.js +0 -499
  75. package/convex/analytics.d.ts +0 -5
  76. package/convex/analytics.js +0 -166
  77. package/convex/billing.d.ts +0 -88
  78. package/convex/billing.js +0 -655
  79. package/convex/capabilities.d.ts +0 -9
  80. package/convex/capabilities.js +0 -145
  81. package/convex/chains.d.ts +0 -67
  82. package/convex/chains.js +0 -1042
  83. package/convex/credits.d.ts +0 -25
  84. package/convex/credits.js +0 -186
  85. package/convex/crons.d.ts +0 -3
  86. package/convex/crons.js +0 -17
  87. package/convex/directCall.d.ts +0 -72
  88. package/convex/directCall.js +0 -627
  89. package/convex/earnProgress.d.ts +0 -58
  90. package/convex/earnProgress.js +0 -649
  91. package/convex/email.d.ts +0 -14
  92. package/convex/email.js +0 -300
  93. package/convex/feedback.d.ts +0 -7
  94. package/convex/feedback.js +0 -227
  95. package/convex/http.d.ts +0 -3
  96. package/convex/http.js +0 -910
  97. package/convex/logs.d.ts +0 -38
  98. package/convex/logs.js +0 -487
  99. package/convex/mou.d.ts +0 -6
  100. package/convex/mou.js +0 -82
  101. package/convex/providerKeys.d.ts +0 -31
  102. package/convex/providerKeys.js +0 -257
  103. package/convex/providers.d.ts +0 -29
  104. package/convex/providers.js +0 -756
  105. package/convex/purchases.d.ts +0 -7
  106. package/convex/purchases.js +0 -157
  107. package/convex/ratelimit.d.ts +0 -4
  108. package/convex/ratelimit.js +0 -91
  109. package/convex/searchLogs.d.ts +0 -4
  110. package/convex/searchLogs.js +0 -129
  111. package/convex/spendAlerts.d.ts +0 -36
  112. package/convex/spendAlerts.js +0 -380
  113. package/convex/stripeActions.d.ts +0 -19
  114. package/convex/stripeActions.js +0 -411
  115. package/convex/teams.d.ts +0 -21
  116. package/convex/teams.js +0 -215
  117. package/convex/telemetry.d.ts +0 -4
  118. package/convex/telemetry.js +0 -74
  119. package/convex/usage.d.ts +0 -27
  120. package/convex/usage.js +0 -229
  121. package/convex/waitlist.d.ts +0 -4
  122. package/convex/waitlist.js +0 -49
  123. package/convex/webhooks.d.ts +0 -12
  124. package/convex/webhooks.js +0 -410
  125. package/convex/workspaces.d.ts +0 -29
  126. package/convex/workspaces.js +0 -880
  127. package/direct-test.mjs +0 -51
  128. package/dist/access-control.d.ts +0 -45
  129. package/dist/access-control.d.ts.map +0 -1
  130. package/dist/access-control.js +0 -142
  131. package/dist/access-control.js.map +0 -1
  132. package/dist/chain-types.d.ts +0 -187
  133. package/dist/chain-types.d.ts.map +0 -1
  134. package/dist/chain-types.js +0 -33
  135. package/dist/chain-types.js.map +0 -1
  136. package/dist/convex/adminActivate.js +0 -46
  137. package/dist/convex/adminStats.js +0 -41
  138. package/dist/convex/agents.js +0 -498
  139. package/dist/convex/analytics.js +0 -165
  140. package/dist/convex/billing.js +0 -654
  141. package/dist/convex/capabilities.js +0 -144
  142. package/dist/convex/chains.js +0 -1041
  143. package/dist/convex/credits.js +0 -185
  144. package/dist/convex/crons.js +0 -16
  145. package/dist/convex/directCall.js +0 -626
  146. package/dist/convex/earnProgress.js +0 -648
  147. package/dist/convex/email.js +0 -299
  148. package/dist/convex/feedback.js +0 -226
  149. package/dist/convex/http.js +0 -909
  150. package/dist/convex/logs.js +0 -486
  151. package/dist/convex/mou.js +0 -81
  152. package/dist/convex/providerKeys.js +0 -256
  153. package/dist/convex/providers.js +0 -755
  154. package/dist/convex/purchases.js +0 -156
  155. package/dist/convex/ratelimit.js +0 -90
  156. package/dist/convex/schema.js +0 -709
  157. package/dist/convex/searchLogs.js +0 -128
  158. package/dist/convex/spendAlerts.js +0 -379
  159. package/dist/convex/stripeActions.js +0 -410
  160. package/dist/convex/teams.js +0 -214
  161. package/dist/convex/telemetry.js +0 -73
  162. package/dist/convex/usage.js +0 -228
  163. package/dist/convex/waitlist.js +0 -48
  164. package/dist/convex/webhooks.js +0 -409
  165. package/dist/convex/workspaces.js +0 -879
  166. package/dist/hivr-whitelist.d.ts +0 -18
  167. package/dist/hivr-whitelist.d.ts.map +0 -1
  168. package/dist/hivr-whitelist.js +0 -95
  169. package/dist/hivr-whitelist.js.map +0 -1
  170. package/dist/http-server-minimal.d.ts +0 -7
  171. package/dist/http-server-minimal.d.ts.map +0 -1
  172. package/dist/http-server-minimal.js +0 -126
  173. package/dist/http-server-minimal.js.map +0 -1
  174. package/dist/product-whitelist.d.ts +0 -37
  175. package/dist/product-whitelist.d.ts.map +0 -1
  176. package/dist/product-whitelist.js +0 -203
  177. package/dist/product-whitelist.js.map +0 -1
  178. package/dist/src/analytics.js +0 -129
  179. package/dist/src/bin.js +0 -17
  180. package/dist/src/capability-router.js +0 -240
  181. package/dist/src/chainExecutor.js +0 -451
  182. package/dist/src/chainResolver.js +0 -518
  183. package/dist/src/cli/commands/doctor.js +0 -324
  184. package/dist/src/cli/commands/mcp-install.js +0 -255
  185. package/dist/src/cli/commands/restore.js +0 -259
  186. package/dist/src/cli/commands/setup.js +0 -205
  187. package/dist/src/cli/commands/uninstall.js +0 -188
  188. package/dist/src/cli/index.js +0 -111
  189. package/dist/src/cli.js +0 -302
  190. package/dist/src/confirmation.js +0 -240
  191. package/dist/src/credentials.js +0 -357
  192. package/dist/src/credits.js +0 -260
  193. package/dist/src/crypto.js +0 -66
  194. package/dist/src/discovery.js +0 -504
  195. package/dist/src/enterprise/env.js +0 -123
  196. package/dist/src/enterprise/script-generator.js +0 -460
  197. package/dist/src/execute-dynamic.js +0 -473
  198. package/dist/src/execute.js +0 -1727
  199. package/dist/src/index.js +0 -2062
  200. package/dist/src/metered.js +0 -80
  201. package/dist/src/open-apis.js +0 -276
  202. package/dist/src/proxy.js +0 -28
  203. package/dist/src/session.js +0 -86
  204. package/dist/src/stripe.js +0 -407
  205. package/dist/src/telemetry.js +0 -49
  206. package/dist/src/types.js +0 -2
  207. package/dist/src/utils/backup.js +0 -181
  208. package/dist/src/utils/config.js +0 -220
  209. package/dist/src/utils/os.js +0 -105
  210. package/dist/src/utils/paths.js +0 -159
  211. package/landing/pages/api/discover.ts +0 -43
  212. package/landing/pages/api/health.ts +0 -20
  213. package/scripts/test-whitelist-v2.sh +0 -128
  214. package/src/access-control.ts +0 -174
  215. package/src/hivr-whitelist.ts +0 -110
  216. package/src/http-server-minimal.ts +0 -154
  217. package/src/product-whitelist.ts +0 -246
  218. package/test-actual-handlers.ts +0 -92
  219. package/test-apilayer-all-14.ts +0 -249
  220. package/test-apilayer-fixed.ts +0 -248
  221. package/test-direct-endpoints.ts +0 -174
  222. package/test-exact-endpoints.ts +0 -144
  223. package/test-final.ts +0 -83
  224. package/test-full-routing.ts +0 -100
  225. package/test-handlers-correct.ts +0 -217
  226. package/test-numverify-key.ts +0 -41
  227. package/test-via-handlers.ts +0 -92
  228. package/test-worldnews.mjs +0 -26
@@ -1,460 +0,0 @@
1
- /**
2
- * Enterprise Script Generator
3
- * Generates self-contained deployment scripts for bash and PowerShell
4
- */
5
- import { ENV_VARS, DEFAULT_API_URL } from './env.js';
6
- // Env var names as strings for embedding in scripts
7
- const WORKSPACE_VAR = ENV_VARS.WORKSPACE;
8
- const API_URL_VAR = ENV_VARS.API_URL;
9
- const TELEMETRY_VAR = ENV_VARS.DISABLE_TELEMETRY;
10
- /**
11
- * Generate self-contained bash deployment script
12
- */
13
- export function generateBashScript(options = {}) {
14
- const serverName = options.serverName || 'apiclaw';
15
- const workspaceVal = options.workspace || '';
16
- const apiUrlVal = options.apiUrl || DEFAULT_API_URL;
17
- const disableTelemetry = options.disableTelemetry ? 'true' : '';
18
- const verbose = options.verbose ? '1' : '';
19
- return `#!/usr/bin/env bash
20
- #
21
- # APIClaw MCP Auto-Setup Script
22
- # Generated by: npx @nordsym/apiclaw setup --enterprise
23
- #
24
- # This script automatically configures APIClaw for all detected MCP clients.
25
- # Supports: Claude Desktop, Cursor, Windsurf, Cline, Continue
26
- #
27
-
28
- set -e
29
-
30
- # Configuration
31
- SERVER_NAME="${serverName}"
32
- WORKSPACE="${workspaceVal}"
33
- API_URL="${apiUrlVal}"
34
- DEFAULT_API_URL="${DEFAULT_API_URL}"
35
- DISABLE_TELEMETRY="${disableTelemetry}"
36
- VERBOSE="${verbose}"
37
-
38
- # Environment variable names
39
- ENV_WORKSPACE="${WORKSPACE_VAR}"
40
- ENV_API_URL="${API_URL_VAR}"
41
- ENV_TELEMETRY="${TELEMETRY_VAR}"
42
-
43
- # Colors
44
- RED='\\033[0;31m'
45
- GREEN='\\033[0;32m'
46
- YELLOW='\\033[1;33m'
47
- BLUE='\\033[0;34m'
48
- NC='\\033[0m' # No Color
49
-
50
- log_info() { echo -e "\${BLUE}ℹ\${NC} $1"; }
51
- log_success() { echo -e "\${GREEN}✓\${NC} $1"; }
52
- log_warn() { echo -e "\${YELLOW}⚠\${NC} $1"; }
53
- log_error() { echo -e "\${RED}✗\${NC} $1"; }
54
- log_verbose() { [[ -n "$VERBOSE" ]] && echo -e " $1"; }
55
-
56
- # Detect OS
57
- detect_os() {
58
- case "$(uname -s)" in
59
- Darwin*) echo "mac" ;;
60
- Linux*) echo "linux" ;;
61
- MINGW*|MSYS*|CYGWIN*) echo "win" ;;
62
- *) echo "linux" ;;
63
- esac
64
- }
65
-
66
- OS=$(detect_os)
67
- HOME_DIR="$HOME"
68
-
69
- # Set paths based on OS
70
- case "$OS" in
71
- mac)
72
- APP_DATA="$HOME_DIR/Library/Application Support"
73
- ;;
74
- linux)
75
- APP_DATA="\${XDG_CONFIG_HOME:-$HOME_DIR/.config}"
76
- ;;
77
- win)
78
- APP_DATA="\${APPDATA:-$HOME_DIR/AppData/Roaming}"
79
- ;;
80
- esac
81
-
82
- echo ""
83
- echo "🔧 APIClaw MCP Auto-Setup"
84
- echo "========================="
85
- echo ""
86
- log_info "Detected OS: $OS"
87
-
88
- # Check for Node.js
89
- if ! command -v node &> /dev/null; then
90
- log_error "Node.js is required but not installed."
91
- exit 1
92
- fi
93
- log_success "Node.js $(node --version) found"
94
-
95
- # Check for npx
96
- if ! command -v npx &> /dev/null; then
97
- log_error "npx is required but not installed."
98
- exit 1
99
- fi
100
- log_success "npx available"
101
-
102
- # Generate APIClaw server config JSON
103
- generate_config() {
104
- local env_block=""
105
-
106
- if [[ -n "$WORKSPACE" ]] || [[ -n "$API_URL" && "$API_URL" != "$DEFAULT_API_URL" ]] || [[ -n "$DISABLE_TELEMETRY" ]]; then
107
- env_block='"env": {'
108
- local first=true
109
-
110
- if [[ -n "$WORKSPACE" ]]; then
111
- env_block+="\\"$ENV_WORKSPACE\\": \\"$WORKSPACE\\""
112
- first=false
113
- fi
114
-
115
- if [[ -n "$API_URL" && "$API_URL" != "$DEFAULT_API_URL" ]]; then
116
- [[ "$first" == "false" ]] && env_block+=','
117
- env_block+="\\"$ENV_API_URL\\": \\"$API_URL\\""
118
- first=false
119
- fi
120
-
121
- if [[ -n "$DISABLE_TELEMETRY" ]]; then
122
- [[ "$first" == "false" ]] && env_block+=','
123
- env_block+="\\"$ENV_TELEMETRY\\": \\"true\\""
124
- fi
125
-
126
- env_block+='},'
127
- fi
128
-
129
- if [[ -n "$env_block" ]]; then
130
- echo "{\\"command\\": \\"npx\\", \\"args\\": [\\"-y\\", \\"@nordsym/apiclaw\\"], $env_block}"
131
- else
132
- echo "{\\"command\\": \\"npx\\", \\"args\\": [\\"-y\\", \\"@nordsym/apiclaw\\"]}"
133
- fi
134
- }
135
-
136
- # Merge APIClaw into existing config using Node.js
137
- merge_config() {
138
- local config_path="$1"
139
- local apiclaw_config
140
- apiclaw_config=$(generate_config)
141
-
142
- if [[ -f "$config_path" ]]; then
143
- # Backup existing
144
- cp "$config_path" "$config_path.backup.$(date +%s).json"
145
-
146
- # Read existing config
147
- local existing
148
- existing=$(cat "$config_path")
149
-
150
- # Use node to merge JSON
151
- node -e "
152
- const fs = require('fs');
153
- const existing = JSON.parse(process.argv[1] || '{}');
154
- const apiclaw = JSON.parse(process.argv[2]);
155
-
156
- if (!existing.mcpServers) existing.mcpServers = {};
157
- existing.mcpServers['$SERVER_NAME'] = apiclaw;
158
-
159
- fs.writeFileSync('$config_path', JSON.stringify(existing, null, 2));
160
- " "$existing" "$apiclaw_config"
161
- else
162
- # Create new config
163
- mkdir -p "$(dirname "$config_path")"
164
- node -e "
165
- const fs = require('fs');
166
- const apiclaw = JSON.parse(process.argv[1]);
167
- const config = { mcpServers: { '$SERVER_NAME': apiclaw } };
168
- fs.writeFileSync('$config_path', JSON.stringify(config, null, 2));
169
- " "$apiclaw_config"
170
- fi
171
- }
172
-
173
- # Client config paths
174
- declare -A CLIENT_PATHS
175
-
176
- case "$OS" in
177
- mac)
178
- CLIENT_PATHS=(
179
- ["Claude Desktop"]="$APP_DATA/Claude/claude_desktop_config.json"
180
- ["Cursor"]="$APP_DATA/Cursor/User/globalStorage/cursor.mcp/config.json"
181
- ["Windsurf"]="$HOME_DIR/.codeium/windsurf/mcp_config.json"
182
- ["Cline"]="$APP_DATA/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json"
183
- ["Continue"]="$HOME_DIR/.continue/config.json"
184
- )
185
- ;;
186
- linux)
187
- CLIENT_PATHS=(
188
- ["Claude Desktop"]="$APP_DATA/Claude/claude_desktop_config.json"
189
- ["Cursor"]="$APP_DATA/Cursor/User/globalStorage/cursor.mcp/config.json"
190
- ["Windsurf"]="$HOME_DIR/.codeium/windsurf/mcp_config.json"
191
- ["Cline"]="$APP_DATA/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json"
192
- ["Continue"]="$HOME_DIR/.continue/config.json"
193
- )
194
- ;;
195
- win)
196
- CLIENT_PATHS=(
197
- ["Claude Desktop"]="$APP_DATA/Claude/claude_desktop_config.json"
198
- ["Cursor"]="$APP_DATA/Cursor/User/globalStorage/cursor.mcp/config.json"
199
- ["Windsurf"]="$USERPROFILE/.codeium/windsurf/mcp_config.json"
200
- ["Cline"]="$APP_DATA/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json"
201
- ["Continue"]="$USERPROFILE/.continue/config.json"
202
- )
203
- ;;
204
- esac
205
-
206
- # Configure each client
207
- echo ""
208
- log_info "Scanning for MCP clients..."
209
- echo ""
210
-
211
- configured=0
212
- skipped=0
213
-
214
- for client in "\${!CLIENT_PATHS[@]}"; do
215
- config_path="\${CLIENT_PATHS[$client]}"
216
- config_dir=$(dirname "$config_path")
217
-
218
- # Check if client is installed (config dir exists or we can create it)
219
- if [[ -d "$config_dir" ]] || [[ -f "$config_path" ]]; then
220
- log_info "Configuring $client..."
221
-
222
- if merge_config "$config_path"; then
223
- log_success "$client configured"
224
- ((configured++))
225
- else
226
- log_error "Failed to configure $client"
227
- fi
228
- else
229
- log_verbose "$client not detected (no config directory)"
230
- ((skipped++))
231
- fi
232
- done
233
-
234
- # Summary
235
- echo ""
236
- echo "========================="
237
- echo ""
238
-
239
- if [[ $configured -gt 0 ]]; then
240
- log_success "Configured $configured client(s)"
241
- echo ""
242
- echo "🎉 APIClaw is ready! Restart your MCP clients to activate."
243
- else
244
- log_warn "No MCP clients were detected."
245
- echo ""
246
- echo "Install one of these clients first:"
247
- echo " • Claude Desktop: https://claude.ai/download"
248
- echo " • Cursor: https://cursor.sh"
249
- echo " • Windsurf: https://codeium.com/windsurf"
250
- fi
251
-
252
- echo ""
253
- `;
254
- }
255
- /**
256
- * Generate self-contained PowerShell deployment script
257
- */
258
- export function generatePowerShellScript(options = {}) {
259
- const serverName = options.serverName || 'apiclaw';
260
- const workspaceVal = options.workspace || '';
261
- const apiUrlVal = options.apiUrl || DEFAULT_API_URL;
262
- const disableTelemetry = options.disableTelemetry;
263
- const verbose = options.verbose;
264
- return `#Requires -Version 5.1
265
- <#
266
- .SYNOPSIS
267
- APIClaw MCP Auto-Setup Script
268
-
269
- .DESCRIPTION
270
- Automatically configures APIClaw for all detected MCP clients.
271
- Supports: Claude Desktop, Cursor, Windsurf, Cline, Continue
272
-
273
- .NOTES
274
- Generated by: npx @nordsym/apiclaw setup --enterprise
275
- #>
276
-
277
- [CmdletBinding()]
278
- param()
279
-
280
- $ErrorActionPreference = "Stop"
281
-
282
- # Configuration
283
- $ServerName = "${serverName}"
284
- $Workspace = "${workspaceVal}"
285
- $ApiUrl = "${apiUrlVal}"
286
- $DefaultApiUrl = "${DEFAULT_API_URL}"
287
- $DisableTelemetry = $${disableTelemetry ? 'true' : 'false'}
288
- $VerboseMode = $${verbose ? 'true' : 'false'}
289
-
290
- # Env var names
291
- $EnvWorkspace = "${WORKSPACE_VAR}"
292
- $EnvApiUrl = "${API_URL_VAR}"
293
- $EnvTelemetry = "${TELEMETRY_VAR}"
294
-
295
- # Helper functions
296
- function Write-Info { param($Message) Write-Host "ℹ $Message" -ForegroundColor Blue }
297
- function Write-Success { param($Message) Write-Host "✓ $Message" -ForegroundColor Green }
298
- function Write-Warn { param($Message) Write-Host "⚠ $Message" -ForegroundColor Yellow }
299
- function Write-Err { param($Message) Write-Host "✗ $Message" -ForegroundColor Red }
300
-
301
- Write-Host ""
302
- Write-Host "🔧 APIClaw MCP Auto-Setup" -ForegroundColor Cyan
303
- Write-Host "=========================" -ForegroundColor Cyan
304
- Write-Host ""
305
-
306
- # Check for Node.js
307
- try {
308
- $nodeVersion = & node --version 2>$null
309
- Write-Success "Node.js $nodeVersion found"
310
- } catch {
311
- Write-Err "Node.js is required but not installed."
312
- exit 1
313
- }
314
-
315
- # Check for npx
316
- try {
317
- $null = & npx --version 2>$null
318
- Write-Success "npx available"
319
- } catch {
320
- Write-Err "npx is required but not installed."
321
- exit 1
322
- }
323
-
324
- # Generate APIClaw config
325
- function Get-ApiclawConfig {
326
- $config = @{
327
- command = "npx"
328
- args = @("-y", "@nordsym/apiclaw")
329
- }
330
-
331
- $env = @{}
332
- if ($Workspace) { $env[$EnvWorkspace] = $Workspace }
333
- if ($ApiUrl -and $ApiUrl -ne $DefaultApiUrl) { $env[$EnvApiUrl] = $ApiUrl }
334
- if ($DisableTelemetry) { $env[$EnvTelemetry] = "true" }
335
-
336
- if ($env.Count -gt 0) {
337
- $config["env"] = $env
338
- }
339
-
340
- return $config
341
- }
342
-
343
- # Merge config into existing file
344
- function Merge-Config {
345
- param(
346
- [string]$ConfigPath
347
- )
348
-
349
- $configDir = Split-Path -Parent $ConfigPath
350
-
351
- # Ensure directory exists
352
- if (!(Test-Path $configDir)) {
353
- New-Item -ItemType Directory -Path $configDir -Force | Out-Null
354
- }
355
-
356
- # Read existing or create new
357
- if (Test-Path $ConfigPath) {
358
- # Backup existing
359
- $backupPath = "$ConfigPath.backup.$([DateTimeOffset]::UtcNow.ToUnixTimeSeconds()).json"
360
- Copy-Item $ConfigPath $backupPath
361
-
362
- $existing = Get-Content $ConfigPath -Raw | ConvertFrom-Json -AsHashtable
363
- } else {
364
- $existing = @{}
365
- }
366
-
367
- # Ensure mcpServers exists
368
- if (!$existing.ContainsKey("mcpServers")) {
369
- $existing["mcpServers"] = @{}
370
- }
371
-
372
- # Add APIClaw
373
- $existing["mcpServers"][$ServerName] = Get-ApiclawConfig
374
-
375
- # Write back
376
- $existing | ConvertTo-Json -Depth 10 | Set-Content $ConfigPath -Encoding UTF8
377
- }
378
-
379
- # Client paths
380
- $AppData = $env:APPDATA
381
- $UserProfile = $env:USERPROFILE
382
-
383
- $ClientPaths = @{
384
- "Claude Desktop" = "$AppData\\Claude\\claude_desktop_config.json"
385
- "Cursor" = "$AppData\\Cursor\\User\\globalStorage\\cursor.mcp\\config.json"
386
- "Windsurf" = "$UserProfile\\.codeium\\windsurf\\mcp_config.json"
387
- "Cline" = "$AppData\\Code\\User\\globalStorage\\saoudrizwan.claude-dev\\settings\\cline_mcp_settings.json"
388
- "Continue" = "$UserProfile\\.continue\\config.json"
389
- }
390
-
391
- Write-Host ""
392
- Write-Info "Scanning for MCP clients..."
393
- Write-Host ""
394
-
395
- $configured = 0
396
-
397
- foreach ($client in $ClientPaths.Keys) {
398
- $configPath = $ClientPaths[$client]
399
- $configDir = Split-Path -Parent $configPath
400
-
401
- if ((Test-Path $configDir) -or (Test-Path $configPath)) {
402
- Write-Info "Configuring $client..."
403
-
404
- try {
405
- Merge-Config -ConfigPath $configPath
406
- Write-Success "$client configured"
407
- $configured++
408
- } catch {
409
- Write-Err "Failed to configure $client: $_"
410
- }
411
- }
412
- }
413
-
414
- Write-Host ""
415
- Write-Host "=========================" -ForegroundColor Cyan
416
- Write-Host ""
417
-
418
- if ($configured -gt 0) {
419
- Write-Success "Configured $configured client(s)"
420
- Write-Host ""
421
- Write-Host "🎉 APIClaw is ready! Restart your MCP clients to activate." -ForegroundColor Green
422
- } else {
423
- Write-Warn "No MCP clients were detected."
424
- Write-Host ""
425
- Write-Host "Install one of these clients first:"
426
- Write-Host " • Claude Desktop: https://claude.ai/download"
427
- Write-Host " • Cursor: https://cursor.sh"
428
- Write-Host " • Windsurf: https://codeium.com/windsurf"
429
- }
430
-
431
- Write-Host ""
432
- `;
433
- }
434
- /**
435
- * Generate script based on target platform
436
- */
437
- export function generateScript(platform, options = {}) {
438
- // Auto-detect platform
439
- let targetPlatform = platform === 'auto'
440
- ? (process.platform === 'win32' ? 'powershell' : 'bash')
441
- : platform;
442
- if (targetPlatform === 'powershell') {
443
- return {
444
- script: generatePowerShellScript(options),
445
- filename: 'apiclaw-setup.ps1',
446
- platform: 'powershell',
447
- };
448
- }
449
- return {
450
- script: generateBashScript(options),
451
- filename: 'apiclaw-setup.sh',
452
- platform: 'bash',
453
- };
454
- }
455
- /**
456
- * Get file extension for platform
457
- */
458
- export function getScriptExtension(platform) {
459
- return platform === 'powershell' ? '.ps1' : '.sh';
460
- }