@secondlayer/cli 12.2.0 → 13.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.
Files changed (4) hide show
  1. package/README.md +31 -16
  2. package/dist/cli.js +2334 -492
  3. package/dist/cli.js.map +36 -30
  4. package/package.json +8 -6
package/README.md CHANGED
@@ -26,15 +26,29 @@ export SL_API_KEY=<INSTANCE_TOKEN>
26
26
 
27
27
  ```bash
28
28
  bun add -g @secondlayer/cli
29
- secondlayer init --network mainnet
30
- secondlayer start --print
31
- # docker compose -f docker/oss/docker-compose.yml up -d
29
+ secondlayer setup
32
30
 
33
31
  secondlayer subgraphs scaffold SP1234ABCD.my-contract -o subgraphs/my-contract.ts
34
32
  secondlayer subgraphs deploy subgraphs/my-contract.ts --start-block <recent-block>
35
33
  secondlayer subgraphs query my-contract <table> --sort _block_height --order desc
36
34
  ```
37
35
 
36
+ `secondlayer setup` is a guided wizard: it picks network + node mode (with the
37
+ RAM/disk floor shown live), generates secrets, writes `docker-compose.yml` and
38
+ `.env` into a target directory, brings the stack up, prints the observer
39
+ stanza for an external node, and restores + verifies history from the
40
+ archive — the one-command replacement for `init` → hand-copy secrets →
41
+ `docker compose up` → `observer` → `bootstrap` → `verify`. Without a TTY (or
42
+ with `--yes`), it skips the interactive prompts and runs from flags instead;
43
+ `--network` and `--node-mode` are then required, and `--against` is required
44
+ unless you pass `--skip-bootstrap`:
45
+
46
+ ```bash
47
+ secondlayer setup --yes \
48
+ --network mainnet --node-mode external \
49
+ --against https://archive.secondlayer.tools/latest.json
50
+ ```
51
+
38
52
  `secondlayer subgraphs scaffold` writes the definition file, creates/updates
39
53
  `package.json`, and runs `bun install` (pass `--no-install` to skip).
40
54
 
@@ -46,6 +60,7 @@ No account. Writes `.env.local`, restores history, prints the Stacks observer st
46
60
 
47
61
  | Command | What it does |
48
62
  |---|---|
63
+ | `secondlayer setup [--network …] [--node-mode external\|stacks\|full] [--api-port <spec>] [--dir <path>] [--against <manifest>] [--skip-bootstrap] [--skip-verify] [--yes] [--force]` | Guided self-host onboarding — secrets, compose + `.env`, docker up, observer stanza, bootstrap, verify. TUI when interactive; flags-only (no prompts) with `--yes` or no TTY |
49
64
  | `secondlayer init [--network mainnet\|testnet\|devnet] [--api-url <url>] [--force]` | Write `.env.local` (token, secrets key, webhook signing key). Idempotent |
50
65
  | `secondlayer start [--print]` | Validate one-box config and print `docker compose up` |
51
66
  | `secondlayer 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 |
@@ -96,22 +111,22 @@ points at.
96
111
  |---|---|
97
112
  | `secondlayer subgraphs create <name>` | Scaffold a definition file |
98
113
  | `secondlayer subgraphs scaffold <SP...::contract> [-o <path>] [--no-install]` | Generate a subgraph from a deployed contract |
99
- | `secondlayer subgraphs deploy <file> [--start-block <n>] [--visibility public\|private]` | Deploy; `--start-block` overrides the definition. Deploys default `public` |
114
+ | `secondlayer subgraphs deploy <file> [--start-block <n>]` | Deploy; `--start-block` overrides the definition |
100
115
  | `secondlayer subgraphs list` | List deployments (`ls` alias) |
101
116
  | `secondlayer subgraphs dev <file>` | Watch + hot-redeploy |
102
117
  | `secondlayer subgraphs query <name> <table>` | Query a table with filters, sort, pagination |
103
118
  | `secondlayer subgraphs status <name>` / `gaps <name>` | Inspect a deployment |
104
119
  | `secondlayer subgraphs spec <nameOrFile> [--format openapi\|agent\|markdown]` | Export API docs for a deployed subgraph or a local definition file |
105
- | `secondlayer subgraphs codegen <file> --target prisma\|drizzle [-o <path>]` | Generate a typed ORM schema for the subgraph's tables |
106
- | `secondlayer subgraphs client <name> -o <path>` | Generate a typed query client for a deployed subgraph |
107
- | `secondlayer subgraphs reindex/backfill/cancel/delete <name>` | Manage processing |
120
+ | `secondlayer codegen subgraph <file> --target kysely\|prisma\|drizzle [-o <path>]` | Generate a typed ORM schema for the subgraph's tables |
121
+ | `secondlayer codegen client <name> -o <path>` | Generate a typed query client for a deployed subgraph |
122
+ | `secondlayer subgraphs reindex/backfill/stop/delete <name>` | Manage processing |
108
123
 
109
124
  ### Data products (reads)
110
125
 
111
126
  | Command | What it does |
112
127
  |---|---|
113
128
  | `secondlayer index ft-transfers` / `nft-transfers` / `events --event-type <t>` / `contract-calls` | Decoded Index layer. Anonymous reads OK |
114
- | `secondlayer streams tip` / `events` / `consume` / `reorgs` / `canonical <h>` / `pull` | Raw chain event firehose. **Requires `SL_API_KEY`** |
129
+ | `secondlayer streams tip` / `events` / `consume` / `reorgs` / `canonical <h>` / `dumps` | Raw chain event firehose. **Requires `SL_API_KEY`** |
115
130
 
116
131
  Reads emit JSON to stdout (`--json` accepted across all read commands); `-o/--output` is a file path, not a format.
117
132
 
@@ -144,7 +159,7 @@ operates on both kinds.
144
159
 
145
160
  | Command | What it does |
146
161
  |---|---|
147
- | `secondlayer contracts generate [files...]` (alias `gen`) | Generate TS interfaces from Clarity contracts |
162
+ | `secondlayer codegen contracts [files...]` | Generate TS interfaces from Clarity contracts |
148
163
  | `secondlayer context` | Instance snapshot — Streams + Index tips, subgraphs, subscriptions |
149
164
  | `secondlayer doctor` / `secondlayer status` | Reachability + health checks |
150
165
  | `secondlayer config get/set/reset/delete` | Inspect or reset local config |
@@ -157,26 +172,26 @@ operates on both kinds.
157
172
  | `SL_API_URL` | Instance API. Default `http://127.0.0.1:3800` |
158
173
  | `SL_PLATFORM_API_URL` | Alias of `SL_API_URL` |
159
174
  | `STACKS_NETWORK` | Default network (also via `--network <local\|testnet\|mainnet>`) |
160
- | `HIRO_API_KEY` | Used by `secondlayer contracts generate` for remote contract fetches |
175
+ | `HIRO_API_KEY` | Used by `secondlayer codegen contracts` for remote contract fetches |
161
176
 
162
- ## Code generation (`secondlayer contracts generate`)
177
+ ## Code generation (`secondlayer codegen contracts`)
163
178
 
164
179
  Generate type-safe interfaces, functions, and optional React hooks from Clarity
165
180
  contracts — local `.clar` files, deployed contracts (network inferred from
166
181
  address prefix), or globs.
167
182
 
168
183
  ```bash
169
- secondlayer contracts generate ./contracts/token.clar -o ./src/generated.ts
170
- secondlayer contracts generate SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.alex-vault -o ./src/generated.ts
171
- secondlayer contracts generate "./contracts/*.clar" -o ./src/generated.ts
172
- secondlayer contracts generate --watch # regenerate on .clar / config / Clarinet.toml changes
184
+ secondlayer codegen contracts ./contracts/token.clar -o ./src/generated.ts
185
+ secondlayer codegen contracts SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.alex-vault -o ./src/generated.ts
186
+ secondlayer codegen contracts "./contracts/*.clar" -o ./src/generated.ts
187
+ secondlayer codegen contracts --watch # regenerate on .clar / config / Clarinet.toml changes
173
188
  ```
174
189
 
175
190
  Config-driven:
176
191
 
177
192
  ```bash
178
193
  # write a secondlayer.config.ts, then:
179
- secondlayer contracts generate # regenerates from the config
194
+ secondlayer codegen contracts # regenerates from the config
180
195
  ```
181
196
 
182
197
  ```typescript