@secondlayer/cli 5.1.2 → 5.1.4

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.js CHANGED
@@ -32443,7 +32443,7 @@ var {
32443
32443
  // package.json
32444
32444
  var package_default = {
32445
32445
  name: "@secondlayer/cli",
32446
- version: "5.1.2",
32446
+ version: "5.1.4",
32447
32447
  description: "CLI for subgraphs and blockchain indexing on Stacks",
32448
32448
  type: "module",
32449
32449
  bin: {
@@ -32486,8 +32486,8 @@ var package_default = {
32486
32486
  dependencies: {
32487
32487
  "@inquirer/prompts": "^8.2.0",
32488
32488
  "@secondlayer/bundler": "^0.3.5",
32489
- "@secondlayer/sdk": "^3.3.2",
32490
- "@secondlayer/shared": "^6.3.1",
32489
+ "@secondlayer/sdk": "^3.5.4",
32490
+ "@secondlayer/shared": "^6.3.2",
32491
32491
  "@secondlayer/stacks": "^2.2.0",
32492
32492
  "@secondlayer/subgraphs": "^2.0.0",
32493
32493
  "@biomejs/js-api": "^0.7.0",
@@ -32551,7 +32551,7 @@ function withErrorHandling(fn, options) {
32551
32551
  }
32552
32552
  async function getTenantClient() {
32553
32553
  const { apiUrl, ephemeralKey } = await resolveActiveTenant();
32554
- return new SecondLayer({ baseUrl: apiUrl, apiKey: ephemeralKey });
32554
+ return new SecondLayer({ tenantBaseUrl: apiUrl, apiKey: ephemeralKey });
32555
32555
  }
32556
32556
  async function listSubgraphsApi() {
32557
32557
  return (await getTenantClient()).subgraphs.list();
@@ -34603,8 +34603,10 @@ init_fs();
34603
34603
  init_output();
34604
34604
 
34605
34605
  // src/commands/login.ts
34606
+ init_config();
34606
34607
  init_http();
34607
34608
  init_output();
34609
+ init_project_file();
34608
34610
  init_session();
34609
34611
  import { input as input2 } from "@inquirer/prompts";
34610
34612
  async function runLoginFlow() {
@@ -34646,7 +34648,7 @@ async function runLoginFlow() {
34646
34648
  expiresAt
34647
34649
  });
34648
34650
  success(`Logged in as ${verified.account.email}`);
34649
- info(dim("Run 'sl whoami' to see your account status."));
34651
+ await printPostLoginHints();
34650
34652
  } catch (err) {
34651
34653
  if (err instanceof CliHttpError) {
34652
34654
  error(err.message);
@@ -34656,6 +34658,56 @@ async function runLoginFlow() {
34656
34658
  process.exit(1);
34657
34659
  }
34658
34660
  }
34661
+ async function printPostLoginHints() {
34662
+ let activeSlug = null;
34663
+ let hasTenant = false;
34664
+ try {
34665
+ const config = await loadConfig();
34666
+ const active = await readActiveProject(process.cwd(), config.defaultProject);
34667
+ activeSlug = active?.slug ?? null;
34668
+ } catch {}
34669
+ try {
34670
+ const tenant = await httpPlatform("/api/tenants/me");
34671
+ hasTenant = Boolean(tenant.tenant?.apiUrl);
34672
+ } catch (err) {
34673
+ if (err instanceof CliHttpError && err.status === 404) {
34674
+ hasTenant = false;
34675
+ } else {
34676
+ info(dim("Run 'sl whoami' to see your account status."));
34677
+ return;
34678
+ }
34679
+ }
34680
+ console.log();
34681
+ if (hasTenant && activeSlug) {
34682
+ info(dim(`Active project: ${activeSlug}. Try ${cyan("sl subgraphs new --template basic")}`));
34683
+ return;
34684
+ }
34685
+ if (hasTenant && !activeSlug) {
34686
+ info("Your account has an instance. Bind a project to this directory:");
34687
+ console.log(dim(" ") + cyan("sl project use <slug>") + dim(" # list options with `sl project list`"));
34688
+ return;
34689
+ }
34690
+ if (!hasTenant && activeSlug) {
34691
+ info(`Project "${activeSlug}" is bound. Provision an instance to start indexing:`);
34692
+ console.log(dim(" ") + cyan("sl instance create --plan launch") + dim(" # $99/mo, 2 vCPU / 6GB"));
34693
+ return;
34694
+ }
34695
+ info("First time? Here's the path to your first query:");
34696
+ console.log();
34697
+ console.log(dim(" 1. ") + cyan("sl project create my-app"));
34698
+ console.log(dim(" ") + dim("# scopes your data and routing — pick any name"));
34699
+ console.log();
34700
+ console.log(dim(" 2. ") + cyan("sl instance create --plan launch"));
34701
+ console.log(dim(" ") + dim("# $99/mo · 2 vCPU / 6GB · run `sl --help` for other plans"));
34702
+ console.log();
34703
+ console.log(dim(" 3. ") + cyan("sl subgraphs new my-watcher --template sip-010-balances"));
34704
+ console.log(dim(" ") + dim("# five templates ship with the CLI"));
34705
+ console.log();
34706
+ console.log(dim(" 4. ") + cyan("sl subgraphs deploy subgraphs/my-watcher.ts"));
34707
+ console.log(dim(" ") + dim("# six seconds, backfill auto-starts"));
34708
+ console.log();
34709
+ info(dim("Run `sl whoami` at any time to see where you are in the flow."));
34710
+ }
34659
34711
  function registerLoginCommand(program2) {
34660
34712
  program2.command("login").description("Log in to Secondlayer (magic-link email)").action(runLoginFlow);
34661
34713
  }
@@ -37370,5 +37422,5 @@ registerAccountCommand(program);
37370
37422
  registerBillingCommand(program);
37371
37423
  program.parse();
37372
37424
 
37373
- //# debugId=7CC6836B298FCA6D64756E2164756E21
37425
+ //# debugId=96A767F30317D70164756E2164756E21
37374
37426
  //# sourceMappingURL=cli.js.map