instabox 0.8.113 → 0.8.115
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 +7 -5
- package/bin/instabox.mjs +10 -39
- package/cli/SHA256SUMS +6 -6
- package/cli/instabox-darwin-amd64 +0 -0
- package/cli/instabox-darwin-arm64 +0 -0
- package/cli/instabox-linux-amd64 +0 -0
- package/cli/instabox-linux-arm64 +0 -0
- package/cli/instabox-windows-amd64.exe +0 -0
- package/cli/instabox-windows-arm64.exe +0 -0
- package/lib/cli.mjs +12 -133
- package/package.json +1 -1
- package/skills/instabox/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -16,16 +16,18 @@ Without a terminal (an agent, CI), nobody can enter a device code, so the sign-i
|
|
|
16
16
|
|
|
17
17
|
`npx instabox@latest skills install [-y] [--claude|--codex|--cursor|--opencode|--antigravity|--all]` installs only the agent skills, with no sign-in: Claude Code's in `~/.claude/skills`, Codex's, Cursor's and OpenCode's in `~/.agents/skills` (all three read it, so one copy serves them), Antigravity's in `~/.gemini/config/skills`. With no agent named it installs for all of them, asking first at a terminal unless `-y`. An unknown flag is a usage error, status 2.
|
|
18
18
|
|
|
19
|
-
Any other command line is the instabox CLI's ([`cmd/instabox`](../cmd/instabox)): `npx instabox@latest ls` runs `instabox ls`,
|
|
19
|
+
Any other command line is the instabox CLI's ([`cmd/instabox`](../cmd/instabox)): `npx instabox@latest ls` runs `instabox ls`, the build this package carries.
|
|
20
|
+
|
|
21
|
+
This package is the only place the CLI comes from. The other two install paths read it from the npm registry too: `curl -fsSL https://api.instabox.sh/install.sh | sh` (the server serves the script; the script asks `$INSTABOX_NPM_REGISTRY/instabox/$INSTABOX_VERSION`, default `https://registry.npmjs.org` and `latest`, for `dist.tarball`, verifies the tarball against `dist.integrity` (sha512), and extracts `package/cli/instabox-<os>-<arch>`), and `instabox update` (the same in Go). The control plane builds, stores and serves no CLI: a CLI change is on npm minutes after its merge, with no release and no deploy.
|
|
20
22
|
|
|
21
23
|
## How it works
|
|
22
24
|
|
|
23
25
|
- `bin/instabox.mjs` runs instabox's device-code sign-in (RFC 8628, `POST /v1/auth/device`, then polls `/v1/auth/device/token`), as `instabox login` does, and saves the tokens where the CLI keeps its own, `~/.config/instabox/credentials.json`, so both are signed in at once. There is one copy on purpose: the server rotates refresh tokens and ends the session when a rotated one comes back.
|
|
24
26
|
- `sh` always starts a new box, with no timeout and no idle auto-suspend of its own. An existing box is entered with the CLI: `instabox ssh <box>`.
|
|
25
27
|
- The package carries the Go CLI: all six builds (darwin, linux and windows; amd64 and arm64) under `cli/`, and `bin/instabox.mjs` picks the one for this machine ([`lib/platforms.mjs`](lib/platforms.mjs)). One package rather than one per platform keeps publishing to a single package and a single trusted-publisher setting; the price is that every install downloads the other platforms' builds too (about 22 MB compressed, cached by npx per version). It copies that binary onto PATH (`$INSTABOX_INSTALL_DIR`, else `/usr/local/bin` when writable, else `~/.local/bin`; Windows: `%LOCALAPPDATA%\Programs\instabox`), replaces an installed CLI whose content differs in place, and leaves a development build (`instabox dev`, or `-dirty`) alone. No network is needed for the CLI, and `npx instabox@latest <command>` runs the bundled binary directly, whatever is on PATH.
|
|
26
|
-
- Without a bundled binary (a platform with no build, or this directory run from a checkout, where `cli/` does not exist
|
|
28
|
+
- Without a bundled binary (a platform with no build, or this directory run from a checkout, where `cli/` does not exist until `scripts/bundle-cli.mjs` fills it) nothing is installed and nothing is downloaded: the output says why in one line (`lib/cli.mjs`, `missingBundledCli`), an installed CLI is left as it is, and `npx instabox@latest <command>` runs the installed CLI if there is one.
|
|
27
29
|
- Skills are written only over copies marked `installed-by: instabox`; the output says which were installed, updated, already up to date, or kept because they are the user's own.
|
|
28
|
-
-
|
|
30
|
+
- On Windows the bundled `instabox.exe` goes to `%LOCALAPPDATA%\Programs\instabox`; the output gives the PowerShell line that puts that folder on the user's PATH, and `npx instabox@latest <command>` finds it without that.
|
|
29
31
|
- The bin is also called `instabox`, so `lib/cli.mjs` finds the real CLI the way the insta CLI does: PATH without `node_modules` dirs and without links back to this script, then the installer's own targets.
|
|
30
32
|
- `prepack` copies `../skills` into the package; every skill there ships on the next publish.
|
|
31
33
|
|
|
@@ -39,7 +41,7 @@ npm pack # copies ../skills, then builds instabox-<version>.tgz
|
|
|
39
41
|
npx --package=./instabox-0.4.3.tgz instabox --help
|
|
40
42
|
```
|
|
41
43
|
|
|
42
|
-
`INSTABOX_API_URL` points it at another instabox server. From a checkout there is no bundled binary (`cli/` is not in version control), so the wrapper
|
|
44
|
+
`INSTABOX_API_URL` points it at another instabox server. From a checkout there is no bundled binary (`cli/` is not in version control), so the wrapper installs nothing and says so; to try the real thing, fill `cli/` the way CI does:
|
|
43
45
|
|
|
44
46
|
```sh
|
|
45
47
|
../scripts/build-cli.sh --out ../out/cli --version 0.0.0-local
|
|
@@ -58,4 +60,4 @@ A commit is published once. npm records the commit of every version it publishes
|
|
|
58
60
|
|
|
59
61
|
Trusted publishing is one setting on npmjs.com, package `instabox` → Settings → Trusted Publisher: GitHub Actions, `InsForge` / `instabox` / `npm-release.yml`. It is set. Renaming the workflow file breaks publishing until the setting is updated; npm does not follow renames.
|
|
60
62
|
|
|
61
|
-
The CLI a user gets from npm is the newest
|
|
63
|
+
The CLI a user gets, from npm, `install.sh` or `instabox update` alike, is the newest published, which can be ahead of the release a site runs.
|
package/bin/instabox.mjs
CHANGED
|
@@ -20,13 +20,11 @@ import { guestUserNote, localGuestUser } from '../lib/guestuser.mjs';
|
|
|
20
20
|
import { resolveImage } from '../lib/image.mjs';
|
|
21
21
|
import {
|
|
22
22
|
bundledCli,
|
|
23
|
-
checkCli,
|
|
24
23
|
cliVersion,
|
|
25
24
|
findCli,
|
|
26
25
|
installBundled,
|
|
27
|
-
installCli,
|
|
28
|
-
installCommand,
|
|
29
26
|
isOnboarding,
|
|
27
|
+
missingBundledCli,
|
|
30
28
|
real,
|
|
31
29
|
runCli,
|
|
32
30
|
sha256File,
|
|
@@ -247,40 +245,19 @@ async function newBox() {
|
|
|
247
245
|
return { id: op.machineId, name: body.name, user };
|
|
248
246
|
}
|
|
249
247
|
|
|
250
|
-
// Runs while the box starts; never fatal. Returns a line to print, or null.
|
|
248
|
+
// Runs while the box starts; never fatal. Returns a line to print, or null. The CLI comes from
|
|
249
|
+
// this package only (cli/<build>); without one for this machine there is nothing to install.
|
|
251
250
|
async function ensureCli() {
|
|
252
251
|
if (process.argv.includes('--no-cli')) return null;
|
|
253
252
|
const found = findCli();
|
|
254
253
|
const bundled = bundledCli();
|
|
255
254
|
if (bundled) return ensureBundledCli(bundled, found);
|
|
255
|
+
const why = missingBundledCli();
|
|
256
256
|
if (found) {
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
if (state === 'current') return `instabox CLI${v} is up to date ${dim('· try')} instabox ls`;
|
|
260
|
-
if (state === 'dev')
|
|
261
|
-
return `instabox CLI at ${found} is a development build (${version}), left as is ${dim('· for the release:')} ${installCommand(API)}`;
|
|
262
|
-
if (state === 'unknown')
|
|
263
|
-
return `instabox CLI${v} already installed, could not check for an update ${dim('· to update:')} ${installCommand(API)}`;
|
|
264
|
-
// stale: replace it where it is, the way a first install does. Through a symlink, replace
|
|
265
|
-
// the file it points to, so the link (and whatever manages it) stays as it was.
|
|
266
|
-
const dir = dirname(real(found));
|
|
267
|
-
try {
|
|
268
|
-
accessSync(dir, fsConstants.W_OK);
|
|
269
|
-
} catch {
|
|
270
|
-
// Installing anywhere else would leave the old copy first on PATH.
|
|
271
|
-
return `instabox CLI${v} at ${found} is out of date and ${dir} is not writable ${dim('· to update it there:')} ${installCommand(API, dir)}`;
|
|
272
|
-
}
|
|
273
|
-
const r = await installCli(API, { dir });
|
|
274
|
-
if (r.error)
|
|
275
|
-
return `instabox CLI${v} is out of date and could not be updated ${dim(`(${r.error}) · to update:`)} ${installCommand(API)}`;
|
|
276
|
-
return `instabox CLI updated${v ? ` from${v}` : ''}${r.version ? ` to ${r.version}` : ''} at ${found} ${dim('· try')} instabox ls`;
|
|
257
|
+
const version = await cliVersion(found);
|
|
258
|
+
return `instabox CLI${version ? ` ${version}` : ''} at ${found} left as is ${dim(`(${why})`)}`;
|
|
277
259
|
}
|
|
278
|
-
|
|
279
|
-
if (r.error) return `instabox CLI not installed ${dim(`(${r.error})`)}`;
|
|
280
|
-
return (
|
|
281
|
-
`instabox CLI installed${r.path ? ` at ${r.path}` : ''} ${dim('· try')} instabox ls` +
|
|
282
|
-
(r.pathHint ? `\n ${dim('add it to your PATH:')} ${r.pathHint}` : '')
|
|
283
|
-
);
|
|
260
|
+
return `instabox CLI not installed ${dim(`(${why})`)}`;
|
|
284
261
|
}
|
|
285
262
|
|
|
286
263
|
// This package carries the CLI for this machine (cli/<build>, lib/platforms.mjs): put
|
|
@@ -521,19 +498,13 @@ async function onboard(wantBox) {
|
|
|
521
498
|
}
|
|
522
499
|
|
|
523
500
|
// Any other command line is the CLI's, so `npm i -g instabox` still gives a working `instabox`:
|
|
524
|
-
// this package's own build when it carries one, else the installed CLI
|
|
501
|
+
// this package's own build when it carries one, else the installed CLI.
|
|
525
502
|
const args = process.argv.slice(2);
|
|
526
503
|
if (args.length === 1 && (args[0] === '-h' || args[0] === '--help')) usage();
|
|
527
504
|
else if (args[0] === 'skills') await skillsCommand(args.slice(1));
|
|
528
505
|
else if (isOnboarding(args)) await onboard(args.includes('sh'));
|
|
529
506
|
else {
|
|
530
|
-
|
|
531
|
-
if (!path) {
|
|
532
|
-
console.error(dim(' installing the instabox CLI…'));
|
|
533
|
-
const r = await installCli(API);
|
|
534
|
-
if (r.error) die(`could not install the instabox CLI: ${r.error}`);
|
|
535
|
-
if (!r.path) die('the installer finished but the instabox CLI was not found');
|
|
536
|
-
path = r.path;
|
|
537
|
-
}
|
|
507
|
+
const path = bundledCli() || findCli();
|
|
508
|
+
if (!path) die(`the instabox CLI is not installed: ${missingBundledCli()}`);
|
|
538
509
|
runCli(path, args);
|
|
539
510
|
}
|
package/cli/SHA256SUMS
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
cd05b74ae08c60e8f961094a54d5a282b1babb5c75a6834a6ddc8365f8e73d4b instabox-darwin-amd64
|
|
2
|
+
28bc4e2a0676d631ba7482ab3a4c3c242ab81f46b69b7b8a445a422774712db4 instabox-darwin-arm64
|
|
3
|
+
1f2e781f89d01ea4b18bb63cf41997980891251bd373c0b79365dc786902628f instabox-linux-amd64
|
|
4
|
+
c1baf628527885a58bd7fd209271abb6356be7629b112a109a79a261d0fa2a08 instabox-linux-arm64
|
|
5
|
+
95b7473c8e2c5f44d3f2e0eb7b9c6b6e2cce21ce55bc26e564427758e05700cb instabox-windows-amd64.exe
|
|
6
|
+
7f348fd2ed6297443005720aec84e1c6181999984723fbc3f39c13fff3afef30 instabox-windows-arm64.exe
|
|
Binary file
|
|
Binary file
|
package/cli/instabox-linux-amd64
CHANGED
|
Binary file
|
package/cli/instabox-linux-arm64
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// The Go instabox CLI: find it, install it, hand it the command line.
|
|
2
|
-
import { execFile,
|
|
2
|
+
import { execFile, spawnSync } from 'node:child_process';
|
|
3
3
|
import { createHash } from 'node:crypto';
|
|
4
4
|
import {
|
|
5
5
|
accessSync,
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
renameSync,
|
|
13
13
|
rmSync,
|
|
14
14
|
statSync,
|
|
15
|
-
writeFileSync,
|
|
16
15
|
} from 'node:fs';
|
|
17
16
|
import { homedir } from 'node:os';
|
|
18
17
|
import { dirname, join, sep } from 'node:path';
|
|
@@ -62,7 +61,7 @@ function runnable(p, platform) {
|
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
// Where
|
|
64
|
+
// Where the CLI goes on Windows, which has no /usr/local/bin.
|
|
66
65
|
export function windowsInstallDir(env = process.env) {
|
|
67
66
|
const local = env.LOCALAPPDATA || join(env.USERPROFILE || homedir(), 'AppData', 'Local');
|
|
68
67
|
return join(local, 'Programs', 'instabox');
|
|
@@ -70,7 +69,7 @@ export function windowsInstallDir(env = process.env) {
|
|
|
70
69
|
|
|
71
70
|
// The CLI this package carries for this machine: cli/<build> next to lib/ (lib/platforms.mjs).
|
|
72
71
|
// Null when it is not there (a platform without a build, or this directory run from a checkout,
|
|
73
|
-
// where cli/ does not exist)
|
|
72
|
+
// where cli/ does not exist); missingBundledCli says which.
|
|
74
73
|
const CLI_DIR = fileURLToPath(new URL('../cli/', import.meta.url));
|
|
75
74
|
export function bundledCli({ platform = process.platform, arch = process.arch, dir = CLI_DIR } = {}) {
|
|
76
75
|
const p = platformFor(platform, arch);
|
|
@@ -104,8 +103,8 @@ export function pathHint(dir, { env = process.env, platform = process.platform }
|
|
|
104
103
|
: `export PATH="${dir}:$PATH"`;
|
|
105
104
|
}
|
|
106
105
|
|
|
107
|
-
// Installs the bundled CLI at src as path (default: instabox in dir, default installDir), the way install.sh
|
|
108
|
-
//
|
|
106
|
+
// Installs the bundled CLI at src as path (default: instabox in dir, default installDir), the way install.sh
|
|
107
|
+
// does: written next to its destination, checked with --version, renamed into place,
|
|
109
108
|
// so a reader of the old file never sees a partial one. {path, version, pathHint} or {error};
|
|
110
109
|
// never throws, and never needs the network.
|
|
111
110
|
export async function installBundled(
|
|
@@ -154,18 +153,6 @@ export function findCli({ env = process.env, self = process.argv[1], platform =
|
|
|
154
153
|
return null;
|
|
155
154
|
}
|
|
156
155
|
|
|
157
|
-
// The URL is "$1", never script text; a failed download stops before sh runs anything.
|
|
158
|
-
const INSTALL = 's=$(curl -fsSL "$1/install.sh") && printf \'%s\\n\' "$s" | sh';
|
|
159
|
-
|
|
160
|
-
// The command a person runs to install or update the CLI themselves; with dir, one that puts it
|
|
161
|
-
// in that directory (for a directory they cannot write to without sudo).
|
|
162
|
-
export const installCommand = (api, dir, platform = process.platform) =>
|
|
163
|
-
platform === 'win32'
|
|
164
|
-
? 'npx instabox@latest'
|
|
165
|
-
: dir
|
|
166
|
-
? `curl -fsSL ${api}/install.sh | sudo env INSTABOX_INSTALL_DIR=${dir} sh`
|
|
167
|
-
: `curl -fsSL ${api}/install.sh | sh`;
|
|
168
|
-
|
|
169
156
|
// What `instabox --version` prints after "instabox ", or null when it does not run. Async, so a
|
|
170
157
|
// slow or hung binary does not hold up the rest of onboarding.
|
|
171
158
|
export function cliVersion(path) {
|
|
@@ -191,61 +178,13 @@ export function sha256File(path) {
|
|
|
191
178
|
});
|
|
192
179
|
}
|
|
193
180
|
|
|
194
|
-
//
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
// unknown: the CLI does not run, or SHA256SUMS could not be read
|
|
202
|
-
export async function checkCli(path, api, { fetch = globalThis.fetch } = {}) {
|
|
203
|
-
const version = await cliVersion(path);
|
|
204
|
-
if (!version) return { state: 'unknown', version };
|
|
205
|
-
if (version === 'dev' || version.endsWith('-dirty')) return { state: 'dev', version };
|
|
206
|
-
let sums;
|
|
207
|
-
try {
|
|
208
|
-
const res = await fetch(`${api}/dl/SHA256SUMS`, { signal: AbortSignal.timeout(10_000) });
|
|
209
|
-
if (!res.ok) return { state: 'unknown', version };
|
|
210
|
-
sums = new Set((await res.text()).match(/\b[0-9a-f]{64}\b/g) || []);
|
|
211
|
-
} catch {
|
|
212
|
-
return { state: 'unknown', version };
|
|
213
|
-
}
|
|
214
|
-
if (!sums.size) return { state: 'unknown', version };
|
|
215
|
-
let mine;
|
|
216
|
-
try {
|
|
217
|
-
mine = await sha256File(path);
|
|
218
|
-
} catch {
|
|
219
|
-
return { state: 'unknown', version };
|
|
220
|
-
}
|
|
221
|
-
return { state: sums.has(mine) ? 'current' : 'stale', version };
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// path is null, never a bare `instabox` that could resolve back to this script. dir replaces the
|
|
225
|
-
// CLI in that directory (INSTABOX_INSTALL_DIR), so an update lands where the old one is found.
|
|
226
|
-
export function installCli(api, { dir, platform = process.platform, ...win } = {}) {
|
|
227
|
-
if (platform === 'win32') return installWindows(api, { dir, ...win });
|
|
228
|
-
return new Promise((resolve) => {
|
|
229
|
-
let out = '';
|
|
230
|
-
const env = dir ? { ...process.env, INSTABOX_INSTALL_DIR: dir } : process.env;
|
|
231
|
-
const p = spawn('sh', ['-c', INSTALL, 'sh', api], { stdio: ['ignore', 'pipe', 'pipe'], env });
|
|
232
|
-
p.stdout.on('data', (d) => {
|
|
233
|
-
out += d;
|
|
234
|
-
});
|
|
235
|
-
p.stderr.on('data', (d) => {
|
|
236
|
-
out += d;
|
|
237
|
-
});
|
|
238
|
-
p.on('error', (e) => resolve({ error: e.message }));
|
|
239
|
-
p.on('close', (code) => {
|
|
240
|
-
if (code !== 0) return resolve({ error: out.trim().split('\n').pop() || 'installer failed' });
|
|
241
|
-
const installed = out.match(/^Installed (.+) \(([^()]*), sha256 [0-9a-f]+\)$/m) || [];
|
|
242
|
-
resolve({
|
|
243
|
-
path: installed[1] || findCli(),
|
|
244
|
-
version: installed[2]?.replace(/^instabox /, '') || null,
|
|
245
|
-
pathHint: (out.match(/export PATH="[^"]+"/) || [])[0] || null,
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
});
|
|
181
|
+
// Why bundledCli() is null, in one line: a platform with no build, or this directory run from a
|
|
182
|
+
// checkout, where cli/ does not exist until bundle-cli.mjs fills it. The package is the only
|
|
183
|
+
// place the CLI comes from (the server serves no builds), so there is no fallback.
|
|
184
|
+
export function missingBundledCli({ platform = process.platform, arch = process.arch } = {}) {
|
|
185
|
+
if (!platformFor(platform, arch))
|
|
186
|
+
return `no instabox CLI build for ${platform}/${arch} (macOS, Linux and Windows; amd64 and arm64 only)`;
|
|
187
|
+
return 'this package carries no cli/ (a checkout?); from npm/: ../scripts/build-cli.sh --out ../out/cli && node scripts/bundle-cli.mjs --cli-dir ../out/cli';
|
|
249
188
|
}
|
|
250
189
|
|
|
251
190
|
// Hand the command line to the Go CLI and exit with its status.
|
|
@@ -257,63 +196,3 @@ export function runCli(path, args) {
|
|
|
257
196
|
}
|
|
258
197
|
process.exit(r.status ?? 1);
|
|
259
198
|
}
|
|
260
|
-
|
|
261
|
-
const WINDOWS_ARCH = { x64: 'amd64', arm64: 'arm64' };
|
|
262
|
-
|
|
263
|
-
// Keep its checks in step with /install.sh's, which Windows cannot run.
|
|
264
|
-
async function installWindows(
|
|
265
|
-
api,
|
|
266
|
-
{ dir, env = process.env, arch = process.arch, fetch = globalThis.fetch, version = cliVersion } = {},
|
|
267
|
-
) {
|
|
268
|
-
if (!WINDOWS_ARCH[arch]) return { error: `no instabox CLI for Windows on ${arch} (x64 and arm64 only)` };
|
|
269
|
-
const name = `instabox-windows-${WINDOWS_ARCH[arch]}.exe`;
|
|
270
|
-
const to = dir || env.INSTABOX_INSTALL_DIR || windowsInstallDir(env);
|
|
271
|
-
const tmp = join(to, `.instabox.install.${process.pid}.exe`);
|
|
272
|
-
try {
|
|
273
|
-
const get = async (file) => {
|
|
274
|
-
const res = await fetch(`${api}/dl/${file}`, { signal: AbortSignal.timeout(300_000) });
|
|
275
|
-
if (!res.ok) throw new Error(`download ${file}: HTTP ${res.status}`);
|
|
276
|
-
return { body: Buffer.from(await res.arrayBuffer()), sha256: res.headers.get('x-instabox-sha256') };
|
|
277
|
-
};
|
|
278
|
-
// The sha256 from the same response: behind a load balancer, SHA256SUMS
|
|
279
|
-
// can come from a host serving another build. Older servers lack it.
|
|
280
|
-
let body, sums;
|
|
281
|
-
for (let attempt = 1; ; attempt++) {
|
|
282
|
-
const res = await get(name);
|
|
283
|
-
let want = res.sha256;
|
|
284
|
-
let from = 'the X-Instabox-Sha256 header';
|
|
285
|
-
if (!want) {
|
|
286
|
-
sums ??= String((await get('SHA256SUMS')).body);
|
|
287
|
-
want = sums
|
|
288
|
-
.split('\n')
|
|
289
|
-
.map((l) => l.trim().split(/\s+/))
|
|
290
|
-
.find(([, n]) => n === name || n === `*${name}`)?.[0];
|
|
291
|
-
from = `${api}/dl/SHA256SUMS`;
|
|
292
|
-
}
|
|
293
|
-
if (!/^[0-9a-f]{64}$/.test(want || '')) return { error: `no valid checksum for ${name} in ${from}` };
|
|
294
|
-
const got = createHash('sha256').update(res.body).digest('hex');
|
|
295
|
-
if (got === want) {
|
|
296
|
-
body = res.body;
|
|
297
|
-
break;
|
|
298
|
-
}
|
|
299
|
-
if (attempt === 3)
|
|
300
|
-
return {
|
|
301
|
-
error: `checksum mismatch for ${name} after ${attempt} downloads of ${api}/dl/${name} (got ${got}, want ${want} from ${from}); run it again if a deploy was in progress`,
|
|
302
|
-
};
|
|
303
|
-
await new Promise((r) => setTimeout(r, 1000));
|
|
304
|
-
}
|
|
305
|
-
mkdirSync(to, { recursive: true });
|
|
306
|
-
writeFileSync(tmp, body, { mode: 0o755 });
|
|
307
|
-
const v = await version(tmp);
|
|
308
|
-
if (!v) {
|
|
309
|
-
tryRm(tmp);
|
|
310
|
-
return { error: 'the downloaded instabox does not run (instabox --version failed)' };
|
|
311
|
-
}
|
|
312
|
-
const path = join(to, 'instabox.exe');
|
|
313
|
-
renameSync(tmp, path);
|
|
314
|
-
return { path, version: v, pathHint: pathHint(to, { env, platform: 'win32' }) };
|
|
315
|
-
} catch (e) {
|
|
316
|
-
tryRm(tmp);
|
|
317
|
-
return { error: e.message };
|
|
318
|
-
}
|
|
319
|
-
}
|
package/package.json
CHANGED
package/skills/instabox/SKILL.md
CHANGED
|
@@ -18,7 +18,7 @@ instabox login # device code: open the printed page, enter the cod
|
|
|
18
18
|
|
|
19
19
|
A GitHub sign-in and a Google sign-in with the same verified email share one account; with different emails they are separate accounts with separate boxes. Both `instabox login` and `npx instabox@latest` sign in with a device code: they print a page and a code (and open the page when there is a browser); the user opens it on any device, enters the code and chooses GitHub or Google there. It works the same over SSH or on a machine without a browser. Relay the page and the code to the user and wait; the command finishes on its own. Without a terminal, `npx instabox@latest` does not wait for a code: it uses `INSTABOX_API_KEY` when set (no browser, no code), else exits at once with status 3; add `--device-code` to get the page and code to relay. For Google directly, use `instabox login --provider google`, or `npx instabox@latest --google`. The CLI shares the sign-in `npx` made.
|
|
20
20
|
|
|
21
|
-
`instabox update` replaces the CLI with the
|
|
21
|
+
`instabox update` replaces the CLI with the latest instabox npm package (it prints "already up to date" when it is); run it when a command the docs describe is missing, or when a command ends with `instabox X is outdated (latest Y): run instabox update` on stderr (a daily check; `instabox version --json` has `outdated`/`latest`; `INSTABOX_NO_UPDATE_CHECK=1` silences it). `instabox completion bash|zsh|fish|powershell` prints a shell completion script for the user's shell startup file.
|
|
22
22
|
|
|
23
23
|
For CI or an agent without a browser, use an API key instead: `export INSTABOX_API_KEY=ibk_...` (the user creates it in the dashboard: API keys in the sidebar). Never print, commit or log a key. Installing or updating these skills needs no sign-in: `npx instabox@latest skills install -y` (`--claude` for `~/.claude/skills`, `--codex`, `--cursor` or `--opencode` for `~/.agents/skills`, `--antigravity` for `~/.gemini/config/skills`; none named: all).
|
|
24
24
|
|