@onkernel/cli 0.10.2 → 0.11.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 +121 -40
- package/lib.js +54 -9
- package/package.json +20 -19
- package/run-kernel.js +1 -1
package/README.md
CHANGED
|
@@ -149,17 +149,43 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
|
|
|
149
149
|
|
|
150
150
|
- `kernel browsers list` - List running browsers
|
|
151
151
|
- `kernel browsers create` - Create a new browser session
|
|
152
|
-
- `-p, --persistence-id <id>` - Unique identifier for browser session persistence
|
|
153
152
|
- `-s, --stealth` - Launch browser in stealth mode to avoid detection
|
|
154
153
|
- `-H, --headless` - Launch browser without GUI access
|
|
155
154
|
- `--kiosk` - Launch browser in kiosk mode
|
|
156
|
-
-
|
|
155
|
+
- `--pool-id <id>` - Acquire a browser from the specified pool (mutually exclusive with --pool-name; ignores other session flags)
|
|
156
|
+
- `--pool-name <name>` - Acquire a browser from the pool name (mutually exclusive with --pool-id; ignores other session flags)
|
|
157
|
+
- _Note: When a pool is specified, omit other session configuration flags—pool settings determine profile, proxy, viewport, etc._
|
|
158
|
+
- `kernel browsers delete <id>` - Delete a browser
|
|
157
159
|
- `-y, --yes` - Skip confirmation prompt
|
|
158
|
-
- `kernel browsers view <id
|
|
160
|
+
- `kernel browsers view <id>` - Get live view URL for a browser
|
|
161
|
+
|
|
162
|
+
### Browser Pools
|
|
163
|
+
|
|
164
|
+
- `kernel browser-pools list` - List browser pools
|
|
165
|
+
- `-o, --output json` - Output raw JSON response
|
|
166
|
+
- `kernel browser-pools create` - Create a browser pool
|
|
167
|
+
- `--name <name>` - Optional unique name for the pool
|
|
168
|
+
- `--size <n>` - Number of browsers in the pool (required)
|
|
169
|
+
- `--fill-rate <n>` - Percentage of the pool to fill per minute
|
|
170
|
+
- `--timeout <seconds>` - Idle timeout for browsers acquired from the pool
|
|
171
|
+
- `--stealth`, `--headless`, `--kiosk` - Default pool configuration
|
|
172
|
+
- `--profile-id`, `--profile-name`, `--save-changes`, `--proxy-id`, `--extension`, `--viewport` - Same semantics as `kernel browsers create`
|
|
173
|
+
- `kernel browser-pools get <id-or-name>` - Get pool details
|
|
174
|
+
- `-o, --output json` - Output raw JSON response
|
|
175
|
+
- `kernel browser-pools update <id-or-name>` - Update pool configuration
|
|
176
|
+
- Same flags as create plus `--discard-all-idle` to discard all idle browsers in the pool and refill at the specified fill rate
|
|
177
|
+
- `kernel browser-pools delete <id-or-name>` - Delete a pool
|
|
178
|
+
- `--force` - Force delete even if browsers are leased
|
|
179
|
+
- `kernel browser-pools acquire <id-or-name>` - Acquire a browser from the pool
|
|
180
|
+
- `--timeout <seconds>` - Acquire timeout before returning 204
|
|
181
|
+
- `kernel browser-pools release <id-or-name>` - Release a browser back to the pool
|
|
182
|
+
- `--session-id <id>` - Browser session ID to release (required)
|
|
183
|
+
- `--reuse` - Reuse the browser instance (default: true)
|
|
184
|
+
- `kernel browser-pools flush <id-or-name>` - Destroy all idle browsers in the pool
|
|
159
185
|
|
|
160
186
|
### Browser Logs
|
|
161
187
|
|
|
162
|
-
- `kernel browsers logs stream <id
|
|
188
|
+
- `kernel browsers logs stream <id>` - Stream browser logs
|
|
163
189
|
- `--source <source>` - Log source: "path" or "supervisor" (required)
|
|
164
190
|
- `--follow` - Follow the log stream (default: true)
|
|
165
191
|
- `--path <path>` - File path when source=path
|
|
@@ -167,111 +193,111 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
|
|
|
167
193
|
|
|
168
194
|
### Browser Replays
|
|
169
195
|
|
|
170
|
-
- `kernel browsers replays list <id
|
|
171
|
-
- `kernel browsers replays start <id
|
|
196
|
+
- `kernel browsers replays list <id>` - List replays for a browser
|
|
197
|
+
- `kernel browsers replays start <id>` - Start a replay recording
|
|
172
198
|
- `--framerate <fps>` - Recording framerate (fps)
|
|
173
199
|
- `--max-duration <seconds>` - Maximum duration in seconds
|
|
174
|
-
- `kernel browsers replays stop <id
|
|
175
|
-
- `kernel browsers replays download <id
|
|
200
|
+
- `kernel browsers replays stop <id> <replay-id>` - Stop a replay recording
|
|
201
|
+
- `kernel browsers replays download <id> <replay-id>` - Download a replay video
|
|
176
202
|
- `-o, --output <path>` - Output file path for the replay video
|
|
177
203
|
|
|
178
204
|
### Browser Process Control
|
|
179
205
|
|
|
180
|
-
- `kernel browsers process exec <id
|
|
206
|
+
- `kernel browsers process exec <id> [--] [command...]` - Execute a command synchronously
|
|
181
207
|
- `--command <cmd>` - Command to execute (optional; if omitted, trailing args are executed via /bin/bash -c)
|
|
182
208
|
- `--args <args>` - Command arguments
|
|
183
209
|
- `--cwd <path>` - Working directory
|
|
184
210
|
- `--timeout <seconds>` - Timeout in seconds
|
|
185
211
|
- `--as-user <user>` - Run as user
|
|
186
212
|
- `--as-root` - Run as root
|
|
187
|
-
- `kernel browsers process spawn <id
|
|
213
|
+
- `kernel browsers process spawn <id> [--] [command...]` - Execute a command asynchronously
|
|
188
214
|
- `--command <cmd>` - Command to execute (optional; if omitted, trailing args are executed via /bin/bash -c)
|
|
189
215
|
- `--args <args>` - Command arguments
|
|
190
216
|
- `--cwd <path>` - Working directory
|
|
191
217
|
- `--timeout <seconds>` - Timeout in seconds
|
|
192
218
|
- `--as-user <user>` - Run as user
|
|
193
219
|
- `--as-root` - Run as root
|
|
194
|
-
- `kernel browsers process kill <id
|
|
220
|
+
- `kernel browsers process kill <id> <process-id>` - Send a signal to a process
|
|
195
221
|
- `--signal <signal>` - Signal to send: TERM, KILL, INT, HUP (default: TERM)
|
|
196
|
-
- `kernel browsers process status <id
|
|
197
|
-
- `kernel browsers process stdin <id
|
|
222
|
+
- `kernel browsers process status <id> <process-id>` - Get process status
|
|
223
|
+
- `kernel browsers process stdin <id> <process-id>` - Write to process stdin (base64)
|
|
198
224
|
- `--data-b64 <data>` - Base64-encoded data to write to stdin (required)
|
|
199
|
-
- `kernel browsers process stdout-stream <id
|
|
225
|
+
- `kernel browsers process stdout-stream <id> <process-id>` - Stream process stdout/stderr
|
|
200
226
|
|
|
201
227
|
### Browser Filesystem
|
|
202
228
|
|
|
203
|
-
- `kernel browsers fs new-directory <id
|
|
229
|
+
- `kernel browsers fs new-directory <id>` - Create a new directory
|
|
204
230
|
- `--path <path>` - Absolute directory path to create (required)
|
|
205
231
|
- `--mode <mode>` - Directory mode (octal string)
|
|
206
|
-
- `kernel browsers fs delete-directory <id
|
|
232
|
+
- `kernel browsers fs delete-directory <id>` - Delete a directory
|
|
207
233
|
- `--path <path>` - Absolute directory path to delete (required)
|
|
208
|
-
- `kernel browsers fs delete-file <id
|
|
234
|
+
- `kernel browsers fs delete-file <id>` - Delete a file
|
|
209
235
|
- `--path <path>` - Absolute file path to delete (required)
|
|
210
|
-
- `kernel browsers fs download-dir-zip <id
|
|
236
|
+
- `kernel browsers fs download-dir-zip <id>` - Download a directory as zip
|
|
211
237
|
- `--path <path>` - Absolute directory path to download (required)
|
|
212
238
|
- `-o, --output <path>` - Output zip file path
|
|
213
|
-
- `kernel browsers fs file-info <id
|
|
239
|
+
- `kernel browsers fs file-info <id>` - Get file or directory info
|
|
214
240
|
- `--path <path>` - Absolute file or directory path (required)
|
|
215
|
-
- `kernel browsers fs list-files <id
|
|
241
|
+
- `kernel browsers fs list-files <id>` - List files in a directory
|
|
216
242
|
- `--path <path>` - Absolute directory path (required)
|
|
217
|
-
- `kernel browsers fs move <id
|
|
243
|
+
- `kernel browsers fs move <id>` - Move or rename a file or directory
|
|
218
244
|
- `--src <path>` - Absolute source path (required)
|
|
219
245
|
- `--dest <path>` - Absolute destination path (required)
|
|
220
|
-
- `kernel browsers fs read-file <id
|
|
246
|
+
- `kernel browsers fs read-file <id>` - Read a file
|
|
221
247
|
- `--path <path>` - Absolute file path (required)
|
|
222
248
|
- `-o, --output <path>` - Output file path (optional)
|
|
223
|
-
- `kernel browsers fs set-permissions <id
|
|
249
|
+
- `kernel browsers fs set-permissions <id>` - Set file permissions or ownership
|
|
224
250
|
- `--path <path>` - Absolute path (required)
|
|
225
251
|
- `--mode <mode>` - File mode bits (octal string) (required)
|
|
226
252
|
- `--owner <user>` - New owner username or UID
|
|
227
253
|
- `--group <group>` - New group name or GID
|
|
228
|
-
- `kernel browsers fs upload <id
|
|
254
|
+
- `kernel browsers fs upload <id>` - Upload one or more files
|
|
229
255
|
- `--file <local:remote>` - Mapping local:remote (repeatable)
|
|
230
256
|
- `--dest-dir <path>` - Destination directory for uploads
|
|
231
257
|
- `--paths <paths>` - Local file paths to upload
|
|
232
|
-
- `kernel browsers fs upload-zip <id
|
|
258
|
+
- `kernel browsers fs upload-zip <id>` - Upload a zip and extract it
|
|
233
259
|
- `--zip <path>` - Local zip file path (required)
|
|
234
260
|
- `--dest-dir <path>` - Destination directory to extract to (required)
|
|
235
|
-
- `kernel browsers fs write-file <id
|
|
261
|
+
- `kernel browsers fs write-file <id>` - Write a file from local data
|
|
236
262
|
- `--path <path>` - Destination absolute file path (required)
|
|
237
263
|
- `--mode <mode>` - File mode (octal string)
|
|
238
264
|
- `--source <path>` - Local source file path (required)
|
|
239
265
|
|
|
240
266
|
### Browser Extensions
|
|
241
267
|
|
|
242
|
-
- `kernel browsers extensions upload <id
|
|
268
|
+
- `kernel browsers extensions upload <id> <extension-path>...` - Ad-hoc upload of one or more unpacked extensions to a running browser instance.
|
|
243
269
|
|
|
244
270
|
### Browser Computer Controls
|
|
245
271
|
|
|
246
|
-
- `kernel browsers computer click-mouse <id
|
|
272
|
+
- `kernel browsers computer click-mouse <id>` - Click mouse at coordinates
|
|
247
273
|
- `--x <coordinate>` - X coordinate (required)
|
|
248
274
|
- `--y <coordinate>` - Y coordinate (required)
|
|
249
275
|
- `--num-clicks <n>` - Number of clicks (default: 1)
|
|
250
276
|
- `--button <button>` - Mouse button: left, right, middle, back, forward (default: left)
|
|
251
277
|
- `--click-type <type>` - Click type: down, up, click (default: click)
|
|
252
278
|
- `--hold-key <key>` - Modifier keys to hold (repeatable)
|
|
253
|
-
- `kernel browsers computer move-mouse <id
|
|
279
|
+
- `kernel browsers computer move-mouse <id>` - Move mouse to coordinates
|
|
254
280
|
- `--x <coordinate>` - X coordinate (required)
|
|
255
281
|
- `--y <coordinate>` - Y coordinate (required)
|
|
256
282
|
- `--hold-key <key>` - Modifier keys to hold (repeatable)
|
|
257
|
-
- `kernel browsers computer screenshot <id
|
|
283
|
+
- `kernel browsers computer screenshot <id>` - Capture a screenshot
|
|
258
284
|
- `--to <path>` - Output file path for the PNG image (required)
|
|
259
285
|
- `--x <coordinate>` - Top-left X for region capture (optional)
|
|
260
286
|
- `--y <coordinate>` - Top-left Y for region capture (optional)
|
|
261
287
|
- `--width <pixels>` - Region width (optional)
|
|
262
288
|
- `--height <pixels>` - Region height (optional)
|
|
263
|
-
- `kernel browsers computer type <id
|
|
289
|
+
- `kernel browsers computer type <id>` - Type text on the browser instance
|
|
264
290
|
|
|
265
291
|
- `--text <text>` - Text to type (required)
|
|
266
292
|
- `--delay <ms>` - Delay in milliseconds between keystrokes (optional)
|
|
267
293
|
|
|
268
|
-
- `kernel browsers computer press-key <id
|
|
294
|
+
- `kernel browsers computer press-key <id>` - Press one or more keys
|
|
269
295
|
|
|
270
296
|
- `--key <key>` - Key symbols to press (repeatable)
|
|
271
297
|
- `--duration <ms>` - Duration to hold keys down in ms (0=tap)
|
|
272
298
|
- `--hold-key <key>` - Modifier keys to hold (repeatable)
|
|
273
299
|
|
|
274
|
-
- `kernel browsers computer scroll <id
|
|
300
|
+
- `kernel browsers computer scroll <id>` - Scroll the mouse wheel
|
|
275
301
|
|
|
276
302
|
- `--x <coordinate>` - X coordinate (required)
|
|
277
303
|
- `--y <coordinate>` - Y coordinate (required)
|
|
@@ -279,7 +305,7 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
|
|
|
279
305
|
- `--delta-y <pixels>` - Vertical scroll amount (+down, -up)
|
|
280
306
|
- `--hold-key <key>` - Modifier keys to hold (repeatable)
|
|
281
307
|
|
|
282
|
-
- `kernel browsers computer drag-mouse <id
|
|
308
|
+
- `kernel browsers computer drag-mouse <id>` - Drag the mouse along a path
|
|
283
309
|
- `--point <x,y>` - Add a point as x,y (repeatable)
|
|
284
310
|
- `--delay <ms>` - Delay before dragging starts in ms
|
|
285
311
|
- `--button <button>` - Mouse button: left, middle, right (default: left)
|
|
@@ -287,7 +313,7 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
|
|
|
287
313
|
|
|
288
314
|
### Browser Playwright
|
|
289
315
|
|
|
290
|
-
- `kernel browsers playwright execute <id
|
|
316
|
+
- `kernel browsers playwright execute <id> [code]` - Execute Playwright/TypeScript code against the browser
|
|
291
317
|
- `--timeout <seconds>` - Maximum execution time in seconds (defaults server-side)
|
|
292
318
|
- If `[code]` is omitted, code is read from stdin
|
|
293
319
|
|
|
@@ -304,6 +330,30 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
|
|
|
304
330
|
- `kernel extensions delete <id-or-name>` - Delete an extension by ID or name
|
|
305
331
|
- `-y, --yes` - Skip confirmation prompt
|
|
306
332
|
|
|
333
|
+
### Proxy Management
|
|
334
|
+
|
|
335
|
+
- `kernel proxies list` - List proxy configurations
|
|
336
|
+
- `kernel proxies get <id>` - Get a proxy configuration by ID
|
|
337
|
+
- `kernel proxies create` - Create a new proxy configuration
|
|
338
|
+
|
|
339
|
+
- `--name <name>` - Proxy configuration name
|
|
340
|
+
- `--type <type>` - Proxy type: datacenter, isp, residential, mobile, custom (required)
|
|
341
|
+
- `--protocol <http|https>` - Protocol to use (default: https)
|
|
342
|
+
- `--country <code>` - ISO 3166 country code or "EU" (location-based types)
|
|
343
|
+
- `--city <name>` - City name (no spaces, e.g. sanfrancisco) (residential, mobile; requires `--country`)
|
|
344
|
+
- `--state <code>` - Two-letter state code (residential, mobile)
|
|
345
|
+
- `--zip <zip>` - US ZIP code (residential, mobile)
|
|
346
|
+
- `--asn <asn>` - Autonomous system number (e.g., AS15169) (residential, mobile)
|
|
347
|
+
- `--os <os>` - Operating system: windows, macos, android (residential)
|
|
348
|
+
- `--carrier <carrier>` - Mobile carrier (mobile)
|
|
349
|
+
- `--host <host>` - Proxy host (custom; required)
|
|
350
|
+
- `--port <port>` - Proxy port (custom; required)
|
|
351
|
+
- `--username <username>` - Username for proxy authentication (custom)
|
|
352
|
+
- `--password <password>` - Password for proxy authentication (custom)
|
|
353
|
+
|
|
354
|
+
- `kernel proxies delete <id>` - Delete a proxy configuration
|
|
355
|
+
- `-y, --yes` - Skip confirmation prompt
|
|
356
|
+
|
|
307
357
|
## Examples
|
|
308
358
|
|
|
309
359
|
### Deploy with environment variables
|
|
@@ -351,8 +401,8 @@ kernel browsers list
|
|
|
351
401
|
# Create a new browser session
|
|
352
402
|
kernel browsers create
|
|
353
403
|
|
|
354
|
-
# Create a
|
|
355
|
-
kernel browsers create --
|
|
404
|
+
# Create a browser with a longer timeout (up to 72 hours)
|
|
405
|
+
kernel browsers create --timeout 3600
|
|
356
406
|
|
|
357
407
|
# Create a headless browser in stealth mode
|
|
358
408
|
kernel browsers create --headless --stealth
|
|
@@ -360,11 +410,14 @@ kernel browsers create --headless --stealth
|
|
|
360
410
|
# Create a browser in kiosk mode
|
|
361
411
|
kernel browsers create --kiosk
|
|
362
412
|
|
|
363
|
-
#
|
|
364
|
-
kernel browsers
|
|
413
|
+
# Create a browser with a profile for session state
|
|
414
|
+
kernel browsers create --profile-name my-profile
|
|
415
|
+
|
|
416
|
+
# Delete a browser
|
|
417
|
+
kernel browsers delete browser123 --yes
|
|
365
418
|
|
|
366
419
|
# Get live view URL
|
|
367
|
-
kernel browsers view
|
|
420
|
+
kernel browsers view browser123
|
|
368
421
|
|
|
369
422
|
# Stream browser logs
|
|
370
423
|
kernel browsers logs stream my-browser --source supervisor --follow --supervisor-process chromium
|
|
@@ -456,6 +509,34 @@ kernel extensions delete my-extension-name --yes
|
|
|
456
509
|
kernel browsers extensions upload my-browser ./extension1 ./extension2
|
|
457
510
|
```
|
|
458
511
|
|
|
512
|
+
### Proxy management
|
|
513
|
+
|
|
514
|
+
```bash
|
|
515
|
+
# List proxy configurations
|
|
516
|
+
kernel proxies list
|
|
517
|
+
|
|
518
|
+
# Create a datacenter proxy
|
|
519
|
+
kernel proxies create --type datacenter --country US --name "US Datacenter"
|
|
520
|
+
|
|
521
|
+
# Create a datacenter proxy using HTTP protocol
|
|
522
|
+
kernel proxies create --type datacenter --country US --protocol http --name "US DC (HTTP)"
|
|
523
|
+
|
|
524
|
+
# Create a custom proxy
|
|
525
|
+
kernel proxies create --type custom --host proxy.example.com --port 8080 --username myuser --password mypass --name "My Custom Proxy"
|
|
526
|
+
|
|
527
|
+
# Create a residential proxy with location and OS
|
|
528
|
+
kernel proxies create --type residential --country US --city sanfrancisco --state CA --zip 94107 --asn AS15169 --os windows --name "SF Residential"
|
|
529
|
+
|
|
530
|
+
# Create a mobile proxy with carrier
|
|
531
|
+
kernel proxies create --type mobile --country US --carrier verizon --name "US Mobile"
|
|
532
|
+
|
|
533
|
+
# Get proxy details
|
|
534
|
+
kernel proxies get prx_123
|
|
535
|
+
|
|
536
|
+
# Delete a proxy (skip confirmation)
|
|
537
|
+
kernel proxies delete prx_123 --yes
|
|
538
|
+
```
|
|
539
|
+
|
|
459
540
|
## Getting Help
|
|
460
541
|
|
|
461
542
|
- `kernel --help` - Show all available commands
|
package/lib.js
CHANGED
|
@@ -6,8 +6,11 @@ const path = require("path");
|
|
|
6
6
|
const JSZip = require("jszip");
|
|
7
7
|
const tar = require("tar");
|
|
8
8
|
const axios = require("axios");
|
|
9
|
+
const { ProxyAgent } = require("proxy-agent");
|
|
9
10
|
const { spawnSync } = require("child_process");
|
|
10
11
|
|
|
12
|
+
const agent = new ProxyAgent();
|
|
13
|
+
|
|
11
14
|
const getArchive = () => {
|
|
12
15
|
let target = `${process.platform}-${process.arch}`;
|
|
13
16
|
const archive = archives[target];
|
|
@@ -19,31 +22,61 @@ const getArchive = () => {
|
|
|
19
22
|
|
|
20
23
|
const binDir = path.join(__dirname, "bin");
|
|
21
24
|
|
|
22
|
-
async function extractTar(tarPath, binaries, dir) {
|
|
25
|
+
async function extractTar(tarPath, binaries, dir, wrappedIn) {
|
|
23
26
|
try {
|
|
27
|
+
const filesToExtract = wrappedIn
|
|
28
|
+
? binaries.map((bin) =>
|
|
29
|
+
path.join(wrappedIn, bin).replace(/\\/g, "/"),
|
|
30
|
+
)
|
|
31
|
+
: binaries;
|
|
32
|
+
|
|
24
33
|
await tar.x({
|
|
25
34
|
file: tarPath,
|
|
26
35
|
cwd: dir,
|
|
27
|
-
filter: (path) =>
|
|
36
|
+
filter: (path) => filesToExtract.includes(path),
|
|
28
37
|
});
|
|
29
|
-
|
|
38
|
+
|
|
39
|
+
// If wrapped, move files from wrapped directory to bin directory
|
|
40
|
+
if (wrappedIn) {
|
|
41
|
+
const wrappedDir = path.join(dir, wrappedIn);
|
|
42
|
+
for (const binary of binaries) {
|
|
43
|
+
const srcPath = path.join(wrappedDir, binary);
|
|
44
|
+
const destPath = path.join(dir, binary);
|
|
45
|
+
if (fs.existsSync(srcPath)) {
|
|
46
|
+
fs.renameSync(srcPath, destPath);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Clean up empty wrapped directory
|
|
50
|
+
try {
|
|
51
|
+
fs.rmSync(wrappedDir, { recursive: true, force: true });
|
|
52
|
+
} catch (err) {
|
|
53
|
+
// Ignore cleanup errors
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log(`Successfully extracted ${binaries} to "${dir}"`);
|
|
30
58
|
} catch (err) {
|
|
31
59
|
throw new Error(`Extraction failed: ${err.message}`);
|
|
32
60
|
}
|
|
33
61
|
}
|
|
34
62
|
|
|
35
|
-
async function extractZip(zipPath, binaries, dir) {
|
|
63
|
+
async function extractZip(zipPath, binaries, dir, wrappedIn) {
|
|
36
64
|
try {
|
|
37
65
|
const zipData = fs.readFileSync(zipPath);
|
|
38
66
|
const zip = await JSZip.loadAsync(zipData);
|
|
67
|
+
|
|
39
68
|
for (const binary of binaries) {
|
|
40
|
-
|
|
69
|
+
const binaryPath = wrappedIn
|
|
70
|
+
? path.join(wrappedIn, binary).replace(/\\/g, "/")
|
|
71
|
+
: binary;
|
|
72
|
+
|
|
73
|
+
if (!zip.files[binaryPath]) {
|
|
41
74
|
throw new Error(
|
|
42
|
-
`Error: ${
|
|
75
|
+
`Error: ${binaryPath} does not exist in ${zipPath}`,
|
|
43
76
|
);
|
|
44
77
|
}
|
|
45
78
|
|
|
46
|
-
const content = await zip.files[
|
|
79
|
+
const content = await zip.files[binaryPath].async("nodebuffer");
|
|
47
80
|
if (!fs.existsSync(dir)) {
|
|
48
81
|
fs.mkdirSync(dir, { recursive: true });
|
|
49
82
|
}
|
|
@@ -94,11 +127,21 @@ const install = async () => {
|
|
|
94
127
|
fs.chmodSync(bin, 0o755);
|
|
95
128
|
return;
|
|
96
129
|
case "zip":
|
|
97
|
-
return extractZip(
|
|
130
|
+
return extractZip(
|
|
131
|
+
archivePath,
|
|
132
|
+
archive.bins,
|
|
133
|
+
binDir,
|
|
134
|
+
archive.wrappedIn,
|
|
135
|
+
);
|
|
98
136
|
case "tar":
|
|
99
137
|
case "tar.gz":
|
|
100
138
|
case "tgz":
|
|
101
|
-
return extractTar(
|
|
139
|
+
return extractTar(
|
|
140
|
+
archivePath,
|
|
141
|
+
archive.bins,
|
|
142
|
+
binDir,
|
|
143
|
+
archive.wrappedIn,
|
|
144
|
+
);
|
|
102
145
|
case "tar.zst":
|
|
103
146
|
case "tzst":
|
|
104
147
|
case "tar.xz":
|
|
@@ -140,6 +183,8 @@ const download = async (url, filename) => {
|
|
|
140
183
|
url: url,
|
|
141
184
|
responseType: "stream",
|
|
142
185
|
timeout: 300000, // 5min
|
|
186
|
+
httpAgent: agent,
|
|
187
|
+
httpsAgent: agent,
|
|
143
188
|
});
|
|
144
189
|
|
|
145
190
|
const writer = fs.createWriteStream(filename);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onkernel/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Kernel CLI",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"postinstall": "node install.js",
|
|
@@ -29,79 +29,80 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"axios": "^1.8.2",
|
|
31
31
|
"jszip": "^3.10.1",
|
|
32
|
+
"proxy-agent": "^6.5.0",
|
|
32
33
|
"tar": "^7.4.3"
|
|
33
34
|
},
|
|
34
35
|
"archives": {
|
|
35
36
|
"darwin-arm64": {
|
|
36
|
-
"name": "kernel_0.
|
|
37
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.
|
|
37
|
+
"name": "kernel_0.11.1_darwin_arm64.tar.gz",
|
|
38
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.11.1/kernel_0.11.1_darwin_arm64.tar.gz",
|
|
38
39
|
"bins": [
|
|
39
40
|
"kernel"
|
|
40
41
|
],
|
|
41
42
|
"format": "tar.gz",
|
|
42
43
|
"checksum": {
|
|
43
44
|
"algorithm": "sha256",
|
|
44
|
-
"digest": "
|
|
45
|
+
"digest": "9146a3fd66e44a022aab4985853124dc0a66c73728fb5187bd2638e2d4c3dc61"
|
|
45
46
|
}
|
|
46
47
|
},
|
|
47
48
|
"darwin-x64": {
|
|
48
|
-
"name": "kernel_0.
|
|
49
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.
|
|
49
|
+
"name": "kernel_0.11.1_darwin_amd64.tar.gz",
|
|
50
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.11.1/kernel_0.11.1_darwin_amd64.tar.gz",
|
|
50
51
|
"bins": [
|
|
51
52
|
"kernel"
|
|
52
53
|
],
|
|
53
54
|
"format": "tar.gz",
|
|
54
55
|
"checksum": {
|
|
55
56
|
"algorithm": "sha256",
|
|
56
|
-
"digest": "
|
|
57
|
+
"digest": "e57991bc143f92b57b48c6f5970ee1953810598145bb75232f63f141ca0baa51"
|
|
57
58
|
}
|
|
58
59
|
},
|
|
59
60
|
"linux-arm64": {
|
|
60
|
-
"name": "kernel_0.
|
|
61
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.
|
|
61
|
+
"name": "kernel_0.11.1_linux_arm64.tar.gz",
|
|
62
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.11.1/kernel_0.11.1_linux_arm64.tar.gz",
|
|
62
63
|
"bins": [
|
|
63
64
|
"kernel"
|
|
64
65
|
],
|
|
65
66
|
"format": "tar.gz",
|
|
66
67
|
"checksum": {
|
|
67
68
|
"algorithm": "sha256",
|
|
68
|
-
"digest": "
|
|
69
|
+
"digest": "149156ee2c688ebda75a043a591e78d78d2d25e5a9b59d6db40539b1de008e43"
|
|
69
70
|
}
|
|
70
71
|
},
|
|
71
72
|
"linux-x64": {
|
|
72
|
-
"name": "kernel_0.
|
|
73
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.
|
|
73
|
+
"name": "kernel_0.11.1_linux_amd64.tar.gz",
|
|
74
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.11.1/kernel_0.11.1_linux_amd64.tar.gz",
|
|
74
75
|
"bins": [
|
|
75
76
|
"kernel"
|
|
76
77
|
],
|
|
77
78
|
"format": "tar.gz",
|
|
78
79
|
"checksum": {
|
|
79
80
|
"algorithm": "sha256",
|
|
80
|
-
"digest": "
|
|
81
|
+
"digest": "dff0d01e197fa31d8b370c17d3f9240a4ae3ca4cd7cef25d33930bbcddd4c998"
|
|
81
82
|
}
|
|
82
83
|
},
|
|
83
84
|
"win32-arm64": {
|
|
84
|
-
"name": "kernel_0.
|
|
85
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.
|
|
85
|
+
"name": "kernel_0.11.1_windows_arm64.tar.gz",
|
|
86
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.11.1/kernel_0.11.1_windows_arm64.tar.gz",
|
|
86
87
|
"bins": [
|
|
87
88
|
"kernel.exe"
|
|
88
89
|
],
|
|
89
90
|
"format": "tar.gz",
|
|
90
91
|
"checksum": {
|
|
91
92
|
"algorithm": "sha256",
|
|
92
|
-
"digest": "
|
|
93
|
+
"digest": "db83ef1d90425925cb702523438ebe81ac0b89f0166f73f7c339f1c46b7d6d3b"
|
|
93
94
|
}
|
|
94
95
|
},
|
|
95
96
|
"win32-x64": {
|
|
96
|
-
"name": "kernel_0.
|
|
97
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.
|
|
97
|
+
"name": "kernel_0.11.1_windows_amd64.tar.gz",
|
|
98
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.11.1/kernel_0.11.1_windows_amd64.tar.gz",
|
|
98
99
|
"bins": [
|
|
99
100
|
"kernel.exe"
|
|
100
101
|
],
|
|
101
102
|
"format": "tar.gz",
|
|
102
103
|
"checksum": {
|
|
103
104
|
"algorithm": "sha256",
|
|
104
|
-
"digest": "
|
|
105
|
+
"digest": "47df8058fcb185bc5ed2fd3f9cc66639e4d0f4e7f0ce5b9be9e5d2042d147256"
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
}
|
package/run-kernel.js
CHANGED