@anvpx/motion-cli 0.1.48 → 0.1.50

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.
@@ -9,12 +9,15 @@ export interface Approval {
9
9
  readonly approvedAt: string;
10
10
  readonly note: string;
11
11
  }
12
+ export type ApprovalScope = "visual" | "audiovisual";
12
13
  export type ApprovalState = {
13
14
  state: "approved";
14
15
  hash: string;
16
+ scope?: ApprovalScope;
15
17
  } | {
16
18
  state: "missing" | "stale";
17
19
  hash: string;
20
+ scope?: ApprovalScope;
18
21
  };
19
22
  /** The stored approval, or undefined when absent, malformed or legacy. */
20
23
  export declare function readApproval(host: Host, storyboard: string): Promise<Approval | undefined>;
@@ -137,5 +137,7 @@ export async function approvalState(host, storyboard, opts = {}) {
137
137
  }
138
138
  if (!isApproval(parsed))
139
139
  return { state: "stale", hash };
140
- return { state: parsed.inputManifestSha256 === hash ? "approved" : "stale", hash };
140
+ // The recorded scope lets a refusal say WHY it differs (silent render, audible approval).
141
+ const scope = parsed.inputManifest.scope === "audiovisual" ? "audiovisual" : "visual";
142
+ return { state: parsed.inputManifestSha256 === hash ? "approved" : "stale", hash, scope };
141
143
  }
@@ -21,6 +21,15 @@ export const VOICE_MANUAL_SETUP = "manual setup only; no auto-install";
21
21
  export const VOICE_NO_PAID_BACKEND = "no paid backend";
22
22
  export const VOICE_ALIGNER = "aligner";
23
23
  const VENV_PYS = [".venv-voice/Scripts/python", ".venv-voice/bin/python"];
24
+ /**
25
+ * The venv pythons to probe, shared venv first. `setup.md` tells a consumer to reuse one
26
+ * 3.12 venv through `MOTION_VOICE_PYTHON` instead of creating one per project, so doctor
27
+ * has to look there before it reports the voice rows missing.
28
+ */
29
+ const venvPys = (env) => {
30
+ const shared = env?.MOTION_VOICE_PYTHON?.trim();
31
+ return shared ? [shared, ...VENV_PYS] : [...VENV_PYS];
32
+ };
24
33
  const ESPEAK_RELEASES = "https://github.com/espeak-ng/espeak-ng/releases";
25
34
  const FFMPEG_VERSION = /version\s+n?(\d+)\.(\d+)(?:\.(\d+))?/;
26
35
  const CHROME_CACHE = [".cache", "hyperframes", "chrome", "chrome-headless-shell"];
@@ -241,8 +250,8 @@ async function pyLauncherState(run) {
241
250
  return "unknown";
242
251
  return "ok";
243
252
  }
244
- async function venvPythonVersion(run) {
245
- for (const cmd of VENV_PYS) {
253
+ async function venvPythonVersion(run, env) {
254
+ for (const cmd of venvPys(env)) {
246
255
  const result = await run(cmd, ["--version"]);
247
256
  if (result.code !== 0)
248
257
  continue;
@@ -250,11 +259,11 @@ async function venvPythonVersion(run) {
250
259
  if (!parsed)
251
260
  continue;
252
261
  const text = formatVersion(parsed);
253
- return { text, usable: !text.startsWith(`${WANTED_PYTHON}.`) };
262
+ return { text, usable: !text.startsWith(`${WANTED_PYTHON}.`), cmd };
254
263
  }
255
264
  return undefined;
256
265
  }
257
- export const checkPythonVenv = async ({ run }) => {
266
+ export const checkPythonVenv = async ({ run, host }) => {
258
267
  const id = "python-venv";
259
268
  const state = await pyLauncherState(run);
260
269
  if (state === "missing") {
@@ -268,7 +277,7 @@ export const checkPythonVenv = async ({ run }) => {
268
277
  if (state === "unknown") {
269
278
  return { id, status: "unknown", required: false, hint: "py -3.12 ran but gave no version" };
270
279
  }
271
- const venv = await venvPythonVersion(run);
280
+ const venv = await venvPythonVersion(run, host.env);
272
281
  if (!venv) {
273
282
  return {
274
283
  id,
@@ -277,8 +286,12 @@ export const checkPythonVenv = async ({ run }) => {
277
286
  hint: "py -3.12 -m venv .venv-voice then .venv-voice\\Scripts\\activate (voice phase only)",
278
287
  };
279
288
  }
280
- if (!venv.usable)
281
- return found(id, venv.text);
289
+ if (!venv.usable) {
290
+ const shared = host.env?.MOTION_VOICE_PYTHON?.trim();
291
+ return shared === venv.cmd
292
+ ? { id, status: "ok", required: false, version: venv.text, hint: `shared venv ${venv.cmd}` }
293
+ : found(id, venv.text);
294
+ }
282
295
  return {
283
296
  id,
284
297
  status: "usable",
@@ -376,11 +389,11 @@ async function kokoroSoundfile(run, cmd, version) {
376
389
  hint: `pip install soundfile==${SOUNDFILE_VERSION} in .venv-voice (.venv-voice\\Scripts\\activate then pip install soundfile==${SOUNDFILE_VERSION}) (voice phase only)`,
377
390
  };
378
391
  }
379
- export const checkKokoro = async ({ run }) => {
392
+ export const checkKokoro = async ({ run, host }) => {
380
393
  const id = "kokoro";
381
394
  const installHint = `activate the venv (.venv-voice\\Scripts\\activate) then pip install kokoro==${KOKORO_VERSION} soundfile==${SOUNDFILE_VERSION} (${VOICE_LOCAL_PRIMARY}; ${VOICE_MANUAL_SETUP}; ${VOICE_NO_PAID_BACKEND}; ${VOICE_WAV_FALLBACK} when env blocked; voice phase only)`;
382
395
  let venvFound = false;
383
- for (const cmd of VENV_PYS) {
396
+ for (const cmd of venvPys(host.env)) {
384
397
  const kok = await pipShowVersion(run, cmd, "kokoro");
385
398
  if ("ok" in kok)
386
399
  return kokoroSoundfile(run, cmd, kok.ok);
@@ -400,11 +413,11 @@ export const checkKokoro = async ({ run }) => {
400
413
  }
401
414
  return { id, status: "missing", required: false, hint: installHint };
402
415
  };
403
- export const checkFasterWhisper = async ({ run }) => {
416
+ export const checkFasterWhisper = async ({ run, host }) => {
404
417
  const id = "faster-whisper";
405
418
  const installHint = `activate the venv (.venv-voice\\Scripts\\activate) then pip install faster-whisper==${FASTER_WHISPER_VERSION} (${VOICE_ALIGNER}; ${VOICE_MANUAL_SETUP}; ${VOICE_NO_PAID_BACKEND}; ${VOICE_WAV_FALLBACK} when env blocked; voice phase only)`;
406
419
  let venvFound = false;
407
- for (const cmd of VENV_PYS) {
420
+ for (const cmd of venvPys(host.env)) {
408
421
  const result = await run(cmd, ["-m", "pip", "show", "faster-whisper"]);
409
422
  if (result.code === 0) {
410
423
  const version = pipVersion(`${result.stdout}\n${result.stderr}`);
@@ -6,14 +6,14 @@ import type { Command } from "../types.ts";
6
6
  * version", which also pins `.claude-plugin/plugin.json`). `0.0.0` is the
7
7
  * pre-publish placeholder: an isolated `npm install` of the packed tarball
8
8
  * rewrites internal `workspace:*` to `0.0.0`, which is private/unpublished,
9
- * so `npx -y @anvpx/motion@0.1.48` 404s in isolation (qualify-pack exits 2
9
+ * so `npx -y @anvpx/motion@0.1.50` 404s in isolation (qualify-pack exits 2
10
10
  * BLOCKED with `unpublishedInternals`). Do NOT unpin or float the range to
11
11
  * work around it. Publish path is choiceA (publish internal @anvpx/motion-*
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.48";
16
- export declare const PINNED_NPX = "npx -y @anvpx/motion@0.1.48";
15
+ export declare const PINNED_CORE_VERSION = "0.1.50";
16
+ export declare const PINNED_NPX = "npx -y @anvpx/motion@0.1.50";
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 {
@@ -11,13 +11,13 @@ import { EXIT } from "../exit-codes.js";
11
11
  * version", which also pins `.claude-plugin/plugin.json`). `0.0.0` is the
12
12
  * pre-publish placeholder: an isolated `npm install` of the packed tarball
13
13
  * rewrites internal `workspace:*` to `0.0.0`, which is private/unpublished,
14
- * so `npx -y @anvpx/motion@0.1.48` 404s in isolation (qualify-pack exits 2
14
+ * so `npx -y @anvpx/motion@0.1.50` 404s in isolation (qualify-pack exits 2
15
15
  * BLOCKED with `unpublishedInternals`). Do NOT unpin or float the range to
16
16
  * work around it. Publish path is choiceA (publish internal @anvpx/motion-*
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.48";
20
+ export const PINNED_CORE_VERSION = "0.1.50";
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");
@@ -21,6 +21,12 @@ export declare function exportArtifact(io: Io, outDir: string, format: Exclude<D
21
21
  readonly ok: false;
22
22
  readonly code: number;
23
23
  }>;
24
+ /**
25
+ * A stale hash often means the render's scope differs from the approved scope, not that the
26
+ * board changed: an approved audiovisual cut rendered without flags, or the reverse. Naming
27
+ * that is the difference between a one-flag fix and a pointless re-preview.
28
+ */
29
+ export declare function scopeMismatch(recorded: "visual" | "audiovisual" | undefined, asked: "visual" | "audiovisual"): string | undefined;
24
30
  /**
25
31
  * ADR-0008 D3: the problems to report for a typed failed delivery. A failure
26
32
  * with an empty list is still a failure, never a silent success.
@@ -337,10 +337,24 @@ async function gatedGate(io, request, audioManifest, musicOpts = {}) {
337
337
  return undefined;
338
338
  const scope = audioManifest === undefined ? "visual" : "audiovisual";
339
339
  const why = state.state === "stale"
340
- ? `the ${scope} inputs (storyboard, themes, referenced assets, ledger${audioManifest === undefined ? "" : ", audio manifest, wavs, mix, bed, volume or license"}) changed since approval`
340
+ ? (scopeMismatch(state.scope, scope) ??
341
+ `the ${scope} inputs (storyboard, themes, referenced assets, ledger${audioManifest === undefined ? "" : ", audio manifest, wavs, mix, bed, volume or license"}) changed since approval`)
341
342
  : "no approval recorded";
342
343
  return awaitingApproval(io, request, audioManifest, state.hash, why, musicOpts);
343
344
  }
345
+ /**
346
+ * A stale hash often means the render's scope differs from the approved scope, not that the
347
+ * board changed: an approved audiovisual cut rendered without flags, or the reverse. Naming
348
+ * that is the difference between a one-flag fix and a pointless re-preview.
349
+ */
350
+ export function scopeMismatch(recorded, asked) {
351
+ if (recorded === undefined || recorded === asked)
352
+ return undefined;
353
+ if (recorded === "audiovisual") {
354
+ return "the approval covers narration and music, but this render has neither: pass the same --audio and --music flags you previewed with, or preview and approve a silent cut";
355
+ }
356
+ return "the approval was recorded for a silent cut, but this render adds audio: preview and approve the audible cut first";
357
+ }
344
358
  /** One AWAITING_APPROVAL line with the fix: preview, show the user, explicit yes, approve. */
345
359
  function awaitingApproval(io, request, audioManifest, hash, why, musicOpts = {}) {
346
360
  const audioFlag = audioManifest === undefined ? "" : ` --audio ${audioManifest}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anvpx/motion-cli",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
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.48",
34
- "@anvpx/motion-build": "0.1.48",
35
- "@anvpx/motion-schema": "0.1.48",
36
- "@anvpx/motion-templates": "0.1.48"
33
+ "@anvpx/motion-audio": "0.1.50",
34
+ "@anvpx/motion-build": "0.1.50",
35
+ "@anvpx/motion-schema": "0.1.50",
36
+ "@anvpx/motion-templates": "0.1.50"
37
37
  },
38
38
  "scripts": {
39
39
  "test:integration": "vitest run --config vitest.integration.config.ts"