Skip to content

Commit 81967dc

Browse files
authored
Merge pull request #4 from onkernel/raf/kernel-229-feature-request-api-to-save-browser-contexts-new-image-apis
add process, replays, more fs commands
2 parents e0a67ee + 24c78c1 commit 81967dc

22 files changed

+2417
-171
lines changed

README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,20 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
106106
### App Management
107107

108108
- `kernel deploy <file>` - Deploy an app to Kernel
109+
109110
- `--version <version>` - Specify app version (default: latest)
110111
- `--force` - Allow overwriting existing version
111112
- `--env <KEY=VALUE>`, `-e` - Set environment variables (can be used multiple times)
112113
- `--env-file <file>` - Load environment variables from file (can be used multiple times)
113114

114115
- `kernel invoke <app> <action>` - Run an app action
116+
115117
- `--version <version>`, `-v` - Specify app version (default: latest)
116118
- `--payload <json>`, `-p` - JSON payload for the action
117119
- `--sync`, `-s` - Invoke synchronously (timeout after 60s)
118120

119121
- `kernel app list` - List deployed apps
122+
120123
- `--name <app_name>` - Filter by app name
121124
- `--version <version>` - Filter by version
122125

@@ -141,6 +144,86 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
141144
- `-y, --yes` - Skip confirmation prompt
142145
- `kernel browsers view <id or persistent id>` - Get live view URL for a browser
143146

147+
### Browser Logs
148+
149+
- `kernel browsers logs stream <id or persistent id>` - Stream browser logs
150+
- `--source <source>` - Log source: "path" or "supervisor" (required)
151+
- `--follow` - Follow the log stream (default: true)
152+
- `--path <path>` - File path when source=path
153+
- `--supervisor-process <name>` - Supervisor process name when source=supervisor. Most useful value is "chromium"
154+
155+
### Browser Replays
156+
157+
- `kernel browsers replays list <id or persistent id>` - List replays for a browser
158+
- `kernel browsers replays start <id or persistent id>` - Start a replay recording
159+
- `--framerate <fps>` - Recording framerate (fps)
160+
- `--max-duration <seconds>` - Maximum duration in seconds
161+
- `kernel browsers replays stop <id or persistent id> <replay-id>` - Stop a replay recording
162+
- `kernel browsers replays download <id or persistent id> <replay-id>` - Download a replay video
163+
- `-o, --output <path>` - Output file path for the replay video
164+
165+
### Browser Process Control
166+
167+
- `kernel browsers process exec <id or persistent id> [--] [command...]` - Execute a command synchronously
168+
- `--command <cmd>` - Command to execute (optional; if omitted, trailing args are executed via /bin/bash -c)
169+
- `--args <args>` - Command arguments
170+
- `--cwd <path>` - Working directory
171+
- `--timeout <seconds>` - Timeout in seconds
172+
- `--as-user <user>` - Run as user
173+
- `--as-root` - Run as root
174+
- `kernel browsers process spawn <id or persistent id> [--] [command...]` - Execute a command asynchronously
175+
- `--command <cmd>` - Command to execute (optional; if omitted, trailing args are executed via /bin/bash -c)
176+
- `--args <args>` - Command arguments
177+
- `--cwd <path>` - Working directory
178+
- `--timeout <seconds>` - Timeout in seconds
179+
- `--as-user <user>` - Run as user
180+
- `--as-root` - Run as root
181+
- `kernel browsers process kill <id or persistent id> <process-id>` - Send a signal to a process
182+
- `--signal <signal>` - Signal to send: TERM, KILL, INT, HUP (default: TERM)
183+
- `kernel browsers process status <id or persistent id> <process-id>` - Get process status
184+
- `kernel browsers process stdin <id or persistent id> <process-id>` - Write to process stdin (base64)
185+
- `--data-b64 <data>` - Base64-encoded data to write to stdin (required)
186+
- `kernel browsers process stdout-stream <id or persistent id> <process-id>` - Stream process stdout/stderr
187+
188+
### Browser Filesystem
189+
190+
- `kernel browsers fs new-directory <id or persistent id>` - Create a new directory
191+
- `--path <path>` - Absolute directory path to create (required)
192+
- `--mode <mode>` - Directory mode (octal string)
193+
- `kernel browsers fs delete-directory <id or persistent id>` - Delete a directory
194+
- `--path <path>` - Absolute directory path to delete (required)
195+
- `kernel browsers fs delete-file <id or persistent id>` - Delete a file
196+
- `--path <path>` - Absolute file path to delete (required)
197+
- `kernel browsers fs download-dir-zip <id or persistent id>` - Download a directory as zip
198+
- `--path <path>` - Absolute directory path to download (required)
199+
- `-o, --output <path>` - Output zip file path
200+
- `kernel browsers fs file-info <id or persistent id>` - Get file or directory info
201+
- `--path <path>` - Absolute file or directory path (required)
202+
- `kernel browsers fs list-files <id or persistent id>` - List files in a directory
203+
- `--path <path>` - Absolute directory path (required)
204+
- `kernel browsers fs move <id or persistent id>` - Move or rename a file or directory
205+
- `--src <path>` - Absolute source path (required)
206+
- `--dest <path>` - Absolute destination path (required)
207+
- `kernel browsers fs read-file <id or persistent id>` - Read a file
208+
- `--path <path>` - Absolute file path (required)
209+
- `-o, --output <path>` - Output file path (optional)
210+
- `kernel browsers fs set-permissions <id or persistent id>` - Set file permissions or ownership
211+
- `--path <path>` - Absolute path (required)
212+
- `--mode <mode>` - File mode bits (octal string) (required)
213+
- `--owner <user>` - New owner username or UID
214+
- `--group <group>` - New group name or GID
215+
- `kernel browsers fs upload <id or persistent id>` - Upload one or more files
216+
- `--file <local:remote>` - Mapping local:remote (repeatable)
217+
- `--dest-dir <path>` - Destination directory for uploads
218+
- `--paths <paths>` - Local file paths to upload
219+
- `kernel browsers fs upload-zip <id or persistent id>` - Upload a zip and extract it
220+
- `--zip <path>` - Local zip file path (required)
221+
- `--dest-dir <path>` - Destination directory to extract to (required)
222+
- `kernel browsers fs write-file <id or persistent id>` - Write a file from local data
223+
- `--path <path>` - Destination absolute file path (required)
224+
- `--mode <mode>` - File mode (octal string)
225+
- `--source <path>` - Local source file path (required)
226+
144227
## Examples
145228

146229
### Deploy with environment variables
@@ -199,6 +282,21 @@ kernel browsers delete --by-persistent-id my-browser-session --yes
199282

200283
# Get live view URL
201284
kernel browsers view --by-id browser123
285+
286+
# Stream browser logs
287+
kernel browsers logs stream my-browser --source supervisor --follow --supervisor-process chromium
288+
289+
# Start a replay recording
290+
kernel browsers replays start my-browser --framerate 30 --max-duration 300
291+
292+
# Execute a command in the browser VM
293+
kernel browsers process exec my-browser -- ls -alh /tmp
294+
295+
# Upload files to the browser VM
296+
kernel browsers fs upload my-browser --file "local.txt:remote.txt" --dest-dir "/tmp"
297+
298+
# List files in a directory
299+
kernel browsers fs list-files my-browser --path "/tmp"
202300
```
203301

204302
## Getting Help

cmd/app.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func runAppList(cmd *cobra.Command, args []string) error {
102102
})
103103
}
104104

105-
pterm.DefaultTable.WithHasHeader().WithData(tableData).Render()
105+
printTableNoPad(tableData, true)
106106
return nil
107107
}
108108

@@ -146,6 +146,6 @@ func runAppHistory(cmd *cobra.Command, args []string) error {
146146
})
147147
}
148148

149-
pterm.DefaultTable.WithHasHeader().WithData(tableData).Render()
149+
printTableNoPad(tableData, true)
150150
return nil
151151
}

0 commit comments

Comments
 (0)