@clipy/cli 0.11.0 → 0.13.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/README.md +44 -11
- package/dist/browserLogin.js +2 -23
- package/dist/context/importCmd.js +147 -21
- package/dist/context/loom.js +30 -0
- package/dist/context/videoFetch.js +41 -20
- package/dist/context-core/index.js +1 -0
- package/dist/context-core/loom.js +293 -0
- package/dist/index.js +157 -42
- 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 +26 -10
- package/package.json +5 -4
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
309
|
bundle (recording.md + manifest.json +
|
|
308
|
-
transcript.json). YouTube captions
|
|
309
|
-
on your machine — no
|
|
310
|
-
|
|
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>
|
|
@@ -426,9 +430,16 @@ ${c.bold("SESSION")} ${c.dim("(agent works, Clipy records — one active session
|
|
|
426
430
|
session status Show the active session's state
|
|
427
431
|
|
|
428
432
|
${c.bold("AGENTS")}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
433
|
+
setup [claude|codex|cursor|windsurf|opencode]
|
|
434
|
+
Wire Clipy into a coding agent in ONE command:
|
|
435
|
+
sign in, install the skill, and register the MCP
|
|
436
|
+
server in that agent's own config. Detects the
|
|
437
|
+
agent it is running inside when you omit the name.
|
|
438
|
+
${c.dim("Published instructions: clipy.online/agent-setup/prompt.md")}
|
|
439
|
+
agents install <claude|codex|cursor|windsurf|opencode>
|
|
440
|
+
Skill only — no MCP, no login prompt beyond the
|
|
441
|
+
first-run one. Use ${c.bold("setup")} unless you deliberately
|
|
442
|
+
want just the skill file
|
|
432
443
|
agents status | uninstall <t> Show / remove installed skills
|
|
433
444
|
doctor [--json] Health check: API key, Mac agent bridge,
|
|
434
445
|
Playwright, and install mode — with fix hints
|
|
@@ -447,7 +458,8 @@ ${c.bold("GLOBAL FLAGS")}
|
|
|
447
458
|
--api-url <url> API base (else CLIPY_API_URL, default https://clipy.online)
|
|
448
459
|
--json Machine-readable output. Supported on: list, search, show,
|
|
449
460
|
transcript, summary, moments, wait, proof, record, session
|
|
450
|
-
start/stop/status, mark, chapter, doctor,
|
|
461
|
+
start/stop/status, mark, chapter, setup, agents, doctor,
|
|
462
|
+
playwright-path
|
|
451
463
|
-v, --version Print version
|
|
452
464
|
|
|
453
465
|
${c.bold("EXIT CODES")}
|
|
@@ -462,8 +474,10 @@ ${c.bold("EXIT CODES")}
|
|
|
462
474
|
"partial":null}. Branch on "code" (stable), never on the message text.
|
|
463
475
|
|
|
464
476
|
${c.bold("SETUP")}
|
|
465
|
-
|
|
466
|
-
|
|
477
|
+
${c.bold("clipy setup claude")} one command: sign in, install the skill, register MCP
|
|
478
|
+
${c.dim("(also: codex · cursor · windsurf · opencode — or omit to auto-detect)")}
|
|
479
|
+
|
|
480
|
+
Reading recordings by hand instead? ${c.bold("clipy login")}, then ${c.bold("clipy list")}.
|
|
467
481
|
|
|
468
482
|
Write commands — ${c.bold("proof")}, ${c.bold("record")}, ${c.bold("session")}/${c.bold("mark")}, and ${c.bold("transcript --replace")} — need a key
|
|
469
483
|
with the "ingest" permission. Everything else is read-only.
|
|
@@ -526,6 +540,7 @@ async function storeAndVerifyKey(ctx, key, meta, opts) {
|
|
|
526
540
|
if (ctx.apiUrl !== "https://clipy.online")
|
|
527
541
|
cfg.apiUrl = ctx.apiUrl;
|
|
528
542
|
writeConfig(cfg);
|
|
543
|
+
ctx.apiKey = key;
|
|
529
544
|
};
|
|
530
545
|
if (opts.storeFirst) {
|
|
531
546
|
store();
|
|
@@ -857,17 +872,8 @@ function fmtBytes(n) {
|
|
|
857
872
|
async function cmdOpen(ctx, id) {
|
|
858
873
|
const pid = normalizeId(id, ctx);
|
|
859
874
|
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
|
-
}
|
|
875
|
+
openUrl(url);
|
|
876
|
+
process.stdout.write(`${c.green("✓")} opening ${c.cyan(url)}\n`);
|
|
871
877
|
}
|
|
872
878
|
async function cmdWait(ctx, id, need, timeoutSec, json) {
|
|
873
879
|
const pid = encodeURIComponent(normalizeId(id, ctx));
|
|
@@ -1206,7 +1212,10 @@ async function doctorYtDlpCheck() {
|
|
|
1206
1212
|
return {
|
|
1207
1213
|
name: "yt-dlp",
|
|
1208
1214
|
status: "warn",
|
|
1209
|
-
|
|
1215
|
+
// Deliberately narrow: a Loom import compiles its transcript over plain
|
|
1216
|
+
// HTTPS and needs this binary only if the server later asks for frames,
|
|
1217
|
+
// so this must not read as "context import is unavailable".
|
|
1218
|
+
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
1219
|
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
1220
|
data: { present: false, path: null, version: null },
|
|
1212
1221
|
};
|
|
@@ -1933,7 +1942,7 @@ async function cmdProof(ctx, opts) {
|
|
|
1933
1942
|
const narrationNotes = resolveNarrationNotes(opts.notes, [0]);
|
|
1934
1943
|
if (hasFrames) {
|
|
1935
1944
|
mkdirSync(tmpDir, { recursive: true });
|
|
1936
|
-
videoPath = join(tmpDir, "proof.
|
|
1945
|
+
videoPath = join(tmpDir, "proof.mp4");
|
|
1937
1946
|
log(c.dim(`assembling ${opts.framePaths.length} proof frame${opts.framePaths.length === 1 ? "" : "s"}…`));
|
|
1938
1947
|
const rendered = await renderProofFrames({
|
|
1939
1948
|
framePaths: opts.framePaths,
|
|
@@ -4338,19 +4347,120 @@ async function runSessionDaemon(file) {
|
|
|
4338
4347
|
// agents — install the bundled Clipy skill for a coding agent, so one command
|
|
4339
4348
|
// teaches Claude Code / Codex / Cursor how to read AND make recordings.
|
|
4340
4349
|
// ---------------------------------------------------------------------------
|
|
4341
|
-
const AGENT_TARGETS =
|
|
4350
|
+
const AGENT_TARGETS = SETUP_TARGETS;
|
|
4351
|
+
/** Real filesystem + subprocess access for the setup helpers. */
|
|
4352
|
+
function realSetupEnv() {
|
|
4353
|
+
return {
|
|
4354
|
+
home: homedir(),
|
|
4355
|
+
env: process.env,
|
|
4356
|
+
run: (command, args) => new Promise((resolveRun) => {
|
|
4357
|
+
// Every agent CLI we shell out to (claude, codex, …) installs on Windows
|
|
4358
|
+
// as a `.cmd` shim, and Node refuses to spawn those without a shell —
|
|
4359
|
+
// it fails ENOENT, which we then report as "not on PATH" even though the
|
|
4360
|
+
// command is right there. Safe here because both the command and the
|
|
4361
|
+
// args are fixed constants (MCP_COMMAND/MCP_ARGS), never user input.
|
|
4362
|
+
const child = spawn(command, [...args], {
|
|
4363
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
4364
|
+
shell: process.platform === "win32",
|
|
4365
|
+
});
|
|
4366
|
+
let stdout = "";
|
|
4367
|
+
let stderr = "";
|
|
4368
|
+
child.stdout?.on("data", (d) => (stdout += d.toString()));
|
|
4369
|
+
child.stderr?.on("data", (d) => (stderr += d.toString()));
|
|
4370
|
+
child.on("error", (e) => resolveRun({ code: -1, stdout, stderr, spawnError: e.message }));
|
|
4371
|
+
child.on("close", (code) => resolveRun({ code: code ?? 0, stdout, stderr }));
|
|
4372
|
+
}),
|
|
4373
|
+
};
|
|
4374
|
+
}
|
|
4342
4375
|
function skillPathFor(target) {
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4376
|
+
return setupSkillPathFor(target, realSetupEnv());
|
|
4377
|
+
}
|
|
4378
|
+
function writeSkillFile(path) {
|
|
4379
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
4380
|
+
writeFileSync(path, CLIPY_SKILL_MD);
|
|
4381
|
+
}
|
|
4382
|
+
// ---------------------------------------------------------------------------
|
|
4383
|
+
// setup — skill + MCP + login in one command, for an agent following the
|
|
4384
|
+
// published setup instructions at clipy.online/agent-setup/prompt.md.
|
|
4385
|
+
// ---------------------------------------------------------------------------
|
|
4386
|
+
async function cmdSetup(ctx, targetRaw, json) {
|
|
4387
|
+
const env = realSetupEnv();
|
|
4388
|
+
let target;
|
|
4389
|
+
if (targetRaw) {
|
|
4390
|
+
if (!isSetupTarget(targetRaw)) {
|
|
4391
|
+
failSetup(json, "invalid_target", `unknown agent "${targetRaw}"`, `Choose one of: ${SETUP_TARGETS.join(", ")}.`, null, 2);
|
|
4350
4392
|
}
|
|
4351
|
-
|
|
4352
|
-
|
|
4393
|
+
target = targetRaw;
|
|
4394
|
+
}
|
|
4395
|
+
else {
|
|
4396
|
+
target = detectSetupTarget(env.env);
|
|
4353
4397
|
}
|
|
4398
|
+
if (!target) {
|
|
4399
|
+
failSetup(json, "target_detection_failed", "could not determine the current agent", `Run clipy setup <${SETUP_TARGETS.join("|")}>.`, null, 2);
|
|
4400
|
+
}
|
|
4401
|
+
if (!ctx.apiKey && json) {
|
|
4402
|
+
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.");
|
|
4403
|
+
}
|
|
4404
|
+
if (!ctx.apiKey) {
|
|
4405
|
+
process.stdout.write(`${c.dim("No Clipy API key found — signing you in first…")}\n`);
|
|
4406
|
+
await loginWithBrowser(ctx, shouldUseManualLogin());
|
|
4407
|
+
}
|
|
4408
|
+
if (!ctx.apiKey) {
|
|
4409
|
+
failSetup(json, "authentication_failed", "setup did not obtain a Clipy credential", "Run clipy login, then retry setup.");
|
|
4410
|
+
}
|
|
4411
|
+
const skillPath = setupSkillPathFor(target, env);
|
|
4412
|
+
let mcp;
|
|
4413
|
+
try {
|
|
4414
|
+
mcp = await registerMcpServer(target, env);
|
|
4415
|
+
}
|
|
4416
|
+
catch (error) {
|
|
4417
|
+
failSetup(json, "mcp_registration_failed", `could not register the Clipy MCP server: ${error.message}`, "Fix the reported config or permission error, then retry setup.");
|
|
4418
|
+
}
|
|
4419
|
+
if (mcp.method === "manual") {
|
|
4420
|
+
const instruction = mcp.command
|
|
4421
|
+
? `Run: ${mcp.command}`
|
|
4422
|
+
: `Merge this into ${mcp.path ?? "the agent MCP config"}:\n${mcp.snippet ?? ""}`;
|
|
4423
|
+
failSetup(json, "mcp_registration_incomplete", mcp.reason ?? "the Clipy MCP server needs a manual registration step", instruction, {
|
|
4424
|
+
target,
|
|
4425
|
+
skill: { installed: false, path: skillPath },
|
|
4426
|
+
mcp,
|
|
4427
|
+
authenticated: true,
|
|
4428
|
+
});
|
|
4429
|
+
}
|
|
4430
|
+
try {
|
|
4431
|
+
writeSkillFile(skillPath);
|
|
4432
|
+
}
|
|
4433
|
+
catch (error) {
|
|
4434
|
+
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 });
|
|
4435
|
+
}
|
|
4436
|
+
if (json) {
|
|
4437
|
+
printJson({
|
|
4438
|
+
ok: true,
|
|
4439
|
+
target,
|
|
4440
|
+
skill: { installed: true, path: skillPath },
|
|
4441
|
+
mcp,
|
|
4442
|
+
authenticated: true,
|
|
4443
|
+
restartRequired: true,
|
|
4444
|
+
docs: "https://clipy.online/agent-setup/prompt.md",
|
|
4445
|
+
});
|
|
4446
|
+
return;
|
|
4447
|
+
}
|
|
4448
|
+
const short = (p) => shortPath(p, env.home);
|
|
4449
|
+
const rows = [
|
|
4450
|
+
`✓ Skill ${short(skillPath)}`,
|
|
4451
|
+
`✓ MCP ${mcp.path ? short(mcp.path) : (mcp.command ?? target)}${mcp.alreadyPresent && !mcp.changed ? " (already registered)" : ""}`,
|
|
4452
|
+
`✓ Signed in`,
|
|
4453
|
+
"",
|
|
4454
|
+
"→ Restart your agent to load the MCP server",
|
|
4455
|
+
];
|
|
4456
|
+
process.stdout.write(`${renderSetupBox("Clipy setup complete", rows)}\n`);
|
|
4457
|
+
}
|
|
4458
|
+
function failSetup(json, code, error, remediation, partial = null, exitCode = 1) {
|
|
4459
|
+
if (json) {
|
|
4460
|
+
printJson({ ok: false, code, error, remediation, partial });
|
|
4461
|
+
process.exit(exitCode);
|
|
4462
|
+
}
|
|
4463
|
+
die(`${error}\n${remediation}`, exitCode);
|
|
4354
4464
|
}
|
|
4355
4465
|
async function cmdAgents(ctx, sub, targetRaw, json) {
|
|
4356
4466
|
if (sub === "status" || sub === undefined) {
|
|
@@ -4372,7 +4482,7 @@ async function cmdAgents(ctx, sub, targetRaw, json) {
|
|
|
4372
4482
|
for (const s of status) {
|
|
4373
4483
|
process.stdout.write(`${s.installed ? c.green("✓ installed") : c.dim("— not installed")} ${s.target.padEnd(7)} ${c.dim(s.path)}\n`);
|
|
4374
4484
|
}
|
|
4375
|
-
process.stdout.write(`${c.dim("install with:")} clipy agents install
|
|
4485
|
+
process.stdout.write(`${c.dim("install with:")} clipy agents install <${AGENT_TARGETS.join("|")}>\n`);
|
|
4376
4486
|
return;
|
|
4377
4487
|
}
|
|
4378
4488
|
const target = targetRaw;
|
|
@@ -4391,8 +4501,7 @@ async function cmdAgents(ctx, sub, targetRaw, json) {
|
|
|
4391
4501
|
process.stdout.write(`${c.dim("No Clipy API key found — signing you in first…")}\n`);
|
|
4392
4502
|
await loginWithBrowser(ctx, shouldUseManualLogin());
|
|
4393
4503
|
}
|
|
4394
|
-
|
|
4395
|
-
writeFileSync(path, CLIPY_SKILL_MD);
|
|
4504
|
+
writeSkillFile(path);
|
|
4396
4505
|
if (json) {
|
|
4397
4506
|
printJson({ installed: true, target, path });
|
|
4398
4507
|
return;
|
|
@@ -4423,13 +4532,15 @@ async function cmdAgents(ctx, sub, targetRaw, json) {
|
|
|
4423
4532
|
// command's shape without trial-and-error. Bump GUIDE_SCHEMA_VERSION when the
|
|
4424
4533
|
// contract changes.
|
|
4425
4534
|
// ---------------------------------------------------------------------------
|
|
4426
|
-
const GUIDE_SCHEMA_VERSION =
|
|
4535
|
+
const GUIDE_SCHEMA_VERSION = 16;
|
|
4427
4536
|
/** The stable machine-readable failure taxonomy carried in `--json` error
|
|
4428
4537
|
* envelopes. Codes are the contract; messages are not. Published through the
|
|
4429
4538
|
* guide so an agent discovers the full recovery table without the skill. */
|
|
4430
4539
|
const GUIDE_ERROR_CODES = [
|
|
4431
4540
|
{ 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
|
|
4541
|
+
{ 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" },
|
|
4542
|
+
{ 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" },
|
|
4543
|
+
{ 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
4544
|
{ 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
4545
|
{ 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
4546
|
{ 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" },
|
|
@@ -4501,12 +4612,12 @@ function cmdGuide(json) {
|
|
|
4501
4612
|
cmdDoc("summary", "clipy summary <id> [--json]", "AI summary: TL;DR, key points, action items"),
|
|
4502
4613
|
cmdDoc("moments", "clipy moments <id> [--json]", "Key moments: timestamps, captions, click coords"),
|
|
4503
4614
|
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.md (the agent-facing document, with the untrusted-content warning and [MM:SS] transcript sections), 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. 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"]),
|
|
4615
|
+
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.md (the agent-facing document, with the untrusted-content warning and [MM:SS] transcript sections), 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"]),
|
|
4505
4616
|
cmdDoc("context read", "clipy context read <bundle-path>", "Print a local bundle's recording.md 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
4617
|
cmdDoc("download", "clipy download <id> [-o path]", "Download the MP4"),
|
|
4507
4618
|
cmdDoc("open", "clipy open <id>", "Open the share page in a browser"),
|
|
4508
4619
|
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
|
|
4620
|
+
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 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. --json prints {id, shareUrl, contextUrl, sizeBytes, source}; 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", "--hold", "--width", "--height", "--title", "--description", "--type", "--note", "--wait", "--json"]),
|
|
4510
4621
|
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>' or --display <id> target one window/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"]),
|
|
4511
4622
|
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). --window/--display (with --source mac-screen) record one window/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
4623
|
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"]),
|
|
@@ -4514,7 +4625,8 @@ function cmdGuide(json) {
|
|
|
4514
4625
|
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
4626
|
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
4627
|
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("
|
|
4628
|
+
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"]),
|
|
4629
|
+
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
4630
|
cmdDoc("guide", "clipy guide --json", "This manifest"),
|
|
4519
4631
|
cmdDoc("mcp", "clipy mcp", "Run the Clipy MCP server (wraps npx -y @clipy/mcp)"),
|
|
4520
4632
|
],
|
|
@@ -4825,7 +4937,7 @@ async function main() {
|
|
|
4825
4937
|
// by that name, which is why they can never be confused for one.
|
|
4826
4938
|
if (rest[0] === "import") {
|
|
4827
4939
|
if (!rest[1])
|
|
4828
|
-
die("usage: clipy context import <youtube-url|local-file> [--transcript <f>] [--output <dir>] [--sync]", 2);
|
|
4940
|
+
die("usage: clipy context import <youtube-url|loom-url|local-file> [--transcript <f>] [--output <dir>] [--sync]", 2);
|
|
4829
4941
|
try {
|
|
4830
4942
|
await cmdContextImport(rest[1], {
|
|
4831
4943
|
apiUrl: ctx.apiUrl,
|
|
@@ -4901,6 +5013,9 @@ async function main() {
|
|
|
4901
5013
|
case "playwright-path":
|
|
4902
5014
|
await cmdPlaywrightPath(json);
|
|
4903
5015
|
return;
|
|
5016
|
+
case "setup":
|
|
5017
|
+
await cmdSetup(ctx, rest[0], json);
|
|
5018
|
+
return;
|
|
4904
5019
|
case "agents":
|
|
4905
5020
|
await cmdAgents(ctx, rest[0], rest[1], json);
|
|
4906
5021
|
return;
|
package/dist/openUrl.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opening a URL in the user's default browser, safely on every platform.
|
|
3
|
+
*
|
|
4
|
+
* The Windows path is the whole reason this module exists. `cmd.exe` parses
|
|
5
|
+
* `&` as a command separator, and Node does NOT escape cmd metacharacters when
|
|
6
|
+
* it builds a command line — it only adds quotes around arguments containing
|
|
7
|
+
* whitespace or quotes. So spawning
|
|
8
|
+
*
|
|
9
|
+
* cmd /c start "" https://clipy.online/cli/authorize?challenge=A&state=B&port=1234
|
|
10
|
+
*
|
|
11
|
+
* opened `…?challenge=A` and then tried to run `state=B` as a separate command.
|
|
12
|
+
* Every Windows user landed on the "This authorization link is invalid" page,
|
|
13
|
+
* because the approval page requires state/port/name/scopes too.
|
|
14
|
+
*
|
|
15
|
+
* The fix follows the current `open` package approach: pass a Base64-encoded
|
|
16
|
+
* command directly to PowerShell. The URL never enters cmd.exe, and PowerShell
|
|
17
|
+
* decodes it only after command-line parsing, so `&` and percent-encoded values
|
|
18
|
+
* arrive unchanged.
|
|
19
|
+
*/
|
|
20
|
+
import { spawn } from "node:child_process";
|
|
21
|
+
/**
|
|
22
|
+
* Build the spawn plan for a URL. Exported separately from the spawn so tests
|
|
23
|
+
* can assert the Windows command line without running on Windows.
|
|
24
|
+
*/
|
|
25
|
+
export function planOpenUrl(url, platform) {
|
|
26
|
+
if (platform === "win32") {
|
|
27
|
+
const escapedUrl = url.replace(/'/g, "''");
|
|
28
|
+
const encodedCommand = Buffer.from(`Start-Process '${escapedUrl}'`, "utf16le").toString("base64");
|
|
29
|
+
return {
|
|
30
|
+
cmd: "powershell.exe",
|
|
31
|
+
args: ["-NoProfile", "-NonInteractive", "-EncodedCommand", encodedCommand],
|
|
32
|
+
verbatim: false,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
cmd: platform === "darwin" ? "open" : "xdg-open",
|
|
37
|
+
args: [url],
|
|
38
|
+
verbatim: false,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Fire-and-forget: spawn the OS opener and detach. Never throws — callers
|
|
43
|
+
* always print the URL as a fallback, which is the real safety net when no
|
|
44
|
+
* opener exists (headless boxes, stripped containers).
|
|
45
|
+
*/
|
|
46
|
+
export function openUrl(url, platform = process.platform) {
|
|
47
|
+
const plan = planOpenUrl(url, platform);
|
|
48
|
+
try {
|
|
49
|
+
const child = spawn(plan.cmd, plan.args, {
|
|
50
|
+
detached: true,
|
|
51
|
+
stdio: "ignore",
|
|
52
|
+
windowsVerbatimArguments: plan.verbatim,
|
|
53
|
+
});
|
|
54
|
+
child.on("error", () => { }); // opener missing — the printed URL is the fallback
|
|
55
|
+
child.unref();
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
// ignore — the caller already printed the URL
|
|
59
|
+
}
|
|
60
|
+
}
|
package/dist/proofFrames.js
CHANGED
|
@@ -11,7 +11,7 @@ function evenDimension(value, label) {
|
|
|
11
11
|
throw new Error(`${label} must be an integer between 320 and 3840`);
|
|
12
12
|
}
|
|
13
13
|
if (value % 2 !== 0) {
|
|
14
|
-
throw new Error(`${label} must be even for
|
|
14
|
+
throw new Error(`${label} must be even for video encoding`);
|
|
15
15
|
}
|
|
16
16
|
return value;
|
|
17
17
|
}
|
|
@@ -45,7 +45,7 @@ function validateFrames(paths) {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
* Turns a bounded sequence of screenshots into a silent
|
|
48
|
+
* Turns a bounded sequence of screenshots into a silent MP4. Each screenshot
|
|
49
49
|
* is held for the same duration; narration/captions remain separate so the
|
|
50
50
|
* server can expose them as timestamped agent evidence.
|
|
51
51
|
*
|
|
@@ -68,12 +68,12 @@ export async function renderProofFrames(opts) {
|
|
|
68
68
|
for (const framePath of framePaths) {
|
|
69
69
|
args.push("-loop", "1", "-t", String(opts.holdSeconds), "-i", framePath);
|
|
70
70
|
}
|
|
71
|
-
const filters = framePaths.map((_frame, index) => `[${index}:v]scale=${width}:${height}:force_original_aspect_ratio=decrease,` +
|
|
71
|
+
const filters = framePaths.map((_frame, index) => `[${index}:v]scale=${width}:${height}:force_original_aspect_ratio=decrease:flags=lanczos,` +
|
|
72
72
|
`pad=${width}:${height}:(ow-iw)/2:(oh-ih)/2:color=black,` +
|
|
73
73
|
`setsar=1,fps=30,format=yuv420p[v${index}]`);
|
|
74
74
|
filters.push(`${framePaths.map((_frame, index) => `[v${index}]`).join("")}` +
|
|
75
75
|
`concat=n=${framePaths.length}:v=1:a=0[outv]`);
|
|
76
|
-
args.push("-filter_complex", filters.join(";"), "-map", "[outv]", "-c:v", "
|
|
76
|
+
args.push("-filter_complex", filters.join(";"), "-map", "[outv]", "-c:v", "libx264", "-preset", "medium", "-tune", "stillimage", "-crf", "14", "-profile:v", "main", "-movflags", "+faststart", "-an", "-y", opts.outputPath);
|
|
77
77
|
const result = await runFf(ffmpeg, args, Math.max(120_000, durationSeconds * 10_000));
|
|
78
78
|
if (result.code !== 0) {
|
|
79
79
|
const detail = result.stderr.trim().slice(-1_000);
|