@runalabs/rill-cli 0.1.3 → 0.1.4

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.
Files changed (3) hide show
  1. package/README.md +225 -16
  2. package/dist/cli.js +33 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,32 +1,241 @@
1
1
  # @runalabs/rill-cli
2
2
 
3
- Record, inspect, and share agent-controlled browser runs with Rill.
3
+ Record a browser flow, keep its video and runtime evidence together, and return an inspectable share link. Use Rill to reproduce a bug, verify a change, or hand a browser run to another developer or agent.
4
4
 
5
- After `rill record stop`, compatible agent hosts may receive `feedbackRequested: true`. They can submit a short Rill product review with `rill feedback submit <recording-id>`. Use `rill record stop <recording-id> --no-feedback` to opt out for one run.
5
+ Rill starts a local Chromium recorder. Your browser tool drives the returned CDP endpoint; Rill captures the selected page and uploads the result when you stop.
6
6
 
7
- ## Install
7
+ [Getting started](https://userill.dev/docs) · [Website CLI reference](https://userill.dev/docs/cli) · [Agent instructions](https://userill.dev/docs/cli#agents)
8
+
9
+ ## Install and verify
10
+
11
+ Browser recording runs on macOS and Linux. Install Node.js 22+, Google Chrome or Chromium, and ffmpeg on `PATH`.
8
12
 
9
13
  ```sh
10
- npm install --global @runalabs/rill-cli@0.1.3
11
- rill doctor
14
+ # macOS
15
+ brew install ffmpeg
16
+ # Debian / Ubuntu
17
+ sudo apt install ffmpeg
12
18
  ```
13
19
 
14
- Rill requires Node.js 22 or newer, Google Chrome or Chromium, and `ffmpeg`.
15
-
16
- ## Record
20
+ Then install the scoped package:
17
21
 
18
22
  ```sh
23
+ npm install --global @runalabs/rill-cli
24
+ rill --version
19
25
  rill login
20
26
  rill doctor
21
- rill record start --url https://example.com --title "Agent reproduction"
22
- # Connect browser automation to the returned cdpUrl.
27
+ ```
28
+
29
+ Do not use `npx rill`: the unscoped package belongs to a different product. Doctor checks Node, API reachability, CLI compatibility, authentication, Chrome, and ffmpeg. Resolve failed checks before starting a run.
30
+
31
+ ## Authenticate
32
+
33
+ ### Interactive login
34
+
35
+ `rill login` prints a verification URL and device code. Open the URL, sign in, and approve the request. The CLI waits for approval and stores the credential in macOS Keychain or Linux Secret Service using `secret-tool`. Linux needs an available Secret Service keyring; use token authentication on headless machines without one.
36
+
37
+ ### CI and unattended agents
38
+
39
+ Create a scoped, expiring agent credential in Rill Settings. Inject it as `RILL_TOKEN` through your environment's secret manager, then run `rill doctor`. This token takes precedence over the OS keychain. Do not put real tokens in source files or command examples.
40
+
41
+ The default API is `https://userill.dev`. `RILL_API_URL` changes it; the global `--api-url <url>` flag takes precedence. Login stores credentials per API URL. Manage and revoke credentials in Settings.
42
+
43
+ ## First recording
44
+
45
+ ```sh
46
+ rill record start --url https://example.com --title "Checkout verification"
47
+ # Save recordingId and connect your browser tool to the returned cdpUrl.
48
+ # Perform the flow in the existing recorded page.
23
49
  rill record stop <recording-id>
50
+ rill inspect https://userill.dev/s/<share-secret>
51
+ ```
52
+
53
+ Start returns `recordingId`, `cdpUrl`, `status`, `bodyCaptureEnabled`, and `maxDurationSeconds`. Stop finalizes capture, uploads video and diagnostics, and waits for playback. Confirm `status: "ready"` and a non-null `shareUrl` before returning the evidence link. Local capture finishing does not establish remote readiness.
54
+
55
+ ### Connect Playwright
56
+
57
+ In a project with `playwright-core` installed, save this as `rill-run.mjs`:
58
+
59
+ ```js
60
+ import { chromium } from 'playwright-core';
61
+
62
+ const browser = await chromium.connectOverCDP(process.argv[2]);
63
+ try {
64
+ const page = browser.contexts()[0].pages()[0];
65
+ if (!page) throw new Error('The recorded page is unavailable.');
66
+ await page.waitForLoadState('domcontentloaded');
67
+ // Add your flow and assertions here, using this page.
68
+ console.log(await page.title());
69
+ } finally {
70
+ // Disconnect this client; let rill record stop finalize the recording.
71
+ await browser.close();
72
+ }
73
+ ```
74
+
75
+ Run `node rill-run.mjs "<cdpUrl>"` with the exact endpoint from start. Then run `rill record stop <recording-id>`, including when your verification fails. A page title alone does not verify your app's behavior.
76
+
77
+ Capture follows the first page selected at recording start. Keep the flow in that page: new tabs and popups do not receive complete video and diagnostic coverage. Keep the recorded page open until Rill stops.
78
+
79
+ ### Recording options
80
+
81
+ | Option | Behavior |
82
+ | --- | --- |
83
+ | `--url <url>` | Open the target in a managed browser. |
84
+ | `--title <title>` | Name the run; defaults to a timestamped title. |
85
+ | `--description <text>` | Describe what the run demonstrates. |
86
+ | `--headed` | Show the managed browser; default is headless. |
87
+ | `--cdp-url <url>` | Attach to an existing Chromium browser and record its first open page. Navigate that page with your browser tool. |
88
+ | `--width <pixels>` / `--height <pixels>` | Managed viewport; defaults to 1280 × 720. |
89
+ | `--max-duration <seconds>` | Automatically finalize local capture; defaults to 600. Still call `record stop` to upload. |
90
+
91
+ Rill closes browsers it launches during finalization. Attached browsers remain open.
92
+
93
+ ## Set up a coding agent
94
+
95
+ Install and authenticate the CLI where the agent runs. No separate skill installation is required. Optionally save the following workflow in your agent's project instructions or skill setup; it is also available in the [public agent instructions](https://userill.dev/docs/cli#agents):
96
+
97
+ 1. Run `rill doctor` and resolve failed checks.
98
+ 2. Start a run titled with the claim to verify.
99
+ 3. Preserve `recordingId`; connect to `cdpUrl` using a browser tool that supports CDP.
100
+ 4. Perform the authorized flow in the existing recorded page.
101
+ 5. Stop the same recording and wait for readiness.
102
+ 6. Inspect the returned share URL.
103
+ 7. Return the link with what passed, failed, or could not be verified.
104
+
105
+ For a bug fix, record the reproduction and verification as separate runs. Attach the ready link to the handoff or pull request.
106
+
107
+ ## Inspect a shared run
108
+
109
+ ```sh
110
+ rill inspect https://userill.dev/s/<share-secret>
111
+ rill inspect https://userill.dev/s/<share-secret> > context.json
112
+ ```
113
+
114
+ Inspect returns bounded JSON context for another agent without requiring login. Browser recordings carry video and synchronized console messages, exceptions, network metadata, navigation, and interaction events. Treat this as bounded evidence, not a guarantee of complete capture. Use the share page to watch the run and examine its diagnostics.
115
+
116
+ An active share URL is required. Expired, replaced, revoked, or deleted shares cannot be inspected; ask the owner for a current link.
117
+
118
+ ## Upload an existing video
119
+
120
+ ```sh
121
+ rill upload ./test-results/checkout.webm --title "Checkout test"
122
+ ```
123
+
124
+ Upload WebM or MP4 evidence. The command waits for readiness and returns the recording ID and share URL. Existing uploads report `diagnosticsAvailable: false`; they do not import Playwright traces or reconstruct diagnostic events.
125
+
126
+ Both `upload` and `record stop` accept `--no-wait`. This still waits for upload but skips playback processing: the result is `status: "processing"` with `shareUrl: null`. Check the recording in the dashboard before sharing.
127
+
128
+ ## Command reference
129
+
130
+ Use `rill --help` or `<command> --help` for supported flags.
131
+
132
+ | Command | Behavior |
133
+ | --- | --- |
134
+ | `rill login` | Authorize a device code and store a credential. |
135
+ | `rill doctor` | Check prerequisites, API compatibility, and authentication. |
136
+ | `rill record start [options]` | Start a managed or attached browser recording. |
137
+ | `rill record stop <recording-id>` | Finalize and upload; supports `--no-wait` and `--no-feedback`. |
138
+ | `rill record status <recording-id>` | Read local state, falling back to remote state if the local session is unavailable. |
139
+ | `rill record cancel <recording-id>` | Abandon a run created by this credential and release its remote quota reservation. |
140
+ | `rill upload <video-file>` | Upload video-only evidence; supports `--title` and `--no-wait`. |
141
+ | `rill inspect <share-url>` | Read bounded context without login. |
142
+ | `rill drafts list` | List directory names under the local draft root. |
143
+ | `rill drafts purge` | Delete draft directories last modified more than 24 hours ago. |
144
+ | `rill feedback submit <recording-id>` | Submit optional Rill-specific feedback. |
145
+
146
+ ## Output and errors
147
+
148
+ Data commands emit JSON on stdout and human progress on stderr. Use global `--pretty` for indented JSON. Help and version commands print plain text.
149
+
150
+ ```sh
151
+ rill --pretty record status <recording-id>
24
152
  ```
25
153
 
26
- If the local recorder is unavailable, `rill record status <recording-id>` falls
27
- back to the control plane. Use `rill record cancel <recording-id>` to abandon an
28
- active recording and release its quota reservation. A failed local startup
29
- automatically cancels the reservation it just created.
154
+ Selected fields from a successful stop result:
155
+
156
+ ```json
157
+ {
158
+ "schemaVersion": 1,
159
+ "recordingId": "<recording-id>",
160
+ "status": "ready",
161
+ "shareUrl": "https://userill.dev/s/<share-secret>"
162
+ }
163
+ ```
164
+
165
+ Stop also returns duration, stop reason, diagnostic summary, and feedback instructions when applicable.
166
+
167
+ Success exits 0; command failures exit 1. Runtime failures emit an `error` object on stdout containing `code`, `message`, and optional `recovery` and `details`. Argument parsing failures may print plain text to stderr. Doctor exits 1 with its JSON check report when a check fails.
168
+
169
+ Check the exit status first, then structured fields. Known codes include `authentication_required`, `scope_denied`, `quota_exceeded`, `browser_unavailable`, `recording_not_found`, `upload_interrupted`, `processing_failed`, `share_revoked`, `validation_failed`, and the fallback `internal_error`. Not every failure has a specific code; avoid branching on message text.
170
+
171
+ ## Recovery and troubleshooting
172
+
173
+ - **Doctor fails:** read the failed check's recovery field. Correct the credential, API connectivity, or executable path before recording.
174
+ - **Quota exceeded:** inspect `error.details.quota.type` and `blockingRecordingId` when present. Check the blocking recording; cancel only an abandoned run. Review storage and daily allowance in Billing.
175
+ - **Upload interrupted or processing timed out:** keep the recording ID and local artifacts. Check the dashboard for remote readiness. `record status` prefers local state and can report local `ready` without a share URL; this does not prove remote playback readiness.
176
+ - **Duration limit reached:** local capture finalizes automatically, but `record stop` is still needed to upload.
177
+ - **Local session missing:** `record status` falls back to remote state. `drafts list` locates local directories, which may be incomplete. There is no `drafts resume` command.
178
+ - **Share cannot be inspected:** open the complete URL in a browser; ask the owner for a current link if needed.
179
+
180
+ A failed local startup automatically attempts to cancel the remote reservation it just created. `record cancel` changes remote state and does not stop the local browser; finish local capture before abandoning the remote reservation.
181
+
182
+ When finalized artifacts survive, retain `recording.webm` and `diagnostics-v1.ndjson.gz` in the recording's draft directory. `rill upload <path-to-recording.webm>` is a video-only fallback: it creates a new recording and does not restore the original diagnostics. Successful stop with readiness removes that run's local artifact directory.
183
+
184
+ `drafts purge` deletes local draft directories older than 24 hours by modification time, without a confirmation prompt. Recover needed evidence before purging.
185
+
186
+ ## Environment variables
187
+
188
+ | Variable | Purpose |
189
+ | --- | --- |
190
+ | `RILL_TOKEN` | Agent credential; overrides the keychain. |
191
+ | `RILL_API_URL` | API origin; defaults to `https://userill.dev`. Global `--api-url` takes precedence. |
192
+ | `RILL_CHROME_PATH` | Chrome or Chromium executable path. |
193
+ | `RILL_FFMPEG` | ffmpeg executable; defaults to `ffmpeg` on `PATH`. |
194
+ | `RILL_HOME` | Recorder state directory; defaults to `~/.rill`. |
195
+ | `RILL_SOCKET` | Recorder socket; defaults to `recorder.sock` inside `RILL_HOME`. |
196
+ | `RILL_TEMP` | Artifact root; defaults to `rill-recordings` inside the system temporary directory. |
197
+
198
+ Set recorder variables before starting the background recorder; an existing recorder retains its original environment. Use the same configuration for recording, stopping, and draft recovery.
199
+
200
+ ## Sharing and privacy
201
+
202
+ Ready recordings get an unlisted share link that expires after seven days. In the recording page, copy it, replace it with a fresh link, or stop sharing. Finished recordings can be deleted after a five-second undo window.
203
+
204
+ Diagnostic redaction targets cookies, credential headers, URL query values, fragments, embedded credentials, and secret-shaped values. Network-body capture defaults off and is controlled by the human-issued credential; the agent cannot enable it for itself. Redaction is best-effort and does not mask the video. Avoid displaying secrets, review evidence before sharing, and treat share URLs as sensitive.
205
+
206
+ ## Optional agent feedback
207
+
208
+ After `record stop`, compatible hosts may receive `feedbackRequested: true` and a structured `suggestedAction`. When requested, agents should submit a short Rill-specific review if practical. Workspace opt-in pre-authorizes it; feedback is optional and must not delay or affect the recording result.
209
+
210
+ ```sh
211
+ rill feedback submit <recording-id> --outcome succeeded --improvement "Make processing progress clearer"
212
+ ```
213
+
214
+ `--outcome` must be `succeeded`, `failed`, or `abandoned`. Include at least one of `--helped`, `--friction`, or `--improvement`. Omit credentials, personal data, and copied page content. Feedback goes to Rill's operators and is not shown on public evidence pages.
215
+
216
+ Skip feedback when it is not requested. Use `rill record stop <recording-id> --no-feedback` to opt out for one run. A feedback failure must not delay returning the share URL.
217
+
218
+ ## Update and uninstall
219
+
220
+ ```sh
221
+ npm install --global @runalabs/rill-cli@latest
222
+ rill --version
223
+ rill doctor
224
+ ```
225
+
226
+ Remove the package:
227
+
228
+ ```sh
229
+ npm uninstall --global @runalabs/rill-cli
230
+ ```
231
+
232
+ This leaves keychain credentials, recorder state, local drafts, and remote recordings in place. Revoke the credential in Settings if access should end, and remove `RILL_TOKEN` from the environment or secret manager. To remove a stored local credential for the default API:
233
+
234
+ ```sh
235
+ # macOS
236
+ security delete-generic-password -a https://userill.dev -s rill
237
+ # Linux
238
+ secret-tool clear service rill api-url https://userill.dev
239
+ ```
30
240
 
31
- Commands emit one schema-versioned JSON object to stdout. Human-readable
32
- progress is written to stderr.
241
+ Substitute your API URL if you configured another environment. These commands clear the local credential; server-side revocation is managed in Settings.
package/dist/cli.js CHANGED
@@ -945,6 +945,28 @@ function controlPlaneUrl(environmentUrl) {
945
945
  return environmentUrl ?? PRODUCTION_API_URL;
946
946
  }
947
947
 
948
+ // src/feedback-protocol.ts
949
+ function suggestedFeedbackAction(recordingId) {
950
+ return {
951
+ type: "rill.feedback.submit",
952
+ recommended: true,
953
+ authorizedBy: "workspace_opt_in",
954
+ confirmationRequired: false,
955
+ failurePolicy: "non_blocking",
956
+ recordingId
957
+ };
958
+ }
959
+ function recordingFeedbackFields(recordingId, feedbackRequested) {
960
+ return feedbackRequested ? { feedbackRequested: true, suggestedAction: suggestedFeedbackAction(recordingId) } : { feedbackRequested: false };
961
+ }
962
+ function feedbackSubmissionReceipt(recordingId) {
963
+ return {
964
+ schemaVersion: 1,
965
+ recordingId,
966
+ feedbackStatus: "submitted"
967
+ };
968
+ }
969
+
948
970
  // src/cli.ts
949
971
  var program = new Command();
950
972
  program.name("rill").description("Record, inspect, and share agent browser runs.").version(CLI_VERSION).option("--api-url <url>", "Rill control plane", controlPlaneUrl(process.env.RILL_API_URL)).option("--pretty", "Pretty-print JSON output", false);
@@ -1016,7 +1038,16 @@ record.command("stop").argument("<recording-id>").option("--no-wait").option("--
1016
1038
  await Promise.all([client.uploadVideo(provisioned.uploadUrl, local.result.videoPath), client.uploadDiagnostics(recordingId, local.result.diagnosticsPath, local.result.diagnostics)]);
1017
1039
  const remote = commandOptions.wait === false ? null : await client.waitUntilPlayable(recordingId);
1018
1040
  if (remote) process.stderr.write("\n");
1019
- const result = { schemaVersion: 1, recordingId, status: remote ? "ready" : "processing", shareUrl: remote?.shareUrl ?? null, durationSeconds: local.result.durationSeconds, stoppedReason: local.result.stoppedReason, diagnostics: local.result.diagnostics, feedbackRequested: stopped?.feedbackRequested ?? false };
1041
+ const result = {
1042
+ schemaVersion: 1,
1043
+ recordingId,
1044
+ status: remote ? "ready" : "processing",
1045
+ shareUrl: remote?.shareUrl ?? null,
1046
+ durationSeconds: local.result.durationSeconds,
1047
+ stoppedReason: local.result.stoppedReason,
1048
+ diagnostics: local.result.diagnostics,
1049
+ ...recordingFeedbackFields(recordingId, stopped?.feedbackRequested ?? false)
1050
+ };
1020
1051
  emit(result, options.pretty);
1021
1052
  if (remote) await rm2(dirname2(local.result.videoPath), { recursive: true, force: true });
1022
1053
  });
@@ -1033,6 +1064,7 @@ feedback.command("submit").argument("<recording-id>").requiredOption("--outcome
1033
1064
  friction: commandOptions.friction,
1034
1065
  improvement: commandOptions.improvement
1035
1066
  });
1067
+ emit(feedbackSubmissionReceipt(recordingId), options.pretty);
1036
1068
  });
1037
1069
  record.command("status").argument("<recording-id>").action(async (recordingId) => {
1038
1070
  const options = program.opts();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runalabs/rill-cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Record, inspect, and share agent-controlled browser runs with Rill.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {