@onkernel/cli 0.4.11 → 0.6.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 +109 -2
- package/lib.js +49 -9
- package/package.json +19 -19
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
<img alt="GitHub License" src="https://img.shields.io/github/license/onkernel/
|
|
6
|
+
<img alt="GitHub License" src="https://img.shields.io/github/license/onkernel/cli">
|
|
7
7
|
<a href="https://discord.gg/FBrveQRcud"><img src="https://img.shields.io/discord/1342243238748225556?logo=discord&logoColor=white&color=7289DA" alt="Discord"></a>
|
|
8
8
|
<a href="https://x.com/juecd__"><img src="https://img.shields.io/twitter/follow/juecd__" alt="Follow @juecd__"></a>
|
|
9
9
|
<a href="https://x.com/rfgarcia"><img src="https://img.shields.io/twitter/follow/rfgarcia" alt="Follow @rfgarcia"></a>
|
|
@@ -103,7 +103,7 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
|
|
|
103
103
|
- `kernel logout` - Clear stored credentials
|
|
104
104
|
- `kernel auth` - Check authentication status
|
|
105
105
|
|
|
106
|
-
### App
|
|
106
|
+
### App Deployment
|
|
107
107
|
|
|
108
108
|
- `kernel deploy <file>` - Deploy an app to Kernel
|
|
109
109
|
- `--version <version>` - Specify app version (default: latest)
|
|
@@ -111,12 +111,24 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
|
|
|
111
111
|
- `--env <KEY=VALUE>`, `-e` - Set environment variables (can be used multiple times)
|
|
112
112
|
- `--env-file <file>` - Load environment variables from file (can be used multiple times)
|
|
113
113
|
|
|
114
|
+
- `kernel deploy logs <deployment_id>` - Stream logs for a deployment
|
|
115
|
+
- `--follow`, `-f` - Follow logs in real-time (stream continuously)
|
|
116
|
+
- `--since`, `-s` - How far back to retrieve logs. Duration formats: ns, us, ms, s, m, h (e.g., 5m, 2h, 1h30m). Timestamps also supported: 2006-01-02, 2006-01-02T15:04, 2006-01-02T15:04:05, 2006-01-02T15:04:05.000
|
|
117
|
+
- `--with-timestamps`, `-t` - Include timestamps in each log line
|
|
118
|
+
|
|
119
|
+
- `kernel deploy history [app_name]` - Show deployment history
|
|
120
|
+
- `--all` - Show deployment history for all applications
|
|
121
|
+
|
|
122
|
+
### App Management
|
|
123
|
+
|
|
114
124
|
- `kernel invoke <app> <action>` - Run an app action
|
|
125
|
+
|
|
115
126
|
- `--version <version>`, `-v` - Specify app version (default: latest)
|
|
116
127
|
- `--payload <json>`, `-p` - JSON payload for the action
|
|
117
128
|
- `--sync`, `-s` - Invoke synchronously (timeout after 60s)
|
|
118
129
|
|
|
119
130
|
- `kernel app list` - List deployed apps
|
|
131
|
+
|
|
120
132
|
- `--name <app_name>` - Filter by app name
|
|
121
133
|
- `--version <version>` - Filter by version
|
|
122
134
|
|
|
@@ -141,6 +153,86 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
|
|
|
141
153
|
- `-y, --yes` - Skip confirmation prompt
|
|
142
154
|
- `kernel browsers view <id or persistent id>` - Get live view URL for a browser
|
|
143
155
|
|
|
156
|
+
### Browser Logs
|
|
157
|
+
|
|
158
|
+
- `kernel browsers logs stream <id or persistent id>` - Stream browser logs
|
|
159
|
+
- `--source <source>` - Log source: "path" or "supervisor" (required)
|
|
160
|
+
- `--follow` - Follow the log stream (default: true)
|
|
161
|
+
- `--path <path>` - File path when source=path
|
|
162
|
+
- `--supervisor-process <name>` - Supervisor process name when source=supervisor. Most useful value is "chromium"
|
|
163
|
+
|
|
164
|
+
### Browser Replays
|
|
165
|
+
|
|
166
|
+
- `kernel browsers replays list <id or persistent id>` - List replays for a browser
|
|
167
|
+
- `kernel browsers replays start <id or persistent id>` - Start a replay recording
|
|
168
|
+
- `--framerate <fps>` - Recording framerate (fps)
|
|
169
|
+
- `--max-duration <seconds>` - Maximum duration in seconds
|
|
170
|
+
- `kernel browsers replays stop <id or persistent id> <replay-id>` - Stop a replay recording
|
|
171
|
+
- `kernel browsers replays download <id or persistent id> <replay-id>` - Download a replay video
|
|
172
|
+
- `-o, --output <path>` - Output file path for the replay video
|
|
173
|
+
|
|
174
|
+
### Browser Process Control
|
|
175
|
+
|
|
176
|
+
- `kernel browsers process exec <id or persistent id> [--] [command...]` - Execute a command synchronously
|
|
177
|
+
- `--command <cmd>` - Command to execute (optional; if omitted, trailing args are executed via /bin/bash -c)
|
|
178
|
+
- `--args <args>` - Command arguments
|
|
179
|
+
- `--cwd <path>` - Working directory
|
|
180
|
+
- `--timeout <seconds>` - Timeout in seconds
|
|
181
|
+
- `--as-user <user>` - Run as user
|
|
182
|
+
- `--as-root` - Run as root
|
|
183
|
+
- `kernel browsers process spawn <id or persistent id> [--] [command...]` - Execute a command asynchronously
|
|
184
|
+
- `--command <cmd>` - Command to execute (optional; if omitted, trailing args are executed via /bin/bash -c)
|
|
185
|
+
- `--args <args>` - Command arguments
|
|
186
|
+
- `--cwd <path>` - Working directory
|
|
187
|
+
- `--timeout <seconds>` - Timeout in seconds
|
|
188
|
+
- `--as-user <user>` - Run as user
|
|
189
|
+
- `--as-root` - Run as root
|
|
190
|
+
- `kernel browsers process kill <id or persistent id> <process-id>` - Send a signal to a process
|
|
191
|
+
- `--signal <signal>` - Signal to send: TERM, KILL, INT, HUP (default: TERM)
|
|
192
|
+
- `kernel browsers process status <id or persistent id> <process-id>` - Get process status
|
|
193
|
+
- `kernel browsers process stdin <id or persistent id> <process-id>` - Write to process stdin (base64)
|
|
194
|
+
- `--data-b64 <data>` - Base64-encoded data to write to stdin (required)
|
|
195
|
+
- `kernel browsers process stdout-stream <id or persistent id> <process-id>` - Stream process stdout/stderr
|
|
196
|
+
|
|
197
|
+
### Browser Filesystem
|
|
198
|
+
|
|
199
|
+
- `kernel browsers fs new-directory <id or persistent id>` - Create a new directory
|
|
200
|
+
- `--path <path>` - Absolute directory path to create (required)
|
|
201
|
+
- `--mode <mode>` - Directory mode (octal string)
|
|
202
|
+
- `kernel browsers fs delete-directory <id or persistent id>` - Delete a directory
|
|
203
|
+
- `--path <path>` - Absolute directory path to delete (required)
|
|
204
|
+
- `kernel browsers fs delete-file <id or persistent id>` - Delete a file
|
|
205
|
+
- `--path <path>` - Absolute file path to delete (required)
|
|
206
|
+
- `kernel browsers fs download-dir-zip <id or persistent id>` - Download a directory as zip
|
|
207
|
+
- `--path <path>` - Absolute directory path to download (required)
|
|
208
|
+
- `-o, --output <path>` - Output zip file path
|
|
209
|
+
- `kernel browsers fs file-info <id or persistent id>` - Get file or directory info
|
|
210
|
+
- `--path <path>` - Absolute file or directory path (required)
|
|
211
|
+
- `kernel browsers fs list-files <id or persistent id>` - List files in a directory
|
|
212
|
+
- `--path <path>` - Absolute directory path (required)
|
|
213
|
+
- `kernel browsers fs move <id or persistent id>` - Move or rename a file or directory
|
|
214
|
+
- `--src <path>` - Absolute source path (required)
|
|
215
|
+
- `--dest <path>` - Absolute destination path (required)
|
|
216
|
+
- `kernel browsers fs read-file <id or persistent id>` - Read a file
|
|
217
|
+
- `--path <path>` - Absolute file path (required)
|
|
218
|
+
- `-o, --output <path>` - Output file path (optional)
|
|
219
|
+
- `kernel browsers fs set-permissions <id or persistent id>` - Set file permissions or ownership
|
|
220
|
+
- `--path <path>` - Absolute path (required)
|
|
221
|
+
- `--mode <mode>` - File mode bits (octal string) (required)
|
|
222
|
+
- `--owner <user>` - New owner username or UID
|
|
223
|
+
- `--group <group>` - New group name or GID
|
|
224
|
+
- `kernel browsers fs upload <id or persistent id>` - Upload one or more files
|
|
225
|
+
- `--file <local:remote>` - Mapping local:remote (repeatable)
|
|
226
|
+
- `--dest-dir <path>` - Destination directory for uploads
|
|
227
|
+
- `--paths <paths>` - Local file paths to upload
|
|
228
|
+
- `kernel browsers fs upload-zip <id or persistent id>` - Upload a zip and extract it
|
|
229
|
+
- `--zip <path>` - Local zip file path (required)
|
|
230
|
+
- `--dest-dir <path>` - Destination directory to extract to (required)
|
|
231
|
+
- `kernel browsers fs write-file <id or persistent id>` - Write a file from local data
|
|
232
|
+
- `--path <path>` - Destination absolute file path (required)
|
|
233
|
+
- `--mode <mode>` - File mode (octal string)
|
|
234
|
+
- `--source <path>` - Local source file path (required)
|
|
235
|
+
|
|
144
236
|
## Examples
|
|
145
237
|
|
|
146
238
|
### Deploy with environment variables
|
|
@@ -199,6 +291,21 @@ kernel browsers delete --by-persistent-id my-browser-session --yes
|
|
|
199
291
|
|
|
200
292
|
# Get live view URL
|
|
201
293
|
kernel browsers view --by-id browser123
|
|
294
|
+
|
|
295
|
+
# Stream browser logs
|
|
296
|
+
kernel browsers logs stream my-browser --source supervisor --follow --supervisor-process chromium
|
|
297
|
+
|
|
298
|
+
# Start a replay recording
|
|
299
|
+
kernel browsers replays start my-browser --framerate 30 --max-duration 300
|
|
300
|
+
|
|
301
|
+
# Execute a command in the browser VM
|
|
302
|
+
kernel browsers process exec my-browser -- ls -alh /tmp
|
|
303
|
+
|
|
304
|
+
# Upload files to the browser VM
|
|
305
|
+
kernel browsers fs upload my-browser --file "local.txt:remote.txt" --dest-dir "/tmp"
|
|
306
|
+
|
|
307
|
+
# List files in a directory
|
|
308
|
+
kernel browsers fs list-files my-browser --path "/tmp"
|
|
202
309
|
```
|
|
203
310
|
|
|
204
311
|
## Getting Help
|
package/lib.js
CHANGED
|
@@ -19,31 +19,61 @@ const getArchive = () => {
|
|
|
19
19
|
|
|
20
20
|
const binDir = path.join(__dirname, "bin");
|
|
21
21
|
|
|
22
|
-
async function extractTar(tarPath, binaries, dir) {
|
|
22
|
+
async function extractTar(tarPath, binaries, dir, wrappedIn) {
|
|
23
23
|
try {
|
|
24
|
+
const filesToExtract = wrappedIn
|
|
25
|
+
? binaries.map((bin) =>
|
|
26
|
+
path.join(wrappedIn, bin).replace(/\\/g, "/"),
|
|
27
|
+
)
|
|
28
|
+
: binaries;
|
|
29
|
+
|
|
24
30
|
await tar.x({
|
|
25
31
|
file: tarPath,
|
|
26
32
|
cwd: dir,
|
|
27
|
-
filter: (path) =>
|
|
33
|
+
filter: (path) => filesToExtract.includes(path),
|
|
28
34
|
});
|
|
29
|
-
|
|
35
|
+
|
|
36
|
+
// If wrapped, move files from wrapped directory to bin directory
|
|
37
|
+
if (wrappedIn) {
|
|
38
|
+
const wrappedDir = path.join(dir, wrappedIn);
|
|
39
|
+
for (const binary of binaries) {
|
|
40
|
+
const srcPath = path.join(wrappedDir, binary);
|
|
41
|
+
const destPath = path.join(dir, binary);
|
|
42
|
+
if (fs.existsSync(srcPath)) {
|
|
43
|
+
fs.renameSync(srcPath, destPath);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// Clean up empty wrapped directory
|
|
47
|
+
try {
|
|
48
|
+
fs.rmSync(wrappedDir, { recursive: true, force: true });
|
|
49
|
+
} catch (err) {
|
|
50
|
+
// Ignore cleanup errors
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
console.log(`Successfully extracted ${binaries} to "${dir}"`);
|
|
30
55
|
} catch (err) {
|
|
31
56
|
throw new Error(`Extraction failed: ${err.message}`);
|
|
32
57
|
}
|
|
33
58
|
}
|
|
34
59
|
|
|
35
|
-
async function extractZip(zipPath, binaries, dir) {
|
|
60
|
+
async function extractZip(zipPath, binaries, dir, wrappedIn) {
|
|
36
61
|
try {
|
|
37
62
|
const zipData = fs.readFileSync(zipPath);
|
|
38
63
|
const zip = await JSZip.loadAsync(zipData);
|
|
64
|
+
|
|
39
65
|
for (const binary of binaries) {
|
|
40
|
-
|
|
66
|
+
const binaryPath = wrappedIn
|
|
67
|
+
? path.join(wrappedIn, binary).replace(/\\/g, "/")
|
|
68
|
+
: binary;
|
|
69
|
+
|
|
70
|
+
if (!zip.files[binaryPath]) {
|
|
41
71
|
throw new Error(
|
|
42
|
-
`Error: ${
|
|
72
|
+
`Error: ${binaryPath} does not exist in ${zipPath}`,
|
|
43
73
|
);
|
|
44
74
|
}
|
|
45
75
|
|
|
46
|
-
const content = await zip.files[
|
|
76
|
+
const content = await zip.files[binaryPath].async("nodebuffer");
|
|
47
77
|
if (!fs.existsSync(dir)) {
|
|
48
78
|
fs.mkdirSync(dir, { recursive: true });
|
|
49
79
|
}
|
|
@@ -94,11 +124,21 @@ const install = async () => {
|
|
|
94
124
|
fs.chmodSync(bin, 0o755);
|
|
95
125
|
return;
|
|
96
126
|
case "zip":
|
|
97
|
-
return extractZip(
|
|
127
|
+
return extractZip(
|
|
128
|
+
archivePath,
|
|
129
|
+
archive.bins,
|
|
130
|
+
binDir,
|
|
131
|
+
archive.wrappedIn,
|
|
132
|
+
);
|
|
98
133
|
case "tar":
|
|
99
134
|
case "tar.gz":
|
|
100
135
|
case "tgz":
|
|
101
|
-
return extractTar(
|
|
136
|
+
return extractTar(
|
|
137
|
+
archivePath,
|
|
138
|
+
archive.bins,
|
|
139
|
+
binDir,
|
|
140
|
+
archive.wrappedIn,
|
|
141
|
+
);
|
|
102
142
|
case "tar.zst":
|
|
103
143
|
case "tzst":
|
|
104
144
|
case "tar.xz":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onkernel/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Kernel CLI",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"postinstall": "node install.js",
|
|
@@ -33,75 +33,75 @@
|
|
|
33
33
|
},
|
|
34
34
|
"archives": {
|
|
35
35
|
"darwin-arm64": {
|
|
36
|
-
"name": "kernel_0.
|
|
37
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.
|
|
36
|
+
"name": "kernel_0.6.0_darwin_arm64.tar.gz",
|
|
37
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.6.0/kernel_0.6.0_darwin_arm64.tar.gz",
|
|
38
38
|
"bins": [
|
|
39
39
|
"kernel"
|
|
40
40
|
],
|
|
41
41
|
"format": "tar.gz",
|
|
42
42
|
"checksum": {
|
|
43
43
|
"algorithm": "sha256",
|
|
44
|
-
"digest": "
|
|
44
|
+
"digest": "92fd44acffaac6000acd964fd587f9c8b616076e9641ff1c6fa242f1cdd573a2"
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"darwin-x64": {
|
|
48
|
-
"name": "kernel_0.
|
|
49
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.
|
|
48
|
+
"name": "kernel_0.6.0_darwin_amd64.tar.gz",
|
|
49
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.6.0/kernel_0.6.0_darwin_amd64.tar.gz",
|
|
50
50
|
"bins": [
|
|
51
51
|
"kernel"
|
|
52
52
|
],
|
|
53
53
|
"format": "tar.gz",
|
|
54
54
|
"checksum": {
|
|
55
55
|
"algorithm": "sha256",
|
|
56
|
-
"digest": "
|
|
56
|
+
"digest": "1478a1bd0c66a4e1cabfd65c8aa4a5bb6ba3301d40603408e79a5b2d130f873e"
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
"linux-arm64": {
|
|
60
|
-
"name": "kernel_0.
|
|
61
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.
|
|
60
|
+
"name": "kernel_0.6.0_linux_arm64.tar.gz",
|
|
61
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.6.0/kernel_0.6.0_linux_arm64.tar.gz",
|
|
62
62
|
"bins": [
|
|
63
63
|
"kernel"
|
|
64
64
|
],
|
|
65
65
|
"format": "tar.gz",
|
|
66
66
|
"checksum": {
|
|
67
67
|
"algorithm": "sha256",
|
|
68
|
-
"digest": "
|
|
68
|
+
"digest": "5c6a5068fa20ac165c5d2b3b783a256c90bc02c5097dd37ce05ceb3505033beb"
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"linux-x64": {
|
|
72
|
-
"name": "kernel_0.
|
|
73
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.
|
|
72
|
+
"name": "kernel_0.6.0_linux_amd64.tar.gz",
|
|
73
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.6.0/kernel_0.6.0_linux_amd64.tar.gz",
|
|
74
74
|
"bins": [
|
|
75
75
|
"kernel"
|
|
76
76
|
],
|
|
77
77
|
"format": "tar.gz",
|
|
78
78
|
"checksum": {
|
|
79
79
|
"algorithm": "sha256",
|
|
80
|
-
"digest": "
|
|
80
|
+
"digest": "136d712be04e2f783360bf7aa3a0a627f87e59425dcf7865642d10acb88eea0d"
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
"win32-arm64": {
|
|
84
|
-
"name": "kernel_0.
|
|
85
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.
|
|
84
|
+
"name": "kernel_0.6.0_windows_arm64.tar.gz",
|
|
85
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.6.0/kernel_0.6.0_windows_arm64.tar.gz",
|
|
86
86
|
"bins": [
|
|
87
87
|
"kernel.exe"
|
|
88
88
|
],
|
|
89
89
|
"format": "tar.gz",
|
|
90
90
|
"checksum": {
|
|
91
91
|
"algorithm": "sha256",
|
|
92
|
-
"digest": "
|
|
92
|
+
"digest": "d794c290fd1c46f18e421239eb5eaf226b78e238536f9aa4ec66198f2f5ec316"
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
95
|
"win32-x64": {
|
|
96
|
-
"name": "kernel_0.
|
|
97
|
-
"url": "https://github.com/onkernel/cli/releases/download/v0.
|
|
96
|
+
"name": "kernel_0.6.0_windows_amd64.tar.gz",
|
|
97
|
+
"url": "https://github.com/onkernel/cli/releases/download/v0.6.0/kernel_0.6.0_windows_amd64.tar.gz",
|
|
98
98
|
"bins": [
|
|
99
99
|
"kernel.exe"
|
|
100
100
|
],
|
|
101
101
|
"format": "tar.gz",
|
|
102
102
|
"checksum": {
|
|
103
103
|
"algorithm": "sha256",
|
|
104
|
-
"digest": "
|
|
104
|
+
"digest": "c8e1bee8b0cd7228eab4c0f1276e52f3dee1d95a5f7772b720b76c72f162bd18"
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
}
|