automovie 0.1.0 → 0.3.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 (160) hide show
  1. package/README.md +28 -16
  2. package/lib/AUTOMOVIE_CAPTURE_OPTIONS.d.ts +6 -0
  3. package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js +16 -0
  4. package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js.map +1 -0
  5. package/lib/AUTOMOVIE_INSPECT_OPTIONS.d.ts +6 -0
  6. package/lib/AUTOMOVIE_INSPECT_OPTIONS.js +14 -0
  7. package/lib/AUTOMOVIE_INSPECT_OPTIONS.js.map +1 -0
  8. package/lib/AUTOMOVIE_RENDER_OPTIONS.d.ts +6 -0
  9. package/lib/AUTOMOVIE_RENDER_OPTIONS.js +15 -0
  10. package/lib/AUTOMOVIE_RENDER_OPTIONS.js.map +1 -0
  11. package/lib/AUTOMOVIE_REVIEW_OPTIONS.d.ts +6 -0
  12. package/lib/AUTOMOVIE_REVIEW_OPTIONS.js +14 -0
  13. package/lib/AUTOMOVIE_REVIEW_OPTIONS.js.map +1 -0
  14. package/lib/AutoMovieCaptureBackend.d.ts +9 -0
  15. package/lib/{IAutoMoviePackageManager.js → AutoMovieCaptureBackend.js} +1 -1
  16. package/lib/AutoMovieCaptureBackend.js.map +1 -0
  17. package/lib/AutoMovieCaptureHost.d.ts +115 -0
  18. package/lib/AutoMovieCaptureHost.js +234 -0
  19. package/lib/AutoMovieCaptureHost.js.map +1 -0
  20. package/lib/AutoMovieCommand.d.ts +24 -13
  21. package/lib/IAutoMovieChromium.d.ts +84 -0
  22. package/lib/IAutoMovieChromium.js +3 -0
  23. package/lib/IAutoMovieChromium.js.map +1 -0
  24. package/lib/captureAutoMovie.d.ts +23 -0
  25. package/lib/captureAutoMovie.js +133 -0
  26. package/lib/captureAutoMovie.js.map +1 -0
  27. package/lib/deriveAutoMovieProjectName.d.ts +1 -1
  28. package/lib/deriveAutoMovieProjectName.js +1 -1
  29. package/lib/findAutoMovieFreePort.d.ts +14 -0
  30. package/lib/findAutoMovieFreePort.js +61 -0
  31. package/lib/findAutoMovieFreePort.js.map +1 -0
  32. package/lib/formatAutoMovieInspectUrl.d.ts +14 -0
  33. package/lib/formatAutoMovieInspectUrl.js +24 -0
  34. package/lib/formatAutoMovieInspectUrl.js.map +1 -0
  35. package/lib/index.d.ts +30 -2
  36. package/lib/index.js +30 -2
  37. package/lib/index.js.map +1 -1
  38. package/lib/inspectAutoMovie.d.ts +19 -0
  39. package/lib/inspectAutoMovie.js +97 -0
  40. package/lib/inspectAutoMovie.js.map +1 -0
  41. package/lib/launchAutoMovieChromium.d.ts +28 -0
  42. package/lib/launchAutoMovieChromium.js +42 -0
  43. package/lib/launchAutoMovieChromium.js.map +1 -0
  44. package/lib/loadAutoMovieProductionModule.d.ts +14 -0
  45. package/lib/loadAutoMovieProductionModule.js +61 -0
  46. package/lib/loadAutoMovieProductionModule.js.map +1 -0
  47. package/lib/planAutoMovieChromiumLaunch.d.ts +27 -0
  48. package/lib/planAutoMovieChromiumLaunch.js +34 -0
  49. package/lib/planAutoMovieChromiumLaunch.js.map +1 -0
  50. package/lib/planAutoMovieModulePageViteConfig.d.ts +37 -0
  51. package/lib/planAutoMovieModulePageViteConfig.js +27 -0
  52. package/lib/planAutoMovieModulePageViteConfig.js.map +1 -0
  53. package/lib/readAutoMovieAddArguments.d.ts +1 -1
  54. package/lib/readAutoMovieAddArguments.js +1 -1
  55. package/lib/readAutoMovieCaptureHostOptions.d.ts +36 -0
  56. package/lib/readAutoMovieCaptureHostOptions.js +57 -0
  57. package/lib/readAutoMovieCaptureHostOptions.js.map +1 -0
  58. package/lib/readAutoMovieCommandArguments.d.ts +1 -1
  59. package/lib/readAutoMovieCommandArguments.js +10 -5
  60. package/lib/readAutoMovieCommandArguments.js.map +1 -1
  61. package/lib/readAutoMovieCreateArguments.d.ts +1 -1
  62. package/lib/readAutoMovieCreateArguments.js +1 -1
  63. package/lib/readAutoMovieInspectHostOptions.d.ts +29 -0
  64. package/lib/readAutoMovieInspectHostOptions.js +48 -0
  65. package/lib/readAutoMovieInspectHostOptions.js.map +1 -0
  66. package/lib/readAutoMovieRenderOptions.d.ts +33 -0
  67. package/lib/readAutoMovieRenderOptions.js +51 -0
  68. package/lib/readAutoMovieRenderOptions.js.map +1 -0
  69. package/lib/readAutoMovieReviewOptions.d.ts +27 -0
  70. package/lib/readAutoMovieReviewOptions.js +54 -0
  71. package/lib/readAutoMovieReviewOptions.js.map +1 -0
  72. package/lib/readAutoMovieRevision.d.ts +12 -0
  73. package/lib/readAutoMovieRevision.js +32 -0
  74. package/lib/readAutoMovieRevision.js.map +1 -0
  75. package/lib/readAutoMovieVideoProbe.d.ts +23 -0
  76. package/lib/readAutoMovieVideoProbe.js +39 -0
  77. package/lib/readAutoMovieVideoProbe.js.map +1 -0
  78. package/lib/recordAutoMoviePlayback.d.ts +37 -0
  79. package/lib/recordAutoMoviePlayback.js +131 -0
  80. package/lib/recordAutoMoviePlayback.js.map +1 -0
  81. package/lib/renderAutoMovie.d.ts +21 -0
  82. package/lib/renderAutoMovie.js +95 -0
  83. package/lib/renderAutoMovie.js.map +1 -0
  84. package/lib/renderAutoMovieScaffoldNextSteps.d.ts +3 -5
  85. package/lib/renderAutoMovieScaffoldNextSteps.js +5 -14
  86. package/lib/renderAutoMovieScaffoldNextSteps.js.map +1 -1
  87. package/lib/renderAutoMovieVideo.d.ts +35 -0
  88. package/lib/renderAutoMovieVideo.js +110 -0
  89. package/lib/renderAutoMovieVideo.js.map +1 -0
  90. package/lib/resolveAutoMovieFfmpeg.d.ts +19 -0
  91. package/lib/resolveAutoMovieFfmpeg.js +32 -0
  92. package/lib/resolveAutoMovieFfmpeg.js.map +1 -0
  93. package/lib/reviewAutoMovie.d.ts +21 -0
  94. package/lib/reviewAutoMovie.js +71 -0
  95. package/lib/reviewAutoMovie.js.map +1 -0
  96. package/lib/run.d.ts +14 -11
  97. package/lib/run.js +139 -67
  98. package/lib/run.js.map +1 -1
  99. package/lib/runAutoMovieFfmpeg.d.ts +14 -0
  100. package/lib/runAutoMovieFfmpeg.js +40 -0
  101. package/lib/runAutoMovieFfmpeg.js.map +1 -0
  102. package/lib/serveAutoMovieDrawPage.d.ts +28 -0
  103. package/lib/serveAutoMovieDrawPage.js +108 -0
  104. package/lib/serveAutoMovieDrawPage.js.map +1 -0
  105. package/lib/serveAutoMovieInspectorPage.d.ts +32 -0
  106. package/lib/serveAutoMovieInspectorPage.js +52 -0
  107. package/lib/serveAutoMovieInspectorPage.js.map +1 -0
  108. package/lib/writeAutoMovieModulePage.d.ts +38 -0
  109. package/lib/writeAutoMovieModulePage.js +75 -0
  110. package/lib/writeAutoMovieModulePage.js.map +1 -0
  111. package/package.json +26 -5
  112. package/src/AUTOMOVIE_CAPTURE_OPTIONS.ts +12 -0
  113. package/src/AUTOMOVIE_INSPECT_OPTIONS.ts +10 -0
  114. package/src/AUTOMOVIE_RENDER_OPTIONS.ts +11 -0
  115. package/src/AUTOMOVIE_REVIEW_OPTIONS.ts +10 -0
  116. package/src/AutoMovieCaptureBackend.ts +9 -0
  117. package/src/AutoMovieCaptureHost.ts +276 -0
  118. package/src/AutoMovieCommand.ts +28 -13
  119. package/src/IAutoMovieChromium.ts +89 -0
  120. package/src/captureAutoMovie.ts +150 -0
  121. package/src/deriveAutoMovieProjectName.ts +1 -1
  122. package/src/findAutoMovieFreePort.ts +27 -0
  123. package/src/formatAutoMovieInspectUrl.ts +25 -0
  124. package/src/index.ts +30 -2
  125. package/src/inspectAutoMovie.ts +82 -0
  126. package/src/launchAutoMovieChromium.ts +61 -0
  127. package/src/loadAutoMovieProductionModule.ts +30 -0
  128. package/src/planAutoMovieChromiumLaunch.ts +45 -0
  129. package/src/planAutoMovieModulePageViteConfig.ts +53 -0
  130. package/src/readAutoMovieAddArguments.ts +1 -1
  131. package/src/readAutoMovieCaptureHostOptions.ts +76 -0
  132. package/src/readAutoMovieCommandArguments.ts +6 -4
  133. package/src/readAutoMovieCreateArguments.ts +1 -1
  134. package/src/readAutoMovieInspectHostOptions.ts +66 -0
  135. package/src/readAutoMovieRenderOptions.ts +67 -0
  136. package/src/readAutoMovieReviewOptions.ts +70 -0
  137. package/src/readAutoMovieRevision.ts +29 -0
  138. package/src/readAutoMovieVideoProbe.ts +55 -0
  139. package/src/recordAutoMoviePlayback.ts +182 -0
  140. package/src/renderAutoMovie.ts +87 -0
  141. package/src/renderAutoMovieScaffoldNextSteps.ts +4 -18
  142. package/src/renderAutoMovieVideo.ts +127 -0
  143. package/src/resolveAutoMovieFfmpeg.ts +33 -0
  144. package/src/reviewAutoMovie.ts +65 -0
  145. package/src/run.ts +154 -105
  146. package/src/runAutoMovieFfmpeg.ts +50 -0
  147. package/src/serveAutoMovieDrawPage.ts +105 -0
  148. package/src/serveAutoMovieInspectorPage.ts +82 -0
  149. package/src/writeAutoMovieModulePage.ts +83 -0
  150. package/lib/IAutoMoviePackageManager.d.ts +0 -14
  151. package/lib/IAutoMoviePackageManager.js.map +0 -1
  152. package/lib/readAutoMovieSyncArguments.d.ts +0 -13
  153. package/lib/readAutoMovieSyncArguments.js +0 -49
  154. package/lib/readAutoMovieSyncArguments.js.map +0 -1
  155. package/lib/selectAutoMoviePackageManager.d.ts +0 -23
  156. package/lib/selectAutoMoviePackageManager.js +0 -70
  157. package/lib/selectAutoMoviePackageManager.js.map +0 -1
  158. package/src/IAutoMoviePackageManager.ts +0 -15
  159. package/src/readAutoMovieSyncArguments.ts +0 -48
  160. package/src/selectAutoMoviePackageManager.ts +0 -45
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.renderAutoMovie = renderAutoMovie;
37
+ const fs = __importStar(require("node:fs/promises"));
38
+ const path = __importStar(require("node:path"));
39
+ const AutoMovieCaptureHost_1 = require("./AutoMovieCaptureHost");
40
+ const loadAutoMovieProductionModule_1 = require("./loadAutoMovieProductionModule");
41
+ const readAutoMovieRenderOptions_1 = require("./readAutoMovieRenderOptions");
42
+ const renderAutoMovieVideo_1 = require("./renderAutoMovieVideo");
43
+ const resolveAutoMovieFfmpeg_1 = require("./resolveAutoMovieFfmpeg");
44
+ /**
45
+ * Run `automovie render` in a production: draw one subject of a module's draw page frame by frame in headless Chromium and encode it into one video, resolving to the exit status.
46
+ *
47
+ * Options are read by `readAutoMovieCaptureArguments` and split by `readAutoMovieRenderOptions`; the rest is the request, of which a render takes only `subject`, read by `parseAutoMovieCapturePlanRequest` as `capture` reads it, and any other key is refused. A `--props` file is read as JSON before anything starts. FFmpeg is resolved before the page is built, so a missing encoder costs no drawing. The work is `renderAutoMovieVideo` through one `AutoMovieCaptureHost`, closed on every outcome. It prints the video, the report and the frame count, and resolves to 0; a refusal throws to `run`, which prints it.
48
+ *
49
+ * @evidence contracts/development/common.md#meaningful-documentation States how options are read, the order of the checks, what does the work, what is printed and the status.
50
+ * @evidence contracts/development/implementation.md#principled-implementation Every rule is the render package's or `renderAutoMovieVideo`'s; the command loads the production's packages and reports.
51
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Read, resolve FFmpeg, open the host, render, report.
52
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts An unknown option and a request key a render cannot honour are refused, and FFmpeg's absence fails before any drawing.
53
+ * @evidence contracts/development/implementation.md#efficient-algorithms One page build, one browser and one encode.
54
+ * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work One render per command.
55
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The host is closed on every outcome.
56
+ */
57
+ async function renderAutoMovie(props) {
58
+ const { root } = props;
59
+ const render = (0, loadAutoMovieProductionModule_1.loadAutoMovieProductionModule)(root, "@automovie/render");
60
+ const options = (0, readAutoMovieRenderOptions_1.readAutoMovieRenderOptions)(render.readAutoMovieCaptureArguments(props.args));
61
+ // The request names the subject; a render draws its whole clock through its own camera, so no other key applies.
62
+ const request = render.parseAutoMovieCapturePlanRequest(options.request);
63
+ for (const key of options.request.keys())
64
+ if (key !== "subject")
65
+ throw new Error(`Render draws a subject's whole clock through its own camera; the request key --${key} does not apply, only --subject`);
66
+ const data = options.props === null
67
+ ? null
68
+ : JSON.parse(await fs.readFile(path.resolve(root, options.props), "utf8"));
69
+ const ffmpeg = (0, resolveAutoMovieFfmpeg_1.resolveAutoMovieFfmpeg)({
70
+ env: props.env,
71
+ load: (id) => (0, loadAutoMovieProductionModule_1.loadAutoMovieProductionModule)(root, id),
72
+ });
73
+ const host = await AutoMovieCaptureHost_1.AutoMovieCaptureHost.open({
74
+ root,
75
+ module: options.module,
76
+ backend: options.backend,
77
+ env: props.env,
78
+ });
79
+ try {
80
+ const written = await (0, renderAutoMovieVideo_1.renderAutoMovieVideo)({
81
+ host,
82
+ root,
83
+ subject: request.subject,
84
+ props: data,
85
+ ...(options.out === null ? {} : { out: options.out }),
86
+ ffmpeg,
87
+ });
88
+ process.stdout.write(`render: ${written.frames} frames into ${written.video}\nbackend ${host.backend}\n${written.report}\n`);
89
+ return 0;
90
+ }
91
+ finally {
92
+ await host.close();
93
+ }
94
+ }
95
+ //# sourceMappingURL=renderAutoMovie.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderAutoMovie.js","sourceRoot":"","sources":["../src/renderAutoMovie.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAY,EAAE,6CAAyB;AACvC,MAAY,IAAI,sCAAkB;AAElC,iEAA8D;AAC9D,mFAAgF;AAChF,6EAA0E;AAC1E,iEAA8D;AAC9D,qEAAkE;AAElE;;;;;;;;;;;;GAYG;AACI,KAAK,0BAA0B,KASrC;IACC,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACvB,MAAM,MAAM,GAAkB,IAAA,6DAA6B,EACzD,IAAI,EACJ,mBAAmB,CACH,CAAC;IACnB,MAAM,OAAO,GACX,IAAA,uDAA0B,EACxB,MAAM,CAAC,6BAA6B,CAAC,KAAK,CAAC,IAAI,CAAC,CACjD,CAAC;IAEJ,iHAAiH;IACjH,MAAM,OAAO,GACX,MAAM,CAAC,gCAAgC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3D,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE;QACtC,IAAI,GAAG,KAAK,SAAS;YACnB,MAAM,IAAI,KAAK,CACb,kFAAkF,GAAG,iCAAiC,CACvH,CAAC;IACN,MAAM,IAAI,GACR,OAAO,CAAC,KAAK,KAAK,IAAI;QACpB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,IAAI,CAAC,KAAK,CACR,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAC7D,CAAC;IACR,MAAM,MAAM,GAAW,IAAA,+CAAsB,EAAC;QAC5C,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,IAAI,EAAE,CAAC,EAAU,EAAW,EAAE,CAAC,IAAA,6DAA6B,EAAC,IAAI,EAAE,EAAE,CAAC;KACvE,CAAC,CAAC;IAEH,MAAM,IAAI,GAAyB,MAAM,2CAAoB,CAAC,IAAI,CAAC;QACjE,IAAI;QACJ,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,GAAG,EAAE,KAAK,CAAC,GAAG;KACf,CAAC,CAAC;IACH,IAAI,CAAC;QACH,MAAM,OAAO,GACX,MAAM,IAAA,2CAAoB,EAAC;YACzB,IAAI;YACJ,IAAI;YACJ,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,KAAK,EAAE,IAAI;YACX,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;YACrD,MAAM;SACP,CAAC,CAAC;QACL,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,WAAW,OAAO,CAAC,MAAM,gBAAgB,OAAO,CAAC,KAAK,aAAa,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,MAAM,IAAI,CACvG,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -1,15 +1,13 @@
1
- import type { IAutoMoviePackageManager } from "./IAutoMoviePackageManager";
2
1
  /**
3
2
  * Explain the work between a freshly written installation and a runnable production.
4
3
  *
5
- * `directory` is printed as given (`run` passes the absolute target). The text starts with a blank line because `run` appends it to the written-file list. A `production` is a single production installed with `packageManager`'s manager: npm by default, pnpm at an enclosing workspace root when one is named; a `workspace` is a pnpm workspace root that still needs its first production; a `workspace-production` is a production added to such a root. The steps name the generated `README.md`, `AGENTS.md`, the `lint` and `evidence` scripts and the workspace's `add` command, so they must change with the scaffold's first-run README sections.
4
+ * `directory` is printed as given (`run` passes the absolute target). The text starts with a blank line because `run` appends it to the written-file list. A `production` is a single production in its own pnpm repository; a `workspace` is a pnpm workspace root that still needs its first production; a `workspace-production` is a production added to such a root. The steps name the generated `README.md`, `AGENTS.md`, the `lint` and `evidence` scripts and the workspace's `add` command, so they must change with the scaffold's first-run README sections.
6
5
  *
7
6
  * @param directory The installed directory.
8
7
  * @param kind Which installation was written.
9
- * @param packageManager The manager a `production` installs with, from `selectAutoMoviePackageManager`; workspace kinds always use pnpm.
10
8
  * @returns The closing text.
11
9
  *
12
- * @evidence contracts/development/implementation.md#principled-implementation The steps are fixed text derived from each layer's first-run contract: the production README's install and checks with the selected manager (npm by default, pnpm with its workspace root inside a pnpm workspace), and the workspace README's pnpm install and add.
10
+ * @evidence contracts/development/implementation.md#principled-implementation The steps are fixed text derived from each layer's first-run contract: the production README's pnpm install and checks, and the workspace README's pnpm install and add.
13
11
  * @evidence contracts/development/implementation.md#clear-and-simple-structure One pure function returns the text for every installation kind and leaves writing to `run`, so the message has a single owner and no terminal effect.
14
12
  * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The text names no fixture or particular directory and is not altered by any caller; a closed union selects the variant.
15
13
  * @evidence contracts/development/common.md#meaningful-documentation The comment states how `directory` is printed, why the text opens with a blank line, what each kind means and what must change with the scaffold.
@@ -17,4 +15,4 @@ import type { IAutoMoviePackageManager } from "./IAutoMoviePackageManager";
17
15
  * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work `run` calls this once per successful installation.
18
16
  * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources The function returns a new string and holds no state, handle, or task after it returns.
19
17
  */
20
- export declare function renderAutoMovieScaffoldNextSteps(directory: string, kind: "production" | "workspace" | "workspace-production", packageManager?: IAutoMoviePackageManager): string;
18
+ export declare function renderAutoMovieScaffoldNextSteps(directory: string, kind: "production" | "workspace" | "workspace-production"): string;
@@ -4,14 +4,13 @@ exports.renderAutoMovieScaffoldNextSteps = renderAutoMovieScaffoldNextSteps;
4
4
  /**
5
5
  * Explain the work between a freshly written installation and a runnable production.
6
6
  *
7
- * `directory` is printed as given (`run` passes the absolute target). The text starts with a blank line because `run` appends it to the written-file list. A `production` is a single production installed with `packageManager`'s manager: npm by default, pnpm at an enclosing workspace root when one is named; a `workspace` is a pnpm workspace root that still needs its first production; a `workspace-production` is a production added to such a root. The steps name the generated `README.md`, `AGENTS.md`, the `lint` and `evidence` scripts and the workspace's `add` command, so they must change with the scaffold's first-run README sections.
7
+ * `directory` is printed as given (`run` passes the absolute target). The text starts with a blank line because `run` appends it to the written-file list. A `production` is a single production in its own pnpm repository; a `workspace` is a pnpm workspace root that still needs its first production; a `workspace-production` is a production added to such a root. The steps name the generated `README.md`, `AGENTS.md`, the `lint` and `evidence` scripts and the workspace's `add` command, so they must change with the scaffold's first-run README sections.
8
8
  *
9
9
  * @param directory The installed directory.
10
10
  * @param kind Which installation was written.
11
- * @param packageManager The manager a `production` installs with, from `selectAutoMoviePackageManager`; workspace kinds always use pnpm.
12
11
  * @returns The closing text.
13
12
  *
14
- * @evidence contracts/development/implementation.md#principled-implementation The steps are fixed text derived from each layer's first-run contract: the production README's install and checks with the selected manager (npm by default, pnpm with its workspace root inside a pnpm workspace), and the workspace README's pnpm install and add.
13
+ * @evidence contracts/development/implementation.md#principled-implementation The steps are fixed text derived from each layer's first-run contract: the production README's pnpm install and checks, and the workspace README's pnpm install and add.
15
14
  * @evidence contracts/development/implementation.md#clear-and-simple-structure One pure function returns the text for every installation kind and leaves writing to `run`, so the message has a single owner and no terminal effect.
16
15
  * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The text names no fixture or particular directory and is not altered by any caller; a closed union selects the variant.
17
16
  * @evidence contracts/development/common.md#meaningful-documentation The comment states how `directory` is printed, why the text opens with a blank line, what each kind means and what must change with the scaffold.
@@ -19,7 +18,7 @@ exports.renderAutoMovieScaffoldNextSteps = renderAutoMovieScaffoldNextSteps;
19
18
  * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work `run` calls this once per successful installation.
20
19
  * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources The function returns a new string and holds no state, handle, or task after it returns.
21
20
  */
22
- function renderAutoMovieScaffoldNextSteps(directory, kind, packageManager = { manager: "npm" }) {
21
+ function renderAutoMovieScaffoldNextSteps(directory, kind) {
23
22
  if (kind === "workspace")
24
23
  return (`\n\nNext (from ${directory}):\n` +
25
24
  ` 1. Read README.md and AGENTS.md. The workspace has no production yet.\n` +
@@ -31,18 +30,10 @@ function renderAutoMovieScaffoldNextSteps(directory, kind, packageManager = { ma
31
30
  ` 2. Read README.md in ${directory} and the workspace AGENTS.md. This is an empty harness.\n` +
32
31
  ` 3. Author the production in TypeScript under src with the public AutoMovie package APIs.\n` +
33
32
  ` 4. Run pnpm run lint and pnpm run evidence there.\n`);
34
- if (packageManager.manager === "pnpm")
35
- return (`\n\nNext (from ${directory}):\n` +
36
- ` 1. Read README.md and AGENTS.md. This is an empty harness.\n` +
37
- (packageManager.workspace === undefined
38
- ? ` 2. Run pnpm install.\n`
39
- : ` 2. Run pnpm install at the workspace root ${packageManager.workspace}; its pnpm-workspace.yaml must list this directory.\n`) +
40
- ` 3. Author the production in TypeScript under src with the public AutoMovie package APIs.\n` +
41
- ` 4. Run pnpm run lint for source and pnpm run evidence for checklist answers.\n`);
42
33
  return (`\n\nNext (from ${directory}):\n` +
43
34
  ` 1. Read README.md and AGENTS.md. This is an empty harness.\n` +
44
- ` 2. Run npm install --package-lock=false.\n` +
35
+ ` 2. Run pnpm install.\n` +
45
36
  ` 3. Author the production in TypeScript under src with the public AutoMovie package APIs.\n` +
46
- ` 4. Run npm run lint for source and npm run evidence for checklist answers.\n`);
37
+ ` 4. Run pnpm run lint for source and pnpm run evidence for checklist answers.\n`);
47
38
  }
48
39
  //# sourceMappingURL=renderAutoMovieScaffoldNextSteps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderAutoMovieScaffoldNextSteps.js","sourceRoot":"","sources":["../src/renderAutoMovieScaffoldNextSteps.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,0CACE,SAAiB,EACjB,IAAyD,EACzD,cAAc,GAA6B,EAAE,OAAO,EAAE,KAAK,EAAE;IAE7D,IAAI,IAAI,KAAK,WAAW;QACtB,OAAO,CACL,kBAAkB,SAAS,MAAM;YACjC,2EAA2E;YAC3E,0BAA0B;YAC1B,0GAA0G,CAC3G,CAAC;IACJ,IAAI,IAAI,KAAK,sBAAsB;QACjC,OAAO,CACL,aAAa;YACb,uEAAuE;YACvE,0BAA0B,SAAS,2DAA2D;YAC9F,8FAA8F;YAC9F,uDAAuD,CACxD,CAAC;IACJ,IAAI,cAAc,CAAC,OAAO,KAAK,MAAM;QACnC,OAAO,CACL,kBAAkB,SAAS,MAAM;YACjC,gEAAgE;YAChE,CAAC,cAAc,CAAC,SAAS,KAAK,SAAS;gBACrC,CAAC,CAAC,0BAA0B;gBAC5B,CAAC,CAAC,+CAA+C,cAAc,CAAC,SAAS,uDAAuD,CAAC;YACnI,8FAA8F;YAC9F,kFAAkF,CACnF,CAAC;IACJ,OAAO,CACL,kBAAkB,SAAS,MAAM;QACjC,gEAAgE;QAChE,8CAA8C;QAC9C,8FAA8F;QAC9F,gFAAgF,CACjF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"renderAutoMovieScaffoldNextSteps.js","sourceRoot":"","sources":["../src/renderAutoMovieScaffoldNextSteps.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,0CACE,SAAiB,EACjB,IAAyD;IAEzD,IAAI,IAAI,KAAK,WAAW;QACtB,OAAO,CACL,kBAAkB,SAAS,MAAM;YACjC,2EAA2E;YAC3E,0BAA0B;YAC1B,0GAA0G,CAC3G,CAAC;IACJ,IAAI,IAAI,KAAK,sBAAsB;QACjC,OAAO,CACL,aAAa;YACb,uEAAuE;YACvE,0BAA0B,SAAS,2DAA2D;YAC9F,8FAA8F;YAC9F,uDAAuD,CACxD,CAAC;IACJ,OAAO,CACL,kBAAkB,SAAS,MAAM;QACjC,gEAAgE;QAChE,0BAA0B;QAC1B,8FAA8F;QAC9F,kFAAkF,CACnF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { AutoMovieCaptureHost } from "./AutoMovieCaptureHost";
2
+ /**
3
+ * Render one subject of a host's draw page into `<out>/film.mp4`, with `render-report.json` beside it.
4
+ *
5
+ * The subject is opened through the host's draw session, every frame of its clock is drawn by `renderAutoMovieDrawnVideo` into a scratch folder under `<root>/.cache/render/`, and FFmpeg encodes them into a partial file that is renamed to `film.mp4` only once it is complete, so a failed render leaves no file that looks finished. The report names the subject, the source revision, the backend, the encoder's arguments and every frame's second and pixel hash. The scratch folder is deleted and the session closed on every outcome.
6
+ *
7
+ * @evidence contracts/development/common.md#meaningful-documentation States what is written where, how a failure leaves the output, what the report holds, and what is released.
8
+ * @evidence contracts/development/implementation.md#principled-implementation Drawing and encoding are the render package's; this host supplies the session, files and FFmpeg, so a delivered frame is drawn by the same function as a capture's still.
9
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Open, draw and encode, rename, report, release.
10
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The output is replaced only by a complete encode; no frame is reused from an earlier render.
11
+ * @evidence contracts/development/implementation.md#efficient-algorithms One draw and one PNG file per frame, then one FFmpeg run.
12
+ * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each render draws afresh.
13
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The frame files live in the scratch folder until the encode ends, then are deleted with it; the session's page is closed on every outcome.
14
+ */
15
+ export declare function renderAutoMovieVideo(props: {
16
+ /** The opened draw host. */
17
+ host: AutoMovieCaptureHost;
18
+ /** The production's root folder. */
19
+ root: string;
20
+ /** The subject's name, or null for the page's only subject. */
21
+ subject: string | null;
22
+ /** Data the subject module reads, as JSON, or null. */
23
+ props: unknown;
24
+ /** Output folder, relative to the root or absolute; absent, `media/automovie/<subject>/videos`. */
25
+ out?: string;
26
+ /** FFmpeg executable. */
27
+ ffmpeg: string;
28
+ }): Promise<{
29
+ /** The video written. */
30
+ video: string;
31
+ /** The report written beside it. */
32
+ report: string;
33
+ /** Frames drawn. */
34
+ frames: number;
35
+ }>;
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.renderAutoMovieVideo = renderAutoMovieVideo;
37
+ const fs = __importStar(require("node:fs/promises"));
38
+ const path = __importStar(require("node:path"));
39
+ const readAutoMovieRevision_1 = require("./readAutoMovieRevision");
40
+ const runAutoMovieFfmpeg_1 = require("./runAutoMovieFfmpeg");
41
+ /**
42
+ * The delivery encoding of a drawn subject: H.264 in yuv420p at CRF 18, without tone mapping, as the production's render used; the frame format is the subject's own clock and raster.
43
+ */
44
+ const SPEC = {
45
+ target: "production",
46
+ toneMapping: "none",
47
+ codec: "h264",
48
+ pixelFormat: "yuv420p",
49
+ crf: 18,
50
+ };
51
+ /**
52
+ * Render one subject of a host's draw page into `<out>/film.mp4`, with `render-report.json` beside it.
53
+ *
54
+ * The subject is opened through the host's draw session, every frame of its clock is drawn by `renderAutoMovieDrawnVideo` into a scratch folder under `<root>/.cache/render/`, and FFmpeg encodes them into a partial file that is renamed to `film.mp4` only once it is complete, so a failed render leaves no file that looks finished. The report names the subject, the source revision, the backend, the encoder's arguments and every frame's second and pixel hash. The scratch folder is deleted and the session closed on every outcome.
55
+ *
56
+ * @evidence contracts/development/common.md#meaningful-documentation States what is written where, how a failure leaves the output, what the report holds, and what is released.
57
+ * @evidence contracts/development/implementation.md#principled-implementation Drawing and encoding are the render package's; this host supplies the session, files and FFmpeg, so a delivered frame is drawn by the same function as a capture's still.
58
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Open, draw and encode, rename, report, release.
59
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The output is replaced only by a complete encode; no frame is reused from an earlier render.
60
+ * @evidence contracts/development/implementation.md#efficient-algorithms One draw and one PNG file per frame, then one FFmpeg run.
61
+ * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each render draws afresh.
62
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The frame files live in the scratch folder until the encode ends, then are deleted with it; the session's page is closed on every outcome.
63
+ */
64
+ async function renderAutoMovieVideo(props) {
65
+ const session = await props.host.session({
66
+ subject: props.subject,
67
+ props: props.props,
68
+ });
69
+ const name = session.subject.name;
70
+ const out = path.resolve(props.root, props.out ?? path.join("media", "automovie", name, "videos"));
71
+ const scratch = path.join(props.root, ".cache", "render", `${name}-${process.pid}-${Date.now()}`);
72
+ const partial = path.join(out, `.film-${process.pid}.mp4`);
73
+ try {
74
+ await fs.mkdir(scratch, { recursive: true });
75
+ await fs.mkdir(out, { recursive: true });
76
+ const result = await props.host.render.renderAutoMovieDrawnVideo({
77
+ session,
78
+ spec: SPEC,
79
+ frameDir: scratch.split(path.sep).join("/"),
80
+ outputPath: partial,
81
+ audio: null,
82
+ write: (file, data) => fs.writeFile(file, data),
83
+ encode: async (args) => {
84
+ await (0, runAutoMovieFfmpeg_1.runAutoMovieFfmpeg)(props.ffmpeg, args);
85
+ },
86
+ });
87
+ const video = path.join(out, "film.mp4");
88
+ await fs.rename(partial, video);
89
+ const report = path.join(out, "render-report.json");
90
+ await fs.writeFile(report, JSON.stringify({
91
+ subject: name,
92
+ revision: (0, readAutoMovieRevision_1.readAutoMovieRevision)(props.root),
93
+ backend: session.backend,
94
+ video: "film.mp4",
95
+ args: result.args,
96
+ frames: result.frames.map((frame) => ({
97
+ index: frame.index,
98
+ seconds: frame.seconds,
99
+ hash: frame.hash,
100
+ })),
101
+ }, null, 2));
102
+ return { video, report, frames: result.frames.length };
103
+ }
104
+ finally {
105
+ await fs.rm(partial, { force: true });
106
+ await fs.rm(scratch, { recursive: true, force: true });
107
+ await session.close();
108
+ }
109
+ }
110
+ //# sourceMappingURL=renderAutoMovieVideo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderAutoMovieVideo.js","sourceRoot":"","sources":["../src/renderAutoMovieVideo.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,MAAY,EAAE,6CAAyB;AACvC,MAAY,IAAI,sCAAkB;AAGlC,mEAAgE;AAChE,6DAA0D;AAE1D;;G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AAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACtC,MAAM,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACvD,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;AACH,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Find the FFmpeg executable a capture of a video file runs: `FFMPEG_PATH` when the environment sets it to a non-blank path, else the binary of the production's `ffmpeg-static`.
3
+ *
4
+ * It throws naming both `FFMPEG_PATH` and `ffmpeg-static` when neither gives a path, so a capture that plans a video says how to supply one before it touches its folder.
5
+ *
6
+ * @evidence contracts/development/common.md#meaningful-documentation States the order of the two sources and the refusal.
7
+ * @evidence contracts/development/implementation.md#principled-implementation `ffmpeg-static` exports the path of the binary it downloaded, or null on a platform it has none for; the environment variable wins so a machine's own build can be used.
8
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Read the variable, else load the package, else refuse.
9
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No `ffmpeg` on the search path is guessed, because a capture records the binary it ran.
10
+ * @evidence contracts/development/implementation.md#efficient-algorithms One module load at most.
11
+ * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Resolved once per capture.
12
+ * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a path and keeps nothing.
13
+ */
14
+ export declare function resolveAutoMovieFfmpeg(props: {
15
+ /** The environment, read for `FFMPEG_PATH`. */
16
+ env: Readonly<Record<string, string | undefined>>;
17
+ /** Loads a package from the production, throwing when it is not installed. */
18
+ load: (id: string) => unknown;
19
+ }): string;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveAutoMovieFfmpeg = resolveAutoMovieFfmpeg;
4
+ /**
5
+ * Find the FFmpeg executable a capture of a video file runs: `FFMPEG_PATH` when the environment sets it to a non-blank path, else the binary of the production's `ffmpeg-static`.
6
+ *
7
+ * It throws naming both `FFMPEG_PATH` and `ffmpeg-static` when neither gives a path, so a capture that plans a video says how to supply one before it touches its folder.
8
+ *
9
+ * @evidence contracts/development/common.md#meaningful-documentation States the order of the two sources and the refusal.
10
+ * @evidence contracts/development/implementation.md#principled-implementation `ffmpeg-static` exports the path of the binary it downloaded, or null on a platform it has none for; the environment variable wins so a machine's own build can be used.
11
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Read the variable, else load the package, else refuse.
12
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No `ffmpeg` on the search path is guessed, because a capture records the binary it ran.
13
+ * @evidence contracts/development/implementation.md#efficient-algorithms One module load at most.
14
+ * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Resolved once per capture.
15
+ * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a path and keeps nothing.
16
+ */
17
+ function resolveAutoMovieFfmpeg(props) {
18
+ const given = props.env.FFMPEG_PATH?.trim();
19
+ if (given !== undefined && given !== "")
20
+ return given;
21
+ let binary = null;
22
+ try {
23
+ binary = props.load("ffmpeg-static");
24
+ }
25
+ catch {
26
+ binary = null;
27
+ }
28
+ if (typeof binary === "string" && binary !== "")
29
+ return binary;
30
+ throw new Error("A video capture needs FFmpeg: set FFMPEG_PATH to an ffmpeg executable, or install ffmpeg-static in the production");
31
+ }
32
+ //# sourceMappingURL=resolveAutoMovieFfmpeg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveAutoMovieFfmpeg.js","sourceRoot":"","sources":["../src/resolveAutoMovieFfmpeg.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,gCAAuC,KAMtC;IACC,MAAM,KAAK,GAAuB,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;IAChE,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IACtD,IAAI,MAAM,GAAY,IAAI,CAAC;IAC3B,IAAI,CAAC;QACH,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,GAAG,IAAI,CAAC;IAChB,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO,MAAM,CAAC;IAC/D,MAAM,IAAI,KAAK,CACb,mHAAmH,CACpH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Run `automovie review` in a production: record real-time playback of its running inspector page for a person to watch, and resolve to the exit status.
3
+ *
4
+ * Options are read by `readAutoMovieCaptureArguments` and admitted by `readAutoMovieReviewOptions`. The recording is `recordAutoMoviePlayback` with the production's `playwright-core`; it and `playback.json`, holding the time readings and the page's script errors, go into `--out` or `media/automovie/review`. It prints the video and the number of errors, and resolves to 1 when the page reported a script error, since a playback that errors is not one to watch, and 0 otherwise.
5
+ *
6
+ * @evidence contracts/development/common.md#meaningful-documentation States how options are read, what records, what is written where, what is printed and the status with its reason.
7
+ * @evidence contracts/development/implementation.md#principled-implementation The recording's rules are `recordAutoMoviePlayback`'s; the command supplies the production's Playwright and writes the result.
8
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Read, record, write, report.
9
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts An unknown option is refused; a page error is reported in the status, not hidden.
10
+ * @evidence contracts/development/implementation.md#efficient-algorithms One recording.
11
+ * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work One review per command.
12
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The browser is the recording's and closed by it.
13
+ */
14
+ export declare function reviewAutoMovie(props: {
15
+ /** The tokens after `review`. */
16
+ args: readonly string[];
17
+ /** The production's root folder, the working directory. */
18
+ root: string;
19
+ /** The environment, read for `CHROME_PATH`. */
20
+ env: Readonly<Record<string, string | undefined>>;
21
+ }): Promise<number>;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.reviewAutoMovie = reviewAutoMovie;
37
+ const fs = __importStar(require("node:fs/promises"));
38
+ const path = __importStar(require("node:path"));
39
+ const loadAutoMovieProductionModule_1 = require("./loadAutoMovieProductionModule");
40
+ const readAutoMovieReviewOptions_1 = require("./readAutoMovieReviewOptions");
41
+ const recordAutoMoviePlayback_1 = require("./recordAutoMoviePlayback");
42
+ /**
43
+ * Run `automovie review` in a production: record real-time playback of its running inspector page for a person to watch, and resolve to the exit status.
44
+ *
45
+ * Options are read by `readAutoMovieCaptureArguments` and admitted by `readAutoMovieReviewOptions`. The recording is `recordAutoMoviePlayback` with the production's `playwright-core`; it and `playback.json`, holding the time readings and the page's script errors, go into `--out` or `media/automovie/review`. It prints the video and the number of errors, and resolves to 1 when the page reported a script error, since a playback that errors is not one to watch, and 0 otherwise.
46
+ *
47
+ * @evidence contracts/development/common.md#meaningful-documentation States how options are read, what records, what is written where, what is printed and the status with its reason.
48
+ * @evidence contracts/development/implementation.md#principled-implementation The recording's rules are `recordAutoMoviePlayback`'s; the command supplies the production's Playwright and writes the result.
49
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Read, record, write, report.
50
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts An unknown option is refused; a page error is reported in the status, not hidden.
51
+ * @evidence contracts/development/implementation.md#efficient-algorithms One recording.
52
+ * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work One review per command.
53
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The browser is the recording's and closed by it.
54
+ */
55
+ async function reviewAutoMovie(props) {
56
+ const { root } = props;
57
+ const render = (0, loadAutoMovieProductionModule_1.loadAutoMovieProductionModule)(root, "@automovie/render");
58
+ const options = (0, readAutoMovieReviewOptions_1.readAutoMovieReviewOptions)(render.readAutoMovieCaptureArguments(props.args));
59
+ const out = path.resolve(root, options.out ?? path.join("media", "automovie", "review"));
60
+ const recorded = await (0, recordAutoMoviePlayback_1.recordAutoMoviePlayback)({
61
+ chromium: (0, loadAutoMovieProductionModule_1.loadAutoMovieProductionModule)(root, "playwright-core").chromium,
62
+ url: options.url,
63
+ seconds: options.seconds,
64
+ out,
65
+ env: props.env,
66
+ });
67
+ await fs.writeFile(path.join(out, "playback.json"), JSON.stringify(recorded, null, 2));
68
+ process.stdout.write(`review: ${recorded.video}\n${recorded.errors.length} page errors\n`);
69
+ return recorded.errors.length === 0 ? 0 : 1;
70
+ }
71
+ //# sourceMappingURL=reviewAutoM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CAAC;IACF,OAAO,QAAQ,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC"}
package/lib/run.d.ts CHANGED
@@ -2,23 +2,26 @@
2
2
  * The `automovie` CLI entry. `argv` is the full process vector; its first two positions (executable and script) are skipped.
3
3
  *
4
4
  * - `help` and `version` write to stdout; the version is read from this package's `package.json`.
5
- * - `create` renders a single production, or with `--workspace` a workspace root, and publishes it into the directory resolved against the working directory. The name is the typed `--name`, else derived from the target's basename; for the working directory itself the terminal is asked, offering `automovie-examples`, which is used without asking when no terminal is attached.
6
- * - `add` requires `pnpm-workspace.yaml` in the working directory, which it takes as the workspace root without searching elsewhere, and publishes a workspace production into `movies/<family>/<directory>`, named by `--name`, else by the npm-safe name derived from the directory segment as `create` derives one.
7
- * - `sync` plans explicit generated-instruction updates for the directory holding `AGENTS.md`, preserves project contracts and content and refuses local conflicts; check reports pending updates without writing.
5
+ * - `create` writes a single production, or with `--workspace` a workspace root, into the directory resolved against the working directory. The name is the typed `--name`, else derived from the target's basename; for the working directory itself the terminal is asked, offering `automovie-examples`, which is used without asking when no terminal is attached.
6
+ * - `add` fills missing scaffold catalog entries in the working directory's `pnpm-workspace.yaml` and writes a production into `movies/<family>/<directory>`. Its name is `--name` or the npm-safe name derived from the directory segment.
7
+ * - `capture` runs `captureAutoMovie` in the working directory as the production, resolving to its status: 1 when a cell was not drawn.
8
+ * - `inspect` runs `inspectAutoMovie` in the working directory, serving the inspector page until the process is interrupted.
9
+ * - `render` runs `renderAutoMovie` in the working directory as the production, resolving to 0 once the video is written.
10
+ * - `review` runs `reviewAutoMovie`, resolving to 1 when the recorded page reported a script error.
8
11
  *
9
- * `create` and `add` refuse a non-empty target without `--force`. On success they list the written files relative to the target, then the next steps. Completed and partial file effects stay after failure; the error names the completed files and the stopping entry. Prepared directories can remain even when no file was written.
12
+ * `create` and `add` take their files from `createAutoMovieScaffold` and refuse a non-empty target without `--force`, which writes over same-path files and keeps every other file. On success they list the written files relative to the target, then the next steps. A failed write stops there and leaves the files already written.
10
13
  *
11
14
  * Resolves to the process exit code, 0 after queuing the requested stdout text or 1 after queuing a caught error's message and distinct `cause` objects' messages without stacks. A repeated cause ends the chain. Reading or stringifying an unusual thrown value, or writing stderr, can itself throw. The executable assigns the result to `process.exitCode` so queued output can drain.
12
15
  *
13
16
  * @param argv The full process vector.
14
17
  * @returns The exit code.
15
18
  *
16
- * @evidence contracts/development/implementation.md#principled-implementation Parsing finishes before rendering or publication, and path.resolve binds every target to the current working directory. A non-completed receipt becomes ScaffoldPublicationError, preserving the completed prefix and stopping outcome; describeError follows distinct cause values with a set to terminate cycles, but assumes their message access and string conversion do not throw.
17
- * @evidence contracts/development/implementation.md#clear-and-simple-structure This dispatcher delegates admission, name choice, the prompt and closing text to CLI owners and rendering and publication to the template package. Only bin.ts invokes it at module load, so importing run does not execute a request.
18
- * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts `add` checks only the working directory for `pnpm-workspace.yaml` and never searches ancestors; only `create`'s next steps detect a package manager. The catch reports failures without stacks and never retries publication or rolls back files.
19
- * @evidence contracts/development/common.md#meaningful-documentation The comment gives argv ownership, every command's effect, name and target choice, retained file and directory effects, and the returned status.
20
- * @evidence contracts/development/implementation.md#efficient-algorithms For n files, rendering reads total bytes and sorts directory entries and the n rendered paths for deterministic order and collision reporting. Publication encodes those bytes and checks each path's ancestors before writing; listing scans completed paths once. Sync adds linear instruction reads and digests and the existing conditional publication path. Failure formatting additionally walks the distinct cause chain.
21
- * @evidence contracts/development/implementation.md#reuse-equivalent-work Every command takes fresh filesystem observations and cannot reuse an earlier receipt. Check observes without publishing. Rendering reads the installed scaffold anew; only the template's per-call directory captures are reused and revalidated during that publication.
22
- * @evidence contracts/development/implementation.md#bound-retention-and-release-resources Rendered strings, encoded candidate bytes, receipt entries, and listing text scale with scaffold size; the cause set scales with chain length without a fixed cap. The prompt closes its terminal interface before returning. This dispatcher owns no descriptor; queued stdout and stderr bytes belong to the process streams.
19
+ * @evidence contracts/development/implementation.md#principled-implementation Parsing finishes before the scaffold is created, the whole file map exists before the first write, and path.resolve binds every target to the current working directory. describeError follows distinct cause values with a set to terminate cycles, but assumes their message access and string conversion do not throw.
20
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure This dispatcher delegates admission, name choice, the prompt and closing text to CLI owners and the file map to the template package, keeping only the write. Only bin.ts invokes it at module load, so importing run does not execute a request.
21
+ * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts `add` checks only the working directory for `pnpm-workspace.yaml` and never searches ancestors. The catch reports failures without stacks and never retries a write or rolls back files.
22
+ * @evidence contracts/development/common.md#meaningful-documentation The comment gives argv ownership, every command's effect, name and target choice, retained file effects, and the returned status.
23
+ * @evidence contracts/development/implementation.md#efficient-algorithms For n files, creation reads the scaffold once and each file is written once with its directory ensured; listing scans the written paths once. Failure formatting additionally walks the distinct cause chain.
24
+ * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Every command takes fresh filesystem observations and reads the installed scaffold anew.
25
+ * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The file map and listing text scale with scaffold size; the cause set scales with chain length without a fixed cap. The prompt closes its terminal interface before returning. This dispatcher owns no descriptor; queued stdout and stderr bytes belong to the process streams.
23
26
  */
24
27
  export declare function run(argv: readonly string[]): Promise<number>;