@secondlayer/cli 4.0.0 → 5.0.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.
package/README.md CHANGED
@@ -20,7 +20,7 @@ bun add -g @secondlayer/cli
20
20
  sl login
21
21
  sl project create my-app
22
22
  sl project use my-app
23
- sl instance create --plan hobby
23
+ sl instance create --plan launch
24
24
 
25
25
  sl subgraphs scaffold SP1234ABCD.my-contract -o subgraphs/my-contract.ts
26
26
  sl subgraphs deploy subgraphs/my-contract.ts --start-block <recent-block>
@@ -74,7 +74,7 @@ One instance per project. The platform API spawns a dedicated `sl-pg-{slug}`,
74
74
 
75
75
  | Command | What it does |
76
76
  |---|---|
77
- | `sl instance create --plan <hobby\|launch\|grow\|scale>` | Provision containers. Boxed reveal of `serviceKey` + `anonKey` (shown once). |
77
+ | `sl instance create --plan <launch\|scale>` | Provision containers after trial/subscription activation. Boxed reveal of `serviceKey` + `anonKey` (shown once). |
78
78
  | `sl instance info` | Plan, status, resource usage |
79
79
  | `sl instance resize --plan <...>` | Recreate containers with new CPU/memory (~30s downtime) |
80
80
  | `sl instance suspend` / `resume` | Stop/start containers, volume preserved |
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: "4.0.0",
32446
+ version: "5.0.0",
32447
32447
  description: "CLI for subgraphs and blockchain indexing on Stacks",
32448
32448
  type: "module",
32449
32449
  bin: {
@@ -32485,11 +32485,11 @@ var package_default = {
32485
32485
  license: "MIT",
32486
32486
  dependencies: {
32487
32487
  "@inquirer/prompts": "^8.2.0",
32488
- "@secondlayer/bundler": "^0.3.4",
32489
- "@secondlayer/sdk": "^3.3.1",
32490
- "@secondlayer/shared": "^5.0.0",
32488
+ "@secondlayer/bundler": "^0.3.5",
32489
+ "@secondlayer/sdk": "^3.3.2",
32490
+ "@secondlayer/shared": "^6.0.0",
32491
32491
  "@secondlayer/stacks": "^2.0.1",
32492
- "@secondlayer/subgraphs": "^1.3.3",
32492
+ "@secondlayer/subgraphs": "^2.0.0",
32493
32493
  "@biomejs/js-api": "^0.7.0",
32494
32494
  "@biomejs/wasm-nodejs": "^1.9.0",
32495
32495
  esbuild: "^0.19.0",
@@ -36302,12 +36302,12 @@ import { confirm as confirm5, input as input4, select as select4 } from "@inquir
36302
36302
  var INSTANCE_CREATE_TIMEOUT_MS = 180000;
36303
36303
  function registerInstanceCommand(program2) {
36304
36304
  const instance = program2.command("instance").description("Manage your dedicated Secondlayer instance");
36305
- instance.command("create").description("Provision a new dedicated instance for the active project").option("--plan <plan>", "Plan: hobby (free) | launch | scale", "hobby").action(async (opts) => {
36305
+ instance.command("create").description("Provision a new dedicated instance for the active project").option("--plan <plan>", "Plan: launch | scale", "launch").action(async (opts) => {
36306
36306
  guardOssMode();
36307
36307
  const activeSlug = await requireActiveProject();
36308
36308
  const plan = opts.plan;
36309
- if (!["hobby", "launch", "scale"].includes(plan)) {
36310
- error(`Invalid plan: ${plan} (expected hobby, launch, or scale)`);
36309
+ if (!["launch", "scale"].includes(plan)) {
36310
+ error(`Invalid plan: ${plan} (expected launch or scale)`);
36311
36311
  process.exit(1);
36312
36312
  }
36313
36313
  const spinner = createSpinner("Provisioning your instance (~60s; safe to interrupt — instance will still be created; check `sl instance info`)");
@@ -36325,6 +36325,11 @@ function registerInstanceCommand(program2) {
36325
36325
  error("Provisioning may still finish server-side. Run `sl instance info` to check before retrying.");
36326
36326
  process.exit(1);
36327
36327
  }
36328
+ if (err instanceof CliHttpError && err.code === "SUBSCRIPTION_REQUIRED") {
36329
+ spinner.fail("Trial required before provisioning.");
36330
+ await printTrialCheckoutUrl(plan);
36331
+ process.exit(1);
36332
+ }
36328
36333
  spinner.fail("Provision failed.");
36329
36334
  handleInstanceError(err, "provision instance");
36330
36335
  }
@@ -36333,29 +36338,29 @@ function registerInstanceCommand(program2) {
36333
36338
  guardOssMode();
36334
36339
  await renderInstanceInfo();
36335
36340
  });
36336
- instance.command("resize").description("Change your instance plan (brief downtime)").option("--plan <plan>", "Target plan: hobby | launch | scale").option("--yes", "Skip confirm").action(async (opts) => {
36341
+ instance.command("resize").description("Change your instance plan (brief downtime)").option("--plan <plan>", "Target plan: launch | scale").option("--yes", "Skip confirm").action(async (opts) => {
36337
36342
  guardOssMode();
36338
36343
  let target = opts.plan;
36339
36344
  if (!target) {
36340
36345
  const answer = await select4({
36341
36346
  message: "Target plan",
36342
36347
  choices: [
36343
- {
36344
- value: "hobby",
36345
- name: "Hobby — free (0.5 vCPU · 512 MB · 5 GB, auto-pause after 7d idle)"
36346
- },
36347
36348
  {
36348
36349
  value: "launch",
36349
- name: "Launch — $50/mo (1 vCPU · 2 GB · 25 GB)"
36350
+ name: "Launch — $99/mo (2 vCPU · 6 GB · 100 GB)"
36350
36351
  },
36351
36352
  {
36352
36353
  value: "scale",
36353
- name: "Scale — $200/mo (4 vCPU · 8 GB · 100 GB)"
36354
+ name: "Scale — $299/mo (8 vCPU · 24 GB · 500 GB)"
36354
36355
  }
36355
36356
  ]
36356
36357
  });
36357
36358
  target = answer;
36358
36359
  }
36360
+ if (!["launch", "scale"].includes(target)) {
36361
+ error(`Invalid plan: ${target} (expected launch or scale)`);
36362
+ process.exit(1);
36363
+ }
36359
36364
  if (!opts.yes) {
36360
36365
  const ok = await confirm5({
36361
36366
  message: `Resize to ${target}? ~30s downtime while containers recreate. Data preserved.`,
@@ -36532,6 +36537,18 @@ function registerInstanceCommand(program2) {
36532
36537
  }
36533
36538
  });
36534
36539
  }
36540
+ async function printTrialCheckoutUrl(plan) {
36541
+ const res = await httpPlatform("/api/billing/upgrade", {
36542
+ method: "POST",
36543
+ body: { tier: plan }
36544
+ });
36545
+ if (!res.url) {
36546
+ error("No checkout URL returned. Open Billing in the dashboard.");
36547
+ return;
36548
+ }
36549
+ info("Start your 30-day trial, then rerun this command:");
36550
+ console.log(green(res.url));
36551
+ }
36535
36552
  function guardOssMode() {
36536
36553
  if (isOssMode()) {
36537
36554
  error("`sl instance` commands are for hosted deployments. For OSS use `sl local` / `sl stack` or your own provisioning.");
@@ -36803,5 +36820,5 @@ registerLocalCommand(program);
36803
36820
  registerAccountCommand(program);
36804
36821
  program.parse();
36805
36822
 
36806
- //# debugId=95955B508F0821D564756E2164756E21
36823
+ //# debugId=62D7A79023B8002464756E2164756E21
36807
36824
  //# sourceMappingURL=cli.js.map