@clipy/cli 0.8.1 → 0.8.3
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 +110 -36
- package/dist/index.js +513 -91
- package/dist/skill.js +103 -29
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -128,12 +128,27 @@ agent-context — clearly marked as agent narration, never passed off as speech-
|
|
|
128
128
|
|
|
129
129
|
### Recording a logged-in app
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
131
|
+
**If something is driving the browser — prefer that.** Clipy is a recorder, not a driver.
|
|
132
|
+
When an agent (or you) drives a real, already-logged-in browser, don't hand Clipy the
|
|
133
|
+
credentials at all: record the real screen and attach evidence as you go.
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
clipy session start --source mac-screen --window "Chrome" --title "PR-1234 verification"
|
|
137
|
+
clipy mark "redemptions tab active" --observed "tab=Redemptions, rows=14" --verdict pass
|
|
138
|
+
clipy chapter "AFTER — fix applied"
|
|
139
|
+
clipy session stop
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
No auth to reproduce, no credentials in flags, and the recording shows the real app.
|
|
143
|
+
|
|
144
|
+
**The flags below are the agentless / CI fallback** — for a one-shot `clipy record` in CI,
|
|
145
|
+
or a headless session nothing is steering, where Clipy needs its own logged-in context.
|
|
146
|
+
Seed the session **before** the browser navigates — Clipy applies all of these to the
|
|
147
|
+
Playwright context ahead of the first page load, so the app's route guard sees the auth
|
|
148
|
+
state on first paint (seeding `localStorage` *after* visiting a guarded route loses that
|
|
149
|
+
race and bounces you to `/login`). They apply to headless web capture on `record` and
|
|
150
|
+
`session start`; they're rejected on `--source mac-screen` (which records the real,
|
|
151
|
+
already-logged-in screen).
|
|
137
152
|
|
|
138
153
|
- `--storage-state <file>` — a Playwright [`storageState`](https://playwright.dev/docs/auth)
|
|
139
154
|
JSON (cookies + per-origin `localStorage`), passed straight to `browser.newContext()`.
|
|
@@ -146,13 +161,30 @@ to headless web capture on `record` and `session start`; they're rejected on
|
|
|
146
161
|
(repeatable).
|
|
147
162
|
- `--init-script <file>` — run a JS file in every page before its own scripts (e.g. to
|
|
148
163
|
stub a feature flag or inject a token).
|
|
149
|
-
- `--user-data-dir <dir>` — launch a **persistent** Chromium profile from
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
164
|
+
- `--user-data-dir <dir>` — launch a **persistent** Chromium profile from the user-data
|
|
165
|
+
**root** `dir` (`launchPersistentContext`), so the recording carries that profile's
|
|
166
|
+
whole logged-in identity. Web only; **mutually exclusive with `--storage-state`** (a
|
|
167
|
+
profile already carries its own storage). `--cookie` / `--local-storage` / `--init-script`
|
|
168
|
+
still compose. Pass the **root**, not a profile subdir — Clipy refuses a `Default`/`Profile N`
|
|
169
|
+
directory and tells you the parent dir + `--profile-directory` to use. In direct mode
|
|
170
|
+
(no `--profile-directory`) it also refuses a live-locked root (`SingletonLock`/`SingletonSocket`).
|
|
171
|
+
- `--profile-directory "<name>"` — with `--user-data-dir`, select a **named** profile
|
|
172
|
+
(e.g. `Profile 12`, from `chrome://version` → "Profile Path"). Because Playwright can't
|
|
173
|
+
select a named profile in place, Clipy **copies** that profile into a temporary recording
|
|
174
|
+
root and launches the copy — **loudly** (it prints what it's copying and the size). Your
|
|
175
|
+
real profile is never opened or written, and the copy is deleted after upload. No need to
|
|
176
|
+
quit Chrome (Clipy warns if it's running, since in-use databases may copy inconsistently —
|
|
177
|
+
quit it for a guaranteed-clean copy).
|
|
178
|
+
|
|
179
|
+
> **⚠ macOS: a copied Chrome profile can open silently signed out.** Chrome encrypts its
|
|
180
|
+
> cookies with a Keychain key scoped to *Chrome Safe Storage*; the recorder runs
|
|
181
|
+
> Playwright's **Chromium**, which reads *Chromium Safe Storage*. So a copied real-Chrome
|
|
182
|
+
> profile may open looking like you — bookmarks, preferences, `localStorage` all intact —
|
|
183
|
+
> while every cookie-based login is gone. `localStorage`/`Preferences`-based sessions
|
|
184
|
+
> survive; cookie sessions may not. Clipy prints this warning before recording whenever
|
|
185
|
+
> copy mode runs on macOS. **If the recording lands logged out, this is why** — use
|
|
186
|
+
> `--source mac-screen` with your real browser, or the agent-driven path (drive your own
|
|
187
|
+
> browser and attach evidence with `--observed`/`--verdict`).
|
|
156
188
|
|
|
157
189
|
```bash
|
|
158
190
|
# Reuse a saved Playwright login
|
|
@@ -163,9 +195,10 @@ clipy record --url https://app.example.com/dashboard --for 20 \
|
|
|
163
195
|
clipy record --url https://app.example.com/dashboard \
|
|
164
196
|
--local-storage "authToken=eyJ…" --cookie "sid=abc; Domain=app.example.com; Secure"
|
|
165
197
|
|
|
166
|
-
# Or record
|
|
198
|
+
# Or record your real logged-in Chrome profile (copied, never modified)
|
|
167
199
|
clipy record --url https://app.example.com/dashboard --for 20 \
|
|
168
|
-
--user-data-dir
|
|
200
|
+
--user-data-dir "$HOME/Library/Application Support/Google/Chrome" \
|
|
201
|
+
--profile-directory "Profile 12"
|
|
169
202
|
```
|
|
170
203
|
|
|
171
204
|
#### The auth boundary
|
|
@@ -182,7 +215,9 @@ reliable ways to get a real logged-in recording:
|
|
|
182
215
|
# sign in, close the window, then:
|
|
183
216
|
clipy record --url https://app.example.com/dashboard --storage-state auth.json
|
|
184
217
|
```
|
|
185
|
-
2.
|
|
218
|
+
2. **Your real Chrome profile, copied:** `--user-data-dir "<chrome user-data root>"
|
|
219
|
+
--profile-directory "<name>"` (name from `chrome://version`). Clipy copies that profile
|
|
220
|
+
to a temp root and records the copy — no manual export, and your real profile is untouched.
|
|
186
221
|
3. **`--source mac-screen --window "Chrome"`** — record your real, already-logged-in
|
|
187
222
|
Chrome window through the Mac app; there's no headless auth to reproduce at all.
|
|
188
223
|
|
|
@@ -270,13 +305,33 @@ Safety rails are built in: the session **auto-stops and uploads** at `--max <sec
|
|
|
270
305
|
abort` discards everything; a crashed daemon is detected and cleared on the next command;
|
|
271
306
|
corrupt captures are refused before upload, and a failed upload keeps the local file.
|
|
272
307
|
|
|
273
|
-
###
|
|
308
|
+
### Evidence marks — two provenances, never pooled
|
|
274
309
|
|
|
275
310
|
A plain mark is an unverified claim: an agent can write `clipy mark "the Redemptions
|
|
276
311
|
tab is active"` whether or not it is, and the transcript reads as authoritative either
|
|
277
|
-
way.
|
|
278
|
-
|
|
279
|
-
|
|
312
|
+
way. Evidence marks fix that — in one of two ways, and Clipy **labels which**, so a
|
|
313
|
+
claim you attested can never be read as something Clipy checked.
|
|
314
|
+
|
|
315
|
+
**Driver-attested — you brought the browser.** Clipy is a recorder, not a driver: when
|
|
316
|
+
you're driving a real browser with your own tooling (or recording the screen), attach the
|
|
317
|
+
values you observed and your verdict.
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
clipy mark "redemptions tab active" --observed "tab=Redemptions, rows=14" --verdict pass
|
|
321
|
+
clipy mark "totals still stale" --observed "total=\$0.00 (expected \$412.50)" --verdict fail
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Stored as `redemptions tab active [ASSERT ✓ driver-attested; observed=tab=Redemptions, rows=14]`
|
|
325
|
+
(or `✗`). Both flags are required together, a mark carries exactly **one** provenance
|
|
326
|
+
(mixing with `--assert-*` is a usage error), and this works in **every** session type —
|
|
327
|
+
including `--source mac-screen`.
|
|
328
|
+
|
|
329
|
+
> **The honesty rule:** driver-attested means Clipy vouches that the agent **said** it,
|
|
330
|
+
> not that Clipy verified it. Put real observed values in `--observed` — the point of the
|
|
331
|
+
> ledger is that a reviewer can check the attestation against the video.
|
|
332
|
+
|
|
333
|
+
**Clipy-verified — Clipy owns the page.** In a headless web session the daemon owns the
|
|
334
|
+
live Playwright page, so it can check the claim against the real DOM itself:
|
|
280
335
|
|
|
281
336
|
```bash
|
|
282
337
|
# Assert a URL (globs: ** = anything, * = any non-slash segment, no * = substring)
|
|
@@ -286,33 +341,44 @@ clipy mark "opened the redemptions tab" --assert-url "**/redemptions"
|
|
|
286
341
|
clipy mark "status flipped to Active" --assert-selector ".status-badge" --assert-text "Active"
|
|
287
342
|
```
|
|
288
343
|
|
|
289
|
-
- **Pass** →
|
|
344
|
+
- **Pass** → `status flipped to Active [assert ✓ verified-by-clipy; .status-badge="Active"]`
|
|
290
345
|
and the CLI prints a green `✓`.
|
|
291
|
-
- **Fail** →
|
|
292
|
-
`status flipped to Active [ASSERT ✗ expected "Active"; observed .status-badge="Pending"]`
|
|
346
|
+
- **Fail** → `status flipped to Active [ASSERT ✗ verified-by-clipy; expected "Active"; observed .status-badge="Pending"]`
|
|
293
347
|
and the CLI prints a red `✗`. The wrong claim is preserved *as a failed assertion*, not
|
|
294
348
|
as a fact.
|
|
295
349
|
|
|
296
350
|
`--assert-selector <css>` checks an element matches (its trimmed text becomes the
|
|
297
351
|
`observed` value); `--assert-text <substr>` requires that element's text to contain a
|
|
298
352
|
substring (it needs a selector); `--assert-url <glob>` matches the page URL. Combine them
|
|
299
|
-
freely — all provided checks must pass.
|
|
353
|
+
freely — all provided checks must pass. These need a Clipy-owned page, so they're rejected
|
|
354
|
+
on `--source mac-screen` (use `--observed`/`--verdict` there).
|
|
300
355
|
|
|
301
356
|
`--fail-mode` decides what a failed assertion does: `warn` (default) records the `✗` and
|
|
302
357
|
keeps recording; **`abort` discards the whole session** — nothing is uploaded and the CLI
|
|
303
358
|
exits non-zero, so a driver that asserts its way to a broken state doesn't ship a misleading
|
|
304
|
-
clip.
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
359
|
+
clip.
|
|
360
|
+
|
|
361
|
+
The leading `[verification]` note reports the two provenances as **separate segments** and
|
|
362
|
+
never pools them:
|
|
363
|
+
|
|
364
|
+
```text
|
|
365
|
+
[verification] 2 clipy-verified: 1 passed, 1 failed, 1 unverified · 3 driver-attested: 2 passed, 1 failed
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
An empty segment is omitted; with only clipy-verified marks the rendering stays the legacy
|
|
369
|
+
`N assertion(s): P passed, F failed[, K unverified]`.
|
|
370
|
+
|
|
371
|
+
**A mark is never dropped, and a late verdict never rewrites it.** If the daemon can't be
|
|
372
|
+
reached to evaluate an assertion — its event loop briefly starved during a heavy dev-server
|
|
373
|
+
recompile, say — `clipy mark` doesn't fail and lose the note. It records the narration
|
|
374
|
+
anyway, tags it `[ASSERT ⚠ could not evaluate — <reason>]`, prints a loud `⚠`, and exits 0.
|
|
375
|
+
An unverified claim is flagged as unverified (the `K` in the tally), never silently promoted
|
|
376
|
+
to a `✓`. That ⚠ is the **mark of record**: if the daemon was only slow (not gone) and
|
|
377
|
+
evaluates the same claim a moment later, that verdict judged a *later* page state, so it does
|
|
378
|
+
**not** overwrite the ⚠. It's recorded as a separate, honestly-timestamped
|
|
379
|
+
`[late check of "…" — evaluated Ns after the claim: …]` note at the moment it actually ran,
|
|
380
|
+
and it counts toward neither passed, failed, nor unverified. (Plain, non-asserted marks that
|
|
381
|
+
the daemon later processes are simply deduped — they appear exactly once.)
|
|
316
382
|
|
|
317
383
|
Assertions evaluate against a real page, so they need a **web** session (they're rejected on
|
|
318
384
|
`--source mac-screen`, which records the real screen with no page to probe).
|
|
@@ -364,6 +430,14 @@ clipy mark "the toast appeared" --ago 2 # 2 seconds before now
|
|
|
364
430
|
clipy mark "page finished loading" --at 4 # at an absolute 4s on the recording clock
|
|
365
431
|
```
|
|
366
432
|
|
|
433
|
+
Backdating an **asserted** mark is a subtlety: the mark lands at the backdated time, but the
|
|
434
|
+
assertion still judges the **live** page (the daemon can't rewind). When the verdict was
|
|
435
|
+
observed more than 2 s from the backdated position, the mark stays where you put it and the
|
|
436
|
+
text gains `(assertion observed Ns after this backdated mark — the verdict describes the page
|
|
437
|
+
at observation time)`, with a signed `assert.driftSec` in `--json` — so a ✓/✗ is never read
|
|
438
|
+
as describing the earlier moment. Live-clock asserted marks and backdated plain marks are
|
|
439
|
+
unaffected.
|
|
440
|
+
|
|
367
441
|
## Record the real screen — a window, a display (Mac)
|
|
368
442
|
|
|
369
443
|
`--source mac-screen` on `record` / `session start` records through the **running Clipy
|