@anvpx/motion-cli 0.0.0-stage → 0.1.0

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 (197) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +121 -2
  3. package/dist/analyze/command.d.ts +2 -0
  4. package/dist/analyze/command.js +190 -0
  5. package/dist/approval/approval.d.ts +32 -0
  6. package/dist/approval/approval.js +141 -0
  7. package/dist/approval/command.d.ts +2 -0
  8. package/dist/approval/command.js +255 -0
  9. package/dist/approval/gate.d.ts +7 -0
  10. package/dist/approval/gate.js +23 -0
  11. package/dist/approval/hash.d.ts +71 -0
  12. package/dist/approval/hash.js +451 -0
  13. package/dist/args.d.ts +30 -0
  14. package/dist/args.js +53 -0
  15. package/dist/assets/command.d.ts +2 -0
  16. package/dist/assets/command.js +165 -0
  17. package/dist/captions/command.d.ts +2 -0
  18. package/dist/captions/command.js +341 -0
  19. package/dist/captions/cues.d.ts +10 -0
  20. package/dist/captions/cues.js +61 -0
  21. package/dist/catalog/command.d.ts +2 -0
  22. package/dist/catalog/command.js +60 -0
  23. package/dist/catalog/format.d.ts +13 -0
  24. package/dist/catalog/format.js +54 -0
  25. package/dist/cli.d.ts +3 -0
  26. package/dist/cli.js +35 -0
  27. package/dist/commands.d.ts +3 -0
  28. package/dist/commands.js +59 -0
  29. package/dist/compare/command.d.ts +4 -0
  30. package/dist/compare/command.js +144 -0
  31. package/dist/contact/argv.d.ts +24 -0
  32. package/dist/contact/argv.js +42 -0
  33. package/dist/contact/command.d.ts +2 -0
  34. package/dist/contact/command.js +79 -0
  35. package/dist/doctor/checks.d.ts +25 -0
  36. package/dist/doctor/checks.js +571 -0
  37. package/dist/doctor/command.d.ts +4 -0
  38. package/dist/doctor/command.js +88 -0
  39. package/dist/doctor/format.d.ts +7 -0
  40. package/dist/doctor/format.js +41 -0
  41. package/dist/doctor/heal.d.ts +14 -0
  42. package/dist/doctor/heal.js +71 -0
  43. package/dist/doctor/pins.d.ts +8 -0
  44. package/dist/doctor/pins.js +28 -0
  45. package/dist/doctor/skills.d.ts +15 -0
  46. package/dist/doctor/skills.js +58 -0
  47. package/dist/doctor/types.d.ts +36 -0
  48. package/dist/doctor/types.js +1 -0
  49. package/dist/doctor/vendored.d.ts +15 -0
  50. package/dist/doctor/vendored.js +90 -0
  51. package/dist/doctor/version.d.ts +8 -0
  52. package/dist/doctor/version.js +11 -0
  53. package/dist/exit-codes.d.ts +16 -0
  54. package/dist/exit-codes.js +15 -0
  55. package/dist/fit/command.d.ts +5 -0
  56. package/dist/fit/command.js +154 -0
  57. package/dist/fit/solve.d.ts +21 -0
  58. package/dist/fit/solve.js +80 -0
  59. package/dist/fit/target.d.ts +18 -0
  60. package/dist/fit/target.js +47 -0
  61. package/dist/generate3d/command.d.ts +3 -0
  62. package/dist/generate3d/command.js +38 -0
  63. package/dist/generate3d/run.d.ts +39 -0
  64. package/dist/generate3d/run.js +77 -0
  65. package/dist/icon/command.d.ts +2 -0
  66. package/dist/icon/command.js +113 -0
  67. package/dist/index.d.ts +18 -0
  68. package/dist/index.js +16 -0
  69. package/dist/install-mk.d.ts +31 -0
  70. package/dist/install-mk.js +168 -0
  71. package/dist/integration/preview.integration.d.ts +1 -0
  72. package/dist/integration/preview.integration.js +53 -0
  73. package/dist/integration/smoke.integration.d.ts +1 -0
  74. package/dist/integration/smoke.integration.js +91 -0
  75. package/dist/main.d.ts +2 -0
  76. package/dist/main.js +4 -0
  77. package/dist/node-io.d.ts +14 -0
  78. package/dist/node-io.js +152 -0
  79. package/dist/optimize/command.d.ts +12 -0
  80. package/dist/optimize/command.js +110 -0
  81. package/dist/packs/command.d.ts +2 -0
  82. package/dist/packs/command.js +109 -0
  83. package/dist/patch/apply.d.ts +36 -0
  84. package/dist/patch/apply.js +186 -0
  85. package/dist/patch/command.d.ts +2 -0
  86. package/dist/patch/command.js +92 -0
  87. package/dist/plugin/install.d.ts +40 -0
  88. package/dist/plugin/install.js +170 -0
  89. package/dist/preview/command.d.ts +10 -0
  90. package/dist/preview/command.js +758 -0
  91. package/dist/preview/manifest.d.ts +94 -0
  92. package/dist/preview/manifest.js +19 -0
  93. package/dist/preview/pack.d.ts +24 -0
  94. package/dist/preview/pack.js +53 -0
  95. package/dist/preview/plan.d.ts +58 -0
  96. package/dist/preview/plan.js +160 -0
  97. package/dist/preview/provenance.d.ts +23 -0
  98. package/dist/preview/provenance.js +38 -0
  99. package/dist/publish/command.d.ts +2 -0
  100. package/dist/publish/command.js +70 -0
  101. package/dist/publish/player.d.ts +25 -0
  102. package/dist/publish/player.js +108 -0
  103. package/dist/publish/static.d.ts +16 -0
  104. package/dist/publish/static.js +78 -0
  105. package/dist/qc.d.ts +2 -0
  106. package/dist/qc.js +192 -0
  107. package/dist/scene/author.d.ts +16 -0
  108. package/dist/scene/author.js +260 -0
  109. package/dist/scene/command.d.ts +2 -0
  110. package/dist/scene/command.js +110 -0
  111. package/dist/scene/ops.d.ts +23 -0
  112. package/dist/scene/ops.js +151 -0
  113. package/dist/state/command.d.ts +2 -0
  114. package/dist/state/command.js +128 -0
  115. package/dist/state/evidence.d.ts +71 -0
  116. package/dist/state/evidence.js +243 -0
  117. package/dist/storyboard/check.d.ts +21 -0
  118. package/dist/storyboard/check.js +39 -0
  119. package/dist/storyboard/containment.d.ts +24 -0
  120. package/dist/storyboard/containment.js +43 -0
  121. package/dist/storyboard/custom.d.ts +15 -0
  122. package/dist/storyboard/custom.js +133 -0
  123. package/dist/storyboard/edit.d.ts +19 -0
  124. package/dist/storyboard/edit.js +39 -0
  125. package/dist/storyboard/load.d.ts +11 -0
  126. package/dist/storyboard/load.js +52 -0
  127. package/dist/storyboard/report.d.ts +5 -0
  128. package/dist/storyboard/report.js +8 -0
  129. package/dist/template/coerce.d.ts +6 -0
  130. package/dist/template/coerce.js +44 -0
  131. package/dist/template/command.d.ts +5 -0
  132. package/dist/template/command.js +163 -0
  133. package/dist/template/env.d.ts +34 -0
  134. package/dist/template/env.js +38 -0
  135. package/dist/template/fork.d.ts +8 -0
  136. package/dist/template/fork.js +156 -0
  137. package/dist/template/format.d.ts +21 -0
  138. package/dist/template/format.js +161 -0
  139. package/dist/template/list.d.ts +15 -0
  140. package/dist/template/list.js +116 -0
  141. package/dist/template/new.d.ts +6 -0
  142. package/dist/template/new.js +302 -0
  143. package/dist/testing/env.d.ts +8 -0
  144. package/dist/testing/env.js +19 -0
  145. package/dist/testing/fakes.d.ts +33 -0
  146. package/dist/testing/fakes.js +95 -0
  147. package/dist/testing/fixtures.d.ts +8 -0
  148. package/dist/testing/fixtures.js +6 -0
  149. package/dist/testing/probe.d.ts +15 -0
  150. package/dist/testing/probe.js +20 -0
  151. package/dist/testing/project.d.ts +22 -0
  152. package/dist/testing/project.js +26 -0
  153. package/dist/tooling/session.d.ts +40 -0
  154. package/dist/tooling/session.js +106 -0
  155. package/dist/types.d.ts +59 -0
  156. package/dist/types.js +1 -0
  157. package/dist/verify/audio-loudness.d.ts +46 -0
  158. package/dist/verify/audio-loudness.js +186 -0
  159. package/dist/verify/command.d.ts +2 -0
  160. package/dist/verify/command.js +161 -0
  161. package/dist/verify/determinism.d.ts +30 -0
  162. package/dist/verify/determinism.js +59 -0
  163. package/dist/verify/expectation.d.ts +15 -0
  164. package/dist/verify/expectation.js +19 -0
  165. package/dist/verify/media-events.d.ts +61 -0
  166. package/dist/verify/media-events.js +174 -0
  167. package/dist/verify/platform.d.ts +33 -0
  168. package/dist/verify/platform.js +59 -0
  169. package/dist/verify/probe.d.ts +14 -0
  170. package/dist/verify/probe.js +23 -0
  171. package/dist/verify/report.d.ts +15 -0
  172. package/dist/verify/report.js +45 -0
  173. package/dist/verify/run.d.ts +27 -0
  174. package/dist/verify/run.js +53 -0
  175. package/dist/voice/command.d.ts +3 -0
  176. package/dist/voice/command.js +49 -0
  177. package/dist/voice/manifest.d.ts +33 -0
  178. package/dist/voice/manifest.js +69 -0
  179. package/dist/voice/run.d.ts +21 -0
  180. package/dist/voice/run.js +181 -0
  181. package/dist/workflow/build.d.ts +2 -0
  182. package/dist/workflow/build.js +25 -0
  183. package/dist/workflow/draft.d.ts +9 -0
  184. package/dist/workflow/draft.js +201 -0
  185. package/dist/workflow/finish.d.ts +23 -0
  186. package/dist/workflow/finish.js +28 -0
  187. package/dist/workflow/project.d.ts +73 -0
  188. package/dist/workflow/project.js +198 -0
  189. package/dist/workflow/provenance.d.ts +18 -0
  190. package/dist/workflow/provenance.js +36 -0
  191. package/dist/workflow/render.d.ts +31 -0
  192. package/dist/workflow/render.js +705 -0
  193. package/dist/workflow/still.d.ts +5 -0
  194. package/dist/workflow/still.js +62 -0
  195. package/dist/workflow/validate.d.ts +2 -0
  196. package/dist/workflow/validate.js +49 -0
  197. package/package.json +38 -3
@@ -0,0 +1,5 @@
1
+ import type { Command } from "../types.ts";
2
+ export declare const STILLS_DIR = "stills";
3
+ /** The `hyperframes snapshot` argv for one `--at` timestamp; shared by every command that captures a still. */
4
+ export declare const stillSnapshotArgs: (at: string) => readonly string[];
5
+ export declare const stillCommand: Command;
@@ -0,0 +1,62 @@
1
+ import { join } from "node:path";
2
+ import { textFlag, usageError } from "../args.js";
3
+ import { EXIT } from "../exit-codes.js";
4
+ import { runInProject } from "../tooling/session.js";
5
+ import { parseBuildArgs, prepareProject } from "./project.js";
6
+ const USAGE = `mk still <storyboard.json> (--at 1,5,9 | --review) [--out <dir>] [--assets <dir>] [--ledger <assets.json>]
7
+
8
+ Build, then capture PNGs with \`hyperframes snapshot\`.
9
+ --at: one PNG per timestamp (seconds) with \`--no-end\`.
10
+ --review: the upstream review set instead (scene starts, middles, cut
11
+ seams plus phone-width beats); use either --at or --review, not both.
12
+ PNGs go to <out>/stills; the paths are printed. Output of hyperframes: <out>/render-log.txt.
13
+ `;
14
+ export const STILLS_DIR = "stills";
15
+ const TIMES = /^\d+(\.\d+)?(,\d+(\.\d+)?)*$/;
16
+ /** The `hyperframes snapshot` argv for one `--at` timestamp; shared by every command that captures a still. */
17
+ export const stillSnapshotArgs = (at) => [
18
+ "snapshot",
19
+ ".",
20
+ "--at",
21
+ at,
22
+ "--no-end",
23
+ "-o",
24
+ STILLS_DIR,
25
+ ];
26
+ async function printStills(dir, io) {
27
+ const names = await io.host.listDir(dir).catch(() => []);
28
+ const shots = names.filter((name) => /\.(png|jpg|jpeg)$/.test(name)).sort();
29
+ if (shots.length === 0) {
30
+ io.stderr(`mk: no stills were written to ${dir}\n`);
31
+ return EXIT.ERROR;
32
+ }
33
+ io.stdout(shots.map((name) => `${join(dir, name)}\n`).join(""));
34
+ return EXIT.OK;
35
+ }
36
+ export const stillCommand = {
37
+ name: "still",
38
+ summary: "build, then capture PNG stills at --at timestamps or --review the upstream set",
39
+ async run(args, io) {
40
+ const parsed = parseBuildArgs("still", USAGE, args, { at: { type: "string" }, review: { type: "boolean" } }, io);
41
+ if (parsed.kind === "exit")
42
+ return parsed.code;
43
+ const at = textFlag(parsed.flags, "at");
44
+ const review = parsed.flags.review === true;
45
+ if (review && at !== undefined) {
46
+ return usageError("still", USAGE, "use either --at or --review, not both", io).code;
47
+ }
48
+ if (!review && (at === undefined || !TIMES.test(at))) {
49
+ return usageError("still", USAGE, "--at needs seconds like 1,5,9", io).code;
50
+ }
51
+ const prepared = await prepareProject(parsed.request, io);
52
+ if (!prepared.ok)
53
+ return prepared.code;
54
+ const snapArgs = review
55
+ ? ["snapshot", ".", "--review", "-o", STILLS_DIR]
56
+ : stillSnapshotArgs(at);
57
+ const code = await runInProject(io, prepared.outDir, async (session) => {
58
+ await session.hf([...snapArgs]);
59
+ });
60
+ return code === 0 ? printStills(join(prepared.outDir, STILLS_DIR), io) : code;
61
+ },
62
+ };
@@ -0,0 +1,2 @@
1
+ import type { Command } from "../types.ts";
2
+ export declare const validateCommand: Command;
@@ -0,0 +1,49 @@
1
+ import { parseFlags, requireStoryboard } from "../args.js";
2
+ import { EXIT } from "../exit-codes.js";
3
+ import { checkStoryboard, rootError } from "../storyboard/check.js";
4
+ import { readCustomScenes } from "../storyboard/custom.js";
5
+ import { readJsonFile } from "../storyboard/load.js";
6
+ import { formatFindings, summaryLine } from "../storyboard/report.js";
7
+ import { platformLookup } from "../verify/platform.js";
8
+ const USAGE = `mk validate <storyboard.json> [--json]
9
+
10
+ Validate a storyboard: schema, scene props, timing and lint.
11
+ Exit 0 when there are no errors (warnings allowed); 2 on validation errors, bad usage or unreadable files.
12
+ --json one JSON document {ok, errors, warnings}
13
+ `;
14
+ const printText = (report, io) => {
15
+ io.stdout(formatFindings([...report.errors, ...report.warnings]));
16
+ io.stdout(summaryLine(report.errors.length, report.warnings.length));
17
+ };
18
+ const printJson = (report, io) => {
19
+ const { errors, warnings } = report;
20
+ io.stdout(`${JSON.stringify({ ok: errors.length === 0, errors, warnings }, null, 2)}\n`);
21
+ };
22
+ export const validateCommand = {
23
+ name: "validate",
24
+ summary: "check a storyboard: schema, scene props, timing, lint",
25
+ async run(args, io) {
26
+ const parsed = parseFlags("validate", USAGE, args, { json: { type: "boolean" } }, io);
27
+ if (parsed.kind === "exit")
28
+ return parsed.code;
29
+ const path = requireStoryboard("validate", USAGE, parsed.positionals, io);
30
+ if (typeof path !== "string")
31
+ return path.code;
32
+ const loaded = await readJsonFile(path, io.host);
33
+ if (!loaded.ok && loaded.kind === "io") {
34
+ io.stderr(`mk validate: ${loaded.message}\n`);
35
+ return EXIT.USAGE;
36
+ }
37
+ const report = loaded.ok
38
+ ? checkStoryboard(loaded.value, { platforms: await platformLookup(io.host) })
39
+ : { errors: [rootError(loaded.message)], warnings: [] };
40
+ if (loaded.ok && report.errors.length === 0) {
41
+ const custom = await readCustomScenes(loaded.value, path, io.host);
42
+ for (const finding of custom.findings) {
43
+ (finding.severity === "error" ? report.errors : report.warnings).push(finding);
44
+ }
45
+ }
46
+ (parsed.flags.json ? printJson : printText)(report, io);
47
+ return report.errors.length === 0 ? EXIT.OK : EXIT.USAGE;
48
+ },
49
+ };
package/package.json CHANGED
@@ -1,6 +1,41 @@
1
1
  {
2
2
  "name": "@anvpx/motion-cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "The mk CLI for @anvpx/motion: validate, preview, approve and render storyboards.",
5
+ "license": "MIT",
6
+ "author": "anvpx",
7
+ "type": "module",
8
+ "engines": {
9
+ "node": ">=22"
10
+ },
11
+ "keywords": [
12
+ "motion-kit",
13
+ "cli",
14
+ "video",
15
+ "storyboard",
16
+ "animation"
17
+ ],
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "bin": {
22
+ "mk": "./dist/main.js"
23
+ },
24
+ "exports": {
25
+ ".": "./dist/index.js",
26
+ "./package.json": "./package.json"
27
+ },
28
+ "files": [
29
+ "dist/**/*.js",
30
+ "dist/**/*.d.ts"
31
+ ],
32
+ "dependencies": {
33
+ "@anvpx/motion-audio": "0.1.0",
34
+ "@anvpx/motion-build": "0.1.0",
35
+ "@anvpx/motion-schema": "0.1.0",
36
+ "@anvpx/motion-templates": "0.1.0"
37
+ },
38
+ "scripts": {
39
+ "test:integration": "vitest run --config vitest.integration.config.ts"
40
+ }
6
41
  }