@runalabs/rill-cli 0.1.11 → 0.1.13

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 +53 -4
  2. package/dist/cli.js +689 -511
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -40,6 +40,17 @@ Do not use `npx rill`: the unscoped package belongs to a different product. Doct
40
40
 
41
41
  ## Authenticate
42
42
 
43
+ ### Connect with pollable approval
44
+
45
+ `rill whoami` verifies the current account without starting sign-in. `rill connect --email you@example.com` waits for human approval by default. For agents that cannot hold a foreground command open:
46
+
47
+ ```sh
48
+ rill connect --email you@example.com --no-wait
49
+ rill connect status <authorization-id>
50
+ ```
51
+
52
+ The first response contains `authorizationId`, `verificationUri`, `userCode`, `expiresAt`, `retryAfterSeconds`, and the exact `nextCommand`. The human opens the URL and approves their own request. Poll no faster than `retryAfterSeconds`; each status command returns once. States are `pending`, `authenticated` (approved and credentials saved), `expired`, or `denied` (including revoked claims). Expired and denied status commands exit 1. Pending state and polling backoff survive process exit in the OS credential store; claim/access tokens are never returned. Repeating connect with the same email resumes an unexpired pending request. Only the latest authorization ID for that API URL can be polled.
53
+
43
54
  ### Interactive login
44
55
 
45
56
  `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.
@@ -66,6 +77,8 @@ New browser recordings include a visible cursor and click pulses by default. In
66
77
 
67
78
  ### Connect Playwright
68
79
 
80
+ Start also returns `browserAttachment` with the CDP endpoint, protocol, Playwright method, and attachment instructions. Browser tools must explicitly support attaching to that endpoint; Rill does not automatically expose its browser to every tool.
81
+
69
82
  In a project with `playwright-core` installed, save this as `rill-run.mjs`:
70
83
 
71
84
  ```js
@@ -86,6 +99,31 @@ try {
86
99
 
87
100
  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.
88
101
 
102
+ For a shell-only macOS/Linux agent with no project Playwright dependency, use a temporary directory. This installs the automation client without changing the project's manifest or launching another browser:
103
+
104
+ ```sh
105
+ rill_automation_dir=$(mktemp -d)
106
+ npm install --prefix "$rill_automation_dir" --no-save --package-lock=false playwright-core
107
+ cat > "$rill_automation_dir/run.mjs" <<'JS'
108
+ import { chromium } from 'playwright-core';
109
+ const browser = await chromium.connectOverCDP(process.argv[2]);
110
+ try {
111
+ const page = browser.contexts()[0]?.pages()[0];
112
+ if (!page) throw new Error('The recorded page is unavailable.');
113
+ await page.waitForLoadState('domcontentloaded');
114
+ // Add the agreed interactions and assertions on this page.
115
+ console.log(await page.title());
116
+ } finally {
117
+ await browser.close(); // Disconnect this CDP client; preserve the recorded browser.
118
+ }
119
+ JS
120
+ node "$rill_automation_dir/run.mjs" "<cdpUrl>"
121
+ rill record stop <recording-id> --no-wait
122
+ rill record status <recording-id>
123
+ ```
124
+
125
+ Replace the placeholders with start's actual values. This snippet verifies attachment only until you add your flow assertions. Keep the directory for retries and remove it when finished. Playwright documents the [connected-browser disconnect behavior](https://playwright.dev/docs/api/class-browser#browser-close).
126
+
89
127
  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.
90
128
 
91
129
  ### Recording options
@@ -145,10 +183,13 @@ Use `rill --help` or `<command> --help` for supported flags.
145
183
  | Command | Behavior |
146
184
  | --- | --- |
147
185
  | `rill login` | Authorize a device code and store a credential. |
186
+ | `rill whoami` | Verify the saved identity and account email. |
187
+ | `rill connect --email <email> [--no-wait]` | Start or resume account approval. |
188
+ | `rill connect status <authorization-id>` | Poll a saved approval once; obey `retryAfterSeconds`. |
148
189
  | `rill doctor` | Check prerequisites, API compatibility, and authentication. |
149
190
  | `rill record start [options]` | Start a managed or attached browser recording. |
150
191
  | `rill record stop <recording-id>` | Finalize and upload; supports `--no-wait` and `--no-feedback`. |
151
- | `rill record status <recording-id>` | Read the remote encoding job first; otherwise check local capture state with a remote fallback. |
192
+ | `rill record status <recording-id>` | Read remote state first, then local capture for unsubmitted recordings; local completion is `captured`. |
152
193
  | `rill record retry <recording-id>` | Resume a retained remote capture or retry a failed encode; supports `--no-wait`. |
153
194
  | `rill record cancel <recording-id>` | Abandon a run created by this credential and release its remote quota reservation. |
154
195
  | `rill upload <video-file>` | Upload video-only evidence; supports `--title` and `--no-wait`. |
@@ -182,14 +223,18 @@ Success exits 0; command failures exit 1. Runtime failures emit an `error` objec
182
223
 
183
224
  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.
184
225
 
226
+ Lifecycle recovery also distinguishes `unsupported_platform`, `processing_pending`, `authorization_not_found`, `expired_token`, and `access_denied`. An elapsed playback wait is pending, while a confirmed remote failure remains `processing_failed`.
227
+
185
228
  ## Recovery and troubleshooting
186
229
 
187
230
  - **Doctor fails:** read the failed check's recovery field. Correct the credential, API connectivity, or executable path before recording.
188
- - **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.
231
+ - **Quota exceeded:** inspect `error.details.quota.type` and `blockingRecordingId` when present. Uploading and processing recordings still hold the concurrency slot. Run the returned status command and wait for `ready`; if it reports `captured`, run its stop command to upload. Cancel only an abandoned run. Review storage and daily allowance in Billing.
189
232
  - **Remote upload interrupted or encoding failed:** keep the recording ID and local capture files. Run `rill record status <recording-id>`, then `rill record retry <recording-id>` with the original credential before capture expiry. Retry resumes accepted chunks or requeues the encode without repeating browser actions. A `ready` result needs a share URL before you return it as evidence.
190
- - **Duration limit reached:** local capture finalizes automatically, but `record stop` is still needed to upload.
233
+ - **Duration limit reached:** local capture finalizes automatically. Status reports `captured`, `source: "local"`, and the exact `nextCommand` to upload. It is not a playable share. Run `record stop <recording-id> --no-wait`, then poll status.
234
+ - **Upload reached 100%:** transfer has finished; encoding/playback processing may continue. `--no-wait` returns after submission with a status command. A polling timeout reports `processing_pending`, not a confirmed processing failure.
235
+ - **Windows:** doctor reports `recorder_transport` failure, and local record start rejects before reserving a recording. Use macOS/Linux for browser recording. Windows can use `RILL_TOKEN` with video-only `upload`; setting `RILL_SOCKET` does not add named-pipe/TCP support.
191
236
  - **Terminal closed:** after upload acceptance, the server finishes independently; retrieve the result with `record status`. Before acceptance, retry from the original machine while its captured frames remain available.
192
- - **Local session missing:** `record status` checks for a remote encoding job before falling back to local or remote recording state. `drafts list` locates local directories, which may be incomplete. There is no `drafts resume` command.
237
+ - **Local session missing:** `record status` checks remote encoding and recording state. Remote processing/completion takes precedence over retained local artifacts. For captures not submitted, it checks the local recorder. Remote authorization/network errors are surfaced rather than being masked by local readiness. `drafts list` locates local directories, which may be incomplete. There is no `drafts resume` command.
193
238
  - **Share cannot be inspected:** open the complete URL in a browser; ask the owner for a current link if needed.
194
239
 
195
240
  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.
@@ -288,3 +333,7 @@ Progress runs through `uploading` → `queued` → `encoding` → `processing`
288
333
  Run `rill connect --email you@example.com` to authorize account access or keep your anonymous recordings. Open the displayed link, sign in, and enter the code yourself. Approval allows creation and reading of your existing and new recordings for 90 days, with automatic renewal of one-hour access tokens. Revoke the connection in Rill's Credentials page to stop access and renewal. Deletion and changes to existing sharing settings are not included.
289
334
 
290
335
  Use `rill record list` to list accessible recordings and `rill inspect <recording-id>` for private recording details. `rill inspect <share-url>` continues to work without account access. The existing `rill login` and `RILL_TOKEN` flows remain supported. Local credential storage requires macOS Keychain or Linux Secret Service.
336
+
337
+ ### Check the connected account
338
+
339
+ Run `rill whoami` (or `rill --pretty whoami`) to verify your current identity. JSON output includes status, account email when available, workspace, scopes, and access expiry. It uses RILL_TOKEN when set, otherwise the saved OS credential. Existing access can renew automatically; it never creates an identity or opens an approval flow. Missing credentials return `not_connected` and exit 1. Invalid or revoked credentials return an error.