starkbot-cli 0.1.2 → 0.1.3
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/index.js +2 -33
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -597,14 +597,6 @@ async function provisionCommand() {
|
|
|
597
597
|
const spin = spinner("Checking instance status...");
|
|
598
598
|
spin.start();
|
|
599
599
|
try {
|
|
600
|
-
const me = await client.getMe();
|
|
601
|
-
const creditBalance = me.credits?.balance ?? 0;
|
|
602
|
-
const hasSubscription = me.subscription && me.subscription.status === "active";
|
|
603
|
-
if (!hasSubscription && creditBalance <= 0) {
|
|
604
|
-
spin.stop();
|
|
605
|
-
printWarning("No credits available. Run `starkbot subscribe` to add credits first.");
|
|
606
|
-
return;
|
|
607
|
-
}
|
|
608
600
|
spin.text = "Provisioning your Starkbot instance...";
|
|
609
601
|
const result = await client.provision();
|
|
610
602
|
if (result.success) {
|
|
@@ -1429,7 +1421,7 @@ async function wizardCommand() {
|
|
|
1429
1421
|
createSpin.start();
|
|
1430
1422
|
try {
|
|
1431
1423
|
me = await client.createInstance(displayName || void 0);
|
|
1432
|
-
updateCredentials({ tenant_id: me.tenant.id, gateway_token: void 0, instance_domain: void 0 });
|
|
1424
|
+
updateCredentials({ jwt: me.jwt, tenant_id: me.tenant.id, gateway_token: void 0, instance_domain: void 0 });
|
|
1433
1425
|
createSpin.succeed("Instance created");
|
|
1434
1426
|
} catch (err) {
|
|
1435
1427
|
createSpin.fail("Failed to create instance");
|
|
@@ -1441,7 +1433,7 @@ async function wizardCommand() {
|
|
|
1441
1433
|
switchSpin.start();
|
|
1442
1434
|
try {
|
|
1443
1435
|
me = await client.switchInstance(instanceChoice);
|
|
1444
|
-
updateCredentials({ tenant_id: me.tenant.id, gateway_token: void 0, instance_domain: void 0 });
|
|
1436
|
+
updateCredentials({ jwt: me.jwt, tenant_id: me.tenant.id, gateway_token: void 0, instance_domain: void 0 });
|
|
1445
1437
|
switchSpin.succeed(`Switched to instance ${me.tenant.domain || instanceChoice}`);
|
|
1446
1438
|
} catch (err) {
|
|
1447
1439
|
switchSpin.fail("Failed to switch instance");
|
|
@@ -1453,28 +1445,6 @@ async function wizardCommand() {
|
|
|
1453
1445
|
}
|
|
1454
1446
|
console.log();
|
|
1455
1447
|
}
|
|
1456
|
-
const creditBalance = me.credits?.balance ?? 0;
|
|
1457
|
-
const hasCredits = creditBalance > 0;
|
|
1458
|
-
const hasSubscription = me.subscription && me.subscription.status === "active";
|
|
1459
|
-
if (!hasCredits && !hasSubscription) {
|
|
1460
|
-
console.log(bold("\n Subscribe\n"));
|
|
1461
|
-
await subscribeCommand();
|
|
1462
|
-
try {
|
|
1463
|
-
me = await client.getMe();
|
|
1464
|
-
} catch {
|
|
1465
|
-
return;
|
|
1466
|
-
}
|
|
1467
|
-
const recheckCredits = me.credits?.balance ?? 0;
|
|
1468
|
-
const recheckSub = me.subscription && me.subscription.status === "active";
|
|
1469
|
-
if (recheckCredits <= 0 && !recheckSub) {
|
|
1470
|
-
printWarning("Credits required to continue. Run `starkbot subscribe` when ready.");
|
|
1471
|
-
return;
|
|
1472
|
-
}
|
|
1473
|
-
console.log();
|
|
1474
|
-
} else {
|
|
1475
|
-
const formattedCredits = (creditBalance / 1e6).toFixed(2);
|
|
1476
|
-
printSuccess(`$${formattedCredits} credits available`);
|
|
1477
|
-
}
|
|
1478
1448
|
console.log(bold("\n Provision your bot\n"));
|
|
1479
1449
|
await provisionCommand();
|
|
1480
1450
|
console.log();
|
|
@@ -1510,7 +1480,6 @@ var init_wizard = __esm({
|
|
|
1510
1480
|
init_ui();
|
|
1511
1481
|
init_login();
|
|
1512
1482
|
init_logout();
|
|
1513
|
-
init_subscribe();
|
|
1514
1483
|
init_provision();
|
|
1515
1484
|
init_connect();
|
|
1516
1485
|
init_chat();
|