@secondlayer/cli 3.1.0 → 3.1.1
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 +128 -0
- package/dist/cli.js +4 -3
- package/dist/cli.js.map +2 -2
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# @secondlayer/cli
|
|
2
|
+
|
|
3
|
+
The Secondlayer CLI — one binary for dedicated Stacks indexing, real-time
|
|
4
|
+
subgraphs, and per-tenant hosting lifecycle.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
bun add -g @secondlayer/cli
|
|
8
|
+
sl --version
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quickstart
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
sl login # magic-link auth, session cached at ~/.secondlayer/session.json
|
|
15
|
+
sl project create my-app # scaffold a project
|
|
16
|
+
sl project use my-app # bind cwd to the project (writes ./.secondlayer/project)
|
|
17
|
+
sl instance create --plan launch # provision dedicated Postgres + API + processor
|
|
18
|
+
sl subgraphs deploy ./x.ts # deploy to your instance
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Command surface
|
|
22
|
+
|
|
23
|
+
### Auth (top-level)
|
|
24
|
+
|
|
25
|
+
| Command | What it does |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `sl login` | Magic-link email → 6-digit code → writes session to `~/.secondlayer/session.json` |
|
|
28
|
+
| `sl logout` | Revokes the session and clears the local file |
|
|
29
|
+
| `sl whoami` | Prints account, active project, instance URL, trial days left |
|
|
30
|
+
|
|
31
|
+
### Project
|
|
32
|
+
|
|
33
|
+
Projects are the unit that binds a working directory to a dedicated instance.
|
|
34
|
+
Binding is **per-directory** — `.secondlayer/project` in cwd takes precedence
|
|
35
|
+
over the global default at `~/.secondlayer/config.json:defaultProject`. The
|
|
36
|
+
walk-up stops at `.git` (never crosses repos).
|
|
37
|
+
|
|
38
|
+
| Command | What it does |
|
|
39
|
+
|---|---|
|
|
40
|
+
| `sl project create [name]` | Scaffold a new project on the platform |
|
|
41
|
+
| `sl project list` | List all projects for the account |
|
|
42
|
+
| `sl project use <slug>` | Write `./.secondlayer/project` — binds cwd to that project |
|
|
43
|
+
| `sl project current` | Prints the resolved slug + the file it was read from |
|
|
44
|
+
|
|
45
|
+
### Instance (dedicated hosting)
|
|
46
|
+
|
|
47
|
+
One instance per project. The platform API spawns a dedicated `sl-pg-{slug}`,
|
|
48
|
+
`sl-api-{slug}`, and `sl-proc-{slug}` container set on the hosting side.
|
|
49
|
+
|
|
50
|
+
| Command | What it does |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `sl instance create --plan <launch\|grow\|scale>` | Provision containers. Boxed reveal of `serviceKey` + `anonKey` (shown once). |
|
|
53
|
+
| `sl instance info` | Plan, status, resource usage, trial days left |
|
|
54
|
+
| `sl instance resize --plan <...>` | Recreate containers with new CPU/memory (~30s downtime) |
|
|
55
|
+
| `sl instance suspend` / `resume` | Stop/start containers, volume preserved |
|
|
56
|
+
| `sl instance keys rotate [--service\|--anon\|--both]` | Bump JWT gen, recreate API container, mint replacement key(s) |
|
|
57
|
+
| `sl instance delete` | Typed-slug confirm, hard teardown |
|
|
58
|
+
| `sl instance db` | Print `ssh -L` command + `DATABASE_URL` for tunneled Postgres access |
|
|
59
|
+
| `sl instance db add-key <path>` | Upload an SSH pubkey to the bastion |
|
|
60
|
+
| `sl instance db revoke-key` | Revoke your bastion access |
|
|
61
|
+
|
|
62
|
+
### Subgraphs (tenant-scoped)
|
|
63
|
+
|
|
64
|
+
All tenant-scoped commands auto-mint a 5-minute ephemeral service JWT per
|
|
65
|
+
invocation. No long-lived key on disk.
|
|
66
|
+
|
|
67
|
+
| Command | What it does |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `sl subgraphs new <name>` | Scaffold a subgraph definition file |
|
|
70
|
+
| `sl subgraphs deploy <file>` | Deploy to the active instance |
|
|
71
|
+
| `sl subgraphs dev <file>` | Watch + hot-redeploy |
|
|
72
|
+
| `sl subgraphs list` | List deployed subgraphs |
|
|
73
|
+
| `sl subgraphs status <name>` | Indexing progress, row counts, gaps |
|
|
74
|
+
| `sl subgraphs query <name> <table>` | Query a subgraph table with filters, sort, pagination |
|
|
75
|
+
| `sl subgraphs reindex <name>` | Drop + re-process from the tip backwards |
|
|
76
|
+
| `sl subgraphs backfill <name>` | Fill a specific block range |
|
|
77
|
+
| `sl subgraphs stop <name>` | Pause processing |
|
|
78
|
+
| `sl subgraphs gaps <name>` | List missing block ranges |
|
|
79
|
+
| `sl subgraphs delete <name>` | Drop the subgraph + its schema |
|
|
80
|
+
| `sl subgraphs scaffold <SP...::contract>` | Generate a starter subgraph from a deployed contract |
|
|
81
|
+
| `sl subgraphs generate <name>` | Regenerate TS types for an existing subgraph |
|
|
82
|
+
|
|
83
|
+
### Local dev + OSS
|
|
84
|
+
|
|
85
|
+
| Command | What it does |
|
|
86
|
+
|---|---|
|
|
87
|
+
| `sl local start/stop/restart/status/logs` | Manage the local Docker stack |
|
|
88
|
+
| `sl local node setup/start/stop/...` | Manage the local Stacks node |
|
|
89
|
+
| `sl stack start/stop/restart` | Alias for `sl local` |
|
|
90
|
+
| `sl db blocks/txs/events/gaps/reset/resync` | Inspect the local source DB |
|
|
91
|
+
|
|
92
|
+
### Other
|
|
93
|
+
|
|
94
|
+
| Command | What it does |
|
|
95
|
+
|---|---|
|
|
96
|
+
| `sl generate [files...]` (aliases: `gen`, `codegen`) | Generate TS interfaces from Clarity contracts |
|
|
97
|
+
| `sl init` | Scaffold `secondlayer.config.ts` |
|
|
98
|
+
| `sl doctor` | Session + project + instance reachability + trial status check |
|
|
99
|
+
| `sl status` | Platform/instance health |
|
|
100
|
+
| `sl account profile` | Update display name / bio / slug |
|
|
101
|
+
| `sl config show/set/reset/clear` | Inspect or reset local config |
|
|
102
|
+
|
|
103
|
+
## Environment variables
|
|
104
|
+
|
|
105
|
+
| Var | Purpose |
|
|
106
|
+
|---|---|
|
|
107
|
+
| `SL_API_URL` | Bypass platform resolution — point at an OSS or internal API directly |
|
|
108
|
+
| `SL_SERVICE_KEY` | Service key when using env-var bypass |
|
|
109
|
+
| `SL_PLATFORM_API_URL` | Override the platform API base (default `https://api.secondlayer.tools`) |
|
|
110
|
+
| `STACKS_NETWORK` | Override via `--network <local\|testnet\|mainnet>` |
|
|
111
|
+
| `HIRO_API_KEY` | Used by `sl generate` for remote contract fetches |
|
|
112
|
+
|
|
113
|
+
## Error codes
|
|
114
|
+
|
|
115
|
+
Every tenant-scoped failure surfaces a typed code and an action hint:
|
|
116
|
+
|
|
117
|
+
| Code | CLI hint |
|
|
118
|
+
|---|---|
|
|
119
|
+
| `SESSION_EXPIRED` | `Session expired. Run: sl login` |
|
|
120
|
+
| `TRIAL_EXPIRED` | `Your trial expired. Run: sl instance resize --plan <...> and add payment` |
|
|
121
|
+
| `TENANT_SUSPENDED` | `Instance is suspended. Run: sl instance resume` |
|
|
122
|
+
| `NO_ACTIVE_PROJECT` | `No project selected. Run: sl project use <slug>` |
|
|
123
|
+
| `NO_TENANT_FOR_PROJECT` | `Project has no instance. Run: sl instance create --plan launch` |
|
|
124
|
+
| `KEY_ROTATED` | Handled transparently — `http.ts` re-mints and retries once |
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
MIT
|
package/dist/cli.js
CHANGED
|
@@ -32410,7 +32410,7 @@ var {
|
|
|
32410
32410
|
// package.json
|
|
32411
32411
|
var package_default = {
|
|
32412
32412
|
name: "@secondlayer/cli",
|
|
32413
|
-
version: "3.1.
|
|
32413
|
+
version: "3.1.1",
|
|
32414
32414
|
description: "CLI for subgraphs and blockchain indexing on Stacks",
|
|
32415
32415
|
type: "module",
|
|
32416
32416
|
bin: {
|
|
@@ -32431,7 +32431,8 @@ var package_default = {
|
|
|
32431
32431
|
},
|
|
32432
32432
|
files: [
|
|
32433
32433
|
"dist",
|
|
32434
|
-
"templates"
|
|
32434
|
+
"templates",
|
|
32435
|
+
"README.md"
|
|
32435
32436
|
],
|
|
32436
32437
|
scripts: {
|
|
32437
32438
|
build: "bunup",
|
|
@@ -35448,5 +35449,5 @@ registerLocalCommand(program);
|
|
|
35448
35449
|
registerAccountCommand(program);
|
|
35449
35450
|
program.parse();
|
|
35450
35451
|
|
|
35451
|
-
//# debugId=
|
|
35452
|
+
//# debugId=93095DDF734A3A2E64756E2164756E21
|
|
35452
35453
|
//# sourceMappingURL=cli.js.map
|