cueframe 0.12.6 → 0.12.8

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.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{L as a}from"./chunk-5WARCXXA.js";import"./chunk-3QSA3EBY.js";export{a as analyzeCommand};
@@ -11,7 +11,7 @@ function Blank({ params }) {
11
11
  return h(MediaTileScene, { streams: {}, tiles: [], background: params.background ?? '#101014' });
12
12
  }
13
13
  __cfScene.mount({ root: document.getElementById('root'), component: Blank, variables: __hyperframes.getVariables() });
14
- </script></template>`,manifest:{version:4,runtime:"hyperframes",hfContract:1,kind:"scene",assets:{},graphics:{api:"webgl2",required:!0,accelerationPreference:"software-allowed"},alphaPolicy:"allows-opaque"},definition:{inputSchema:{type:"object",additionalProperties:!1,properties:{background:{type:"string",pattern:"^#[0-9a-fA-F]{6}$",default:"#101014",title:"Background"}}},defaults:{},brandBindings:[],timing:{defaultDuration:{frames:90,fps:30}},capabilities:[{kind:"clip"}]}};function zr(e){return e.replace(/^W\//,"").replace(/-gzip(?=("?)$)/,"")}var E="X-CueFrame-Client";var Yr=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,31}$/,Xr=["web","console","clips"];function Zr(e,t){return Xr.includes(e)===(t==="browser")}function et(e){if(!Yr.test(e.version))throw new Error(`${E} cannot carry the version ${JSON.stringify(e.version)}.`);if(!Zr(e.surface,e.os))throw new Error(`${E} cannot carry ${e.surface} on ${e.os}.`);return`${e.surface}/${e.version}/${e.os}`}function tt(e){return e==="darwin"?"macos":e==="win32"?"windows":e==="linux"?"linux":"unknown"}import{readFileSync as Qr,writeFileSync as eo,mkdirSync as to,existsSync as ro}from"fs";import{join as rt}from"path";import{homedir as oo}from"os";var f={Success:0,UserError:2,ApiClientError:3,ApiServerError:4,NetworkError:5,PaymentRequired:6};function M(e){if(e instanceof l){if(e.status===402)return f.PaymentRequired;if(e.status>=500)return f.ApiServerError;if(e.status>=400)return f.ApiClientError}let t=e?.exitCode;return typeof t=="number"?t:f.NetworkError}function oT(e){return e===402?f.PaymentRequired:e>=500?f.ApiServerError:e>=400?f.ApiClientError:f.Success}function S(e){process.exit(e)}var ot=rt(oo(),".cueframe"),T=rt(ot,"auth.json"),R={local:"http://127.0.0.1:3211",prod:"https://api.cueframe.ai"},no="prod";function cT(e=no){return process.env.CUEFRAME_API_URL??R[e]??R.prod}var h=class extends Error{constructor(r,n){super(n);this.code=r;this.name="AuthStoreError"}code;exitCode=f.UserError};function mT(e){if(!/^cf_(?:live|test)_[A-Za-z0-9_-]{8,}$/.test(e))throw new h("auth_invalid","Invalid API key. Expected a key beginning with cf_live_ or cf_test_.")}function nt(){if(!ro(T))return{targets:{}};let e=Qr(T,"utf-8");try{return JSON.parse(e)}catch{throw new h("auth_config_corrupt",`${T} is corrupt and cannot be parsed. Delete it and re-run \`cueframe login\`.`)}}function so(e){to(ot,{recursive:!0,mode:448}),eo(T,JSON.stringify(e,null,2),{mode:384})}function fT(e,t="prod",r){let n=nt(),o=R[t]??R.prod;n.targets[t]={apiKey:e,apiUrl:r??o},so(n)}function st(e="prod"){let t=process.env.CUEFRAME_API_KEY,r=process.env.CUEFRAME_API_URL;if(t)return{apiKey:t,apiUrl:r??R[e]??R.prod};let o=nt().targets[e];if(!o)throw new h("auth_missing",`No auth configured for target "${e}". Run \`cueframe login --target ${e}\` (browser sign-in) or \`cueframe auth <api-key> --target ${e}\` (CI / headless).`);return o}function io(){return{[E]:et({surface:"cli",version:"0.12.6",os:tt(process.platform)})}}function it(e,t={}){let{apiKey:r,apiUrl:n}=st(e);I({baseUrl:n,apiKey:r,headers:io(),...t})}function k(e){let t=e instanceof l?`${e.message} (${e.code}${e.status?`, ${e.status}`:""})`:e instanceof Error?e.message:String(e),r=A(e);return r?`${t}
14
+ </script></template>`,manifest:{version:4,runtime:"hyperframes",hfContract:1,kind:"scene",assets:{},graphics:{api:"webgl2",required:!0,accelerationPreference:"software-allowed"},alphaPolicy:"allows-opaque"},definition:{inputSchema:{type:"object",additionalProperties:!1,properties:{background:{type:"string",pattern:"^#[0-9a-fA-F]{6}$",default:"#101014",title:"Background"}}},defaults:{},brandBindings:[],timing:{defaultDuration:{frames:90,fps:30}},capabilities:[{kind:"clip"}]}};function zr(e){return e.replace(/^W\//,"").replace(/-gzip(?=("?)$)/,"")}var E="X-CueFrame-Client";var Yr=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,31}$/,Xr=["web","console","clips"];function Zr(e,t){return Xr.includes(e)===(t==="browser")}function et(e){if(!Yr.test(e.version))throw new Error(`${E} cannot carry the version ${JSON.stringify(e.version)}.`);if(!Zr(e.surface,e.os))throw new Error(`${E} cannot carry ${e.surface} on ${e.os}.`);return`${e.surface}/${e.version}/${e.os}`}function tt(e){return e==="darwin"?"macos":e==="win32"?"windows":e==="linux"?"linux":"unknown"}import{readFileSync as Qr,writeFileSync as eo,mkdirSync as to,existsSync as ro}from"fs";import{join as rt}from"path";import{homedir as oo}from"os";var f={Success:0,UserError:2,ApiClientError:3,ApiServerError:4,NetworkError:5,PaymentRequired:6};function M(e){if(e instanceof l){if(e.status===402)return f.PaymentRequired;if(e.status>=500)return f.ApiServerError;if(e.status>=400)return f.ApiClientError}let t=e?.exitCode;return typeof t=="number"?t:f.NetworkError}function oT(e){return e===402?f.PaymentRequired:e>=500?f.ApiServerError:e>=400?f.ApiClientError:f.Success}function S(e){process.exit(e)}var ot=rt(oo(),".cueframe"),T=rt(ot,"auth.json"),R={local:"http://127.0.0.1:3211",prod:"https://api.cueframe.ai"},no="prod";function cT(e=no){return process.env.CUEFRAME_API_URL??R[e]??R.prod}var h=class extends Error{constructor(r,n){super(n);this.code=r;this.name="AuthStoreError"}code;exitCode=f.UserError};function mT(e){if(!/^cf_(?:live|test)_[A-Za-z0-9_-]{8,}$/.test(e))throw new h("auth_invalid","Invalid API key. Expected a key beginning with cf_live_ or cf_test_.")}function nt(){if(!ro(T))return{targets:{}};let e=Qr(T,"utf-8");try{return JSON.parse(e)}catch{throw new h("auth_config_corrupt",`${T} is corrupt and cannot be parsed. Delete it and re-run \`cueframe login\`.`)}}function so(e){to(ot,{recursive:!0,mode:448}),eo(T,JSON.stringify(e,null,2),{mode:384})}function fT(e,t="prod",r){let n=nt(),o=R[t]??R.prod;n.targets[t]={apiKey:e,apiUrl:r??o},so(n)}function st(e="prod"){let t=process.env.CUEFRAME_API_KEY,r=process.env.CUEFRAME_API_URL;if(t)return{apiKey:t,apiUrl:r??R[e]??R.prod};let o=nt().targets[e];if(!o)throw new h("auth_missing",`No auth configured for target "${e}". Run \`cueframe login --target ${e}\` (browser sign-in) or \`cueframe auth <api-key> --target ${e}\` (CI / headless).`);return o}function io(){return{[E]:et({surface:"cli",version:"0.12.8",os:tt(process.platform)})}}function it(e,t={}){let{apiKey:r,apiUrl:n}=st(e);I({baseUrl:n,apiKey:r,headers:io(),...t})}function k(e){let t=e instanceof l?`${e.message} (${e.code}${e.status?`, ${e.status}`:""})`:e instanceof Error?e.message:String(e),r=A(e);return r?`${t}
15
15
  \u2192 ${r}`:t}import ao from"ora";import po from"pino";var co="v1",at=po({level:"trace",base:{schemaVersion:co},messageKey:"event",timestamp:()=>`,"ts":${Date.now()}`,formatters:{level:()=>({_:0})}});function w(e,t){return ao({text:e,isSilent:!!t}).start()}function C(e,t,r={}){e.json&&at.info(r,t)}function bT(e,t,r){if(e.json){console.log(JSON.stringify(t,null,2));return}r()}function U(e,t,r,n){let o=r instanceof Error?r.message:String(r),s=typeof r?.code=="string"?r.code:void 0,i=r?.status;e.json?at.info({phase:t,message:o,...s?{code:s}:{},...typeof i=="number"?{status:i}:{},exitCode:n},"error"):process.stderr.write(`\u2716 ${t}: ${k(r)}
16
16
  `)}function K(e,t,r,n){e.json&&U(e,t,r,n)}function PT(e,t){t.json||console.log(e)}function mo(e){for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r<=31||r===127)return!0}return!1}function ct(e,t,r){e.length===0&&pt(`${t} is empty.`,r),mo(e)&&pt(`${t} contains a control character (newline, tab, or null byte). Identifiers must be plain text \u2014 check for a stray copy-paste artifact.`,r)}function pt(e,t){U(t,"preflight",new Error(e),f.UserError),S(f.UserError)}var fo=5e3,N=300*1e3;async function jT(e,t){if(ct(e,"mediaItemId",t),t.dryRun){C(t,"analyze_dry_run",{mediaItemId:e,target:t.target,wait:!!t.wait,wouldCall:"POST /v1/media/:id/suggestions"}),t.json||console.log(`[dry-run] Would trigger clip analysis for ${e} on ${t.target}.`);return}it(t.target),C(t,"analyze_prepare",{mediaItemId:e,target:t.target,wait:!!t.wait});let r=w("Triggering clip analysis\u2026",t.json),n;try{n=await P.suggestBriefs(e),r.succeed(`Analysis ${n.alreadyRunning?"already running":"started"}`)}catch(i){r.fail(`Failed to start analysis: ${k(i)}`),K(t,"analyze_prepare",i,M(i)),S(M(i))}if(C(t,"analyze_ready",{mediaItemId:e,status:n.status,alreadyRunning:!!n.alreadyRunning}),!t.wait){t.json||console.log(`
17
17
  Run \`cueframe clips ${e}\` to check results.`);return}let o=w("Waiting for analysis to complete\u2026",t.json),s=Date.now();for(;;){await new Promise(i=>setTimeout(i,fo)),Date.now()-s>N&&(o.fail(`Timed out after ${Math.round(N/1e3)}s. Run \`cueframe clips ${e}\` to check later.`),K(t,"analyze_progress",new Error(`Analysis did not complete within ${Math.round(N/1e3)}s`),f.UserError),S(f.UserError));try{let i=await P.listMediaSuggestions(e);if(i.suggestions.length>0){o.succeed(`Analysis complete \u2014 ${i.suggestions.length} clips found`),C(t,"analyze_complete",{mediaItemId:e,durationMs:Date.now()-s,suggestionCount:i.suggestions.length,suggestions:i.suggestions}),t.json||i.suggestions.forEach((d,c)=>{let m=(d.trim.end-d.trim.start).toFixed(1);console.log(`
package/dist/cueframe.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{A as rn,B as nn,C as Q,D as le,E as pe,F as _,G as te,H as D,I as xe,J as _e,K as ie,L as qu,a as Fe,b as xu,c as Oe,d as ho,e as cu,f as pu,g as gu,h as en,i as on,j as Ye,k as Ho,l as bu,m as Zt,n as fu,o as Ru,p as Mu,q as Bu,r as Ou,s as tn,t as Ht,u as $,v as N,w as Ie,x as v,y as Jo,z as yu}from"./chunk-W3KRGWX2.js";import{a as io}from"./chunk-3QSA3EBY.js";import{Command as AWa,Option as qi}from"commander";import{existsSync as sc}from"fs";import{homedir as $u}from"os";import{dirname as zc,join as Ei}from"path";import{fileURLToPath as uc}from"url";import{agents as lc,detectGlobalAgents as ku,upsertServer as wc}from"add-mcp";import{createHash as nc,randomUUID as Cu}from"crypto";import{chmodSync as ac,existsSync as ic,lstatSync as Ai,mkdirSync as Si,readFileSync as vu,readdirSync as Au,renameSync as Ui,writeFileSync as Su}from"fs";import{dirname as an,join as eo}from"path";var Vi=".cueframe-install.json";function Vu(d){return nc("sha256").update(d).digest("hex")}function Uu(d){let T=new Map;function z(u){let m=eo(d,u),s=Ai(m);if(s.isSymbolicLink())throw new Error(`Skill package contains a symbolic link: ${m}`);if(s.isDirectory())for(let w of Au(m).sort())!u&&w===Vi||z(u?`${u}/${w}`:w);else if(s.isFile())T.set(u,{bytes:vu(m),mode:s.mode&511});else throw new Error(`Unsupported skill package entry: ${m}`)}return z(""),T}function vi(d){return Object.fromEntries([...d].map(([T,z])=>[T,`${z.mode}:${Vu(z.bytes)}`]))}function dc(d,T){let z=Object.keys(d).sort();return JSON.stringify(z)===JSON.stringify(Object.keys(T).sort())&&z.every(u=>d[u]===T[u])}function Tc(d,T){try{let z=eo(d,Vi);if(!Ai(z).isFile())return;let u=JSON.parse(vu(z,"utf8"));return u.version!==1||typeof u.sourceHash!="string"||!u.files||!dc(u.files,vi(T))?void 0:u}catch{return}}function mc(d,T){let z=`> Installed ${T} by \`npx -y cueframe install\`. Run it again to refresh
2
+ import{A as rn,B as nn,C as Q,D as le,E as pe,F as _,G as te,H as D,I as xe,J as _e,K as ie,L as qu,a as Fe,b as xu,c as Oe,d as ho,e as cu,f as pu,g as gu,h as en,i as on,j as Ye,k as Ho,l as bu,m as Zt,n as fu,o as Ru,p as Mu,q as Bu,r as Ou,s as tn,t as Ht,u as $,v as N,w as Ie,x as v,y as Jo,z as yu}from"./chunk-5WARCXXA.js";import{a as io}from"./chunk-3QSA3EBY.js";import{Command as AWa,Option as qi}from"commander";import{existsSync as sc}from"fs";import{homedir as $u}from"os";import{dirname as zc,join as Ei}from"path";import{fileURLToPath as uc}from"url";import{agents as lc,detectGlobalAgents as ku,upsertServer as wc}from"add-mcp";import{createHash as nc,randomUUID as Cu}from"crypto";import{chmodSync as ac,existsSync as ic,lstatSync as Ai,mkdirSync as Si,readFileSync as vu,readdirSync as Au,renameSync as Ui,writeFileSync as Su}from"fs";import{dirname as an,join as eo}from"path";var Vi=".cueframe-install.json";function Vu(d){return nc("sha256").update(d).digest("hex")}function Uu(d){let T=new Map;function z(u){let m=eo(d,u),s=Ai(m);if(s.isSymbolicLink())throw new Error(`Skill package contains a symbolic link: ${m}`);if(s.isDirectory())for(let w of Au(m).sort())!u&&w===Vi||z(u?`${u}/${w}`:w);else if(s.isFile())T.set(u,{bytes:vu(m),mode:s.mode&511});else throw new Error(`Unsupported skill package entry: ${m}`)}return z(""),T}function vi(d){return Object.fromEntries([...d].map(([T,z])=>[T,`${z.mode}:${Vu(z.bytes)}`]))}function dc(d,T){let z=Object.keys(d).sort();return JSON.stringify(z)===JSON.stringify(Object.keys(T).sort())&&z.every(u=>d[u]===T[u])}function Tc(d,T){try{let z=eo(d,Vi);if(!Ai(z).isFile())return;let u=JSON.parse(vu(z,"utf8"));return u.version!==1||typeof u.sourceHash!="string"||!u.files||!dc(u.files,vi(T))?void 0:u}catch{return}}function mc(d,T){let z=`> Installed ${T} by \`npx -y cueframe install\`. Run it again to refresh
3
3
  > unchanged managed skills. Locally edited or untracked packages are preserved;
4
4
  > inspect reported conflicts before using \`--force\` (which makes a backup).
5
5
  `,u=d.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n/);return u?`${u[0]}
@@ -80,7 +80,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
80
80
  `)}te(T,{ok:!0,dryRun:z,name:d,component:m,dir:h,files:Object.keys(b),overwritten:p&&u},()=>{console.log(`\u2713 ${z?"Would scaffold":"Scaffolded"} custom component ${d} (${m}) into ${h}`);for(let R of Object.keys(b))console.log(` ${z?"would write":"wrote"} ${R}`);z||console.log(` stamped cueframe.json components.${d} (custom)`),console.log("Edit template.html and definition.json, then `cueframe push "+d+"` to publish it to CueFrame.")})}var fi="declared in the native (v4) source definition";function JI(d){let T=d.code;return T==="no_component_source"||T==="no_component_manifest"||T==="invalid_component_definition"||T==="component_source_retired"||T==="invalid_component_metadata"||T==="invalid_workspace_manifest"?$.UserError:N(d)}async function KI(d,T,z){let u=NI(d,T),{name:m,category:s,ejectedFrom:w}=jI(d,T),h=`Custom component "${T}" pushed from the local CueFrame workspace.`;_(z,"push_component",{id:T,name:m,category:s,ejectedFrom:w,propSchema:fi});let p=!1;try{await en.getComponent(T),p=!0}catch(c){if(c instanceof Fe&&c.status===404)p=!1;else throw c}return p?(await en.updateComponent(T,{source:u,name:m,description:h,category:s,origin:"customer-owned",...w?{ejectedFrom:w}:{}}),_(z,"pushed",{id:T,action:"updated"}),{id:T,action:"updated",name:m,category:s,propSchema:fi}):(await en.createComponent({componentId:T,source:u,name:m,description:h,category:s,origin:"customer-owned",...w?{ejectedFrom:w}:{}}),_(z,"pushed",{id:T,action:"created"}),{id:T,action:"created",name:m,category:s,propSchema:fi})}async function XI(d,T){d||(D(T,"push",new Error("Pass a component id (cueframe push <id>), or use `cueframe sync` to push all."),$.UserError),v($.UserError)),ie(d,"id",T),Q(T.target);let z=Nr(process.cwd());z||(D(T,"push",new Error("No CueFrame workspace found (no cueframe.json up-tree). Run `cueframe init` first."),$.UserError),v($.UserError)),_(T,"push_prepare",{id:d,target:T.target});try{let u=await KI(z,d,T);te(T,{ok:!0,target:T.target,...u},()=>{console.log(`\u2713 ${u.action} component ${u.id} (${u.name}) on CueFrame`),console.log(` propSchema: ${u.propSchema}`)})}catch(u){let m=JI(u);D(T,"push",u,m),v(m)}}async function QI(d){Q(d.target);let T=Nr(process.cwd());T||(D(d,"sync",new Error("No CueFrame workspace found (no cueframe.json up-tree). Run `cueframe init` first."),$.UserError),v($.UserError));let z=$h(T);_(d,"sync_prepare",{target:d.target,count:z.length,ids:z});let u=[],m=[];for(let s of z)try{u.push(await KI(T,s,d))}catch(w){let h=JI(w);xe(d,"sync",w,h),m.push({id:s,error:w})}te(d,{ok:m.length===0,target:d.target,pushed:u,failed:m.map(s=>({id:s.id,error:le(s.error)}))},()=>{if(u.length===0&&m.length===0){console.log("No components to sync. Scaffold one with `cueframe new component <id>`.");return}for(let s of u)console.log(`\u2713 ${s.action} ${s.id} (${s.name})`);u.length>0&&console.log(` propSchema: ${fi}`);for(let s of m)console.error(`\u2716 ${s.id}: ${le(s.error)}`);console.log(`Synced ${u.length}/${z.length} component(s) to CueFrame.`)}),m.length>0&&v(N(m[0].error))}var Ri=["media","sessions","projects","renders","webhooks"],YI={readonly:Object.fromEntries(Ri.map(d=>[d,["read"]])),editall:Object.fromEntries(Ri.map(d=>[d,["read","write"]]))};function k5a(d){if(d.preset){let T=YI[d.preset];return T||(console.error(`Unknown --preset "${d.preset}". Valid: ${Object.keys(YI).join(", ")}.`),v($.UserError)),T}if(d.scope)return G5a(d.scope);console.error("Provide --scope or --preset (e.g. --preset readonly | editall)."),v($.UserError)}function G5a(d){let T={};for(let z of d.split(",").map(u=>u.trim()).filter(Boolean)){let[u,m]=z.split(":");(!u||!m)&&(console.error(`Invalid --scope "${z}". Use resource:rw (e.g. renders:rw,media:r).`),v($.UserError)),Ri.includes(u)||(console.error(`--scope "${z}": unknown resource "${u}". Valid: ${Ri.join(", ")}.`),v($.UserError));let s=[];/r/i.test(m)&&s.push("read"),/w/i.test(m)&&s.push("write"),s.length===0&&(console.error(`--scope "${z}": actions must include r and/or w.`),v($.UserError)),T[u]=s}return Object.keys(T).length===0&&(console.error("--scope is required, e.g. --scope media:rw,projects:rw,renders:rw"),v($.UserError)),T}async function ex(d){Q(d.target);let T=k5a(d),z={name:d.name,permissions:T};if(d.expires){let u=Number(d.expires);(!Number.isFinite(u)||u<=0)&&(console.error("--expires must be a positive number of days."),v($.UserError)),z.expiresIn=Math.round(u*86400)}try{let u=await ho("/v1/api-keys",{method:"POST",body:JSON.stringify(z),headers:{"content-type":"application/json"}});te(d,{ok:!0,id:u.id,prefix:u.prefix,start:u.start,key:u.key},()=>{let m=Object.entries(T).map(([s,w])=>`${s}:${w.map(h=>h[0]).join("")}`).join(" ");console.log(`\u2713 API key "${d.name}" created \u2014 scopes: ${m}`),console.log(`
81
81
  ${u.key}
82
82
  `),console.log(" Shown ONCE \u2014 store it now (paste it into your integration; not saved here).")})}catch(u){D(d,"keys_create",u,N(u)),v(N(u))}}async function ox(d){Q(d.target);let T;try{T=await Oe("/api/auth/api-key/list",{method:"GET"})}catch(u){D(d,"keys_list",u,N(u)),v(N(u))}T.status>=400&&(D(d,"keys_list",new Error(`list failed (${T.status})`),Ie(T.status)),v(Ie(T.status)));let z=Array.isArray(T.body)?T.body:[];te(d,{ok:!0,keys:z},()=>{if(z.length===0){console.log("No API keys.");return}for(let u of z)console.log(` ${u.id} ${u.name??"(unnamed)"} ${u.start??""}\u2026`)})}async function tx(d,T){Q(T.target);let z;try{z=await Oe("/api/auth/api-key/delete",{method:"POST",body:JSON.stringify({keyId:d}),headers:{"content-type":"application/json"}})}catch(u){D(T,"keys_revoke",u,N(u)),v(N(u))}z.status>=400&&(D(T,"keys_revoke",new Error(`revoke failed (${z.status})`),Ie(z.status)),v(Ie(z.status))),te(T,{ok:!0,revoked:d},()=>console.log(`\u2713 Revoked ${d}`))}async function rx(d){Q(d.target),_(d,"list_prepare",{target:d.target});try{let T=await Ho.listProjects(),z=d.limit,u=typeof z=="number"&&Number.isFinite(z)&&z>0?T.data.slice(0,z):T.data;if(_(d,"list_complete",{count:u.length,total:T.data.length,truncated:u.length<T.data.length,projects:u}),!d.json){if(T.data.length===0){console.log("No projects found.");return}for(let m of u){let s=new Date(m.createdAt).toLocaleDateString();console.log(` ${m.id} ${m.name} (${s})`)}u.length<T.data.length&&console.log(` \u2026 ${T.data.length-u.length} more (raise --limit to see all)`)}}catch(T){D(d,"list",T,N(T)),v(N(T))}}import{stat as P5a}from"fs/promises";import{existsSync as F5a,openAsBlob as _5a}from"fs";import{basename as j5a,extname as D5a}from"path";var L5a=4e3,nx=1800*1e3,ax=5,ix={".mp4":"video/mp4",".mov":"video/quicktime",".webm":"video/webm",".mkv":"video/x-matroska",".wav":"audio/wav",".mp3":"audio/mpeg",".m4a":"audio/mp4",".aac":"audio/aac",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".svg":"image/svg+xml"};function N5a(d,T){let z=D5a(d).toLowerCase(),u=ix[z];if(!u){let m=new Error(`Unsupported file extension "${z||"(none)"}" for ${d}. Supported: ${Object.keys(ix).join(", ")}.`);D(T,"preflight",m,$.UserError),v($.UserError)}return u}var dx=["vo","music","sfx","ambience"];async function Mi(d,T){F5a(d)||(D(T,"preflight",new Error(`File not found: ${d}`),$.UserError),v($.UserError));let z=j5a(d),u=await P5a(d),m=u.size,s=N5a(z,T),w=du.safeParse({filename:z,contentType:s,size:m});if(!u.isFile()||!w.success){let G=u.isFile()?`Invalid upload: ${w.error?.message}`:"Upload input must be a regular file.";D(T,"preflight",new Error(G),$.UserError),v($.UserError)}if(T.audioRole&&!dx.includes(T.audioRole)){let G=new Error(`--audio-role must be one of ${dx.join("|")} (got "${T.audioRole}")`);D(T,"preflight",G,$.UserError),v($.UserError)}let h=T.audioRole;if(T.dryRun){_(T,"upload_dry_run",{file:z,sizeBytes:m,contentType:s,target:T.target,analyzeAfter:!!T.analyze,wouldCall:"POST /v1/media \u2192 presigned PUT \u2192 POST /v1/media/:id/finalize \u2192 poll processing"}),T.json||console.log(`[dry-run] Would upload ${z} (${(m/1024/1024).toFixed(1)} MB, ${s}) to ${T.target}.`);return}Q(T.target),_(T,"upload_prepare",{file:z,sizeBytes:m,contentType:s,target:T.target});let p=pe("Preparing upload\u2026",T.json),c,b;try{let G=await Ye.createMediaUpload({filename:z,contentType:s,size:m});c=G.id,b=G.uploadUrl,p.succeed("Ready"),_(T,"upload_ready",{mediaItemId:c})}catch(G){p.fail(`Failed: ${le(G)}`),xe(T,"upload_prepare",G,N(G)),v(N(G))}let f=Date.now(),R=pe(`Uploading ${z} (${(m/1024/1024).toFixed(1)} MB)\u2026`,T.json);try{let G=await _5a(d,{type:s});if(G.size!==m)throw new Error("Upload file changed after reservation.");let j=await fetch(b,{method:"PUT",headers:{"Content-Type":s},body:G});if(!j.ok)throw new Error(`presigned PUT failed: ${j.status} ${j.statusText}`);await Ye.finalizeMedia(c,h?{audioRole:h}:{}),R.succeed(`Uploaded: ${z}`),_(T,"upload_complete",{mediaItemId:c,bytesUploaded:m,...h?{audioRole:h}:{},durationMs:Date.now()-f})}catch(G){R.fail(`Upload failed: ${le(G)}`),xe(T,"upload",G,$.NetworkError),v($.NetworkError)}let B=pe("Processing (transcription)\u2026",T.json),S=Date.now(),U=null,k=0;for(;;){if(await new Promise(G=>setTimeout(G,L5a)),Date.now()-S>nx){let G=`Processing did not complete within ${Math.round(nx/6e4)}m. Media item ID: ${c}.`;B.fail(G),xe(T,"process",new Error(G),$.ApiServerError),v($.ApiServerError)}try{let G=await Ye.getMedia(c);k=0;let j=G?.processingStatus?.phase??"unknown",P=G?.processingStatus?.percent??null,H=Math.round((Date.now()-S)/1e3),ae=P!=null?` \xB7 ${Math.round(P*100)}%`:"";if(B.text=`Processing\u2026 ${j}${ae} (${H}s)`,_(T,"process_progress",{phase:j,percent:P,elapsedSec:H}),j==="complete"||j==="completed"){B.succeed(`Ready: ${c}`),U=G,_(T,"process_complete",{mediaItemId:c,durationMs:Date.now()-S,item:G});break}if(j==="error"){let ne=G?.processingStatus?.error??"unknown error";B.fail(`Processing failed: ${ne}`),xe(T,"process",new Error(ne),$.ApiServerError),v($.ApiServerError)}}catch(G){G instanceof Fe&&[401,403,404].includes(G.status)&&(B.fail(`Processing check failed: ${le(G)}`),xe(T,"process",G,N(G)),v(N(G))),k++,k>=ax&&(B.fail(`Processing check failed: ${le(G)}`),xe(T,"process",new Error(`Processing status unreadable after ${ax} consecutive failures: ${le(G)}`),N(G)),v(N(G)))}}if(T.analyze){_e(`
83
- Media item ID: ${c}`,T);let{analyzeCommand:G}=await import("./analyze-EODPHY2S.js");return await G(c,{target:T.target,wait:!0,json:T.json}),{mediaItemId:c,item:U}}return T.json||te(T,{mediaItemId:c,item:U},()=>{console.log(`
83
+ Media item ID: ${c}`,T);let{analyzeCommand:G}=await import("./analyze-ROANQ43D.js");return await G(c,{target:T.target,wait:!0,json:T.json}),{mediaItemId:c,item:U}}return T.json||te(T,{mediaItemId:c,item:U},()=>{console.log(`
84
84
  Media item ID: ${c}`),console.log(`
85
85
  Run \`cueframe analyze ${c} --target ${T.target}\` to generate clip suggestions.`)}),{mediaItemId:c,item:U}}function su(d){let T=Math.floor(d/60),z=Math.floor(d%60);return`${T}:${String(z).padStart(2,"0")}`}async function Tx(d,T){d!==void 0&&ie(d,"mediaItemId",T),Q(T.target),_(T,"clips_prepare",{target:T.target,mode:d?"suggestions":"media-list",...d?{mediaItemId:d}:{}});try{if(!d){let u=await Ye.listMedia();if(_(T,"clips_complete",{mode:"media-list",count:u.data.length,media:u.data}),!T.json){if(u.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 m of u.data){let s=m.duration?`${su(m.duration)} `:"",w=m.processingStatus?.phase??"unknown",h=w==="complete"?"":` [${w}]`;console.log(` ${m.id} ${m.name} ${s}${h}`)}}return}let z=await gu.listMediaSuggestions(d);if(_(T,"clips_complete",{mode:"suggestions",mediaItemId:d,count:z.suggestions.length,suggestions:z.suggestions}),!T.json){if(z.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(`${z.suggestions.length} clip suggestion${z.suggestions.length!==1?"s":""}:`),console.log("");for(let u of z.suggestions){let m=`${su(u.trim.start)} \u2192 ${su(u.trim.end)}`,s=(u.trim.end-u.trim.start).toFixed(1);console.log(` ${u.id}`),console.log(` ${u.title}`),console.log(` ${m} (${s}s) ${u.format} score: ${u.score}`),u.reason&&console.log(` ${u.reason}`),console.log("")}}}catch(z){D(T,"clips",z,N(z)),v(N(z))}}import{readFileSync as W5a}from"fs";var Jr=d=>`/v1/projects/${d}/composition?${new URLSearchParams(Ou.map(T=>["componentExecutionVersions",String(T)]))}`;async function sx(d,T){ie(d,"projectId",T),Q(T.target),_(T,"composition_get_prepare",{projectId:d});let z=await Kr(Jr(d),{method:"GET"},T,"composition_get");z.status>=400&&(Xr(z,T,"composition_get"),v(Ie(z.status)));let u=z.headers.etag,m=u&&Ht(u);_(T,"composition_get_complete",{projectId:d,etag:m,status:z.status,composition:z.body}),T.json||te(T,{etag:m,composition:z.body},()=>{m&&console.log(`# ETag: ${m}`),console.log(JSON.stringify(z.body,null,2))})}async function zx(d,T){ie(d,"projectId",T),T.body||(console.error("--body is required (inline JSON, @file.json, or @- for stdin)"),v($.UserError));let z=Z5a(T);Q(T.target);let u=await lx(T.body);_(T,"composition_put_prepare",{projectId:d,...z});let m=new Headers({"content-type":"application/json"});z.ifMatch?m.set("if-match",z.ifMatch):m.set("if-none-match","*");let s=await Kr(`/v1/projects/${d}/composition`,{method:"PUT",headers:m,body:u},T,"composition_put");s.status>=400&&(Xr(s,T,"composition_put"),v(Ie(s.status)));let w=s.headers.etag;return _(T,"composition_put_complete",{projectId:d,etag:w,status:s.status,response:s.body}),T.json||te(T,{etag:w,response:s.body},()=>{console.log(`Composition saved (ETag: ${w??"unknown"}).`),s.body&&typeof s.body=="object"&&console.log(JSON.stringify(s.body,null,2))}),{etag:w,response:s.body}}async function Bi(d,T){ie(d,"projectId",T),T.suggestionId||(console.error("--suggestion <suggestionId> is required"),v($.UserError)),Q(T.target);let z=await mx(d,T),u;if(T.format)try{u=JSON.parse(T.format)}catch{console.error(`--format must be JSON, e.g. '{"aspectRatio":"9:16","fps":30,"resolution":"fhd"}'`),v($.UserError)}let m=JSON.stringify({suggestionId:T.suggestionId,...u?{format:u}:{}});_(T,"composition_from_suggestion_prepare",{projectId:d,suggestionId:T.suggestionId,ifMatch:z});let s,w=z,h=0,p=3;for(;;){h++;let b=new Headers({"content-type":"application/json"});if(w&&b.set("if-match",w),s=await Kr(`/v1/projects/${d}/composition/from-suggestion`,{method:"POST",headers:b,body:m},T,"composition_from_suggestion"),!(s.status===409&&s.body?.error?.code==="stale_etag"))break;if(h>p){_(T,"composition_from_suggestion_etag_retries_exhausted",{projectId:d,attempts:p});break}_(T,"composition_from_suggestion_etag_retry",{projectId:d,attempt:h,reason:"stale_etag"}),w=await mx(d,T)}s.status>=400&&(Xr(s,T,"composition_from_suggestion"),v(Ie(s.status)));let c=s.headers.etag;_(T,"composition_from_suggestion_complete",{projectId:d,suggestionId:T.suggestionId,etag:c,status:s.status,response:s.body,attempts:h}),T.json||te(T,{etag:c,response:s.body},()=>{console.log(`Composition built from suggestion ${T.suggestionId} (ETag: ${c??"unknown"}).`),s.body&&typeof s.body=="object"&&console.log(JSON.stringify(s.body,null,2))})}async function ux(d){d.body||(console.error("--body is required (inline JSON, @file.json, or @- for stdin)"),v($.UserError)),Q(d.target);let T=await lx(d.body);_(d,"composition_validate_prepare",{});let z=new Headers({"content-type":"application/json"}),u=await Kr("/v1/composition/validate",{method:"POST",headers:z,body:T},d,"composition_validate");u.status>=400&&(Xr(u,d,"composition_validate"),v(Ie(u.status)));let m=u.body;return(!m||typeof m!="object"||!("valid"in m)||typeof m.valid!="boolean")&&(D(d,"composition_validate",new Error("The server returned an invalid composition validation verdict."),$.ApiServerError),v($.ApiServerError)),_(d,"composition_validate_complete",{status:u.status,valid:m.valid,response:m}),d.json||te(d,m,()=>{console.log(m.valid?"\u2713 Composition is valid.":"\u2717 Composition is invalid."),m.valid||console.log(JSON.stringify(m,null,2))}),m.valid||v($.UserError),m}function Z5a(d){if(d.ifMatch&&d.create&&(console.error("Pass either --if-match <etag> or --create, not both."),v($.UserError)),d.create)return{create:!0};if(d.ifMatch)return{ifMatch:d.ifMatch};console.error(["composition put needs the ETag of the version your edit is based on, so it cannot overwrite a newer save."," Read it with `cueframe composition get <projectId>` (the `# ETag:` line, or `.etag` with --json) and pass --if-match <etag>."," Pass --create to write the first composition of a project that has none (If-None-Match: *)."].join(`
86
86
  `)),v($.UserError)}async function mx(d,T){if(T.ifMatch)return T.ifMatch;let z=await Kr(Jr(d),{method:"GET"},T,"composition_etag_fetch");if(z.status===404)return _e("No existing composition; building the first one.",T),null;z.status>=400&&(Xr(z,T,"composition_etag_fetch"),v(Ie(z.status)));let u=z.headers.etag;return u||(D(T,"composition_etag_fetch",new Error("Server returned no ETag on composition GET; cannot safely thread If-Match. Pass --if-match <etag> from `composition get`."),$.ApiServerError),v($.ApiServerError)),Ht(u)}async function lx(d){if(d.startsWith("@")){let T=d.slice(1);if(T==="-"){let z=[];for await(let u of process.stdin)z.push(Buffer.isBuffer(u)?u:Buffer.from(u));return Buffer.concat(z).toString("utf-8")}return W5a(T,"utf-8")}return d}async function Kr(d,T,z,u){try{return await Oe(d,T)}catch(m){D(z,u,m,$.NetworkError),v($.NetworkError)}}function Xr(d,T,z){let u=d.body?.error,m=u?.code??"unknown",s=u?.message??d.statusText,w=H5a(m,d.status,u?.details),h=Ie(d.status);T.json?D(T,z,Object.assign(new Error(s),{code:m,status:d.status,details:u?.details,advice:w}),h):(process.stderr.write(`\u2716 ${z}: ${s} (${m}, ${d.status})
@@ -105,4 +105,4 @@ Project ${k.projectId} created from ${m.name}.`),G&&console.log(`Output: ${G.out
105
105
  Export ID: ${u}
106
106
  Re-fetch via GET /v1/projects/${T.projectId}/exports/${u}.`),v($.ApiServerError));let w=T.out??`./export-${u.slice(0,8)}.zip`,h=await vWa(m.outputUrl,w,T.json);_(T,"export_complete",{exportId:u,projectId:T.projectId,format:d,outputUrl:m.outputUrl,outputExpiresAt:m.outputExpiresAt,outputSizeBytes:m.outputSizeBytes,trimCacheHit:m.trimCacheHit,outputPath:h})}async function UWa(d,T,z){let u=Date.now()+(z.timeoutMs??Dx),m=z.pollIntervalMs??SWa,s=Date.now(),w=pe("Exporting\u2026",z.json);try{for(;Date.now()<u;){let h;try{h=await on.getExport(d,T)}catch(b){if(b instanceof Fe&&b.status>=500){await Lx(m);continue}throw w.fail(`Failed to poll: ${le(b)}`),b}let p=Math.round((Date.now()-s)/1e3),c=Math.round((h.progress??0)*100);if(w.text=`Exporting\u2026 ${h.status}${c>0?` \xB7 ${c}%`:""} (${p}s)`,_(z,"export_progress",{exportId:T,status:h.status,progress:h.progress,elapsedSec:p}),h.status==="complete")return w.succeed(`Export complete (${p}s)`),{kind:"complete",outputUrl:h.outputUrl??null,outputExpiresAt:h.outputExpiresAt??null,outputSizeBytes:h.outputSizeBytes??null,trimCacheHit:h.trimCacheHit??null};if(h.status==="error"||h.status==="cancelled"){let b=h.error?.message??`Export ${h.status}`;return w.fail(b),{kind:"failed",message:b,error:h.error?{phase:h.error.phase,retryable:!!h.error.retryable}:null}}await Lx(m)}return w.fail(`Timed out waiting for export (${Math.round((Date.now()-s)/1e3)}s)`),{kind:"failed",message:`Timed out after ${Math.round((z.timeoutMs??Dx)/1e3)}s`,error:null}}catch(h){D(z,"export_progress",h,N(h)),v(N(h))}}async function vWa(d,T,z){let u=CWa(T),m=pe(`Downloading \u2192 ${u}\u2026`,z);try{let s=await fetch(d);if(!s.ok)throw new Error(`HTTP ${s.status}`);let w=Buffer.from(await s.arrayBuffer());return qWa(u,w),m.succeed(`Saved: ${u} (${(w.length/1024/1024).toFixed(1)} MB)`),u}catch(s){m.fail(`Download failed: ${le(s)}`),z||console.error(`
107
107
  Export URL (7-day TTL): ${d}`),v($.NetworkError)}}function Lx(d){return new Promise(T=>setTimeout(T,d))}async function Nx(d){Q(d.target),_(d,"sessions_list_prepare",{});try{let T=await Zt.listSessions();_(d,"sessions_list_complete",{count:T.data.length}),te(d,T,()=>{if(T.data.length===0){console.log("No sessions yet. Create one with `cueframe sessions create --name <n> --files <mediaId:role> \u2026`");return}for(let z of T.data){let u=z.muxStatus??"pending";console.log(`${z.id} ${z.fileCount} files mux:${u} ${z.name}`)}T.pagination.hasMore&&console.log(`# more \u2014 pass --after ${T.pagination.nextCursor} (raw via \`cueframe api\`)`)})}catch(T){D(d,"sessions_list",T,N(T)),v(N(T))}}async function Wx(d,T){ie(d,"sessionId",T),Q(T.target),_(T,"sessions_get_prepare",{sessionId:d});try{let z=await Zt.getSession(d);_(T,"sessions_get_complete",{sessionId:d}),te(T,z,()=>{console.log(JSON.stringify(z,null,2))})}catch(z){D(T,"sessions_get",z,N(z)),v(N(z))}}async function Zx(d){d.name||(console.error("--name is required"),v($.UserError)),(!d.files||d.files.length===0)&&(console.error("At least one --file <mediaId:role> is required"),v($.UserError));let T=d.files.map((z,u)=>{let m=z.indexOf(":");return m===-1&&(console.error(`--file[${u}] must be <mediaId>:<role>. Got: ${z}`),v($.UserError)),{mediaId:z.slice(0,m).trim(),role:z.slice(m+1).trim()}});Q(d.target),_(d,"sessions_create_prepare",{name:d.name,fileCount:T.length});try{let z=await Zt.createSession({name:d.name,files:T});_(d,"sessions_create_complete",{sessionId:z.id}),te(d,z,()=>{console.log(`Session created: ${z.id}`),console.log(JSON.stringify(z,null,2))})}catch(z){D(d,"sessions_create",z,N(z)),v(N(z))}}async function Hx(d,T){ie(d,"sessionId",T),Q(T.target),_(T,"sessions_delete_prepare",{sessionId:d});try{await Zt.deleteSession(d),_(T,"sessions_delete_complete",{sessionId:d}),te(T,{ok:!0,sessionId:d},()=>{console.log(`Session ${d} deleted.`)})}catch(z){D(T,"sessions_delete",z,N(z)),v(N(z))}}function Jx(d){let T=d.commands.map(Jx);return{name:d.name(),description:d.description(),arguments:d.registeredArguments.map(z=>({name:z.name(),required:z.required,description:z.description})),options:d.options.map(z=>({flags:z.flags,description:z.description,...z.defaultValue!==void 0?{default:z.defaultValue}:{}})),...T.length>0?{subcommands:T}:{}}}function Kx(d,T){let z=d.commands.map(Jx);if(T.json){_(T,"describe_complete",{name:d.name(),version:d.version()??null,commands:z});return}console.log(`${d.name()} ${d.version()??""}`.trim());for(let u of z){console.log(`
108
- ${u.name} \u2014 ${u.description}`);for(let m of u.subcommands??[])console.log(` ${u.name} ${m.name} \u2014 ${m.description}`)}}var Xx=["prod","local"];function ce(d){if(d===void 0)return"prod";if(Xx.includes(d))return d;console.error(`Invalid --target ${d}. Allowed: ${Xx.join(", ")}.`),v($.UserError)}function Qx(d){if(!d)return;let T=parseInt(d,10);if(T===24||T===25||T===30||T===60)return T;console.error(`Invalid --fps ${d}. Allowed: 24, 25, 30, 60.`),v($.UserError)}var Yx=d=>new qi("-a, --aspect <ratio>",d).choices(Object.values(fu)),ec=d=>new qi("--resolution <r>",d).choices(Object.values(Ru));async function oc(){let d=new AWa;d.name("cueframe").description("AI-assisted video editing and rendering").version("0.12.6").option("--json","Emit a structured JSON document on stdout instead of human-formatted output. Spinners are silenced.").option("--dry-run","Report what would happen without mutating anything; `template run` asks the API to bind the inputs without storing a template. Applies to upload, analyze, project create, render, template run.");let T=()=>d.opts();d.command("compare").description("Compare an identified reference frame with an existing saved preview, without rendering the composition again.").argument("<projectId>","Project owning the saved preview").requiredOption("--reference-media <mediaId>","Certified reference media id").requiredOption("--reference-representation <identity>","Exact certified representation identity").requiredOption("--reference-frame <frame>","Zero-based frame in the certified representation").requiredOption("--candidate-job <jobId>","Succeeded preview job id").requiredOption("--candidate-artifact <artifactId>","Image artifact id from that job").option("--views <views>","Comma-separated side_by_side,overlay,difference; default side_by_side,overlay").option("--crop <rectangle>","Shared image coordinates: x,y,width,height").option("-o, --out <directory>","Save comparison PNGs; JSON output contains compact receipts, never image bytes").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>Fx(f,{...R,target:ce(R.target),json:T().json})),d.command("install").description('One-line setup: wire the CueFrame MCP server into every installed agent (Claude Code / Cursor / Codex) 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), local. CUEFRAME_API_URL overrides the host.").option("-f, --force","Replace locally changed or untracked skills, retaining backups").action(f=>Gu({json:T().json,target:ce(f.target),dryRun:T().dryRun,force:f.force})),d.command("init").description("Scaffold a CueFrame component workspace (cueframe.json + components dir) in the current repo, so `new component` has a home and the render harness can discover it.").action(()=>_u({json:T().json,dryRun:T().dryRun})),d.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)").requiredOption("-c, --category <category>","Catalog category: text, effects, transitions, layouts, backgrounds, ui-blocks or scenes").option("-f, --force","Overwrite an existing non-empty component dir").action((f,R)=>HI(f,{json:T().json,dryRun:T().dryRun,force:R.force,category:R.category})),d.command("push").description("Publish a locally-authored native component (cueframe/components/<id>/template.html + definition.json) 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), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>XI(f,{target:ce(R.target),json:T().json})),d.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), local. CUEFRAME_API_URL overrides the host.").action(f=>QI({target:ce(f.target),json:T().json}));let u=d.command("keys").description("Manage API keys. `keys create` mints a scoped key \u2014 run `cueframe login` first (keys cannot mint keys).");u.command("create").description("Mint a scoped API key (cf_*). Requires a logged-in session.").requiredOption("-n, --name <name>","Key name, e.g. ci-runner").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)").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action(f=>ex({...f,target:ce(f.target),json:T().json})),u.command("list").description("List your API keys.").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action(f=>ox({target:ce(f.target),json:T().json})),u.command("revoke").description("Revoke an API key by id.").argument("<keyId>","Key id (from `cueframe keys list`)").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>tx(f,{target:ce(R.target),json:T().json})),d.command("login").description("Browser-mediated sign-in (OAuth device flow). Recommended for laptops.").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").option("--url <url>","Override the API base URL (advanced)").action(f=>Vx({...f,target:ce(f.target),json:T().json})),d.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), local. CUEFRAME_API_URL overrides the host.").option("--url <url>","Override the API base URL (advanced)").action((f,R)=>{let B=ce(R.target);yu(f),rn(f,B,R.url),T().json?console.log(JSON.stringify({ok:!0,target:B},null,2)):console.log(`API key saved for target "${B}"`)}),d.command("list").description("List projects").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").option("-n, --limit <n>","Max projects to show","10").action(f=>rx({target:ce(f.target),limit:parseInt(f.limit),json:T().json}));let m=d.command("project").description("Project commands");m.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), local. CUEFRAME_API_URL overrides the host.").addOption(Yx("Aspect ratio").default("9:16")).option("--fps <n>","Frame rate: 24, 25, 30, 60","30").addOption(ec("Resolution").default("fhd")).option("--brand-kit <id>","Bind a brand kit id to the project").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(async f=>{await wx({name:f.name,target:ce(f.target),aspect:f.aspect,fps:Qx(f.fps),resolution:f.resolution,brandKitId:f.brandKit,fromSuggestion:f.fromSuggestion,cheap:f.cheap,json:T().json,dryRun:T().dryRun})}),m.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), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>hx(f,{target:ce(R.target),json:T().json}));let s=d.command("media").description("Media library commands");s.command("download-url").description("Print a presigned download URL for a media item's stored source file (valid about an hour; pipe it into curl). With --json: { url, expiresAt }.").argument("<mediaId>","Media item ID (from `cueframe clips`)").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>xx(f,{target:ce(R.target),json:T().json})),s.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), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>Ix(f,{target:ce(R.target),json:T().json})),d.command("upload").description("Upload a video file and process it").argument("<file>","Path to video file").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").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(async(f,R)=>{await Mi(f,{target:ce(R.target),analyze:R.analyze,audioRole:R.audioRole,json:T().json,dryRun:T().dryRun})}),d.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), local. CUEFRAME_API_URL overrides the host.").option("-w, --wait","Wait for analysis to complete and show results").action((f,R)=>qu(f,{target:ce(R.target),wait:R.wait,json:T().json,dryRun:T().dryRun})),d.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), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>Tx(f,{target:ce(R.target),json:T().json}));let w=d.command("template").description("Run or validate a CueFrame template document (.cueframe), from the public catalog or your org");w.command("run").description("Start a template preparation job, wait for the ready project, and render").argument("<template>","Catalog slug (cueframe-ai/cueframe-templates), a template id in your org, or a local .cueframe document").option("-m, --media <name=source...>","A media parameter: name=<file|https url|sample|media:<id>> (repeatable)",[]).option("-v, --values <name=value...>","A parameter value: name=value (repeatable); coerced by the document",[]).option("-p, --preset <name>","A preset of the document; its values fill what --values leaves out").option("--brand-kit <id>","Apply with one of your org brand kits instead of the template's").option("--idempotency-key <key>","Reuse this key to safely retry a start request whose response was lost").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").option("-o, --out <path>","Output MP4 path","./template-output.mp4").option("--no-render","Create the editable project without rendering it").action(async(f,R)=>{await Ax(f,{media:R.media,values:R.values,preset:R.preset,brandKitId:R.brandKit,idempotencyKey:R.idempotencyKey,out:R.out,target:ce(R.target),render:R.render!==!1,json:T().json,dryRun:T().dryRun})}),w.command("status").description("Read a template preparation job; use --wait to reconnect until it is ready").argument("<jobId>","Job id returned by template run").option("--wait","Poll until ready, failed, or cancelled").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action(async(f,R)=>{await Ux(f,{target:ce(R.target),json:T().json,wait:R.wait})}),w.command("validate").description("Check a template document: its references, every preset bound with the sample media, its prepared mattes. Runs on the CueFrame API with your key; nothing is stored.").argument("<template>","Catalog slug, a template id in your org, or a local .cueframe document").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action(async(f,R)=>{await vx(f,{target:ce(R.target),json:T().json})});let h=d.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), local. CUEFRAME_API_URL overrides the host.").addOption(Yx("Format override; must match the composition's aspect (a new aspect is `derive_composition`). Default: the composition's format")).option("--fps <n>","Frame rate (24, 25, 30, 60); needs --aspect. A saved composition keeps its own fps").addOption(ec("Output resolution override; needs --aspect. Default: the composition's resolution")).option("-o, --out <path>","Output file path (default: ./reel-<id>.mp4)").option("--idempotency-key <key>","Override the auto-derived Idempotency-Key. Default: sha256 of the project, the current composition ETag and the request body (format, priority, intent). Pass a fresh UUID to force a new render row.").addOption(new qi("--priority <p>","Routing intent: interactive (low-latency, access-gated), standard (default), background (lowest queue weight).").choices(Object.values(Bu))).addOption(new qi("--intent <i>","Encode-quality hint: preview (fast / low-bitrate, for editor scrubbing) or final (default, full Format).").choices(Object.values(Mu))).action(async(f,R)=>{await Oi(f,{target:R.target,aspect:R.aspect,fps:Qx(R.fps),resolution:R.resolution,out:R.out,json:T().json,dryRun:T().dryRun,...R.idempotencyKey?{idempotencyKey:R.idempotencyKey}:{},...R.priority?{priority:R.priority}:{},...R.intent?{intent:R.intent}:{}})});d.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), local. CUEFRAME_API_URL overrides the host.").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.").option("--timeout-ms <milliseconds>","Request timeout in milliseconds (1\u20132147483647); omitted uses the SDK default. Does not change server deadlines.").action((f,R,B)=>Gx(f,R,{target:B.target,body:B.body,header:B.header,include:B.include,timeoutMs:B.timeoutMs,json:T().json})),d.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), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>jx(f,{target:R.target,json:T().json}));let p=d.command("composition").description("Read/write a project's composition. ETag is threaded automatically.");p.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), local. CUEFRAME_API_URL overrides the host.").action(async f=>{await ux({target:f.target,body:f.body,json:T().json})}),p.command("get").description("Fetch the project's composition and ETag").argument("<projectId>","Project ID").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>sx(f,{target:R.target,json:T().json})),p.command("put").description("Replace the composition. Requires --if-match <etag> from `composition get` (or --create for a project with none), so a newer save is never silently overwritten.").argument("<projectId>","Project ID").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").requiredOption("-b, --body <body>","Composition JSON (inline, @file.json, or @- for stdin)").option("--if-match <etag>","ETag of the version your edit is based on (from `composition get`); a newer save fails with 409 stale_etag").option("--create","Create the first composition of a project that has none (If-None-Match: *); refused 409 if one exists").action(async(f,R)=>{await zx(f,{target:R.target,body:R.body,ifMatch:R.ifMatch,create:R.create,json:T().json})}),p.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), local. CUEFRAME_API_URL overrides the host.").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)").action((f,R)=>Bi(f,{target:R.target,suggestionId:R.suggestion,format:R.format,ifMatch:R.ifMatch,json:T().json})),h.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), local. CUEFRAME_API_URL overrides the host.").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((f,R,B)=>{let S=B?.parent?.opts?.()??{},U=S.target??R.target;return px(f,{target:U,project:R.project,out:R.out??S.out,download:R.download!==!1,json:T().json})});let c=d.command("export").description("Hand the timeline off to a real NLE (Final Cut Pro / Premiere Pro)");c.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), local. CUEFRAME_API_URL overrides the host.").option("-o, --out <path>","Output zip path (default: ./export-<id>.zip)").option("--wait","Block until the export finishes, then download the artifact").action((f,R)=>wu("fcpxml",{target:R.target,projectId:f,suggestionId:R.suggestion,out:R.out,wait:R.wait,json:T().json})),c.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), local. CUEFRAME_API_URL overrides the host.").option("-o, --out <path>","Output zip path (default: ./export-<id>.zip)").option("--wait","Block until the export finishes, then download the artifact").action((f,R)=>wu("premiere",{target:R.target,projectId:f,suggestionId:R.suggestion,out:R.out,wait:R.wait,json:T().json}));let b=d.command("sessions").description("Multi-file ingest sessions (camera A/B/screen \u2192 muxed composition)");b.command("list").description("List sessions in this org").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action(f=>Nx({target:f.target,json:T().json})),b.command("get").description("Get a single session by ID").argument("<sessionId>","Session ID").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>Wx(f,{target:R.target,json:T().json})),b.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), local. CUEFRAME_API_URL overrides the host.").action(f=>Zx({target:f.target,name:f.name,files:f.file,json:T().json})),b.command("delete").description("Delete a session (server checks for compositions referencing it)").argument("<sessionId>","Session ID").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>Hx(f,{target:R.target,json:T().json})),d.command("describe").description("Print the CLI command tree as structured JSON (agent introspection)").action(()=>Kx(d,{json:T().json}));try{await d.parseAsync()}catch(f){let R=N(f);D(T(),"cli",Object.assign(new Error(le(f)),{code:f?.code,status:f?.status}),R),v(R)}}await oc();
108
+ ${u.name} \u2014 ${u.description}`);for(let m of u.subcommands??[])console.log(` ${u.name} ${m.name} \u2014 ${m.description}`)}}var Xx=["prod","local"];function ce(d){if(d===void 0)return"prod";if(Xx.includes(d))return d;console.error(`Invalid --target ${d}. Allowed: ${Xx.join(", ")}.`),v($.UserError)}function Qx(d){if(!d)return;let T=parseInt(d,10);if(T===24||T===25||T===30||T===60)return T;console.error(`Invalid --fps ${d}. Allowed: 24, 25, 30, 60.`),v($.UserError)}var Yx=d=>new qi("-a, --aspect <ratio>",d).choices(Object.values(fu)),ec=d=>new qi("--resolution <r>",d).choices(Object.values(Ru));async function oc(){let d=new AWa;d.name("cueframe").description("AI-assisted video editing and rendering").version("0.12.8").option("--json","Emit a structured JSON document on stdout instead of human-formatted output. Spinners are silenced.").option("--dry-run","Report what would happen without mutating anything; `template run` asks the API to bind the inputs without storing a template. Applies to upload, analyze, project create, render, template run.");let T=()=>d.opts();d.command("compare").description("Compare an identified reference frame with an existing saved preview, without rendering the composition again.").argument("<projectId>","Project owning the saved preview").requiredOption("--reference-media <mediaId>","Certified reference media id").requiredOption("--reference-representation <identity>","Exact certified representation identity").requiredOption("--reference-frame <frame>","Zero-based frame in the certified representation").requiredOption("--candidate-job <jobId>","Succeeded preview job id").requiredOption("--candidate-artifact <artifactId>","Image artifact id from that job").option("--views <views>","Comma-separated side_by_side,overlay,difference; default side_by_side,overlay").option("--crop <rectangle>","Shared image coordinates: x,y,width,height").option("-o, --out <directory>","Save comparison PNGs; JSON output contains compact receipts, never image bytes").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>Fx(f,{...R,target:ce(R.target),json:T().json})),d.command("install").description('One-line setup: wire the CueFrame MCP server into every installed agent (Claude Code / Cursor / Codex) 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), local. CUEFRAME_API_URL overrides the host.").option("-f, --force","Replace locally changed or untracked skills, retaining backups").action(f=>Gu({json:T().json,target:ce(f.target),dryRun:T().dryRun,force:f.force})),d.command("init").description("Scaffold a CueFrame component workspace (cueframe.json + components dir) in the current repo, so `new component` has a home and the render harness can discover it.").action(()=>_u({json:T().json,dryRun:T().dryRun})),d.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)").requiredOption("-c, --category <category>","Catalog category: text, effects, transitions, layouts, backgrounds, ui-blocks or scenes").option("-f, --force","Overwrite an existing non-empty component dir").action((f,R)=>HI(f,{json:T().json,dryRun:T().dryRun,force:R.force,category:R.category})),d.command("push").description("Publish a locally-authored native component (cueframe/components/<id>/template.html + definition.json) 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), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>XI(f,{target:ce(R.target),json:T().json})),d.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), local. CUEFRAME_API_URL overrides the host.").action(f=>QI({target:ce(f.target),json:T().json}));let u=d.command("keys").description("Manage API keys. `keys create` mints a scoped key \u2014 run `cueframe login` first (keys cannot mint keys).");u.command("create").description("Mint a scoped API key (cf_*). Requires a logged-in session.").requiredOption("-n, --name <name>","Key name, e.g. ci-runner").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)").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action(f=>ex({...f,target:ce(f.target),json:T().json})),u.command("list").description("List your API keys.").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action(f=>ox({target:ce(f.target),json:T().json})),u.command("revoke").description("Revoke an API key by id.").argument("<keyId>","Key id (from `cueframe keys list`)").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>tx(f,{target:ce(R.target),json:T().json})),d.command("login").description("Browser-mediated sign-in (OAuth device flow). Recommended for laptops.").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").option("--url <url>","Override the API base URL (advanced)").action(f=>Vx({...f,target:ce(f.target),json:T().json})),d.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), local. CUEFRAME_API_URL overrides the host.").option("--url <url>","Override the API base URL (advanced)").action((f,R)=>{let B=ce(R.target);yu(f),rn(f,B,R.url),T().json?console.log(JSON.stringify({ok:!0,target:B},null,2)):console.log(`API key saved for target "${B}"`)}),d.command("list").description("List projects").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").option("-n, --limit <n>","Max projects to show","10").action(f=>rx({target:ce(f.target),limit:parseInt(f.limit),json:T().json}));let m=d.command("project").description("Project commands");m.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), local. CUEFRAME_API_URL overrides the host.").addOption(Yx("Aspect ratio").default("9:16")).option("--fps <n>","Frame rate: 24, 25, 30, 60","30").addOption(ec("Resolution").default("fhd")).option("--brand-kit <id>","Bind a brand kit id to the project").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(async f=>{await wx({name:f.name,target:ce(f.target),aspect:f.aspect,fps:Qx(f.fps),resolution:f.resolution,brandKitId:f.brandKit,fromSuggestion:f.fromSuggestion,cheap:f.cheap,json:T().json,dryRun:T().dryRun})}),m.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), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>hx(f,{target:ce(R.target),json:T().json}));let s=d.command("media").description("Media library commands");s.command("download-url").description("Print a presigned download URL for a media item's stored source file (valid about an hour; pipe it into curl). With --json: { url, expiresAt }.").argument("<mediaId>","Media item ID (from `cueframe clips`)").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>xx(f,{target:ce(R.target),json:T().json})),s.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), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>Ix(f,{target:ce(R.target),json:T().json})),d.command("upload").description("Upload a video file and process it").argument("<file>","Path to video file").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").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(async(f,R)=>{await Mi(f,{target:ce(R.target),analyze:R.analyze,audioRole:R.audioRole,json:T().json,dryRun:T().dryRun})}),d.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), local. CUEFRAME_API_URL overrides the host.").option("-w, --wait","Wait for analysis to complete and show results").action((f,R)=>qu(f,{target:ce(R.target),wait:R.wait,json:T().json,dryRun:T().dryRun})),d.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), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>Tx(f,{target:ce(R.target),json:T().json}));let w=d.command("template").description("Run or validate a CueFrame template document (.cueframe), from the public catalog or your org");w.command("run").description("Start a template preparation job, wait for the ready project, and render").argument("<template>","Catalog slug (cueframe-ai/cueframe-templates), a template id in your org, or a local .cueframe document").option("-m, --media <name=source...>","A media parameter: name=<file|https url|sample|media:<id>> (repeatable)",[]).option("-v, --values <name=value...>","A parameter value: name=value (repeatable); coerced by the document",[]).option("-p, --preset <name>","A preset of the document; its values fill what --values leaves out").option("--brand-kit <id>","Apply with one of your org brand kits instead of the template's").option("--idempotency-key <key>","Reuse this key to safely retry a start request whose response was lost").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").option("-o, --out <path>","Output MP4 path","./template-output.mp4").option("--no-render","Create the editable project without rendering it").action(async(f,R)=>{await Ax(f,{media:R.media,values:R.values,preset:R.preset,brandKitId:R.brandKit,idempotencyKey:R.idempotencyKey,out:R.out,target:ce(R.target),render:R.render!==!1,json:T().json,dryRun:T().dryRun})}),w.command("status").description("Read a template preparation job; use --wait to reconnect until it is ready").argument("<jobId>","Job id returned by template run").option("--wait","Poll until ready, failed, or cancelled").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action(async(f,R)=>{await Ux(f,{target:ce(R.target),json:T().json,wait:R.wait})}),w.command("validate").description("Check a template document: its references, every preset bound with the sample media, its prepared mattes. Runs on the CueFrame API with your key; nothing is stored.").argument("<template>","Catalog slug, a template id in your org, or a local .cueframe document").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action(async(f,R)=>{await vx(f,{target:ce(R.target),json:T().json})});let h=d.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), local. CUEFRAME_API_URL overrides the host.").addOption(Yx("Format override; must match the composition's aspect (a new aspect is `derive_composition`). Default: the composition's format")).option("--fps <n>","Frame rate (24, 25, 30, 60); needs --aspect. A saved composition keeps its own fps").addOption(ec("Output resolution override; needs --aspect. Default: the composition's resolution")).option("-o, --out <path>","Output file path (default: ./reel-<id>.mp4)").option("--idempotency-key <key>","Override the auto-derived Idempotency-Key. Default: sha256 of the project, the current composition ETag and the request body (format, priority, intent). Pass a fresh UUID to force a new render row.").addOption(new qi("--priority <p>","Routing intent: interactive (low-latency, access-gated), standard (default), background (lowest queue weight).").choices(Object.values(Bu))).addOption(new qi("--intent <i>","Encode-quality hint: preview (fast / low-bitrate, for editor scrubbing) or final (default, full Format).").choices(Object.values(Mu))).action(async(f,R)=>{await Oi(f,{target:R.target,aspect:R.aspect,fps:Qx(R.fps),resolution:R.resolution,out:R.out,json:T().json,dryRun:T().dryRun,...R.idempotencyKey?{idempotencyKey:R.idempotencyKey}:{},...R.priority?{priority:R.priority}:{},...R.intent?{intent:R.intent}:{}})});d.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), local. CUEFRAME_API_URL overrides the host.").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.").option("--timeout-ms <milliseconds>","Request timeout in milliseconds (1\u20132147483647); omitted uses the SDK default. Does not change server deadlines.").action((f,R,B)=>Gx(f,R,{target:B.target,body:B.body,header:B.header,include:B.include,timeoutMs:B.timeoutMs,json:T().json})),d.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), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>jx(f,{target:R.target,json:T().json}));let p=d.command("composition").description("Read/write a project's composition. ETag is threaded automatically.");p.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), local. CUEFRAME_API_URL overrides the host.").action(async f=>{await ux({target:f.target,body:f.body,json:T().json})}),p.command("get").description("Fetch the project's composition and ETag").argument("<projectId>","Project ID").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>sx(f,{target:R.target,json:T().json})),p.command("put").description("Replace the composition. Requires --if-match <etag> from `composition get` (or --create for a project with none), so a newer save is never silently overwritten.").argument("<projectId>","Project ID").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").requiredOption("-b, --body <body>","Composition JSON (inline, @file.json, or @- for stdin)").option("--if-match <etag>","ETag of the version your edit is based on (from `composition get`); a newer save fails with 409 stale_etag").option("--create","Create the first composition of a project that has none (If-None-Match: *); refused 409 if one exists").action(async(f,R)=>{await zx(f,{target:R.target,body:R.body,ifMatch:R.ifMatch,create:R.create,json:T().json})}),p.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), local. CUEFRAME_API_URL overrides the host.").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)").action((f,R)=>Bi(f,{target:R.target,suggestionId:R.suggestion,format:R.format,ifMatch:R.ifMatch,json:T().json})),h.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), local. CUEFRAME_API_URL overrides the host.").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((f,R,B)=>{let S=B?.parent?.opts?.()??{},U=S.target??R.target;return px(f,{target:U,project:R.project,out:R.out??S.out,download:R.download!==!1,json:T().json})});let c=d.command("export").description("Hand the timeline off to a real NLE (Final Cut Pro / Premiere Pro)");c.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), local. CUEFRAME_API_URL overrides the host.").option("-o, --out <path>","Output zip path (default: ./export-<id>.zip)").option("--wait","Block until the export finishes, then download the artifact").action((f,R)=>wu("fcpxml",{target:R.target,projectId:f,suggestionId:R.suggestion,out:R.out,wait:R.wait,json:T().json})),c.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), local. CUEFRAME_API_URL overrides the host.").option("-o, --out <path>","Output zip path (default: ./export-<id>.zip)").option("--wait","Block until the export finishes, then download the artifact").action((f,R)=>wu("premiere",{target:R.target,projectId:f,suggestionId:R.suggestion,out:R.out,wait:R.wait,json:T().json}));let b=d.command("sessions").description("Multi-file ingest sessions (camera A/B/screen \u2192 muxed composition)");b.command("list").description("List sessions in this org").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action(f=>Nx({target:f.target,json:T().json})),b.command("get").description("Get a single session by ID").argument("<sessionId>","Session ID").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>Wx(f,{target:R.target,json:T().json})),b.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), local. CUEFRAME_API_URL overrides the host.").action(f=>Zx({target:f.target,name:f.name,files:f.file,json:T().json})),b.command("delete").description("Delete a session (server checks for compositions referencing it)").argument("<sessionId>","Session ID").option("-t, --target <target>","Target environment: prod (default), local. CUEFRAME_API_URL overrides the host.").action((f,R)=>Hx(f,{target:R.target,json:T().json})),d.command("describe").description("Print the CLI command tree as structured JSON (agent introspection)").action(()=>Kx(d,{json:T().json}));try{await d.parseAsync()}catch(f){let R=N(f);D(T(),"cli",Object.assign(new Error(le(f)),{code:f?.code,status:f?.status}),R),v(R)}}await oc();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cueframe",
3
- "version": "0.12.6",
3
+ "version": "0.12.8",
4
4
  "description": "CueFrame video editing CLI: manage media, edit compositions and render MP4s from terminals and scripts.",
5
5
  "keywords": [
6
6
  "cueframe",
@@ -46,8 +46,8 @@
46
46
  "typescript": "npm:@typescript/typescript6@^6.0.2",
47
47
  "vitest": "^5.0.3",
48
48
  "zod": "^4.6.7",
49
- "@cueframe/skills": "0.4.7",
50
- "@cueframe/sdk": "^0.19.0"
49
+ "@cueframe/sdk": "^0.19.0",
50
+ "@cueframe/skills": "0.4.9"
51
51
  },
52
52
  "repository": {
53
53
  "type": "git",
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{L as a}from"./chunk-W3KRGWX2.js";import"./chunk-3QSA3EBY.js";export{a as analyzeCommand};