import { createAndRenderDraft, validateDraftSpec } from 'cutsdk'; const spec = { version: '1.0', canvas: { width: 1080, height: 1920 }, duration: '6s', assets: { cover: { type: 'image', src: '/absolute/path/to/cover.png', width: 1080, height: 1920, }, bgm: { type: 'audio', src: '/absolute/path/to/music.mp3', duration: '6s', }, }, styles: { title: { fontSize: 10, color: '#ffffff', bold: true, shadow: true, }, }, tracks: [ { type: 'visual', clips: [ { type: 'image', asset: 'cover', start: '0s', duration: '6s' }, ], }, { type: 'text', clips: [ { type: 'caption', text: 'AI Draft Spec 示例', style: 'title', keyword: 'AI|Spec', keywordColor: '#00ffaa', start: '0s', duration: '6s', position: 'bottom', }, ], }, { type: 'audio', clips: [ { type: 'audio', asset: 'bgm', start: '0s', duration: '6s', volume: 0.7 }, ], }, ], } as const; async function main() { const validation = validateDraftSpec(spec); if (!validation.valid) { console.error(validation.errors); process.exit(1); } const result = await createAndRenderDraft({ draft: spec, output: { draftsDir: process.env.CUT_DRAFTS_DIR, name: 'AI Draft Spec 示例', }, render: false, }); console.log(result.draft); } main().catch((error) => { console.error(error); process.exit(1); });