@anvpx/motion-cli 0.1.14 → 0.1.16
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.
|
@@ -4,7 +4,13 @@ type BuiltWord = {
|
|
|
4
4
|
start: number;
|
|
5
5
|
end: number;
|
|
6
6
|
};
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Split a scene into cue chunks of at most CUE_MAX_WORDS, **on clause
|
|
9
|
+
* boundaries first**. A cue that starts mid-clause ("in it is built, one cue at a
|
|
10
|
+
* time.") is the defect this avoids: a blind review of the first 3D film caught
|
|
11
|
+
* exactly that, so the splitter now prefers a sentence end, then a comma near the
|
|
12
|
+
* cap, and only cuts blind when there is no boundary at all.
|
|
13
|
+
*/
|
|
8
14
|
export declare const splitCueWords: (words: readonly BuiltWord[]) => BuiltWord[][];
|
|
9
15
|
export declare const captionsCommand: Command;
|
|
10
16
|
export {};
|
package/dist/captions/command.js
CHANGED
|
@@ -58,17 +58,78 @@ const sceneWords = (row, bound, fallback) => {
|
|
|
58
58
|
};
|
|
59
59
|
/** Cue budget: broadcast captions rarely hold more than this many words. */
|
|
60
60
|
const CUE_MAX_WORDS = 12;
|
|
61
|
-
|
|
61
|
+
const SENTENCE_END = /[.!?…]$/;
|
|
62
|
+
const CLAUSE_END = /[,;:—–]$/;
|
|
63
|
+
/**
|
|
64
|
+
* Split a scene into cue chunks of at most CUE_MAX_WORDS, **on clause
|
|
65
|
+
* boundaries first**. A cue that starts mid-clause ("in it is built, one cue at a
|
|
66
|
+
* time.") is the defect this avoids: a blind review of the first 3D film caught
|
|
67
|
+
* exactly that, so the splitter now prefers a sentence end, then a comma near the
|
|
68
|
+
* cap, and only cuts blind when there is no boundary at all.
|
|
69
|
+
*/
|
|
62
70
|
export const splitCueWords = (words) => {
|
|
63
|
-
if (words.length
|
|
64
|
-
return [[
|
|
65
|
-
|
|
66
|
-
const
|
|
71
|
+
if (words.length === 0)
|
|
72
|
+
return [[]];
|
|
73
|
+
/** @type {BuiltWord[][]} */
|
|
74
|
+
const sentences = [];
|
|
75
|
+
let run = [];
|
|
76
|
+
for (const word of words) {
|
|
77
|
+
run.push(word);
|
|
78
|
+
if (SENTENCE_END.test(word.w)) {
|
|
79
|
+
sentences.push(run);
|
|
80
|
+
run = [];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (run.length > 0)
|
|
84
|
+
sentences.push(run);
|
|
67
85
|
const cues = [];
|
|
68
|
-
for (
|
|
69
|
-
|
|
86
|
+
for (const sentence of sentences) {
|
|
87
|
+
if (sentence.length === 0)
|
|
88
|
+
continue;
|
|
89
|
+
if (sentence.length <= CUE_MAX_WORDS) {
|
|
90
|
+
cues.push(sentence);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
// An over-long sentence keeps the even chunk size it always had, but a clause
|
|
94
|
+
// end within two words of a cut wins: a cue must not start mid-clause for the
|
|
95
|
+
// sake of an exact word count.
|
|
96
|
+
const count = Math.ceil(sentence.length / CUE_MAX_WORDS);
|
|
97
|
+
const size = Math.ceil(sentence.length / count);
|
|
98
|
+
const clauseAt = (index) => {
|
|
99
|
+
const word = sentence[index];
|
|
100
|
+
return word !== undefined && CLAUSE_END.test(word.w);
|
|
101
|
+
};
|
|
102
|
+
let start = 0;
|
|
103
|
+
const MIN_PIECE = 4;
|
|
104
|
+
while (sentence.length - start > CUE_MAX_WORDS) {
|
|
105
|
+
let cut = start + size;
|
|
106
|
+
for (let shift = 0; shift <= 2; shift += 1) {
|
|
107
|
+
const after = start + size - 1 + shift;
|
|
108
|
+
const before = start + size - 1 - shift;
|
|
109
|
+
if (clauseAt(after)) {
|
|
110
|
+
cut = after + 1;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
if (clauseAt(before)) {
|
|
114
|
+
cut = before + 1;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
cut = Math.min(cut, start + CUE_MAX_WORDS);
|
|
119
|
+
// A cut that leaves a stub ("bridge.") is worse than an even split.
|
|
120
|
+
if (sentence.length - cut < MIN_PIECE)
|
|
121
|
+
cut = sentence.length;
|
|
122
|
+
if (cut - start < MIN_PIECE)
|
|
123
|
+
cut = Math.min(sentence.length, start + CUE_MAX_WORDS);
|
|
124
|
+
if (cut <= start)
|
|
125
|
+
cut = start + 1;
|
|
126
|
+
cues.push(sentence.slice(start, cut));
|
|
127
|
+
start = cut;
|
|
128
|
+
}
|
|
129
|
+
if (start < sentence.length)
|
|
130
|
+
cues.push(sentence.slice(start));
|
|
70
131
|
}
|
|
71
|
-
return cues;
|
|
132
|
+
return cues.length === 0 ? [[]] : cues;
|
|
72
133
|
};
|
|
73
134
|
/** One `add /scenes/-` op per caption cue, with a per-scene captioned/omitted report. */
|
|
74
135
|
const planFromManifest = (board, manifest) => {
|
package/dist/plugin/install.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ import type { Command } from "../types.ts";
|
|
|
12
12
|
* at real versions) or choiceB (bundle into one tarball); either lands with
|
|
13
13
|
* a version bump of core manifest + this pin + plugin.json together.
|
|
14
14
|
*/
|
|
15
|
-
export declare const PINNED_CORE_VERSION = "0.1.
|
|
16
|
-
export declare const PINNED_NPX = "npx -y @anvpx/motion@0.1.
|
|
15
|
+
export declare const PINNED_CORE_VERSION = "0.1.16";
|
|
16
|
+
export declare const PINNED_NPX = "npx -y @anvpx/motion@0.1.16";
|
|
17
17
|
/** Skill file whose sha256 must survive `plugin install` byte for byte. */
|
|
18
18
|
export declare const PLUGIN_SKILL: string;
|
|
19
19
|
export interface PluginEnv {
|
package/dist/plugin/install.js
CHANGED
|
@@ -17,7 +17,7 @@ import { EXIT } from "../exit-codes.js";
|
|
|
17
17
|
* at real versions) or choiceB (bundle into one tarball); either lands with
|
|
18
18
|
* a version bump of core manifest + this pin + plugin.json together.
|
|
19
19
|
*/
|
|
20
|
-
export const PINNED_CORE_VERSION = "0.1.
|
|
20
|
+
export const PINNED_CORE_VERSION = "0.1.16";
|
|
21
21
|
export const PINNED_NPX = `npx -y @anvpx/motion@${PINNED_CORE_VERSION}`;
|
|
22
22
|
/** Skill file whose sha256 must survive `plugin install` byte for byte. */
|
|
23
23
|
export const PLUGIN_SKILL = join("skills", "motion-kit", "SKILL.md");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anvpx/motion-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "The mk CLI for @anvpx/motion: validate, preview, approve and render storyboards.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "anvpx",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"dist/**/*.d.ts"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@anvpx/motion-audio": "0.1.
|
|
34
|
-
"@anvpx/motion-build": "0.1.
|
|
35
|
-
"@anvpx/motion-schema": "0.1.
|
|
36
|
-
"@anvpx/motion-templates": "0.1.
|
|
33
|
+
"@anvpx/motion-audio": "0.1.16",
|
|
34
|
+
"@anvpx/motion-build": "0.1.16",
|
|
35
|
+
"@anvpx/motion-schema": "0.1.16",
|
|
36
|
+
"@anvpx/motion-templates": "0.1.16"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"test:integration": "vitest run --config vitest.integration.config.ts"
|