@clipy/cli 0.12.0 → 0.13.1
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 +54 -18
- package/dist/browserLogin.js +2 -23
- package/dist/context/importCmd.js +160 -28
- package/dist/context/loom.js +30 -0
- package/dist/context/readCmd.js +8 -4
- package/dist/context/videoFetch.js +41 -20
- package/dist/context-core/arec.js +39 -4
- package/dist/context-core/index.js +1 -0
- package/dist/context-core/loom.js +293 -0
- package/dist/index.js +227 -63
- package/dist/openUrl.js +60 -0
- package/dist/proofFrames.js +4 -4
- package/dist/setup.js +203 -0
- package/dist/setupConfig.js +128 -0
- package/dist/setupTypes.js +7 -0
- package/dist/skill.js +34 -18
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -26,7 +26,9 @@ import { pathToFileURL } from "node:url";
|
|
|
26
26
|
import { createServer } from "node:net";
|
|
27
27
|
import { createServer as createHttpServer } from "node:http";
|
|
28
28
|
import { CLIPY_SKILL_MD } from "./skill.js";
|
|
29
|
+
import { SETUP_TARGETS, detectSetupTarget, isSetupTarget, registerMcpServer, renderSetupBox, shortPath, skillPathFor as setupSkillPathFor, } from "./setup.js";
|
|
29
30
|
import { browserLogin, shouldUseManualLogin } from "./browserLogin.js";
|
|
31
|
+
import { openUrl } from "./openUrl.js";
|
|
30
32
|
import { cmdContextImport } from "./context/importCmd.js";
|
|
31
33
|
import { cmdContextRead } from "./context/readCmd.js";
|
|
32
34
|
import { errorEnvelope } from "./context/errors.js";
|
|
@@ -302,12 +304,14 @@ ${c.bold("RECORDINGS")}
|
|
|
302
304
|
summary <id> [--json] AI summary: TL;DR, key points, action items
|
|
303
305
|
moments <id> [--json] Key moments (timestamps + captions + click coords)
|
|
304
306
|
context <id> Full agent-context bundle as markdown
|
|
305
|
-
context import <youtube-url|file> [--transcript <f>] [--output <dir>]
|
|
307
|
+
context import <youtube-url|loom-url|file> [--transcript <f>] [--output <dir>]
|
|
306
308
|
Compile ANY video into a local Clipy context
|
|
307
|
-
bundle (recording.
|
|
308
|
-
transcript.json). YouTube captions
|
|
309
|
-
on your machine — no
|
|
310
|
-
|
|
309
|
+
bundle (recording.arec + manifest.json +
|
|
310
|
+
transcript.json). YouTube captions and Loom
|
|
311
|
+
transcripts are fetched on your machine — no
|
|
312
|
+
media leaves it, and Loom needs no yt-dlp at
|
|
313
|
+
all. Local files need --transcript
|
|
314
|
+
<.vtt|.srt|.json>
|
|
311
315
|
--language <code> Caption language preference (default en)
|
|
312
316
|
--title <t> Override the bundle title
|
|
313
317
|
--tag <t> Tag for --sync (repeatable) · --folder <name>
|
|
@@ -317,7 +321,7 @@ ${c.bold("RECORDINGS")}
|
|
|
317
321
|
are then extracted locally and added to the bundle
|
|
318
322
|
--no-frames With --sync: take the verdict but never download media
|
|
319
323
|
--json Print {bundlePath, profile, classification, frames, …}
|
|
320
|
-
context read <bundle-path> Print a local bundle's recording.
|
|
324
|
+
context read <bundle-path> Print a local bundle's recording.arec
|
|
321
325
|
download <id> [-o <path>] Download the MP4
|
|
322
326
|
open <id> Open the share page in your browser
|
|
323
327
|
wait <id> [--for transcript|summary|both] [--timeout <sec>]
|
|
@@ -332,6 +336,7 @@ ${c.bold("PROOF")} ${c.dim("(tool-neutral evidence; needs an ingest-scoped API k
|
|
|
332
336
|
--hold <sec> Seconds to show each frame (default 3; 0.25–30)
|
|
333
337
|
--width/--height Even output dimensions, 320–3840 (default 1280×720)
|
|
334
338
|
proof --video <webm|mp4> Upload a video the agent/tool already recorded
|
|
339
|
+
--for <id|url> Link the proof back to the recording it verifies
|
|
335
340
|
--title/--description/--type/--note/--wait/--json
|
|
336
341
|
Same metadata, narration, processing wait, and JSON result
|
|
337
342
|
contract as record; no browser automation dependency
|
|
@@ -380,7 +385,7 @@ ${c.bold("SESSION")} ${c.dim("(agent works, Clipy records — one active session
|
|
|
380
385
|
--json gives each entry a "source" {kind,id,title}
|
|
381
386
|
matching what session start/record report, so you
|
|
382
387
|
can compare pick-vs-camera directly
|
|
383
|
-
--window "<title|app|id>" Record
|
|
388
|
+
--window "<title|app|id>" Record that window's current screen area (e.g. --window Chrome)
|
|
384
389
|
--display <id> Record a specific display
|
|
385
390
|
--mic Opt IN to microphone capture (default: mic OFF —
|
|
386
391
|
an agent recording for you is not the same consent
|
|
@@ -426,9 +431,16 @@ ${c.bold("SESSION")} ${c.dim("(agent works, Clipy records — one active session
|
|
|
426
431
|
session status Show the active session's state
|
|
427
432
|
|
|
428
433
|
${c.bold("AGENTS")}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
434
|
+
setup [claude|codex|cursor|windsurf|opencode]
|
|
435
|
+
Wire Clipy into a coding agent in ONE command:
|
|
436
|
+
sign in, install the skill, and register the MCP
|
|
437
|
+
server in that agent's own config. Detects the
|
|
438
|
+
agent it is running inside when you omit the name.
|
|
439
|
+
${c.dim("Published instructions: clipy.online/agent-setup/prompt.md")}
|
|
440
|
+
agents install <claude|codex|cursor|windsurf|opencode>
|
|
441
|
+
Skill only — no MCP, no login prompt beyond the
|
|
442
|
+
first-run one. Use ${c.bold("setup")} unless you deliberately
|
|
443
|
+
want just the skill file
|
|
432
444
|
agents status | uninstall <t> Show / remove installed skills
|
|
433
445
|
doctor [--json] Health check: API key, Mac agent bridge,
|
|
434
446
|
Playwright, and install mode — with fix hints
|
|
@@ -437,7 +449,8 @@ ${c.bold("AGENTS")}
|
|
|
437
449
|
playwright-path [--json] Print the node_modules dir of the Playwright
|
|
438
450
|
this CLI resolves, for your own driver scripts:
|
|
439
451
|
${c.dim("NODE_PATH=$(clipy playwright-path) node driver.js")}
|
|
440
|
-
transcript <id> --replace <file>
|
|
452
|
+
transcript <id> --replace <file> --revision <sha256>
|
|
453
|
+
Replace a transcript with agent-authored
|
|
441
454
|
JSON ({segments} or {plaintext}); regenerates
|
|
442
455
|
the summary ${c.dim("(needs the \"ingest\" permission)")}
|
|
443
456
|
mcp Run the Clipy MCP server (wraps: npx -y @clipy/mcp)
|
|
@@ -447,7 +460,8 @@ ${c.bold("GLOBAL FLAGS")}
|
|
|
447
460
|
--api-url <url> API base (else CLIPY_API_URL, default https://clipy.online)
|
|
448
461
|
--json Machine-readable output. Supported on: list, search, show,
|
|
449
462
|
transcript, summary, moments, wait, proof, record, session
|
|
450
|
-
start/stop/status, mark, chapter, doctor,
|
|
463
|
+
start/stop/status, mark, chapter, setup, agents, doctor,
|
|
464
|
+
playwright-path
|
|
451
465
|
-v, --version Print version
|
|
452
466
|
|
|
453
467
|
${c.bold("EXIT CODES")}
|
|
@@ -462,8 +476,10 @@ ${c.bold("EXIT CODES")}
|
|
|
462
476
|
"partial":null}. Branch on "code" (stable), never on the message text.
|
|
463
477
|
|
|
464
478
|
${c.bold("SETUP")}
|
|
465
|
-
|
|
466
|
-
|
|
479
|
+
${c.bold("clipy setup claude")} one command: sign in, install the skill, register MCP
|
|
480
|
+
${c.dim("(also: codex · cursor · windsurf · opencode — or omit to auto-detect)")}
|
|
481
|
+
|
|
482
|
+
Reading recordings by hand instead? ${c.bold("clipy login")}, then ${c.bold("clipy list")}.
|
|
467
483
|
|
|
468
484
|
Write commands — ${c.bold("proof")}, ${c.bold("record")}, ${c.bold("session")}/${c.bold("mark")}, and ${c.bold("transcript --replace")} — need a key
|
|
469
485
|
with the "ingest" permission. Everything else is read-only.
|
|
@@ -526,6 +542,7 @@ async function storeAndVerifyKey(ctx, key, meta, opts) {
|
|
|
526
542
|
if (ctx.apiUrl !== "https://clipy.online")
|
|
527
543
|
cfg.apiUrl = ctx.apiUrl;
|
|
528
544
|
writeConfig(cfg);
|
|
545
|
+
ctx.apiKey = key;
|
|
529
546
|
};
|
|
530
547
|
if (opts.storeFirst) {
|
|
531
548
|
store();
|
|
@@ -789,7 +806,8 @@ async function cmdMoments(ctx, id, json) {
|
|
|
789
806
|
}
|
|
790
807
|
}
|
|
791
808
|
async function cmdContext(ctx, id) {
|
|
792
|
-
const
|
|
809
|
+
const publicId = normalizeId(id, ctx);
|
|
810
|
+
const pid = encodeURIComponent(publicId);
|
|
793
811
|
const res = await api(ctx, `/api/agent-context/${pid}`, "text/markdown, text/plain, application/json");
|
|
794
812
|
const text = await res.text();
|
|
795
813
|
if (!res.ok) {
|
|
@@ -805,6 +823,20 @@ async function cmdContext(ctx, id) {
|
|
|
805
823
|
die(msg);
|
|
806
824
|
}
|
|
807
825
|
process.stdout.write(text.endsWith("\n") ? text : `${text}\n`);
|
|
826
|
+
try {
|
|
827
|
+
await ingestPostJson(ctx, `/api/v1/recordings/${pid}/agent-activity`, {
|
|
828
|
+
kind: "read",
|
|
829
|
+
source: "cli",
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
catch (error) {
|
|
833
|
+
// The context endpoint serves public recordings owned by anyone; the read
|
|
834
|
+
// receipt is owner-only, so a 404 just means "not this key's recording" —
|
|
835
|
+
// a normal shared-link read, not a failure worth warning about.
|
|
836
|
+
if (error.status !== 404) {
|
|
837
|
+
process.stderr.write(`${c.yellow("!")} agent read receipt failed: ${error.message}\n`);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
808
840
|
}
|
|
809
841
|
async function cmdDownload(ctx, id, outputPath) {
|
|
810
842
|
const pid = normalizeId(id, ctx);
|
|
@@ -857,17 +889,8 @@ function fmtBytes(n) {
|
|
|
857
889
|
async function cmdOpen(ctx, id) {
|
|
858
890
|
const pid = normalizeId(id, ctx);
|
|
859
891
|
const url = `${ctx.apiUrl}/video/${pid}`;
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
const args = platform === "win32" ? ["/c", "start", "", url] : [url];
|
|
863
|
-
try {
|
|
864
|
-
const child = spawn(opener, args, { detached: true, stdio: "ignore" });
|
|
865
|
-
child.unref();
|
|
866
|
-
process.stdout.write(`${c.green("✓")} opening ${c.cyan(url)}\n`);
|
|
867
|
-
}
|
|
868
|
-
catch {
|
|
869
|
-
process.stdout.write(`${url}\n`);
|
|
870
|
-
}
|
|
892
|
+
openUrl(url);
|
|
893
|
+
process.stdout.write(`${c.green("✓")} opening ${c.cyan(url)}\n`);
|
|
871
894
|
}
|
|
872
895
|
async function cmdWait(ctx, id, need, timeoutSec, json) {
|
|
873
896
|
const pid = encodeURIComponent(normalizeId(id, ctx));
|
|
@@ -1206,7 +1229,10 @@ async function doctorYtDlpCheck() {
|
|
|
1206
1229
|
return {
|
|
1207
1230
|
name: "yt-dlp",
|
|
1208
1231
|
status: "warn",
|
|
1209
|
-
|
|
1232
|
+
// Deliberately narrow: a Loom import compiles its transcript over plain
|
|
1233
|
+
// HTTPS and needs this binary only if the server later asks for frames,
|
|
1234
|
+
// so this must not read as "context import is unavailable".
|
|
1235
|
+
detail: "not installed, so `clipy context import <youtube-url>` cannot resolve YouTube yet (a Loom import still works; yt-dlp is only needed there for frames)",
|
|
1210
1236
|
hint: "Clipy auto-installs it into ~/.clipy/bin on first use; to pre-install run `brew install yt-dlp` (macOS), `pipx install yt-dlp`, or `python3 -m pip install -U yt-dlp`",
|
|
1211
1237
|
data: { present: false, path: null, version: null },
|
|
1212
1238
|
};
|
|
@@ -1436,18 +1462,23 @@ async function ingestPostJson(ctx, path, payload) {
|
|
|
1436
1462
|
if (!res.ok) {
|
|
1437
1463
|
const msg = (typeof body.error === "string" && body.error) || `Clipy API error ${res.status}`;
|
|
1438
1464
|
if (res.status === 401) {
|
|
1439
|
-
throw
|
|
1465
|
+
throw ingestError(`${msg}. Run \`clipy login\` with an ingest-scoped key.`, res.status);
|
|
1440
1466
|
}
|
|
1441
1467
|
if (res.status === 403) {
|
|
1442
|
-
throw
|
|
1443
|
-
`${ctx.apiUrl}/settings/api-keys (check "Record & upload")
|
|
1468
|
+
throw ingestError(`${msg}\nYour API key needs the "ingest" permission. Mint one at ` +
|
|
1469
|
+
`${ctx.apiUrl}/settings/api-keys (check "Record & upload").`, res.status);
|
|
1444
1470
|
}
|
|
1445
|
-
throw
|
|
1471
|
+
throw ingestError(msg, res.status);
|
|
1446
1472
|
}
|
|
1447
1473
|
return body;
|
|
1448
1474
|
}
|
|
1449
1475
|
throw new Error(`request failed after retries (${path})`);
|
|
1450
1476
|
}
|
|
1477
|
+
// Error with the HTTP status attached so callers can branch on it (e.g. the
|
|
1478
|
+
// best-effort read receipt treats owner-scope 404 as "not mine", not a failure).
|
|
1479
|
+
function ingestError(message, status) {
|
|
1480
|
+
return Object.assign(new Error(message), { status });
|
|
1481
|
+
}
|
|
1451
1482
|
/** Upload one chunk as multipart/form-data, retrying transient 429/5xx. */
|
|
1452
1483
|
async function ingestPostChunk(ctx, recordingId, uploadToken, partNumber, bytes, container = "webm") {
|
|
1453
1484
|
const key = requireKey(ctx);
|
|
@@ -1894,7 +1925,7 @@ async function uploadVideoToClipy(ctx, opts) {
|
|
|
1894
1925
|
shareUrl: `${ctx.apiUrl}/video/${publicId}`,
|
|
1895
1926
|
// The friendly content-negotiated form: markdown to agents, a rendered
|
|
1896
1927
|
// page to browsers. Same document as /api/agent-context/<id>.
|
|
1897
|
-
contextUrl: `${ctx.apiUrl}/video/${publicId}.
|
|
1928
|
+
contextUrl: `${ctx.apiUrl}/video/${publicId}.arec`,
|
|
1898
1929
|
sizeBytes,
|
|
1899
1930
|
container,
|
|
1900
1931
|
};
|
|
@@ -1920,6 +1951,12 @@ async function cmdProof(ctx, opts) {
|
|
|
1920
1951
|
die('proof notes use absolute timestamps such as --note "3: saved state"; passN notes need record --viewports', 2);
|
|
1921
1952
|
}
|
|
1922
1953
|
requireKey(ctx);
|
|
1954
|
+
const verificationFor = opts.verificationFor
|
|
1955
|
+
? normalizeId(opts.verificationFor, ctx)
|
|
1956
|
+
: null;
|
|
1957
|
+
if (verificationFor) {
|
|
1958
|
+
await apiJson(ctx, `/api/v1/recordings/${encodeURIComponent(verificationFor)}`);
|
|
1959
|
+
}
|
|
1923
1960
|
const tmpDir = join(tmpdir(), `clipy-proof-${randomUUID()}`);
|
|
1924
1961
|
let generatedVideo = false;
|
|
1925
1962
|
let videoPath = opts.videoPath ? resolve(opts.videoPath) : "";
|
|
@@ -1933,7 +1970,7 @@ async function cmdProof(ctx, opts) {
|
|
|
1933
1970
|
const narrationNotes = resolveNarrationNotes(opts.notes, [0]);
|
|
1934
1971
|
if (hasFrames) {
|
|
1935
1972
|
mkdirSync(tmpDir, { recursive: true });
|
|
1936
|
-
videoPath = join(tmpDir, "proof.
|
|
1973
|
+
videoPath = join(tmpDir, "proof.mp4");
|
|
1937
1974
|
log(c.dim(`assembling ${opts.framePaths.length} proof frame${opts.framePaths.length === 1 ? "" : "s"}…`));
|
|
1938
1975
|
const rendered = await renderProofFrames({
|
|
1939
1976
|
framePaths: opts.framePaths,
|
|
@@ -1972,6 +2009,18 @@ async function cmdProof(ctx, opts) {
|
|
|
1972
2009
|
sourceVersion: `cli-proof/${VERSION}`,
|
|
1973
2010
|
log,
|
|
1974
2011
|
});
|
|
2012
|
+
if (verificationFor) {
|
|
2013
|
+
try {
|
|
2014
|
+
await ingestPostJson(ctx, `/api/v1/recordings/${encodeURIComponent(verificationFor)}/agent-activity`, {
|
|
2015
|
+
kind: "verification",
|
|
2016
|
+
source: "cli",
|
|
2017
|
+
verificationPublicId: uploaded.publicId,
|
|
2018
|
+
});
|
|
2019
|
+
}
|
|
2020
|
+
catch (error) {
|
|
2021
|
+
throw new Error(`Proof uploaded at ${uploaded.shareUrl}, but linking it to ${verificationFor} failed: ${error.message}`);
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
1975
2024
|
if (opts.wait) {
|
|
1976
2025
|
await waitForArtifacts(ctx, uploaded.publicId);
|
|
1977
2026
|
}
|
|
@@ -1990,6 +2039,7 @@ async function cmdProof(ctx, opts) {
|
|
|
1990
2039
|
contextUrl: uploaded.contextUrl,
|
|
1991
2040
|
sizeBytes: uploaded.sizeBytes,
|
|
1992
2041
|
source,
|
|
2042
|
+
...(verificationFor ? { verifies: verificationFor } : {}),
|
|
1993
2043
|
});
|
|
1994
2044
|
}
|
|
1995
2045
|
else {
|
|
@@ -3437,7 +3487,7 @@ async function cmdSessionStop(json) {
|
|
|
3437
3487
|
publicId,
|
|
3438
3488
|
shareUrl: String(result.shareUrl ?? ""),
|
|
3439
3489
|
contextUrl: `https://clipy.online/api/agent-context/${publicId}`,
|
|
3440
|
-
sizeBytes: 0,
|
|
3490
|
+
sizeBytes: Number(result.sizeBytes ?? 0),
|
|
3441
3491
|
}, json);
|
|
3442
3492
|
return;
|
|
3443
3493
|
}
|
|
@@ -4338,19 +4388,120 @@ async function runSessionDaemon(file) {
|
|
|
4338
4388
|
// agents — install the bundled Clipy skill for a coding agent, so one command
|
|
4339
4389
|
// teaches Claude Code / Codex / Cursor how to read AND make recordings.
|
|
4340
4390
|
// ---------------------------------------------------------------------------
|
|
4341
|
-
const AGENT_TARGETS =
|
|
4391
|
+
const AGENT_TARGETS = SETUP_TARGETS;
|
|
4392
|
+
/** Real filesystem + subprocess access for the setup helpers. */
|
|
4393
|
+
function realSetupEnv() {
|
|
4394
|
+
return {
|
|
4395
|
+
home: homedir(),
|
|
4396
|
+
env: process.env,
|
|
4397
|
+
run: (command, args) => new Promise((resolveRun) => {
|
|
4398
|
+
// Every agent CLI we shell out to (claude, codex, …) installs on Windows
|
|
4399
|
+
// as a `.cmd` shim, and Node refuses to spawn those without a shell —
|
|
4400
|
+
// it fails ENOENT, which we then report as "not on PATH" even though the
|
|
4401
|
+
// command is right there. Safe here because both the command and the
|
|
4402
|
+
// args are fixed constants (MCP_COMMAND/MCP_ARGS), never user input.
|
|
4403
|
+
const child = spawn(command, [...args], {
|
|
4404
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
4405
|
+
shell: process.platform === "win32",
|
|
4406
|
+
});
|
|
4407
|
+
let stdout = "";
|
|
4408
|
+
let stderr = "";
|
|
4409
|
+
child.stdout?.on("data", (d) => (stdout += d.toString()));
|
|
4410
|
+
child.stderr?.on("data", (d) => (stderr += d.toString()));
|
|
4411
|
+
child.on("error", (e) => resolveRun({ code: -1, stdout, stderr, spawnError: e.message }));
|
|
4412
|
+
child.on("close", (code) => resolveRun({ code: code ?? 0, stdout, stderr }));
|
|
4413
|
+
}),
|
|
4414
|
+
};
|
|
4415
|
+
}
|
|
4342
4416
|
function skillPathFor(target) {
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4417
|
+
return setupSkillPathFor(target, realSetupEnv());
|
|
4418
|
+
}
|
|
4419
|
+
function writeSkillFile(path) {
|
|
4420
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
4421
|
+
writeFileSync(path, CLIPY_SKILL_MD);
|
|
4422
|
+
}
|
|
4423
|
+
// ---------------------------------------------------------------------------
|
|
4424
|
+
// setup — skill + MCP + login in one command, for an agent following the
|
|
4425
|
+
// published setup instructions at clipy.online/agent-setup/prompt.md.
|
|
4426
|
+
// ---------------------------------------------------------------------------
|
|
4427
|
+
async function cmdSetup(ctx, targetRaw, json) {
|
|
4428
|
+
const env = realSetupEnv();
|
|
4429
|
+
let target;
|
|
4430
|
+
if (targetRaw) {
|
|
4431
|
+
if (!isSetupTarget(targetRaw)) {
|
|
4432
|
+
failSetup(json, "invalid_target", `unknown agent "${targetRaw}"`, `Choose one of: ${SETUP_TARGETS.join(", ")}.`, null, 2);
|
|
4350
4433
|
}
|
|
4351
|
-
|
|
4352
|
-
return join(home, ".cursor", "skills", "clipy", "SKILL.md");
|
|
4434
|
+
target = targetRaw;
|
|
4353
4435
|
}
|
|
4436
|
+
else {
|
|
4437
|
+
target = detectSetupTarget(env.env);
|
|
4438
|
+
}
|
|
4439
|
+
if (!target) {
|
|
4440
|
+
failSetup(json, "target_detection_failed", "could not determine the current agent", `Run clipy setup <${SETUP_TARGETS.join("|")}>.`, null, 2);
|
|
4441
|
+
}
|
|
4442
|
+
if (!ctx.apiKey && json) {
|
|
4443
|
+
failSetup(true, "authentication_required", "setup cannot complete without a Clipy credential", "Run clipy setup without --json to approve browser sign-in, or set CLIPY_API_KEY before retrying.");
|
|
4444
|
+
}
|
|
4445
|
+
if (!ctx.apiKey) {
|
|
4446
|
+
process.stdout.write(`${c.dim("No Clipy API key found — signing you in first…")}\n`);
|
|
4447
|
+
await loginWithBrowser(ctx, shouldUseManualLogin());
|
|
4448
|
+
}
|
|
4449
|
+
if (!ctx.apiKey) {
|
|
4450
|
+
failSetup(json, "authentication_failed", "setup did not obtain a Clipy credential", "Run clipy login, then retry setup.");
|
|
4451
|
+
}
|
|
4452
|
+
const skillPath = setupSkillPathFor(target, env);
|
|
4453
|
+
let mcp;
|
|
4454
|
+
try {
|
|
4455
|
+
mcp = await registerMcpServer(target, env);
|
|
4456
|
+
}
|
|
4457
|
+
catch (error) {
|
|
4458
|
+
failSetup(json, "mcp_registration_failed", `could not register the Clipy MCP server: ${error.message}`, "Fix the reported config or permission error, then retry setup.");
|
|
4459
|
+
}
|
|
4460
|
+
if (mcp.method === "manual") {
|
|
4461
|
+
const instruction = mcp.command
|
|
4462
|
+
? `Run: ${mcp.command}`
|
|
4463
|
+
: `Merge this into ${mcp.path ?? "the agent MCP config"}:\n${mcp.snippet ?? ""}`;
|
|
4464
|
+
failSetup(json, "mcp_registration_incomplete", mcp.reason ?? "the Clipy MCP server needs a manual registration step", instruction, {
|
|
4465
|
+
target,
|
|
4466
|
+
skill: { installed: false, path: skillPath },
|
|
4467
|
+
mcp,
|
|
4468
|
+
authenticated: true,
|
|
4469
|
+
});
|
|
4470
|
+
}
|
|
4471
|
+
try {
|
|
4472
|
+
writeSkillFile(skillPath);
|
|
4473
|
+
}
|
|
4474
|
+
catch (error) {
|
|
4475
|
+
failSetup(json, "skill_install_failed", `the MCP server was registered, but the skill could not be installed: ${error.message}`, `Fix permissions for ${skillPath}, then retry setup.`, { target, skill: { installed: false, path: skillPath }, mcp, authenticated: true });
|
|
4476
|
+
}
|
|
4477
|
+
if (json) {
|
|
4478
|
+
printJson({
|
|
4479
|
+
ok: true,
|
|
4480
|
+
target,
|
|
4481
|
+
skill: { installed: true, path: skillPath },
|
|
4482
|
+
mcp,
|
|
4483
|
+
authenticated: true,
|
|
4484
|
+
restartRequired: true,
|
|
4485
|
+
docs: "https://clipy.online/agent-setup/prompt.md",
|
|
4486
|
+
});
|
|
4487
|
+
return;
|
|
4488
|
+
}
|
|
4489
|
+
const short = (p) => shortPath(p, env.home);
|
|
4490
|
+
const rows = [
|
|
4491
|
+
`✓ Skill ${short(skillPath)}`,
|
|
4492
|
+
`✓ MCP ${mcp.path ? short(mcp.path) : (mcp.command ?? target)}${mcp.alreadyPresent && !mcp.changed ? " (already registered)" : ""}`,
|
|
4493
|
+
`✓ Signed in`,
|
|
4494
|
+
"",
|
|
4495
|
+
"→ Restart your agent to load the MCP server",
|
|
4496
|
+
];
|
|
4497
|
+
process.stdout.write(`${renderSetupBox("Clipy setup complete", rows)}\n`);
|
|
4498
|
+
}
|
|
4499
|
+
function failSetup(json, code, error, remediation, partial = null, exitCode = 1) {
|
|
4500
|
+
if (json) {
|
|
4501
|
+
printJson({ ok: false, code, error, remediation, partial });
|
|
4502
|
+
process.exit(exitCode);
|
|
4503
|
+
}
|
|
4504
|
+
die(`${error}\n${remediation}`, exitCode);
|
|
4354
4505
|
}
|
|
4355
4506
|
async function cmdAgents(ctx, sub, targetRaw, json) {
|
|
4356
4507
|
if (sub === "status" || sub === undefined) {
|
|
@@ -4372,7 +4523,7 @@ async function cmdAgents(ctx, sub, targetRaw, json) {
|
|
|
4372
4523
|
for (const s of status) {
|
|
4373
4524
|
process.stdout.write(`${s.installed ? c.green("✓ installed") : c.dim("— not installed")} ${s.target.padEnd(7)} ${c.dim(s.path)}\n`);
|
|
4374
4525
|
}
|
|
4375
|
-
process.stdout.write(`${c.dim("install with:")} clipy agents install
|
|
4526
|
+
process.stdout.write(`${c.dim("install with:")} clipy agents install <${AGENT_TARGETS.join("|")}>\n`);
|
|
4376
4527
|
return;
|
|
4377
4528
|
}
|
|
4378
4529
|
const target = targetRaw;
|
|
@@ -4391,8 +4542,7 @@ async function cmdAgents(ctx, sub, targetRaw, json) {
|
|
|
4391
4542
|
process.stdout.write(`${c.dim("No Clipy API key found — signing you in first…")}\n`);
|
|
4392
4543
|
await loginWithBrowser(ctx, shouldUseManualLogin());
|
|
4393
4544
|
}
|
|
4394
|
-
|
|
4395
|
-
writeFileSync(path, CLIPY_SKILL_MD);
|
|
4545
|
+
writeSkillFile(path);
|
|
4396
4546
|
if (json) {
|
|
4397
4547
|
printJson({ installed: true, target, path });
|
|
4398
4548
|
return;
|
|
@@ -4423,13 +4573,15 @@ async function cmdAgents(ctx, sub, targetRaw, json) {
|
|
|
4423
4573
|
// command's shape without trial-and-error. Bump GUIDE_SCHEMA_VERSION when the
|
|
4424
4574
|
// contract changes.
|
|
4425
4575
|
// ---------------------------------------------------------------------------
|
|
4426
|
-
const GUIDE_SCHEMA_VERSION =
|
|
4576
|
+
const GUIDE_SCHEMA_VERSION = 16;
|
|
4427
4577
|
/** The stable machine-readable failure taxonomy carried in `--json` error
|
|
4428
4578
|
* envelopes. Codes are the contract; messages are not. Published through the
|
|
4429
4579
|
* guide so an agent discovers the full recovery table without the skill. */
|
|
4430
4580
|
const GUIDE_ERROR_CODES = [
|
|
4431
4581
|
{ code: "invalid_url", meaning: "the URL is not a video Clipy can resolve", retryable: false, remediation: "re-read the URL with the user; retrying the same string cannot help" },
|
|
4432
|
-
{ code: "no_captions", meaning: "the YouTube video
|
|
4582
|
+
{ code: "no_captions", meaning: "the source publishes no transcript: a YouTube video with captions in no language, or one of the ~16% of Loom videos with no transcript recorded", retryable: false, remediation: "there is nothing to transcribe from, so re-run with --transcript <.vtt|.srt|json>, or proceed without the video" },
|
|
4583
|
+
{ code: "loom_unreachable", meaning: "loom.com or its transcript CDN could not be reached, or answered with something unusable", retryable: true, remediation: "usually transient, so re-run the SAME command once after a short pause; if it repeats, it is a network/proxy problem, not a bad link" },
|
|
4584
|
+
{ code: "source_private", meaning: "the video exists but is private or password-protected, so its transcript cannot be read", retryable: false, remediation: "ask the owner for a public share link, or import an exported copy with --transcript; re-running the same URL cannot help" },
|
|
4433
4585
|
{ code: "ytdlp_missing", meaning: "yt-dlp could not be resolved or auto-installed", retryable: true, remediation: "let Clipy auto-install it into ~/.clipy/bin, or install it yourself (brew install yt-dlp / pipx install yt-dlp), then re-run; `clipy doctor --json` reports the path it tried" },
|
|
4434
4586
|
{ code: "ytdlp_download_403", meaning: "YouTube refused the media download (frames could not be extracted)", retryable: false, remediation: "the CLI already retried internally — do NOT loop. If the transcript synced, the import is usable: report frames as pending and re-run the same command later" },
|
|
4435
4587
|
{ code: "ffmpeg_missing", meaning: "ffmpeg/ffprobe is not installed or not on PATH", retryable: true, remediation: "brew install ffmpeg (macOS) / sudo apt install ffmpeg (Linux) / winget install Gyan.FFmpeg, then re-run the same command" },
|
|
@@ -4497,24 +4649,25 @@ function cmdGuide(json) {
|
|
|
4497
4649
|
cmdDoc("memory search", "clipy memory search <query> [--kind recording|context]… [--limit N] [--json]", "Hybrid semantic + keyword search across the user's own screen recordings and imported/watched context. Results include kind, publicId, title, timestamp/span, resolution, plain-text snippet, scores, and a deep link. Read semantic.status before trusting an empty result: unavailable/failed means keyword-only fallback. lexical/refined resolutions are exact moments; window is a span; document has no exact timestamp.", ["--kind recording|context", "--limit N", "--json"]),
|
|
4498
4650
|
cmdDoc("search", "clipy search <query> [--json]", "Full-text search titles + descriptions"),
|
|
4499
4651
|
cmdDoc("show", "clipy show <id|url> [--json]", "One recording's metadata + share link"),
|
|
4500
|
-
cmdDoc("transcript", "clipy transcript <id> [--marks-only] [--srt|--vtt|--json] | clipy transcript <id> --replace <file.json|-> ", "Print the transcript, or REPLACE it (ingest scope; file holds {segments:[{start,end,text}]} or {plaintext}; regenerates the summary). Default text output is ONE ENTRY PER LINE, chronological and timestamp-prefixed, from the same segments --srt/--vtt use — an agent-narration transcript is a list of discrete marks, and concatenating them into one run-on paragraph made it unreadable. --marks-only drops [auto] instrumentation lines (navigations, console errors) so only the narration a human wrote remains; it applies to the default text output (--srt/--vtt/--json are unaffected). A transcript with no segments falls back to plaintext, and --json still carries the raw plaintext for scripts that want the old shape.", ["--marks-only", "--srt", "--vtt", "--json", "--replace <file>"]),
|
|
4652
|
+
cmdDoc("transcript", "clipy transcript <id> [--marks-only] [--srt|--vtt|--json] | clipy transcript <id> --replace <file.json|-> --revision <sha256>", "Print the transcript, or REPLACE it (ingest scope; first read --json and pass its revision; file holds {segments:[{start,end,text}]} or {plaintext}; regenerates the summary). Default text output is ONE ENTRY PER LINE, chronological and timestamp-prefixed, from the same segments --srt/--vtt use — an agent-narration transcript is a list of discrete marks, and concatenating them into one run-on paragraph made it unreadable. --marks-only drops [auto] instrumentation lines (navigations, console errors) so only the narration a human wrote remains; it applies to the default text output (--srt/--vtt/--json are unaffected). A transcript with no segments falls back to plaintext, and --json still carries the raw plaintext for scripts that want the old shape.", ["--marks-only", "--srt", "--vtt", "--json", "--replace <file>", "--revision <sha256>"]),
|
|
4501
4653
|
cmdDoc("summary", "clipy summary <id> [--json]", "AI summary: TL;DR, key points, action items"),
|
|
4502
4654
|
cmdDoc("moments", "clipy moments <id> [--json]", "Key moments: timestamps, captions, click coords"),
|
|
4503
4655
|
cmdDoc("context", "clipy context <id>", "Full agent-context bundle as markdown"),
|
|
4504
|
-
cmdDoc("context import", "clipy context import <youtube-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.
|
|
4505
|
-
cmdDoc("context read", "clipy context read <bundle-path>", "Print a local bundle's recording.
|
|
4656
|
+
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"]),
|
|
4657
|
+
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."),
|
|
4506
4658
|
cmdDoc("download", "clipy download <id> [-o path]", "Download the MP4"),
|
|
4507
4659
|
cmdDoc("open", "clipy open <id>", "Open the share page in a browser"),
|
|
4508
4660
|
cmdDoc("wait", "clipy wait <id> [--for transcript|summary|both] [--timeout sec]", "Block until artifacts are ready"),
|
|
4509
|
-
cmdDoc("proof", "clipy proof (--frame <png|jpg|webp>… | --video <webm|mp4>) [--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 silent
|
|
4510
|
-
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 mac-screen: records the real screen via the Clipy Mac app (--type not yet applied on mac; auth flags rejected — the screen is already logged in); --window '<title|app|id>'
|
|
4511
|
-
cmdDoc("session", "clipy session <start|run|stop|abort|status> [--url <url>] [--max sec] [--type kind] [--source web|mac-screen] [--window w] [--display d] [--expose-cdp] [--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).
|
|
4661
|
+
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"]),
|
|
4662
|
+
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 mac-screen: records the real screen via the Clipy Mac app (--type not yet applied on mac; auth flags rejected — the screen is already logged in); --window '<title|app|id>' records that window's initial screen area and --display <id> records one display (ids from clipy sources). --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", "--json"]),
|
|
4663
|
+
cmdDoc("session", "clipy session <start|run|stop|abort|status> [--url <url>] [--max sec] [--type kind] [--source web|mac-screen] [--window w] [--display d] [--expose-cdp] [--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). With --source mac-screen, --window records that window's initial screen area and --display records one display. --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), then GUARANTEES cleanup: exit 0 uploads, any non-zero exit or signal discards (session abort) and propagates the child's code — 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", "--expose-cdp", "--storage-state", "--user-data-dir", "--profile-directory", "--cookie", "--local-storage", "--init-script", "--json"]),
|
|
4512
4664
|
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"]),
|
|
4513
4665
|
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"]),
|
|
4514
4666
|
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"]),
|
|
4515
4667
|
cmdDoc("playwright-path", "clipy playwright-path [--json]", "Print the node_modules directory of the Playwright this CLI resolves, so your own --expose-cdp driver scripts can load the same copy: NODE_PATH=$(clipy playwright-path) node driver.js. Exits 1 (empty stdout) if Playwright is unresolvable. --json prints {path, nodeModulesDir, source}", ["--json"]),
|
|
4516
4668
|
cmdDoc("sources", "clipy sources [--json]", "List displays + windows the Clipy Mac app can capture — ids feed --window/--display. --json gives each entry a `source` {kind,id,title} in the SAME shape session start/record report for the resolved capture, so a caller can compare what it picked against what the camera reports without transforming either."),
|
|
4517
|
-
cmdDoc("
|
|
4669
|
+
cmdDoc("setup", "clipy setup [claude|codex|cursor|windsurf|opencode] [--json]", "Wire Clipy into one coding agent in a single command: sign in if needed, install the bundled skill, and register the MCP server in that agent's own config (`claude`/`codex` through their own `mcp add`; `cursor`/`windsurf`/`opencode` by merging their JSON config, never replacing other servers). Omit the agent to auto-detect from the environment — ambiguous or unknown exits 2 rather than guessing. Re-running is safe. Successful --json output is {ok:true, target, skill:{installed,path}, mcp:{method,path,changed,alreadyPresent}, authenticated:true, restartRequired:true}. Failures use {ok:false,code,error,remediation,partial}; partial.mcp.method 'manual' means the caller must run partial.mcp.command or paste partial.mcp.snippet before setup is complete. The MCP server is read at agent startup, so the calling session will not see the tools until it restarts.", ["--json"]),
|
|
4670
|
+
cmdDoc("agents", "clipy agents <status|install|uninstall> <claude|codex|cursor|windsurf|opencode>", "Skill file only — does NOT register MCP. `clipy setup` is the one-command form; install triggers a browser login first when no key is configured (interactive terminals only)"),
|
|
4518
4671
|
cmdDoc("guide", "clipy guide --json", "This manifest"),
|
|
4519
4672
|
cmdDoc("mcp", "clipy mcp", "Run the Clipy MCP server (wraps npx -y @clipy/mcp)"),
|
|
4520
4673
|
],
|
|
@@ -4527,7 +4680,7 @@ function cmdGuide(json) {
|
|
|
4527
4680
|
"--note is absolute ('12: text') or pass-scoped ('pass2: text' / 'pass2@5: text'); pass-scoped notes anchor to the real start of a --viewports pass, so they don't drift when load time shifts the pass boundaries. A malformed pass note (e.g. 'pass2 text' with no colon) is a usage error, not silently demoted.",
|
|
4528
4681
|
"--type declares what a recording IS (bug_report/feature_request/product_demo/walkthrough_tutorial/feedback_review/discussion_talk/other, plus short aliases) so the AI summary doesn't misread a demo as a bug report. Applied on web today; --source mac-screen support is pending a Clipy app update.",
|
|
4529
4682
|
"AUDIO on --source mac-screen: agent screen recordings do NOT capture the microphone by default (system audio ON, mic OFF). An agent recording on your behalf is not the same consent as a human clicking Record — nobody asked for the room, or whatever call you are on, to be captured — and agent narration rides on marks, not speech. Opt in with --mic; opt out of system audio with --no-system-audio. Both are --source mac-screen only: headless web captures are silent, so passing them on the web path is a usage error (exit 2). The resolved config is printed (`audio: system on, mic off`) and returned as a sibling `audio` {includeSystemAudio, includeMic} in --json — sibling, not inside `source`, because audio is a property of the capture, not of the surface. IMPORTANT: the CLI reports the config the APP echoed back, and if the app does not echo one (a desktop build predating agent audio control) it WARNS that the app is using its own defaults and the microphone may be recording — update the Clipy app to make the setting take effect.",
|
|
4530
|
-
"CONFIRM THE CAMERA on --source mac-screen. `session start` and `record` print the surface they resolved, read LIVE from the app at start time — `recording window: \"<title>\" (id 157)` — and `session start --json` / `record --json` carry it as `source: {kind, id, title}`, the SAME shape each entry's `source` takes in `clipy sources --json`, so a caller can compare its pick against the camera with a direct object comparison. Check it and abort on mismatch: driver-attested marks prove what the DRIVER observed and say nothing about what the camera saw, so driving a background tab of the recorded window yields a truthful 'N passed' tally over footage of something else — worse than no evidence, because the tally vouches for the wrong footage. Clipy will NEVER activate or foreground a window/tab: it cannot know which tab/page/simulator you mean (on mac-screen it may not be recording a browser at all), so focusing the right surface is the caller's job, done before session start. The reported title
|
|
4683
|
+
"CONFIRM THE CAMERA on --source mac-screen. `session start` and `record` print the surface they resolved, read LIVE from the app at start time — `recording window: \"<title>\" (id 157)` — and `session start --json` / `record --json` carry it as `source: {kind, id, title}`, the SAME shape each entry's `source` takes in `clipy sources --json`, so a caller can compare its pick against the camera with a direct object comparison. Check it and abort on mismatch: driver-attested marks prove what the DRIVER observed and say nothing about what the camera saw, so driving a background tab of the recorded window yields a truthful 'N passed' tally over footage of something else — worse than no evidence, because the tally vouches for the wrong footage. Clipy will NEVER activate or foreground a window/tab: it cannot know which tab/page/simulator you mean (on mac-screen it may not be recording a browser at all), so focusing the right surface is the caller's job, done before session start. The reported title and screen area are fixed at START time; moving the window does not move the recording, and anything entering that area is filmed.",
|
|
4531
4684
|
"Clipy is a RECORDER, not a driver. When you drive the browser yourself (the usual agent case), the primary path is: record the real app (--source mac-screen --window '<app>', or your own driven browser) and attach evidence with driver-attested marks — `clipy mark \"<claim>\" --observed \"<values you read>\" --verdict pass|fail` — plus `clipy chapter` for before/after. Clipy holds the ledger; it does not drive. The owned-browser auth flags (--storage-state/--user-data-dir/--profile-directory/--cookie/--local-storage/--init-script) are the AGENTLESS/CI fallback for when nothing is driving and Clipy needs its own logged-in context. Provenance is never pooled: driver-attested marks render '[≈ ASSERT driver-attested; observed=…]' / '[≈ FAILED …]' (hedge glyph) and clipy-evaluated ones '[assert ✓ verified-by-clipy; …]' / '[ASSERT ✗ verified-by-clipy; …]' (✓/✗ are reserved for what Clipy itself checked), and the [verification] note counts them in separate segments. The honesty rule: driver-attested means Clipy vouches the agent SAID it, not that Clipy verified it.",
|
|
4532
4685
|
"Assertion marks are the differentiator: assert what you claim. `clipy mark \"X\" --assert-selector '.status' --assert-text Active` records X only alongside the live-page truth — the daemon runs the check against its Playwright page and annotates the mark ✓/✗ with what it actually observed, so a false claim cannot pass as fact in the transcript. --fail-mode abort turns a failed assertion into a discarded session (nothing uploaded, non-zero exit). Assertions need a web session and the daemon's control endpoint (started by clipy 0.6+); they are rejected on --source mac-screen.",
|
|
4533
4686
|
"A mark is NEVER dropped, and a late verdict never rewrites it. If the daemon can't be reached to evaluate an assertion (its event loop briefly starved during a dev-server recompile), `clipy mark` records the narration anyway tagged '[ASSERT ⚠ clipy could not evaluate — <reason>]', prints a loud ⚠, and exits 0 — an unverified claim is flagged, never promoted to a ✓. The tally's third bucket counts these: '[verification] N assertion(s): P passed, F failed, K unverified' (the ', K unverified' clause is omitted when K=0). That ⚠ is the MARK OF RECORD: if the daemon was only slow and evaluates the same claim later, that verdict judged a LATER page state, so it does NOT overwrite the ⚠ — it's recorded as a separate '[late check of \"…\" — evaluated Ns after the claim: …]' note at its own time and counts toward none of P/F/K. Plain non-asserted marks the daemon later processes are just deduped (exactly once).",
|
|
@@ -4540,7 +4693,7 @@ function cmdGuide(json) {
|
|
|
4540
4693
|
"Recording a real Chrome profile: --user-data-dir is the user-data ROOT (the dir with 'Local State'), NOT a profile subdir — pointing it at a 'Default'/'Profile N' dir is refused (Chromium would mint a blank logged-out Default inside your real profile), with a hint to pass the parent + --profile-directory. --profile-directory '<name>' selects a named profile: Playwright's launchPersistentContext IGNORES an in-place --profile-directory switch (verified: it's stripped and Default always loads), so Clipy COPIES <root>/<name> into a temp 0700 scratch root's Default/ (+ the root's 'Local State'; skipping Singleton-locks and Cache/Code Cache/GPUCache/Service Worker CacheStorage), launches the copy, and deletes it after upload. The copy is disclosed loudly on stderr (never silent — that's the whole point), the real profile is never opened or written, a running Chrome only draws a warning (in-use DBs may copy inconsistently), and a stranded copy from a SIGKILL is swept after 24h at the next record/session start.",
|
|
4541
4694
|
"clipy record gates its capture clock on the first non-blank frame (up to a 10s cap, then starts anyway) so notes aren't anchored to a still-compiling t=0.",
|
|
4542
4695
|
"Run `clipy doctor` first when record/session or --source mac-screen fails — it names the exact missing piece (key, bridge socket/handshake/version, Playwright, install mode).",
|
|
4543
|
-
"Public recordings have
|
|
4696
|
+
"Public recordings have a canonical unauthenticated AREC document at https://clipy.online/video/<id>.arec; .md remains a byte-identical compatibility alias.",
|
|
4544
4697
|
"READING AN IMPORT WITHOUT DROWNING IN IT. Imported videos are often an hour or more, so read in widening passes rather than pulling the whole document. (1) Metadata + classification first — `clipy context read` opens with the self-describing header (source, duration, video type, whether the words stand alone, and the timestamps the classifier flagged as blind); over MCP `get_context_document` returns exactly that WITHOUT the transcript, the cheapest possible orientation. (2) Then the targeted span — the document is sectioned in [MM:SS] blocks and MCP `read_context_document` takes startMs/endMs, returning only overlapping sections (and reporting how many it withheld), so a two-hour video costs two minutes of context. (3) Frames LAST, and only at the timestamps the classifier said the transcript cannot carry. Whole-document reads are for short videos (~under 10 minutes) or when you genuinely need every word.",
|
|
4545
4698
|
"FAILURE RECOVERY. Under --json every command's error is a stable-code envelope {ok:false, error:{code,message,hint}} — see errorCodes for the full table with per-code remediation. The three an agent actually hits: auth_required (401) ⇒ run `clipy login` and WAIT for the user to approve in the browser it opens, saying out loud that you are waiting (a silently blocking agent looks hung); quota_exceeded (429) ⇒ report the limit to the user and STOP, never retry-loop; ytdlp_download_403 ⇒ the CLI already retried internally, so treat the import as done-but-incomplete, tell the user frames are pending, and move on with the transcript. When you cannot tell which state you are in, run `clipy doctor --json` — it reports yt-dlp, ffmpeg, auth, and API reachability in one call.",
|
|
4546
4699
|
"PARTIAL SUCCESS IS SUCCESS. A context import whose transcript synced while frames failed produces a real, readable document. Complete it by re-running the SAME import command on the SAME source (imports are idempotent and resolve to the same document); never re-import from scratch and never delete the partial first — see partialSuccess.",
|
|
@@ -4548,7 +4701,10 @@ function cmdGuide(json) {
|
|
|
4548
4701
|
});
|
|
4549
4702
|
}
|
|
4550
4703
|
/** transcript --replace: PUT agent-authored transcript content. */
|
|
4551
|
-
async function cmdTranscriptReplace(ctx, id, file) {
|
|
4704
|
+
async function cmdTranscriptReplace(ctx, id, file, revision) {
|
|
4705
|
+
if (!/^[a-f0-9]{64}$/.test(revision)) {
|
|
4706
|
+
die("--revision must be the 64-character revision returned by `clipy transcript <id> --json`", 2);
|
|
4707
|
+
}
|
|
4552
4708
|
const pid = encodeURIComponent(normalizeId(id, ctx));
|
|
4553
4709
|
let raw;
|
|
4554
4710
|
if (file === "-") {
|
|
@@ -4572,7 +4728,7 @@ async function cmdTranscriptReplace(ctx, id, file) {
|
|
|
4572
4728
|
"Content-Type": "application/json",
|
|
4573
4729
|
"User-Agent": `clipy-cli/${VERSION}`,
|
|
4574
4730
|
},
|
|
4575
|
-
body: JSON.stringify(payload),
|
|
4731
|
+
body: JSON.stringify({ ...payload, expectedRevision: revision }),
|
|
4576
4732
|
});
|
|
4577
4733
|
const text = await res.text();
|
|
4578
4734
|
let body = {};
|
|
@@ -4644,6 +4800,7 @@ async function main() {
|
|
|
4644
4800
|
viewports: { type: "string" },
|
|
4645
4801
|
max: { type: "string" },
|
|
4646
4802
|
replace: { type: "string" },
|
|
4803
|
+
revision: { type: "string" },
|
|
4647
4804
|
transcript: { type: "string" },
|
|
4648
4805
|
language: { type: "string" },
|
|
4649
4806
|
folder: { type: "string" },
|
|
@@ -4800,9 +4957,12 @@ async function main() {
|
|
|
4800
4957
|
return;
|
|
4801
4958
|
case "transcript": {
|
|
4802
4959
|
if (!rest[0])
|
|
4803
|
-
die("usage: clipy transcript <id|url> [--srt|--vtt|--json]
|
|
4960
|
+
die("usage: clipy transcript <id|url> [--srt|--vtt|--json] | --replace <file.json|-> --revision <sha256>", 2);
|
|
4804
4961
|
if (values.replace) {
|
|
4805
|
-
|
|
4962
|
+
if (!values.revision) {
|
|
4963
|
+
die("--revision is required with --replace; read the current transcript with --json first", 2);
|
|
4964
|
+
}
|
|
4965
|
+
await cmdTranscriptReplace(ctx, rest[0], String(values.replace), String(values.revision));
|
|
4806
4966
|
return;
|
|
4807
4967
|
}
|
|
4808
4968
|
const fmt = json ? "json" : values.srt ? "srt" : values.vtt ? "vtt" : "text";
|
|
@@ -4825,7 +4985,7 @@ async function main() {
|
|
|
4825
4985
|
// by that name, which is why they can never be confused for one.
|
|
4826
4986
|
if (rest[0] === "import") {
|
|
4827
4987
|
if (!rest[1])
|
|
4828
|
-
die("usage: clipy context import <youtube-url|local-file> [--transcript <f>] [--output <dir>] [--sync]", 2);
|
|
4988
|
+
die("usage: clipy context import <youtube-url|loom-url|local-file> [--transcript <f>] [--output <dir>] [--sync]", 2);
|
|
4829
4989
|
try {
|
|
4830
4990
|
await cmdContextImport(rest[1], {
|
|
4831
4991
|
apiUrl: ctx.apiUrl,
|
|
@@ -4901,6 +5061,9 @@ async function main() {
|
|
|
4901
5061
|
case "playwright-path":
|
|
4902
5062
|
await cmdPlaywrightPath(json);
|
|
4903
5063
|
return;
|
|
5064
|
+
case "setup":
|
|
5065
|
+
await cmdSetup(ctx, rest[0], json);
|
|
5066
|
+
return;
|
|
4904
5067
|
case "agents":
|
|
4905
5068
|
await cmdAgents(ctx, rest[0], rest[1], json);
|
|
4906
5069
|
return;
|
|
@@ -4957,6 +5120,7 @@ async function main() {
|
|
|
4957
5120
|
notes: (values.note ?? []).map(parseNoteFlag),
|
|
4958
5121
|
wait: Boolean(values.wait),
|
|
4959
5122
|
json,
|
|
5123
|
+
verificationFor: values.for?.trim() || undefined,
|
|
4960
5124
|
});
|
|
4961
5125
|
return;
|
|
4962
5126
|
}
|