cueframe 0.2.0 → 0.3.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/dist/analyze-4EZTZEAG.js +2 -0
- package/dist/chunk-3QSA3EBY.js +2 -0
- package/dist/chunk-4FMFWW74.js +12 -0
- package/dist/cueframe.js +35 -31
- package/dist/supportedAgents.js +2 -0
- package/package.json +4 -3
- package/skills/add-music-bed/SKILL.md +105 -0
- package/skills/brand-reel/SKILL.md +105 -0
- package/skills/clip-a-talking-head/SKILL.md +97 -0
- package/skills/composing-video/SKILL.md +240 -16
- package/skills/cueframe-brand-demo/SKILL.md +3 -0
- package/skills/cueframe-cli/SKILL.md +1 -1
- package/skills/cueframe-component-authoring/SKILL.md +1 -1
- package/skills/cueframe-compose-loop/SKILL.md +3 -0
- package/skills/cueframe-storyboard/SKILL.md +3 -0
- package/skills/every-format-from-one-edit/SKILL.md +93 -0
- package/skills/extracting-brand-kits/SKILL.md +156 -0
- package/skills/launch-video/SKILL.md +97 -0
- package/skills/make-a-social-reel/SKILL.md +105 -0
- package/skills/rebrand-a-video/SKILL.md +101 -0
- package/skills/video-craft-standards/SKILL.md +119 -0
- package/dist/analyze-6ETMHDG5.js +0 -2
- package/dist/chunk-JHOJIRD5.js +0 -12
package/dist/cueframe.js
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{A as
|
|
3
|
-
|
|
2
|
+
import{A as E,B as w,C as v,D as Fe,a as N,b as Z,c as C,d as p,e as j,f as g,g as T,h as I,i as Ie,j as Re,k,l as fe,m as Te,n as Oe,o as F,p as L,q as Pe,r as Q,s as q,t as Y,u as Ae,v as ge,w as m,x as y,y as A,z as l}from"./chunk-4FMFWW74.js";import"./chunk-3QSA3EBY.js";import{Command as _r}from"commander";import{existsSync as Ue,mkdirSync as Gt,readFileSync as Kt,writeFileSync as Ht,readdirSync as Vt,statSync as Zt}from"fs";import{homedir as Qt}from"os";import{dirname as Me,join as X}from"path";import{fileURLToPath as Yt}from"url";import{agents as Xt,detectGlobalAgents as De,upsertServer as eo}from"add-mcp";var ee="cueframe";function to(){let t=Me(Yt(import.meta.url));for(let e=0;e<8;e++){let o=X(t,"skills");if(Ue(o)&&Zt(o).isDirectory())return o;let r=Me(t);if(r===t)break;t=r}return null}function oo(t,e){let o=`> Installed ${e} by \`cueframe install\`. Skills and tools change often \u2014
|
|
3
|
+
> if that date is more than a week old, run \`npx -y cueframe install\` to refresh.
|
|
4
|
+
`,r=t.match(/^---\n[\s\S]*?\n---\n/);return r?`${r[0]}
|
|
5
|
+
${o}${t.slice(r[0].length)}`:`${o}
|
|
6
|
+
${t}`}function ro(t){let e=to();e||(g(t,"install",new Error("Bundled skills/ directory not found"),m.UserError),l(m.UserError));let o=new Date().toISOString().slice(0,10),r=[];for(let n of Vt(e)){let i=X(e,n,"SKILL.md");if(!Ue(i))continue;let s=X(Qt(),".claude","skills",n);Gt(s,{recursive:!0});let a=X(s,"SKILL.md");Ht(a,oo(Kt(i,"utf8"),o),"utf8"),r.push(a)}return r}function no(t){return(Xt[t]?.supportedTransports??[]).includes("http")}async function io(t){return(await De()).map(o=>{if(!no(o))return{agent:o,wired:!1,error:"speaks stdio only \u2014 CueFrame\u2019s MCP server is remote HTTP"};try{let r=eo(o,ee,{type:"http",url:t});return{agent:o,wired:r.success,path:r.path,error:r.error}}catch(r){return{agent:o,wired:!1,error:r instanceof Error?r.message:String(r)}}})}async function Ne(t){let e=`${N(t.target)}/v1/mcp`;if(t.dryRun){let n=await De();j(t,{ok:!0,dryRun:!0,mcpUrl:e,wouldWire:n,serverName:ee},()=>{console.log(`Would wire MCP server "${ee}" \u2192 ${e} into:`),n.length===0&&console.log(" (no agents detected on this machine)");for(let i of n)console.log(` \u2192 ${i}`);console.log("Would install the CueFrame agent skills into ~/.claude/skills"),console.log("Dry run \u2014 nothing was written.")});return}let o=ro(t),r=await io(e);o.length===0&&r.length===0&&(g(t,"install",new Error("No agents detected and no skills found \u2014 nothing to install"),m.UserError),l(m.UserError)),j(t,{ok:!0,mcpUrl:e,agents:r,skills:o},()=>{if(console.log(`\u2713 CueFrame MCP server (${e})`),r.length===0)console.log(" No agents detected on this machine. Add it manually:"),console.log(` claude mcp add --transport http ${ee} ${e}`),console.log(` \u2026or add the MCP server ${e} as a custom connector.`);else for(let n of r)console.log(n.wired?` \u2192 wired ${n.agent}`:` \u2717 ${n.agent}: ${n.error??"failed"}`);console.log(`\u2713 Installed ${o.length} CueFrame skill(s) into ~/.claude/skills`),console.log(""),console.log("Next: ask your agent to make a video \u2014 it opens a browser to authorize on"),console.log("first call. No API key needed. (Prefer the CLI? Run `cueframe login`.)"),console.log("Restart your agent session to load the MCP server and skills.")})}import{existsSync as he,mkdirSync as so,readFileSync as We,writeFileSync as ye}from"fs";import{join as we}from"path";var Le="cueframe.json",ao="cueframe/components",te=".cueframe/";function co(t,e){let o=we(t,".gitignore");if(he(o)){let r=We(o,"utf8"),n=r.split(`
|
|
7
|
+
`).map(i=>i.trim());if(n.includes(te)||n.includes(".cueframe"))return!1;if(!e){let i=r.endsWith(`
|
|
4
8
|
`)||r.length===0?"":`
|
|
5
9
|
`;ye(o,`${r}${i}
|
|
6
10
|
# CueFrame derived render cache (regenerated; never authored)
|
|
7
|
-
${
|
|
11
|
+
${te}
|
|
8
12
|
`)}return!0}return e||ye(o,`# CueFrame derived render cache (regenerated; never authored)
|
|
9
|
-
${
|
|
10
|
-
`),!0}function
|
|
11
|
-
`);let s=we(e,i),a=he(s);!a&&!o&&
|
|
13
|
+
${te}
|
|
14
|
+
`),!0}function ze(t){let e=process.cwd(),o=t.dryRun??!1;p(t,"init_prepare",{cwd:e,dryRun:o});let r=we(e,Le),n=he(r),i=ao;if(n)try{let u=JSON.parse(We(r,"utf8"));typeof u.componentsDir=="string"&&u.componentsDir.length>0&&(i=u.componentsDir)}catch{}else o||ye(r,`${JSON.stringify({componentsDir:i},null,2)}
|
|
15
|
+
`);let s=we(e,i),a=he(s);!a&&!o&&so(s,{recursive:!0});let f=co(e,o);j(t,{ok:!0,dryRun:o,root:e,manifest:{path:r,created:!n},componentsDir:i,componentsDirCreated:!a,gitignoreUpdated:f},()=>{console.log(`\u2713 ${o?"Would initialize":"Initialized"} CueFrame workspace at ${e}`),console.log(` ${n?"kept":"created"} ${Le} (componentsDir: ${i})`),console.log(` ${a?"exists":"created"} ${i}/`),f&&console.log(` gitignored ${te}`),console.log("Next: cueframe eject <primitive> or cueframe new component <name>")})}import{existsSync as je,mkdirSync as vo,readFileSync as re,readdirSync as Ge,statSync as jo,writeFileSync as Be}from"fs";import{dirname as Ee,join as B}from"path";import{fileURLToPath as Eo}from"url";import S from"typescript";import O from"typescript";var mo="@cueframe/primitives";function lo(t){if(!t.startsWith("."))return t;let e=t.split("/"),o=e.indexOf("lib");return o===-1||!e.slice(0,o).every(r=>r==="."||r==="..")?t:`${mo}/${e.slice(o).join("/")}`}function be(t,e){let o=O.createSourceFile(e,t,O.ScriptTarget.Latest,!1,e.endsWith(".tsx")?O.ScriptKind.TSX:O.ScriptKind.TS),r=[],n=s=>{let a;if(O.isImportDeclaration(s)||O.isExportDeclaration(s)?a=s.moduleSpecifier:O.isCallExpression(s)&&s.expression.kind===O.SyntaxKind.ImportKeyword&&(a=s.arguments[0]),a&&O.isStringLiteral(a)){let f=lo(a.text);f!==a.text&&r.push({start:a.getStart(o)+1,end:a.getEnd()-1,text:f})}O.forEachChild(s,n)};if(n(o),r.length===0)return t;r.sort((s,a)=>a.start-s.start);let i=t;for(let s of r)i=i.slice(0,s.start)+s.text+i.slice(s.end);return i}import{existsSync as oe,readFileSync as uo,readdirSync as po,statSync as fo}from"fs";import{dirname as go,join as W,parse as ho}from"path";var yo="cueframe/components";var wo="cueframe.json",bo=ge.object({componentsDir:ge.string().min(1).default(yo)}).passthrough();function U(t){let e=t,o=ho(e).root;for(;;){let r=W(e,wo);if(oe(r)){let n=uo(r,"utf8"),i=bo.parse(JSON.parse(n));return{root:e,manifest:i}}if(e===o)return null;e=go(e)}}function Je(t){return W(t.root,t.manifest.componentsDir)}function z(t,e){return W(Je(t),e)}function qe(t){let e=Je(t);return oe(e)?po(e).filter(o=>{let r=W(e,o);return fo(r).isDirectory()?oe(W(r,"index.tsx"))&&oe(W(r,"config.ts")):!1}).sort():[]}var ve="@cueframe/primitives",xo="cueframe.json";function So(){let t=Ee(Eo(import.meta.url));for(;;){let e=B(t,"packages","execution","primitives","src");if(je(e))return e;let o=Ee(t);if(o===t)return null;t=o}}function Ke(t){let e=[];for(let o of Ge(t)){if(o==="node_modules"||o==="dist"||o==="__tests__")continue;let r=B(t,o);jo(r).isDirectory()?e.push(...Ke(r)):o==="config.ts"&&e.push(r)}return e}function Co(t){let e=t;for(;S.isAsExpression(e)||S.isParenthesizedExpression(e)||typeof S.isSatisfiesExpression=="function"&&S.isSatisfiesExpression(e);)e=e.expression;return e}function $o(t,e){let o=S.createSourceFile(e,t,S.ScriptTarget.Latest,!0,S.ScriptKind.TS),r;for(let i of o.statements)if(S.isVariableStatement(i)){for(let s of i.declarationList.declarations)if(S.isIdentifier(s.name)&&s.name.text==="config"&&s.initializer){let a=Co(s.initializer);S.isObjectLiteralExpression(a)&&(r=a)}if(r)break}let n={sf:o};if(!r)return n;for(let i of r.properties){if(!S.isPropertyAssignment(i)||!(S.isIdentifier(i.name)||S.isStringLiteral(i.name)))continue;let s=i.name.text;s==="id"&&S.isStringLiteralLike(i.initializer)?n.id=i.initializer.text:s==="version"&&S.isStringLiteralLike(i.initializer)?n.version=i.initializer.text:s==="component"&&S.isIdentifier(i.initializer)&&(n.componentName=i.initializer.text)}return n}function He(t,e){let o=t.importClause;if(!o||o.isTypeOnly)return!1;if(o.name&&o.name.text===e)return!0;let r=o.namedBindings;return r&&S.isNamedImports(r)?r.elements.some(n=>!n.isTypeOnly&&n.name.text===e):!1}function ko(t,e){for(let o of t.statements)if(S.isImportDeclaration(o)&&S.isStringLiteral(o.moduleSpecifier)&&He(o,e))return o.moduleSpecifier.text}function _o(t,e,o){let r=S.createSourceFile(e,t,S.ScriptTarget.Latest,!1,S.ScriptKind.TS);for(let n of r.statements){if(!S.isImportDeclaration(n)||!S.isStringLiteral(n.moduleSpecifier)||!He(n,o))continue;let i=n.moduleSpecifier.getStart(r)+1,s=n.moduleSpecifier.getEnd()-1;return t.slice(0,i)+"./index"+t.slice(s)}return t}function D(t,e){g(t,"eject",new Error(e),m.UserError),l(m.UserError)}function Ve(t,e){E(t,"primitive",e);let o=t,r=e.dryRun??!1,n=e.force??!1;p(e,"eject_prepare",{primitive:o,dryRun:r,force:n});let i=U(process.cwd());i||D(e,"No CueFrame workspace found (no cueframe.json up-tree). Run `cueframe init` first to scaffold one.");let s=So();s||D(e,"Built-in primitive source not found \u2014 `cueframe eject` reads in-tree source and must run inside the CueFrame monorepo checkout.");let a,f;for(let P of Ke(s)){let R=$o(re(P,"utf8"),P);if(R.id===o){a=P,f=R;break}}(!a||!f)&&D(e,`Unknown primitive id "${o}". No built-in primitive declares config.id === "${o}".`),f.componentName||D(e,`Primitive "${o}" config has no \`component:\` identifier to eject.`);let u=f.componentName,c=f.version??"0.0.0",d=ko(f.sf,u);d||D(e,`Could not find the import that provides component "${u}" in ${a}.`);let h=Ee(a),x=d.replace(/^\.\//,""),b;for(let P of[".tsx",".ts"]){let R=B(h,x+P);if(je(R)){b=R;break}}b||D(e,`Component source for "${o}" not found on disk (resolved "${d}" beside ${a}).`);let _=re(b,"utf8"),J=be(_,"index.tsx"),H=`/** Owned eject of '${o}'. Adapts the ({durationInFrames, params}) mount contract to the primitive's props. */
|
|
12
16
|
export default function ${u}Owned({ params }: { durationInFrames: number; params: Record<string, unknown> }) {
|
|
13
17
|
return <${u} {...(params as Record<string, never>)} />;
|
|
14
18
|
}
|
|
15
|
-
`,
|
|
19
|
+
`,ue=`${J.replace(/\s*$/,"")}
|
|
16
20
|
|
|
17
|
-
${
|
|
21
|
+
${H}`,V=re(a,"utf8"),Wt=be(V,"_config.ts"),zt=_o(Wt,"_config.ts",u),Jt=`import component from './index';
|
|
18
22
|
import { config as base } from './_config';
|
|
19
23
|
|
|
20
24
|
export const config = { ...base, component };
|
|
21
25
|
export default config;
|
|
22
|
-
`,
|
|
23
|
-
`)}
|
|
26
|
+
`,M=z(i,o),ke=je(M);ke&&Ge(M).length>0&&!n&&D(e,`Component dir ${M} already exists and is non-empty. Pass --force to overwrite (this replaces local customizations).`);let pe={"index.tsx":ue,"_config.ts":zt,"config.ts":Jt};if(!r){vo(M,{recursive:!0});for(let[qt,Bt]of Object.entries(pe))Be(B(M,qt),Bt);let P=B(i.root,xo),R=JSON.parse(re(P,"utf8")),_e=R.components??{};_e[o]={ejectedFrom:ve,primitiveVersion:c},R.components=_e,Be(P,`${JSON.stringify(R,null,2)}
|
|
27
|
+
`)}j(e,{ok:!0,dryRun:r,primitive:o,component:u,version:c,from:ve,dir:M,files:Object.keys(pe),overwritten:ke&&n},()=>{console.log(`\u2713 ${r?"Would eject":"Ejected"} ${o} (${u}) into ${M}`);for(let R of Object.keys(pe))console.log(` ${r?"would write":"wrote"} ${R}`);r||console.log(` stamped cueframe.json components.${o} (${ve}@${c})`),console.log("Edit the source, then render it on CueFrame.")})}import{existsSync as Io,mkdirSync as Ro,readFileSync as To,readdirSync as Oo,writeFileSync as Ze}from"fs";import{join as Qe}from"path";var Po="cueframe.json";function Ao(t){return t.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join("")}function Fo(t){return t.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ")}function xe(t,e){g(t,"new_component",new Error(e),m.UserError),l(m.UserError)}function Mo(t,e){return`import React from 'react';
|
|
24
28
|
|
|
25
29
|
/** Custom CueFrame component. Mounted as ({ durationInFrames, params }). Edit me. */
|
|
26
30
|
export default function ${e}({ params }: { durationInFrames: number; params: Record<string, unknown> }) {
|
|
27
31
|
return <div style={{ width: '100%', height: '100%', display: 'grid', placeItems: 'center' }}>{String((params as { text?: unknown }).text ?? '${t}')}</div>;
|
|
28
32
|
}
|
|
29
|
-
`}function
|
|
33
|
+
`}function Uo(t,e){return`import { z } from 'zod';
|
|
30
34
|
import component from './index';
|
|
31
35
|
|
|
32
36
|
const paramsSchema = z.object({}).passthrough();
|
|
@@ -41,40 +45,40 @@ export const config = {
|
|
|
41
45
|
paramsSchema,
|
|
42
46
|
};
|
|
43
47
|
export default config;
|
|
44
|
-
`}function Ye(t,e){
|
|
45
|
-
`)}
|
|
48
|
+
`}function Ye(t,e){E(t,"name",e);let o=e.dryRun??!1,r=e.force??!1,n=Ao(t);n||xe(e,`name "${t}" has no alphanumeric characters to form a component identifier.`);let i=Fo(t);p(e,"new_component_prepare",{name:t,dryRun:o,force:r});let s=U(process.cwd());s||xe(e,"No CueFrame workspace found (no cueframe.json up-tree). Run `cueframe init` first to scaffold one.");let a=z(s,t),f=Io(a);f&&Oo(a).length>0&&!r&&xe(e,`Component dir ${a} already exists and is non-empty. Pass --force to overwrite (this replaces local source).`);let u={"index.tsx":Mo(t,n),"config.ts":Uo(t,i)};if(!o){Ro(a,{recursive:!0});for(let[x,b]of Object.entries(u))Ze(Qe(a,x),b);let c=Qe(s.root,Po),d=JSON.parse(To(c,"utf8")),h=d.components??{};h[t]={custom:!0},d.components=h,Ze(c,`${JSON.stringify(d,null,2)}
|
|
49
|
+
`)}j(e,{ok:!0,dryRun:o,name:t,component:n,dir:a,files:Object.keys(u),overwritten:f&&r},()=>{console.log(`\u2713 ${o?"Would scaffold":"Scaffolded"} custom component ${t} (${n}) into ${a}`);for(let d of Object.keys(u))console.log(` ${o?"would write":"wrote"} ${d}`);o||console.log(` stamped cueframe.json components.${t} (custom)`),console.log("Edit index.tsx, then `cueframe push "+t+"` to publish it to CueFrame.")})}import{existsSync as ne,readFileSync as ie}from"fs";import{join as se}from"path";import $ from"typescript";var Do="cueframe.json",No=["effects","transitions","text","layouts"];function Lo(t){return No.includes(t??"")?t:"layouts"}function Wo(t){let e=t;for(;$.isAsExpression(e)||$.isParenthesizedExpression(e)||typeof $.isSatisfiesExpression=="function"&&$.isSatisfiesExpression(e);)e=e.expression;return e}function zo(t,e){for(let o of t.statements)if($.isImportDeclaration(o)&&$.isStringLiteral(o.moduleSpecifier)&&o.moduleSpecifier.text===e)return!0;return!1}function Xe(t,e){let o=$.createSourceFile(e,t,$.ScriptTarget.Latest,!0,$.ScriptKind.TS),r;for(let i of o.statements)if($.isVariableStatement(i)){for(let s of i.declarationList.declarations)if($.isIdentifier(s.name)&&s.name.text==="config"&&s.initializer){let a=Wo(s.initializer);$.isObjectLiteralExpression(a)&&(r=a)}if(r)break}let n={};if(!r)return n;for(let i of r.properties){if(!$.isPropertyAssignment(i)||!($.isIdentifier(i.name)||$.isStringLiteral(i.name)))continue;let s=i.name.text;$.isStringLiteralLike(i.initializer)&&(s==="name"?n.name=i.initializer.text:s==="category"?n.category=i.initializer.text:s==="version"&&(n.version=i.initializer.text))}return n}function Jo(t){let e=se(t,"config.ts");if(!ne(e))return{};let o=ie(e,"utf8"),r=$.createSourceFile("config.ts",o,$.ScriptTarget.Latest,!0,$.ScriptKind.TS),n=se(t,"_config.ts");return zo(r,"./_config")&&ne(n)?Xe(ie(n,"utf8"),"_config.ts"):Xe(o,"config.ts")}function qo(t){return t.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Bo(t,e){let o=se(t.root,Do);if(ne(o))try{let n=JSON.parse(ie(o,"utf8")).components?.[e]?.ejectedFrom;return typeof n=="string"&&n.length>0?n:void 0}catch{return}}async function et(t,e,o){let r=z(t,e),n=se(r,"index.tsx");if(!ne(n))throw Object.assign(new Error(`Component "${e}" has no index.tsx at ${r}. Scaffold it first (cueframe eject / new component).`),{code:"no_component_source"});let i=ie(n,"utf8"),s=Jo(r),a=s.name??qo(e),f=Lo(s.category),u=Bo(t,e),c=`Custom component "${e}" pushed from the local CueFrame workspace.`,d={type:"object",properties:{}};p(o,"push_component",{id:e,name:a,category:f,version:s.version,ejectedFrom:u});let h=!1;try{await Y.getComponent(e),h=!0}catch(x){if(x instanceof I&&x.status===404)h=!1;else throw x}return h?(await Y.updateComponent(e,{tsxSource:i,name:a,description:c,category:f,propSchema:d,origin:"repo-owned",...u?{ejectedFrom:u}:{}}),p(o,"pushed",{id:e,action:"updated"}),{id:e,action:"updated",name:a,category:f}):(await Y.createComponent({componentId:e,tsxSource:i,name:a,description:c,category:f,propSchema:d,origin:"repo-owned",...u?{ejectedFrom:u}:{}}),p(o,"pushed",{id:e,action:"created"}),{id:e,action:"created",name:a,category:f})}async function tt(t,e){t||(g(e,"push",new Error("Pass a component id (cueframe push <id>), or use `cueframe sync` to push all."),m.UserError),l(m.UserError)),E(t,"id",e),w(e.target);let o=U(process.cwd());o||(g(e,"push",new Error("No CueFrame workspace found (no cueframe.json up-tree). Run `cueframe init` first."),m.UserError),l(m.UserError)),p(e,"push_prepare",{id:t,target:e.target});try{let r=await et(o,t,e);j(e,{ok:!0,target:e.target,...r},()=>{console.log(`\u2713 ${r.action} component ${r.id} (${r.name}) on CueFrame`)})}catch(r){let n=r.code==="no_component_source"?m.UserError:y(r);g(e,"push",r,n),e.json||console.error(`Push failed: ${v(r)}`),l(n)}}async function ot(t){w(t.target);let e=U(process.cwd());e||(g(t,"sync",new Error("No CueFrame workspace found (no cueframe.json up-tree). Run `cueframe init` first."),m.UserError),l(m.UserError));let o=qe(e);p(t,"sync_prepare",{target:t.target,count:o.length,ids:o});let r=[],n=[];for(let i of o)try{r.push(await et(e,i,t))}catch(s){let a=s.code==="no_component_source"?m.UserError:y(s);g(t,"sync",s,a),n.push({id:i,error:s})}j(t,{ok:n.length===0,target:t.target,pushed:r,failed:n.map(i=>({id:i.id,error:v(i.error)}))},()=>{if(r.length===0&&n.length===0){console.log("No components to sync. Scaffold one with `cueframe eject` or `cueframe new component`.");return}for(let i of r)console.log(`\u2713 ${i.action} ${i.id} (${i.name})`);for(let i of n)console.error(`\u2716 ${i.id}: ${v(i.error)}`);console.log(`Synced ${r.length}/${o.length} component(s) to CueFrame.`)}),n.length>0&&l(y(n[0].error))}var ae=["media","sessions","projects","renders","webhooks"],rt={readonly:Object.fromEntries(ae.map(t=>[t,["read"]])),editall:Object.fromEntries(ae.map(t=>[t,["read","write"]]))};function Go(t){if(t.preset){let e=rt[t.preset];return e||(console.error(`Unknown --preset "${t.preset}". Valid: ${Object.keys(rt).join(", ")}.`),l(m.UserError)),e}if(t.scope)return Ko(t.scope);console.error("Provide --scope or --preset (e.g. --preset readonly | editall)."),l(m.UserError)}function Ko(t){let e={};for(let o of t.split(",").map(r=>r.trim()).filter(Boolean)){let[r,n]=o.split(":");(!r||!n)&&(console.error(`Invalid --scope "${o}". Use resource:rw (e.g. renders:rw,media:r).`),l(m.UserError)),ae.includes(r)||(console.error(`--scope "${o}": unknown resource "${r}". Valid: ${ae.join(", ")}.`),l(m.UserError));let i=[];/r/i.test(n)&&i.push("read"),/w/i.test(n)&&i.push("write"),i.length===0&&(console.error(`--scope "${o}": actions must include r and/or w.`),l(m.UserError)),e[r]=i}return Object.keys(e).length===0&&(console.error("--scope is required, e.g. --scope media:rw,projects:rw,renders:rw"),l(m.UserError)),e}async function nt(t){w("dev");let e=Go(t),o={name:t.name,permissions:e};if(t.expires){let r=Number(t.expires);(!Number.isFinite(r)||r<=0)&&(console.error("--expires must be a positive number of days."),l(m.UserError)),o.expiresIn=Math.round(r*86400)}try{let r=await fe("/v1/api-keys",{method:"POST",body:JSON.stringify(o),headers:{"content-type":"application/json"}});j(t,{ok:!0,id:r.id,prefix:r.prefix,start:r.start,key:r.key},()=>{let n=Object.entries(e).map(([i,s])=>`${i}:${s.map(a=>a[0]).join("")}`).join(" ");console.log(`\u2713 API key "${t.name}" created \u2014 scopes: ${n}`),console.log(`
|
|
46
50
|
${r.key}
|
|
47
|
-
`),console.log(" Shown ONCE \u2014 store it now (paste it into your integration; not saved here).")})}catch(r){g(t,"keys_create",r,
|
|
48
|
-
Media item ID: ${
|
|
49
|
-
Media item ID: ${
|
|
50
|
-
Run \`cueframe analyze ${
|
|
51
|
+
`),console.log(" Shown ONCE \u2014 store it now (paste it into your integration; not saved here).")})}catch(r){g(t,"keys_create",r,m.ApiClientError),l(m.ApiClientError)}}async function it(t){w("dev");let e=await k("/api/auth/api-key/list",{method:"GET"});e.status>=400&&(g(t,"keys_list",new Error(`list failed (${e.status})`),m.ApiClientError),l(m.ApiClientError));let o=Array.isArray(e.body)?e.body:[];j(t,{ok:!0,keys:o},()=>{if(o.length===0){console.log("No API keys.");return}for(let r of o)console.log(` ${r.id} ${r.name??"(unnamed)"} ${r.start??""}\u2026`)})}async function st(t,e){w("dev");let o=await k("/api/auth/api-key/delete",{method:"POST",body:JSON.stringify({keyId:t}),headers:{"content-type":"application/json"}});o.status>=400&&(g(e,"keys_revoke",new Error(`revoke failed (${o.status})`),m.ApiClientError),l(m.ApiClientError)),j(e,{ok:!0,revoked:t},()=>console.log(`\u2713 Revoked ${t}`))}async function at(t){w(t.target),p(t,"list_prepare",{target:t.target});try{let e=await L.listProjects(),o=t.limit,r=typeof o=="number"&&Number.isFinite(o)&&o>0?e.data.slice(0,o):e.data;if(p(t,"list_complete",{count:r.length,total:e.data.length,truncated:r.length<e.data.length,projects:r}),!t.json){if(e.data.length===0){console.log("No projects found.");return}for(let n of r){let i=new Date(n.createdAt).toLocaleDateString();console.log(` ${n.id} ${n.name} (${i})`)}r.length<e.data.length&&console.log(` \u2026 ${e.data.length-r.length} more (raise --limit to see all)`)}}catch(e){g(t,"list",e,y(e)),t.json||console.error(`Failed to list projects: ${v(e)}`),l(y(e))}}import{readFile as Ho,stat as Vo}from"fs/promises";import{existsSync as Zo}from"fs";import{basename as Qo,extname as Yo}from"path";var Xo=4e3;function er(t){switch(Yo(t).toLowerCase()){case".mp4":return"video/mp4";case".mov":return"video/quicktime";case".webm":return"video/webm";case".mkv":return"video/x-matroska";case".wav":return"audio/wav";case".mp3":return"audio/mpeg";case".m4a":return"audio/mp4";case".aac":return"audio/aac";default:return"video/mp4"}}var ct=["vo","music","sfx","ambience"];async function dt(t,e){Zo(t)||(g(e,"preflight",new Error(`File not found: ${t}`),m.UserError),e.json||console.error(`File not found: ${t}`),l(m.UserError));let o=Qo(t),r=(await Vo(t)).size,n=er(o);if(e.audioRole&&!ct.includes(e.audioRole)){let b=new Error(`--audio-role must be one of ${ct.join("|")} (got "${e.audioRole}")`);g(e,"preflight",b,m.UserError),e.json||console.error(b.message),l(m.UserError)}let i=e.audioRole;if(e.dryRun){p(e,"upload_dry_run",{file:o,sizeBytes:r,contentType:n,target:e.target,analyzeAfter:!!e.analyze,wouldCall:"POST /v1/media \u2192 presigned PUT \u2192 POST /v1/media/:id/finalize \u2192 poll processing"}),e.json||console.log(`[dry-run] Would upload ${o} (${(r/1024/1024).toFixed(1)} MB, ${n}) to ${e.target}.`);return}w(e.target),p(e,"upload_prepare",{file:o,sizeBytes:r,contentType:n,target:e.target});let s=C("Preparing upload\u2026",e.json),a,f;try{let b=await F.createMediaUpload({filename:o,contentType:n,size:r});a=b.id,f=b.uploadUrl,s.succeed("Ready"),p(e,"upload_ready",{mediaItemId:a})}catch(b){s.fail(`Failed: ${v(b)}`),g(e,"upload_prepare",b,y(b)),l(y(b))}let u=Date.now(),c=C(`Uploading ${o} (${(r/1024/1024).toFixed(1)} MB)\u2026`,e.json);try{let b=await Ho(t),_=await fetch(f,{method:"PUT",headers:{"Content-Type":n},body:b});if(!_.ok)throw new Error(`presigned PUT failed: ${_.status} ${_.statusText}`);await F.finalizeMedia(a,i?{audioRole:i}:{}),c.succeed(`Uploaded: ${o}`),p(e,"upload_complete",{mediaItemId:a,bytesUploaded:r,...i?{audioRole:i}:{},durationMs:Date.now()-u})}catch(b){c.fail(`Upload failed: ${v(b)}`),g(e,"upload",b,m.NetworkError),l(m.NetworkError)}let d=C("Processing (transcription)\u2026",e.json),h=Date.now(),x=null;for(;;){await new Promise(b=>setTimeout(b,Xo));try{let b=await F.getMedia(a),_=b?.processingStatus?.phase??"unknown",J=b?.processingStatus?.percent??null,H=Math.round((Date.now()-h)/1e3),ue=J!=null?` \xB7 ${Math.round(J*100)}%`:"";if(d.text=`Processing\u2026 ${_}${ue} (${H}s)`,p(e,"process_progress",{phase:_,percent:J,elapsedSec:H}),_==="complete"||_==="completed"){d.succeed(`Ready: ${a}`),x=b,p(e,"process_complete",{mediaItemId:a,durationMs:Date.now()-h,item:b});break}if(_==="error"){let V=b?.processingStatus?.error??"unknown error";d.fail(`Processing failed: ${V}`),g(e,"process",new Error(V),m.ApiServerError),l(m.ApiServerError)}}catch{}}if(e.analyze){T(`
|
|
52
|
+
Media item ID: ${a}`,e);let{analyzeCommand:b}=await import("./analyze-4EZTZEAG.js");await b(a,{target:e.target,wait:!0,json:e.json});return}e.json||j(e,{mediaItemId:a,item:x},()=>{console.log(`
|
|
53
|
+
Media item ID: ${a}`),console.log(`
|
|
54
|
+
Run \`cueframe analyze ${a} --target ${e.target}\` to generate clip suggestions.`)})}function Se(t){let e=Math.floor(t/60),o=Math.floor(t%60);return`${e}:${String(o).padStart(2,"0")}`}async function mt(t,e){t!==void 0&&E(t,"mediaItemId",e),w(e.target),p(e,"clips_prepare",{target:e.target,mode:t?"suggestions":"media-list",...t?{mediaItemId:t}:{}});try{if(!t){let r=await F.listMedia();if(p(e,"clips_complete",{mode:"media-list",count:r.data.length,media:r.data}),!e.json){if(r.data.length===0){console.log("No media items found. Import a video first.");return}console.log("Media items (pass the ID to `cueframe clips <id>`):"),console.log("");for(let n of r.data){let i=n.duration?`${Se(n.duration)} `:"",s=n.processingStatus?.phase??"unknown",a=s==="complete"?"":` [${s}]`;console.log(` ${n.id} ${n.name} ${i}${a}`)}}return}let o=await Ae.listMediaSuggestions(t);if(p(e,"clips_complete",{mode:"suggestions",mediaItemId:t,count:o.suggestions.length,suggestions:o.suggestions}),!e.json){if(o.suggestions.length===0){console.log("No clip suggestions found for this media item."),console.log("If analysis is still running, try again shortly. Otherwise the video may not have suitable clips.");return}console.log(`${o.suggestions.length} clip suggestion${o.suggestions.length!==1?"s":""}:`),console.log("");for(let r of o.suggestions){let n=`${Se(r.trim.start)} \u2192 ${Se(r.trim.end)}`,i=(r.trim.end-r.trim.start).toFixed(1);console.log(` ${r.id}`),console.log(` ${r.title}`),console.log(` ${n} (${i}s) ${r.format} score: ${r.score}`),r.reason&&console.log(` ${r.reason}`),console.log("")}}}catch(o){g(e,"clips",o,y(o)),e.json||console.error(`Failed: ${v(o)}`),l(y(o))}}import{readFileSync as tr}from"fs";async function lt(t,e){E(t,"projectId",e),w(e.target),p(e,"composition_get_prepare",{projectId:t});let o=await G(`/v1/projects/${t}/composition`,{method:"GET"},e,"composition_get");o.status>=400&&(K(o,e,"composition_get"),l(A(o.status)));let r=o.headers.etag,n=r&&ft(r);p(e,"composition_get_complete",{projectId:t,etag:n,status:o.status}),j(e,{etag:n,composition:o.body},()=>{n&&console.log(`# ETag: ${n}`),console.log(JSON.stringify(o.body,null,2))})}async function ut(t,e){E(t,"projectId",e),e.body||(console.error("--body is required (inline JSON, @file.json, or @- for stdin)"),l(m.UserError)),w(e.target);let o=await Ce(t,e),r=await gt(e.body);p(e,"composition_put_prepare",{projectId:t,ifMatch:o});let n=new Headers({"content-type":"application/json","if-match":o}),i=await G(`/v1/projects/${t}/composition`,{method:"PUT",headers:n,body:r},e,"composition_put");i.status>=400&&(K(i,e,"composition_put"),l(A(i.status)));let s=i.headers.etag;p(e,"composition_put_complete",{projectId:t,etag:s,status:i.status,response:i.body}),j(e,{etag:s,response:i.body},()=>{console.log(`Composition saved (ETag: ${s??"unknown"}).`),i.body&&typeof i.body=="object"&&console.log(JSON.stringify(i.body,null,2))})}async function ce(t,e){E(t,"projectId",e),e.suggestionId||(console.error("--suggestion <suggestionId> is required"),l(m.UserError)),w(e.target);let o=await Ce(t,e),r;if(e.format)try{r=JSON.parse(e.format)}catch{console.error(`--format must be JSON, e.g. '{"aspectRatio":"9:16","fps":30,"resolution":"fhd"}'`),l(m.UserError)}let n=JSON.stringify({suggestionId:e.suggestionId,...r?{format:r}:{}});p(e,"composition_from_suggestion_prepare",{projectId:t,suggestionId:e.suggestionId,ifMatch:o});let i,s=o,a=0,f=3;for(;;){a++;let c=new Headers({"content-type":"application/json","if-match":s});if(i=await G(`/v1/projects/${t}/composition/from-suggestion`,{method:"POST",headers:c,body:n},e,"composition_from_suggestion"),!(i.status===409&&typeof i.body=="object"&&i.body!==null&&i.body.code==="stale_etag"))break;if(a>f){p(e,"composition_from_suggestion_etag_retries_exhausted",{projectId:t,attempts:f});break}p(e,"composition_from_suggestion_etag_retry",{projectId:t,attempt:a,reason:"stale_etag"}),s=await Ce(t,e)}i.status>=400&&(K(i,e,"composition_from_suggestion"),l(A(i.status)));let u=i.headers.etag;p(e,"composition_from_suggestion_complete",{projectId:t,suggestionId:e.suggestionId,etag:u,status:i.status,response:i.body,attempts:a}),j(e,{etag:u,response:i.body},()=>{console.log(`Composition built from suggestion ${e.suggestionId} (ETag: ${u??"unknown"}).`),i.body&&typeof i.body=="object"&&console.log(JSON.stringify(i.body,null,2))})}async function pt(t){t.body||(console.error("--body is required (inline JSON, @file.json, or @- for stdin)"),l(m.UserError)),w(t.target);let e=await gt(t.body);p(t,"composition_validate_prepare",{});let o=new Headers({"content-type":"application/json"}),r=await G("/v1/composition/validate",{method:"POST",headers:o,body:e},t,"composition_validate");r.status>=400&&(K(r,t,"composition_validate"),l(A(r.status))),p(t,"composition_validate_complete",{status:r.status}),j(t,{valid:!0},()=>{console.log("\u2713 Composition is valid.")})}function ft(t){return t.replace(/^W\//,"").replace(/-gzip(?=("?)$)/,"")}async function Ce(t,e){if(e.force)return"*";if(e.ifMatch)return e.ifMatch;let o=await G(`/v1/projects/${t}/composition`,{method:"GET"},e,"composition_etag_fetch");if(o.status===404)return T("No existing composition; treating as create (If-Match: *).",e),"*";o.status>=400&&(K(o,e,"composition_etag_fetch"),l(A(o.status)));let r=o.headers.etag;return r||(g(e,"composition_etag_fetch",new Error("Server returned no ETag on composition GET; cannot safely thread If-Match. Pass --force to overwrite anyway."),m.ApiServerError),l(m.ApiServerError)),ft(r)}async function gt(t){if(t.startsWith("@")){let e=t.slice(1);if(e==="-"){let o=[];for await(let r of process.stdin)o.push(Buffer.isBuffer(r)?r:Buffer.from(r));return Buffer.concat(o).toString("utf-8")}return tr(e,"utf-8")}return t}async function G(t,e,o,r){try{return await k(t,e)}catch(n){g(o,r,n,m.NetworkError),l(m.NetworkError)}}function K(t,e,o){let r=t.body?.error,n=r?.code??"unknown",i=r?.message??t.statusText,s=or(n,t.status,r?.details),a=A(t.status);e.json?g(e,o,Object.assign(new Error(i),{code:n,status:t.status,details:r?.details,advice:s}),a):(process.stderr.write(`\u2716 ${o}: ${i} (${n}, ${t.status})
|
|
51
55
|
`),s&&process.stderr.write(` \u2192 ${s}
|
|
52
|
-
`))}function
|
|
56
|
+
`))}function or(t,e,o){let r=new I(e,{code:t,message:"",details:o&&typeof o=="object"?o:void 0}),n=Te(r);return n||(e===404?"Project or composition not found. Run `cueframe list` to confirm the project ID; the composition may not yet exist.":null)}import{readFile as ti}from"fs/promises";async function de(t,e){let o=e.map(s=>s==null?"null":String(s)).join(":"),r=`${t}:${o}`,n=new TextEncoder().encode(r),i=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(i),s=>s.toString(16).padStart(2,"0")).join("")}var ht=1500,rr=1800*1e3;async function*nr(t,e,o){let r=Re();if(!r?.baseUrl)throw new Error("cueframe: createClient({baseUrl}) must be called before iterComposeEvents.");let n=r.baseUrl.replace(/\/$/,"")+`/v1/projects/${encodeURIComponent(t)}/compose/jobs/${encodeURIComponent(e)}/stream`,i=new Headers({accept:"text/event-stream",...r.headers??{}});r.apiKey&&!i.has("authorization")&&i.set("authorization",`Bearer ${r.apiKey}`);let a=await(r.fetch??fetch)(n,{method:"GET",headers:i,signal:o});if(!a.ok){let d;try{d=(await a.json()).error??{code:"unknown",message:a.statusText}}catch{d={code:"unknown",message:a.statusText}}throw new I(a.status,d,a.headers.get("x-request-id")??void 0)}if(!a.body)throw new Error("SSE response has no body");let f=a.body.getReader(),u=new TextDecoder("utf-8"),c="";try{for(;;){let{value:d,done:h}=await f.read();if(h)break;c+=u.decode(d,{stream:!0});let x=c.indexOf(`
|
|
53
57
|
|
|
54
|
-
`);for(;
|
|
58
|
+
`);for(;x!==-1;){let b=c.slice(0,x);c=c.slice(x+2);let _=ir(b);_&&(yield _),x=c.indexOf(`
|
|
55
59
|
|
|
56
|
-
`)}}}finally{try{f.releaseLock()}catch{}}}function
|
|
60
|
+
`)}}}finally{try{f.releaseLock()}catch{}}}function ir(t){if(!t.trim())return null;let e=null,o=[];for(let n of t.split(`
|
|
57
61
|
`)){if(!n||n.startsWith(":"))continue;let i=n.indexOf(":");if(i===-1)continue;let s=n.slice(0,i),a=n.slice(i+1).replace(/^ /,"");s==="event"?e=a:s==="data"&&o.push(a)}if(!e||o.length===0||e!=="compose_event")return null;let r;try{r=JSON.parse(o.join(`
|
|
58
|
-
`))}catch{return null}return{event:e,data:r}}async function
|
|
62
|
+
`))}catch{return null}return{event:e,data:r}}async function sr(t,e,o={}){let r=Date.now()+(o.timeoutMs??rr);for(;Date.now()<r;){let n=null;try{for await(let i of nr(t,e)){if(o.onTypedEvent?.(i.data),i.data.event==="checkpoint_reached"){let s=i.data.data;n={kind:"checkpoint",...s.checkpointId?{checkpointId:s.checkpointId}:{},stage:String(s.stage??""),version:Number(s.version??0),...s.artifactSummary?{artifactSummary:s.artifactSummary}:{}};break}if(i.data.event==="job_completed"){let s=i.data.data;n={kind:"complete",compositionId:s.compositionId??null,etag:s.etag??null};break}if(i.data.event==="job_failed"){let a=i.data.data.reason??"compose_failed";a==="cancelled"||a.startsWith("cancelled")?n={kind:"cancelled",reason:a}:n={kind:"error",message:a};break}}}catch(i){if(i instanceof I)throw i;await new Promise(s=>setTimeout(s,ht));continue}if(n)return n;await new Promise(i=>setTimeout(i,ht))}return{kind:"error",message:`Timed out waiting for compose to reach terminal state. ComposeJob: ${e}, Project: ${t}.`}}async function yt(t,e){E(t,"suggestionId",e),E(e.project,"projectId",e),w(e.target),p(e,"compose_prepare",{suggestionId:t,projectId:e.project,target:e.target});let o=e.idempotencyKey??await de("compose",[e.project,t,e.seed??"auto"]);p(e,"idempotency_key",{scope:"compose",key:o,overridden:!!e.idempotencyKey,seed:e.seed??null});let r=C(`Starting compose for ${t}\u2026`,e.json),n,i=!1;try{let u={suggestionId:t};if(e.critique!==void 0&&(u.critique=e.critique),e.clientNonce!==void 0&&(u.clientNonce=e.clientNonce),e.baseline!==void 0&&(u.parentJobId=e.baseline),e.maxCandidates!==void 0&&(u.maxCandidates=e.maxCandidates),e.holdAt!==void 0&&e.holdAt.length>0&&(u.holdAt=e.holdAt),e.seed!==void 0){let d=Number(e.seed);Number.isInteger(d)&&(u.seed=d)}let c=await k(`/v1/projects/${e.project}/compose`,{method:"POST",headers:{"content-type":"application/json","idempotency-key":o},body:JSON.stringify(u)});if(c.status>=400){let d=c.body?.error,h=d?.message??c.statusText;throw new I(c.status,{code:d?.code??"unknown",message:h})}n=c.body,i=c.headers["idempotency-replay"]==="true"}catch(u){r.fail(`Failed to start compose: ${v(u)}`),g(e,"compose_create",u,y(u)),l(y(u))}i?(p(e,"compose_idempotent_replay",{composeJobId:n.composeJobId,projectId:n.projectId,workflowId:n.workflowId,idempotencyKey:o}),r.text=`Compose already in flight or complete (job ${n.composeJobId})\u2026`):(p(e,"compose_started",{composeJobId:n.composeJobId,projectId:n.projectId,workflowId:n.workflowId}),r.text=`Composing (job ${n.composeJobId})\u2026`);let s,a,f=Date.now();try{s=await sr(e.project,n.composeJobId,{onTypedEvent:u=>{if(p(e,`compose:${u.event}`,{composeJobId:n.composeJobId,...u.data,timestamp:u.timestamp}),e.json)return;let c=Math.round((Date.now()-f)/1e3),d=u.data;if(u.event==="job_started")r.text=`Composing\u2026 ${d.candidateCount??"?"} candidates (${c}s)`;else if(u.event==="candidate_phase_started")r.text=`Candidate ${d.candidateIndex} starting (${c}s)`;else if(u.event==="candidate_phase_evaluated"){let h=d.perCriterion,x=h?`E${(h.editorial?.score??0).toFixed(1)} S${(h.spatial?.score??0).toFixed(1)} B${(h.brand?.score??0).toFixed(1)} C${(h.caption?.score??0).toFixed(1)}`:"";r.text=`Candidate ${d.candidateIndex} evaluated \xB7 ${x} (${c}s)`}else if(u.event==="critique_retry_started")r.text=`Candidate ${d.candidateIndex} retry ${d.attemptNumber} (${c}s)`;else if(u.event==="candidate_completed"){let h=typeof d.composite=="number"?d.composite.toFixed(2):"?";r.text=`Candidate ${d.candidateIndex} done \xB7 composite ${h} (${c}s)`}else if(u.event==="winner_selected"){let h=typeof d.composite=="number"?d.composite.toFixed(2):"?";(d.route==="publish"||d.route==="handoff")&&(a=d.route);let x=a==="handoff"?" \xB7 \u2691 handoff":a==="publish"?" \xB7 \u2713 publish":"";r.text=`Picked candidate ${d.candidateIndex} \xB7 composite ${h}${x} (${c}s)`}}})}catch(u){r.fail(`Compose watch failed: ${v(u)}`),g(e,"compose_watch",u,y(u)),l(y(u))}if(s.kind==="checkpoint"){r.warn(`Compose paused at the "${s.stage}" checkpoint (version ${s.version}) \u2014 awaiting your review.`),p(e,"compose_checkpoint",{composeJobId:n.composeJobId,projectId:e.project,...s.checkpointId?{checkpointId:s.checkpointId}:{},stage:s.stage,version:s.version,...s.artifactSummary?{artifactSummary:s.artifactSummary}:{}}),e.json||(console.log(`
|
|
59
63
|
Stage "${s.stage}" (version ${s.version}) is ready for review.`),s.artifactSummary&&console.log(` ${s.artifactSummary}`),s.checkpointId?(console.log(`
|
|
60
64
|
Review the packet (artifact, stills, verdicts, quote):`),console.log(` GET /v1/checkpoints/${s.checkpointId}`),console.log(" Then answer it:"),console.log(` cueframe compose resume ${s.checkpointId} --approve -t ${e.target} (or --revise --comments @notes.json [--edits @edits.json] / --abandon)`)):(console.log(`
|
|
61
65
|
Inspect it:`),console.log(` cueframe compose inspect ${n.composeJobId} --project ${e.project} -t ${e.target}`)));return}if(s.kind==="complete"){r.succeed(`Compose complete (job ${n.composeJobId})`),p(e,"compose_complete",{composeJobId:n.composeJobId,projectId:e.project,compositionId:s.compositionId,etag:s.etag}),e.json||(console.log(`
|
|
62
66
|
Project: ${e.project}`),s.compositionId&&console.log(` Composition: ${s.compositionId}`),s.etag&&console.log(` ETag: ${s.etag}`),a==="publish"?console.log(" Verdict: \u2713 publish \u2014 clears the quality bar, ships autonomously"):a==="handoff"&&console.log(" Verdict: \u2691 handoff \u2014 below bar / floor violation; review in your NLE before publishing"),console.log(`
|
|
63
|
-
\u2192 Render with: cueframe render ${e.project} -t ${e.target}`));return}s.kind==="cancelled"&&(r.warn(`Compose cancelled: ${s.reason}`),p(e,"compose_cancelled",{composeJobId:n.composeJobId,reason:s.reason}),m
|
|
64
|
-
${r.id} ${r.name}`),t.fromSuggestion&&(t.cheap?await
|
|
65
|
-
${r.id} ${r.name} \u2190 composed from ${t.fromSuggestion} ${n}`)}}async function bt(t,e){
|
|
66
|
-
Re-fetch via GET /v1/projects/${e.project}/renders/${t}.`),m
|
|
67
|
-
MP4 URL (1-hour TTL): ${t}`),m
|
|
67
|
+
\u2192 Render with: cueframe render ${e.project} -t ${e.target}`));return}s.kind==="cancelled"&&(r.warn(`Compose cancelled: ${s.reason}`),p(e,"compose_cancelled",{composeJobId:n.composeJobId,reason:s.reason}),l(m.UserError)),r.fail(`Compose failed: ${s.message}`),g(e,"compose_run",new Error(s.message),m.ApiServerError),l(m.ApiServerError)}async function wt(t){let e=t.aspect?{aspectRatio:t.aspect,fps:t.fps??30,resolution:t.resolution??"fhd"}:void 0;if(t.dryRun){if(p(t,"project_create_dry_run",{name:t.name,target:t.target,format:e??null,fromSuggestion:t.fromSuggestion??null,cheap:t.cheap??!1,wouldCall:t.fromSuggestion?t.cheap?"POST /v1/projects \u2192 POST /v1/projects/:id/composition/from-suggestion (sync translator)":"POST /v1/projects \u2192 POST /v1/projects/:id/compose (async) \u2192 SSE watch":"POST /v1/projects"}),!t.json){let n=t.cheap?" (--cheap: deterministic translator)":"";console.log(`[dry-run] Would create project "${t.name}" on ${t.target}`+(t.fromSuggestion?` from suggestion ${t.fromSuggestion}${n}.`:"."))}return}w(t.target),p(t,"project_create_prepare",{name:t.name,target:t.target,fromSuggestion:t.fromSuggestion??null,cheap:t.cheap??!1});let o=C(`Creating project "${t.name}"\u2026`,t.json),r;try{r=await L.createProject({name:t.name,format:e}),o.succeed(`Created: ${r.id}`)}catch(n){o.fail(`Failed: ${v(n)}`),g(t,"project_create",n,y(n)),l(y(n))}if(p(t,"project_create_complete",{project:r}),!t.json&&!t.fromSuggestion&&console.log(`
|
|
68
|
+
${r.id} ${r.name}`),t.fromSuggestion&&(t.cheap?await ce(r.id,{target:t.target,suggestionId:t.fromSuggestion,json:t.json,force:!0}):await yt(t.fromSuggestion,{target:t.target,project:r.id,json:t.json}),!t.json)){let n=t.cheap?"(--cheap)":"(composed)";console.log(`
|
|
69
|
+
${r.id} ${r.name} \u2190 composed from ${t.fromSuggestion} ${n}`)}}async function bt(t,e){E(t,"projectId",e),w(e.target),p(e,"project_delete_prepare",{projectId:t});try{await L.deleteProject(t),p(e,"project_delete_complete",{projectId:t}),j(e,{ok:!0,projectId:t},()=>{console.log(`Project ${t} deleted.`)})}catch(o){g(e,"project_delete",o,y(o)),e.json||console.error(`\u2716 project delete: ${v(o)}`),l(y(o))}}async function vt(t,e){E(t,"mediaId",e),w(e.target),p(e,"media_delete_prepare",{mediaId:t});try{await F.deleteMedia(t),p(e,"media_delete_complete",{mediaId:t}),j(e,{ok:!0,mediaId:t},()=>{console.log(`Media ${t} deleted.`)})}catch(o){g(e,"media_delete",o,y(o)),e.json||console.error(`\u2716 media delete: ${v(o)}`),l(y(o))}}import{writeFileSync as ar}from"fs";import{resolve as cr}from"path";var jt=1500,dr=4e3,mr=1800*1e3;async function me(t,e,o={}){let r=Date.now()+(o.timeoutMs??mr),n=Date.now();for(;Date.now()<r;){let i=null,s=!1;try{for await(let a of Oe(t,e)){if(a.event==="progress"){let f=Math.round((Date.now()-n)/1e3);if(o.spinner){let u=Math.round(a.data.percent*100);o.spinner.text=`Rendering\u2026 ${a.data.phase}${u>0?` \xB7 ${u}%`:""} (${f}s)`}o.onProgress?.({phase:a.data.phase,percent:a.data.percent,elapsedSec:f});continue}a.event==="complete"?i={kind:"complete",outputUrl:a.data.outputUrl,outputExpiresAt:a.data.outputExpiresAt,duration:a.data.duration}:i={kind:"failed",message:a.data.message};break}}catch(a){if(a instanceof I)s=!0;else{await new Promise(f=>setTimeout(f,jt));continue}}if(i)return i;if(s){let a=await lr(t,e);if(a)return a;await new Promise(f=>setTimeout(f,dr));continue}await new Promise(a=>setTimeout(a,jt))}return{kind:"failed",message:`Timed out waiting for render to reach a terminal state. Render ID: ${e}, Project ID: ${t}.`}}async function lr(t,e){let o=await Pe.getRender(t,e);return o.status==="complete"?{kind:"complete",outputUrl:o.outputUrl??null,outputExpiresAt:null,duration:null}:o.status==="error"||o.status==="cancelled"?{kind:"failed",message:o.error??`Render ${o.status}`}:null}async function Et(t,e){E(t,"renderId",e),E(e.project,"projectId",e),w(e.target),p(e,"render_watch_prepare",{renderId:t,projectId:e.project,target:e.target});let o=C(`Watching render ${t}\u2026`,e.json),r;try{r=await me(e.project,t,{spinner:o,onProgress:i=>p(e,"render_progress",{renderId:t,...i})})}catch(i){o.fail(`Failed to watch render: ${v(i)}`),g(e,"render_watch",i,y(i)),l(y(i))}r.kind==="failed"&&(o.fail(r.message),g(e,"render_watch",new Error(r.message),m.ApiServerError),l(m.ApiServerError)),o.succeed(`Render complete (${t})`);let n=null;e.download&&r.outputUrl?n=await le(r.outputUrl,e.out??`./reel-${t.slice(0,8)}.mp4`,e.json):r.outputUrl||(g(e,"render_watch",new Error("Render reported complete but no outputUrl was returned."),m.ApiServerError),e.json||console.error(`Render reported complete but no outputUrl was returned.
|
|
70
|
+
Re-fetch via GET /v1/projects/${e.project}/renders/${t}.`),l(m.ApiServerError)),p(e,"render_complete",{renderId:t,projectId:e.project,outputUrl:r.outputUrl,outputExpiresAt:r.outputExpiresAt,duration:r.duration,outputPath:n}),e.json||(r.outputUrl&&console.log(`MP4 URL: ${r.outputUrl}`),r.outputExpiresAt&&console.log(`Expires: ${r.outputExpiresAt}`),r.duration!=null&&console.log(`Duration: ${r.duration}s`))}async function le(t,e,o){let r=cr(e),n=C(`Downloading \u2192 ${r}\u2026`,o);try{let i=await fetch(t);if(!i.ok)throw new Error(`HTTP ${i.status}`);let s=Buffer.from(await i.arrayBuffer());return ar(r,s),n.succeed(`Saved: ${r} (${(s.length/1024/1024).toFixed(1)} MB)`),r}catch(i){n.fail(`Download failed: ${v(i)}`),console.error(`
|
|
71
|
+
MP4 URL (1-hour TTL): ${t}`),l(m.NetworkError)}}async function ur(t){let e=await k(`/v1/projects/${t}/composition`,{method:"GET"});return e.status===404?"no-composition":e.status>=400?"unknown-composition":e.headers.etag??"no-etag"}async function xt(t,e){if(E(t,"projectId",e),e.dryRun){p(e,"render_dry_run",{projectId:t,target:e.target,wouldCall:"POST /v1/projects/:id/renders \u2192 SSE watch \u2192 download MP4"}),e.json||console.log(`[dry-run] Would render project ${t} on ${e.target}.`);return}w(e.target),p(e,"render_prepare",{projectId:t,target:e.target});let o;try{o=e.idempotencyKey??await de("render",[t,await ur(t)]),p(e,"idempotency_key",{scope:"render",key:o,overridden:!!e.idempotencyKey})}catch(c){o="",p(e,"idempotency_key",{scope:"render",key:null,skipped:!0,reason:c instanceof Error?c.message:String(c)})}let r=C("Queuing render\u2026",e.json),n,i,s=!1;try{let c=e.aspect?{format:{aspectRatio:e.aspect,fps:e.fps??30,resolution:e.resolution??"fhd"}}:{};e.priority&&(c.priority=e.priority),e.intent&&(c.intent=e.intent);let d={"content-type":"application/json"};o&&(d["idempotency-key"]=o);let h=await k(`/v1/projects/${t}/renders`,{method:"POST",headers:d,body:JSON.stringify(c)});if(h.status>=400){let b=h.body?.error;throw new I(h.status,{code:b?.code??"unknown",message:b?.message??h.statusText})}let x=h.body;n=x.id,i=x.status,s=h.headers["idempotency-replay"]==="true",r.succeed(s?`Render replayed: ${n} (status: ${i})`:`Render queued: ${n}`)}catch(c){r.fail(`Failed: ${v(c)}`),g(e,"render_prepare",c,y(c)),l(y(c))}s?p(e,"render_idempotent_replay",{renderId:n,projectId:t,status:i,idempotencyKey:o}):p(e,"render_queued",{renderId:n,projectId:t});let a=C("Rendering\u2026",e.json),f;try{f=await me(t,n,{spinner:a,onProgress:c=>p(e,"render_progress",{renderId:n,...c})})}catch(c){a.fail(`Failed to watch render: ${v(c)}`),g(e,"render_progress",c,y(c)),l(y(c))}f.kind==="failed"&&(a.fail(f.message),g(e,"render_progress",new Error(f.message),m.ApiServerError),l(m.ApiServerError)),a.succeed("Render complete"),f.outputUrl||(g(e,"render_complete",new Error("Render reported complete but no outputUrl was returned."),m.ApiServerError),e.json||console.error(`Render reported complete but no outputUrl was returned.
|
|
68
72
|
Render ID: ${n}
|
|
69
73
|
Project ID: ${t}
|
|
70
|
-
Re-fetch via GET /v1/projects/${t}/renders/${n} once the URL is signed.`),m
|
|
74
|
+
Re-fetch via GET /v1/projects/${t}/renders/${n} once the URL is signed.`),l(m.ApiServerError));let u=await le(f.outputUrl,e.out??`./reel-${n.slice(0,8)}.mp4`,e.json);p(e,"render_complete",{renderId:n,projectId:t,outputUrl:f.outputUrl,outputExpiresAt:f.outputExpiresAt,duration:f.duration,outputPath:u})}import pr from"open";import{createAuthClient as fr}from"better-auth/client";import{deviceAuthorizationClient as gr}from"better-auth/client/plugins";async function St(t){let e=N(t.target),o=fr({baseURL:e,plugins:[gr()]}),r=C("Requesting device code\u2026",t.json),n;try{let{data:u,error:c}=await o.device.code({client_id:"cueframe-cli",scope:"openid profile email"});(c||!u)&&(r.fail(`Could not start login: ${c?.message??"unknown error"}`),l(m.NetworkError)),n=u}catch(u){r.fail(`Could not start login: ${u instanceof Error?u.message:String(u)}`),l(m.NetworkError)}r.succeed("Device code issued");let i=n.verification_uri_complete??n.verification_uri;T("",t),T(` Visit: ${i}`,t),T(` Code: ${n.user_code}`,t),T("",t);try{await pr(i)}catch{}let s=C("Waiting for approval in browser\u2026",t.json),a=Date.now()+n.expires_in*1e3,f=n.interval*1e3;for(;Date.now()<a;){await new Promise(u=>setTimeout(u,f));try{let{data:u,error:c}=await o.device.token({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:n.device_code,client_id:"cueframe-cli"});if(u?.access_token){let x=u.access_token;Z(x,t.target,t.url),s.succeed(`Logged in. Token saved for target "${t.target}".`),j(t,{ok:!0,target:t.target,apiUrl:e},()=>{});return}let d=u??c,h=d?.error;h==="authorization_pending"||(h==="slow_down"?f+=5e3:h==="access_denied"?(s.fail("Access denied in the browser."),l(m.UserError)):h==="expired_token"?(s.fail("Device code expired before approval. Run `cueframe login` again."),l(m.UserError)):h&&(s.fail(`Login failed: ${d?.error_description??h}`),l(m.ApiClientError)))}catch{}}s.fail("Timed out waiting for approval. Run `cueframe login` again."),l(m.UserError)}import{readFileSync as hr}from"fs";var Ct=new Set(["GET","POST","PUT","PATCH","DELETE"]);async function _t(t,e,o){let r=t.toUpperCase();Ct.has(r)||(console.error(`Unsupported method: ${t}. Allowed: ${[...Ct].join(", ")}.`),l(m.UserError)),e.startsWith("/")||(console.error(`Path must start with '/'. Got: ${e}`),l(m.UserError)),w(o.target);let n=br(o.header??[]),i=await vr(o.body,r);i!==void 0&&!n.has("content-type")&&n.set("content-type","application/json");let s;try{s=await k(e,{method:r,headers:n,body:i})}catch(a){console.error(a instanceof Error?a.message:String(a)),l(m.NetworkError)}wr(s,{include:!!o.include,json:!!o.json,method:r,path:e}),l(yr(s.status))}function yr(t){return t===402?m.PaymentRequired:t>=500?m.ApiServerError:t>=400?m.ApiClientError:m.Success}function wr(t,{include:e,json:o,method:r,path:n}){if(o){console.log(JSON.stringify({status:t.status,statusText:t.statusText,headers:t.headers,body:t.body}));return}if(e){process.stdout.write(`HTTP/1.1 ${t.status} ${t.statusText}
|
|
71
75
|
`);for(let[i,s]of Object.entries(t.headers))process.stdout.write(`${i}: ${s}
|
|
72
76
|
`);process.stdout.write(`
|
|
73
77
|
`),$t(t.body,t.status>=400);return}if(t.status===204||t.body===null){console.error(`${r} ${n} \u2192 ${t.status} (no content)`);return}$t(t.body,t.status>=400)}function $t(t,e){let o=e?process.stderr:process.stdout;t!=null&&(typeof t=="string"?o.write(t.endsWith(`
|
|
74
78
|
`)?t:t+`
|
|
75
79
|
`):o.write(JSON.stringify(t,null,2)+`
|
|
76
|
-
`))}function
|
|
80
|
+
`))}function br(t){let e=new Headers;for(let o of t){let r=o.indexOf(":");r===-1&&(console.error(`Invalid --header (expected "Name: value"): ${o}`),l(m.UserError));let n=o.slice(0,r).trim(),i=o.slice(r+1).trim();e.set(n,i)}return e}async function vr(t,e){if(t){if(t.startsWith("@")){let o=t.slice(1);return o==="-"?kt():hr(o,"utf-8")}return t}if(!(e==="GET"||e==="DELETE")&&!process.stdin.isTTY)return kt()}async function kt(){let t=[];for await(let e of process.stdin)t.push(Buffer.isBuffer(e)?e:Buffer.from(e));return Buffer.concat(t).toString("utf-8")}var It=/#\/components\/schemas\/([A-Za-z0-9_]+)/g;function jr(t,e){let o=new Set,r=[e];for(;r.length;){let n=r.pop();if(o.has(n)||!(n in t))continue;o.add(n);let i=JSON.stringify(t[n]),s;for(It.lastIndex=0;s=It.exec(i);)r.push(s[1])}return o}function Er(t){let e=t?.paths??{};for(let o of Object.values(e))if(o?.put?.operationId==="putComposition"){let r=o.put?.requestBody?.content?.["application/json"]?.schema?.$ref,n=typeof r=="string"?r.match(/#\/components\/schemas\/(.+)$/):null;if(n)return n[1]}return null}async function Rt(t,e){t!=="composition"&&(console.error(`Unknown schema '${t}'. Supported: composition.`),l(m.UserError)),Ie({baseUrl:N(e.target)});let o;try{o=await k("/v1/openapi.json",{method:"GET"})}catch(u){g(e,"schema",u,m.NetworkError),l(m.NetworkError)}if(o.status>=400){let u=A(o.status);g(e,"schema",new Error(`Failed to fetch /v1/openapi.json (${o.status})`),u),l(u)}let r=o.body,n=r?.components?.schemas??{},i=Er(r);(!i||!(i in n))&&(g(e,"schema",new Error("Could not locate the composition schema in openapi.json (putComposition body ref not found)."),m.ApiServerError),l(m.ApiServerError));let s=jr(n,i);s.delete(i);let a={};for(let u of[...s].sort())a[u]=n[u];let f={name:i,schema:n[i],referenced:a};j(e,f,()=>{console.log(JSON.stringify(f,null,2))})}import{writeFileSync as xr}from"fs";import{resolve as Sr}from"path";var Tt=1800*1e3,Cr=5e3;async function $e(t,e){E(e.projectId,"projectId",e),E(e.suggestionId,"suggestionId",e),w(e.target),p(e,"export_prepare",{projectId:e.projectId,suggestionId:e.suggestionId,format:t,target:e.target});let o=C(`Queuing ${t} export\u2026`,e.json),r;try{r=(await(t==="fcpxml"?Q.createFcpxmlExport:Q.createPremiereExport)(e.projectId,{clipSuggestionId:e.suggestionId})).id,o.succeed(`Export queued: ${r}`)}catch(f){o.fail(`Failed: ${v(f)}`),g(e,"export_prepare",f,y(f)),l(y(f))}if(p(e,"export_queued",{exportId:r,projectId:e.projectId,format:t}),!e.wait){T(`Poll status with: cueframe api GET /v1/projects/${e.projectId}/exports/${r}`,e);return}let n=await $r(e.projectId,r,e);n.kind==="failed"&&(g(e,"export_progress",Object.assign(new Error(n.message),n.error?{details:n.error}:{}),m.ApiServerError),e.json||console.error(`Export failed: ${n.message}`),l(m.ApiServerError)),n.outputUrl||(g(e,"export_complete",new Error("Export reported complete but no outputUrl was returned."),m.ApiServerError),e.json||console.error(`Export reported complete but no outputUrl was returned.
|
|
77
81
|
Export ID: ${r}
|
|
78
|
-
Re-fetch via GET /v1/projects/${e.projectId}/exports/${r}.`),m
|
|
79
|
-
Export URL (7-day TTL): ${t}`),m
|
|
80
|
-
${r.name} \u2014 ${r.description}`);for(let n of r.subcommands??[])console.log(` ${r.name} ${n.name} \u2014 ${n.description}`)}}function Dt(t){if(!t)return;let e=parseInt(t,10);if(e===24||e===30||e===60)return e;console.error(`Invalid --fps ${t}. Allowed: 24, 30, 60.`),m(l.UserError)}function Lt(){let t=new jr;t.name("cueframe").description("AI-assisted video editing and rendering").version("0.1.2").option("--json","Emit a structured JSON document on stdout instead of human-formatted output. Spinners are silenced.").option("--dry-run","Validate inputs and report what would happen \u2014 no API calls, no mutations. Applies to upload, analyze, project create, render.");let e=()=>t.opts();t.command("install").description("Install the cueframe-cli agent skill into ~/.claude/skills (Claude Code / Cursor / Codex).").action(()=>Ne({json:e().json})),t.command("init").description("Scaffold a CueFrame component workspace (cueframe.json + components dir) in the current repo, so `eject` / `new component` have a home and the render harness can discover them.").action(()=>We({json:e().json,dryRun:e().dryRun})),t.command("eject").description("Fork a built-in CueFrame primitive into cueframe/components/<id> as owned, editable source (renders on CueFrame).").argument("<primitive>","Primitive id (e.g. cinematic-title, heroText)").option("-f, --force","Overwrite an existing ejected component dir").action((c,d)=>He(c,{json:e().json,dryRun:e().dryRun,force:d.force})),t.command("new").description("Scaffold new owned source in the component workspace").command("component").description("Scaffold a blank custom component in cueframe/components/<name>").argument("<name>","Component id (e.g. my-badge)").option("-f, --force","Overwrite an existing non-empty component dir").action((c,d)=>Ye(c,{json:e().json,dryRun:e().dryRun,force:d.force})),t.command("push").description("Publish a locally-authored component (cueframe/components/<id>/index.tsx) to CueFrame so it renders server-side. Upserts by id.").argument("[id]","Component id to push (omit and use `cueframe sync` to push all)").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>et(c,{target:d.target,json:e().json})),t.command("sync").description("Publish EVERY component in the workspace (cueframe/components/*) to CueFrame. Upserts each by id.").option("-t, --target <target>","Target environment: prod (default), dev, local").action(c=>tt({target:c.target,json:e().json}));let r=t.command("keys").description("Manage API keys. `keys create` mints a scoped key \u2014 run `cueframe login` first (keys cannot mint keys).");r.command("create").description("Mint a scoped API key (cf_*). Requires a logged-in session.").requiredOption("-n, --name <name>","Key name, e.g. vaaya-staging").option("-s, --scope <scope>","Comma-separated resource:actions, e.g. media:rw,projects:rw,renders:rw (resources: media,sessions,projects,renders,webhooks; actions r/w)").option("--preset <preset>","Scope preset instead of --scope: readonly (read all) | editall (read+write all)").option("--expires <days>","Expire after N days (default: never)").action(c=>rt({...c,json:e().json})),r.command("list").description("List your API keys.").action(()=>nt({json:e().json})),r.command("revoke").description("Revoke an API key by id.").argument("<keyId>","Key id (from `cueframe keys list`)").action(c=>it(c,{json:e().json})),t.command("login").description("Browser-mediated sign-in (OAuth device flow). Recommended for laptops.").option("-t, --target <target>","Target environment: prod (default), dev, local").option("--url <url>","Override the API base URL (advanced)").action(c=>St({...c,json:e().json})),t.command("auth").description("Save a static API key (cf_live_\u2026 / cf_test_\u2026). Use for CI / headless environments.").argument("<api-key>","Your CueFrame API key").option("-t, --target <target>","Target environment: prod (default), dev, local").option("--url <url>","Override the API base URL (advanced)").action((c,d)=>{ee(c,d.target,d.url),e().json?console.log(JSON.stringify({ok:!0,target:d.target},null,2)):console.log(`API key saved for target "${d.target}"`)}),t.command("list").description("List projects").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-n, --limit <n>","Max projects to show","10").action(c=>st({target:c.target,limit:parseInt(c.limit),json:e().json}));let n=t.command("project").description("Project commands");n.command("create").description("Create a new project. With --from-suggestion, atomically build the composition from a clip suggestion in one round-trip \u2014 the project is then immediately renderable via `cueframe render <projectId>`.").requiredOption("-n, --name <name>","Project name").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-a, --aspect <ratio>","Aspect ratio: 9:16, 1:1, 16:9","9:16").option("--fps <n>","Frame rate","30").option("--resolution <r>","Resolution: hd, fhd, 2k, 4k","fhd").option("--from-suggestion <sug>","Clip suggestion publicId (sug_\u2026) \u2014 atomically builds the composition after project creation so render needs no further args").option("--cheap","With --from-suggestion: use the deterministic translator (no LLM, ~100ms) instead of the AI authoring pass. Useful for tests / programmatic flows.").action(c=>wt({name:c.name,target:c.target,aspect:c.aspect,fps:Dt(c.fps),resolution:c.resolution,fromSuggestion:c.fromSuggestion,cheap:c.cheap,json:e().json,dryRun:e().dryRun})),n.command("delete").description("Permanently delete a project (irreversible cleanup \u2014 removes the composition and render history).").argument("<projectId>","Project ID (from `cueframe list` or `project create`)").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>bt(c,{target:d.target,json:e().json})),t.command("media").description("Media library cleanup commands").command("delete").description("Permanently delete a media item (irreversible cleanup \u2014 removes the source and its derived assets).").argument("<mediaId>","Media item ID (from `cueframe clips`)").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>jt(c,{target:d.target,json:e().json})),t.command("upload").description("Upload a video file and process it").argument("<file>","Path to video file").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-a, --analyze","Run clip analysis after processing completes").action((c,d)=>dt(c,{target:d.target,analyze:d.analyze,json:e().json,dryRun:e().dryRun})),t.command("analyze").description("Trigger AI clip suggestion analysis for a media item").argument("<mediaItemId>","Media item ID (from `cueframe clips`)").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-w, --wait","Wait for analysis to complete and show results").action((c,d)=>Fe(c,{target:d.target,wait:d.wait,json:e().json,dryRun:e().dryRun})),t.command("clips").description("List AI-generated clip suggestions for a media item").argument("[mediaItemId]","Media item ID (omit to list your media library)").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>mt(c,{target:d.target,json:e().json}));let s=t.command("render").description("Render a project to MP4 (queues, watches via SSE, downloads). Renders whatever composition is saved on the project \u2014 build it first via `project create --from-suggestion` or `composition from-suggestion`.").allowExcessArguments(!1).argument("<projectId>","Project ID (from `cueframe list` or `project create`)").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-a, --aspect <ratio>","Aspect ratio: 9:16, 1:1, 16:9 (defaults to project format)").option("--fps <n>","Frame rate","30").option("--resolution <r>","Resolution: hd, fhd, 2k, 4k","fhd").option("-o, --out <path>","Output file path (default: ./reel-<id>.mp4)").option("--idempotency-key <key>",'Override the auto-derived Idempotency-Key. Default: sha256("render:<projectId>:<currentCompositionETag>"). Pass a fresh UUID to force a new render row.').option("--priority <p>","Routing intent: interactive (low-latency, access-gated), standard (default), background (lowest queue weight).").option("--intent <i>","Encode-quality hint: preview (fast / low-bitrate, for editor scrubbing) or final (default, full Format).").action((c,d)=>xt(c,{target:d.target,aspect:d.aspect,fps:Dt(d.fps),resolution:d.resolution,out:d.out,json:e().json,dryRun:e().dryRun,...d.idempotencyKey?{idempotencyKey:d.idempotencyKey}:{},...d.priority?{priority:d.priority}:{},...d.intent?{intent:d.intent}:{}}));t.command("api").description("Raw API call against the v1 surface (escape hatch \u2014 like `gh api`).").argument("<method>","HTTP method: GET, POST, PUT, PATCH, DELETE").argument("<path>","API path starting with /v1, e.g. /v1/projects").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-b, --body <body>","Request body (inline JSON, @file.json to read from disk, @- for stdin)").option("-H, --header <header...>",'Additional header (repeatable), e.g. -H "If-Match: \\"abc\\""').option("-i, --include","Include response status line + headers in stdout (curl-style). Lets agents read ETag etc.").action((c,d,h)=>_t(c,d,{target:h.target,body:h.body,header:h.header,include:h.include,json:e().json})),t.command("schema").description("Print the live composition wire schema from the server (/v1/openapi.json) \u2014 discover the contract instead of guessing.").argument("[resource]","Schema to print (currently: composition)","composition").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>Rt(c,{target:d.target,json:e().json}));let a=t.command("composition").description("Read/write a project's composition. ETag is threaded automatically.");a.command("validate").description("Validate a composition body against the live schema WITHOUT saving or rendering. Returns per-field errors \u2014 author safely before paying for a render.").requiredOption("-b, --body <body>","Composition JSON (inline, @file.json, or @- for stdin)").option("-t, --target <target>","Target environment: prod (default), dev, local").action(c=>pt({target:c.target,body:c.body,json:e().json})),a.command("get").description("Fetch the project's composition and ETag").argument("<projectId>","Project ID").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>lt(c,{target:d.target,json:e().json})),a.command("put").description("Replace the composition. GETs ETag first for safe concurrent writes.").argument("<projectId>","Project ID").option("-t, --target <target>","Target environment: prod (default), dev, local").requiredOption("-b, --body <body>","Composition JSON (inline, @file.json, or @- for stdin)").option("--if-match <etag>","Use this ETag (skip the GET round-trip)").option("--force","Use If-Match: * (unconditional overwrite \u2014 may clobber concurrent edits)").action((c,d)=>ut(c,{target:d.target,body:d.body,ifMatch:d.ifMatch,force:d.force,json:e().json})),a.command("from-suggestion").description("Build the composition from an existing clip suggestion").argument("<projectId>","Project ID").requiredOption("-s, --suggestion <suggestionId>","Clip suggestion publicId (sug_\u2026)").option("-t, --target <target>","Target environment: prod (default), dev, local").option("--format <json>",`Optional format override, e.g. '{"aspectRatio":"9:16","fps":30,"resolution":"fhd"}'`).option("--if-match <etag>","Use this ETag (skip the GET round-trip)").option("--force","Use If-Match: * (unconditional overwrite)").action((c,d)=>de(c,{target:d.target,suggestionId:d.suggestion,format:d.format,ifMatch:d.ifMatch,force:d.force,json:e().json})),s.command("watch").description("Reattach to an existing render and stream progress to terminal state").argument("<renderId>","Render ID (from `cueframe render` output)").requiredOption("-p, --project <projectId>","Project the render belongs to").option("-t, --target <target>","Target environment: prod (default), dev, local").option("--no-download","Print the MP4 URL but skip downloading the file").option("-o, --out <path>","Output file path when downloading (default: ./reel-<id>.mp4)").action((c,d,h)=>{let E=h?.parent?.opts?.()?.target??d.target;return Et(c,{target:E,project:d.project,out:d.out,download:d.download!==!1,json:e().json})});let f=t.command("export").description("Hand the timeline off to a real NLE (Final Cut Pro / Premiere Pro)");f.command("fcpxml").description("Build a Final Cut Pro export zip and (optionally) wait to download it").argument("<projectId>","Project ID").requiredOption("-s, --suggestion <suggestionId>","Clip suggestion publicId (sug_\u2026)").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-o, --out <path>","Output zip path (default: ./export-<id>.zip)").option("--wait","Block until the export finishes, then download the artifact").action((c,d)=>$e("fcpxml",{target:d.target,projectId:c,suggestionId:d.suggestion,out:d.out,wait:d.wait,json:e().json})),f.command("premiere").description("Build a Premiere Pro export zip and (optionally) wait to download it").argument("<projectId>","Project ID").requiredOption("-s, --suggestion <suggestionId>","Clip suggestion publicId (sug_\u2026)").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-o, --out <path>","Output zip path (default: ./export-<id>.zip)").option("--wait","Block until the export finishes, then download the artifact").action((c,d)=>$e("premiere",{target:d.target,projectId:c,suggestionId:d.suggestion,out:d.out,wait:d.wait,json:e().json}));let u=t.command("sessions").description("Multi-file ingest sessions (camera A/B/screen \u2192 muxed composition)");u.command("list").description("List sessions in this org").option("-t, --target <target>","Target environment: prod (default), dev, local").action(c=>Pt({target:c.target,json:e().json})),u.command("get").description("Get a single session by ID").argument("<sessionId>","Session ID").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>At(c,{target:d.target,json:e().json})),u.command("create").description("Create a session from one or more media files").requiredOption("-n, --name <name>","Session name").requiredOption("-f, --file <entry...>","Each entry is <mediaId>:<role> (repeatable)").option("-t, --target <target>","Target environment: prod (default), dev, local").action(c=>Ft({target:c.target,name:c.name,files:c.file,json:e().json})),u.command("delete").description("Delete a session (server checks for compositions referencing it)").argument("<sessionId>","Session ID").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>Ut(c,{target:d.target,json:e().json})),t.command("describe").description("Print the CLI command tree as structured JSON (agent introspection)").action(()=>Nt(t,{json:e().json})),t.parse()}Lt();
|
|
82
|
+
Re-fetch via GET /v1/projects/${e.projectId}/exports/${r}.`),l(m.ApiServerError));let s=e.out??`./export-${r.slice(0,8)}.zip`,a=await kr(n.outputUrl,s,e.json);p(e,"export_complete",{exportId:r,projectId:e.projectId,format:t,outputUrl:n.outputUrl,outputExpiresAt:n.outputExpiresAt,outputSizeBytes:n.outputSizeBytes,trimCacheHit:n.trimCacheHit,outputPath:a})}async function $r(t,e,o){let r=Date.now()+(o.timeoutMs??Tt),n=o.pollIntervalMs??Cr,i=Date.now(),s=C("Exporting\u2026",o.json);try{for(;Date.now()<r;){let a;try{a=await Q.getExport(t,e)}catch(c){if(c instanceof I&&c.status>=500){await Ot(n);continue}throw s.fail(`Failed to poll: ${v(c)}`),c}let f=Math.round((Date.now()-i)/1e3),u=Math.round((a.progress??0)*100);if(s.text=`Exporting\u2026 ${a.status}${u>0?` \xB7 ${u}%`:""} (${f}s)`,p(o,"export_progress",{exportId:e,status:a.status,progress:a.progress,elapsedSec:f}),a.status==="complete")return s.succeed(`Export complete (${f}s)`),{kind:"complete",outputUrl:a.outputUrl??null,outputExpiresAt:a.outputExpiresAt??null,outputSizeBytes:a.outputSizeBytes??null,trimCacheHit:a.trimCacheHit??null};if(a.status==="error"||a.status==="cancelled"){let c=a.error?.message??`Export ${a.status}`;return s.fail(c),{kind:"failed",message:c,error:a.error?{phase:a.error.phase,retryable:!!a.error.retryable}:null}}await Ot(n)}return s.fail(`Timed out waiting for export (${Math.round((Date.now()-i)/1e3)}s)`),{kind:"failed",message:`Timed out after ${Math.round((o.timeoutMs??Tt)/1e3)}s`,error:null}}catch(a){g(o,"export_progress",a,y(a)),l(y(a))}}async function kr(t,e,o){let r=Sr(e),n=C(`Downloading \u2192 ${r}\u2026`,o);try{let i=await fetch(t);if(!i.ok)throw new Error(`HTTP ${i.status}`);let s=Buffer.from(await i.arrayBuffer());return xr(r,s),n.succeed(`Saved: ${r} (${(s.length/1024/1024).toFixed(1)} MB)`),r}catch(i){n.fail(`Download failed: ${v(i)}`),o||console.error(`
|
|
83
|
+
Export URL (7-day TTL): ${t}`),l(m.NetworkError)}}function Ot(t){return new Promise(e=>setTimeout(e,t))}async function Pt(t){w(t.target),p(t,"sessions_list_prepare",{});try{let e=await q.listSessions();p(t,"sessions_list_complete",{count:e.data.length}),j(t,e,()=>{if(e.data.length===0){console.log("No sessions yet. Create one with `cueframe sessions create --name <n> --files <mediaId:role> \u2026`");return}for(let o of e.data){let r=o.muxStatus??"pending";console.log(`${o.id} ${o.fileCount} files mux:${r} ${o.name}`)}e.pagination.hasMore&&console.log(`# more \u2014 pass --after ${e.pagination.nextCursor} (raw via \`cueframe api\`)`)})}catch(e){g(t,"sessions_list",e,y(e)),t.json||console.error(`\u2716 sessions list: ${v(e)}`),l(y(e))}}async function At(t,e){E(t,"sessionId",e),w(e.target),p(e,"sessions_get_prepare",{sessionId:t});try{let o=await q.getSession(t);p(e,"sessions_get_complete",{sessionId:t}),j(e,o,()=>{console.log(JSON.stringify(o,null,2))})}catch(o){g(e,"sessions_get",o,y(o)),e.json||console.error(`\u2716 sessions get: ${v(o)}`),l(y(o))}}async function Ft(t){t.name||(console.error("--name is required"),l(m.UserError)),(!t.files||t.files.length===0)&&(console.error("At least one --file <mediaId:role> is required"),l(m.UserError));let e=t.files.map((o,r)=>{let n=o.indexOf(":");return n===-1&&(console.error(`--file[${r}] must be <mediaId>:<role>. Got: ${o}`),l(m.UserError)),{mediaId:o.slice(0,n).trim(),role:o.slice(n+1).trim()}});w(t.target),p(t,"sessions_create_prepare",{name:t.name,fileCount:e.length});try{let o=await q.createSession({name:t.name,files:e});p(t,"sessions_create_complete",{sessionId:o.id}),j(t,o,()=>{console.log(`Session created: ${o.id}`),console.log(JSON.stringify(o,null,2))})}catch(o){g(t,"sessions_create",o,y(o)),t.json||console.error(`\u2716 sessions create: ${v(o)}`),l(y(o))}}async function Mt(t,e){E(t,"sessionId",e),w(e.target),p(e,"sessions_delete_prepare",{sessionId:t});try{await q.deleteSession(t),p(e,"sessions_delete_complete",{sessionId:t}),j(e,{ok:!0,sessionId:t},()=>{console.log(`Session ${t} deleted.`)})}catch(o){g(e,"sessions_delete",o,y(o)),e.json||console.error(`\u2716 sessions delete: ${v(o)}`),l(y(o))}}function Ut(t){let e=t.commands.map(Ut);return{name:t.name(),description:t.description(),arguments:t.registeredArguments.map(o=>({name:o.name(),required:o.required,description:o.description})),options:t.options.map(o=>({flags:o.flags,description:o.description,...o.defaultValue!==void 0?{default:o.defaultValue}:{}})),...e.length>0?{subcommands:e}:{}}}function Dt(t,e){let o=t.commands.map(Ut);if(e.json){p(e,"describe_complete",{name:t.name(),version:t.version()??null,commands:o});return}console.log(`${t.name()} ${t.version()??""}`.trim());for(let r of o){console.log(`
|
|
84
|
+
${r.name} \u2014 ${r.description}`);for(let n of r.subcommands??[])console.log(` ${r.name} ${n.name} \u2014 ${n.description}`)}}function Nt(t){if(!t)return;let e=parseInt(t,10);if(e===24||e===30||e===60)return e;console.error(`Invalid --fps ${t}. Allowed: 24, 30, 60.`),l(m.UserError)}function Lt(){let t=new _r;t.name("cueframe").description("AI-assisted video editing and rendering").version("0.1.2").option("--json","Emit a structured JSON document on stdout instead of human-formatted output. Spinners are silenced.").option("--dry-run","Validate inputs and report what would happen \u2014 no API calls, no mutations. Applies to upload, analyze, project create, render.");let e=()=>t.opts();t.command("install").description('One-line setup: wire the CueFrame MCP server into every installed agent (Claude Code / Cursor / Codex / Claude Desktop) and install the agent skills. No API key \u2014 auth is a browser "Allow" on first call.').option("-t, --target <target>","Target environment: prod (default), dev, local").action(c=>Ne({json:e().json,target:c.target,dryRun:e().dryRun})),t.command("init").description("Scaffold a CueFrame component workspace (cueframe.json + components dir) in the current repo, so `eject` / `new component` have a home and the render harness can discover them.").action(()=>ze({json:e().json,dryRun:e().dryRun})),t.command("eject").description("Fork a built-in CueFrame primitive into cueframe/components/<id> as owned, editable source (renders on CueFrame).").argument("<primitive>","Primitive id (e.g. cinematic-title, heroText)").option("-f, --force","Overwrite an existing ejected component dir").action((c,d)=>Ve(c,{json:e().json,dryRun:e().dryRun,force:d.force})),t.command("new").description("Scaffold new owned source in the component workspace").command("component").description("Scaffold a blank custom component in cueframe/components/<name>").argument("<name>","Component id (e.g. my-badge)").option("-f, --force","Overwrite an existing non-empty component dir").action((c,d)=>Ye(c,{json:e().json,dryRun:e().dryRun,force:d.force})),t.command("push").description("Publish a locally-authored component (cueframe/components/<id>/index.tsx) to CueFrame so it renders server-side. Upserts by id.").argument("[id]","Component id to push (omit and use `cueframe sync` to push all)").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>tt(c,{target:d.target,json:e().json})),t.command("sync").description("Publish EVERY component in the workspace (cueframe/components/*) to CueFrame. Upserts each by id.").option("-t, --target <target>","Target environment: prod (default), dev, local").action(c=>ot({target:c.target,json:e().json}));let r=t.command("keys").description("Manage API keys. `keys create` mints a scoped key \u2014 run `cueframe login` first (keys cannot mint keys).");r.command("create").description("Mint a scoped API key (cf_*). Requires a logged-in session.").requiredOption("-n, --name <name>","Key name, e.g. vaaya-staging").option("-s, --scope <scope>","Comma-separated resource:actions, e.g. media:rw,projects:rw,renders:rw (resources: media,sessions,projects,renders,webhooks; actions r/w)").option("--preset <preset>","Scope preset instead of --scope: readonly (read all) | editall (read+write all)").option("--expires <days>","Expire after N days (default: never)").action(c=>nt({...c,json:e().json})),r.command("list").description("List your API keys.").action(()=>it({json:e().json})),r.command("revoke").description("Revoke an API key by id.").argument("<keyId>","Key id (from `cueframe keys list`)").action(c=>st(c,{json:e().json})),t.command("login").description("Browser-mediated sign-in (OAuth device flow). Recommended for laptops.").option("-t, --target <target>","Target environment: prod (default), dev, local").option("--url <url>","Override the API base URL (advanced)").action(c=>St({...c,json:e().json})),t.command("auth").description("Save a static API key (cf_live_\u2026 / cf_test_\u2026). Use for CI / headless environments.").argument("<api-key>","Your CueFrame API key").option("-t, --target <target>","Target environment: prod (default), dev, local").option("--url <url>","Override the API base URL (advanced)").action((c,d)=>{Z(c,d.target,d.url),e().json?console.log(JSON.stringify({ok:!0,target:d.target},null,2)):console.log(`API key saved for target "${d.target}"`)}),t.command("list").description("List projects").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-n, --limit <n>","Max projects to show","10").action(c=>at({target:c.target,limit:parseInt(c.limit),json:e().json}));let n=t.command("project").description("Project commands");n.command("create").description("Create a new project. With --from-suggestion, atomically build the composition from a clip suggestion in one round-trip \u2014 the project is then immediately renderable via `cueframe render <projectId>`.").requiredOption("-n, --name <name>","Project name").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-a, --aspect <ratio>","Aspect ratio: 9:16, 1:1, 16:9","9:16").option("--fps <n>","Frame rate","30").option("--resolution <r>","Resolution: hd, fhd, 2k, 4k","fhd").option("--from-suggestion <sug>","Clip suggestion publicId (sug_\u2026) \u2014 atomically builds the composition after project creation so render needs no further args").option("--cheap","With --from-suggestion: use the deterministic translator (no LLM, ~100ms) instead of the AI authoring pass. Useful for tests / programmatic flows.").action(c=>wt({name:c.name,target:c.target,aspect:c.aspect,fps:Nt(c.fps),resolution:c.resolution,fromSuggestion:c.fromSuggestion,cheap:c.cheap,json:e().json,dryRun:e().dryRun})),n.command("delete").description("Permanently delete a project (irreversible cleanup \u2014 removes the composition and render history).").argument("<projectId>","Project ID (from `cueframe list` or `project create`)").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>bt(c,{target:d.target,json:e().json})),t.command("media").description("Media library cleanup commands").command("delete").description("Permanently delete a media item (irreversible cleanup \u2014 removes the source and its derived assets).").argument("<mediaId>","Media item ID (from `cueframe clips`)").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>vt(c,{target:d.target,json:e().json})),t.command("upload").description("Upload a video file and process it").argument("<file>","Path to video file").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-a, --analyze","Run clip analysis after processing completes").option("-r, --audio-role <role>","Declare the audio role (vo|music|sfx|ambience) \u2014 routes ingest enrichment: vo\u2192transcript, music\u2192beat grid, sfx/ambience\u2192envelope").action((c,d)=>dt(c,{target:d.target,analyze:d.analyze,audioRole:d.audioRole,json:e().json,dryRun:e().dryRun})),t.command("analyze").description("Trigger AI clip suggestion analysis for a media item").argument("<mediaItemId>","Media item ID (from `cueframe clips`)").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-w, --wait","Wait for analysis to complete and show results").action((c,d)=>Fe(c,{target:d.target,wait:d.wait,json:e().json,dryRun:e().dryRun})),t.command("clips").description("List AI-generated clip suggestions for a media item").argument("[mediaItemId]","Media item ID (omit to list your media library)").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>mt(c,{target:d.target,json:e().json}));let s=t.command("render").description("Render a project to MP4 (queues, watches via SSE, downloads). Renders whatever composition is saved on the project \u2014 build it first via `project create --from-suggestion` or `composition from-suggestion`.").allowExcessArguments(!1).argument("<projectId>","Project ID (from `cueframe list` or `project create`)").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-a, --aspect <ratio>","Aspect ratio: 9:16, 1:1, 16:9 (defaults to project format)").option("--fps <n>","Frame rate","30").option("--resolution <r>","Resolution: hd, fhd, 2k, 4k","fhd").option("-o, --out <path>","Output file path (default: ./reel-<id>.mp4)").option("--idempotency-key <key>",'Override the auto-derived Idempotency-Key. Default: sha256("render:<projectId>:<currentCompositionETag>"). Pass a fresh UUID to force a new render row.').option("--priority <p>","Routing intent: interactive (low-latency, access-gated), standard (default), background (lowest queue weight).").option("--intent <i>","Encode-quality hint: preview (fast / low-bitrate, for editor scrubbing) or final (default, full Format).").action((c,d)=>xt(c,{target:d.target,aspect:d.aspect,fps:Nt(d.fps),resolution:d.resolution,out:d.out,json:e().json,dryRun:e().dryRun,...d.idempotencyKey?{idempotencyKey:d.idempotencyKey}:{},...d.priority?{priority:d.priority}:{},...d.intent?{intent:d.intent}:{}}));t.command("api").description("Raw API call against the v1 surface (escape hatch \u2014 like `gh api`).").argument("<method>","HTTP method: GET, POST, PUT, PATCH, DELETE").argument("<path>","API path starting with /v1, e.g. /v1/projects").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-b, --body <body>","Request body (inline JSON, @file.json to read from disk, @- for stdin)").option("-H, --header <header...>",'Additional header (repeatable), e.g. -H "If-Match: \\"abc\\""').option("-i, --include","Include response status line + headers in stdout (curl-style). Lets agents read ETag etc.").action((c,d,h)=>_t(c,d,{target:h.target,body:h.body,header:h.header,include:h.include,json:e().json})),t.command("schema").description("Print the live composition wire schema from the server (/v1/openapi.json) \u2014 discover the contract instead of guessing.").argument("[resource]","Schema to print (currently: composition)","composition").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>Rt(c,{target:d.target,json:e().json}));let a=t.command("composition").description("Read/write a project's composition. ETag is threaded automatically.");a.command("validate").description("Validate a composition body against the live schema WITHOUT saving or rendering. Returns per-field errors \u2014 author safely before paying for a render.").requiredOption("-b, --body <body>","Composition JSON (inline, @file.json, or @- for stdin)").option("-t, --target <target>","Target environment: prod (default), dev, local").action(c=>pt({target:c.target,body:c.body,json:e().json})),a.command("get").description("Fetch the project's composition and ETag").argument("<projectId>","Project ID").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>lt(c,{target:d.target,json:e().json})),a.command("put").description("Replace the composition. GETs ETag first for safe concurrent writes.").argument("<projectId>","Project ID").option("-t, --target <target>","Target environment: prod (default), dev, local").requiredOption("-b, --body <body>","Composition JSON (inline, @file.json, or @- for stdin)").option("--if-match <etag>","Use this ETag (skip the GET round-trip)").option("--force","Use If-Match: * (unconditional overwrite \u2014 may clobber concurrent edits)").action((c,d)=>ut(c,{target:d.target,body:d.body,ifMatch:d.ifMatch,force:d.force,json:e().json})),a.command("from-suggestion").description("Build the composition from an existing clip suggestion").argument("<projectId>","Project ID").requiredOption("-s, --suggestion <suggestionId>","Clip suggestion publicId (sug_\u2026)").option("-t, --target <target>","Target environment: prod (default), dev, local").option("--format <json>",`Optional format override, e.g. '{"aspectRatio":"9:16","fps":30,"resolution":"fhd"}'`).option("--if-match <etag>","Use this ETag (skip the GET round-trip)").option("--force","Use If-Match: * (unconditional overwrite)").action((c,d)=>ce(c,{target:d.target,suggestionId:d.suggestion,format:d.format,ifMatch:d.ifMatch,force:d.force,json:e().json})),s.command("watch").description("Reattach to an existing render and stream progress to terminal state").argument("<renderId>","Render ID (from `cueframe render` output)").requiredOption("-p, --project <projectId>","Project the render belongs to").option("-t, --target <target>","Target environment: prod (default), dev, local").option("--no-download","Print the MP4 URL but skip downloading the file").option("-o, --out <path>","Output file path when downloading (default: ./reel-<id>.mp4)").action((c,d,h)=>{let x=h?.parent?.opts?.()?.target??d.target;return Et(c,{target:x,project:d.project,out:d.out,download:d.download!==!1,json:e().json})});let f=t.command("export").description("Hand the timeline off to a real NLE (Final Cut Pro / Premiere Pro)");f.command("fcpxml").description("Build a Final Cut Pro export zip and (optionally) wait to download it").argument("<projectId>","Project ID").requiredOption("-s, --suggestion <suggestionId>","Clip suggestion publicId (sug_\u2026)").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-o, --out <path>","Output zip path (default: ./export-<id>.zip)").option("--wait","Block until the export finishes, then download the artifact").action((c,d)=>$e("fcpxml",{target:d.target,projectId:c,suggestionId:d.suggestion,out:d.out,wait:d.wait,json:e().json})),f.command("premiere").description("Build a Premiere Pro export zip and (optionally) wait to download it").argument("<projectId>","Project ID").requiredOption("-s, --suggestion <suggestionId>","Clip suggestion publicId (sug_\u2026)").option("-t, --target <target>","Target environment: prod (default), dev, local").option("-o, --out <path>","Output zip path (default: ./export-<id>.zip)").option("--wait","Block until the export finishes, then download the artifact").action((c,d)=>$e("premiere",{target:d.target,projectId:c,suggestionId:d.suggestion,out:d.out,wait:d.wait,json:e().json}));let u=t.command("sessions").description("Multi-file ingest sessions (camera A/B/screen \u2192 muxed composition)");u.command("list").description("List sessions in this org").option("-t, --target <target>","Target environment: prod (default), dev, local").action(c=>Pt({target:c.target,json:e().json})),u.command("get").description("Get a single session by ID").argument("<sessionId>","Session ID").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>At(c,{target:d.target,json:e().json})),u.command("create").description("Create a session from one or more media files").requiredOption("-n, --name <name>","Session name").requiredOption("-f, --file <entry...>","Each entry is <mediaId>:<role> (repeatable)").option("-t, --target <target>","Target environment: prod (default), dev, local").action(c=>Ft({target:c.target,name:c.name,files:c.file,json:e().json})),u.command("delete").description("Delete a session (server checks for compositions referencing it)").argument("<sessionId>","Session ID").option("-t, --target <target>","Target environment: prod (default), dev, local").action((c,d)=>Mt(c,{target:d.target,json:e().json})),t.command("describe").description("Print the CLI command tree as structured JSON (agent introspection)").action(()=>Dt(t,{json:e().json})),t.parse()}Lt();
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import"./chunk-3QSA3EBY.js";import{agents as c}from"add-mcp";var o=["claude-code","cursor","codex","vscode","windsurf","zed","gemini-cli","github-copilot-cli"];function s(e){let t=o.indexOf(e);return t===-1?o.length:t}var l=Object.entries(c).filter(([,e])=>(e.supportedTransports??[]).includes("http")).map(([e,t])=>({id:e,label:t.displayName??e})).sort((e,t)=>s(e.id)-s(t.id)||e.id.localeCompare(t.id));function d(e=4){let t=l.map(i=>i.label),n=t.slice(0,e).join(", "),r=t.length-e;return r>0?`${n} \u2014 and ${r} more`:n}export{l as SUPPORTED_AGENTS,d as supportedAgentsSentence};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cueframe",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Agent-native CLI for CueFrame
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Agent-native CLI for CueFrame \u2014 author compositions and render video from the terminal (early-access preview).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cueframe",
|
|
7
7
|
"video",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"add-mcp": "^1.14.0",
|
|
35
36
|
"better-auth": "1.5.3",
|
|
36
37
|
"commander": "^13.1.0",
|
|
37
38
|
"open": "^10.1.0",
|
|
@@ -47,8 +48,8 @@
|
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
50
|
"@cueframe/cloud-import": "workspace:*",
|
|
50
|
-
"@cueframe/primitive-registry": "workspace:*",
|
|
51
51
|
"@cueframe/sdk": "workspace:*",
|
|
52
|
+
"@cueframe/shared": "workspace:*",
|
|
52
53
|
"@types/node": "^22.15.0",
|
|
53
54
|
"tsup": "^8.5.1",
|
|
54
55
|
"vitest": "^4.1.0"
|