@lalalic/markcut 3.2.60 → 3.2.62

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.
Files changed (54) hide show
  1. package/README.md +48 -5
  2. package/bin/markcut +15 -0
  3. package/docs/developer-reference.md +41 -1
  4. package/package.json +8 -2
  5. package/recipes/markcut/map-cinematic-follow.json +17 -0
  6. package/recipes/markcut/map-location-reveal.json +17 -0
  7. package/recipes/markcut/map-route-journey.json +18 -0
  8. package/recipes/markcut/map-streetview-explore.json +17 -0
  9. package/skills/markcut/SKILL.md +8 -3
  10. package/skills/markcut/docs/markdown-descriptive.md +68 -1
  11. package/skills/markcut/docs/recipes.md +45 -0
  12. package/skills/markcut/references/mobile-event-preview-cli.md +9 -5
  13. package/src/descriptive/compiler.ts +38 -2
  14. package/src/descriptive/markdown.ts +30 -0
  15. package/src/descriptive/model3d.test.ts +38 -0
  16. package/src/editor-decision/cli.mjs +21 -0
  17. package/src/editor-decision/editor-decision.schema.json +41 -0
  18. package/src/editor-decision/index.mjs +115 -0
  19. package/src/editor-decision/index.test.mjs +63 -0
  20. package/src/mcp/bridge.mjs +92 -12
  21. package/src/mcp/compile-worker.mjs +2 -2
  22. package/src/mcp/design-cli.mjs +126 -0
  23. package/src/mcp/mobile-review-cli.mjs +40 -33
  24. package/src/mcp/preview-mobile.css +21 -8
  25. package/src/mcp/preview.mjs +97 -57
  26. package/src/mcp/remote-assets.mjs +85 -7
  27. package/src/mcp/remotion-app.bundle.js +5013 -1117
  28. package/src/mcp/remotion-app.tsx +132 -10
  29. package/src/mcp/server.mjs +4 -2
  30. package/src/player/browser.tsx +1 -3
  31. package/src/player/bundle/player.js +73054 -17357
  32. package/src/player/components/HeaderBar.tsx +3 -1
  33. package/src/player/components/VariantBar.tsx +20 -21
  34. package/src/player/pipeline.mjs +133 -77
  35. package/src/player/server.mjs +43 -23
  36. package/src/recipes/catalog.mjs +115 -0
  37. package/src/recipes/cli.mjs +87 -0
  38. package/src/render/cli.mjs +40 -1
  39. package/src/schema/index.ts +21 -0
  40. package/src/types/Folder.tsx +2 -0
  41. package/src/types/Model3D.tsx +91 -0
  42. package/src/vision/cli.mjs +63 -50
  43. package/tests/mcp-design-mode.test.ts +100 -0
  44. package/tests/mcp-editor-decisions-mobile.test.ts +35 -0
  45. package/tests/mcp-preview-bridge.test.ts +44 -3
  46. package/tests/mcp-preview-proxy-version.test.mjs +80 -0
  47. package/tests/mcp-preview.test.ts +43 -8
  48. package/tests/mcp-remote-assets.test.ts +17 -0
  49. package/tests/mcp-static-preview.test.ts +1 -1
  50. package/tests/mcp-video-selector.test.ts +55 -0
  51. package/tests/mobile-preview-cli.test.ts +10 -15
  52. package/tests/recipes-catalog.test.ts +141 -0
  53. package/tests/vision-generic-vtt-hooks.test.ts +7 -7
  54. package/tests/vision-normalized-metadata.test.ts +23 -0
@@ -0,0 +1,55 @@
1
+ import {describe,it,expect} from 'vitest';
2
+ import {mkdtemp,writeFile,mkdir,rm,readFile} from 'node:fs/promises';
3
+ import {tmpdir} from 'node:os';
4
+ import {join} from 'node:path';
5
+
6
+ describe('one video selector for original, named variants, and editor decisions',()=>{
7
+ it('compiles and publishes every named variant and the EDL without modifying the authored film',async()=>{
8
+ const root=await mkdtemp(join(tmpdir(),'markcut-video-selector-'));
9
+ const beforeExport=process.env.MARKCUT_EXPORT_ROOT,beforeOrigin=process.env.NEOY_PUBLIC_ORIGIN;
10
+ process.env.MARKCUT_EXPORT_ROOT=join(root,'exports');
11
+ process.env.NEOY_PUBLIC_ORIGIN='https://neoy.example.test';
12
+ try {
13
+ const {ensureVideoPreview,getPreviewMedia}=await import('../src/mcp/preview.mjs');
14
+ await mkdir(join(root,'input','media'),{recursive:true});
15
+ await writeFile(join(root,'input','media','frame.png'),Buffer.from('media'));
16
+ const film=join(root,'video.md');
17
+ const markdown=['---','edl: ./video.edl.json','---','# video',
18
+ 'width:320 height:568 fps:24 layout:series','','## Main',
19
+ '- image src:input/media/frame.png duration:1','','# landscape',
20
+ 'width:640 height:360 fps:24','','# square',
21
+ 'width:480 height:480 fps:24',''].join('\n');
22
+ await writeFile(film,markdown);
23
+ await writeFile(join(root,'video.edl.json'),JSON.stringify({schema_version:1,
24
+ edits:[{shot_id:'intro',source_src:'input/media/frame.png',in_seconds:0,out_seconds:1,editor_reason:'Hold the opening'}]}));
25
+ const preview=await ensureVideoPreview(film);
26
+ const media=getPreviewMedia(preview.contentHash);
27
+ expect([media.compiled.width,media.compiled.height]).toEqual([320,568]);
28
+ expect(Object.keys(media.variants)).toEqual(['landscape','square']);
29
+ expect([media.variants.landscape.width,media.variants.landscape.height]).toEqual([640,360]);
30
+ expect([media.variants.square.width,media.variants.square.height]).toEqual([480,480]);
31
+ expect(media.editorDecisions.children.map((scene:any)=>scene.name)).toEqual(['Shot1']);
32
+ expect(JSON.parse(await readFile(join(root,'exports','cache',preview.contentHash+'.variants.json'),'utf8')))
33
+ .toHaveProperty('landscape');
34
+ expect(await readFile(film,'utf8')).toBe(markdown);
35
+ // Validate published resource while the test's Neo origin and export directory
36
+ // are set; CI has no actual NeoY deployment.json.
37
+ const {buildPreviewHtml}=await import('../src/mcp/preview.mjs');
38
+ const html=buildPreviewHtml();
39
+ expect(html).toContain('id="markcut-video-selector-slot"');
40
+ expect(html).not.toContain('id="review-delivery-mode"');
41
+ } finally {
42
+ if(beforeExport===undefined)delete process.env.MARKCUT_EXPORT_ROOT;else process.env.MARKCUT_EXPORT_ROOT=beforeExport;
43
+ if(beforeOrigin===undefined)delete process.env.NEOY_PUBLIC_ORIGIN;else process.env.NEOY_PUBLIC_ORIGIN=beforeOrigin;
44
+ await rm(root,{recursive:true,force:true});
45
+ }
46
+ },25000);
47
+ it('ships a right-hand selector without a separate mode label or EDL tab bar',async()=>{
48
+ const {readFileSync}=await import('node:fs');
49
+ const app=readFileSync(new URL('../src/mcp/remotion-app.tsx',import.meta.url),'utf8');
50
+ expect(app).toContain('id="markcut-video-selector"');
51
+ expect(app).toContain('editor-decisions');
52
+ expect(app).not.toContain('role="tablist"');
53
+ expect(app).not.toContain('Editorial view · Switch to Video');
54
+ });
55
+ });
@@ -1,5 +1,5 @@
1
1
  import {describe,it,expect} from 'vitest';
2
- import {parseEventPreviewOptions,neoReviewEndpoint,buildReviewRequest,submitNeoReview} from '../src/mcp/mobile-review-cli.mjs';
2
+ import {parseEventPreviewOptions,neoReviewWrapper,buildReviewRequest,submitNeoReview} from '../src/mcp/mobile-review-cli.mjs';
3
3
 
4
4
  describe('Standalone Markcut CLI preview (notification belongs to Neo)',()=>{
5
5
  it('accepts externally supplied event templates without a phone or APNs URL',()=>{
@@ -11,7 +11,7 @@ describe('Standalone Markcut CLI preview (notification belongs to Neo)',()=>{
11
11
  });
12
12
  });
13
13
 
14
- describe('Neo-owned REST notification from standalone CLI',()=>{
14
+ describe('Neo-owned wrapper delivery from standalone CLI',()=>{
15
15
  const id='82ba2e6c-6432-4ecd-83ee-cb78ba87c668';
16
16
  const hash='f'.repeat(64);
17
17
  const options={file:'/tmp/preview.md'};
@@ -30,22 +30,17 @@ describe('Neo-owned REST notification from standalone CLI',()=>{
30
30
  expect(request).not.toHaveProperty('jobId');
31
31
  expect(request).not.toHaveProperty('revisionId');expect(request).not.toHaveProperty('contentHash');
32
32
  });
33
- it('POSTs to local Neo Core REST and requires persisted matching ACK',async()=>{
33
+ it('delegates the complete immutable request to the Neo-owned wrapper',async()=>{
34
34
  const request=buildReviewRequest(options,{delivery:'text'},state,id);
35
35
  const seen:any[]=[];
36
- const fetchImpl=async (url:string,init:any)=>{
37
- seen.push({url,init});return {ok:true,json:async()=>({stored:true,requestId:id,accepted:false})};
38
- };
39
- const receipt=await submitNeoReview(request,{url:'http://127.0.0.1:6767/mobile/review/notify',fetchImpl} as any);
36
+ const receipt=await submitNeoReview(request,{deliver:async (value:any)=>{
37
+ seen.push(value);return {stored:true,requestId:id,accepted:false};
38
+ }} as any);
40
39
  expect(receipt.stored).toBe(true);
41
- expect(seen[0].init.method).toBe('POST');
42
- expect(JSON.parse(seen[0].init.body)).toEqual(request);
43
- expect(seen[0].init.headers['Content-Type']).toBe('application/json');
44
- await expect(submitNeoReview(request,{url:'http://127.0.0.1:6767/mobile/review/notify',fetchImpl:async()=>({ok:true,json:async()=>({stored:false,requestId:id})})} as any)).rejects.toThrow('acknowledge');
45
- await expect(submitNeoReview(request,{url:'http://127.0.0.1:6767/mobile/review/notify',fetchImpl:async()=>({ok:false,status:403})} as any)).rejects.toThrow('403');
40
+ expect(seen).toEqual([request]);
41
+ await expect(submitNeoReview(request,{deliver:async()=>({stored:false,requestId:id})} as any)).rejects.toThrow('acknowledge');
46
42
  });
47
- it('rejects delivery to remote origins and non-review routes',async()=>{
48
- expect(()=>neoReviewEndpoint('https://evil.example/mobile/review/notify')).toThrow('local REST');
49
- await expect(submitNeoReview({id} as any,{url:'http://127.0.0.1:6767/mcp'})).rejects.toThrow('nonlocal');
43
+ it('requires a real Neo wrapper, never a direct review notification URL',()=>{
44
+ expect(()=>neoReviewWrapper('/does/not/exist')).toThrow('unavailable');
50
45
  });
51
46
  });
@@ -0,0 +1,141 @@
1
+ import {describe,it,expect} from 'vitest';
2
+ import {loadRecipeCatalog,findShotcraftSkillRoot,filterRecipes,getRecipe,readRecipeDetail} from '../src/recipes/catalog.mjs';
3
+ import {parseMarkdownDescriptive} from '../src/descriptive/markdown';
4
+ import {compileDescriptiveRoot} from '../src/descriptive/compiler';
5
+ import {mkdtemp,mkdir,writeFile,rm,symlink} from 'node:fs/promises';
6
+ import {tmpdir} from 'node:os';
7
+ import {join,resolve} from 'node:path';
8
+ import {fileURLToPath} from 'node:url';
9
+ import {spawnSync} from 'node:child_process';
10
+
11
+ const native=()=>loadRecipeCatalog({shotcraftRoot:null});
12
+ const cli=fileURLToPath(new URL('../bin/markcut',import.meta.url));
13
+
14
+ describe('Markcut-owned recipe catalog',()=>{
15
+ it('has four independently addressable native Google map recipes',()=>{
16
+ const recipes=native().recipes;
17
+ expect(recipes.map(r=>r.id)).toEqual([
18
+ 'markcut:map-cinematic-follow','markcut:map-location-reveal',
19
+ 'markcut:map-route-journey','markcut:map-streetview-explore'
20
+ ]);
21
+ expect(recipes.map(r=>r.view).sort()).toEqual(['cinematic','overview','route','streetview']);
22
+ expect(recipes.every(r=>r.executable&&r.source==='markcut'&&r.implementation==='native-markcut')).toBe(true);
23
+ });
24
+ it('compiles every native recipe snippet into the requested map view',()=>{
25
+ for(const recipe of native().recipes){
26
+ const doc=`# video\nwidth:540 height:960 fps:24\n\n${recipe.snippet}`;
27
+ const root=compileDescriptiveRoot(parseMarkdownDescriptive(doc));
28
+ const node=root.children[0]?.children?.[0] as any;
29
+ expect(node?.type,recipe.id).toBe('map');
30
+ expect(node?.view,recipe.id).toBe(recipe.view);
31
+ expect(node?.durationInSeconds,recipe.id).toBe(recipe.durationSeconds);
32
+ }
33
+ });
34
+ it('supports future non-map Markcut recipes without requiring a map view',async()=>{
35
+ const dir=await mkdtemp(join(tmpdir(),'markcut-other-recipe-'));
36
+ try{
37
+ const card={name:'chapter-title-reveal',title:'Chapter title',category:'typography',description:'A title',parameters:[],durationSeconds:2,snippet:'## Title\nlayout:parallel\n- component jsx:<div>Title</div> duration:2'};
38
+ await writeFile(join(dir,'chapter-title-reveal.json'),JSON.stringify(card));
39
+ const catalog=loadRecipeCatalog({markcutDir:dir,shotcraftRoot:null});
40
+ expect(catalog.recipes[0]).toMatchObject({id:'markcut:chapter-title-reveal',category:'typography',executable:true});
41
+ }finally{await rm(dir,{recursive:true,force:true});}
42
+ });
43
+ it('keeps source namespace even if external Shotcraft card shares a bare name',async()=>{
44
+ const dir=await mkdtemp(join(tmpdir(),'shotcraft-card-collision-'));
45
+ try{
46
+ await mkdir(join(dir,'gallery/api'),{recursive:true});
47
+ await writeFile(join(dir,'gallery/api/library.json'),JSON.stringify({cards:[{name:'map-route-journey',summary:'Other implementation',source:'references/shots/map-route-journey.md',styles:[]}]}));
48
+ const catalog=loadRecipeCatalog({shotcraftRoot:dir});
49
+ expect(catalog.recipes.filter(x=>x.name==='map-route-journey')).toHaveLength(2);
50
+ expect(getRecipe(catalog,'markcut:map-route-journey')?.source).toBe('markcut');
51
+ expect(getRecipe(catalog,'shotcraft:map-route-journey')?.source).toBe('shotcraft');
52
+ expect(()=>getRecipe(catalog,'map-route-journey')).toThrow(/Ambiguous/);
53
+ }finally{await rm(dir,{recursive:true,force:true});}
54
+ });
55
+ it('runs offline with external Shotcraft skill missing',()=>{
56
+ const catalog=loadRecipeCatalog({shotcraftRoot:null});
57
+ expect(catalog.sources.shotcraft).toMatchObject({count:0,status:'not-installed'});
58
+ expect(filterRecipes(catalog,{source:'shotcraft'})).toHaveLength(0);
59
+ expect(filterRecipes(catalog,{category:'map'})).toHaveLength(4);
60
+ });
61
+ });
62
+
63
+ describe('installed Shotcraft skill integration',()=>{
64
+ it('discovers the Skill based on home or an explicit environment override',async()=>{
65
+ const home=await mkdtemp(join(tmpdir(),'shotcraft-home-'));
66
+ const skill=join(home,'.agents/skills/video-shotcraft');
67
+ try {
68
+ await mkdir(join(skill,'gallery/api'),{recursive:true});
69
+ await writeFile(join(skill,'gallery/api/library.json'),'{"cards":[]}');
70
+ expect(findShotcraftSkillRoot({home,env:{}})).toBe(skill);
71
+ expect(findShotcraftSkillRoot({home,env:{MARKCUT_SHOTCRAFT_SKILL_DIR:join(home,'missing')}})).toBeNull();
72
+ }finally{await rm(home,{recursive:true,force:true});}
73
+ });
74
+ it('reads external source cards and variants live, does not copy source or execute them',async()=>{
75
+ const dir=await mkdtemp(join(tmpdir(),'shotcraft-live-'));
76
+ try{
77
+ await mkdir(join(dir,'gallery/api'),{recursive:true});
78
+ await mkdir(join(dir,'references/shots/camera'),{recursive:true});
79
+ const card='---\nname: a-camera\n---\n\nTest live guidance';
80
+ await writeFile(join(dir,'references/shots/camera/a-camera.md'),card);
81
+ await writeFile(join(dir,'gallery/api/library.json'),JSON.stringify({cards:[
82
+ {name:'a-camera',summary:'Travel across the view',use:'Show motion',category:'camera',duration:'3s',source:'references/shots/camera/a-camera.md',styles:[{key:'fly',label:'Fly'}]},
83
+ {name:'bad-file',summary:'Unsafe',source:'../escape.md',styles:[]}
84
+ ]}));
85
+ const catalog=loadRecipeCatalog({shotcraftRoot:dir});
86
+ const selected=filterRecipes(catalog,{source:'shotcraft',category:'camera',query:'fly'});
87
+ expect(selected).toHaveLength(1);
88
+ expect(selected[0]).toMatchObject({id:'shotcraft:a-camera',executable:false,implementation:'reference-shot-card',styles:[{key:'fly',label:'Fly'}]});
89
+ expect(readRecipeDetail(selected[0]).guide).toBe(card);
90
+ expect(getRecipe(catalog,'shotcraft:bad-file')?.sourceFile).toBeNull();
91
+ await writeFile(join(dir,'references/shots/camera/a-camera.md'),'Updated on disk');
92
+ expect(readRecipeDetail(selected[0]).guide).toBe('Updated on disk');
93
+ }finally{await rm(dir,{recursive:true,force:true});}
94
+ });
95
+ it('keeps Markcut native recipes available when the installed Shotcraft JSON is invalid',async()=>{
96
+ const dir=await mkdtemp(join(tmpdir(),'shotcraft-corrupt-'));
97
+ try{
98
+ await mkdir(join(dir,'gallery/api'),{recursive:true});
99
+ await writeFile(join(dir,'gallery/api/library.json'),'not-json');
100
+ const catalog=loadRecipeCatalog({shotcraftRoot:dir});
101
+ expect(catalog.sources.shotcraft.status).toBe('unavailable');
102
+ expect(catalog.sources.markcut.count).toBe(4);
103
+ expect(catalog.recipes).toHaveLength(4);
104
+ }finally{await rm(dir,{recursive:true,force:true});}
105
+ });
106
+ it('rejects Shotcraft reference files that are symlinks outside the installed Skill',async()=>{
107
+ const dir=await mkdtemp(join(tmpdir(),'shotcraft-symlink-'));
108
+ const outside=await mkdtemp(join(tmpdir(),'shotcraft-outside-'));
109
+ try{
110
+ await mkdir(join(dir,'gallery/api'),{recursive:true});
111
+ await mkdir(join(dir,'references/shots/camera'),{recursive:true});
112
+ await writeFile(join(outside,'sensitive.md'),'do not read');
113
+ await symlink(join(outside,'sensitive.md'),join(dir,'references/shots/camera/escape.md'));
114
+ await writeFile(join(dir,'gallery/api/library.json'),JSON.stringify({cards:[{name:'escape',source:'references/shots/camera/escape.md'}]}));
115
+ const catalog=loadRecipeCatalog({shotcraftRoot:dir});
116
+ expect(catalog.recipes.at(-1)?.sourceFile).toBeNull();
117
+ }finally{await rm(dir,{recursive:true,force:true});await rm(outside,{recursive:true,force:true});}
118
+ });
119
+ });
120
+
121
+ describe('user-facing recipes CLI',()=>{
122
+ it('provides machine-readable unified catalog with provenance',()=>{
123
+ const result=spawnSync(process.execPath,[cli,'recipes','list','--json'],{encoding:'utf8'});
124
+ expect(result.status,result.stderr).toBe(0);
125
+ const json=JSON.parse(result.stdout);
126
+ expect(json.count).toBe(json.recipes.length);
127
+ expect(json.sources.markcut.count).toBe(4);
128
+ expect(json.recipes.some((r:any)=>r.id==='markcut:map-route-journey')).toBe(true);
129
+ });
130
+ it('provides a real native copyable scene and a readable external reference',()=>{
131
+ const own=spawnSync(process.execPath,[cli,'recipes','show','markcut:map-route-journey'],{encoding:'utf8'});
132
+ expect(own.status).toBe(0);
133
+ expect(own.stdout).toContain('- map view:route');
134
+ expect(own.stdout).toContain('routeAnimation:');
135
+ });
136
+ it('fails clearly for invalid options rather than silently ignoring them',()=>{
137
+ const result=spawnSync(process.execPath,[cli,'recipes','list','--nonsense'],{encoding:'utf8'});
138
+ expect(result.status).toBe(2);
139
+ expect(result.stderr).toContain('Unknown recipes option');
140
+ });
141
+ });
@@ -42,12 +42,12 @@ it('generic --vtt/--itt plus --agent uses the existing STT→semantic segment wo
42
42
  '--vtt-sample-interval','2'];
43
43
  execFileSync(process.execPath,args,{cwd:base,timeout:200000,encoding:'utf8'});
44
44
  const meta=JSON.parse(readFileSync(join(media,'metadata.json'),'utf8'));
45
- expect(meta.photo.perception.desc).toContain('Recognized landscape');
46
- expect(meta.clip.perception.subtitle).toBe('clip.vtt');
47
- expect(meta.clip.perception.desc).toContain('Recognized landscape');
48
- expect(Object.keys(meta.clip.perception.segments)).toEqual(['0to2000','2000to4000']);
49
- expect(meta.clip.perception.segments['0to2000'].vision).toContain('Recognized landscape');
50
- expect(meta.clip.perception.segments['2000to4000'].instructions).toEqual([
45
+ expect(meta['photo.png'].perception.desc).toContain('Recognized landscape');
46
+ expect(meta['clip.mp4'].perception.subtitle).toBe('clip.vtt');
47
+ expect(meta['clip.mp4'].perception.desc).toContain('Recognized landscape');
48
+ expect(Object.keys(meta['clip.mp4'].perception.segments)).toEqual(['0to2000','2000to4000']);
49
+ expect(meta['clip.mp4'].perception.segments['0to2000'].vision).toContain('Recognized landscape');
50
+ expect(meta['clip.mp4'].perception.segments['2000to4000'].instructions).toEqual([
51
51
  {utterance:'嘿 Neo,这里是一个重要镜头',intent:'emphasize later',time_seconds:2.2,confidence:'high'},
52
52
  ]);
53
53
  });
@@ -66,7 +66,7 @@ it('invalid semantic Agent response does not silently fall back to code-selected
66
66
  expect(()=>execFileSync(process.execPath,args,{cwd:base,timeout:90000,stdio:'pipe'}))
67
67
  .toThrow();
68
68
  const meta=JSON.parse(readFileSync(join(other,'metadata.json'),'utf8'));
69
- expect(meta.clip?.perception?.segments).toBeUndefined();
69
+ expect(meta['clip.mp4']?.perception?.segments).toBeUndefined();
70
70
  });
71
71
 
72
72
  it('obsolete provider switch is rejected instead of silently becoming a prompt override',()=>{
@@ -0,0 +1,23 @@
1
+ import { describe,it,expect,afterAll } from 'vitest';
2
+ import {execFileSync} from 'node:child_process';
3
+ import {mkdirSync,mkdtempSync,rmSync,readFileSync,writeFileSync,existsSync} from 'node:fs';
4
+ import {tmpdir} from 'node:os';
5
+ import {join} from 'node:path';
6
+ import {main} from '../src/vision/cli.mjs';
7
+ const folder=mkdtempSync(join(tmpdir(),'markcut-meta-single-'));
8
+ afterAll(()=>rmSync(folder,{recursive:true,force:true}));
9
+ it('filename keys, same-stem sources, normalized paths and preserved durations',async()=>{
10
+ execFileSync('ffmpeg',['-v','error','-y','-f','lavfi','-i','color=c=blue:s=160x90:d=2','-frames:v','1',join(folder,'same.jpg')]);
11
+ execFileSync('ffmpeg',['-v','error','-y','-f','lavfi','-i','testsrc2=s=160x90:r=2:d=62',
12
+ '-c:v','libx264','-preset','ultrafast',join(folder,'same.mp4')]);
13
+ writeFileSync(join(folder,'metadata.json'),JSON.stringify({'same':{perception:{desc:'Older metadata cache'}}}));
14
+ await main(['node','vision','vision',folder,'--normalize-only']);
15
+ const m=JSON.parse(readFileSync(join(folder,'metadata.json'),'utf8'));
16
+ expect(Object.keys(m).sort()).toEqual(['same.jpg','same.mp4']);
17
+ expect(m['same.jpg'].normalized).toMatch(/^\.normalized\/same.jpg_384\.jpg$/);
18
+ expect(m['same.mp4'].normalized).toMatch(/^\.normalized\/same.mp4_full\.mp4$/);
19
+ const output=join(folder,m['same.mp4'].normalized);
20
+ expect(existsSync(output)).toBe(true);
21
+ const duration=Number(execFileSync('ffprobe',['-v','error','-show_entries','format=duration','-of','default=noprint_wrappers=1:nokey=1',output],{encoding:'utf8'}).trim());
22
+ expect(Math.abs(duration-62)).toBeLessThan(.6);
23
+ });