@secondlayer/cli 10.0.0 → 10.1.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
@@ -62,6 +62,18 @@ sl subscriptions create my-hook \
62
62
 
63
63
  ## Commands
64
64
 
65
+ ### Local runtime
66
+
67
+ No account. Writes `.env.local`, restores history, prints the Stacks observer stanza.
68
+
69
+ | Command | What it does |
70
+ |---|---|
71
+ | `sl init [--network mainnet\|testnet\|devnet] [--api-url <url>] [--force]` | Write `.env.local` (token, secrets key, webhook signing key). Idempotent |
72
+ | `sl bootstrap --against <manifest> [--to-block <n>] [--public-key <pem>] [-y] [--json]` | Restore chain history from a verified archive into an empty database. Exit `0` restored, `1` diverged, `2` refused |
73
+ | `sl observer [--mode indexer\|signer-shared] [--endpoint host:port] [--recovery journal\|archive] [--network …]` | Print the `[[events_observer]]` stanza. Signer-shared requires `--recovery` |
74
+ | `sl verify [all\|raw\|decode:<name>\|subgraph:<name>] --against <manifest> [--quick\|--deep\|--anchor]` | Compare local data to a signed archive. Default target `raw`. Exit `0` clean, `1` diverged, `2` unanchored |
75
+ | `sl repair --against <archive> [--apply]` | Plan (default) or apply an archive repair |
76
+
65
77
  ### Auth & project
66
78
 
67
79
  | Command | What it does |
@@ -90,10 +102,10 @@ scoped reads and cannot mint (403). Minted keys inherit your plan's tier.
90
102
  | `sl subgraphs create <name>` | Scaffold a definition file |
91
103
  | `sl subgraphs scaffold <SP...::contract> [-o <path>] [--no-install]` | Generate a subgraph from a deployed contract |
92
104
  | `sl subgraphs deploy <file> [--start-block <n>] [--visibility public\|private]` | Deploy; `--start-block` overrides the definition. Managed deploys default `public`, BYO default `private` |
93
- | `sl subgraphs publish <name>` / `unpublish <name>` | Flip visibility; publish claims the global public name (409 `PUBLIC_NAME_TAKEN` if claimed) |
105
+ | `sl subgraphs list` | List deployments (`ls` alias) |
94
106
  | `sl subgraphs dev <file>` | Watch + hot-redeploy |
95
107
  | `sl subgraphs query <name> <table>` | Query a table with filters, sort, pagination |
96
- | `sl subgraphs list` / `status <name>` / `gaps <name>` | Inspect deployments |
108
+ | `sl subgraphs status <name>` / `gaps <name>` | Inspect a deployment |
97
109
  | `sl subgraphs spec <nameOrFile> [--format openapi\|agent\|markdown]` | Export API docs for a deployed subgraph or a local definition file |
98
110
  | `sl subgraphs deploy <file> --database-url <url>` | BYO: write the subgraph's rows to your own Postgres |
99
111
  | `sl subgraphs codegen <file> --target prisma\|drizzle [-o <path>]` | Generate an ORM schema for the subgraph's tables (BYO DB) |
@@ -141,9 +153,6 @@ deliveries/...) operates on both kinds.
141
153
  |---|---|
142
154
  | `sl contracts generate [files...]` (alias `gen`) | Generate TS interfaces from Clarity contracts |
143
155
  | `sl context` | Print a headless orientation snapshot — account, Streams + Index tips, your subgraphs, subscriptions, and in-flight reindex operations. CLI counterpart to the MCP `secondlayer://context` resource |
144
- | `sl init` | Write `.env.local` (token, secrets key, webhook signing key) |
145
- | `sl bootstrap` | Restore chain history from a verified archive |
146
- | `sl observer` | Print the Stacks `events_observer` stanza |
147
156
  | `sl doctor` / `sl status` | Reachability + health checks |
148
157
  | `sl account get` / `sl account update` | Show or update display name / bio / slug |
149
158
  | `sl account billing` | Show plan, subscription, trial, discounts |
package/dist/cli.js CHANGED
@@ -34784,7 +34784,7 @@ init_esm();
34784
34784
  // package.json
34785
34785
  var package_default = {
34786
34786
  name: "@secondlayer/cli",
34787
- version: "10.0.0",
34787
+ version: "10.1.0",
34788
34788
  repository: {
34789
34789
  type: "git",
34790
34790
  url: "git+https://github.com/ryanwaits/secondlayer.git",
@@ -34825,10 +34825,10 @@ var package_default = {
34825
34825
  "@biomejs/wasm-nodejs": "^1.9.0",
34826
34826
  "@dsnp/parquetjs": "^1.8.8",
34827
34827
  "@inquirer/prompts": "^8.2.0",
34828
- "@secondlayer/bundler": "^0.4.1",
34828
+ "@secondlayer/bundler": "^0.5.0",
34829
34829
  "@secondlayer/scaffold": "^1.5.1",
34830
34830
  "@secondlayer/sdk": "^6.51.0",
34831
- "@secondlayer/shared": "^7.9.0",
34831
+ "@secondlayer/shared": "^7.10.0",
34832
34832
  "@secondlayer/stacks": "^3.3.1",
34833
34833
  "@secondlayer/subgraphs": "^3.26.4",
34834
34834
  esbuild: "^0.27.4",
@@ -38738,6 +38738,11 @@ import {
38738
38738
  comparePartitionSemanticDigests,
38739
38739
  computePartitionSemanticDigest
38740
38740
  } from "@secondlayer/shared/archive/semantic-digest-builder";
38741
+ import {
38742
+ datasetMatchesTarget,
38743
+ parseVerifyTarget,
38744
+ reportVerify
38745
+ } from "@secondlayer/shared/coverage";
38741
38746
  import { getDb as getDb2 } from "@secondlayer/shared/db";
38742
38747
 
38743
38748
  // src/lib/archive-reference.ts
@@ -38881,17 +38886,21 @@ function statusLabel(status2) {
38881
38886
  return yellow("missing");
38882
38887
  }
38883
38888
  function registerVerifyCommand(program2) {
38884
- program2.command("verify").description("Compare local chain data against a signed archive (read-only; nothing is uploaded)").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", `
38889
+ 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", `
38885
38890
  Examples:
38886
38891
  $ sl verify --against https://archive.secondlayer.tools/.../snapshots/<digest>.json
38887
- $ sl verify --against ./snapshot.json --from-block 8000000 --to-block 8499999
38888
- $ sl verify --against ./snapshot.json --counts --json
38892
+ $ sl verify raw --against ./snapshot.json --from-block 8000000 --to-block 8499999
38893
+ $ sl verify all --against ./snapshot.json --json
38894
+ $ sl verify decode:ft_transfer --against ./snapshot.json --quick
38895
+ $ sl verify subgraph:sbtc --against ./snapshot.json --deep
38889
38896
 
38890
38897
  Exit codes:
38891
38898
  0 local data matches the archive
38892
38899
  1 divergence found (divergent ranges are listed)
38893
- 2 unanchored — reference unavailable or unverifiable`).action(async (opts) => {
38900
+ 2 unanchored — reference unavailable or unverifiable`).action(async (targetArg, opts) => {
38894
38901
  try {
38902
+ const target = parseVerifyTarget(targetArg);
38903
+ const mode = opts.deep ? "deep" : opts.anchor ? "anchor" : "quick";
38895
38904
  const fromBlock = opts.fromBlock === undefined ? undefined : parseHeight2(opts.fromBlock, "--from-block");
38896
38905
  const toBlock = opts.toBlock === undefined ? undefined : parseHeight2(opts.toBlock, "--to-block");
38897
38906
  if (fromBlock !== undefined && toBlock !== undefined && toBlock < fromBlock) {
@@ -38907,6 +38916,12 @@ Exit codes:
38907
38916
  output({
38908
38917
  json: opts.json,
38909
38918
  data: {
38919
+ ...reportVerify({
38920
+ target,
38921
+ mode,
38922
+ anchored: false,
38923
+ detail: signature.reason
38924
+ }),
38910
38925
  status: "unanchored",
38911
38926
  reference: origin,
38912
38927
  reason: signature.reason
@@ -38916,6 +38931,8 @@ Exit codes:
38916
38931
  process.exit(VERIFY_EXIT.UNANCHORED);
38917
38932
  }
38918
38933
  const reference = (manifest.range_digests ?? []).filter((d2) => {
38934
+ if (!datasetMatchesTarget(d2.dataset, target))
38935
+ return false;
38919
38936
  if (fromBlock !== undefined && d2.to_block < fromBlock)
38920
38937
  return false;
38921
38938
  if (toBlock !== undefined && d2.from_block > toBlock)
@@ -38963,13 +38980,15 @@ Exit codes:
38963
38980
  }
38964
38981
  const semanticChecks = [];
38965
38982
  const referenceSemantic = (manifest.partition_semantic_digests ?? []).filter((d2) => {
38983
+ if (!datasetMatchesTarget(d2.dataset, target))
38984
+ return false;
38966
38985
  if (fromBlock !== undefined && d2.to_block < fromBlock)
38967
38986
  return false;
38968
38987
  if (toBlock !== undefined && d2.from_block > toBlock)
38969
38988
  return false;
38970
38989
  return true;
38971
38990
  });
38972
- if (opts.semantic) {
38991
+ if (opts.semantic || opts.deep) {
38973
38992
  if (referenceSemantic.length === 0) {
38974
38993
  warn("Reference publishes no semantic digests; --semantic had nothing to compare.");
38975
38994
  } else {
@@ -39001,8 +39020,14 @@ Exit codes:
39001
39020
  }))
39002
39021
  ];
39003
39022
  const diverged = all2.filter((c4) => c4.status !== "match");
39023
+ const verdict = reportVerify({
39024
+ target,
39025
+ mode,
39026
+ diverged: diverged.length > 0
39027
+ });
39004
39028
  const report = {
39005
- status: diverged.length === 0 ? "clean" : "diverged",
39029
+ ...verdict,
39030
+ status: verdict.status,
39006
39031
  reference: origin,
39007
39032
  signature_verified: signature.verified,
39008
39033
  ranges_checked: all2.length,
@@ -39838,5 +39863,5 @@ registerAccountCommand(program);
39838
39863
  registerKeysCommand(program);
39839
39864
  program.parse();
39840
39865
 
39841
- //# debugId=8F8395688EA7983464756E2164756E21
39866
+ //# debugId=43937D51F562F20264756E2164756E21
39842
39867
  //# sourceMappingURL=cli.js.map