@clipy/cli 0.8.2 → 0.8.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.
package/README.md CHANGED
@@ -59,7 +59,7 @@ to ferry by hand. Without a TTY at all (scripts, CI), use `CLIPY_API_KEY` or
59
59
  clipy list [-n 20] [--page 2] [--status ready,processing] [--json]
60
60
  clipy search <query> # full-text search titles + descriptions
61
61
  clipy show <id|share-url> # metadata + share link
62
- clipy transcript <id> [--srt|--vtt] # plaintext, or export subtitles
62
+ clipy transcript <id> [--marks-only] # one entry per line, timestamped (--srt/--vtt to export)
63
63
  clipy summary <id> # TL;DR, key points, action items
64
64
  clipy moments <id> # key moments: timestamps, captions, click coords
65
65
  clipy context <id> # the full agent-context bundle as markdown
@@ -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
- To record an authenticated SPA, seed the session **before** the browser navigates —
132
- Clipy applies all of these to the Playwright context ahead of the first page load, so the
133
- app's route guard sees the auth state on first paint (seeding `localStorage` *after*
134
- visiting a guarded route loses that race and bounces you to `/login`). These flags apply
135
- to headless web capture on `record` and `session start`; they're rejected on
136
- `--source mac-screen` (which records the real, already-logged-in screen).
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,19 +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 `dir` instead
150
- of an ephemeral context (`launchPersistentContext`), so the recording carries that
151
- profile's whole logged-in identity. Web only; **mutually exclusive with
152
- `--storage-state`** (a profile already carries its own storage). `--cookie` /
153
- `--local-storage` / `--init-script` still compose. Chrome locks a profile while it's
154
- open, so Clipy refuses a dir that has a `SingletonLock`/`SingletonSocket`. Two ways to
155
- point it at a real logged-in profile:
156
- - **Quit Chrome, then point at the real profile dir.** No copy needed and you record
157
- with full identity — but the recorder writes to that profile, so quit Chrome first
158
- (that's what clears the `Singleton*` locks) and expect it to have your live session.
159
- - **Copy the profile out and strip the locks** (`cp -R "<profile>" ./clipy-profile &&
160
- rm -f ./clipy-profile/Singleton*`) for isolation from your live browser, at the cost
161
- of duplicating a (large) profile dir. The profile owner's call.
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`).
162
188
 
163
189
  ```bash
164
190
  # Reuse a saved Playwright login
@@ -169,9 +195,10 @@ clipy record --url https://app.example.com/dashboard --for 20 \
169
195
  clipy record --url https://app.example.com/dashboard \
170
196
  --local-storage "authToken=eyJ…" --cookie "sid=abc; Domain=app.example.com; Secure"
171
197
 
172
- # Or record a persistent logged-in profile
198
+ # Or record your real logged-in Chrome profile (copied, never modified)
173
199
  clipy record --url https://app.example.com/dashboard --for 20 \
174
- --user-data-dir ./clipy-profile
200
+ --user-data-dir "$HOME/Library/Application Support/Google/Chrome" \
201
+ --profile-directory "Profile 12"
175
202
  ```
176
203
 
177
204
  #### The auth boundary
@@ -188,7 +215,9 @@ reliable ways to get a real logged-in recording:
188
215
  # sign in, close the window, then:
189
216
  clipy record --url https://app.example.com/dashboard --storage-state auth.json
190
217
  ```
191
- 2. **`--user-data-dir <dedicated-profile>`** — a persistent profile you logged into once.
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.
192
221
  3. **`--source mac-screen --window "Chrome"`** — record your real, already-logged-in
193
222
  Chrome window through the Mac app; there's no headless auth to reproduce at all.
194
223
 
@@ -276,13 +305,33 @@ Safety rails are built in: the session **auto-stops and uploads** at `--max <sec
276
305
  abort` discards everything; a crashed daemon is detected and cleared on the next command;
277
306
  corrupt captures are refused before upload, and a failed upload keeps the local file.
278
307
 
279
- ### Assertion marks — recordings as evidence
308
+ ### Evidence marks — two provenances, never pooled
280
309
 
281
310
  A plain mark is an unverified claim: an agent can write `clipy mark "the Redemptions
282
311
  tab is active"` whether or not it is, and the transcript reads as authoritative either
283
- way. Assertion marks fix that. The recording daemon owns the live Playwright page, so it
284
- can **check the claim against the real DOM** and annotate the mark with what it actually
285
- observed — a false claim can't pass as fact.
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:
286
335
 
287
336
  ```bash
288
337
  # Assert a URL (globs: ** = anything, * = any non-slash segment, no * = substring)
@@ -292,29 +341,37 @@ clipy mark "opened the redemptions tab" --assert-url "**/redemptions"
292
341
  clipy mark "status flipped to Active" --assert-selector ".status-badge" --assert-text "Active"
293
342
  ```
294
343
 
295
- - **Pass** → the mark is stored as `status flipped to Active [assert ✓ .status-badge="Active"]`
344
+ - **Pass** → `status flipped to Active [assert ✓ verified-by-clipy; .status-badge="Active"]`
296
345
  and the CLI prints a green `✓`.
297
- - **Fail** → it's stored as
298
- `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"]`
299
347
  and the CLI prints a red `✗`. The wrong claim is preserved *as a failed assertion*, not
300
348
  as a fact.
301
349
 
302
350
  `--assert-selector <css>` checks an element matches (its trimmed text becomes the
303
351
  `observed` value); `--assert-text <substr>` requires that element's text to contain a
304
352
  substring (it needs a selector); `--assert-url <glob>` matches the page URL. Combine them
305
- 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).
306
355
 
307
356
  `--fail-mode` decides what a failed assertion does: `warn` (default) records the `✗` and
308
357
  keeps recording; **`abort` discards the whole session** — nothing is uploaded and the CLI
309
358
  exits non-zero, so a driver that asserts its way to a broken state doesn't ship a misleading
310
- clip. If any assertion was attempted, a leading `[verification] N assertion(s): P passed,
311
- F failed[, K unverified]` note is prepended at 0 ms, so the transcript and the `.md` context
312
- open with the scorecard.
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]`.
313
370
 
314
371
  **A mark is never dropped, and a late verdict never rewrites it.** If the daemon can't be
315
372
  reached to evaluate an assertion — its event loop briefly starved during a heavy dev-server
316
373
  recompile, say — `clipy mark` doesn't fail and lose the note. It records the narration
317
- anyway, tags it `[ASSERT ⚠ could not evaluate — <reason>]`, prints a loud `⚠`, and exits 0.
374
+ anyway, tags it `[ASSERT ⚠ clipy could not evaluate — <reason>]`, prints a loud `⚠`, and exits 0.
318
375
  An unverified claim is flagged as unverified (the `K` in the tally), never silently promoted
319
376
  to a `✓`. That ⚠ is the **mark of record**: if the daemon was only slow (not gone) and
320
377
  evaluates the same claim a moment later, that verdict judged a *later* page state, so it does