envio-cloud 0.3.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 +261 -0
- package/bin/envio-cloud +71 -0
- package/install.js +67 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# envio-cloud
|
|
2
|
+
|
|
3
|
+
CLI for [Envio's Hosted Service](https://envio.dev) — deploy, manage, and monitor blockchain indexers powered by [HyperIndex](https://docs.envio.dev/docs/HyperIndex/overview).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g envio-cloud
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or run directly with npx:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx envio-cloud deployment metrics hyperindex b3ead3a mjyoung114
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Authenticate with GitHub (opens browser)
|
|
21
|
+
envio-cloud login
|
|
22
|
+
|
|
23
|
+
# List public indexers
|
|
24
|
+
envio-cloud indexer list
|
|
25
|
+
|
|
26
|
+
# View deployment metrics (no auth required)
|
|
27
|
+
envio-cloud deployment metrics hyperindex b3ead3a mjyoung114
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Authentication
|
|
31
|
+
|
|
32
|
+
### Browser Login (default)
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
envio-cloud login
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Opens your browser to sign in via [envio.dev](https://envio.dev). No local server or OAuth credentials required. Session lasts 30 days.
|
|
39
|
+
|
|
40
|
+
### Token Login (CI/CD)
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Via flag
|
|
44
|
+
envio-cloud login --token ghp_YOUR_TOKEN
|
|
45
|
+
|
|
46
|
+
# Via environment variable
|
|
47
|
+
export ENVIO_GITHUB_TOKEN=ghp_YOUR_TOKEN
|
|
48
|
+
envio-cloud login
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Required token scopes: `read:org`, `read:user`, `user:email`.
|
|
52
|
+
|
|
53
|
+
### Session Management
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
envio-cloud token # Check current session status
|
|
57
|
+
envio-cloud logout # Remove stored credentials
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Commands
|
|
61
|
+
|
|
62
|
+
### Indexer Commands
|
|
63
|
+
|
|
64
|
+
#### `envio-cloud indexer list`
|
|
65
|
+
|
|
66
|
+
List all public indexers on the platform.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
envio-cloud indexer list
|
|
70
|
+
envio-cloud indexer list --org myorg
|
|
71
|
+
envio-cloud indexer list --limit 10
|
|
72
|
+
envio-cloud indexer list -o json
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
| Flag | Description |
|
|
76
|
+
|------|-------------|
|
|
77
|
+
| `--org` | Filter by organisation ID |
|
|
78
|
+
| `--limit` | Max number of results (default: 1000) |
|
|
79
|
+
| `-o, --output` | Output format: `json` |
|
|
80
|
+
|
|
81
|
+
#### `envio-cloud indexer get <name> <organisation>`
|
|
82
|
+
|
|
83
|
+
View details and deployments for a specific indexer.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
envio-cloud indexer get hyperindex mjyoung114
|
|
87
|
+
envio-cloud indexer get hyperindex mjyoung114 -o json
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### `envio-cloud indexer add` (requires auth)
|
|
91
|
+
|
|
92
|
+
Add a new indexer to the platform.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
envio-cloud indexer add --name my-indexer --repo my-repo
|
|
96
|
+
envio-cloud indexer add --name my-indexer --repo my-repo --branch main --tier development
|
|
97
|
+
envio-cloud indexer add --name my-indexer --repo my-repo --dry-run
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
| Flag | Description | Default |
|
|
101
|
+
|------|-------------|---------|
|
|
102
|
+
| `-n, --name` | Indexer name (required) | |
|
|
103
|
+
| `-r, --repo` | GitHub repository (required) | |
|
|
104
|
+
| `-b, --branch` | Git branch | `envio` |
|
|
105
|
+
| `-d, --root-dir` | Root directory | `./` |
|
|
106
|
+
| `-c, --config-file` | Config file path | `config.yaml` |
|
|
107
|
+
| `-t, --tier` | Service tier | `development` |
|
|
108
|
+
| `-a, --access-type` | Access type | `public` |
|
|
109
|
+
| `-e, --env-file` | Path to .env file | |
|
|
110
|
+
| `--auto-deploy` | Auto-deploy on push | `true` |
|
|
111
|
+
| `--dry-run` | Preview without creating | |
|
|
112
|
+
| `-y, --yes` | Skip confirmation | |
|
|
113
|
+
|
|
114
|
+
### Deployment Commands
|
|
115
|
+
|
|
116
|
+
#### `envio-cloud deployment metrics <indexer> <commit> <organisation>`
|
|
117
|
+
|
|
118
|
+
Real-time indexing metrics per chain. **No auth required.**
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
envio-cloud deployment metrics hyperindex b3ead3a mjyoung114
|
|
122
|
+
envio-cloud deployment metrics hyperindex b3ead3a mjyoung114 -o json
|
|
123
|
+
envio-cloud deployment metrics hyperindex b3ead3a mjyoung114 --watch
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Example output:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
Deployment Metrics: mjyoung114/hyperindex (commit: b3ead3a)
|
|
130
|
+
|
|
131
|
+
CHAIN PROGRESS BLOCK HEIGHT PROCESSED EVENTS HYPERSYNC SYNCED AT
|
|
132
|
+
143 100.00% 62456629 62456630 577336 yes 2026-03-18 16:52
|
|
133
|
+
999 100.00% 30166822 30166822 1161921 yes 2026-03-18 16:52
|
|
134
|
+
|
|
135
|
+
Total chains: 2 | Total events: 1739257 | Status: fully synced
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
| Flag | Description |
|
|
139
|
+
|------|-------------|
|
|
140
|
+
| `--watch` | Auto-refresh every 10 seconds |
|
|
141
|
+
| `-o, --output` | Output format: `json` |
|
|
142
|
+
|
|
143
|
+
#### `envio-cloud deployment status <indexer> <commit> <organisation>`
|
|
144
|
+
|
|
145
|
+
Sync progress and completion percentage. **No auth required.**
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
envio-cloud deployment status hyperindex b3ead3a mjyoung114
|
|
149
|
+
envio-cloud deployment status hyperindex b3ead3a mjyoung114 --watch-till-synced
|
|
150
|
+
envio-cloud deployment status hyperindex b3ead3a mjyoung114 -o json
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
#### `envio-cloud deployment info <indexer> <commit> <organisation>`
|
|
154
|
+
|
|
155
|
+
Aggregator configuration (cache, DB exposure). **No auth required.**
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
envio-cloud deployment info hyperindex b3ead3a mjyoung114
|
|
159
|
+
envio-cloud deployment info hyperindex b3ead3a mjyoung114 -o json
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
#### `envio-cloud deployment promote <indexer> <commit> <organisation>` (requires auth)
|
|
163
|
+
|
|
164
|
+
Promote a deployment to production.
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
envio-cloud deployment promote myindexer abc1234 myorg
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Repository Commands
|
|
171
|
+
|
|
172
|
+
#### `envio-cloud repos` (requires auth)
|
|
173
|
+
|
|
174
|
+
List GitHub repositories linked to your organisation.
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
envio-cloud repos
|
|
178
|
+
envio-cloud repos -o json
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## JSON Output
|
|
182
|
+
|
|
183
|
+
All commands support `-o json` for machine-readable output with a consistent envelope:
|
|
184
|
+
|
|
185
|
+
```json
|
|
186
|
+
{
|
|
187
|
+
"ok": true,
|
|
188
|
+
"data": [ ... ]
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
On error:
|
|
193
|
+
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"ok": false,
|
|
197
|
+
"error": "error message"
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Piping Examples
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# Get event count with jq
|
|
205
|
+
envio-cloud deployment metrics hyperindex b3ead3a mjyoung114 -o json \
|
|
206
|
+
| jq '.data[].num_events_processed'
|
|
207
|
+
|
|
208
|
+
# List indexer names for an org
|
|
209
|
+
envio-cloud indexer list --org enviodev -o json \
|
|
210
|
+
| jq -r '.data[].indexer_id'
|
|
211
|
+
|
|
212
|
+
# Check if fully synced
|
|
213
|
+
envio-cloud deployment metrics hyperindex b3ead3a mjyoung114 -o json \
|
|
214
|
+
| jq '.data | all(.latest_processed_block >= .block_height)'
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Global Flags
|
|
218
|
+
|
|
219
|
+
| Flag | Description |
|
|
220
|
+
|------|-------------|
|
|
221
|
+
| `-q, --quiet` | Suppress informational messages, output data only |
|
|
222
|
+
| `-o, --output` | Output format: `json` (on supported commands) |
|
|
223
|
+
| `--config` | Config file path (default: `~/.envio-cloud.yaml`) |
|
|
224
|
+
| `-h, --help` | Help for any command |
|
|
225
|
+
| `-v, --version` | Print version |
|
|
226
|
+
|
|
227
|
+
## Exit Codes
|
|
228
|
+
|
|
229
|
+
| Code | Meaning |
|
|
230
|
+
|------|---------|
|
|
231
|
+
| 0 | Success (including empty results) |
|
|
232
|
+
| 1 | User error (bad arguments, not logged in) |
|
|
233
|
+
| 2 | API or server error |
|
|
234
|
+
|
|
235
|
+
## Alternative Installation
|
|
236
|
+
|
|
237
|
+
### Go
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
go install github.com/enviodev/hosted-service-cli@latest
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### From Source
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
git clone https://github.com/enviodev/hosted-service-cli.git
|
|
247
|
+
cd hosted-service-cli
|
|
248
|
+
go build -o envio-cloud .
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### GitHub Releases
|
|
252
|
+
|
|
253
|
+
Download prebuilt binaries from [GitHub Releases](https://github.com/enviodev/hosted-service-cli/releases).
|
|
254
|
+
|
|
255
|
+
## Links
|
|
256
|
+
|
|
257
|
+
- [Envio Documentation](https://docs.envio.dev)
|
|
258
|
+
- [HyperIndex Overview](https://docs.envio.dev/docs/HyperIndex/overview)
|
|
259
|
+
- [Hosted Service Guide](https://docs.envio.dev/docs/HyperIndex/hosted-service)
|
|
260
|
+
- [GitHub Repository](https://github.com/enviodev/hosted-service-cli)
|
|
261
|
+
- [Report Issues](https://github.com/enviodev/hosted-service-cli/issues)
|
package/bin/envio-cloud
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const { execFileSync } = require("child_process");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const fs = require("fs");
|
|
8
|
+
|
|
9
|
+
// Map Node.js platform/arch to our package names
|
|
10
|
+
const PLATFORMS = {
|
|
11
|
+
"darwin-arm64": "@envio-dev/envio-cloud-darwin-arm64",
|
|
12
|
+
"darwin-x64": "@envio-dev/envio-cloud-darwin-x64",
|
|
13
|
+
"linux-x64": "@envio-dev/envio-cloud-linux-x64",
|
|
14
|
+
"linux-arm64": "@envio-dev/envio-cloud-linux-arm64",
|
|
15
|
+
"win32-x64": "@envio-dev/envio-cloud-win32-x64",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function getBinaryPath() {
|
|
19
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
20
|
+
const pkg = PLATFORMS[platformKey];
|
|
21
|
+
|
|
22
|
+
if (!pkg) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
`Unsupported platform: ${platformKey}\n` +
|
|
25
|
+
`envio-cloud supports: ${Object.keys(PLATFORMS).join(", ")}`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Try to find the binary in the platform package
|
|
30
|
+
try {
|
|
31
|
+
const pkgPath = require.resolve(`${pkg}/package.json`);
|
|
32
|
+
const binDir = path.join(path.dirname(pkgPath), "bin");
|
|
33
|
+
const binName = process.platform === "win32" ? "envio-cloud.exe" : "envio-cloud";
|
|
34
|
+
const binPath = path.join(binDir, binName);
|
|
35
|
+
|
|
36
|
+
if (fs.existsSync(binPath)) {
|
|
37
|
+
return binPath;
|
|
38
|
+
}
|
|
39
|
+
} catch (e) {
|
|
40
|
+
// Package not found via require.resolve
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Fallback: check if binary was installed via postinstall download
|
|
44
|
+
const localBin = path.join(
|
|
45
|
+
__dirname,
|
|
46
|
+
process.platform === "win32" ? "envio-cloud.exe" : "envio-cloud-binary"
|
|
47
|
+
);
|
|
48
|
+
if (fs.existsSync(localBin)) {
|
|
49
|
+
return localBin;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
throw new Error(
|
|
53
|
+
`Could not find envio-cloud binary for ${platformKey}.\n` +
|
|
54
|
+
`Try reinstalling: npm install envio-cloud`
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
const binPath = getBinaryPath();
|
|
60
|
+
const result = execFileSync(binPath, process.argv.slice(2), {
|
|
61
|
+
stdio: "inherit",
|
|
62
|
+
env: process.env,
|
|
63
|
+
});
|
|
64
|
+
} catch (e) {
|
|
65
|
+
if (e.status !== undefined) {
|
|
66
|
+
// execFileSync throws with status code on non-zero exit
|
|
67
|
+
process.exit(e.status);
|
|
68
|
+
}
|
|
69
|
+
console.error(e.message);
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
package/install.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { existsSync } = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
// Map Node.js platform/arch to package names
|
|
7
|
+
const PLATFORMS = {
|
|
8
|
+
"darwin-arm64": "@envio-dev/envio-cloud-darwin-arm64",
|
|
9
|
+
"darwin-x64": "@envio-dev/envio-cloud-darwin-x64",
|
|
10
|
+
"linux-x64": "@envio-dev/envio-cloud-linux-x64",
|
|
11
|
+
"linux-arm64": "@envio-dev/envio-cloud-linux-arm64",
|
|
12
|
+
"win32-x64": "@envio-dev/envio-cloud-win32-x64",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
function verifyInstallation() {
|
|
16
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
17
|
+
const pkg = PLATFORMS[platformKey];
|
|
18
|
+
|
|
19
|
+
if (!pkg) {
|
|
20
|
+
console.warn(
|
|
21
|
+
`Warning: envio-cloud does not have a prebuilt binary for ${platformKey}.`
|
|
22
|
+
);
|
|
23
|
+
console.warn(
|
|
24
|
+
"You can build from source: go install github.com/enviodev/hosted-service-cli@latest"
|
|
25
|
+
);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Check if the platform package was installed (via optionalDependencies)
|
|
30
|
+
try {
|
|
31
|
+
const pkgPath = require.resolve(`${pkg}/package.json`);
|
|
32
|
+
const binDir = path.join(path.dirname(pkgPath), "bin");
|
|
33
|
+
const binName = process.platform === "win32" ? "envio-cloud.exe" : "envio-cloud";
|
|
34
|
+
const binPath = path.join(binDir, binName);
|
|
35
|
+
|
|
36
|
+
if (existsSync(binPath)) {
|
|
37
|
+
return; // Binary found, we're good
|
|
38
|
+
}
|
|
39
|
+
} catch (e) {
|
|
40
|
+
// Package not installed
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Check for fallback binary
|
|
44
|
+
const localBin = path.join(
|
|
45
|
+
__dirname,
|
|
46
|
+
"bin",
|
|
47
|
+
process.platform === "win32" ? "envio-cloud.exe" : "envio-cloud-binary"
|
|
48
|
+
);
|
|
49
|
+
if (existsSync(localBin)) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
console.warn(
|
|
54
|
+
`Warning: envio-cloud binary for ${platformKey} was not installed.`
|
|
55
|
+
);
|
|
56
|
+
console.warn("This can happen if npm was run with --no-optional.");
|
|
57
|
+
console.warn("Alternatives:");
|
|
58
|
+
console.warn(" 1. Reinstall without --no-optional: npm install envio-cloud");
|
|
59
|
+
console.warn(
|
|
60
|
+
" 2. Install via Go: go install github.com/enviodev/hosted-service-cli@latest"
|
|
61
|
+
);
|
|
62
|
+
console.warn(
|
|
63
|
+
" 3. Download from: https://github.com/enviodev/hosted-service-cli/releases"
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
verifyInstallation();
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "envio-cloud",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "CLI for Envio's Hosted Service — manage and monitor blockchain indexers powered by HyperIndex",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/enviodev/hosted-service-cli.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"bin": {
|
|
11
|
+
"envio-cloud": "bin/envio-cloud"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"postinstall": "node install.js"
|
|
15
|
+
},
|
|
16
|
+
"optionalDependencies": {
|
|
17
|
+
"@envio-dev/envio-cloud-darwin-arm64": "0.3.0",
|
|
18
|
+
"@envio-dev/envio-cloud-darwin-x64": "0.3.0",
|
|
19
|
+
"@envio-dev/envio-cloud-linux-x64": "0.3.0",
|
|
20
|
+
"@envio-dev/envio-cloud-linux-arm64": "0.3.0",
|
|
21
|
+
"@envio-dev/envio-cloud-win32-x64": "0.3.0"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"envio",
|
|
25
|
+
"hyperindex",
|
|
26
|
+
"blockchain",
|
|
27
|
+
"indexer",
|
|
28
|
+
"hosted-service",
|
|
29
|
+
"cli",
|
|
30
|
+
"web3"
|
|
31
|
+
],
|
|
32
|
+
"homepage": "https://docs.envio.dev/docs/HyperIndex/hosted-service",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/enviodev/hosted-service-cli/issues"
|
|
35
|
+
}
|
|
36
|
+
}
|