@trading-boy/cli 1.2.6 → 1.2.8

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.
@@ -69,4 +69,10 @@ export declare function saveApiKey(apiKey: string, metadata: {
69
69
  }): Promise<void>;
70
70
  export declare function formatSubscribeSuccess(result: PollResult): string;
71
71
  export declare function registerSubscribeCommand(program: Command): void;
72
+ export interface RegisterResponse {
73
+ apiKey: string;
74
+ keyPrefix: string;
75
+ email: string;
76
+ plan: string;
77
+ }
72
78
  //# sourceMappingURL=subscribe.d.ts.map
@@ -251,9 +251,9 @@ export function registerSubscribeCommand(program) {
251
251
  plan = await select({
252
252
  message: 'Choose your plan',
253
253
  choices: [
254
- { name: 'Starter — $20/mo (core context + journal)', value: 'starter' },
255
- { name: 'Pro — $40/mo (+ coaching + thesis extraction)', value: 'pro' },
256
- { name: 'Edge — $75/mo (+ edge analysis + full analytics)', value: 'edge' },
254
+ { name: 'Starter — Free (core context + journal)', value: 'starter' },
255
+ { name: 'Pro — $29/mo (+ coaching + thesis extraction)', value: 'pro' },
256
+ { name: 'Edge — $99/mo (+ edge analysis + full analytics)', value: 'edge' },
257
257
  ],
258
258
  });
259
259
  }
@@ -263,7 +263,16 @@ export function registerSubscribeCommand(program) {
263
263
  process.exitCode = 1;
264
264
  return;
265
265
  }
266
- // Interactive payment method picker if not specified
266
+ const planLabels = { starter: 'Starter (Free)', pro: 'Pro ($29/mo)', edge: 'Edge ($99/mo)' };
267
+ // Free tier — skip payment entirely
268
+ if (plan === 'starter') {
269
+ console.log('');
270
+ console.log(` ${chalk.bold('Plan:')} ${planLabels[plan]}`);
271
+ console.log('');
272
+ await handleFreeRegistration(email);
273
+ return;
274
+ }
275
+ // Paid plans — pick payment method
267
276
  if (!pay) {
268
277
  pay = await select({
269
278
  message: 'How would you like to pay?',
@@ -279,7 +288,6 @@ export function registerSubscribeCommand(program) {
279
288
  process.exitCode = 1;
280
289
  return;
281
290
  }
282
- const planLabels = { starter: 'Starter ($20/mo)', pro: 'Pro ($40/mo)', edge: 'Edge ($75/mo)' };
283
291
  console.log('');
284
292
  console.log(` ${chalk.bold('Plan:')} ${planLabels[plan] ?? plan}`);
285
293
  console.log(` ${chalk.bold('Pay:')} ${pay === 'crypto' ? 'USDC on Solana' : 'Stripe'}`);
@@ -304,6 +312,38 @@ export function registerSubscribeCommand(program) {
304
312
  }
305
313
  });
306
314
  }
315
+ async function handleFreeRegistration(email) {
316
+ console.log(chalk.white(' Creating your free account...'));
317
+ let result;
318
+ try {
319
+ const response = await fetch(`${getApiBase()}/api/v1/auth/register`, {
320
+ method: 'POST',
321
+ headers: { 'Content-Type': 'application/json' },
322
+ body: JSON.stringify({ email }),
323
+ });
324
+ if (!response.ok) {
325
+ const body = await response.text();
326
+ throw new Error(`Registration failed (${response.status}): ${body}`);
327
+ }
328
+ result = await response.json();
329
+ }
330
+ catch (err) {
331
+ const message = err instanceof Error ? err.message : String(err);
332
+ console.error(chalk.red(` Failed to register: ${message}`));
333
+ const hint = formatConnectionError(message);
334
+ if (hint)
335
+ console.error(hint);
336
+ process.exitCode = 1;
337
+ return;
338
+ }
339
+ await storeAndDisplayKey({
340
+ success: true,
341
+ apiKey: result.apiKey,
342
+ keyPrefix: result.keyPrefix,
343
+ email: result.email,
344
+ plan: result.plan,
345
+ });
346
+ }
307
347
  // ─── Checkout Flows ───
308
348
  async function handleStripeCheckout(email, plan) {
309
349
  // Step 1: Create checkout session
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trading-boy/cli",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "Trading Boy CLI — crypto context intelligence for traders and AI agents",
5
5
  "publishConfig": {
6
6
  "access": "public"