@clipy/cli 0.17.0 → 0.18.0

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/dist/index.js CHANGED
@@ -13,7 +13,7 @@
13
13
  * override the stored key. Read-only unless the key carries the "ingest" scope.
14
14
  */
15
15
  import { parseArgs } from "node:util";
16
- import { appendFileSync, closeSync, copyFileSync, cpSync, createWriteStream, existsSync, mkdirSync, openSync, readdirSync, readFileSync, readSync, realpathSync, renameSync, rmSync, statSync, writeFileSync, chmodSync } from "node:fs";
16
+ import { appendFileSync, closeSync, copyFileSync, cpSync, createWriteStream, existsSync, mkdirSync, mkdtempSync, openSync, readdirSync, readFileSync, readSync, realpathSync, renameSync, rmSync, statSync, writeFileSync, chmodSync } from "node:fs";
17
17
  import { homedir, tmpdir } from "node:os";
18
18
  import { basename, dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
19
19
  import { createInterface } from "node:readline";
@@ -39,6 +39,8 @@ import { supportsWebp } from "./context/ffmpeg.js";
39
39
  import { renderProofFrames } from "./proofFrames.js";
40
40
  import { cmdAnalytics, cmdComment, cmdComments, cmdDelete, cmdDiagnostics, cmdFolders, cmdInteractions, cmdOrganize, cmdShare, cmdUpdate, failure, } from "./library.js";
41
41
  import { waitForAgentContext } from "./agentReadiness.js";
42
+ import { cmdRecheck } from "./recheckCmd.js";
43
+ import { RECHECK_MAX_STEPS } from "./recheck.js";
42
44
  import { BridgeUnavailableError, bridgeRequest, inspectBridge, listSources, readBridgeInfo, resolveCaptureSource, windowLabel, probeSocketOpenable, probeBridgeHandshake, bridgeInfoFromFile, bridgeAppOutdated, MIN_BRIDGE_APP_VERSION, describeWindow, describeDisplay, resolveFromSources, } from "./macBridge.js";
43
45
  import { defaultDisplay, describeCaps, ffmpegCaps, isWaylandSession, listLinuxSources, orphanedCaptureProcesses, parseDisplaySize, realRunner, startScreenRecorder, startVirtualDisplay, } from "./linuxScreen.js";
44
46
  // Exit quietly when stdout/stderr close early (e.g. `clipy list | head`).
@@ -253,6 +255,62 @@ function libraryDeps(ctx, json) {
253
255
  color: c,
254
256
  };
255
257
  }
258
+ /** `clipy recheck`: the library helpers plus Playwright and the proof upload. */
259
+ function recheckDeps(ctx, json) {
260
+ return {
261
+ ...libraryDeps(ctx, json),
262
+ loadChromium: async () => (await loadChromium()),
263
+ uploadFrames: (frames, meta) => uploadRecheckFrames(ctx, frames, meta),
264
+ };
265
+ }
266
+ /** The same path as `clipy proof --frame`: one held frame per step, the step
267
+ * result as its timed caption. */
268
+ async function uploadRecheckFrames(ctx, frames, meta) {
269
+ requireKey(ctx);
270
+ const holdSeconds = 3;
271
+ // Private (mkdtemp is 0700): the video is made of screenshots of a
272
+ // signed-in app. Removed on success, failure and Ctrl-C alike.
273
+ const tmpDir = mkdtempSync(join(tmpdir(), "clipy-recheck-upload-"));
274
+ const onSignal = (signal) => {
275
+ rmSync(tmpDir, { recursive: true, force: true });
276
+ process.exit(signal === "SIGINT" ? 130 : 143);
277
+ };
278
+ process.once("SIGINT", onSignal);
279
+ process.once("SIGTERM", onSignal);
280
+ try {
281
+ const videoPath = join(tmpDir, "recheck.mp4");
282
+ meta.log(`assembling ${frames.length} step frame${frames.length === 1 ? "" : "s"}…`);
283
+ await renderProofFrames({
284
+ framePaths: frames.map((f) => f.path),
285
+ outputPath: videoPath,
286
+ holdSeconds,
287
+ width: 1280,
288
+ height: 720,
289
+ notify: meta.log,
290
+ });
291
+ const notes = frames.map((f, i) => ({
292
+ startMs: Math.round(i * holdSeconds * 1000),
293
+ endMs: Math.round((i + 1) * holdSeconds * 1000),
294
+ text: f.caption,
295
+ }));
296
+ const uploaded = await uploadVideoToClipy(ctx, {
297
+ videoPath,
298
+ name: meta.name,
299
+ nameIsUserProvided: true,
300
+ description: meta.description,
301
+ narration: { notes },
302
+ // The server maps the cli-proof/ prefix to the CLI source platform.
303
+ sourceVersion: `cli-proof/${VERSION}`,
304
+ log: meta.log,
305
+ });
306
+ return { id: uploaded.publicId, shareUrl: uploaded.shareUrl, contextUrl: uploaded.contextUrl };
307
+ }
308
+ finally {
309
+ process.off("SIGINT", onSignal);
310
+ process.off("SIGTERM", onSignal);
311
+ rmSync(tmpDir, { recursive: true, force: true });
312
+ }
313
+ }
256
314
  function printJson(data) {
257
315
  process.stdout.write(`${JSON.stringify(data, null, 2)}\n`);
258
316
  }
@@ -365,7 +423,7 @@ ${c.bold("RECORDINGS")}
365
423
  your library (needs "ingest"). --wait, --json
366
424
 
367
425
  ${c.bold("MANAGE")} ${c.dim("(needs recordings:write; comments needs comments:read, comment comments:write, analytics analytics:read)")}
368
- update <id> [--title <t>] [--description <d> | --clear-description]
426
+ update <id> [--title <t>] [--description <d> | --clear-description] [--expected <text>]
369
427
  Rename a recording or edit its description
370
428
  share <id> [public|restricted|private]
371
429
  Show or change who can open the share link
@@ -397,6 +455,14 @@ ${c.bold("BUG EVIDENCE")} ${c.dim("(captured by the Chrome extension's bug captu
397
455
  Clicks, scrolls, typing and pauses with
398
456
  the element labels and frame evidence;
399
457
  page with --cursor <nextCursor>
458
+ recheck <id> --url <start-url> [--plan] [--no-upload] [--out <dir>]
459
+ Replay a recorded workflow in Chrome for
460
+ Clipy and report each step: matched,
461
+ control not found, different screen, error
462
+ or could not map. --plan lists the steps only.
463
+ Irreversible-looking controls (delete, pay,
464
+ send) are not clicked without
465
+ --allow-destructive
400
466
 
401
467
  ${c.bold("PROOF")} ${c.dim("(tool-neutral evidence; needs an ingest-scoped API key)")}
402
468
  proof --frame <png|jpg|webp> [--frame <image> ...]
@@ -2147,6 +2213,7 @@ async function uploadVideoToClipy(ctx, opts) {
2147
2213
  ...(opts.accessMode ? { accessMode: opts.accessMode } : {}),
2148
2214
  ...(opts.nameIsUserProvided && opts.name ? { nameIsUserProvided: true } : {}),
2149
2215
  ...(opts.recordingKind ? { recordingKind: opts.recordingKind } : {}),
2216
+ ...(opts.expectedResult ? { expectedResult: opts.expectedResult } : {}),
2150
2217
  ...(opts.narration && (opts.narration.text || opts.narration.notes?.length)
2151
2218
  ? { narration: opts.narration }
2152
2219
  : {}),
@@ -2246,6 +2313,7 @@ async function cmdUpload(ctx, file, opts) {
2246
2313
  nameIsUserProvided: opts.name !== undefined,
2247
2314
  description: opts.description,
2248
2315
  recordingKind: opts.recordingKind,
2316
+ expectedResult: opts.expectedResult,
2249
2317
  narration: notes.length > 0 ? { notes } : undefined,
2250
2318
  accessMode,
2251
2319
  sourceVersion: `cli/${VERSION}`,
@@ -2384,6 +2452,7 @@ async function cmdProof(ctx, opts) {
2384
2452
  description: opts.description,
2385
2453
  narration: narrationNotes.length > 0 ? { notes: narrationNotes } : undefined,
2386
2454
  recordingKind: opts.recordingKind,
2455
+ expectedResult: opts.expectedResult,
2387
2456
  sourceVersion: `cli-proof/${VERSION}`,
2388
2457
  log,
2389
2458
  });
@@ -2993,6 +3062,7 @@ async function cmdRecord(ctx, opts) {
2993
3062
  name: opts.name,
2994
3063
  description: opts.description,
2995
3064
  recordingKind: opts.recordingKind,
3065
+ expectedResult: opts.expectedResult,
2996
3066
  narration: notes.length ? { notes } : undefined,
2997
3067
  log,
2998
3068
  });
@@ -3585,6 +3655,7 @@ async function cmdSessionStartLinux(ctx, opts) {
3585
3655
  name: opts.name,
3586
3656
  description: opts.description,
3587
3657
  recordingKind: opts.recordingKind,
3658
+ expectedResult: opts.expectedResult,
3588
3659
  maxSec,
3589
3660
  width: opts.width,
3590
3661
  height: opts.height,
@@ -3706,6 +3777,7 @@ async function cmdRecordLinux(ctx, opts) {
3706
3777
  name: opts.name,
3707
3778
  description: opts.description,
3708
3779
  recordingKind: opts.recordingKind,
3780
+ expectedResult: opts.expectedResult,
3709
3781
  narration: notes.length ? { notes } : undefined,
3710
3782
  log: (m) => {
3711
3783
  if (!opts.json)
@@ -3914,6 +3986,9 @@ async function cmdRecordMac(opts) {
3914
3986
  if (opts.recordingKind) {
3915
3987
  log(c.yellow(`note: --type is not applied to --source mac-screen recordings yet (needs a Clipy app update)`));
3916
3988
  }
3989
+ if (opts.expectedResult) {
3990
+ log(c.yellow(`note: --expected is not applied to --source mac-screen recordings yet; run clipy update <id> --expected "<text>" afterwards`));
3991
+ }
3917
3992
  // Before the camera turns on, not after — see warnAudioUncontrollable().
3918
3993
  // Deliberately NOT `log`: a "your mic may be live" warning must survive
3919
3994
  // --json, and stderr never corrupts the JSON on stdout.
@@ -4125,6 +4200,9 @@ async function cmdSessionStartExtension(opts) {
4125
4200
  if (opts.recordingKind && !opts.json) {
4126
4201
  process.stderr.write(`${c.yellow("note: --type is not applied to --source chrome-extension recordings yet")}\n`);
4127
4202
  }
4203
+ if (opts.expectedResult && !opts.json) {
4204
+ process.stderr.write(`${c.yellow("note: --expected is not applied to --source chrome-extension recordings yet; after stop, run clipy update <id> --expected \"<text>\"")}\n`);
4205
+ }
4128
4206
  const file = sessionFilePath(process.cwd());
4129
4207
  const existing = readSessionState(file);
4130
4208
  if (existing && sessionIsActive(existing)) {
@@ -4243,6 +4321,9 @@ async function cmdSessionStart(ctx, opts) {
4243
4321
  if (opts.recordingKind && !opts.json) {
4244
4322
  process.stderr.write(`${c.yellow("note: --type is not applied to --source mac-screen recordings yet (needs a Clipy app update)")}\n`);
4245
4323
  }
4324
+ if (opts.expectedResult && !opts.json) {
4325
+ process.stderr.write(`${c.yellow("note: --expected is not applied to --source mac-screen recordings yet; after stop, run clipy update <id> --expected \"<text>\"")}\n`);
4326
+ }
4246
4327
  // Before the camera turns on, not after — see warnAudioUncontrollable().
4247
4328
  const audioUncontrollable = warnAudioUncontrollable(info.protocolVersion, opts.audio, (m) => process.stderr.write(`${m}\n`));
4248
4329
  const windowWarned = warnWindowCaptureUnknown(info.protocolVersion, target, (m) => process.stderr.write(`${m}\n`));
@@ -4344,6 +4425,7 @@ async function cmdSessionStart(ctx, opts) {
4344
4425
  name: opts.name,
4345
4426
  description: opts.description,
4346
4427
  recordingKind: opts.recordingKind,
4428
+ expectedResult: opts.expectedResult,
4347
4429
  maxSec,
4348
4430
  width: opts.width,
4349
4431
  height: opts.height,
@@ -5886,6 +5968,7 @@ async function runSessionDaemon(file) {
5886
5968
  name: state.name,
5887
5969
  description: state.description,
5888
5970
  recordingKind: state.recordingKind,
5971
+ expectedResult: state.expectedResult,
5889
5972
  narration: notes.length ? { notes } : undefined,
5890
5973
  browserDiagnostics: diagnosticsSidecar,
5891
5974
  log: (m) => log(m.replace(/\x1b\[[0-9;]*m/g, "")),
@@ -6332,7 +6415,7 @@ async function cmdAgents(ctx, sub, targetRaw, json) {
6332
6415
  // command's shape without trial-and-error. Bump GUIDE_SCHEMA_VERSION when the
6333
6416
  // contract changes.
6334
6417
  // ---------------------------------------------------------------------------
6335
- const GUIDE_SCHEMA_VERSION = 18;
6418
+ const GUIDE_SCHEMA_VERSION = 19;
6336
6419
  /** The stable machine-readable failure taxonomy carried in `--json` error
6337
6420
  * envelopes. Codes are the contract; messages are not. Published through the
6338
6421
  * guide so an agent discovers the full recovery table without the skill. */
@@ -6359,6 +6442,11 @@ const GUIDE_ERROR_CODES = [
6359
6442
  { code: "confirmation_required", meaning: "a permanent action (clipy delete) was run without --yes (exit 2)", retryable: false, remediation: "only if the user asked for that exact recording to be deleted, re-run with --yes" },
6360
6443
  { code: "upload_unconfirmed", meaning: "the upload became a recording, but the server never confirmed its completion (still being committed or queued)", retryable: false, remediation: "do NOT upload again (that creates a duplicate); check the recording in partial.id with `clipy show <id>`" },
6361
6444
  { code: "sharing_not_applied", meaning: "the upload became a recording, but the requested public/restricted/private sharing could not be applied", retryable: false, remediation: "do NOT upload again (that creates a duplicate); run the `clipy share <id> <mode>` in the remediation, using partial.id" },
6445
+ { code: "timeline_not_ready", meaning: "clipy recheck: the recording's interaction timeline is still being prepared", retryable: true, remediation: "wait a minute and re-run the same command" },
6446
+ { code: "no_interactions", meaning: "clipy recheck: the recording has no clicks or page navigations to replay (for example a plain web-recorder take)", retryable: false, remediation: "only Chrome extension, Chrome for Clipy, Mac and Windows app takes can be re-checked; re-running cannot help" },
6447
+ { code: "chrome_unavailable", meaning: "clipy recheck: Chrome for Clipy could not be started or driven", retryable: true, remediation: "run `clipy chrome status --json` and `clipy chrome start`, then re-run once" },
6448
+ { code: "start_url_unreachable", meaning: "clipy recheck: the --url page could not be opened (connection refused, unknown host)", retryable: false, remediation: "check that --url loads (is the server running, is it the right host?), then re-run" },
6449
+ { code: "recheck_upload_failed", meaning: "clipy recheck finished, but its step frames were not uploaded (a warning on an ok:true report, not a failure)", retryable: false, remediation: "the report and frames are saved locally (files.json); do not re-run the whole re-check just for the upload" },
6362
6450
  { code: "unknown", meaning: "an unclassified failure", retryable: true, remediation: "re-run once; if it repeats, hand the user the whole envelope as a bug report rather than improvising a workaround" },
6363
6451
  ];
6364
6452
  function cmdGuide(json) {
@@ -6398,6 +6486,7 @@ function cmdGuide(json) {
6398
6486
  { code: 1, meaning: "error" },
6399
6487
  { code: 2, meaning: "usage error" },
6400
6488
  { code: 3, meaning: "artifact not ready yet (transcript/summary/wait)" },
6489
+ { code: 4, meaning: "clipy recheck --fail-on-divergence: the re-check finished but its verdict is not matches" },
6401
6490
  ],
6402
6491
  errorCodes: GUIDE_ERROR_CODES,
6403
6492
  partialSuccess: {
@@ -6419,9 +6508,9 @@ function cmdGuide(json) {
6419
6508
  cmdDoc("moments", "clipy moments <id> [--json]", "Key moments: timestamps, captions, click coords"),
6420
6509
  cmdDoc("context", "clipy context <id>", "Full agent-context bundle as markdown"),
6421
6510
  cmdDoc("context import", "clipy context import <youtube-url|loom-url|local-file> [--transcript <f>] [--output <dir>] [--language <code>] [--title <t>] [--tag <t>]… [--folder <name>] [--sync] [--json]", "Compile ANY video into a local Clipy context bundle — a directory holding recording.arec (the canonical agent-facing Markdown document), a byte-identical recording.md compatibility copy, manifest.json (provenance, versions, sufficiency report) and transcript.json. YouTube URLs resolve on YOUR machine via a Clipy-managed yt-dlp (auto-installed into ~/.clipy/bin on first use, with a disclosure); creator captions are preferred over auto-captions and NO media is downloaded. Loom share links (loom.com/share/<32-hex-id>) use Loom's own published transcript over plain HTTPS — no yt-dlp is needed and none is installed, so `clipy doctor`'s yt-dlp check does not gate a Loom import; roughly one Loom in six has no transcript recorded and fails with `no_captions` rather than emitting an empty bundle, and Loom's transcript is machine-generated so it is recorded as auto_captions. Local files need --transcript <.vtt|.srt|Clipy transcript JSON> and are probed with ffprobe. A deterministic classifier scores how well the transcript stands alone and lists the timestamps where it is blind — v1 emits the transcript profile only, so those gaps are the honest statement of what the bundle cannot show. Reruns over the same source are idempotent. --sync additionally uploads the DERIVED bundle (never source media) to your private library.", ["--transcript", "--output", "--language", "--title", "--tag", "--folder", "--sync", "--no-frames", "--json"]),
6422
- cmdDoc("context read", "clipy context read <bundle-path>", "Print a local bundle's recording.arec to stdout — plain, unpaged, uncoloured, for an agent to read directly. It opens with a self-describing header (source, duration, classification, sufficiency, untrusted-content warning) before the [MM:SS] transcript sections, so the first screen tells you what the document is and where it is blind. For a SYNCED document read it over MCP instead: get_context_document for metadata+classification without the transcript, then read_context_document with startMs/endMs for just the span you need."),
6423
- cmdDoc("upload", "clipy upload <file> [--title t] [--description d] [--type kind] [--access public|restricted|private] [--note '12: text']… [--wait] [--json]", "Upload an existing WebM/MP4/MOV file to the library through the same pipeline as recordings (needs 'ingest'; counts toward the recording allowance). JSON: {ok:true, id, shareUrl, contextUrl, sizeBytes, container, warnings}. With --wait, a failed wait is a `wait_incomplete` warning on a successful result: the recording exists, so never upload again", ["--title", "--description", "--type", "--access", "--note", "--wait", "--json"]),
6424
- cmdDoc("update", "clipy update <id> [--title t] [--description d | --clear-description] [--json]", "Rename a recording or edit its description (recordings:write)"),
6511
+ cmdDoc("context read", "clipy context read <bundle-path>", "Print a local bundle's recording.arec to stdout: plain, unpaged, uncoloured, for an agent to read directly. It opens with a self-describing header (source, duration, classification, sufficiency) before the [MM:SS] transcript sections, so the first screen tells you what the document is and where it is blind. For a SYNCED document read it over MCP instead: get_context_document for metadata+classification without the transcript, then read_context_document with startMs/endMs for just the span you need."),
6512
+ cmdDoc("upload", "clipy upload <file> [--title t] [--description d] [--type kind] [--expected text] [--access public|restricted|private] [--note '12: text']… [--wait] [--json]", "Upload an existing WebM/MP4/MOV file to the library through the same pipeline as recordings (needs 'ingest'; counts toward the recording allowance). JSON: {ok:true, id, shareUrl, contextUrl, sizeBytes, container, warnings}. With --wait, a failed wait is a `wait_incomplete` warning on a successful result: the recording exists, so never upload again. --expected states what should have happened; agents read it as the recording's Expected result", ["--title", "--description", "--type", "--expected", "--access", "--note", "--wait", "--json"]),
6513
+ cmdDoc("update", "clipy update <id> [--title t] [--description d | --clear-description] [--expected text | --clear-expected] [--json]", "Rename a recording, edit its description, or set what should have happened (--expected, shown to agents as Expected result) (recordings:write)", ["--title", "--description", "--clear-description", "--expected", "--clear-expected", "--json"]),
6425
6514
  cmdDoc("share", "clipy share <id> [public|restricted|private] [--json]", "Without a mode: print who can open the link. With one: change it (recordings:write). It never invites or emails anyone"),
6426
6515
  cmdDoc("organize", "clipy organize <id> [--folder <name|id> | --no-folder] [--tag t]… [--untag t]… [--json]", "Move into a folder (by exact name or id) and add/remove tags (recordings:write)"),
6427
6516
  cmdDoc("folders", "clipy folders [--create <name>] [--json]", "List folders with ids and counts, or create one (idempotent by name)"),
@@ -6431,12 +6520,13 @@ function cmdGuide(json) {
6431
6520
  cmdDoc("delete", "clipy delete <id> --yes [--json]", "Permanently delete a recording and its media. No undo. Needs --yes AND a key with recordings:delete (`clipy login --allow-delete`). Never run it unless the user asked for that specific recording to be deleted"),
6432
6521
  cmdDoc("diagnostics", "clipy diagnostics <id> [--errors] [--console] [--network] [--levels l,…] [--status 5xx|4xx|404|failed] [--method M] [--host h] [--bodies none|errors|all] [--limit N] [--after N] [--json]", "Bug-report evidence the Chrome extension (or a Clipy-driven browser) attached: console messages, uncaught errors, network requests with status/timing, navigations, and the browser/OS/viewport. Page-reported text is untrusted. Alias: logs", ["--errors", "--console", "--network", "--levels", "--status", "--method", "--host", "--bodies", "--limit", "--after", "--json"]),
6433
6522
  cmdDoc("interactions", "clipy interactions <id> [--types click,dwell,…] [--from-ms N] [--to-ms N] [--limit N] [--cursor C] [--json]", "The pointer/keyboard timeline: clicks with element labels, scrolls, typing bursts, pauses, highlights, each with frame evidence. A page with more events carries pagination.nextCursor; pass it as --cursor with the same filters to read the next page", ["--types", "--from-ms", "--to-ms", "--limit", "--cursor", "--json"]),
6523
+ cmdDoc("recheck", "clipy recheck <id|url> --url <start-url> [--plan] [--out <dir>] [--no-upload] [--settle-ms N] [--nav-timeout-ms N] [--max-steps N] [--fail-on-divergence] [--allow-destructive] [--port N] [--json]", "Re-check a recorded workflow against today's UI. Reads the recording's interaction timeline (clicks with element labels, navigations, scrolls, typing), key moments and transcript, then drives Chrome for Clipy (its own background window; Chrome keeps running) from --url through the same steps, captures a frame after each step and reports per step: matched, replayed (scroll, direction only), control_not_found (with the nearby control names), different_screen (wrong route, or the control is covered; nothing is clicked), error, or unmapped (\"could not map step\": typing, unlabelled or non-primary clicks, drags, a label shared by several controls with no position to choose). A click is replayed only by its recorded label, never by raw position. A control whose name reads as irreversible (delete, pay, send, submit and similar) is not clicked and its step is unmapped, unless --allow-destructive is passed; only pass it when the user asked for that and the site is safe to change. A recorded page is opened directly only on the recording's own host (moved onto --url's host), never on another host the timeline names. Recorded on one host and re-checked on another (e.g. staging), recorded routes are moved onto the --url host and must match there; a page that lands on any other host (a redirect to production) is different_screen and is never clicked. A disabled control is different_screen, never matched. --plan prints the steps without opening Chrome. By default the frames are uploaded like clipy proof --frame (ingest scope, ffmpeg) and the report carries the new recording's shareUrl and contextUrl; --no-upload keeps everything local. report.json and report.md are written to --out (default a private temp dir). Ctrl-C closes the re-check's window and exits 130. An unreachable --url fails with start_url_unreachable. An upload whose completion was not confirmed carries the recording plus an upload_unconfirmed warning: do not upload again. --json prints {ok:true, type:'clipy.recheck_report', original:{…, expectedResult}, summary:{verdict: matches|diverged|incomplete, firstDivergence, counts}, steps:[{status, reason, expected, observed}], recording, limitations, warnings, files}. original.expectedResult carries the recording's \"what should have happened\" when it has one; compare it with the last frame yourself. --fail-on-divergence exits 4 unless the verdict is matches. Needs Playwright (as session --source chrome-for-clipy does) and a Chrome for Clipy that is signed in where the workflow needs it.", ["--url <start-url>", "--plan", "--out <dir>", "--no-upload", "--settle-ms", "--nav-timeout-ms", "--max-steps", "--fail-on-divergence", "--allow-destructive", "--port", "--json"]),
6434
6524
  cmdDoc("download", "clipy download <id> [-o path]", "Download the MP4"),
6435
6525
  cmdDoc("open", "clipy open <id>", "Open the share page in a browser"),
6436
6526
  cmdDoc("wait", "clipy wait <id> [--for transcript|summary|both] [--timeout sec]", "Block until artifacts are ready"),
6437
- cmdDoc("proof", "clipy proof (--frame <png|jpg|webp>… | --video <webm|mp4>) [--for <recording>] [--caption <text>…] [--hold sec] [--title t] [--type kind] [--note '3: text']… [--wait] [--json]", "Tool-neutral proof upload. --frame may be repeated to turn screenshots produced by any browser, computer-use, simulator, or test tool into one high-quality silent MP4; --caption must be omitted or repeated exactly once per frame and becomes timestamped agent narration. --hold controls each frame's duration (default 3s, 0.25–30; total cap 300s); --width/--height must be even integers from 320–3840 and default to 1280x720. Frame inputs are bounded to 50 MiB each and 250 MiB total. Screenshot stitching needs ffmpeg but does not need Playwright or a browser integration. --video uploads an already-recorded WebM or MP4 without re-encoding and needs no recording dependency. Exactly one source mode is required. --for <recording id|url> links the uploaded proof back to the recording it verifies (validated before upload; the link appears in the owner-only receipt on that recording's watch page and needs a key with both ingest and recordings:read). --json prints {id, shareUrl, contextUrl, sizeBytes, source, verifies?}; proof-video source reports only the detected container and never discloses the local path. Captions and notes are driver-attested narration, not Clipy-verified assertions.", ["--frame", "--caption", "--video", "--for", "--hold", "--width", "--height", "--title", "--description", "--type", "--note", "--wait", "--json"]),
6438
- cmdDoc("record", "clipy record --url <url> [--for sec] [--viewports list] [--title t] [--type kind] [--note '12: text']… [--storage-state f] [--cookie 'n=v']… [--local-storage 'k=v']… [--init-script f] [--wait] [--json]", "Headless one-shot capture of a web app; notes become the transcript. Notes are absolute ('12: text') or pass-scoped ('pass2: text' / 'pass2@5: text', anchored to a --viewports pass's real start; a malformed pass note is rejected). --type declares the recording kind (bug_report|feature_request|product_demo|walkthrough_tutorial|feedback_review|discussion_talk|other, plus aliases bug/feature/demo/walkthrough/feedback/discussion) so the AI summary reads it correctly. Auth (web capture only, applied before the first navigation so a logged-in SPA's route guard sees it): --storage-state <playwright storageState JSON path>, --cookie 'name=value[; Domain=d; Path=p; Secure; HttpOnly; SameSite=Lax]' (repeatable), --local-storage 'key=value' (repeatable, target origin only), --init-script <js file run before every page load>, --user-data-dir <dir> (launch from a persistent Chromium user-data ROOT with its whole logged-in identity; web only, mutually exclusive with --storage-state; refused if <dir> is a profile subdir — pass the root — or, in direct mode, a live-locked root via SingletonLock/Socket), --profile-directory <name> (with --user-data-dir: pick a NAMED profile like 'Profile 12' from chrome://version; Playwright can't select a profile in place, so Clipy COPIES it into a temp recording root and launches the copy — loudly disclosed, the real profile is never opened or written, and the copy is deleted after upload; no need to quit Chrome, though it warns if Chrome is running since in-use DBs may copy inconsistently). Auth boundary: --storage-state only seeds what the file contains; for cross-origin auth produce it with `npx playwright open --save-storage=auth.json <login-host>`, or use --user-data-dir + --profile-directory to record your real profile, or --source mac-screen --window Chrome. With --source screen (or mac-screen on macOS): records the real screen, via the Clipy Mac app on macOS (--type not yet applied on mac) and with the CLI's own X11 recorder on Linux (silent; needs ffmpeg with x11grab). Auth flags are rejected, since the screen is already logged in; --window '<title|app|id>' records that window by itself (windows on top of it stay out, and it follows the window if it moves, only when --json reports windowCapture \"window\"; \"area\", from a Clipy Mac app older than bridge protocol v3 or on ffmpeg older than 5.1, records whatever is on top, and on Linux covered parts are black without a compositor) and --display <id> records one display (ids from clipy sources). Linux only: --x-display :N picks the X display (default $DISPLAY) and --virtual-display records a private X display sized by --width/--height. --json prints {id, shareUrl, contextUrl, sizeBytes}", ["--for", "--viewports", "--title", "--description", "--type", "--note", "--storage-state", "--cookie", "--local-storage", "--init-script", "--user-data-dir", "--profile-directory", "--width", "--height", "--wait", "--source", "--window", "--display", "--x-display", "--virtual-display", "--json"]),
6439
- cmdDoc("session", "clipy session <start|run|stop|abort|status> [--url <url>] [--max sec] [--type kind] [--source web|screen|chrome-for-clipy|chrome-extension] [--window w] [--display d] [--x-display :N] [--virtual-display] [--expose-cdp] [--diagnostics off|errors|all] [--network-detail] [--storage-state f] [--cookie 'n=v']… [--local-storage 'k=v']… [--init-script f] [--json]", "Background recording session; auto-stops + uploads at --max (default 600s, cap 1800s). --type sets the recording kind (see record). Web and chrome-for-clipy sessions attach browser evidence read from the browser itself (console output, uncaught errors, failed requests including GraphQL errors, WebSocket activity, environment) as the recording's browser diagnostics: --diagnostics errors (default) keeps warnings/errors and failures, all keeps every message and request, off keeps none; --network-detail also keeps request/response headers and text bodies (cookie and authorization headers never leave the machine; the server redacts the rest by field name and value pattern). With --source screen (mac-screen on macOS), --window records that window by itself (windows on top of it stay out only when --json reports windowCapture \"window\"; \"area\", from a Clipy Mac app older than bridge protocol v3 or on ffmpeg older than 5.1, records whatever is on top, and on Linux covered parts are black without a compositor) and --display records one display; on Linux --x-display :N picks the X display and --virtual-display records a private X display whose name is returned as xDisplay (session run exports it to the command as DISPLAY). --source chrome-extension records ONE TAB through the Clipy extension inside Chrome for Clipy (needs a one-time clipy chrome setup): no daemon, the extension records and uploads; start returns cdpHttpUrl and the recorded tab's url (opened in the background, never focused), --name titles the recording, the tab's sound is left out unless --tab-audio (detected speech would replace the marks as the transcript), mark/chapter (plain or --observed/--verdict, not --assert-*) are kept by the CLI and sent at stop as the transcript, stop waits for the upload and returns the link. --source chrome-for-clipy records ONE TAB (tab video + tab audio, no picker or gesture) inside the persistent Chrome for Clipy instance: the instance is started automatically (sign in once via clipy chrome start and the profile stays signed in), the recorded tab opens at --url, its CDP endpoint is always published as cdpUrl/cdpHttpUrl so drivers attach to the very browser being recorded, and stopping the session leaves Chrome for Clipy running; auth-capture flags and --user-data-dir are rejected for this source. --expose-cdp (web sessions) opens a CDP endpoint (cdpUrl/cdpHttpUrl in the state file + session start/status output) so your own tools can drive the page while it records; OFF by default (any local process could attach), and CLIPY_DISABLE_CDP=1 forces it off. `session run [start flags] -- <command…>` starts a session, runs the command with inherited stdio (env CLIPY_SESSION=1, plus CLIPY_CDP_URL when --expose-cdp, plus CLIPY_TARGET_ID/CLIPY_PAGE_WS_URL for the recorded tab with --source chrome-extension), then GUARANTEES cleanup: exit 0 uploads, any non-zero exit or signal discards (session abort) and propagates the child's code. It is the crash-safe wrapper, so a dead driver never records dead air. Accepts the same auth flags as record (--storage-state/--user-data-dir/--profile-directory/--cookie/--local-storage/--init-script; web only, rejected on --source mac-screen). `session run` exports CLIPY_SESSION_FILE to the child so mark/chapter resolve the session from any cwd. --json is supported on start/stop/status (start returns cdpUrl/cdpHttpUrl)", ["run", "--url", "--max", "--type", "--source", "--window", "--display", "--x-display", "--virtual-display", "--tab-audio", "--expose-cdp", "--diagnostics", "--network-detail", "--storage-state", "--user-data-dir", "--profile-directory", "--cookie", "--local-storage", "--init-script", "--json"]),
6527
+ cmdDoc("proof", "clipy proof (--frame <png|jpg|webp>… | --video <webm|mp4>) [--for <recording>] [--caption <text>…] [--hold sec] [--title t] [--type kind] [--expected text] [--note '3: text']… [--wait] [--json]", "Tool-neutral proof upload. --frame may be repeated to turn screenshots produced by any browser, computer-use, simulator, or test tool into one high-quality silent MP4; --caption must be omitted or repeated exactly once per frame and becomes timestamped agent narration. --hold controls each frame's duration (default 3s, 0.25–30; total cap 300s); --width/--height must be even integers from 320–3840 and default to 1280x720. Frame inputs are bounded to 50 MiB each and 250 MiB total. Screenshot stitching needs ffmpeg but does not need Playwright or a browser integration. --video uploads an already-recorded WebM or MP4 without re-encoding and needs no recording dependency. Exactly one source mode is required. --for <recording id|url> links the uploaded proof back to the recording it verifies (validated before upload; the link appears in the owner-only receipt on that recording's watch page and needs a key with both ingest and recordings:read). --json prints {id, shareUrl, contextUrl, sizeBytes, source, verifies?}; proof-video source reports only the detected container and never discloses the local path. Captions and notes are driver-attested narration, not Clipy-verified assertions.", ["--frame", "--caption", "--video", "--for", "--hold", "--width", "--height", "--title", "--description", "--type", "--expected", "--note", "--wait", "--json"]),
6528
+ cmdDoc("record", "clipy record --url <url> [--for sec] [--viewports list] [--title t] [--type kind] [--expected text] [--note '12: text']… [--storage-state f] [--cookie 'n=v']… [--local-storage 'k=v']… [--init-script f] [--wait] [--json]", "Headless one-shot capture of a web app; notes become the transcript. Notes are absolute ('12: text') or pass-scoped ('pass2: text' / 'pass2@5: text', anchored to a --viewports pass's real start; a malformed pass note is rejected). --type declares the recording kind (bug_report|feature_request|product_demo|walkthrough_tutorial|feedback_review|discussion_talk|other, plus aliases bug/feature/demo/walkthrough/feedback/discussion) so the AI summary reads it correctly. --expected states what should have happened (not yet applied on mac; use clipy update afterwards). Auth (web capture only, applied before the first navigation so a logged-in SPA's route guard sees it): --storage-state <playwright storageState JSON path>, --cookie 'name=value[; Domain=d; Path=p; Secure; HttpOnly; SameSite=Lax]' (repeatable), --local-storage 'key=value' (repeatable, target origin only), --init-script <js file run before every page load>, --user-data-dir <dir> (launch from a persistent Chromium user-data ROOT with its whole logged-in identity; web only, mutually exclusive with --storage-state; refused if <dir> is a profile subdir — pass the root — or, in direct mode, a live-locked root via SingletonLock/Socket), --profile-directory <name> (with --user-data-dir: pick a NAMED profile like 'Profile 12' from chrome://version; Playwright can't select a profile in place, so Clipy COPIES it into a temp recording root and launches the copy — loudly disclosed, the real profile is never opened or written, and the copy is deleted after upload; no need to quit Chrome, though it warns if Chrome is running since in-use DBs may copy inconsistently). Auth boundary: --storage-state only seeds what the file contains; for cross-origin auth produce it with `npx playwright open --save-storage=auth.json <login-host>`, or use --user-data-dir + --profile-directory to record your real profile, or --source mac-screen --window Chrome. With --source screen (or mac-screen on macOS): records the real screen, via the Clipy Mac app on macOS (--type not yet applied on mac) and with the CLI's own X11 recorder on Linux (silent; needs ffmpeg with x11grab). Auth flags are rejected, since the screen is already logged in; --window '<title|app|id>' records that window by itself (windows on top of it stay out, and it follows the window if it moves, only when --json reports windowCapture \"window\"; \"area\", from a Clipy Mac app older than bridge protocol v3 or on ffmpeg older than 5.1, records whatever is on top, and on Linux covered parts are black without a compositor) and --display <id> records one display (ids from clipy sources). Linux only: --x-display :N picks the X display (default $DISPLAY) and --virtual-display records a private X display sized by --width/--height. --json prints {id, shareUrl, contextUrl, sizeBytes}", ["--for", "--viewports", "--title", "--description", "--type", "--expected", "--note", "--storage-state", "--cookie", "--local-storage", "--init-script", "--user-data-dir", "--profile-directory", "--width", "--height", "--wait", "--source", "--window", "--display", "--x-display", "--virtual-display", "--json"]),
6529
+ cmdDoc("session", "clipy session <start|run|stop|abort|status> [--url <url>] [--max sec] [--type kind] [--expected text] [--source web|screen|chrome-for-clipy|chrome-extension] [--window w] [--display d] [--x-display :N] [--virtual-display] [--expose-cdp] [--diagnostics off|errors|all] [--network-detail] [--storage-state f] [--cookie 'n=v']… [--local-storage 'k=v']… [--init-script f] [--json]", "Background recording session; auto-stops + uploads at --max (default 600s, cap 1800s). --type sets the recording kind (see record). --expected states what should have happened, shown to agents as the recording's Expected result (web, chrome-for-clipy and Linux screen sessions; for the others run clipy update afterwards). Web and chrome-for-clipy sessions attach browser evidence read from the browser itself (console output, uncaught errors, failed requests including GraphQL errors, WebSocket activity, environment) as the recording's browser diagnostics: --diagnostics errors (default) keeps warnings/errors and failures, all keeps every message and request, off keeps none; --network-detail also keeps request/response headers and text bodies (cookie and authorization headers never leave the machine; the server redacts the rest by field name and value pattern). With --source screen (mac-screen on macOS), --window records that window by itself (windows on top of it stay out only when --json reports windowCapture \"window\"; \"area\", from a Clipy Mac app older than bridge protocol v3 or on ffmpeg older than 5.1, records whatever is on top, and on Linux covered parts are black without a compositor) and --display records one display; on Linux --x-display :N picks the X display and --virtual-display records a private X display whose name is returned as xDisplay (session run exports it to the command as DISPLAY). --source chrome-extension records ONE TAB through the Clipy extension inside Chrome for Clipy (needs a one-time clipy chrome setup): no daemon, the extension records and uploads; start returns cdpHttpUrl and the recorded tab's url (opened in the background, never focused), --name titles the recording, the tab's sound is left out unless --tab-audio (detected speech would replace the marks as the transcript), mark/chapter (plain or --observed/--verdict, not --assert-*) are kept by the CLI and sent at stop as the transcript, stop waits for the upload and returns the link. --source chrome-for-clipy records ONE TAB (tab video + tab audio, no picker or gesture) inside the persistent Chrome for Clipy instance: the instance is started automatically (sign in once via clipy chrome start and the profile stays signed in), the recorded tab opens at --url, its CDP endpoint is always published as cdpUrl/cdpHttpUrl so drivers attach to the very browser being recorded, and stopping the session leaves Chrome for Clipy running; auth-capture flags and --user-data-dir are rejected for this source. --expose-cdp (web sessions) opens a CDP endpoint (cdpUrl/cdpHttpUrl in the state file + session start/status output) so your own tools can drive the page while it records; OFF by default (any local process could attach), and CLIPY_DISABLE_CDP=1 forces it off. `session run [start flags] -- <command…>` starts a session, runs the command with inherited stdio (env CLIPY_SESSION=1, plus CLIPY_CDP_URL when --expose-cdp, plus CLIPY_TARGET_ID/CLIPY_PAGE_WS_URL for the recorded tab with --source chrome-extension), then GUARANTEES cleanup: exit 0 uploads, any non-zero exit or signal discards (session abort) and propagates the child's code. It is the crash-safe wrapper, so a dead driver never records dead air. Accepts the same auth flags as record (--storage-state/--user-data-dir/--profile-directory/--cookie/--local-storage/--init-script; web only, rejected on --source mac-screen). `session run` exports CLIPY_SESSION_FILE to the child so mark/chapter resolve the session from any cwd. --json is supported on start/stop/status (start returns cdpUrl/cdpHttpUrl)", ["run", "--url", "--max", "--type", "--expected", "--source", "--window", "--display", "--x-display", "--virtual-display", "--tab-audio", "--expose-cdp", "--diagnostics", "--network-detail", "--storage-state", "--user-data-dir", "--profile-directory", "--cookie", "--local-storage", "--init-script", "--json"]),
6440
6530
  cmdDoc("mark", "clipy mark \"<text>\" [--observed \"<values>\" --verdict pass|fail] [--assert-selector <css> [--assert-text <substr>]] [--assert-url <glob>] [--fail-mode warn|abort] [--at <sec>|--ago <sec>] [--json]", "Drop a live-timestamped note into the active session. A mark carries at most ONE evidence provenance, and the two are labeled + tallied separately so they can never be pooled. DRIVER-ATTESTED (--observed '<values>' --verdict pass|fail, both required together): you drove the browser and report what YOU observed — renders '<text> [≈ ASSERT driver-attested; observed=<values>]' (pass) / '<text> [≈ FAILED driver-attested; observed=<values>]' (fail) — a HEDGE glyph, never ✓/✗, so a skim distinguishes provenance by shape alone and works in EVERY session type including --source mac-screen. Honesty rule: driver-attested means Clipy vouches the agent SAID it, not that Clipy verified it — put real observed values there. Combining --observed/--verdict with --assert-* is a usage error. CLIPY-VERIFIED assertion marks (Clipy-owned page only) make the note evidence Clipy itself checked: --assert-selector checks a CSS selector matches (its trimmed textContent is recorded as 'observed'); --assert-text requires that element's text to contain a substring (needs --assert-selector); --assert-url matches the page URL against a glob (** = any, * = any non-slash, no * = substring). The daemon evaluates against its live page and annotates the mark: pass ⇒ '<text> [assert ✓ verified-by-clipy; <observed>]', fail ⇒ '<text> [ASSERT ✗ verified-by-clipy; expected …; observed …]' — a false claim cannot read as fact. --fail-mode warn (default) records the ✗; --fail-mode abort DISCARDS the whole session on a failed assertion (no upload) and the CLI exits non-zero. If any assertion was attempted, a leading 0ms [verification] note is prepended, reporting the provenances as SEPARATE segments: '[verification] N clipy-verified: P passed, F failed, K unverified · M driver-attested: P passed, F failed' (a segment is omitted when empty; with only clipy-verified marks the legacy 'N assertion(s): …' rendering is byte-identical). --at <sec> stamps at an absolute recording time; --ago <sec> stamps N seconds before now (mutually exclusive). Assertions/backdating need a web session (rejected on --source mac-screen). Up to 200 marks per recording.", ["--observed", "--verdict", "--assert-selector", "--assert-text", "--assert-url", "--fail-mode", "--at", "--ago", "--json"]),
6441
6531
  cmdDoc("chapter", "clipy chapter \"<label>\" [--json]", "Mark a BEFORE/AFTER section boundary in the active recording (stored as '=== CHAPTER: <label> ==='). The PR-review shape: demo the base branch, run `clipy chapter \"AFTER — fix applied\"`, swap branches + restart the dev server, demo the fix — one video carrying both states. Works on web + --source mac-screen sessions.", ["--json"]),
6442
6532
  cmdDoc("doctor", "clipy doctor [--json]", "One-shot health check: API reachability (GET /api/health, with latency), API key + whoami round-trip, Mac agent bridge (exists/parses/pid/appVersion>=" + MIN_BRIDGE_APP_VERSION + "), Playwright resolvability (and the resolved path/node_modules dir), context/proof prerequisites (yt-dlp presence/path/version, ffmpeg + ffprobe presence/version, and whether that ffmpeg has libwebp), and install mode (npx/global/local) — each a pass/warn/fail with a fix hint; exits non-zero if any check fails. Read-only: it never installs anything, so a missing yt-dlp/ffmpeg reports WARN with the install command rather than silently downloading a binary. Run it first whenever an import, proof, or recording fails.", ["--json"]),
@@ -6573,6 +6663,15 @@ async function main() {
6573
6663
  for: { type: "string" },
6574
6664
  timeout: { type: "string" },
6575
6665
  url: { type: "string" },
6666
+ // recheck
6667
+ out: { type: "string" },
6668
+ plan: { type: "boolean", default: false },
6669
+ "no-upload": { type: "boolean", default: false },
6670
+ "settle-ms": { type: "string" },
6671
+ "nav-timeout-ms": { type: "string" },
6672
+ "max-steps": { type: "string" },
6673
+ "fail-on-divergence": { type: "boolean", default: false },
6674
+ "allow-destructive": { type: "boolean", default: false },
6576
6675
  name: { type: "string" },
6577
6676
  title: { type: "string" },
6578
6677
  description: { type: "string" },
@@ -6622,6 +6721,10 @@ async function main() {
6622
6721
  yes: { type: "boolean", default: false },
6623
6722
  "allow-delete": { type: "boolean", default: false },
6624
6723
  "clear-description": { type: "boolean", default: false },
6724
+ // What the recorder expected to happen (issue #741). Optional; shown to
6725
+ // agents as "Expected result" in the recording's AREC.
6726
+ expected: { type: "string" },
6727
+ "clear-expected": { type: "boolean", default: false },
6625
6728
  access: { type: "string" },
6626
6729
  create: { type: "string" },
6627
6730
  untag: { type: "string", multiple: true },
@@ -6644,6 +6747,7 @@ async function main() {
6644
6747
  help: { type: "boolean", short: "h", default: false },
6645
6748
  },
6646
6749
  });
6750
+ const expectedResult = values.expected?.trim() || undefined;
6647
6751
  if (values.version) {
6648
6752
  process.stdout.write(`${VERSION}\n`);
6649
6753
  return;
@@ -6859,7 +6963,7 @@ async function main() {
6859
6963
  case "upload": {
6860
6964
  const file = rest[0] ?? values.video;
6861
6965
  if (!file)
6862
- usageFail('usage: clipy upload <file.mp4|webm|mov> [--title "<t>"] [--type kind] [--access public|restricted|private] [--wait] [--json]', 2);
6966
+ usageFail('usage: clipy upload <file.mp4|webm|mov> [--title "<t>"] [--type kind] [--expected "<text>"] [--access public|restricted|private] [--wait] [--json]', 2);
6863
6967
  // Validated here, not by requireRecordingKind/parseNoteFlag, whose die()
6864
6968
  // would print prose and break the one-object --json contract.
6865
6969
  let uploadKind;
@@ -6878,6 +6982,7 @@ async function main() {
6878
6982
  name: (values.title ?? values.name)?.trim() || undefined,
6879
6983
  description: values.description?.trim() || undefined,
6880
6984
  recordingKind: uploadKind,
6985
+ expectedResult,
6881
6986
  notes: uploadNotes.map(parseNoteFlag),
6882
6987
  accessMode: values.access,
6883
6988
  wait: Boolean(values.wait),
@@ -6887,11 +6992,13 @@ async function main() {
6887
6992
  }
6888
6993
  case "update":
6889
6994
  if (!rest[0])
6890
- usageFail('usage: clipy update <id|url> [--title "<title>"] [--description "<text>" | --clear-description]', 2);
6995
+ usageFail('usage: clipy update <id|url> [--title "<title>"] [--description "<text>" | --clear-description] [--expected "<text>" | --clear-expected]', 2);
6891
6996
  await cmdUpdate(libraryDeps(ctx, json), rest[0], {
6892
6997
  title: values.title ?? values.name,
6893
6998
  description: values.description,
6894
6999
  clearDescription: Boolean(values["clear-description"]),
7000
+ expected: values.expected,
7001
+ clearExpected: Boolean(values["clear-expected"]),
6895
7002
  });
6896
7003
  return;
6897
7004
  case "share":
@@ -6992,6 +7099,22 @@ async function main() {
6992
7099
  });
6993
7100
  return;
6994
7101
  }
7102
+ case "recheck": {
7103
+ const numFlag = (v, fallback) => (v === undefined ? fallback : Number(v));
7104
+ await cmdRecheck(recheckDeps(ctx, json), rest[0], {
7105
+ startUrl: values.url?.trim() || undefined,
7106
+ outDir: values.out?.trim() || undefined,
7107
+ planOnly: Boolean(values.plan),
7108
+ upload: !values["no-upload"],
7109
+ settleMs: numFlag(values["settle-ms"], 800),
7110
+ navigationTimeoutMs: numFlag(values["nav-timeout-ms"], 5_000),
7111
+ maxSteps: numFlag(values["max-steps"], RECHECK_MAX_STEPS),
7112
+ failOnDivergence: Boolean(values["fail-on-divergence"]),
7113
+ allowDestructive: Boolean(values["allow-destructive"]),
7114
+ port: values.port === undefined ? undefined : Number(values.port),
7115
+ });
7116
+ return;
7117
+ }
6995
7118
  case "download":
6996
7119
  if (!rest[0])
6997
7120
  die("usage: clipy download <id|url> [-o <path>]", 2);
@@ -7091,6 +7214,7 @@ async function main() {
7091
7214
  undefined,
7092
7215
  description: values.description?.trim() || undefined,
7093
7216
  recordingKind: values.type ? requireRecordingKind(String(values.type)) : undefined,
7217
+ expectedResult,
7094
7218
  notes: (values.note ?? []).map(parseNoteFlag),
7095
7219
  wait: Boolean(values.wait),
7096
7220
  json,
@@ -7129,6 +7253,7 @@ async function main() {
7129
7253
  undefined,
7130
7254
  description: values.description?.trim() || undefined,
7131
7255
  recordingKind,
7256
+ expectedResult,
7132
7257
  window: values.window?.trim() || undefined,
7133
7258
  display: values.display?.trim() || undefined,
7134
7259
  xDisplay: values["x-display"]?.trim() || undefined,
@@ -7172,6 +7297,7 @@ async function main() {
7172
7297
  undefined,
7173
7298
  description: values.description?.trim() || undefined,
7174
7299
  recordingKind,
7300
+ expectedResult,
7175
7301
  window: values.window?.trim() || undefined,
7176
7302
  display: values.display?.trim() || undefined,
7177
7303
  notes: noteFlags.map(parseNoteFlag),
@@ -7210,6 +7336,7 @@ async function main() {
7210
7336
  undefined,
7211
7337
  description: values.description?.trim() || undefined,
7212
7338
  recordingKind,
7339
+ expectedResult,
7213
7340
  notes: noteFlags.map(parseNoteFlag),
7214
7341
  viewports: values.viewports ? parseViewports(String(values.viewports)) : null,
7215
7342
  width: num(values.width, 1280),
@@ -7267,6 +7394,7 @@ async function main() {
7267
7394
  undefined,
7268
7395
  description: values.description?.trim() || undefined,
7269
7396
  recordingKind: values.type ? requireRecordingKind(String(values.type)) : undefined,
7397
+ expectedResult,
7270
7398
  maxSec: num(values.max, SESSION_DEFAULT_MAX_SEC),
7271
7399
  width: num(values.width, 1280),
7272
7400
  height: num(values.height, 720),
package/dist/library.js CHANGED
@@ -48,7 +48,7 @@ function scopeRemedy(message) {
48
48
  return (`Your key does not carry ${missing.join(", ")}. Run \`${remedy}\` to approve a key that does, ` +
49
49
  `or create one at https://clipy.online/settings/api-keys. Retrying with the same key cannot help.`);
50
50
  }
51
- async function request(deps, method, path, body) {
51
+ export async function request(deps, method, path, body) {
52
52
  if (!deps.apiKey) {
53
53
  failure(deps, "auth_required", "no API key", "Run `clipy login` to approve this device in your browser, or set CLIPY_API_KEY.");
54
54
  }
@@ -104,7 +104,7 @@ async function request(deps, method, path, body) {
104
104
  }
105
105
  return parsed;
106
106
  }
107
- function recordingPath(deps, id, sub = "") {
107
+ export function recordingPath(deps, id, sub = "") {
108
108
  const pid = deps.normalizeId(id);
109
109
  return { pid, path: `/api/v1/recordings/${encodeURIComponent(pid)}${sub}` };
110
110
  }
@@ -134,8 +134,12 @@ export async function cmdUpdate(deps, id, opts) {
134
134
  patch.description = null;
135
135
  else if (opts.description !== undefined)
136
136
  patch.description = opts.description;
137
+ if (opts.clearExpected)
138
+ patch.expectedResult = null;
139
+ else if (opts.expected !== undefined)
140
+ patch.expectedResult = opts.expected.trim() || null;
137
141
  if (Object.keys(patch).length === 0) {
138
- usage(deps, 'usage: clipy update <id|url> [--title "<title>"] [--description "<text>" | --clear-description]');
142
+ usage(deps, 'usage: clipy update <id|url> [--title "<title>"] [--description "<text>" | --clear-description] [--expected "<text>" | --clear-expected]');
139
143
  }
140
144
  const { path } = recordingPath(deps, id);
141
145
  const body = await request(deps, "PATCH", path, patch);