@trading-boy/cli 1.2.7 → 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.
- package/dist/cli.bundle.js +42 -4
- package/dist/commands/subscribe.d.ts +6 -0
- package/dist/commands/subscribe.js +45 -5
- package/package.json +1 -1
package/dist/cli.bundle.js
CHANGED
|
@@ -46371,9 +46371,9 @@ function registerSubscribeCommand(program2) {
|
|
|
46371
46371
|
plan = await select({
|
|
46372
46372
|
message: "Choose your plan",
|
|
46373
46373
|
choices: [
|
|
46374
|
-
{ name: "Starter \u2014
|
|
46375
|
-
{ name: "Pro \u2014 $
|
|
46376
|
-
{ name: "Edge \u2014 $
|
|
46374
|
+
{ name: "Starter \u2014 Free (core context + journal)", value: "starter" },
|
|
46375
|
+
{ name: "Pro \u2014 $29/mo (+ coaching + thesis extraction)", value: "pro" },
|
|
46376
|
+
{ name: "Edge \u2014 $99/mo (+ edge analysis + full analytics)", value: "edge" }
|
|
46377
46377
|
]
|
|
46378
46378
|
});
|
|
46379
46379
|
}
|
|
@@ -46383,6 +46383,14 @@ function registerSubscribeCommand(program2) {
|
|
|
46383
46383
|
process.exitCode = 1;
|
|
46384
46384
|
return;
|
|
46385
46385
|
}
|
|
46386
|
+
const planLabels = { starter: "Starter (Free)", pro: "Pro ($29/mo)", edge: "Edge ($99/mo)" };
|
|
46387
|
+
if (plan === "starter") {
|
|
46388
|
+
console.log("");
|
|
46389
|
+
console.log(` ${source_default.bold("Plan:")} ${planLabels[plan]}`);
|
|
46390
|
+
console.log("");
|
|
46391
|
+
await handleFreeRegistration(email3);
|
|
46392
|
+
return;
|
|
46393
|
+
}
|
|
46386
46394
|
if (!pay) {
|
|
46387
46395
|
pay = await select({
|
|
46388
46396
|
message: "How would you like to pay?",
|
|
@@ -46398,7 +46406,6 @@ function registerSubscribeCommand(program2) {
|
|
|
46398
46406
|
process.exitCode = 1;
|
|
46399
46407
|
return;
|
|
46400
46408
|
}
|
|
46401
|
-
const planLabels = { starter: "Starter ($20/mo)", pro: "Pro ($40/mo)", edge: "Edge ($75/mo)" };
|
|
46402
46409
|
console.log("");
|
|
46403
46410
|
console.log(` ${source_default.bold("Plan:")} ${planLabels[plan] ?? plan}`);
|
|
46404
46411
|
console.log(` ${source_default.bold("Pay:")} ${pay === "crypto" ? "USDC on Solana" : "Stripe"}`);
|
|
@@ -46420,6 +46427,37 @@ function registerSubscribeCommand(program2) {
|
|
|
46420
46427
|
}
|
|
46421
46428
|
});
|
|
46422
46429
|
}
|
|
46430
|
+
async function handleFreeRegistration(email3) {
|
|
46431
|
+
console.log(source_default.white(" Creating your free account..."));
|
|
46432
|
+
let result;
|
|
46433
|
+
try {
|
|
46434
|
+
const response = await fetch(`${getApiBase()}/api/v1/auth/register`, {
|
|
46435
|
+
method: "POST",
|
|
46436
|
+
headers: { "Content-Type": "application/json" },
|
|
46437
|
+
body: JSON.stringify({ email: email3 })
|
|
46438
|
+
});
|
|
46439
|
+
if (!response.ok) {
|
|
46440
|
+
const body = await response.text();
|
|
46441
|
+
throw new Error(`Registration failed (${response.status}): ${body}`);
|
|
46442
|
+
}
|
|
46443
|
+
result = await response.json();
|
|
46444
|
+
} catch (err) {
|
|
46445
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
46446
|
+
console.error(source_default.red(` Failed to register: ${message}`));
|
|
46447
|
+
const hint = formatConnectionError2(message);
|
|
46448
|
+
if (hint)
|
|
46449
|
+
console.error(hint);
|
|
46450
|
+
process.exitCode = 1;
|
|
46451
|
+
return;
|
|
46452
|
+
}
|
|
46453
|
+
await storeAndDisplayKey({
|
|
46454
|
+
success: true,
|
|
46455
|
+
apiKey: result.apiKey,
|
|
46456
|
+
keyPrefix: result.keyPrefix,
|
|
46457
|
+
email: result.email,
|
|
46458
|
+
plan: result.plan
|
|
46459
|
+
});
|
|
46460
|
+
}
|
|
46423
46461
|
async function handleStripeCheckout(email3, plan) {
|
|
46424
46462
|
let checkout;
|
|
46425
46463
|
try {
|
|
@@ -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 —
|
|
255
|
-
{ name: 'Pro — $
|
|
256
|
-
{ name: '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
|
-
|
|
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
|