@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.
Files changed (4) hide show
  1. package/README.md +110 -36
  2. package/dist/index.js +513 -91
  3. package/dist/skill.js +103 -29
  4. package/package.json +1 -1
package/dist/skill.js CHANGED
@@ -15,7 +15,7 @@ description: Read and create Clipy screen recordings. Use when the user shares a
15
15
 
16
16
  # Clipy — recordings you can read AND make
17
17
 
18
- Written for @clipy/cli + @clipy/mcp 0.8.1 (the two versions move in lockstep). If
18
+ Written for @clipy/cli + @clipy/mcp 0.8.3 (the two versions move in lockstep). If
19
19
  \`clipy --version\` reports older, upgrade first: \`npm i -g @clipy/cli@latest\`.
20
20
 
21
21
  Clipy (clipy.online) is the screen recorder built to be agent-readable. Every
@@ -81,14 +81,30 @@ Notes are absolute (\`"12: text"\`) or pass-scoped (\`"pass2: text"\`,
81
81
  \`"pass2@5: text"\`). Pass-scoped notes anchor to a --viewports pass's REAL start,
82
82
  so they stay aligned when load time shifts the pass boundaries.
83
83
 
84
- ## Recording a logged-in app (headless web capture)
84
+ ## Recording a logged-in app
85
85
 
86
- The headless browser starts signed out. To record a page behind auth, seed the
87
- session BEFORE the first navigation — otherwise the app's route guard runs before
88
- your credentials exist and redirects to /login (seeding localStorage AFTER visiting
89
- a guarded route loses that race). \`--storage-state\` and \`--init-script\` apply
90
- BEFORE any page script structurally, which is what avoids the trap. All four flags
91
- work on both \`record\` and \`session start\` (web only; rejected on --source mac-screen):
86
+ **Preferred when YOU are driving (the usual agent case):** don't hand Clipy the
87
+ credentials at all. Drive the REAL, already-logged-in browser with your own tooling
88
+ and let Clipy record the screen:
89
+
90
+ clipy session start --source mac-screen --window "Chrome" --title "PR-1234 verification"
91
+ # …drive the real Chrome with your own tooling, attaching evidence as you go:
92
+ clipy mark "redemptions tab active" --observed "tab=Redemptions, rows=14" --verdict pass
93
+ clipy chapter "AFTER — fix applied"
94
+ clipy session stop
95
+
96
+ No auth to reproduce, no credentials in flags, and the recording shows the real app.
97
+ Clipy is the camera + the ledger; you are the driver.
98
+
99
+ ### Fallback: hand Clipy its own browser (agentless / CI)
100
+
101
+ When nothing is driving — a one-shot \`clipy record\` in CI, or a headless session
102
+ you're not steering — Clipy needs its own logged-in context. The headless browser
103
+ starts signed out, so seed the session BEFORE the first navigation — otherwise the
104
+ app's route guard runs before your credentials exist and redirects to /login (seeding
105
+ localStorage AFTER visiting a guarded route loses that race). \`--storage-state\` and
106
+ \`--init-script\` apply BEFORE any page script structurally, which is what avoids the
107
+ trap. These flags are web-only (rejected on --source mac-screen):
92
108
 
93
109
  # reuse a saved Playwright login (cookies + per-origin localStorage)
94
110
  clipy record --url https://app.example.com/dashboard --for 20 --storage-state ./auth.json
@@ -103,11 +119,17 @@ work on both \`record\` and \`session start\` (web only; rejected on --source ma
103
119
  repeatable; without a Domain it's url-scoped to the target.
104
120
  - \`--local-storage "key=value"\` — repeatable; origin-guarded to the target.
105
121
  - \`--init-script <file>\` — a JS file run before every page's own scripts.
106
- - \`--user-data-dir <dir>\` — launch a PERSISTENT Chromium profile from \`dir\`
107
- (its whole logged-in identity, not just injected storage). Web only; mutually
108
- exclusive with --storage-state; --cookie/--local-storage/--init-script still
109
- compose. Point it at a COPY or a dedicated profile — never your live Chrome's
110
- default profile (Chrome locks it; Clipy refuses a dir with a SingletonLock).
122
+ - \`--user-data-dir <dir>\` — launch a PERSISTENT Chromium profile from the
123
+ user-data ROOT \`dir\` (its whole logged-in identity, not just injected storage).
124
+ Web only; mutually exclusive with --storage-state; --cookie/--local-storage/
125
+ --init-script still compose. Pass the ROOT, not a profile subdir (Clipy refuses
126
+ a profile dir and tells you the parent + --profile-directory to use).
127
+ - \`--profile-directory "<name>"\` — with --user-data-dir, pick a NAMED profile
128
+ (e.g. "Profile 12", from chrome://version → "Profile Path"). Clipy COPIES that
129
+ profile into a temporary recording root and launches it there (loudly — it
130
+ prints what it's copying); your real profile is never opened or modified, and
131
+ the copy is deleted after upload. This is how you record your actual logged-in
132
+ Chrome identity.
111
133
 
112
134
  ### The auth boundary (read this if a login won't stick)
113
135
 
@@ -118,8 +140,18 @@ Three reliable ways to record a real logged-in app:
118
140
  1. Produce the state file with a REAL interactive login (it captures cross-domain
119
141
  cookies): \`npx playwright open --save-storage=auth.json https://<login-host>\`,
120
142
  sign in, close — then \`--storage-state auth.json\`.
121
- 2. \`--user-data-dir <dedicated-profile>\` — a persistent profile you logged into
122
- once (copy it out of your real Chrome, or make a throwaway profile).
143
+ 2. Your real Chrome profile via copy:
144
+ \`--user-data-dir "$HOME/Library/Application Support/Google/Chrome" --profile-directory "Profile 12"\`
145
+ (name from chrome://version). Clipy copies that profile to a temp root and
146
+ records the copy — no manual export, no quitting Chrome required (quit it for a
147
+ guaranteed-clean copy of in-use databases; Clipy warns if it's running).
148
+ ⚠ ON macOS THIS CAN OPEN SILENTLY SIGNED OUT: Chrome encrypts cookies with a
149
+ Keychain key scoped to "Chrome Safe Storage", but the recorder runs Playwright's
150
+ CHROMIUM, which reads "Chromium Safe Storage". The copy can look like the user
151
+ (bookmarks, prefs, localStorage intact) while every cookie login is gone.
152
+ localStorage/Preferences sessions survive; cookie sessions may not. Clipy prints
153
+ this warning before recording. If the recording lands logged out, THAT is why —
154
+ fall back to option 3, or to the agent-driven path at the top of this section.
123
155
  3. \`--source mac-screen --window "Chrome"\` — record your REAL logged-in Chrome
124
156
  window (Mac app), no headless auth to reproduce at all.
125
157
 
@@ -149,12 +181,33 @@ Headless captures are silent, so your notes/marks BECOME the transcript (honestl
149
181
  labeled as agent narration, never passed off as speech). Narrate every meaningful
150
182
  step.
151
183
 
152
- ### Assert what you claim (assertion marks)
184
+ ### Assert what you claim (two provenances, never pooled)
153
185
 
154
186
  A plain mark is an unverified claim — you can write \`clipy mark "the Redemptions
155
187
  tab is active"\` whether it's true or not, and the transcript reads as fact either
156
- way. Make marks EVIDENCE by attaching an assertion the recording daemon checks
157
- against its live page:
188
+ way. Make marks EVIDENCE. There are TWO ways, and Clipy labels which one produced
189
+ each mark so they can never be confused:
190
+
191
+ **A. Driver-attested — you brought the browser (the usual agent path).** You are
192
+ driving a real browser with your own tooling; Clipy is the camera + the ledger.
193
+ Attach the values YOU observed and your verdict:
194
+
195
+ clipy mark "redemptions tab active" --observed "tab=Redemptions, rows=14" --verdict pass
196
+ clipy mark "totals still stale" --observed "total=\$0.00 (expected \$412.50)" --verdict fail
197
+
198
+ Renders as \`… [ASSERT ✓ driver-attested; observed=<your values>]\` (or ✗). Both
199
+ flags are required together, and a mark carries exactly ONE provenance — combining
200
+ them with --assert-* is a usage error. Works in EVERY session type, including
201
+ \`--source mac-screen\`.
202
+
203
+ **THE HONESTY RULE — internalize this:**
204
+ driver-attested means Clipy vouches the agent SAID it, not that Clipy verified it.
205
+ Put real observed values in --observed (the actual text/number/URL you read), never a
206
+ restatement of the claim — the whole value of the ledger is that a reviewer can check
207
+ your attestation against the video.
208
+
209
+ **B. Clipy-verified — Clipy owns the page (headless web sessions only).** When the
210
+ recording IS a Clipy-owned Playwright page, Clipy can check the claim itself:
158
211
 
159
212
  clipy mark "opened redemptions" --assert-url "**/redemptions"
160
213
  clipy mark "status is Active" --assert-selector ".status-badge" --assert-text "Active"
@@ -166,21 +219,31 @@ against its live page:
166
219
  - \`--assert-url <glob>\` — the page URL must match (\`**\` = anything, \`*\` = any
167
220
  non-slash segment, no \`*\` = substring). Combine freely; all checks must pass.
168
221
 
169
- A pass annotates the mark \`… [assert ✓ <observed>]\`; a fail annotates it
170
- \`… [ASSERT ✗ expected …; observed …]\` — a wrong claim is preserved AS a failed
171
- assertion, it can never read as fact. \`--fail-mode warn\` (default) records the ✗
172
- and keeps going; \`--fail-mode abort\` DISCARDS the whole session (nothing uploaded,
173
- non-zero exit) so you never ship a clip that asserted its way into a broken state.
174
- If any assertion was attempted, a leading \`[verification] N assertion(s): P passed,
175
- F failed[, K unverified]\` note opens the transcript.
222
+ A pass annotates the mark \`… [assert ✓ verified-by-clipy; <observed>]\`; a fail
223
+ \`… [ASSERT ✗ verified-by-clipy; expected …; observed …]\` — a wrong claim is
224
+ preserved AS a failed assertion, it can never read as fact. \`--fail-mode warn\`
225
+ (default) records the ✗ and keeps going; \`--fail-mode abort\` DISCARDS the whole
226
+ session (nothing uploaded, non-zero exit) so you never ship a clip that asserted its
227
+ way into a broken state.
228
+
229
+ The leading \`[verification]\` note reports the two provenances as SEPARATE segments
230
+ and never pools them:
231
+ \`[verification] N clipy-verified: P passed, F failed[, K unverified] · M driver-attested: P passed, F failed\`
232
+ (a segment is omitted when it's empty).
176
233
 
177
234
  A mark is NEVER dropped: if the recording daemon can't be reached to evaluate an
178
235
  assertion (e.g. its event loop is briefly starved during a dev-server recompile),
179
236
  \`clipy mark\` still records the narration, tags it \`[ASSERT ⚠ could not evaluate —
180
237
  <reason>]\`, prints a loud ⚠, and exits 0 — an unverified claim is flagged as
181
- unverified (the K bucket), never passed off as a ✓. Assertions need a WEB session
182
- (rejected on --source mac-screen — there's no page to probe). Prefer asserting the
183
- specific claims a reviewer cares about over narrating them unverified.
238
+ unverified (the K bucket), never passed off as a ✓. That ⚠ is the MARK OF RECORD:
239
+ if the daemon was only slow and evaluates the same claim a moment later, that late
240
+ verdict does NOT overwrite the ⚠ (it judged a later page state) — it's recorded as a
241
+ separate \`[late check of "…" — evaluated Ns after the claim: …]\` note at its own
242
+ time, and it counts toward neither passed/failed/unverified. Clipy-VERIFIED
243
+ assertions need a Clipy-owned page, so \`--assert-*\` is rejected on
244
+ \`--source mac-screen\` — use \`--observed/--verdict\` there (and anywhere you drive
245
+ the browser yourself). Prefer attaching evidence to the specific claims a reviewer
246
+ cares about over narrating them bare.
184
247
 
185
248
  ### Before/after in one recording (clipy chapter)
186
249
 
@@ -219,6 +282,14 @@ the state it describes. Backdate onto the recording clock:
219
282
  clipy mark "toast appeared" --ago 2 # 2s before now
220
283
  clipy mark "page loaded" --at 4 # absolute 4s on the recording clock
221
284
 
285
+ Backdating an ASSERTED mark: the mark lands at the backdated time, but the assertion
286
+ judges the LIVE page (the daemon can't rewind). If the verdict was observed >2s from
287
+ the backdated position, the mark stays put and its text gains \`(assertion observed Ns
288
+ after this backdated mark — the verdict describes the page at observation time)\` plus a
289
+ signed \`assert.driftSec\` in --json — so a ✓/✗ isn't misread as describing the earlier
290
+ moment. So: assert on the LIVE clock, and reserve --at/--ago for narration you're
291
+ backdating without a claim (or accept the disclaimer).
292
+
222
293
  When you drive over --expose-cdp, emit marks IN-PAGE with zero spawn latency by
223
294
  calling the bindings the daemon exposes (they run daemon-side with the page in
224
295
  hand — no \`clipy mark\` process, no shell-out latency):
@@ -239,7 +310,10 @@ evaluated daemon-side, annotated ✓/✗ identically:
239
310
 
240
311
  It returns the annotated result (\`{ tMs, text, assert }\`); \`assertText\` without
241
312
  \`assertSelector\` REJECTS so your driver sees the misuse, and \`failMode: "abort"\`
242
- discards the session just like the CLI flag.
313
+ discards the session just like the CLI flag. \`__clipyMark\` deliberately has NO
314
+ observed/verdict option: it runs inside a Clipy-owned page, where clipy-verified is
315
+ strictly better than an attestation. Use \`--observed/--verdict\` for browsers Clipy
316
+ doesn't own.
243
317
 
244
318
  (While CDP is exposed the page's own scripts can call these too — same trust model as
245
319
  --expose-cdp itself.) \`clipy playwright-path\` prints the node_modules dir to resolve
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clipy/cli",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "Command-line interface for Clipy — list, search, and read your screen recordings' transcripts, AI summaries, and key moments from the terminal.",
5
5
  "license": "MIT",
6
6
  "type": "module",