@secondlayer/cli 6.0.0 → 7.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 +38 -36
- package/dist/cli.js +829 -855
- package/dist/cli.js.map +21 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,18 +14,22 @@ Two ways to authenticate:
|
|
|
14
14
|
|
|
15
15
|
- **Interactive (`sl login`)** — magic-link email → 6-digit code → session
|
|
16
16
|
written to `~/.secondlayer/session.json`. Used for day-to-day CLI work.
|
|
17
|
-
- **Machine / CI** — set `
|
|
17
|
+
- **Machine / CI** — set `SL_API_KEY` to an API key created in the platform
|
|
18
18
|
console at https://secondlayer.tools/platform/api-keys. Keys are prefixed
|
|
19
|
-
`sk-sl_`.
|
|
19
|
+
`sk-sl_`. For a persisted headless login: `echo "$SL_API_KEY" | sl login --with-token`.
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
# interactive
|
|
23
23
|
sl login
|
|
24
24
|
|
|
25
25
|
# machine / CI
|
|
26
|
-
export
|
|
26
|
+
export SL_API_KEY=sk-sl_xxxxxxxx
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
`sl whoami` shows the active account, the effective API URL, and the credential
|
|
30
|
+
source (and exits non-zero when not logged in). The global `--api-key` /
|
|
31
|
+
`--api-url` flags (and `SL_API_KEY` / `SL_API_URL`) apply to every command.
|
|
32
|
+
|
|
29
33
|
During open beta, reads are public (no key needed). Writes — deploying or
|
|
30
34
|
managing subgraphs and subscriptions — require a session or an `sk-sl_` key.
|
|
31
35
|
|
|
@@ -34,8 +38,8 @@ managing subgraphs and subscriptions — require a session or an `sk-sl_` key.
|
|
|
34
38
|
```bash
|
|
35
39
|
bun add -g @secondlayer/cli
|
|
36
40
|
sl login
|
|
37
|
-
sl
|
|
38
|
-
sl
|
|
41
|
+
sl projects create my-app
|
|
42
|
+
sl projects use my-app
|
|
39
43
|
|
|
40
44
|
# scaffold + deploy a subgraph from a deployed contract
|
|
41
45
|
sl subgraphs scaffold SP1234ABCD.my-contract -o subgraphs/my-contract.ts
|
|
@@ -43,7 +47,7 @@ sl subgraphs deploy subgraphs/my-contract.ts --start-block <recent-block>
|
|
|
43
47
|
sl subgraphs query my-contract <table> --sort _block_height --order desc
|
|
44
48
|
|
|
45
49
|
# wire a webhook receiver
|
|
46
|
-
sl create
|
|
50
|
+
sl subscriptions create my-hook \
|
|
47
51
|
--runtime node \
|
|
48
52
|
--subgraph my-contract \
|
|
49
53
|
--table <table> \
|
|
@@ -60,11 +64,11 @@ sl create subscription my-hook \
|
|
|
60
64
|
| Command | What it does |
|
|
61
65
|
|---|---|
|
|
62
66
|
| `sl login` / `sl logout` | Start or revoke a session |
|
|
63
|
-
| `sl whoami` | Print account
|
|
64
|
-
| `sl
|
|
65
|
-
| `sl
|
|
66
|
-
| `sl
|
|
67
|
-
| `sl
|
|
67
|
+
| `sl whoami` | Print account, credential source, and active project |
|
|
68
|
+
| `sl projects create [name]` | Create a project |
|
|
69
|
+
| `sl projects list` | List projects |
|
|
70
|
+
| `sl projects use <slug>` | Bind cwd to a project (writes `./.secondlayer/project`) |
|
|
71
|
+
| `sl projects get` | Show resolved project + source file |
|
|
68
72
|
|
|
69
73
|
Project binding is per-directory: `.secondlayer/project` in cwd takes
|
|
70
74
|
precedence over `~/.secondlayer/config.json:defaultProject`. The walk-up stops
|
|
@@ -74,27 +78,23 @@ at `.git`.
|
|
|
74
78
|
|
|
75
79
|
| Command | What it does |
|
|
76
80
|
|---|---|
|
|
77
|
-
| `sl subgraphs
|
|
81
|
+
| `sl subgraphs create <name>` | Scaffold a definition file |
|
|
78
82
|
| `sl subgraphs scaffold <SP...::contract> [-o <path>] [--no-install]` | Generate a subgraph from a deployed contract |
|
|
79
83
|
| `sl subgraphs deploy <file> [--start-block <n>]` | Deploy; `--start-block` overrides the definition |
|
|
80
84
|
| `sl subgraphs dev <file>` | Watch + hot-redeploy |
|
|
81
85
|
| `sl subgraphs query <name> <table>` | Query a table with filters, sort, pagination |
|
|
82
86
|
| `sl subgraphs list` / `status <name>` / `gaps <name>` | Inspect deployments |
|
|
83
|
-
| `sl subgraphs spec <
|
|
84
|
-
| `sl subgraphs inspect <file> [--format ...]` | Same docs from a local definition before deploy |
|
|
87
|
+
| `sl subgraphs spec <nameOrFile> [--format openapi\|agent\|markdown]` | Export API docs for a deployed subgraph or a local definition file |
|
|
85
88
|
| `sl subgraphs deploy <file> --database-url <url>` | BYO: write the subgraph's rows to your own Postgres |
|
|
86
89
|
| `sl subgraphs codegen <file> --target prisma\|drizzle [-o <path>]` | Generate an ORM schema for the subgraph's tables (BYO DB) |
|
|
87
|
-
| `sl subgraphs client <name> -o <path>` | Generate a typed query client for a deployed subgraph
|
|
88
|
-
| `sl subgraphs reindex/backfill/
|
|
90
|
+
| `sl subgraphs client <name> -o <path>` | Generate a typed query client for a deployed subgraph |
|
|
91
|
+
| `sl subgraphs reindex/backfill/cancel/delete <name>` | Manage processing |
|
|
89
92
|
|
|
90
93
|
### Subscriptions
|
|
91
94
|
|
|
92
|
-
`sl create subscription` scaffolds a receiver project. `sl subscriptions ...`
|
|
93
|
-
manages existing ones.
|
|
94
|
-
|
|
95
95
|
| Command | What it does |
|
|
96
96
|
|---|---|
|
|
97
|
-
| `sl create
|
|
97
|
+
| `sl subscriptions create <name> --runtime <inngest\|trigger\|cloudflare\|node> [--auth-token <token>] [--filter key=value]` | Scaffold a receiver wired to a new subscription |
|
|
98
98
|
| `sl subscriptions list` / `get <id\|name>` | List or show config + delivery state |
|
|
99
99
|
| `sl subscriptions update <id\|name> --url <url> [--filter key.gte=value]` | Patch URL, filter, format, retry, etc. |
|
|
100
100
|
| `sl subscriptions pause/resume <id\|name>` | Stop or restart delivery |
|
|
@@ -105,55 +105,57 @@ manages existing ones.
|
|
|
105
105
|
| `sl subscriptions doctor/test <id\|name>` | Health check / signed fixture |
|
|
106
106
|
|
|
107
107
|
Read/action commands support `--json`. Destructive commands prompt unless
|
|
108
|
-
`--yes`. Filters are schema-aware: unknown tables/columns, bad operators,
|
|
109
|
-
non-scalar columns are rejected before the API call.
|
|
108
|
+
`-y` / `--yes`. Filters are schema-aware: unknown tables/columns, bad operators,
|
|
109
|
+
and non-scalar columns are rejected before the API call.
|
|
110
110
|
|
|
111
111
|
### Local dev & OSS
|
|
112
112
|
|
|
113
113
|
| Command | What it does |
|
|
114
114
|
|---|---|
|
|
115
|
-
| `sl local
|
|
115
|
+
| `sl local up [--devnet]` / `sl local down [--devnet]` | Start/stop the full local stack (Stacks node + dev services), or a Clarinet devnet |
|
|
116
|
+
| `sl local start/stop/restart/status/logs` | Manage just the local dev services |
|
|
116
117
|
| `sl local node setup/start/stop/...` | Manage the local Stacks node |
|
|
117
|
-
| `sl
|
|
118
|
-
| `sl
|
|
118
|
+
| `sl local db blocks/txs/events/gaps/truncate/resync` | Inspect the local source DB |
|
|
119
|
+
| `sl devnet connect/down/status/logs` | Clarinet devnet integration |
|
|
119
120
|
|
|
120
121
|
### Other
|
|
121
122
|
|
|
122
123
|
| Command | What it does |
|
|
123
124
|
|---|---|
|
|
124
|
-
| `sl generate [files...]` (alias `gen`) | Generate TS interfaces from Clarity contracts |
|
|
125
|
+
| `sl contracts generate [files...]` (alias `gen`) | Generate TS interfaces from Clarity contracts |
|
|
125
126
|
| `sl init` | Scaffold `secondlayer.config.ts` |
|
|
126
127
|
| `sl doctor` / `sl status` | Reachability + health checks |
|
|
127
|
-
| `sl account
|
|
128
|
-
| `sl
|
|
128
|
+
| `sl account get` / `sl account update` | Show or update display name / bio / slug |
|
|
129
|
+
| `sl account billing` | Show plan, subscription, trial, discounts |
|
|
130
|
+
| `sl config get/set/reset/delete` | Inspect or reset local config |
|
|
129
131
|
|
|
130
132
|
## Environment variables
|
|
131
133
|
|
|
132
134
|
| Var | Purpose |
|
|
133
135
|
|---|---|
|
|
134
|
-
| `
|
|
136
|
+
| `SL_API_KEY` | An `sk-sl_` API key (or session token) for machine/CI use; bypasses platform resolution |
|
|
135
137
|
| `SL_API_URL` | Point at an OSS or internal API directly, bypassing the platform |
|
|
136
138
|
| `SL_PLATFORM_API_URL` | Override the platform API base (default `https://api.secondlayer.tools`) |
|
|
137
139
|
| `STACKS_NETWORK` | Default network (also via `--network <local\|testnet\|mainnet>`) |
|
|
138
|
-
| `HIRO_API_KEY` | Used by `sl generate` for remote contract fetches |
|
|
140
|
+
| `HIRO_API_KEY` | Used by `sl contracts generate` for remote contract fetches |
|
|
139
141
|
|
|
140
|
-
## Code generation (`sl generate`)
|
|
142
|
+
## Code generation (`sl contracts generate`)
|
|
141
143
|
|
|
142
144
|
Generate type-safe interfaces, functions, and optional React hooks from Clarity
|
|
143
145
|
contracts — local `.clar` files, deployed contracts (network inferred from
|
|
144
146
|
address prefix), or globs.
|
|
145
147
|
|
|
146
148
|
```bash
|
|
147
|
-
sl generate ./contracts/token.clar -o ./src/generated.ts
|
|
148
|
-
sl generate SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.alex-vault -o ./src/generated.ts
|
|
149
|
-
sl generate "./contracts/*.clar" -o ./src/generated.ts
|
|
149
|
+
sl contracts generate ./contracts/token.clar -o ./src/generated.ts
|
|
150
|
+
sl contracts generate SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.alex-vault -o ./src/generated.ts
|
|
151
|
+
sl contracts generate "./contracts/*.clar" -o ./src/generated.ts
|
|
150
152
|
```
|
|
151
153
|
|
|
152
154
|
Config-driven:
|
|
153
155
|
|
|
154
156
|
```bash
|
|
155
|
-
sl init
|
|
156
|
-
sl generate
|
|
157
|
+
sl init # creates secondlayer.config.ts
|
|
158
|
+
sl contracts generate # regenerates from the config
|
|
157
159
|
```
|
|
158
160
|
|
|
159
161
|
```typescript
|