@rollpilot/cli 0.0.0-stage → 0.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/LICENSE +16 -0
- package/README.md +61 -2
- package/bin/rollpilot.js +27 -0
- package/checksums.json +7 -0
- package/lib/resolve.js +150 -0
- package/package.json +28 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
RollPilot CLI License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yibi AI LLC. All rights reserved.
|
|
4
|
+
|
|
5
|
+
The RollPilot CLI, consisting of this package and the rollpilot binaries it
|
|
6
|
+
installs or downloads, is proprietary software of Yibi AI LLC.
|
|
7
|
+
|
|
8
|
+
Yibi AI LLC grants you a non-exclusive, non-transferable, revocable license to
|
|
9
|
+
install and use the RollPilot CLI, unmodified, for the purpose of accessing and
|
|
10
|
+
using RollPilot services.
|
|
11
|
+
|
|
12
|
+
All other rights are reserved. No other license, express or implied, is granted.
|
|
13
|
+
|
|
14
|
+
THE ROLLPILOT CLI IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED. IN NO EVENT SHALL YIBI AI LLC BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
16
|
+
OTHER LIABILITY ARISING FROM OR IN CONNECTION WITH THE ROLLPILOT CLI OR ITS USE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,62 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @rollpilot/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The RollPilot CLI for React Native / Expo over-the-air releases: publish,
|
|
4
|
+
roll out, pause and roll back from the terminal, CI or an agent.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npx @rollpilot/cli version # run without installing
|
|
8
|
+
npm install -g @rollpilot/cli # or put `rollpilot` on your PATH
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
No Go toolchain is needed. On first use the launcher downloads the prebuilt
|
|
12
|
+
`rollpilot` binary for your platform from
|
|
13
|
+
`https://downloads.rollpilot.dev/cli/<version>/`, verifies it against the
|
|
14
|
+
SHA-256 checksum published inside this package, and caches it. A binary whose
|
|
15
|
+
checksum does not match is refused and never cached.
|
|
16
|
+
|
|
17
|
+
Without npm, the same binary installs with
|
|
18
|
+
`curl -fsSL https://rollpilot.dev/install.sh | sh`.
|
|
19
|
+
|
|
20
|
+
## Getting started
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Asks for your password without echoing it.
|
|
24
|
+
rollpilot login --server https://app.rollpilot.dev --email you@example.com --save
|
|
25
|
+
|
|
26
|
+
# Creates or reuses the app and deployment, issues a scoped token (shown once),
|
|
27
|
+
# and writes the Expo config snippet, the app's code signing certificate and
|
|
28
|
+
# rollpilot.json (commit it: later commands then need no --server/--app-key).
|
|
29
|
+
rollpilot setup --app-key my-app --deployment staging \
|
|
30
|
+
--write-app-json rollpilot.app.json --write-cert certs/rollpilot-certificate.pem
|
|
31
|
+
|
|
32
|
+
export ROLLPILOT_TOKEN=<token printed by setup>
|
|
33
|
+
rollpilot release --platform ios --runtime-version 1.0.0 --expo-export-dir dist
|
|
34
|
+
rollpilot rollout --release-id <release-id> --rollout-percent 5
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Every command takes `--output json` for CI and agents; `rollpilot --help`
|
|
38
|
+
lists them all.
|
|
39
|
+
|
|
40
|
+
`login` prompts for the password only in a terminal. Scripts, CI and agents
|
|
41
|
+
pass `--password` or set `ROLLPILOT_ADMIN_PASSWORD`; without either they fail
|
|
42
|
+
at once instead of waiting for input. The server address must be `https://`;
|
|
43
|
+
plain `http://` is accepted only for this machine (`localhost`, `127.0.0.0/8`,
|
|
44
|
+
`::1`), and nothing is sent to any other plain-HTTP address.
|
|
45
|
+
|
|
46
|
+
## Environment
|
|
47
|
+
|
|
48
|
+
The CLI's own variables use the `ROLLPILOT_` prefix (`ROLLPILOT_SERVER`,
|
|
49
|
+
`ROLLPILOT_TOKEN`, ...). The old `RN_OTA_` spellings still work as deprecated
|
|
50
|
+
aliases, print a warning on stderr, and are removed in releases after
|
|
51
|
+
2027-03-01. The launcher adds:
|
|
52
|
+
|
|
53
|
+
| Variable | Purpose |
|
|
54
|
+
|:---|:---|
|
|
55
|
+
| `ROLLPILOT_BINARY` | Run this binary instead of downloading one, for air-gapped installs. |
|
|
56
|
+
| `ROLLPILOT_CACHE_DIR` | Where the downloaded binary is cached (default `~/.cache/rollpilot/<version>`). Pre-seed it in a CI image to skip the download. |
|
|
57
|
+
| `ROLLPILOT_DOWNLOAD_BASE_URL` | Download root of an internal mirror of `https://downloads.rollpilot.dev/cli`; the launcher fetches `<root>/<version>/<binary>`. The checksum is still enforced. |
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
Proprietary; see [LICENSE](LICENSE). You may install and use the RollPilot CLI
|
|
62
|
+
to access RollPilot services.
|
package/bin/rollpilot.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { spawn } = require("child_process");
|
|
5
|
+
const { resolveBinary } = require("../lib/resolve");
|
|
6
|
+
|
|
7
|
+
resolveBinary()
|
|
8
|
+
.then((binary) => {
|
|
9
|
+
const child = spawn(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
10
|
+
child.on("error", (error) => {
|
|
11
|
+
process.stderr.write(`rollpilot: ${error.message}\n`);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
});
|
|
14
|
+
// Forward the child's exit faithfully, including signals, so CI sees the
|
|
15
|
+
// real result.
|
|
16
|
+
child.on("exit", (code, signal) => {
|
|
17
|
+
if (signal) {
|
|
18
|
+
process.kill(process.pid, signal);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
process.exit(code === null ? 1 : code);
|
|
22
|
+
});
|
|
23
|
+
})
|
|
24
|
+
.catch((error) => {
|
|
25
|
+
process.stderr.write(`rollpilot: ${error.message}\n`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
});
|
package/checksums.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"rollpilot_darwin_amd64": "97ba21af07059452b1b8c30ab7e6abd2228d2de4dfebdb9f9f363d7332033d48",
|
|
3
|
+
"rollpilot_darwin_arm64": "6ed661c051de9077fec198e0f5ca626c2744a4f177f20a3787ada5309dece6a2",
|
|
4
|
+
"rollpilot_linux_amd64": "04a1a4ad41d637481a8ca491427ac4771ba397ab0a692d99f1344447e06650ed",
|
|
5
|
+
"rollpilot_linux_arm64": "f9c81894916cc2e9794c8989798c28a2d1929b83ae7b99581260ae34ada24970",
|
|
6
|
+
"rollpilot_windows_amd64.exe": "f4d2ebebc1fd73d76e9d78baac3d5a3a75657fbee16f9350b047c344710762ae"
|
|
7
|
+
}
|
package/lib/resolve.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Resolves the rollpilot binary for the current platform, downloading it once
|
|
4
|
+
// from the public download host and caching it.
|
|
5
|
+
//
|
|
6
|
+
// React Native teams already have Node, so `npx @rollpilot/cli` is the entry
|
|
7
|
+
// point that costs them nothing: no Go toolchain and no checkout of anything.
|
|
8
|
+
// The binary is the CLI-only build (make cli-dist); the server is not public.
|
|
9
|
+
|
|
10
|
+
const fs = require("fs");
|
|
11
|
+
const os = require("os");
|
|
12
|
+
const path = require("path");
|
|
13
|
+
const crypto = require("crypto");
|
|
14
|
+
const https = require("https");
|
|
15
|
+
const http = require("http");
|
|
16
|
+
|
|
17
|
+
const pkg = require("../package.json");
|
|
18
|
+
const checksums = require("../checksums.json");
|
|
19
|
+
|
|
20
|
+
// make cli-dist output, as published: <base>/<version>/<artifact>.
|
|
21
|
+
const DEFAULT_DOWNLOAD_BASE_URL = "https://downloads.rollpilot.dev/cli";
|
|
22
|
+
// Idle time allowed on the connection before the download fails; a stalled
|
|
23
|
+
// connection must not hang CI forever.
|
|
24
|
+
const DOWNLOAD_IDLE_TIMEOUT_MS = 60 * 1000;
|
|
25
|
+
|
|
26
|
+
const PLATFORMS = {
|
|
27
|
+
"darwin-x64": "rollpilot_darwin_amd64",
|
|
28
|
+
"darwin-arm64": "rollpilot_darwin_arm64",
|
|
29
|
+
"linux-x64": "rollpilot_linux_amd64",
|
|
30
|
+
"linux-arm64": "rollpilot_linux_arm64",
|
|
31
|
+
"win32-x64": "rollpilot_windows_amd64.exe",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function artifactName() {
|
|
35
|
+
const key = `${process.platform}-${process.arch}`;
|
|
36
|
+
const name = PLATFORMS[key];
|
|
37
|
+
if (!name) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
`there is no prebuilt rollpilot binary for ${key}; ` +
|
|
40
|
+
`published platforms are ${Object.keys(PLATFORMS).join(", ")}. ` +
|
|
41
|
+
`Point ROLLPILOT_BINARY at a rollpilot binary to use one you already have.`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return name;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function cacheDir() {
|
|
48
|
+
// Honour the override so air-gapped and CI images can pre-seed the cache
|
|
49
|
+
// instead of reaching the network.
|
|
50
|
+
if (process.env.ROLLPILOT_CACHE_DIR) {
|
|
51
|
+
return process.env.ROLLPILOT_CACHE_DIR;
|
|
52
|
+
}
|
|
53
|
+
return path.join(os.homedir(), ".cache", "rollpilot", pkg.version);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function downloadURL(name) {
|
|
57
|
+
const base = (process.env.ROLLPILOT_DOWNLOAD_BASE_URL || DEFAULT_DOWNLOAD_BASE_URL).replace(/\/+$/, "");
|
|
58
|
+
return `${base}/${pkg.version}/${name}`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function get(url, redirectsLeft = 5) {
|
|
62
|
+
// Protocol follows the URL. The default base is https; an operator pointing
|
|
63
|
+
// ROLLPILOT_DOWNLOAD_BASE_URL at an internal http mirror has made that choice
|
|
64
|
+
// explicitly, and the checksum below, which ships inside this package rather
|
|
65
|
+
// than with the download, still guards integrity either way.
|
|
66
|
+
const client = url.startsWith("http://") ? http : https;
|
|
67
|
+
return new Promise((resolve, reject) => {
|
|
68
|
+
const request = client.get(url, (response) => {
|
|
69
|
+
const status = response.statusCode || 0;
|
|
70
|
+
if (status >= 300 && status < 400 && response.headers.location) {
|
|
71
|
+
response.resume();
|
|
72
|
+
if (redirectsLeft === 0) {
|
|
73
|
+
reject(new Error(`too many redirects fetching ${url}`));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
// A CDN may answer with a relative Location.
|
|
77
|
+
resolve(get(new URL(response.headers.location, url).toString(), redirectsLeft - 1));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (status !== 200) {
|
|
81
|
+
response.resume();
|
|
82
|
+
reject(new Error(`download failed with HTTP ${status}: ${url}`));
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const chunks = [];
|
|
86
|
+
response.on("data", (chunk) => chunks.push(chunk));
|
|
87
|
+
response.on("end", () => resolve(Buffer.concat(chunks)));
|
|
88
|
+
response.on("error", reject);
|
|
89
|
+
});
|
|
90
|
+
request.setTimeout(DOWNLOAD_IDLE_TIMEOUT_MS, () => {
|
|
91
|
+
request.destroy(new Error(`download stalled for ${DOWNLOAD_IDLE_TIMEOUT_MS / 1000}s: ${url}`));
|
|
92
|
+
});
|
|
93
|
+
request.on("error", reject);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async function download(name, destination) {
|
|
98
|
+
const expected = checksums[name];
|
|
99
|
+
if (!expected) {
|
|
100
|
+
// checksums.json is generated by make cli-dist for a release. The
|
|
101
|
+
// template in the repository has none, so say what to do instead of
|
|
102
|
+
// failing cryptically.
|
|
103
|
+
throw new Error(
|
|
104
|
+
`this @rollpilot/cli package (version ${pkg.version}) carries no checksum for ${name}, ` +
|
|
105
|
+
`so it was not built for release. Install a published version with ` +
|
|
106
|
+
`"npx @rollpilot/cli@latest", or point ROLLPILOT_BINARY at a rollpilot binary.`
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
const url = downloadURL(name);
|
|
110
|
+
const payload = await get(url);
|
|
111
|
+
const actual = crypto.createHash("sha256").update(payload).digest("hex");
|
|
112
|
+
if (actual !== expected) {
|
|
113
|
+
// Never run a binary that does not match what this package was published
|
|
114
|
+
// with.
|
|
115
|
+
throw new Error(
|
|
116
|
+
`checksum mismatch for ${name}\n expected ${expected}\n received ${actual}\n from ${url}`
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
120
|
+
// Write to a temporary name and rename, so a concurrent npx never sees a
|
|
121
|
+
// half-written binary and a failed write leaves nothing behind.
|
|
122
|
+
const temporary = `${destination}.${process.pid}.tmp`;
|
|
123
|
+
try {
|
|
124
|
+
fs.writeFileSync(temporary, payload, { mode: 0o755 });
|
|
125
|
+
fs.renameSync(temporary, destination);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
fs.rmSync(temporary, { force: true });
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
return destination;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async function resolveBinary() {
|
|
134
|
+
// An explicit path wins: air-gapped installs and platform developers should
|
|
135
|
+
// never be forced through a download.
|
|
136
|
+
if (process.env.ROLLPILOT_BINARY) {
|
|
137
|
+
if (!fs.existsSync(process.env.ROLLPILOT_BINARY)) {
|
|
138
|
+
throw new Error(`ROLLPILOT_BINARY does not exist: ${process.env.ROLLPILOT_BINARY}`);
|
|
139
|
+
}
|
|
140
|
+
return process.env.ROLLPILOT_BINARY;
|
|
141
|
+
}
|
|
142
|
+
const name = artifactName();
|
|
143
|
+
const cached = path.join(cacheDir(), name);
|
|
144
|
+
if (fs.existsSync(cached)) {
|
|
145
|
+
return cached;
|
|
146
|
+
}
|
|
147
|
+
return download(name, cached);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
module.exports = { resolveBinary, artifactName, cacheDir, downloadURL, PLATFORMS, DEFAULT_DOWNLOAD_BASE_URL };
|
package/package.json
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rollpilot/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "RollPilot CLI — React Native OTA releases from the terminal, CI, or an agent.",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"homepage": "https://rollpilot.dev",
|
|
7
|
+
"bin": {
|
|
8
|
+
"rollpilot": "bin/rollpilot.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/",
|
|
12
|
+
"lib/",
|
|
13
|
+
"checksums.json",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"react-native",
|
|
22
|
+
"expo",
|
|
23
|
+
"ota",
|
|
24
|
+
"code-push",
|
|
25
|
+
"rollpilot"
|
|
26
|
+
],
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
}
|
|
30
|
+
}
|