rampkit-mcp-server 0.1.0

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 (62) hide show
  1. package/README.md +160 -0
  2. package/dist/api/rampkit.d.ts +96 -0
  3. package/dist/api/rampkit.d.ts.map +1 -0
  4. package/dist/api/rampkit.js +391 -0
  5. package/dist/api/rampkit.js.map +1 -0
  6. package/dist/detection/platform.d.ts +11 -0
  7. package/dist/detection/platform.d.ts.map +1 -0
  8. package/dist/detection/platform.js +420 -0
  9. package/dist/detection/platform.js.map +1 -0
  10. package/dist/index.d.ts +9 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +13 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/prompts/index.d.ts +24 -0
  15. package/dist/prompts/index.d.ts.map +1 -0
  16. package/dist/prompts/index.js +183 -0
  17. package/dist/prompts/index.js.map +1 -0
  18. package/dist/resources/authoring-guide.d.ts +9 -0
  19. package/dist/resources/authoring-guide.d.ts.map +1 -0
  20. package/dist/resources/authoring-guide.js +487 -0
  21. package/dist/resources/authoring-guide.js.map +1 -0
  22. package/dist/resources/best-practices.d.ts +8 -0
  23. package/dist/resources/best-practices.d.ts.map +1 -0
  24. package/dist/resources/best-practices.js +92 -0
  25. package/dist/resources/best-practices.js.map +1 -0
  26. package/dist/resources/index.d.ts +19 -0
  27. package/dist/resources/index.d.ts.map +1 -0
  28. package/dist/resources/index.js +236 -0
  29. package/dist/resources/index.js.map +1 -0
  30. package/dist/resources/schema.d.ts +42 -0
  31. package/dist/resources/schema.d.ts.map +1 -0
  32. package/dist/resources/schema.js +239 -0
  33. package/dist/resources/schema.js.map +1 -0
  34. package/dist/resources/sdk-guide.d.ts +7 -0
  35. package/dist/resources/sdk-guide.d.ts.map +1 -0
  36. package/dist/resources/sdk-guide.js +368 -0
  37. package/dist/resources/sdk-guide.js.map +1 -0
  38. package/dist/resources/templates.d.ts +9 -0
  39. package/dist/resources/templates.d.ts.map +1 -0
  40. package/dist/resources/templates.js +874 -0
  41. package/dist/resources/templates.js.map +1 -0
  42. package/dist/server.d.ts +10 -0
  43. package/dist/server.d.ts.map +1 -0
  44. package/dist/server.js +109 -0
  45. package/dist/server.js.map +1 -0
  46. package/dist/tools/instructions.d.ts +23 -0
  47. package/dist/tools/instructions.d.ts.map +1 -0
  48. package/dist/tools/instructions.js +74 -0
  49. package/dist/tools/instructions.js.map +1 -0
  50. package/dist/tools/onboarding.d.ts +211 -0
  51. package/dist/tools/onboarding.d.ts.map +1 -0
  52. package/dist/tools/onboarding.js +452 -0
  53. package/dist/tools/onboarding.js.map +1 -0
  54. package/dist/tools/setup.d.ts +61 -0
  55. package/dist/tools/setup.d.ts.map +1 -0
  56. package/dist/tools/setup.js +543 -0
  57. package/dist/tools/setup.js.map +1 -0
  58. package/dist/types.d.ts +280 -0
  59. package/dist/types.d.ts.map +1 -0
  60. package/dist/types.js +5 -0
  61. package/dist/types.js.map +1 -0
  62. package/package.json +51 -0
@@ -0,0 +1,543 @@
1
+ /**
2
+ * Setup Tools
3
+ *
4
+ * Tools for checking setup status and configuring RampKit.
5
+ * Progress is tracked in ~/.rampkit/setup-progress.json
6
+ * API key is stored in ~/.rampkit/config.json
7
+ */
8
+ import { z } from 'zod';
9
+ import * as fs from 'fs';
10
+ import * as path from 'path';
11
+ import * as os from 'os';
12
+ import { getRampKitClient, saveApiKeyToConfig, resetClient, isConfigured } from '../api/rampkit.js';
13
+ import { detectProject } from '../detection/platform.js';
14
+ // Progress file path
15
+ const CONFIG_DIR = path.join(os.homedir(), '.rampkit');
16
+ const PROGRESS_FILE = path.join(CONFIG_DIR, 'setup-progress.json');
17
+ export const SETUP_TOOLS = ['check_setup', 'set_api_key', 'complete_step'];
18
+ // Input schemas
19
+ const SetApiKeySchema = z.object({
20
+ apiKey: z.string().describe('Your RampKit API key (starts with pk_live_ or pk_test_)'),
21
+ });
22
+ const CompleteStepSchema = z.object({
23
+ stepId: z.string().describe('The step ID to mark as complete (e.g., "install_sdk", "create_account")'),
24
+ notes: z.string().optional().describe('Optional notes about what was done'),
25
+ });
26
+ export function setupTools() {
27
+ return [
28
+ {
29
+ name: 'check_setup',
30
+ description: 'Check RampKit setup status and get step-by-step instructions. Call this FIRST when user wants to configure or set up RampKit. Returns current status, saved progress, and detailed next steps.',
31
+ inputSchema: {
32
+ type: 'object',
33
+ properties: {},
34
+ required: [],
35
+ },
36
+ },
37
+ {
38
+ name: 'complete_step',
39
+ description: 'Mark a setup step as complete. Call this after completing each setup step to track progress. Progress is saved to ~/.rampkit/setup-progress.json.',
40
+ inputSchema: {
41
+ type: 'object',
42
+ properties: {
43
+ stepId: {
44
+ type: 'string',
45
+ description: 'The step ID to mark as complete (e.g., "install_sdk", "wrap_app", "create_account", "create_app", "add_init_code", "get_api_key", "configure_api_key")',
46
+ },
47
+ notes: {
48
+ type: 'string',
49
+ description: 'Optional notes about what was done (e.g., "Installed version 1.2.3")',
50
+ },
51
+ },
52
+ required: ['stepId'],
53
+ },
54
+ },
55
+ {
56
+ name: 'set_api_key',
57
+ description: 'Set your RampKit API key. Called during setup after user provides their key. Persists to ~/.rampkit/config.json and marks the API key step as complete.',
58
+ inputSchema: {
59
+ type: 'object',
60
+ properties: {
61
+ apiKey: {
62
+ type: 'string',
63
+ description: 'Your RampKit API key (starts with pk_live_ or pk_test_)',
64
+ },
65
+ },
66
+ required: ['apiKey'],
67
+ },
68
+ },
69
+ ];
70
+ }
71
+ export async function handleSetupTool(name, args) {
72
+ switch (name) {
73
+ case 'check_setup':
74
+ return formatResult(await checkSetup());
75
+ case 'complete_step': {
76
+ const { stepId, notes } = CompleteStepSchema.parse(args);
77
+ return formatResult(await completeStep(stepId, notes));
78
+ }
79
+ case 'set_api_key': {
80
+ const { apiKey } = SetApiKeySchema.parse(args);
81
+ return formatResult(await setApiKey(apiKey));
82
+ }
83
+ default:
84
+ throw new Error(`Unknown setup tool: ${name}`);
85
+ }
86
+ }
87
+ function formatResult(data) {
88
+ return {
89
+ content: [
90
+ {
91
+ type: 'text',
92
+ text: JSON.stringify(data, null, 2),
93
+ },
94
+ ],
95
+ };
96
+ }
97
+ function loadProgress() {
98
+ try {
99
+ if (fs.existsSync(PROGRESS_FILE)) {
100
+ const content = fs.readFileSync(PROGRESS_FILE, 'utf-8');
101
+ return JSON.parse(content);
102
+ }
103
+ }
104
+ catch {
105
+ // File doesn't exist or is invalid
106
+ }
107
+ return null;
108
+ }
109
+ function saveProgress(progress) {
110
+ try {
111
+ if (!fs.existsSync(CONFIG_DIR)) {
112
+ fs.mkdirSync(CONFIG_DIR, { recursive: true });
113
+ }
114
+ progress.updatedAt = new Date().toISOString();
115
+ fs.writeFileSync(PROGRESS_FILE, JSON.stringify(progress, null, 2));
116
+ }
117
+ catch (error) {
118
+ console.error('Failed to save progress:', error);
119
+ }
120
+ }
121
+ function initProgress(platform, bundleId) {
122
+ const existing = loadProgress();
123
+ if (existing) {
124
+ // Update with new detection info if available
125
+ if (platform)
126
+ existing.platform = platform;
127
+ if (bundleId)
128
+ existing.bundleId = bundleId;
129
+ return existing;
130
+ }
131
+ return {
132
+ startedAt: new Date().toISOString(),
133
+ updatedAt: new Date().toISOString(),
134
+ platform,
135
+ bundleId,
136
+ appId: null,
137
+ completedSteps: {},
138
+ };
139
+ }
140
+ /**
141
+ * Mark a step as complete
142
+ */
143
+ async function completeStep(stepId, notes) {
144
+ const progress = loadProgress() || initProgress(null, null);
145
+ progress.completedSteps[stepId] = {
146
+ completedAt: new Date().toISOString(),
147
+ notes,
148
+ };
149
+ saveProgress(progress);
150
+ return {
151
+ success: true,
152
+ message: `Step "${stepId}" marked as complete.`,
153
+ stepId,
154
+ progress,
155
+ };
156
+ }
157
+ /**
158
+ * Check setup status and return step-by-step instructions
159
+ */
160
+ async function checkSetup() {
161
+ // Detect project
162
+ const detection = await detectProject();
163
+ // Check API key status
164
+ const apiKeyConfigured = isConfigured();
165
+ let appName = null;
166
+ let appId = null;
167
+ if (apiKeyConfigured) {
168
+ const client = getRampKitClient();
169
+ const cachedApp = client.getCachedApp();
170
+ if (cachedApp) {
171
+ appName = cachedApp.name;
172
+ appId = cachedApp.id;
173
+ }
174
+ else {
175
+ const validation = await client.validateApiKey();
176
+ if (validation.valid && validation.app) {
177
+ appName = validation.app.name;
178
+ appId = validation.app.id;
179
+ }
180
+ }
181
+ }
182
+ // Load or initialize progress
183
+ const progress = initProgress(detection.platform, detection.bundleId);
184
+ if (appId)
185
+ progress.appId = appId;
186
+ saveProgress(progress);
187
+ // Build steps based on platform and progress
188
+ const steps = buildSetupSteps(detection, apiKeyConfigured, appId, progress);
189
+ // Find first incomplete step
190
+ const nextStep = steps.find(s => s.status !== 'done') || null;
191
+ // Count completed
192
+ const completedStepsCount = steps.filter(s => s.status === 'done').length;
193
+ return {
194
+ currentStatus: {
195
+ sdkInstalled: detection.sdkInstalled,
196
+ apiKeyConfigured,
197
+ appName,
198
+ appId,
199
+ setupStarted: Object.keys(progress.completedSteps).length > 0,
200
+ completedStepsCount,
201
+ totalSteps: steps.length,
202
+ },
203
+ detectedProject: {
204
+ platform: detection.platform,
205
+ bundleId: detection.bundleId,
206
+ appName: detection.appName,
207
+ iosDeploymentTarget: detection.iosDeploymentTarget,
208
+ androidMinSdk: detection.androidMinSdk,
209
+ },
210
+ progress,
211
+ steps,
212
+ nextStep,
213
+ finalPrompt: "Setup complete! Ask the user: 'Do you have an existing onboarding flow you'd like to port over to RampKit, or would you like me to create a new one for you?'",
214
+ };
215
+ }
216
+ function buildSetupSteps(detection, apiKeyConfigured, appId, progress) {
217
+ const platform = detection.platform || 'unknown';
218
+ const steps = [];
219
+ let stepNum = 1;
220
+ // Helper to check if step is done
221
+ const isStepDone = (stepId) => {
222
+ return !!progress.completedSteps[stepId];
223
+ };
224
+ const getStepInfo = (stepId) => {
225
+ const info = progress.completedSteps[stepId];
226
+ return info ? { completedAt: info.completedAt, completedNotes: info.notes } : {};
227
+ };
228
+ // Step: Check platform requirements (iOS 14+ / Android API 24+)
229
+ const requirementsStepId = 'check_requirements';
230
+ const requirementsDone = isStepDone(requirementsStepId);
231
+ steps.push({
232
+ id: requirementsStepId,
233
+ step: stepNum++,
234
+ title: 'Check platform requirements',
235
+ status: requirementsDone ? 'done' : 'unknown',
236
+ instruction: requirementsDone
237
+ ? 'Platform requirements verified.'
238
+ : 'Check that the project meets RampKit requirements. Look at app.json, Podfile, or build.gradle to verify:',
239
+ notes: requirementsDone ? undefined : `Requirements:
240
+ - iOS: deployment target must be 14.0 or higher
241
+ - Android: minSdkVersion must be 24 or higher
242
+
243
+ For Expo: check app.json for expo.ios.deploymentTarget and expo.android.minSdkVersion
244
+ For React Native: check ios/Podfile and android/app/build.gradle
245
+ For native iOS: check Xcode project settings (IPHONEOS_DEPLOYMENT_TARGET)
246
+ For native Android: check app/build.gradle
247
+
248
+ After verifying (or updating if needed), call complete_step with stepId "check_requirements".`,
249
+ ...getStepInfo(requirementsStepId),
250
+ });
251
+ // Step: Install SDK
252
+ const installStepId = 'install_sdk';
253
+ if (platform === 'react-native' || platform === 'expo') {
254
+ const isDone = detection.sdkInstalled || isStepDone(installStepId);
255
+ steps.push({
256
+ id: installStepId,
257
+ step: stepNum++,
258
+ title: 'Install the RampKit SDK',
259
+ status: isDone ? 'done' : 'not_done',
260
+ instruction: isDone
261
+ ? 'SDK is already installed.'
262
+ : 'Run the following command to install the RampKit SDK and its peer dependencies:',
263
+ command: isDone ? undefined : 'npm install rampkit-expo-dev && npx expo install react-native-webview react-native-pager-view react-native-root-siblings',
264
+ notes: isDone ? undefined : 'This installs the SDK and required native dependencies. After running, call complete_step with stepId "install_sdk".',
265
+ ...getStepInfo(installStepId),
266
+ });
267
+ // Step 2: Wrap app with RootSiblingParent
268
+ const wrapStepId = 'wrap_app';
269
+ const wrapDone = isStepDone(wrapStepId);
270
+ steps.push({
271
+ id: wrapStepId,
272
+ step: stepNum++,
273
+ title: 'Wrap your app with RootSiblingParent',
274
+ status: wrapDone ? 'done' : 'unknown',
275
+ instruction: wrapDone
276
+ ? 'App wrapper is configured.'
277
+ : 'Check if the app is wrapped with RootSiblingParent. If not, add it to enable overlay display. After adding, call complete_step with stepId "wrap_app".',
278
+ file: 'App.tsx (or your root component)',
279
+ code: wrapDone ? undefined : `import { RootSiblingParent } from 'react-native-root-siblings';
280
+
281
+ export default function App() {
282
+ return (
283
+ <RootSiblingParent>
284
+ {/* Your existing app content */}
285
+ </RootSiblingParent>
286
+ );
287
+ }`,
288
+ notes: wrapDone ? undefined : 'RootSiblingParent is required for RampKit to display onboarding overlays.',
289
+ ...getStepInfo(wrapStepId),
290
+ });
291
+ }
292
+ else if (platform === 'ios') {
293
+ const isDone = detection.sdkInstalled || isStepDone(installStepId);
294
+ steps.push({
295
+ id: installStepId,
296
+ step: stepNum++,
297
+ title: 'Install the RampKit SDK',
298
+ status: isDone ? 'done' : 'not_done',
299
+ instruction: isDone
300
+ ? 'SDK is already installed.'
301
+ : 'Add RampKit via Swift Package Manager in Xcode:',
302
+ code: isDone ? undefined : `// In Xcode:
303
+ // 1. File → Add Package Dependencies
304
+ // 2. Enter: https://github.com/getrampkit/rampkit-ios.git
305
+ // 3. Select version 1.0.0 or "Up to Next Major"
306
+ // 4. Add to your target
307
+
308
+ // Or in Package.swift:
309
+ dependencies: [
310
+ .package(url: "https://github.com/getrampkit/rampkit-ios.git", from: "1.0.0")
311
+ ]`,
312
+ notes: isDone ? undefined : 'After adding the package, call complete_step with stepId "install_sdk".',
313
+ ...getStepInfo(installStepId),
314
+ });
315
+ }
316
+ else if (platform === 'android') {
317
+ const isDone = detection.sdkInstalled || isStepDone(installStepId);
318
+ steps.push({
319
+ id: installStepId,
320
+ step: stepNum++,
321
+ title: 'Install the RampKit SDK',
322
+ status: isDone ? 'done' : 'not_done',
323
+ instruction: isDone
324
+ ? 'SDK is already installed.'
325
+ : 'Add RampKit to your app build.gradle:',
326
+ code: isDone ? undefined : `// In app/build.gradle
327
+ dependencies {
328
+ implementation "com.rampkit:sdk:1.0.0"
329
+ }`,
330
+ command: isDone ? undefined : './gradlew sync',
331
+ notes: isDone ? undefined : 'After syncing, call complete_step with stepId "install_sdk".',
332
+ ...getStepInfo(installStepId),
333
+ });
334
+ }
335
+ else {
336
+ steps.push({
337
+ id: installStepId,
338
+ step: stepNum++,
339
+ title: 'Install the RampKit SDK',
340
+ status: isStepDone(installStepId) ? 'done' : 'unknown',
341
+ instruction: 'Could not detect project type. Ask the user what platform they are using (iOS, Android, React Native, or Expo).',
342
+ askUser: 'What platform is your app built on? (iOS native, Android native, React Native, or Expo)',
343
+ ...getStepInfo(installStepId),
344
+ });
345
+ }
346
+ // Step 3: Create RampKit account
347
+ const accountStepId = 'create_account';
348
+ const accountDone = isStepDone(accountStepId);
349
+ steps.push({
350
+ id: accountStepId,
351
+ step: stepNum++,
352
+ title: 'Create a RampKit account',
353
+ status: accountDone ? 'done' : 'unknown',
354
+ instruction: accountDone
355
+ ? 'User has a RampKit account.'
356
+ : 'Ask the user if they have a RampKit account. After they confirm, call complete_step with stepId "create_account".',
357
+ askUser: accountDone ? undefined : 'Do you have a RampKit account? If not, please sign up at https://www.rampkit.com/sign-in?mode=signup and let me know when you\'re done.',
358
+ ...getStepInfo(accountStepId),
359
+ });
360
+ // Step 4: Create app in dashboard
361
+ const createAppStepId = 'create_app';
362
+ const createAppDone = appId !== null || isStepDone(createAppStepId);
363
+ const bundleIdNote = detection.bundleId
364
+ ? `Use bundle ID: ${detection.bundleId}`
365
+ : 'Enter your app\'s bundle identifier';
366
+ steps.push({
367
+ id: createAppStepId,
368
+ step: stepNum++,
369
+ title: 'Create an app in RampKit dashboard',
370
+ status: createAppDone ? 'done' : 'unknown',
371
+ instruction: createAppDone
372
+ ? `App configured${appId ? `: ${appId}` : ''}.`
373
+ : 'Ask the user to create an app in the RampKit dashboard. After they confirm, call complete_step with stepId "create_app".',
374
+ askUser: createAppDone ? undefined : `Please create a new app in the RampKit dashboard at https://www.rampkit.com/dashboard. ${bundleIdNote}. Let me know when you've created it.`,
375
+ ...getStepInfo(createAppStepId),
376
+ });
377
+ // Step 5: Get App ID and add initialization code
378
+ const initCodeStepId = 'add_init_code';
379
+ const initCodeDone = isStepDone(initCodeStepId);
380
+ if (platform === 'react-native' || platform === 'expo') {
381
+ steps.push({
382
+ id: initCodeStepId,
383
+ step: stepNum++,
384
+ title: 'Add SDK initialization code',
385
+ status: initCodeDone ? 'done' : 'unknown',
386
+ instruction: initCodeDone
387
+ ? 'SDK initialization code is added.'
388
+ : 'Add the RampKit initialization code to your app. Ask the user for their App ID from the dashboard. After adding the code, call complete_step with stepId "add_init_code".',
389
+ askUser: initCodeDone ? undefined : 'What is your App ID? You can find it in the RampKit dashboard under your app settings.',
390
+ file: 'App.tsx or a startup file',
391
+ code: initCodeDone ? undefined : `import { RampKit } from 'rampkit-expo-dev';
392
+
393
+ // Initialize RampKit on app start (e.g., in useEffect or before app renders)
394
+ await RampKit.configure({
395
+ appId: 'YOUR_APP_ID', // Replace with actual App ID
396
+ environment: 'production',
397
+ autoShowOnboarding: false, // Set to true to auto-show on first launch
398
+ });
399
+
400
+ // To show onboarding manually:
401
+ // RampKit.showOnboarding();`,
402
+ notes: initCodeDone ? undefined : 'Replace YOUR_APP_ID with the App ID from the dashboard.',
403
+ ...getStepInfo(initCodeStepId),
404
+ });
405
+ }
406
+ else if (platform === 'ios') {
407
+ steps.push({
408
+ id: initCodeStepId,
409
+ step: stepNum++,
410
+ title: 'Add SDK initialization code',
411
+ status: initCodeDone ? 'done' : 'unknown',
412
+ instruction: initCodeDone
413
+ ? 'SDK initialization code is added.'
414
+ : 'Add the RampKit initialization code to your app. For SwiftUI apps, add it to your @main App init. For UIKit, add it to AppDelegate. After adding, call complete_step with stepId "add_init_code".',
415
+ askUser: initCodeDone ? undefined : 'What is your App ID? You can find it in the RampKit dashboard under your app settings.',
416
+ file: 'App.swift (SwiftUI) or AppDelegate.swift (UIKit)',
417
+ code: initCodeDone ? undefined : `import RampKit
418
+
419
+ // Call once at app launch (e.g., in AppDelegate or @main App init)
420
+ Task {
421
+ await RampKit.configure(config: RampKitConfig(
422
+ appId: "YOUR_APP_ID",
423
+ environment: "production",
424
+ autoShowOnboarding: false,
425
+ appUserID: nil, // optional user ID
426
+ verboseLogging: false,
427
+ onOnboardingFinished: { payload in
428
+ print("Onboarding finished", payload ?? "")
429
+ },
430
+ onShowPaywall: { payload in
431
+ // Present your paywall here
432
+ }
433
+ ))
434
+ }
435
+
436
+ // To show onboarding manually:
437
+ // RampKit.showOnboarding()
438
+
439
+ // To close onboarding:
440
+ // RampKit.closeOnboarding()
441
+
442
+ // To get user answers from onboarding:
443
+ // let answers = RampKit.getAnswers()
444
+ // let singleAnswer = RampKit.getAnswer("questionId")`,
445
+ notes: initCodeDone ? undefined : 'Note: StoreKit 2 transactions are automatically tracked on iOS 15+.',
446
+ ...getStepInfo(initCodeStepId),
447
+ });
448
+ }
449
+ else if (platform === 'android') {
450
+ steps.push({
451
+ id: initCodeStepId,
452
+ step: stepNum++,
453
+ title: 'Add SDK initialization code',
454
+ status: initCodeDone ? 'done' : 'unknown',
455
+ instruction: initCodeDone
456
+ ? 'SDK initialization code is added.'
457
+ : 'Add the RampKit initialization code to your Application class. After adding, call complete_step with stepId "add_init_code".',
458
+ askUser: initCodeDone ? undefined : 'What is your App ID? You can find it in the RampKit dashboard under your app settings.',
459
+ file: 'Application.kt or MainActivity.kt',
460
+ code: initCodeDone ? undefined : `import com.rampkit.sdk.RampKit
461
+
462
+ class MyApplication : Application() {
463
+ override fun onCreate() {
464
+ super.onCreate()
465
+ RampKit.configure(this, "YOUR_APP_ID")
466
+ }
467
+ }
468
+
469
+ // To show onboarding:
470
+ // RampKit.showOnboarding(activity)`,
471
+ ...getStepInfo(initCodeStepId),
472
+ });
473
+ }
474
+ // Step 6: Get API key
475
+ const getApiKeyStepId = 'get_api_key';
476
+ const getApiKeyDone = apiKeyConfigured || isStepDone(getApiKeyStepId);
477
+ steps.push({
478
+ id: getApiKeyStepId,
479
+ step: stepNum++,
480
+ title: 'Get your API key',
481
+ status: getApiKeyDone ? 'done' : 'not_done',
482
+ instruction: getApiKeyDone
483
+ ? 'API key is configured.'
484
+ : 'Ask the user to get their API key from the dashboard. Once they provide it, call set_api_key with the key.',
485
+ askUser: getApiKeyDone ? undefined : 'Please get your API key from https://www.rampkit.com/dashboard → Settings → API Keys. Paste it here and I\'ll configure it for you.',
486
+ notes: getApiKeyDone ? undefined : 'The API key starts with pk_live_ or pk_test_. Use set_api_key tool to save it.',
487
+ ...getStepInfo(getApiKeyStepId),
488
+ });
489
+ return steps;
490
+ }
491
+ /**
492
+ * Set and persist the API key to ~/.rampkit/config.json
493
+ */
494
+ async function setApiKey(apiKey) {
495
+ // Validate format
496
+ if (!apiKey.startsWith('pk_live_') && !apiKey.startsWith('pk_test_')) {
497
+ return {
498
+ success: false,
499
+ message: 'Invalid API key format. Key should start with pk_live_ or pk_test_',
500
+ };
501
+ }
502
+ // Save to global config file (~/.rampkit/config.json)
503
+ const saveResult = saveApiKeyToConfig(apiKey);
504
+ if (!saveResult.success) {
505
+ return {
506
+ success: false,
507
+ message: saveResult.error || 'Failed to save API key',
508
+ };
509
+ }
510
+ // Reset client so it picks up the new key
511
+ resetClient();
512
+ // Validate the key by calling the API
513
+ const client = getRampKitClient();
514
+ const validation = await client.validateApiKey();
515
+ if (!validation.valid) {
516
+ return {
517
+ success: false,
518
+ message: `API key saved but validation failed: ${validation.error}`,
519
+ };
520
+ }
521
+ // Mark the API key step as complete
522
+ const progress = loadProgress() || initProgress(null, null);
523
+ progress.completedSteps['get_api_key'] = {
524
+ completedAt: new Date().toISOString(),
525
+ notes: `Connected to app: ${validation.app?.name}`,
526
+ };
527
+ if (validation.app?.id) {
528
+ progress.appId = validation.app.id;
529
+ }
530
+ saveProgress(progress);
531
+ const dashboardUrl = validation.app
532
+ ? `https://www.rampkit.com/app/${validation.app.id}/dashboard`
533
+ : 'https://www.rampkit.com/dashboard';
534
+ return {
535
+ success: true,
536
+ message: `API key configured! Connected to "${validation.app?.name}".`,
537
+ appName: validation.app?.name,
538
+ appId: validation.app?.id,
539
+ dashboardUrl,
540
+ nextStep: "Setup complete! Ask the user: 'Do you have an existing onboarding flow you'd like to port over to RampKit, or would you like me to create a new one for you?'",
541
+ };
542
+ }
543
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/tools/setup.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,qBAAqB;AACrB,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC;AACvD,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAC;AAEnE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,aAAa,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;AAE3E,gBAAgB;AAChB,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC;CACvF,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yEAAyE,CAAC;IACtG,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAo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