@anvpx/motion-cli 0.1.54 → 0.1.56

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.
@@ -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.54` 404s in isolation (qualify-pack exits 2
9
+ * so `npx -y @anvpx/motion@0.1.56` 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.54";
16
- export declare const PINNED_NPX = "npx -y @anvpx/motion@0.1.54";
15
+ export declare const PINNED_CORE_VERSION = "0.1.56";
16
+ export declare const PINNED_NPX = "npx -y @anvpx/motion@0.1.56";
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.54` 404s in isolation (qualify-pack exits 2
14
+ * so `npx -y @anvpx/motion@0.1.56` 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.54";
20
+ export const PINNED_CORE_VERSION = "0.1.56";
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");
@@ -6,6 +6,8 @@ export interface SceneInfo {
6
6
  weight: number;
7
7
  start: number;
8
8
  duration: number;
9
+ /** Missed overlay candidate: shown only when a base slot is free, so every base scene keeps its review still. */
10
+ overlay?: boolean;
9
11
  }
10
12
  export interface StillPick {
11
13
  id: string;
@@ -21,7 +23,8 @@ export declare const SETTLED = 0.7;
21
23
  export declare const DARK_COUNT = 3;
22
24
  /**
23
25
  * Which scenes to show, as ascending indices: first, last, each distinct `type` once (the instance
24
- * with the most props), then an even spread. Pure and deterministic.
26
+ * with the most props), then an even spread. Missed overlays fill leftover slots only, so every
27
+ * base scene keeps its review still. Pure and deterministic.
25
28
  */
26
29
  export declare function pickScenes(scenes: readonly SceneInfo[], count: number): number[];
27
30
  /** Time of each pick: 70% into its scene. */
@@ -21,9 +21,25 @@ function bisect(picked) {
21
21
  return Math.floor(((sorted[best] ?? 0) + (sorted[best + 1] ?? 0)) / 2);
22
22
  }
23
23
  const weightOf = (scenes, index) => scenes[index]?.weight ?? 0;
24
+ /**
25
+ * Type coverage order: types seen on base scenes first (timeline order), then
26
+ * overlay-only types. Overlays fill leftover slots; they never starve a base
27
+ * scene of its review still.
28
+ */
29
+ const baseFirstTypes = (scenes) => {
30
+ const base = new Set();
31
+ const over = new Set();
32
+ for (const s of scenes)
33
+ (s.overlay === true ? over : base).add(s.type);
34
+ for (const t of over)
35
+ if (!base.has(t))
36
+ base.add(t);
37
+ return [...base];
38
+ };
24
39
  /**
25
40
  * Which scenes to show, as ascending indices: first, last, each distinct `type` once (the instance
26
- * with the most props), then an even spread. Pure and deterministic.
41
+ * with the most props), then an even spread. Missed overlays fill leftover slots only, so every
42
+ * base scene keeps its review still. Pure and deterministic.
27
43
  */
28
44
  export function pickScenes(scenes, count) {
29
45
  const n = scenes.length;
@@ -31,20 +47,48 @@ export function pickScenes(scenes, count) {
31
47
  return [];
32
48
  if (count >= n)
33
49
  return scenes.map((_, i) => i);
34
- const picked = new Set([0]);
35
- const add = (index) => {
36
- if (picked.size < count)
37
- picked.add(index);
50
+ const picked = new Set();
51
+ const bases = scenes.flatMap((s, i) => (s.overlay === true ? [] : [i]));
52
+ const run = (pool) => {
53
+ if (pool.length === 0)
54
+ return;
55
+ const add = (index) => {
56
+ if (picked.size < count)
57
+ picked.add(index);
58
+ };
59
+ add(pool[0]);
60
+ const last = pool[pool.length - 1];
61
+ if (last !== pool[0] && !picked.has(last))
62
+ add(last);
63
+ for (const type of baseFirstTypes(pool.map((i) => scenes[i]))) {
64
+ const same = pool.filter((i) => scenes[i]?.type === type);
65
+ if (same.some((i) => picked.has(i)))
66
+ continue;
67
+ add(same.reduce((a, b) => (weightOf(scenes, b) ?? 0) > (weightOf(scenes, a) ?? 0) ? b : a));
68
+ }
69
+ const sub = () => new Set(pool.filter((i) => picked.has(i)));
70
+ let guard = pool.length + 2;
71
+ while (picked.size < count && sub().size < pool.length && guard-- > 0) {
72
+ const next = bisect(sub());
73
+ if (!pool.includes(next) || picked.has(next)) {
74
+ const open = pool.find((i) => !picked.has(i));
75
+ if (open === undefined)
76
+ break;
77
+ picked.add(open);
78
+ }
79
+ else {
80
+ picked.add(next);
81
+ }
82
+ }
38
83
  };
39
- add(n - 1);
40
- for (const type of new Set(scenes.map((s) => s.type))) {
41
- const same = scenes.flatMap((s, i) => (s.type === type ? [i] : []));
42
- if (same.some((i) => picked.has(i)))
43
- continue;
44
- add(same.reduce((a, b) => (weightOf(scenes, b) > weightOf(scenes, a) ? b : a)));
84
+ run(bases);
85
+ if (picked.size < count) {
86
+ for (const i of scenes.flatMap((s, j) => (s.overlay === true ? [j] : []))) {
87
+ if (picked.size >= count)
88
+ break;
89
+ picked.add(i);
90
+ }
45
91
  }
46
- while (picked.size < count)
47
- picked.add(bisect(picked));
48
92
  return [...picked].sort((a, b) => a - b);
49
93
  }
50
94
  /** Time of each pick: 70% into its scene. */
@@ -110,6 +154,7 @@ export function stillCandidates(board) {
110
154
  weight: JSON.stringify(entry?.props ?? {}).length,
111
155
  start: o.start,
112
156
  duration: o.duration,
157
+ overlay: true,
113
158
  },
114
159
  ];
115
160
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anvpx/motion-cli",
3
- "version": "0.1.54",
3
+ "version": "0.1.56",
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.54",
34
- "@anvpx/motion-build": "0.1.54",
35
- "@anvpx/motion-schema": "0.1.54",
36
- "@anvpx/motion-templates": "0.1.54"
33
+ "@anvpx/motion-audio": "0.1.56",
34
+ "@anvpx/motion-build": "0.1.56",
35
+ "@anvpx/motion-schema": "0.1.56",
36
+ "@anvpx/motion-templates": "0.1.56"
37
37
  },
38
38
  "scripts": {
39
39
  "test:integration": "vitest run --config vitest.integration.config.ts"