@secondlayer/cli 3.6.0 → 3.6.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 CHANGED
@@ -25,6 +25,7 @@ sl instance create --plan hobby
25
25
  sl subgraphs scaffold SP1234ABCD.my-contract -o subgraphs/my-contract.ts
26
26
  sl subgraphs deploy subgraphs/my-contract.ts --start-block <recent-block>
27
27
  sl subgraphs query my-contract <table> --sort _block_height --order desc
28
+ sl subgraphs spec my-contract --format openapi -o openapi.json
28
29
  ```
29
30
 
30
31
  `sl subgraphs scaffold` writes the definition file, creates or updates
@@ -128,6 +129,8 @@ invocation. No long-lived key on disk.
128
129
  | `sl subgraphs list` | List deployed subgraphs |
129
130
  | `sl subgraphs status <name>` | Indexing progress, row counts, gaps |
130
131
  | `sl subgraphs query <name> <table>` | Query a subgraph table with filters, sort, pagination |
132
+ | `sl subgraphs spec <name> [--format openapi\|agent\|markdown] [-o <path>] [--server <url>]` | Export generated API docs for a deployed subgraph |
133
+ | `sl subgraphs inspect <file> [--format openapi\|agent\|markdown] [-o <path>] [--server <url>]` | Generate API docs from a local `defineSubgraph()` file before deploy |
131
134
  | `sl subgraphs reindex <name>` | Drop + re-process from the tip backwards |
132
135
  | `sl subgraphs backfill <name>` | Fill a specific block range |
133
136
  | `sl subgraphs stop <name>` | Pause processing |
@@ -136,6 +139,32 @@ invocation. No long-lived key on disk.
136
139
  | `sl subgraphs scaffold <SP...::contract> [-o <path>] [--no-install]` | Generate a starter subgraph from a deployed contract, write/amend `package.json`, and install dependencies unless skipped |
137
140
  | `sl subgraphs generate <name>` | Regenerate TS types for an existing subgraph |
138
141
 
142
+ #### Subgraph API specs
143
+
144
+ Use `spec` when the subgraph is already deployed to the active project
145
+ instance. Use `inspect` when you want the same documentation contract from a
146
+ local TypeScript definition before deploy.
147
+
148
+ ```bash
149
+ # Deployed subgraph docs from the active project instance
150
+ sl subgraphs spec token-transfers --format openapi -o openapi.json
151
+ sl subgraphs spec token-transfers --format agent
152
+ sl subgraphs spec token-transfers --format markdown -o API.md
153
+
154
+ # Local pre-deploy docs from a defineSubgraph() file
155
+ sl subgraphs inspect subgraphs/token-transfers.ts --format agent
156
+ sl subgraphs inspect subgraphs/token-transfers.ts --format openapi \
157
+ --server https://<your-slug>.secondlayer.tools
158
+ ```
159
+
160
+ Formats:
161
+
162
+ | Format | Use |
163
+ |---|---|
164
+ | `openapi` | OpenAPI 3.1 JSON for docs tooling, client generators, and API catalogs |
165
+ | `agent` | Compact JSON schema for agents that need table, column, filter, and endpoint context |
166
+ | `markdown` | Human-readable API reference for docs pages or repository docs |
167
+
139
168
  ### Local dev + OSS
140
169
 
141
170
  | Command | What it does |
package/dist/cli.js CHANGED
@@ -32439,7 +32439,7 @@ var {
32439
32439
  // package.json
32440
32440
  var package_default = {
32441
32441
  name: "@secondlayer/cli",
32442
- version: "3.6.0",
32442
+ version: "3.6.1",
32443
32443
  description: "CLI for subgraphs and blockchain indexing on Stacks",
32444
32444
  type: "module",
32445
32445
  bin: {
@@ -36641,6 +36641,11 @@ function handleInstanceError(err, action) {
36641
36641
  error("This project already has an instance. Run `sl instance info` to see it.");
36642
36642
  process.exit(1);
36643
36643
  }
36644
+ if (err.code === "PROVISIONER_REJECTED" || err.code === "INSTANCE_RECORD_FAILED" || err.code === "INSTANCE_PROVISION_FAILED") {
36645
+ error(err.message || `Failed to ${action}.`);
36646
+ error("Run: sl instance info before retrying.");
36647
+ process.exit(1);
36648
+ }
36644
36649
  error(err.message || `Failed to ${action}.`);
36645
36650
  process.exit(1);
36646
36651
  }
@@ -36792,5 +36797,5 @@ registerLocalCommand(program);
36792
36797
  registerAccountCommand(program);
36793
36798
  program.parse();
36794
36799
 
36795
- //# debugId=9B4F6BACEC00400164756E2164756E21
36800
+ //# debugId=EA9BC913F2D4968D64756E2164756E21
36796
36801
  //# sourceMappingURL=cli.js.map