@secondlayer/cli 10.3.1 → 10.3.2

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
@@ -2567,7 +2567,7 @@ async function resolveAuth() {
2567
2567
  }
2568
2568
  const session = await readSession();
2569
2569
  if (!session) {
2570
- const err = new Error("Not logged in — run `sl login`");
2570
+ const err = new Error("Not logged in — run `secondlayer login`");
2571
2571
  err.code = "SESSION_EXPIRED";
2572
2572
  throw err;
2573
2573
  }
@@ -2619,7 +2619,7 @@ async function httpPlatform(path2, opts = {}) {
2619
2619
  try {
2620
2620
  auth = await resolveAuth();
2621
2621
  } catch {
2622
- throw new CliHttpError(401, "SESSION_EXPIRED", { error: "Not logged in" }, isOssMode() ? "Not authenticated — set SL_API_KEY from `sl init`" : "Not logged in — run `sl login`");
2622
+ throw new CliHttpError(401, "SESSION_EXPIRED", { error: "Not logged in" }, isOssMode() ? "Not authenticated — set SL_API_KEY from `secondlayer init`" : "Not logged in — run `secondlayer login`");
2623
2623
  }
2624
2624
  return request(`${auth.apiUrl}${path2}`, {
2625
2625
  ...opts,
@@ -2640,7 +2640,7 @@ async function httpArchiveOps(path2, opts = {}) {
2640
2640
  const session = envKey ? null : await readSession();
2641
2641
  const bearer = envKey ?? session?.token;
2642
2642
  if (!bearer) {
2643
- throw new CliHttpError(401, "SESSION_EXPIRED", { error: "Not logged in" }, "Not logged in — run `SL_API_URL=https://api.secondlayer.tools sl login`");
2643
+ throw new CliHttpError(401, "SESSION_EXPIRED", { error: "Not logged in" }, "Not logged in — run `SL_API_URL=https://api.secondlayer.tools secondlayer login`");
2644
2644
  }
2645
2645
  return request(`${resolveArchiveOpsUrl()}${path2}`, {
2646
2646
  ...opts,
@@ -2778,7 +2778,7 @@ function nextStepHint(status) {
2778
2778
  if (status === undefined)
2779
2779
  return;
2780
2780
  if (status === 403)
2781
- return "You may not have access — check your active project with `sl whoami`.";
2781
+ return "You may not have access — check your active project with `secondlayer whoami`.";
2782
2782
  if (status === 404)
2783
2783
  return "Check the name/slug — run the matching `list` command to see what exists.";
2784
2784
  if (status === 400 || status === 422)
@@ -2786,14 +2786,14 @@ function nextStepHint(status) {
2786
2786
  if (status === 429)
2787
2787
  return "Rate limited — wait a moment and retry.";
2788
2788
  if (status >= 500)
2789
- return "Server error — retry shortly, or check `sl status`.";
2789
+ return "Server error — retry shortly, or check `secondlayer status`.";
2790
2790
  return;
2791
2791
  }
2792
2792
  function handleApiError(err, action) {
2793
2793
  const status = err instanceof ApiError || err instanceof CliHttpError ? err.status : undefined;
2794
2794
  if (err instanceof CliHttpError && err.code === "SESSION_EXPIRED" || status === 401) {
2795
2795
  printError("Authentication required.", {
2796
- hint: isOssMode() ? "Set SL_API_KEY / INSTANCE_TOKEN from `sl init`." : "Run `sl login` to re-authenticate."
2796
+ hint: isOssMode() ? "Set SL_API_KEY / INSTANCE_TOKEN from `secondlayer init`." : "Run `secondlayer login` to re-authenticate."
2797
2797
  });
2798
2798
  process.exit(1);
2799
2799
  }
@@ -28616,12 +28616,12 @@ function getDefaultConfig() {
28616
28616
  async function requireLocalNetwork() {
28617
28617
  const config = await loadConfig2();
28618
28618
  if (config.network !== "local") {
28619
- console.error(`Error: 'sl local' commands require local mode.`);
28619
+ console.error(`Error: 'secondlayer local' commands require local mode.`);
28620
28620
  console.error(` Current context: ${config.network} (hosted)`);
28621
28621
  console.error("");
28622
- console.error(" To check system status, use: sl status");
28622
+ console.error(" To check system status, use: secondlayer status");
28623
28623
  console.error("");
28624
- console.error(" To switch to local mode: sl config set network local");
28624
+ console.error(" To switch to local mode: secondlayer config set network local");
28625
28625
  process.exit(1);
28626
28626
  }
28627
28627
  return config;
@@ -28783,7 +28783,7 @@ async function readStdin() {
28783
28783
  async function runTokenLogin() {
28784
28784
  const token = await readStdin();
28785
28785
  if (!token) {
28786
- error('No token on stdin. Usage: echo "$KEY" | sl login --with-token');
28786
+ error('No token on stdin. Usage: echo "$KEY" | secondlayer login --with-token');
28787
28787
  process.exit(1);
28788
28788
  }
28789
28789
  process.env.SL_API_KEY = token;
@@ -28808,7 +28808,7 @@ async function runLoginFlow(options3 = {}) {
28808
28808
  if (existing) {
28809
28809
  info(`Already logged in as ${existing.email}.`);
28810
28810
  if (!process.stdin.isTTY) {
28811
- info(dim("Run 'sl logout' first, or re-run with --force to switch accounts."));
28811
+ info(dim("Run 'secondlayer logout' first, or re-run with --force to switch accounts."));
28812
28812
  return;
28813
28813
  }
28814
28814
  try {
@@ -28817,11 +28817,11 @@ async function runLoginFlow(options3 = {}) {
28817
28817
  default: false
28818
28818
  });
28819
28819
  if (!proceed) {
28820
- info(dim("Run 'sl logout' to sign out."));
28820
+ info(dim("Run 'secondlayer logout' to sign out."));
28821
28821
  return;
28822
28822
  }
28823
28823
  } catch {
28824
- info(dim("Run 'sl logout' first, or re-run with --force to switch accounts."));
28824
+ info(dim("Run 'secondlayer logout' first, or re-run with --force to switch accounts."));
28825
28825
  return;
28826
28826
  }
28827
28827
  }
@@ -28863,7 +28863,7 @@ async function runLoginFlow(options3 = {}) {
28863
28863
  expiresAt: sessionExpiry()
28864
28864
  });
28865
28865
  success(`Logged in as ${verified.account.email}`);
28866
- info(dim("Run 'sl whoami' to see your account status."));
28866
+ info(dim("Run 'secondlayer whoami' to see your account status."));
28867
28867
  } catch (err) {
28868
28868
  if (err instanceof CliHttpError) {
28869
28869
  error(err.message);
@@ -28876,8 +28876,8 @@ async function runLoginFlow(options3 = {}) {
28876
28876
  function registerLoginCommand(program2) {
28877
28877
  program2.command("login", { hidden: true }).description("Log in to Secondlayer (magic-link email)").option("--force", "Skip the already-logged-in check and re-run the flow").option("--with-token", "Read an API key from stdin (non-interactive)").addHelpText("after", `
28878
28878
  Examples:
28879
- $ sl login
28880
- $ echo "$SL_API_KEY" | sl login --with-token`).action((opts) => opts.withToken ? runTokenLogin() : runLoginFlow({ force: opts.force }));
28879
+ $ secondlayer login
28880
+ $ echo "$SL_API_KEY" | secondlayer login --with-token`).action((opts) => opts.withToken ? runTokenLogin() : runLoginFlow({ force: opts.force }));
28881
28881
  }
28882
28882
  var init_login = __esm(() => {
28883
28883
  init_http();
@@ -28927,12 +28927,12 @@ function nextStepsHeader(name) {
28927
28927
  //
28928
28928
  // 1. Edit the source filter + schema below to match what you want to track.
28929
28929
  // 2. Edit the handler at the bottom — it runs once per matching event.
28930
- // 3. Deploy: sl subgraphs deploy ${name}.ts
28930
+ // 3. Deploy: secondlayer subgraphs deploy ${name}.ts
28931
28931
  // (You'll be prompted to log in if this is your first remote deploy.)
28932
- // 4. Wait for sync: sl subgraphs status ${name}
28932
+ // 4. Wait for sync: secondlayer subgraphs status ${name}
28933
28933
  // Mainnet backfill from genesis can take an hour or more depending on
28934
28934
  // your filter scope. Use --start-block to skip ahead.
28935
- // 5. Query: sl subgraphs query ${name} <table-name>
28935
+ // 5. Query: secondlayer subgraphs query ${name} <table-name>
28936
28936
  // Or hit the auto-generated REST endpoint listed in the deploy output.
28937
28937
  //
28938
28938
  // Bind a typed Subscription to any table you write here — see
@@ -29415,7 +29415,7 @@ async function runSubgraphTest(file, options3) {
29415
29415
  toHeight = usable.toHeight;
29416
29416
  } else {
29417
29417
  if (options3.offline) {
29418
- error("No usable cassette for --offline. Record one first: sl subgraphs test <file> --from <h> --to <h>");
29418
+ error("No usable cassette for --offline. Record one first: secondlayer subgraphs test <file> --from <h> --to <h>");
29419
29419
  process.exit(1);
29420
29420
  }
29421
29421
  if (!options3.from) {
@@ -30018,10 +30018,10 @@ function registerSubgraphsCommand(program2) {
30018
30018
  const subgraphs = program2.command("subgraphs").description("Manage materialized subgraphs");
30019
30019
  subgraphs.command("create <name>").description("Create a new subgraph definition file").option("--template <slug>", `Starter template (one of: ${SUBGRAPH_TEMPLATE_SLUGS.join(", ")})`).option("--from-contract <contractId>", "Generate sources/schema/handlers from the contract's observed print events (requires network)").option("--table-per-topic", "With --from-contract: one table per print topic instead of a single wide table").addHelpText("after", `
30020
30020
  Examples:
30021
- $ sl subgraphs create my-graph
30022
- $ sl subgraphs create token-balances --template sip-010-balances
30023
- $ sl subgraphs create sbtc-flows --from-contract SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-registry
30024
- $ sl subgraphs create sbtc-flows --from-contract SM3....sbtc-registry --table-per-topic`).action(async (name, opts) => {
30021
+ $ secondlayer subgraphs create my-graph
30022
+ $ secondlayer subgraphs create token-balances --template sip-010-balances
30023
+ $ secondlayer subgraphs create sbtc-flows --from-contract SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-registry
30024
+ $ secondlayer subgraphs create sbtc-flows --from-contract SM3....sbtc-registry --table-per-topic`).action(async (name, opts) => {
30025
30025
  if (opts.fromContract && opts.template) {
30026
30026
  error("--from-contract and --template are mutually exclusive");
30027
30027
  process.exit(1);
@@ -30077,7 +30077,7 @@ Check the contract id, and that the contract has emitted print events (schemas a
30077
30077
  } else if (slug !== "basic") {
30078
30078
  info(`Template: ${slug} — ${SUBGRAPH_TEMPLATE_DESCRIPTIONS[slug]}`);
30079
30079
  }
30080
- info(`Next: sl subgraphs deploy subgraphs/${name}.ts`);
30080
+ info(`Next: secondlayer subgraphs deploy subgraphs/${name}.ts`);
30081
30081
  });
30082
30082
  subgraphs.command("dev <file>").description("Watch a subgraph file and auto-redeploy on change").action(async (file) => {
30083
30083
  await requireLocalNetwork();
@@ -30276,15 +30276,15 @@ Stopped watching.`);
30276
30276
  info(` Share: ${apiUrl}/v1/subgraphs/${effectiveDef.name} (public — no key needed)`);
30277
30277
  } else if (firstTable) {
30278
30278
  info(` REST: ${apiUrl}/api/subgraphs/${effectiveDef.name}/${firstTable}`);
30279
- info(` Publish: sl subgraphs publish ${effectiveDef.name} (open anon /v1 reads)`);
30279
+ info(` Publish: secondlayer subgraphs publish ${effectiveDef.name} (open anon /v1 reads)`);
30280
30280
  }
30281
30281
  if (result.reindexStarted) {
30282
30282
  const denom = result.estimatedEvents != null ? ` ~${result.estimatedEvents.toLocaleString()} events —` : "";
30283
30283
  info(` Reindex: ${denom} started in the background — check status in ~30s for an ETA`);
30284
30284
  }
30285
- info(` Watch: sl subgraphs status ${effectiveDef.name}`);
30285
+ info(` Watch: secondlayer subgraphs status ${effectiveDef.name}`);
30286
30286
  if (firstTable) {
30287
- info(` Webhook: sl subscriptions create ${effectiveDef.name}-hook --subgraph ${effectiveDef.name} --table ${firstTable} --url <your-endpoint>`);
30287
+ info(` Webhook: secondlayer subscriptions create ${effectiveDef.name}-hook --subgraph ${effectiveDef.name} --table ${firstTable} --url <your-endpoint>`);
30288
30288
  }
30289
30289
  } catch {}
30290
30290
  };
@@ -30430,7 +30430,7 @@ ${data.length} subgraph(s) total`));
30430
30430
  ]));
30431
30431
  if (sync && sync.gaps.count > 0) {
30432
30432
  console.log(dim(`
30433
- Run: sl subgraphs gaps ${name}`));
30433
+ Run: secondlayer subgraphs gaps ${name}`));
30434
30434
  }
30435
30435
  const tableEntries = Object.entries(subgraph.tables);
30436
30436
  if (tableEntries.length > 0) {
@@ -30482,23 +30482,23 @@ Synced — exiting watch.`));
30482
30482
  }
30483
30483
  });
30484
30484
  subgraphs.command("codegen <file>").description("Generate an ORM schema (Prisma, Drizzle, or Kysely) for a subgraph's tables — point it at your BYO database").option("--target <orm>", "ORM target: prisma | drizzle | kysely", "prisma").option("--schema <name>", "Postgres schema name (defaults to subgraph_<name>)").option("--env <var>", "datasource url env var", "DATABASE_URL").option("--models-only", "Emit only Prisma models (compose via prismaSchemaFolder)").option("--payloads", "Emit a .d.ts of print payload types for pinned print_event sources, inferred from observed on-chain events (requires network)").option("-o, --output <path>", "Write to a file (defaults to stdout)").action(async (file, options3, command) => {
30485
- deprecatedCodegenNotice("sl subgraphs codegen", options3.payloads ? "sl codegen prints" : "sl codegen subgraph");
30485
+ deprecatedCodegenNotice("secondlayer subgraphs codegen", options3.payloads ? "secondlayer codegen prints" : "secondlayer codegen subgraph");
30486
30486
  await runSubgraphSchemaCodegen(file, options3, (key) => command.getOptionValueSource(key));
30487
30487
  });
30488
30488
  subgraphs.command("test <file>").description("Run a subgraph's handlers against real chain data without deploying").option("--from <height>", "Start block height (required on first run)").option("--to <height>", "End block height (defaults to --from + 100)").option("--offline", "Replay the recorded cassette; never hit the network").option("--no-record", "Don't write a cassette").option("--limit <n>", "Max events per source", "500").addHelpText("after", `
30489
30489
  Examples:
30490
- $ sl subgraphs test subgraphs/bns-names.ts --from 167484 --to 167600
30491
- $ sl subgraphs test subgraphs/bns-names.ts --offline`).action(async (file, options3) => {
30490
+ $ secondlayer subgraphs test subgraphs/bns-names.ts --from 167484 --to 167600
30491
+ $ secondlayer subgraphs test subgraphs/bns-names.ts --offline`).action(async (file, options3) => {
30492
30492
  const { runSubgraphTest: runSubgraphTest2 } = await Promise.resolve().then(() => (init_subgraph_test(), exports_subgraph_test));
30493
30493
  await runSubgraphTest2(file, options3);
30494
30494
  });
30495
30495
  subgraphs.command("reindex <name>").description("Drop a subgraph's data and rebuild it from its start block (destructive)").option("-y, --yes", "Skip confirmation").addHelpText("after", `
30496
30496
  Reindex is always whole-subgraph: it drops every row and rebuilds from the
30497
30497
  subgraph's start block to chain tip. To process a specific block range without
30498
- dropping anything, use "sl subgraphs backfill".
30498
+ dropping anything, use "secondlayer subgraphs backfill".
30499
30499
 
30500
30500
  Examples:
30501
- $ sl subgraphs reindex my-graph -y`).action(async (name, options3) => {
30501
+ $ secondlayer subgraphs reindex my-graph -y`).action(async (name, options3) => {
30502
30502
  try {
30503
30503
  if (!options3.yes) {
30504
30504
  if (!process.stdin.isTTY) {
@@ -30535,7 +30535,7 @@ Examples:
30535
30535
  });
30536
30536
  subgraphs.command("backfill <name>").description("Backfill a block range without dropping existing data").option("--from-block <n>", "Start block height").option("--to-block <n>", "End block height").addHelpText("after", `
30537
30537
  Examples:
30538
- $ sl subgraphs backfill my-graph --from-block 150000 --to-block 160000`).action(async (name, options3) => {
30538
+ $ secondlayer subgraphs backfill my-graph --from-block 150000 --to-block 160000`).action(async (name, options3) => {
30539
30539
  try {
30540
30540
  const fromRaw = options3.fromBlock;
30541
30541
  const toRaw = options3.toBlock;
@@ -30600,9 +30600,9 @@ ${result.meta.total} gap(s), ${result.meta.totalMissingBlocks} total missing blo
30600
30600
  });
30601
30601
  subgraphs.command("query <name> <table>").description("Query a subgraph table").option("--sort <column>", "Sort by column").option("--order <dir>", "Sort direction (asc|desc)", "asc").option("--limit <n>", "Max rows to return", "20").option("--offset <n>", "Skip first N rows").option("--fields <cols>", "Comma-separated columns to include").option("--filter <kv...>", "Filter as key=value (supports .gte/.lte/.gt/.lt/.neq suffixes)").option("--count", "Return row count only").option("--json", "Output as JSON").addHelpText("after", `
30602
30602
  Examples:
30603
- $ sl subgraphs query my-graph balances --filter holder=SP2J6ZY... --limit 50
30604
- $ sl subgraphs query my-graph transfers --filter amount.gte=1000 --sort _block_height --order desc
30605
- $ sl subgraphs query my-graph balances --count`).action(async (name, table, options3) => {
30603
+ $ secondlayer subgraphs query my-graph balances --filter holder=SP2J6ZY... --limit 50
30604
+ $ secondlayer subgraphs query my-graph transfers --filter amount.gte=1000 --sort _block_height --order desc
30605
+ $ secondlayer subgraphs query my-graph balances --count`).action(async (name, table, options3) => {
30606
30606
  try {
30607
30607
  let filters;
30608
30608
  try {
@@ -30729,9 +30729,9 @@ ${rows.length} row(s)`));
30729
30729
  });
30730
30730
  subgraphs.command("scaffold [contractAddress]").description("Scaffold a defineSubgraph() file from a contract or trait").option("-o, --output <path>", "Output file path (required)").option("-k, --api-key <key>", "Stacks node API key for direct RPC URLs").option("--functions <names>", "Comma-separated public functions to index as typed contract_call tables").option("--trait <std>", "Scaffold a trait-scoped source (sip-009|sip-010|sip-013) — no contract needed").option("--no-install", "Skip bun install after writing package.json").addHelpText("after", `
30731
30731
  Examples:
30732
- $ sl subgraphs scaffold SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335.megapont-ape-club-nft -o subgraphs/apes.ts
30733
- $ sl subgraphs scaffold SP00...token --functions transfer,mint -o subgraphs/token.ts
30734
- $ sl subgraphs scaffold --trait sip-010 -o subgraphs/all-ft.ts`).action(async (contractAddress, options3) => {
30732
+ $ secondlayer subgraphs scaffold SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335.megapont-ape-club-nft -o subgraphs/apes.ts
30733
+ $ secondlayer subgraphs scaffold SP00...token --functions transfer,mint -o subgraphs/token.ts
30734
+ $ secondlayer subgraphs scaffold --trait sip-010 -o subgraphs/all-ft.ts`).action(async (contractAddress, options3) => {
30735
30735
  try {
30736
30736
  if (!options3.output) {
30737
30737
  error("--output <path> is required");
@@ -30784,14 +30784,14 @@ Examples:
30784
30784
  process.exit(1);
30785
30785
  }
30786
30786
  }
30787
- info(`Next: sl subgraphs deploy ${options3.output}`);
30787
+ info(`Next: secondlayer subgraphs deploy ${options3.output}`);
30788
30788
  } catch (err) {
30789
30789
  error(`Failed to scaffold subgraph: ${err}`);
30790
30790
  process.exit(1);
30791
30791
  }
30792
30792
  });
30793
30793
  subgraphs.command("client <subgraphName>").description("Generate a typed query client for a deployed subgraph").option("-o, --output <path>", "Output file path (required)").action(async (subgraphName, options3) => {
30794
- deprecatedCodegenNotice("sl subgraphs client", "sl codegen client");
30794
+ deprecatedCodegenNotice("secondlayer subgraphs client", "secondlayer codegen client");
30795
30795
  await runSubgraphClientCodegen(subgraphName, options3);
30796
30796
  });
30797
30797
  }
@@ -30956,7 +30956,7 @@ function emitOne(doc, label, json) {
30956
30956
  function registerIndexCommand(program2) {
30957
30957
  const index = program2.command("index").description("Query the decoded Index layer (events + contract calls)");
30958
30958
  index.command("codegen").description("Generate a typed schema (Prisma, Kysely, Drizzle, or JSON-Schema) for the Index domain tables — point it at your BYO database mirror").option("--target <orm>", "prisma | kysely | drizzle | json-schema", "kysely").option("--schema <name>", "Postgres schema to qualify table names with").option("--tables <list>", "Comma-separated subset of Index tables (default: all)").option("--env <var>", "Prisma datasource url env var", "DATABASE_URL").option("-o, --output <path>", "Write to a file (defaults to stdout)").action(async (o3) => {
30959
- deprecatedCodegenNotice("sl index codegen", "sl codegen index");
30959
+ deprecatedCodegenNotice("secondlayer index codegen", "secondlayer codegen index");
30960
30960
  await runIndexCodegen(o3);
30961
30961
  });
30962
30962
  const rangeFlags = (cmd) => cmd.option("--contract-id <id>", "Filter by contract id").option("--from-height <n>", "Start block height (inclusive)").option("--to-height <n>", "End block height (inclusive)").option("--cursor <cursor>", "Resume token from a previous next_cursor").option("--limit <n>", "Rows per page").option("--json", "Print the full envelope as JSON");
@@ -33752,9 +33752,9 @@ async function isDevAlreadyRunning() {
33752
33752
  printRunningServices(running);
33753
33753
  console.log("");
33754
33754
  console.log(dim("Commands:"));
33755
- console.log(` ${green("sl local logs")} ${dim("View logs")}`);
33756
- console.log(` ${green("sl local stop")} ${dim("Stop all services")}`);
33757
- console.log(` ${green("sl local status")} ${dim("Show status")}`);
33755
+ console.log(` ${green("secondlayer local logs")} ${dim("View logs")}`);
33756
+ console.log(` ${green("secondlayer local stop")} ${dim("Stop all services")}`);
33757
+ console.log(` ${green("secondlayer local status")} ${dim("Show status")}`);
33758
33758
  return true;
33759
33759
  }
33760
33760
  return false;
@@ -33896,9 +33896,9 @@ async function runBackground(options3) {
33896
33896
  success("Dev environment started in background");
33897
33897
  console.log("");
33898
33898
  console.log(dim("Commands:"));
33899
- console.log(` ${green("sl local logs -f")} ${dim("Follow logs")}`);
33900
- console.log(` ${green("sl local stop")} ${dim("Stop all services")}`);
33901
- console.log(` ${green("sl local status")} ${dim("Show status")}`);
33899
+ console.log(` ${green("secondlayer local logs -f")} ${dim("Follow logs")}`);
33900
+ console.log(` ${green("secondlayer local stop")} ${dim("Stop all services")}`);
33901
+ console.log(` ${green("secondlayer local status")} ${dim("Show status")}`);
33902
33902
  console.log("");
33903
33903
  process.exit(0);
33904
33904
  } catch (err) {
@@ -34009,7 +34009,7 @@ async function showLogs(options3) {
34009
34009
  const state = await loadDevState();
34010
34010
  if (!state || Object.keys(state.services).length === 0) {
34011
34011
  error("Dev environment is not running");
34012
- console.log(dim("Start with: sl local start"));
34012
+ console.log(dim("Start with: secondlayer local start"));
34013
34013
  process.exit(1);
34014
34014
  }
34015
34015
  const services = options3.service ? { [options3.service]: state.services[options3.service] } : state.services;
@@ -34148,7 +34148,7 @@ async function restartDev() {
34148
34148
  const state = await loadDevState();
34149
34149
  if (!state) {
34150
34150
  info("Dev environment is not running");
34151
- console.log(dim("Start with: sl local start"));
34151
+ console.log(dim("Start with: secondlayer local start"));
34152
34152
  return;
34153
34153
  }
34154
34154
  info("Restarting dev services...");
@@ -34253,7 +34253,7 @@ async function showDevStatus() {
34253
34253
  const state = await loadDevState();
34254
34254
  if (!state) {
34255
34255
  info("Dev environment is not running");
34256
- console.log(dim("Start with: sl local start"));
34256
+ console.log(dim("Start with: secondlayer local start"));
34257
34257
  return;
34258
34258
  }
34259
34259
  const running = await getRunningServices();
@@ -34488,9 +34488,9 @@ async function runSetupWizard() {
34488
34488
  ]));
34489
34489
  console.log("");
34490
34490
  console.log(dim("Next steps:"));
34491
- console.log(` ${green("sl local node start")}${dim(" - Start the Stacks node")}`);
34492
- console.log(` ${green("sl local node status")}${dim(" - Check sync progress")}`);
34493
- console.log(` ${green("sl local node logs")}${dim(" - View logs")}`);
34491
+ console.log(` ${green("secondlayer local node start")}${dim(" - Start the Stacks node")}`);
34492
+ console.log(` ${green("secondlayer local node status")}${dim(" - Check sync progress")}`);
34493
+ console.log(` ${green("secondlayer local node logs")}${dim(" - View logs")}`);
34494
34494
  console.log("");
34495
34495
  }
34496
34496
  async function startNode(pathOverride, withIndexer) {
@@ -34499,7 +34499,7 @@ async function startNode(pathOverride, withIndexer) {
34499
34499
  const network = config.node?.network || "mainnet";
34500
34500
  if (!nodePath) {
34501
34501
  error("Node not configured");
34502
- console.log(dim("Run 'sl local node setup' or use --path flag"));
34502
+ console.log(dim("Run 'secondlayer local node setup' or use --path flag"));
34503
34503
  process.exit(1);
34504
34504
  }
34505
34505
  if (!await isDockerRunning()) {
@@ -34508,8 +34508,8 @@ async function startNode(pathOverride, withIndexer) {
34508
34508
  }
34509
34509
  if (await isNodeRunning()) {
34510
34510
  info("Node is already running");
34511
- console.log(dim("Run 'sl local node logs' to view output"));
34512
- console.log(dim("Run 'sl local node stop' to stop"));
34511
+ console.log(dim("Run 'secondlayer local node logs' to view output"));
34512
+ console.log(dim("Run 'secondlayer local node stop' to stop"));
34513
34513
  return;
34514
34514
  }
34515
34515
  const validation = await validateNetworkConsistency(config);
@@ -34536,13 +34536,13 @@ async function startNode(pathOverride, withIndexer) {
34536
34536
  console.log("");
34537
34537
  if (withIndexer) {
34538
34538
  const port = config.ports?.indexer || 3700;
34539
- console.log(dim("Tip: Start indexer with: sl local start"));
34539
+ console.log(dim("Tip: Start indexer with: secondlayer local start"));
34540
34540
  console.log(dim(` Or manually: PORT=${port} bun run packages/indexer/src/index.ts`));
34541
34541
  console.log("");
34542
34542
  }
34543
34543
  console.log(dim("Next steps:"));
34544
- console.log(` ${green("sl local node status")}${dim(" - Check sync progress")}`);
34545
- console.log(` ${green("sl local node logs -f")}${dim(" - Follow logs")}`);
34544
+ console.log(` ${green("secondlayer local node status")}${dim(" - Check sync progress")}`);
34545
+ console.log(` ${green("secondlayer local node logs -f")}${dim(" - Follow logs")}`);
34546
34546
  console.log("");
34547
34547
  }
34548
34548
  async function stopNode(_pathOverride, force, _wait) {
@@ -34575,7 +34575,7 @@ async function restartNode(pathOverride, force, _wait) {
34575
34575
  const network = config.node?.network || "mainnet";
34576
34576
  if (!nodePath) {
34577
34577
  error("Node not configured");
34578
- console.log(dim("Run 'sl local node setup' or use --path flag"));
34578
+ console.log(dim("Run 'secondlayer local node setup' or use --path flag"));
34579
34579
  process.exit(1);
34580
34580
  }
34581
34581
  const wasRunning = await isNodeRunning();
@@ -34614,8 +34614,8 @@ async function restartNode(pathOverride, force, _wait) {
34614
34614
  success("Node started!");
34615
34615
  console.log("");
34616
34616
  console.log(dim("Next steps:"));
34617
- console.log(` ${green("sl local node status")}${dim(" - Check sync progress")}`);
34618
- console.log(` ${green("sl local node logs -f")}${dim(" - Follow logs")}`);
34617
+ console.log(` ${green("secondlayer local node status")}${dim(" - Check sync progress")}`);
34618
+ console.log(` ${green("secondlayer local node logs -f")}${dim(" - Follow logs")}`);
34619
34619
  console.log("");
34620
34620
  }
34621
34621
  async function showStatus(pathOverride, jsonOutput) {
@@ -34624,7 +34624,7 @@ async function showStatus(pathOverride, jsonOutput) {
34624
34624
  const network = config.node?.network || "mainnet";
34625
34625
  if (!nodePath) {
34626
34626
  error("Node not configured");
34627
- console.log(dim("Run 'sl local node setup' or use --path flag"));
34627
+ console.log(dim("Run 'secondlayer local node setup' or use --path flag"));
34628
34628
  process.exit(1);
34629
34629
  }
34630
34630
  const running = await isNodeRunning();
@@ -34721,7 +34721,7 @@ async function showStatus(pathOverride, jsonOutput) {
34721
34721
  if (config.node) {
34722
34722
  console.log(blue("Indexer"));
34723
34723
  console.log(` ${dim("-")} ${dim(`Not running (expected on port ${indexerPort})`)}`);
34724
- console.log(dim(" Start with: sl local start"));
34724
+ console.log(dim(" Start with: secondlayer local start"));
34725
34725
  console.log("");
34726
34726
  }
34727
34727
  }
@@ -34733,7 +34733,7 @@ async function showConfig() {
34733
34733
  console.log("");
34734
34734
  if (!config.node?.installPath) {
34735
34735
  warn("Node not configured");
34736
- console.log(dim("Run 'sl local node setup' to configure"));
34736
+ console.log(dim("Run 'secondlayer local node setup' to configure"));
34737
34737
  console.log("");
34738
34738
  return;
34739
34739
  }
@@ -34744,7 +34744,7 @@ async function showConfig() {
34744
34744
  ]));
34745
34745
  console.log("");
34746
34746
  console.log(dim("Config file: ~/.secondlayer/config.json"));
34747
- console.log(dim("Run 'sl local node config --edit' to modify"));
34747
+ console.log(dim("Run 'secondlayer local node config --edit' to modify"));
34748
34748
  console.log("");
34749
34749
  }
34750
34750
  async function showConfigCheck(indexerPort) {
@@ -34772,7 +34772,7 @@ async function showConfigCheck(indexerPort) {
34772
34772
  }
34773
34773
  } catch {
34774
34774
  warn(`Indexer not detected on port ${indexerPort}`);
34775
- console.log(dim("Start with: sl local start"));
34775
+ console.log(dim("Start with: secondlayer local start"));
34776
34776
  }
34777
34777
  console.log("");
34778
34778
  }
@@ -34789,7 +34789,7 @@ init_esm();
34789
34789
  // package.json
34790
34790
  var package_default = {
34791
34791
  name: "@secondlayer/cli",
34792
- version: "10.3.1",
34792
+ version: "10.3.2",
34793
34793
  repository: {
34794
34794
  type: "git",
34795
34795
  url: "git+https://github.com/ryanwaits/secondlayer.git",
@@ -34876,13 +34876,16 @@ async function runBillingStatus(json) {
34876
34876
  output({ json, data: res, human: () => renderBillingStatus(res) });
34877
34877
  }
34878
34878
  function addBillingCommand(parent) {
34879
- parent.command("billing").description("Show archive credit balance (hidden; use sl credits)").option("--json", "Output as JSON").action((options) => runBillingStatus(options.json));
34879
+ parent.command("billing").description("Show archive credit balance (hidden; use secondlayer credits)").option("--json", "Output as JSON").action((options) => runBillingStatus(options.json));
34880
34880
  }
34881
34881
  function renderBillingStatus(res) {
34882
34882
  if (!res.subscription) {
34883
34883
  console.log(formatKeyValue([
34884
- ["Credits", dim("sl credits balance")],
34885
- ["Buy", dim("sl credits buy --email you@example.com --pack 25")]
34884
+ ["Credits", dim("secondlayer credits balance")],
34885
+ [
34886
+ "Buy",
34887
+ dim("secondlayer credits buy --email you@example.com --pack 25")
34888
+ ]
34886
34889
  ]));
34887
34890
  return;
34888
34891
  }
@@ -35015,7 +35018,7 @@ async function runBuy(opts) {
35015
35018
  human: () => {
35016
35019
  success(`Checkout for $${amount} → ${email}`);
35017
35020
  console.log(res.url);
35018
- console.log(dim("After payment: SL_API_URL=https://api.secondlayer.tools sl login && sl credits balance"));
35021
+ console.log(dim("After payment: SL_API_URL=https://api.secondlayer.tools secondlayer login && secondlayer credits balance"));
35019
35022
  }
35020
35023
  });
35021
35024
  }
@@ -35043,7 +35046,10 @@ async function runBalance(opts) {
35043
35046
  "Refill",
35044
35047
  refill?.belowUsd != null ? `on — below $${refill.belowUsd} buy $${refill.packUsd}` : dim("off")
35045
35048
  ],
35046
- ["Buy", dim("sl credits buy --email you@example.com --pack 25")]
35049
+ [
35050
+ "Buy",
35051
+ dim("secondlayer credits buy --email you@example.com --pack 25")
35052
+ ]
35047
35053
  ]));
35048
35054
  }
35049
35055
  });
@@ -35354,9 +35360,9 @@ function registerConfigCommand(program2) {
35354
35360
  });
35355
35361
  config.command("set <key> <value>").description("Set a configuration value (supports dot notation: ports.api)").option("--no-validate", "Skip connection validation for database/redis URLs").addHelpText("after", `
35356
35362
  Examples:
35357
- $ sl config set network local
35358
- $ sl config set ports.api 3800
35359
- $ sl config set database.url postgres://localhost:5432/secondlayer_dev`).action(async (key, value, options3) => {
35363
+ $ secondlayer config set network local
35364
+ $ secondlayer config set ports.api 3800
35365
+ $ secondlayer config set database.url postgres://localhost:5432/secondlayer_dev`).action(async (key, value, options3) => {
35360
35366
  try {
35361
35367
  await setConfigValue(key, value);
35362
35368
  success(`Set ${key} = ${value}`);
@@ -35445,7 +35451,7 @@ async function printConfigTree(cfg) {
35445
35451
  const status = node.running ? green("●") : dim("○");
35446
35452
  console.log(dim(` ${status} ${node.path} (${node.network})`));
35447
35453
  }
35448
- console.log(dim(" Run 'sl init' to configure"));
35454
+ console.log(dim(" Run 'secondlayer init' to configure"));
35449
35455
  }
35450
35456
  } catch {}
35451
35457
  }
@@ -35822,10 +35828,10 @@ SIGNING_SECRET=${signingSecret}
35822
35828
  process.exit(1);
35823
35829
  }
35824
35830
  const pausedLine = subscriptionStatus === "paused" ? `Subscription is paused. Resume:
35825
- sl subscriptions resume ${name}
35831
+ secondlayer subscriptions resume ${name}
35826
35832
  ` : "";
35827
35833
  const runHint = opts.scaffold === false ? `View deliveries:
35828
- sl subscriptions get ${name}` : `cd ${name}
35834
+ secondlayer subscriptions get ${name}` : `cd ${name}
35829
35835
  bun install
35830
35836
  bun run dev`;
35831
35837
  success(`Done. Next:
@@ -35877,7 +35883,7 @@ async function createChainSubscription(name, opts) {
35877
35883
  console.log();
35878
35884
  success(`Done. Next:
35879
35885
  View deliveries:
35880
- sl subscriptions get ${name}`);
35886
+ secondlayer subscriptions get ${name}`);
35881
35887
  }
35882
35888
  async function getSubscriptionClient() {
35883
35889
  const { apiUrl, ephemeralKey } = await resolveAuth();
@@ -35899,7 +35905,7 @@ Examples:
35899
35905
  function addSubscriptionsCreateCommand(subscriptions) {
35900
35906
  addSubscriptionScaffold(subscriptions, "create <name>", {
35901
35907
  description: "Create a subscription receiver for a runtime",
35902
- examplePrefix: "sl subscriptions create"
35908
+ examplePrefix: "secondlayer subscriptions create"
35903
35909
  });
35904
35910
  }
35905
35911
 
@@ -36042,19 +36048,19 @@ function buildDoctorReport(input3) {
36042
36048
  } : null;
36043
36049
  const hints = [];
36044
36050
  if (input3.subscription.status === "paused") {
36045
- hints.push(`Resume when the receiver is healthy: sl subscriptions resume ${input3.subscription.id}`);
36051
+ hints.push(`Resume when the receiver is healthy: secondlayer subscriptions resume ${input3.subscription.id}`);
36046
36052
  }
36047
36053
  if (input3.subscription.lastError) {
36048
- hints.push("Run sl subscriptions test to reproduce the receiver request.");
36054
+ hints.push("Run secondlayer subscriptions test to reproduce the receiver request.");
36049
36055
  }
36050
36056
  if (input3.subscription.circuitOpenedAt || input3.subscription.circuitFailures > 0) {
36051
36057
  hints.push("Circuit breaker has failures; inspect receiver logs and delivery status codes.");
36052
36058
  }
36053
36059
  if (input3.dead.length > 0) {
36054
- hints.push(`Dead-letter rows exist; inspect with sl subscriptions dead ${input3.subscription.id} and requeue selected rows.`);
36060
+ hints.push(`Dead-letter rows exist; inspect with secondlayer subscriptions dead ${input3.subscription.id} and requeue selected rows.`);
36055
36061
  }
36056
36062
  if (subgraph?.gapCount && subgraph.gapCount > 0) {
36057
- hints.push(`Linked subgraph has gaps; run sl subgraphs gaps ${input3.subscription.subgraphName}.`);
36063
+ hints.push(`Linked subgraph has gaps; run secondlayer subgraphs gaps ${input3.subscription.subgraphName}.`);
36058
36064
  }
36059
36065
  if (subgraph?.syncStatus === "catching_up") {
36060
36066
  hints.push("Linked subgraph is still catching up; new matching rows may arrive later.");
@@ -36317,9 +36323,9 @@ ${data.length} subscription(s) total`));
36317
36323
  });
36318
36324
  subscriptions.command("update <idOrName>").description("Update subscription config").option("--name <name>", "Rename subscription").option("--url <url>", "Webhook URL").option("--auth-token <token>", "Set bearer token auth config").option("--format <format>", "standard-webhooks | inngest | trigger | cloudflare | cloudevents | raw").option("--runtime <runtime>", "inngest | trigger | cloudflare | node | none").option("--filter <kv...>", "Filter as key=value (supports .eq/.neq/.gt/.gte/.lt/.lte suffixes)").option("--clear-filter", "Replace filter with {}").option("--max-retries <n>", "Maximum delivery retries").option("--timeout-ms <n>", "Delivery timeout in milliseconds").option("--concurrency <n>", "Per-subscription delivery concurrency").option("--json", "Output as JSON").addHelpText("after", `
36319
36325
  Examples:
36320
- $ sl subscriptions update my-sub --url https://example.com/hook
36321
- $ sl subscriptions update my-sub --filter amount.gte=1000 --max-retries 5
36322
- $ sl subscriptions update my-sub --clear-filter`).action(async (idOrName, options3) => {
36326
+ $ secondlayer subscriptions update my-sub --url https://example.com/hook
36327
+ $ secondlayer subscriptions update my-sub --filter amount.gte=1000 --max-retries 5
36328
+ $ secondlayer subscriptions update my-sub --clear-filter`).action(async (idOrName, options3) => {
36323
36329
  try {
36324
36330
  const client2 = await getSubscriptionClient();
36325
36331
  const patch = buildUpdatePatch(options3);
@@ -36448,7 +36454,7 @@ Examples:
36448
36454
  });
36449
36455
  subscriptions.command("replay <idOrName>").description("Replay a block range").requiredOption("--from-block <n>", "Start block height").requiredOption("--to-block <n>", "End block height").option("-y, --yes", "Skip confirmation").option("--json", "Output as JSON").addHelpText("after", `
36450
36456
  Examples:
36451
- $ sl subscriptions replay my-sub --from-block 150000 --to-block 160000 -y`).action(async (idOrName, options3) => {
36457
+ $ secondlayer subscriptions replay my-sub --from-block 150000 --to-block 160000 -y`).action(async (idOrName, options3) => {
36452
36458
  try {
36453
36459
  const fromBlock = requireIntegerOption(options3.fromBlock, "--from-block");
36454
36460
  const toBlock = requireIntegerOption(options3.toBlock, "--to-block");
@@ -36576,7 +36582,7 @@ function buildDevnetCompose(opts = {}) {
36576
36582
  const dbUrl = "postgres://secondlayer:secondlayer@postgres:5432/secondlayer";
36577
36583
  const DEV_SECRETS_KEY = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
36578
36584
  const DEV_INSTANCE_TOKEN = "dev-instance-token";
36579
- return `# Generated by \`sl devnet connect\` — do not edit by hand.
36585
+ return `# Generated by \`secondlayer devnet connect\` — do not edit by hand.
36580
36586
  # Secondlayer app services for local clarinet devnet development.
36581
36587
  name: secondlayer-devnet
36582
36588
 
@@ -36815,8 +36821,8 @@ function parseAmount(value) {
36815
36821
  function registerFaucetCommand(devnetCommand) {
36816
36822
  devnetCommand.command("faucet").description("Mint mock sBTC to an address on your devnet").requiredOption("--to <address>", "recipient Stacks address").option("--amount <sats>", `amount in sats (default ${DEFAULT_AMOUNT_SATS}, minimum ${DUST_LIMIT_SATS})`).option("--contract <id>", "sBTC deposit contract (default: <deployer>.sbtc-deposit)").option("--rpc-url <url>", "devnet node RPC (default http://localhost:3999)").option("--json", "Output as JSON").addHelpText("after", `
36817
36823
  Examples:
36818
- $ sl devnet faucet --to ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
36819
- $ sl devnet faucet --to ST2... --amount 5000000
36824
+ $ secondlayer devnet faucet --to ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
36825
+ $ secondlayer devnet faucet --to ST2... --amount 5000000
36820
36826
 
36821
36827
  Requires a devnet running with the sBTC contract set deployed by your
36822
36828
  Clarinet deployer — that deployer is the signer set on your own chain, which
@@ -36824,7 +36830,7 @@ is what makes minting possible without Bitcoin.`).action(async (opts) => {
36824
36830
  try {
36825
36831
  const network = process.env.STACKS_NETWORK ?? "devnet";
36826
36832
  if (network !== "devnet" && network !== "local") {
36827
- printError(`sl devnet faucet only works on devnet, not ${network}.`, {
36833
+ printError(`secondlayer devnet faucet only works on devnet, not ${network}.`, {
36828
36834
  hint: "Mock sBTC is mintable because you deployed the contracts. On testnet or mainnet the signer set is not yours."
36829
36835
  });
36830
36836
  process.exit(2);
@@ -36925,7 +36931,7 @@ function registerDevnetCommand(program2) {
36925
36931
  devnet2.command("connect").description("Point your clarinet project's devnet at a local Secondlayer stack and start it").option("--project <dir>", "Clarinet project directory (defaults to the nearest Clarinet.toml)").option("--image-tag <tag>", "Published image tag to run", DEFAULT_IMAGE_TAG).option("--owner <owner>", "ghcr image owner (namespace) to pull from").option("--no-up", "Patch config + write compose without starting docker").action(async (options3) => {
36926
36932
  await connect(options3);
36927
36933
  });
36928
- devnet2.command("down").description("Stop the local Secondlayer stack started by `sl devnet connect`").option("--project <dir>", "Clarinet project directory").option("--purge", "Also remove volumes (wipes the local index)").action(async (options3) => {
36934
+ devnet2.command("down").description("Stop the local Secondlayer stack started by `secondlayer devnet connect`").option("--project <dir>", "Clarinet project directory").option("--purge", "Also remove volumes (wipes the local index)").action(async (options3) => {
36929
36935
  await down(options3);
36930
36936
  });
36931
36937
  devnet2.command("status").description("Snapshot of the local stack: ingest, subgraphs, and recent activity").option("-w, --watch", "Refresh every 2s until Ctrl-C").option("--limit <n>", "Recent activity rows to show", "12").action(async (options3) => {
@@ -36987,15 +36993,15 @@ ${bold("Secondlayer stack up")}`);
36987
36993
  console.log(`
36988
36994
  ${bold("Next:")}`);
36989
36995
  console.log(` ${yellow("clarinet devnet start")} ${dim("# auto-deploys + streams to the indexer")}`);
36990
- console.log(` ${yellow("SL_API_URL=http://localhost:3800 SL_API_KEY=dummy sl subgraphs deploy ./subgraph.ts")}`);
36996
+ console.log(` ${yellow("SL_API_URL=http://localhost:3800 SL_API_KEY=dummy secondlayer subgraphs deploy ./subgraph.ts")}`);
36991
36997
  console.log(dim(`
36992
- Stop with: sl devnet down`));
36998
+ Stop with: secondlayer devnet down`));
36993
36999
  }
36994
37000
  async function down(options3) {
36995
37001
  const project = resolveProject(options3.project);
36996
37002
  const composePath = join9(project, COMPOSE_REL);
36997
37003
  if (!existsSync6(composePath)) {
36998
- error(`No ${COMPOSE_REL} in ${project} — nothing to stop. Run \`sl devnet connect\` first.`);
37004
+ error(`No ${COMPOSE_REL} in ${project} — nothing to stop. Run \`secondlayer devnet connect\` first.`);
36999
37005
  process.exit(1);
37000
37006
  }
37001
37007
  ensureDocker();
@@ -37010,7 +37016,7 @@ async function logs(service, options3) {
37010
37016
  const project = resolveProject(options3.project);
37011
37017
  const composePath = join9(project, COMPOSE_REL);
37012
37018
  if (!existsSync6(composePath)) {
37013
- error(`No ${COMPOSE_REL} in ${project} — run \`sl devnet connect\` first.`);
37019
+ error(`No ${COMPOSE_REL} in ${project} — run \`secondlayer devnet connect\` first.`);
37014
37020
  process.exit(1);
37015
37021
  }
37016
37022
  if (service && !SERVICES.includes(service)) {
@@ -37058,7 +37064,7 @@ async function renderStatus(limit) {
37058
37064
  out.push(` ${apiHealth ? green("●") : red("●")} api ${apiHealth ? "healthy" : "down"} ${dim(":3800")}`);
37059
37065
  if (!health) {
37060
37066
  out.push("");
37061
- out.push(dim(" indexer unreachable — is `sl devnet connect` running?"));
37067
+ out.push(dim(" indexer unreachable — is `secondlayer devnet connect` running?"));
37062
37068
  return out.join(`
37063
37069
  `);
37064
37070
  }
@@ -37073,7 +37079,7 @@ async function renderStatus(limit) {
37073
37079
  out.push("");
37074
37080
  out.push(bold("SUBGRAPHS"));
37075
37081
  if (subs.length === 0) {
37076
- out.push(dim(" none deployed — sl subgraphs deploy ./subgraph.ts"));
37082
+ out.push(dim(" none deployed — secondlayer subgraphs deploy ./subgraph.ts"));
37077
37083
  } else {
37078
37084
  for (const sg of subs) {
37079
37085
  const st = sg.status === "active" ? green(sg.status) : yellow(String(sg.status));
@@ -37113,7 +37119,7 @@ async function status(options3) {
37113
37119
  const tick = async () => {
37114
37120
  const body = await renderStatus(limit);
37115
37121
  process.stdout.write("\x1B[2J\x1B[H");
37116
- console.log(`${dim("sl devnet status")} ${dim("· ctrl-c to stop")}
37122
+ console.log(`${dim("secondlayer devnet status")} ${dim("· ctrl-c to stop")}
37117
37123
  `);
37118
37124
  console.log(body);
37119
37125
  };
@@ -37206,10 +37212,10 @@ function registerStreamsCommand(program2) {
37206
37212
  });
37207
37213
  const events = streams.command("events").description("List events (cursor-paginated; one page per call)").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--event-type <type>", "alias for a single-value --types (the Index spelling)").option("--not-types <types>", "comma-separated event types to exclude").option("--contract-id <ids>", "comma-separated contract identifier(s)").option("--sender <addrs>", "comma-separated sender principal(s)").option("--recipient <addrs>", "comma-separated recipient principal(s)").option("--cursor <cursor>", "start cursor (block_height:event_index)").option("--from-block <n>", "filter to blocks >= n").option("--to-block <n>", "filter to blocks <= n").option("--limit <n>", "page size (1-1000, default 100)", "100").option("--json", "Output as JSON (streams always emits JSON)").addHelpText("after", `
37208
37214
  Examples:
37209
- $ sl streams events --types stx_transfer,print --limit 50
37210
- $ sl streams events --not-types print --contract-id SP00....token,SP01....token
37211
- $ sl streams events --sender SP1...,SP2... --from-block 150000 --to-block 160000
37212
- $ sl streams events --cursor 150000:3`).action(async (options3) => {
37215
+ $ secondlayer streams events --types stx_transfer,print --limit 50
37216
+ $ secondlayer streams events --not-types print --contract-id SP00....token,SP01....token
37217
+ $ secondlayer streams events --sender SP1...,SP2... --from-block 150000 --to-block 160000
37218
+ $ secondlayer streams events --cursor 150000:3`).action(async (options3) => {
37213
37219
  try {
37214
37220
  const envelope = await client2().events.list({
37215
37221
  types: parseTypes(options3.types ?? options3.eventType),
@@ -37239,8 +37245,8 @@ Examples:
37239
37245
  });
37240
37246
  streams.command("consume").description("Long-running pull from a cursor; emits one event per line (jsonl) until SIGINT or --max-pages").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--not-types <types>", "comma-separated event types to exclude").option("--contract-id <ids>", "comma-separated contract identifier(s)").option("--sender <addrs>", "comma-separated sender principal(s)").option("--recipient <addrs>", "comma-separated recipient principal(s)").option("--cursor <cursor>", "start cursor (block_height:event_index)").option("--batch-size <n>", "events per batch (1-1000, default 100)", "100").option("--max-pages <n>", "stop after N pages (default: run until SIGINT)").addHelpText("after", `
37241
37247
  Examples:
37242
- $ sl streams consume --types print --cursor 150000:0
37243
- $ sl streams consume --not-types print --sender SP1...,SP2... --batch-size 500 --max-pages 10`).action(async (options3) => {
37248
+ $ secondlayer streams consume --types print --cursor 150000:0
37249
+ $ secondlayer streams consume --not-types print --sender SP1...,SP2... --batch-size 500 --max-pages 10`).action(async (options3) => {
37244
37250
  try {
37245
37251
  const batchSize = parseLimit(options3.batchSize) ?? 100;
37246
37252
  const maxPages = options3.maxPages ? Number.parseInt(options3.maxPages, 10) : undefined;
@@ -37286,8 +37292,8 @@ Examples:
37286
37292
  });
37287
37293
  streams.command("pull").description("Download finalized bulk parquet dumps to a local dir (verifies sha256)").requiredOption("--to <dir>", "output directory").option("--dumps-url <url>", "public dumps base URL (or SL_STREAMS_DUMPS_URL)").option("--from-block <n>", "only files covering blocks >= n").option("--to-block <n>", "only files covering blocks <= n").addHelpText("after", `
37288
37294
  Examples:
37289
- $ sl streams pull --to ./dump
37290
- $ sl streams pull --to ./dump --from-block 150000 --to-block 200000`).action(async (options3) => {
37295
+ $ secondlayer streams pull --to ./dump
37296
+ $ secondlayer streams pull --to ./dump --from-block 150000 --to-block 200000`).action(async (options3) => {
37291
37297
  try {
37292
37298
  const fromBlock = parseHeight(options3.fromBlock, "--from-block");
37293
37299
  const toBlock = parseHeight(options3.toBlock, "--to-block");
@@ -37715,7 +37721,7 @@ function markFrozen(cmd) {
37715
37721
  if (warned)
37716
37722
  return;
37717
37723
  warned = true;
37718
- process.stderr.write(`⚠ \`sl ${cmd.name()}\` is frozen — no further investment; it may be removed in a future major. The hosted dev loop (sl subgraphs create/deploy) is the supported path.
37724
+ process.stderr.write(`⚠ \`secondlayer ${cmd.name()}\` is frozen — no further investment; it may be removed in a future major. The hosted dev loop (secondlayer subgraphs create/deploy) is the supported path.
37719
37725
  `);
37720
37726
  };
37721
37727
  cmd.hook("preAction", warn2);
@@ -37748,7 +37754,7 @@ Subcommands:
37748
37754
  truncate Truncate all indexed data
37749
37755
  resync Reset database and restart indexer
37750
37756
 
37751
- Run \`sl db\` with no subcommand to print an overview.`).hook("preAction", async () => {
37757
+ Run \`secondlayer db\` with no subcommand to print an overview.`).hook("preAction", async () => {
37752
37758
  await requireLocalNetwork();
37753
37759
  }).action(async () => {
37754
37760
  await showOverview(10);
@@ -37809,14 +37815,14 @@ async function showOverview(_limit) {
37809
37815
  console.log(` Time: ${time}`);
37810
37816
  console.log("");
37811
37817
  }
37812
- console.log(dim(`Use 'sl db blocks|txs|events' to see records`));
37818
+ console.log(dim(`Use 'secondlayer db blocks|txs|events' to see records`));
37813
37819
  console.log("");
37814
37820
  process.exit(0);
37815
37821
  } catch (err) {
37816
37822
  error(`Failed to query database: ${err}`);
37817
37823
  console.log(dim(`
37818
37824
  Make sure PostgreSQL is running.`));
37819
- console.log(dim("Run 'sl local start' to start all services."));
37825
+ console.log(dim("Run 'secondlayer local start' to start all services."));
37820
37826
  process.exit(1);
37821
37827
  }
37822
37828
  }
@@ -37964,7 +37970,7 @@ async function resetDatabase(skipConfirm) {
37964
37970
  console.log("");
37965
37971
  success("Database reset complete");
37966
37972
  console.log("");
37967
- console.log(dim("Run 'sl local restart' to restart the indexer for fresh sync."));
37973
+ console.log(dim("Run 'secondlayer local restart' to restart the indexer for fresh sync."));
37968
37974
  console.log("");
37969
37975
  process.exit(0);
37970
37976
  } catch (err) {
@@ -38013,13 +38019,13 @@ async function resyncDatabase(skipConfirm, backfill) {
38013
38019
  }
38014
38020
  console.log(green(" ✓ Indexer stopped"));
38015
38021
  console.log("");
38016
- info("Run 'sl local restart' to start fresh sync");
38022
+ info("Run 'secondlayer local restart' to start fresh sync");
38017
38023
  } else {
38018
38024
  console.log("");
38019
38025
  success("Database reset complete");
38020
38026
  console.log("");
38021
38027
  if (!backfill) {
38022
- console.log(dim("Indexer not running. Start with 'sl local start' to begin sync."));
38028
+ console.log(dim("Indexer not running. Start with 'secondlayer local start' to begin sync."));
38023
38029
  }
38024
38030
  }
38025
38031
  if (backfill) {
@@ -38029,14 +38035,14 @@ async function resyncDatabase(skipConfirm, backfill) {
38029
38035
  const healthy = await nodeClient.isHealthy();
38030
38036
  if (!healthy) {
38031
38037
  warn(`Cannot reach Stacks node at ${nodeClient.getRpcUrl()}`);
38032
- console.log(dim("Run 'sl sync --from 1 --to <tip>' manually once the node is available."));
38038
+ console.log(dim("Run 'secondlayer sync --from 1 --to <tip>' manually once the node is available."));
38033
38039
  console.log("");
38034
38040
  process.exit(0);
38035
38041
  }
38036
38042
  const nodeInfo = await nodeClient.getInfo();
38037
38043
  const tip = nodeInfo.stacks_tip_height;
38038
38044
  info(`Node tip: block ${tip}. Fetching blocks 1 to ${tip}...`);
38039
- console.log(dim(`This may take a while. Run 'sl sync --from 1 --to ${tip}' if interrupted.`));
38045
+ console.log(dim(`This may take a while. Run 'secondlayer sync --from 1 --to ${tip}' if interrupted.`));
38040
38046
  console.log("");
38041
38047
  const { loadConfig: loadConfig3 } = await Promise.resolve().then(() => (init_config2(), exports_config));
38042
38048
  const config = await loadConfig3();
@@ -38125,7 +38131,7 @@ async function stackStart(options3) {
38125
38131
  if (options3.node) {
38126
38132
  const nodePath = config.node?.installPath;
38127
38133
  if (!nodePath) {
38128
- warn("No node configured, skipping. Run 'sl local node setup' to configure.");
38134
+ warn("No node configured, skipping. Run 'secondlayer local node setup' to configure.");
38129
38135
  } else if (await isNodeRunning()) {
38130
38136
  info("Node already running");
38131
38137
  } else {
@@ -38190,7 +38196,7 @@ async function stackStart(options3) {
38190
38196
  }
38191
38197
  console.log("");
38192
38198
  success("Stack started");
38193
- console.log(dim("Run 'sl status' to check health"));
38199
+ console.log(dim("Run 'secondlayer status' to check health"));
38194
38200
  console.log("");
38195
38201
  }
38196
38202
  async function stackStop(options3) {
@@ -38420,7 +38426,7 @@ async function showLocalLogs(options3) {
38420
38426
  async function showNodeLogs(options3) {
38421
38427
  if (!await isNodeRunning()) {
38422
38428
  error("Node is not running");
38423
- console.log(dim("Run 'sl local node start' first"));
38429
+ console.log(dim("Run 'secondlayer local node start' first"));
38424
38430
  process.exit(1);
38425
38431
  }
38426
38432
  const logs2 = await getNodeLogs({
@@ -38614,7 +38620,7 @@ function registerWhoamiCommand(program2) {
38614
38620
  try {
38615
38621
  auth = await resolveAuth();
38616
38622
  } catch {
38617
- error("Not logged in. Run: sl login");
38623
+ error("Not logged in. Run: secondlayer login");
38618
38624
  process.exit(1);
38619
38625
  }
38620
38626
  let account;
@@ -38622,7 +38628,7 @@ function registerWhoamiCommand(program2) {
38622
38628
  account = await httpPlatform("/api/accounts/me");
38623
38629
  } catch (err) {
38624
38630
  if (err instanceof CliHttpError && err.code === "SESSION_EXPIRED") {
38625
- error("Session expired. Run: sl login");
38631
+ error("Session expired. Run: secondlayer login");
38626
38632
  process.exit(1);
38627
38633
  }
38628
38634
  throw err;
@@ -38649,7 +38655,10 @@ function registerWhoamiCommand(program2) {
38649
38655
  rows.push(["Project", active.slug]);
38650
38656
  rows.push(["Project source", dim(active.resolvedFrom)]);
38651
38657
  } else {
38652
- rows.push(["Project", dim("(none — run `sl project use <slug>`)")]);
38658
+ rows.push([
38659
+ "Project",
38660
+ dim("(none — run `secondlayer project use <slug>`)")
38661
+ ]);
38653
38662
  }
38654
38663
  console.log(formatKeyValue(rows));
38655
38664
  }
@@ -38721,7 +38730,7 @@ function registerProjectCommand(program2) {
38721
38730
  await httpPlatform(`/api/projects/${encodeURIComponent(slug)}`);
38722
38731
  } catch (err) {
38723
38732
  if (err instanceof CliHttpError && err.status === 404) {
38724
- error(`Project "${slug}" not found — run 'sl project list' to see available projects`);
38733
+ error(`Project "${slug}" not found — run 'secondlayer project list' to see available projects`);
38725
38734
  process.exit(1);
38726
38735
  }
38727
38736
  handleProjectError(err);
@@ -38740,7 +38749,7 @@ function registerProjectCommand(program2) {
38740
38749
  human: () => {
38741
38750
  if (!active) {
38742
38751
  info("No active project.");
38743
- info(dim("Run 'sl project use <slug>' to bind this directory."));
38752
+ info(dim("Run 'secondlayer project use <slug>' to bind this directory."));
38744
38753
  return;
38745
38754
  }
38746
38755
  console.log(active.slug);
@@ -38752,7 +38761,7 @@ function registerProjectCommand(program2) {
38752
38761
  function handleProjectError(err) {
38753
38762
  if (err instanceof CliHttpError) {
38754
38763
  if (err.code === "SESSION_EXPIRED") {
38755
- error("Session expired. Run: sl login");
38764
+ error("Session expired. Run: secondlayer login");
38756
38765
  process.exit(1);
38757
38766
  }
38758
38767
  error(err.message);
@@ -38920,11 +38929,11 @@ function statusLabel(status2) {
38920
38929
  function registerVerifyCommand(program2) {
38921
38930
  program2.command("verify").description("Compare local chain data against a signed archive (read-only; nothing is uploaded)").argument("[target]", "all | raw | decode:<name> | subgraph:<name>", "raw").option("--quick", "coverage/identity only (default)").option("--deep", "include semantic / scratch replay where available").option("--anchor", "require a verified archive signature").requiredOption("--against <manifest>", "archive manifest: an https URL or a local file path").option("--from-block <n>", "first height to check").option("--to-block <n>", "last height to check").option("--counts", "also compare transaction/event row counts (slower)").option("--semantic", "also recompute per-partition semantic digests locally and compare (slow: full re-stream)").option("--public-key <pem>", "pin the signing key instead of fetching it").option("--insecure", "skip the manifest signature check (not recommended)").option("--json", "Output as JSON").addHelpText("after", `
38922
38931
  Examples:
38923
- $ sl verify --against https://archive.secondlayer.tools/.../snapshots/<digest>.json
38924
- $ sl verify raw --against ./snapshot.json --from-block 8000000 --to-block 8499999
38925
- $ sl verify all --against ./snapshot.json --json
38926
- $ sl verify decode:ft_transfer --against ./snapshot.json --quick
38927
- $ sl verify subgraph:sbtc --against ./snapshot.json --deep
38932
+ $ secondlayer verify --against https://archive.secondlayer.tools/.../snapshots/<digest>.json
38933
+ $ secondlayer verify raw --against ./snapshot.json --from-block 8000000 --to-block 8499999
38934
+ $ secondlayer verify all --against ./snapshot.json --json
38935
+ $ secondlayer verify decode:ft_transfer --against ./snapshot.json --quick
38936
+ $ secondlayer verify subgraph:sbtc --against ./snapshot.json --deep
38928
38937
 
38929
38938
  Exit codes:
38930
38939
  0 local data matches the archive
@@ -39088,7 +39097,7 @@ Exit codes:
39088
39097
  console.error(dim("These ranges hold different data than the signed archive. Repair with:"));
39089
39098
  const first = diverged[0];
39090
39099
  if (first) {
39091
- console.error(dim(` sl repair --from-block ${first.from_block} --to-block ${first.to_block}`));
39100
+ console.error(dim(` secondlayer repair --from-block ${first.from_block} --to-block ${first.to_block}`));
39092
39101
  }
39093
39102
  }
39094
39103
  });
@@ -39222,9 +39231,9 @@ async function applyFixes(db, reference, partition, fixes) {
39222
39231
  function registerRepairCommand(program2) {
39223
39232
  program2.command("repair").description("Replace local chain data that diverges from a signed archive (dry-run by default)").requiredOption("--against <manifest>", "archive manifest: an https URL or a local file path").option("--from-block <n>", "first height to consider").option("--to-block <n>", "last height to consider").option("--apply", "write the repair (default is a dry-run plan)").option("--public-key <pem>", "pin the signing key instead of fetching it").option("--json", "Output as JSON").addHelpText("after", `
39224
39233
  Examples:
39225
- $ sl repair --against ./snapshot.json # plan only
39226
- $ sl repair --against ./snapshot.json --apply # write the fix
39227
- $ sl repair --against ./snapshot.json --from-block 8500000 --to-block 8549999
39234
+ $ secondlayer repair --against ./snapshot.json # plan only
39235
+ $ secondlayer repair --against ./snapshot.json --apply # write the fix
39236
+ $ secondlayer repair --against ./snapshot.json --from-block 8500000 --to-block 8549999
39228
39237
 
39229
39238
  Exit codes:
39230
39239
  0 nothing to repair, or the repair completed and re-verified clean
@@ -39454,8 +39463,8 @@ async function loadPartition(reference, partition, rawClient) {
39454
39463
  function attachBootstrapCommand(cmd) {
39455
39464
  return cmd.requiredOption("--against <manifest>", "archive manifest: an https URL or a local file path").option("--to-block <n>", "stop at this height instead of the archive tip").option("--public-key <pem>", "pin the signing key instead of fetching it").option("-y, --yes", "skip the confirmation prompt").option("--json", "Output as JSON").addHelpText("after", `
39456
39465
  Examples:
39457
- $ sl bootstrap --against https://archive.secondlayer.tools/.../snapshots/<digest>.json
39458
- $ sl bootstrap --against ./snapshot.json --to-block 4000000 --yes
39466
+ $ secondlayer bootstrap --against https://archive.secondlayer.tools/.../snapshots/<digest>.json
39467
+ $ secondlayer bootstrap --against ./snapshot.json --to-block 4000000 --yes
39459
39468
 
39460
39469
  Exit codes:
39461
39470
  0 restored and verified
@@ -39488,7 +39497,7 @@ Exit codes:
39488
39497
  });
39489
39498
  if (resume.action === "refuse") {
39490
39499
  printError(resume.reason, {
39491
- hint: "Bootstrap is for a fresh instance. To fix an existing one, use `sl repair`."
39500
+ hint: "Bootstrap is for a fresh instance. To fix an existing one, use `secondlayer repair`."
39492
39501
  });
39493
39502
  process.exit(BOOTSTRAP_EXIT.REFUSED);
39494
39503
  }
@@ -39612,7 +39621,7 @@ Exit codes:
39612
39621
  }
39613
39622
  } else {
39614
39623
  warn(`Restored ${loaded.blocks.toLocaleString()} blocks but ${divergent} ranges do not match the archive.`);
39615
- console.error(dim(" Investigate with: sl verify --against <manifest>"));
39624
+ console.error(dim(" Investigate with: secondlayer verify --against <manifest>"));
39616
39625
  }
39617
39626
  }
39618
39627
  });
@@ -39691,7 +39700,7 @@ function buildInstanceEnv(input4) {
39691
39700
  }
39692
39701
  function renderInstanceEnv(env2) {
39693
39702
  const lines2 = [
39694
- "# Generated by sl init. Do not commit.",
39703
+ "# Generated by secondlayer init. Do not commit.",
39695
39704
  `INSTANCE_MODE=${env2.INSTANCE_MODE}`,
39696
39705
  `STACKS_NETWORK=${env2.STACKS_NETWORK}`,
39697
39706
  `INSTANCE_TOKEN=${env2.INSTANCE_TOKEN}`,
@@ -39868,7 +39877,7 @@ function registerStartCommand(program2) {
39868
39877
  }
39869
39878
  // src/cli.ts
39870
39879
  var { version } = package_default;
39871
- program.name("secondlayer").alias("sl").description("Secondlayer CLI — self-hosted Stacks data runtime").version(version).option("--network <network>", "Override network (local, testnet, mainnet)").option("--api-key <key>", "API credential (overrides SL_API_KEY)").option("--api-url <url>", "API endpoint (overrides SL_API_URL)").showSuggestionAfterError(true).showHelpAfterError("(run `sl --help` to see available commands)");
39880
+ program.name("secondlayer").alias("sl").description("Secondlayer CLI — self-hosted Stacks data runtime").version(version).option("--network <network>", "Override network (local, testnet, mainnet)").option("--api-key <key>", "API credential (overrides SL_API_KEY)").option("--api-url <url>", "API endpoint (overrides SL_API_URL)").showSuggestionAfterError(true).showHelpAfterError("(run `secondlayer --help` to see available commands)");
39872
39881
  program.hook("preAction", (thisCommand) => {
39873
39882
  const { network, apiKey, apiUrl } = thisCommand.opts();
39874
39883
  if (network)
@@ -39880,10 +39889,10 @@ program.hook("preAction", (thisCommand) => {
39880
39889
  });
39881
39890
  program.addHelpText("after", `
39882
39891
  Quickstart:
39883
- $ sl init --network mainnet
39884
- $ sl bootstrap --against <manifest>
39885
- $ sl subgraphs create my-watcher --template sip-010-balances
39886
- $ sl subgraphs deploy subgraphs/my-watcher.ts
39892
+ $ secondlayer init --network mainnet
39893
+ $ secondlayer bootstrap --against <manifest>
39894
+ $ secondlayer subgraphs create my-watcher --template sip-010-balances
39895
+ $ secondlayer subgraphs deploy subgraphs/my-watcher.ts
39887
39896
  `);
39888
39897
  program.commandsGroup("Getting started:");
39889
39898
  registerInitCommand(program);
@@ -39903,7 +39912,7 @@ registerProjectCommand(program);
39903
39912
  registerCodegenCommand(program);
39904
39913
  var configureGenerate = (cmd) => cmd.option("-c, --config <path>", "Path to config file").option("-o, --output <path>", "Output file path (required when using direct files)").option("-k, --api-key <key>", "Stacks node API key for direct RPC URLs").option("-w, --watch", "Watch for changes").action(async (files, options3) => {
39905
39914
  const { deprecatedCodegenNotice: deprecatedCodegenNotice2 } = await Promise.resolve().then(() => (init_codegen(), exports_codegen));
39906
- deprecatedCodegenNotice2("sl contracts generate", "sl codegen contracts");
39915
+ deprecatedCodegenNotice2("secondlayer contracts generate", "secondlayer codegen contracts");
39907
39916
  options3.out = options3.output;
39908
39917
  const { generate: generate2 } = await Promise.resolve().then(() => (init_generate(), exports_generate));
39909
39918
  await generate2(files, options3);
@@ -39911,9 +39920,9 @@ var configureGenerate = (cmd) => cmd.option("-c, --config <path>", "Path to conf
39911
39920
  var contracts = program.command("contracts").description("Work with Clarity contracts");
39912
39921
  configureGenerate(contracts.command("generate [files...]").aliases(["gen"]).description("Generate TypeScript interfaces from Clarity contracts")).addHelpText("after", `
39913
39922
  Examples:
39914
- $ sl contracts generate
39915
- $ sl contracts generate ./contracts/pool.clar -o ./src/generated.ts
39916
- $ sl contracts generate --config secondlayer.config.ts --watch`);
39923
+ $ secondlayer contracts generate
39924
+ $ secondlayer contracts generate ./contracts/pool.clar -o ./src/generated.ts
39925
+ $ secondlayer contracts generate --config secondlayer.config.ts --watch`);
39917
39926
  program.commandsGroup("Local development:");
39918
39927
  registerLocalCommand(program);
39919
39928
  registerDevnetCommand(program);
@@ -39930,5 +39939,5 @@ registerAccountCommand(program);
39930
39939
  registerKeysCommand(program);
39931
39940
  program.parse();
39932
39941
 
39933
- //# debugId=71DA8EB190B9ACCF64756E2164756E21
39942
+ //# debugId=0D2E887299BDADAE64756E2164756E21
39934
39943
  //# sourceMappingURL=cli.js.map