automovie 0.2.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.
package/README.md CHANGED
@@ -24,7 +24,7 @@ The motion is where the accuracy goes. Every movement is a goal for hands, feet
24
24
 
25
25
  ### Motion as code
26
26
 
27
- The cast, sets, performance, staging and camera are TypeScript the agent writes against `@automovie/interface`, the typed authoring AST, and `@automovie/motions`, the vocabulary of human actions. An action is a law that brings the body onto its targets, so one chain of actions fits people of different stature and proportion, and an action can be interrupted mid-motion. A production composes each person's performance from that vocabulary, writes a law of its own only for what the vocabulary lacks, tests it against its study, and accepts every module in catalog cases on stills before a scene uses it. A scene then only composes accepted modules, and a defect the scene shows is fixed in the module and its case, never patched in the scene.
27
+ The cast, sets, performance, staging and camera are TypeScript the agent writes against the authoring contracts in `@automovie/interface` and the human action vocabulary in `@automovie/motions`. An action is a law that brings the body onto its targets, so one chain of actions fits people of different stature and proportion, and an action can be interrupted mid-motion. A production composes each person's performance from that vocabulary, writes a law of its own only for what the vocabulary lacks, tests it against its study, and accepts every module in catalog cases on stills before a scene uses it. A scene then only composes accepted modules, and a defect the scene shows is fixed in the module and its case, never patched in the scene.
28
28
 
29
29
  ### The motion hint
30
30
 
@@ -127,7 +127,7 @@ automovie review --url <inspector address> --seconds <s> [--out <dir>]
127
127
 
128
128
  ### add
129
129
 
130
- `add` runs at a workspace root, the directory holding `pnpm-workspace.yaml`. `add shorts/<name>` writes a production into `movies/shorts/<name>` and `add series/<name>` into `movies/series/<name>`; `pnpm install` again links it. The production takes its dependencies from the root's catalogs and its skills from the root's `.agents/skills`.
130
+ `add` runs at the workspace root and writes a production into `movies/shorts/<name>` or `movies/series/<name>`. It fills missing dependency entries in `pnpm-workspace.yaml` and preserves existing pins and overrides. Run `pnpm install` again to link the production. Its skills come from the root's `.agents/skills`.
131
131
 
132
132
  `create` and `add` refuse a non-empty target unless `--force` is given, which replaces files at the same paths.
133
133
 
@@ -148,7 +148,7 @@ automovie review --url <inspector address> --seconds <s> [--out <dir>]
148
148
  | Package | Purpose |
149
149
  | --- | --- |
150
150
  | [`automovie`](https://github.com/samchon/automovie/tree/master/packages/cli) | The CLI that installs and updates the scaffold |
151
- | [`@automovie/interface`](https://github.com/samchon/automovie/tree/master/packages/interface) | The authoring AST: the types a coding agent fills in |
151
+ | [`@automovie/interface`](https://github.com/samchon/automovie/tree/master/packages/interface) | Common and domain contracts, including the authoring AST |
152
152
  | [`@automovie/engine`](https://github.com/samchon/automovie/tree/master/packages/engine) | Deterministic validation and computation of everything a frame contains |
153
153
  | [`@automovie/human`](https://github.com/samchon/automovie/tree/master/packages/human) | The body of a person, its skeleton and contact profile, generated by code from typed parameters (being rebuilt) |
154
154
  | [`@automovie/motions`](https://github.com/samchon/automovie/tree/master/packages/motions) | Human actions, such as walk, sit and pick up, as deterministic laws scaled to the body |
@@ -1,3 +1,4 @@
1
+ import type { IAutoMovieCapturePlanRequest, IAutoMovieCaptureRecord } from "@automovie/interface";
1
2
  import type * as Render from "@automovie/render";
2
3
  import type { AutoMovieCaptureBackend } from "./AutoMovieCaptureBackend";
3
4
  /**
@@ -58,11 +59,11 @@ export declare class AutoMovieCaptureHost {
58
59
  /**
59
60
  * Open a fresh page of the served draw page with a subject and its props injected before it loads, and describe the subject through it.
60
61
  *
61
- * The returned session owns the page; the caller closes it. A page that installs no draw function or cannot describe its subject rejects, and the page is closed first.
62
+ * The returned session owns the page; the caller closes it. An uncaught browser error during initialization rejects immediately with the original cause and logs its stack; console errors are forwarded too. A page that installs no draw function or cannot describe its subject rejects, and the page is closed first.
62
63
  *
63
64
  * @evidence contracts/development/common.md#meaningful-documentation States what is opened and injected, who closes it, and the refusal.
64
65
  * @evidence contracts/development/implementation.md#principled-implementation Every picture of a capture or a render comes through one such session, so both hosts draw through the same function.
65
- * @evidence contracts/development/implementation.md#clear-and-simple-structure One page, one session open, one close on failure.
66
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Observe the browser, race opening against a script failure, and close the page on rejection.
66
67
  * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A failed open is reported, never retried.
67
68
  * @evidence contracts/development/implementation.md#efficient-algorithms One page per call.
68
69
  * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each call is a fresh page, because props differ between subjects.
@@ -89,14 +90,14 @@ export declare class AutoMovieCaptureHost {
89
90
  */
90
91
  capture(props: {
91
92
  /** The request, as `parseAutoMovieCapturePlanRequest` read it. */
92
- request: Render.IAutoMovieCapturePlanRequest;
93
+ request: IAutoMovieCapturePlanRequest;
93
94
  /** Data the subject module reads, as JSON, or null. */
94
95
  props: unknown;
95
96
  /** The capture's root folder, relative to the production or absolute; absent, `media/capture/<subject>` of the production. */
96
97
  out?: string;
97
98
  /** The subject owner's own section of the record, or absent. */
98
99
  section?: Readonly<Record<string, unknown>>;
99
- }): Promise<Extract<Render.IAutoMovieCaptureRecord, {
100
+ }): Promise<Extract<IAutoMovieCaptureRecord, {
100
101
  state: "complete";
101
102
  }>>;
102
103
  /**
@@ -125,11 +125,11 @@ class AutoMovieCaptureHost {
125
125
  /**
126
126
  * Open a fresh page of the served draw page with a subject and its props injected before it loads, and describe the subject through it.
127
127
  *
128
- * The returned session owns the page; the caller closes it. A page that installs no draw function or cannot describe its subject rejects, and the page is closed first.
128
+ * The returned session owns the page; the caller closes it. An uncaught browser error during initialization rejects immediately with the original cause and logs its stack; console errors are forwarded too. A page that installs no draw function or cannot describe its subject rejects, and the page is closed first.
129
129
  *
130
130
  * @evidence contracts/development/common.md#meaningful-documentation States what is opened and injected, who closes it, and the refusal.
131
131
  * @evidence contracts/development/implementation.md#principled-implementation Every picture of a capture or a render comes through one such session, so both hosts draw through the same function.
132
- * @evidence contracts/development/implementation.md#clear-and-simple-structure One page, one session open, one close on failure.
132
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Observe the browser, race opening against a script failure, and close the page on rejection.
133
133
  * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A failed open is reported, never retried.
134
134
  * @evidence contracts/development/implementation.md#efficient-algorithms One page per call.
135
135
  * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each call is a fresh page, because props differ between subjects.
@@ -137,14 +137,29 @@ class AutoMovieCaptureHost {
137
137
  */
138
138
  async session(props) {
139
139
  const page = await this.browser.newPage();
140
- try {
141
- return await this.render.AutoMovieDrawSession.open({
142
- page,
143
- url: this.page.url,
144
- props: { subject: props.subject, props: props.props },
145
- backend: this.backend,
146
- timeout: TIMEOUT,
140
+ // A module can fail before installing the draw port, leaving only a timeout.
141
+ // Forward its original browser error while the failed page is still alive.
142
+ const failed = new Promise((_resolve, reject) => {
143
+ page.on?.("pageerror", (error) => {
144
+ console.error("Draw page error:", error.stack ?? error.message);
145
+ reject(new Error(`The draw page at ${this.page.url} failed during initialization`, { cause: error }));
147
146
  });
147
+ });
148
+ page.on?.("console", (message) => {
149
+ if (message.type() === "error")
150
+ console.error("Draw page console:", message.text());
151
+ });
152
+ try {
153
+ return await Promise.race([
154
+ this.render.AutoMovieDrawSession.open({
155
+ page,
156
+ url: this.page.url,
157
+ props: { subject: props.subject, props: props.props },
158
+ backend: this.backend,
159
+ timeout: TIMEOUT,
160
+ }),
161
+ failed,
162
+ ]);
148
163
  }
149
164
  catch (error) {
150
165
  await page.close();
@@ -1 +1 @@
1
- {"version":3,"file":"AutoMovieCaptureHost.js","sourceRoot":"","sources":["../src/AutoMovieCaptureHost.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,MAAY,EAAE,6CAAyB;AACvC,MAAY,IAAI,sCAAkB;AAIlC,uEAAoE;AACpE,mFAAgF;AAChF,mEAAgE;AAChE,qEAAkE;AAElE,4IAA4I;AAC5I,MAAM,OAAO,GAAW,OAAO,CAAC;AAEhC;;;;;;;;;;;;;;;;;;GAkBG;AACH;IACE,uIAAuI;IACvH,MAAM,CAAgB;IAEtC,uFAAuF;IACvE,OAAO,CAAS;IAEhC,oCAAoC;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AI,CAAC,IAAI,EACT,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CACjE;gBACD,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;gBAC1B,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO;aAC/B,CAAC,CAAC;YACL,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC;gBACtC,IAAI;gBACJ,IAAI,EAAE,CACJ,IAA2B,EACQ,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC;gBACnE,MAAM;gBACN,QAAQ,EAAE,IAAA,6CAAqB,EAAC,IAAI,CAAC,IAAI,CAAC;gBAC1C,KAAK,EAAE,MAAM;gBACb,GAAG,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;aACnE,CAAC,CAAC;QACL,CAAC;gBAAS,CAAC;YACT,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IACI,KAAK,CAAC,KAAK;QAChB,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAC7B,CAAC;gBAAS,CAAC;YACT,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAC1B,CAAC;IACH,CAAC;CACF"}
@@ -58,7 +58,16 @@ export declare namespace IAutoMovieChromium {
58
58
  * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work A signature has no body; Playwright answers.
59
59
  * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources A signature has no body; Playwright answers.
60
60
  */
61
- newPage(): Promise<IAutoMovieDrawPage>;
61
+ newPage(): Promise<IAutoMovieDrawPage & {
62
+ /** Optional browser diagnostics; portable draw-only drivers need not emit browser events. */
63
+ on?: {
64
+ (event: "pageerror", listener: (error: Error) => void): unknown;
65
+ (event: "console", listener: (message: {
66
+ type(): string;
67
+ text(): string;
68
+ }) => void): unknown;
69
+ };
70
+ }>;
62
71
  /**
63
72
  * End the browser and every page it holds.
64
73
  *
@@ -1 +1 @@
1
- {"version":3,"file":"captureAutoMovie.js","sourceRoot":"","sources":["../src/captureAutoMovie.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,MAAY,EAAE,6CAAyB;AACvC,MAAY,IAAI,sCAAkB;AAElC,iEAA8D;AAC9D,mFAAgF;AAChF,uFAAoF;AACpF,mEAAgE;AAChE,uEAAoE;AACpE,qEAAkE;AAClE,6DAA0D;AAE1D;;;;;;;;;;;;;;GAcG;AACI,KAAK,2BAA2B,KAStC;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,iEAA+B,EAC7B,MAAM,CAAC,6BAA6B,CAAC,KAAK,CAAC,IAAI,CAAC,CACjD,CAAC;IACJ,MAAM,OAAO,GACX,MAAM,CAAC,gCAAgC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3D,IAAI,MAAsE,CAAC;IAC3E,IAAI,OAAe,CAAC;IACpB,IAAI,MAAc,CAAC;IACnB,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QAC1B,uDAAuD;QACvD,MAAM,MAAM,GAAW,IAAA,+CAAsB,EAAC;YAC5C,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,IAAI,EAAE,CAAC,EAAU,EAAW,EAAE,CAAC,IAAA,6DAA6B,EAAC,IAAI,EAAE,EAAE,CAAC;SACvE,CAAC,CAAC;QACH,MAAM,IAAI,GAAW,IAAI,CAAC,OAAO,CA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,GAAG,EAAE,MAAM,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAC,2BAA2B,CAChJ,CAAC;IAEF,2BAA2B;IAC3B,MAAM,IAAI,OAAO,CAAY,CAAC,OAAmC,EAAQ,EAAE;QACzE,MAAM,IAAI,GAAe,GAAS,EAAE;YAClC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAC7B,OAAO,CAAC,SAAS,CAAC,CAAC;QACrB,CAAC,CAAC;QACF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACnB,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * The browser draws on the GPU backend, since playback is judged in real time; the recording is Playwright's own video of the page at a 1280 by 900 viewport, which `npx playwright-core install ffmpeg` provides. The page's Play button is found by its role and name, and the readout as the `output` showing `<second> / <duration> s`, both as the inspector renders them. The readout is read at most every half second for `seconds` of wall time after the click, and the page's script errors are collected. The video begins at navigation, so it includes the page's preparation; a reading's elapsed seconds count from the click.
5
5
  *
6
- * It rejects when the page shows no Play button or readout within ten minutes and when the browser produced no video. The browser is closed on every outcome.
6
+ * An uncaught page error before the controls are ready rejects immediately with that error as its cause; every page error also prints its stack, so a failed preparation leaves a usable diagnostic. It rejects when the page shows no Play button or readout within ten minutes and when the browser produced no video. Errors during playback remain in the returned report. The browser is closed on every outcome.
7
7
  *
8
8
  * @evidence contracts/development/common.md#meaningful-documentation States what is recorded and how, which backend and why, how the controls are found, the reading cadence, the clocks of the video and the readings, the refusals and the release.
9
9
  * @evidence contracts/development/implementation.md#principled-implementation Playback is observed on the page a person uses, through its own controls, so the recording shows the real loop's pacing instead of seeks turned into a supposed playback; Playwright closes the context to finish writing the video.
@@ -47,7 +47,7 @@ const READOUT = /\d+\.\d+ \/ \d+\.\d+ s/u;
47
47
  *
48
48
  * The browser draws on the GPU backend, since playback is judged in real time; the recording is Playwright's own video of the page at a 1280 by 900 viewport, which `npx playwright-core install ffmpeg` provides. The page's Play button is found by its role and name, and the readout as the `output` showing `<second> / <duration> s`, both as the inspector renders them. The readout is read at most every half second for `seconds` of wall time after the click, and the page's script errors are collected. The video begins at navigation, so it includes the page's preparation; a reading's elapsed seconds count from the click.
49
49
  *
50
- * It rejects when the page shows no Play button or readout within ten minutes and when the browser produced no video. The browser is closed on every outcome.
50
+ * An uncaught page error before the controls are ready rejects immediately with that error as its cause; every page error also prints its stack, so a failed preparation leaves a usable diagnostic. It rejects when the page shows no Play button or readout within ten minutes and when the browser produced no video. Errors during playback remain in the returned report. The browser is closed on every outcome.
51
51
  *
52
52
  * @evidence contracts/development/common.md#meaningful-documentation States what is recorded and how, which backend and why, how the controls are found, the reading cadence, the clocks of the video and the readings, the refusals and the release.
53
53
  * @evidence contracts/development/implementation.md#principled-implementation Playback is observed on the page a person uses, through its own controls, so the recording shows the real loop's pacing instead of seeks turned into a supposed playback; Playwright closes the context to finish writing the video.
@@ -83,12 +83,12 @@ async function recordAutoMoviePlayback(props) {
83
83
  });
84
84
  const page = await context.newPage();
85
85
  const errors = [];
86
- page.on("pageerror", (error) => {
87
- errors.push(error.message);
88
- });
89
- await page.goto(props.url, {
90
- waitUntil: "domcontentloaded",
91
- timeout: PREPARE,
86
+ const failed = new Promise((_resolve, reject) => {
87
+ page.on("pageerror", (error) => {
88
+ errors.push(error.message);
89
+ console.error("Inspector page error:", error.stack ?? error.message);
90
+ reject(new Error(`The inspector page at ${props.url} failed during initialization`, { cause: error }));
91
+ });
92
92
  });
93
93
  const play = page
94
94
  .getByRole("button", { name: "Play", exact: true })
@@ -96,8 +96,17 @@ async function recordAutoMoviePlayback(props) {
96
96
  const readout = page
97
97
  .locator("output", { hasText: READOUT })
98
98
  .first();
99
- await play.waitFor({ timeout: PREPARE });
100
- await readout.waitFor({ timeout: PREPARE });
99
+ await Promise.race([
100
+ (async () => {
101
+ await page.goto(props.url, {
102
+ waitUntil: "domcontentloaded",
103
+ timeout: PREPARE,
104
+ });
105
+ await play.waitFor({ timeout: PREPARE });
106
+ await readout.waitFor({ timeout: PREPARE });
107
+ })(),
108
+ failed,
109
+ ]);
101
110
  // Press Play and read the readout for the observed seconds.
102
111
  await play.click();
103
112
  const started = performance.now();
@@ -1 +1 @@
1
- {"version":3,"file":"recordAutoMoviePlayback.js","sourceRoot":"","sources":["../src/recordAutoMoviePlayback.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,EAAE,6CAAyB;AAEvC,+EAA4E;AAE5E,uJAAuJ;AACvJ,MAAM,OAAO,GAAW,OAAO,CAAC;AAEhC,4EAA4E;AAC5E,MAAM,OAAO,GAAW,GAAG,CAAC;AAE5B,mGAAmG;AACnG,MAAM,OAAO,GAAW,yBAAyB,CAAC;AAkDlD;;;;;;;;;;;;;;GAcG;AACI,KAAK,kCAAkC,KAe7C;IAUC,MAAM,QAAQ,GAAuB,KAAK,CAAC,QAA8B,CAAC;IAC1E,MAAM,IAAI,GACR,IAAA,yDAA2B,EAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAChD,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAsB,MAAM,QAAQ,CAAC,MAAM,CAAC;QACvD,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE;YACJ,GAAG,IAAI,CAAC,IAAI;YACZ,4CAA4C;YAC5C,uCAAuC;SACxC;QACD,GAAG,CAAC,IAAI,CAAC,cAAc,KAAK,SAAS;YACnC,CAAC,CAAC,EAAE;YACJ,CAAC,C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AAC,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"}
package/lib/run.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * - `help` and `version` write to stdout; the version is read from this package's `package.json`.
5
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` requires `pnpm-workspace.yaml` in the working directory, which it takes as the workspace root without searching elsewhere, and writes 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.
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
7
  * - `capture` runs `captureAutoMovie` in the working directory as the production, resolving to its status: 1 when a cell was not drawn.
8
8
  * - `inspect` runs `inspectAutoMovie` in the working directory, serving the inspector page until the process is interrupted.
9
9
  * - `render` runs `renderAutoMovie` in the working directory as the production, resolving to 0 once the video is written.
package/lib/run.js CHANGED
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.run = run;
37
37
  const template_1 = require("@automovie/template");
38
+ const node_crypto_1 = require("node:crypto");
38
39
  const fs = __importStar(require("node:fs"));
39
40
  const path = __importStar(require("node:path"));
40
41
  const captureAutoMovie_1 = require("./captureAutoMovie");
@@ -106,7 +107,7 @@ Options:
106
107
  *
107
108
  * - `help` and `version` write to stdout; the version is read from this package's `package.json`.
108
109
  * - `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.
109
- * - `add` requires `pnpm-workspace.yaml` in the working directory, which it takes as the workspace root without searching elsewhere, and writes 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.
110
+ * - `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.
110
111
  * - `capture` runs `captureAutoMovie` in the working directory as the production, resolving to its status: 1 when a cell was not drawn.
111
112
  * - `inspect` runs `inspectAutoMovie` in the working directory, serving the inspector page until the process is interrupted.
112
113
  * - `render` runs `renderAutoMovie` in the working directory as the production, resolving to 0 once the video is written.
@@ -168,7 +169,7 @@ async function run(argv) {
168
169
  write(path.join(root, "movies", command.family, command.directory), {
169
170
  kind: "workspace-production",
170
171
  name: command.name ?? (0, deriveAutoMovieProjectName_1.deriveAutoMovieProjectName)(command.directory),
171
- }, command.force);
172
+ }, command.force, path.join(root, "pnpm-workspace.yaml"));
172
173
  return 0;
173
174
  }
174
175
  // Create: a typed or derived name, else the terminal's answer for the working directory itself.
@@ -190,12 +191,14 @@ async function run(argv) {
190
191
  /**
191
192
  * Write one created installation into `directory`, then list the written files and the next steps. A non-empty directory is refused unless `force` is set, which writes over same-path files and keeps every other file.
192
193
  */
193
- function write(directory, props, force) {
194
+ function write(directory, props, force, workspaceFile) {
194
195
  const files = (0, template_1.createAutoMovieScaffold)(props);
195
196
  if (force === false &&
196
197
  fs.existsSync(directory) &&
197
198
  fs.readdirSync(directory).length !== 0)
198
199
  throw new Error(`${directory} is not empty; pass --force to write into it, replacing same-path files.`);
200
+ if (workspaceFile !== undefined)
201
+ completeCatalogs(workspaceFile);
199
202
  for (const [relative, content] of Object.entries(files)) {
200
203
  const file = path.join(directory, relative);
201
204
  fs.mkdirSync(path.dirname(file), { recursive: true });
@@ -207,6 +210,39 @@ function write(directory, props, force) {
207
210
  .join("\n") +
208
211
  (0, renderAutoMovieScaffoldNextSteps_1.renderAutoMovieScaffoldNextSteps)(directory, props.kind));
209
212
  }
213
+ /** Replace an incomplete catalog atomically. A concurrent updater or editor leaves this invocation free to retry. */
214
+ function completeCatalogs(file) {
215
+ const target = fs.realpathSync(file);
216
+ const source = fs.readFileSync(target, "utf8");
217
+ const next = (0, template_1.renderAutoMovieWorkspace)({
218
+ directory: path.dirname(file),
219
+ source,
220
+ });
221
+ if (next === source)
222
+ return;
223
+ const pending = `${target}.${(0, node_crypto_1.randomUUID)()}.tmp`;
224
+ const descriptor = fs.openSync(pending, "wx", fs.statSync(target).mode);
225
+ let renamed = false;
226
+ try {
227
+ try {
228
+ fs.writeFileSync(descriptor, next);
229
+ }
230
+ finally {
231
+ fs.closeSync(descriptor);
232
+ }
233
+ const current = fs.readFileSync(target, "utf8");
234
+ if (current === next)
235
+ return;
236
+ if (current !== source)
237
+ throw new Error(`${file} changed during add. Run the command again.`);
238
+ fs.renameSync(pending, target);
239
+ renamed = true;
240
+ }
241
+ finally {
242
+ if (!renamed)
243
+ fs.unlinkSync(pending);
244
+ }
245
+ }
210
246
  /**
211
247
  * This package's version, read at runtime from the sibling `package.json` (`require`, not an `import`, so it stays outside `rootDir`). `__dirname` resolves to `src` under ttsx and `lib` when published; the file sits one level up in both.
212
248
  */
package/lib/run.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAG6B;AAC7B,MAAY,EAAE,oCAAgB;AAC9B,MAAY,IAAI,sCAAkB;AAGlC,yDAAsD;AACtD,6EAA0E;AAC1E,yDAAsD;AACtD,6EAA0E;AAC1E,mFAAgF;AAChF,uDAAoD;AACpD,yFAAsF;AACtF,uDAAoD;AACpD,6EAA0E;AAE1E,MAAM,KAAK,GAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACI,KAAK,cAAc,IAAuB;IAC/C,IAAI,CAAC;QACH,MAAM,OAAO,GAAqB,IAAA,6DAA6B,EAC7D,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CACd,CAAC;QACF,IAAI,OAAO,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;YAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC5B,OAAO,CAAC,CAAC;QACX,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,KAAK,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CAC3C,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CACpB,CAAC;IACzB,OAAO,QAAQ,CAAC,OAAO,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,KAAc;IACnC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAiB,IAAI,GAAG,EAAE,CAAC;IACrC,IAAI,OAAO,GAAY,KAAK,CAAC;IAC7B,OAAO,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,EAAE,CAAC;QAC5D,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAClB,MAAM,OAAO,GACX,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC/D,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,OAAO,EAAE,CAAC,CAAC;QACrE,OAAO,GAAG,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACjE,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automovie",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Scaffold a coding-agent-first AutoMovie production repository.",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -38,10 +38,10 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@automovie/template": "^0.2.0"
41
+ "@automovie/template": "^0.3.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@automovie/render": "^0.2.0",
44
+ "@automovie/render": "^0.3.0",
45
45
  "ffmpeg-static": "^5.2.0",
46
46
  "playwright-core": "^1.60.0",
47
47
  "vite": "^5.4.10"
@@ -61,13 +61,13 @@
61
61
  }
62
62
  },
63
63
  "devDependencies": {
64
- "@automovie/render": "^0.2.0",
65
- "@ttsc/evidence": "^0.37.0",
64
+ "@automovie/render": "^0.3.0",
65
+ "@ttsc/evidence": "^0.37.1",
66
66
  "@types/node": "^22.19.17",
67
67
  "rimraf": "^6.0.1",
68
- "ttsc": "^0.37.0",
68
+ "ttsc": "^0.37.1",
69
69
  "typescript": "^7.0.2",
70
- "@ttsc/lint": "^0.37.0",
70
+ "@ttsc/lint": "^0.37.1",
71
71
  "@wrtnlabs/evidence": "^0.8.2"
72
72
  },
73
73
  "scripts": {
@@ -1,3 +1,10 @@
1
+ import type {
2
+ IAutoMovieCaptureCell,
3
+ IAutoMovieCaptureDrawing,
4
+ IAutoMovieCapturePlan,
5
+ IAutoMovieCapturePlanRequest,
6
+ IAutoMovieCaptureRecord,
7
+ } from "@automovie/interface";
1
8
  import type * as Render from "@automovie/render";
2
9
  import * as fs from "node:fs/promises";
3
10
  import * as path from "node:path";
@@ -129,11 +136,11 @@ export class AutoMovieCaptureHost {
129
136
  /**
130
137
  * Open a fresh page of the served draw page with a subject and its props injected before it loads, and describe the subject through it.
131
138
  *
132
- * The returned session owns the page; the caller closes it. A page that installs no draw function or cannot describe its subject rejects, and the page is closed first.
139
+ * The returned session owns the page; the caller closes it. An uncaught browser error during initialization rejects immediately with the original cause and logs its stack; console errors are forwarded too. A page that installs no draw function or cannot describe its subject rejects, and the page is closed first.
133
140
  *
134
141
  * @evidence contracts/development/common.md#meaningful-documentation States what is opened and injected, who closes it, and the refusal.
135
142
  * @evidence contracts/development/implementation.md#principled-implementation Every picture of a capture or a render comes through one such session, so both hosts draw through the same function.
136
- * @evidence contracts/development/implementation.md#clear-and-simple-structure One page, one session open, one close on failure.
143
+ * @evidence contracts/development/implementation.md#clear-and-simple-structure Observe the browser, race opening against a script failure, and close the page on rejection.
137
144
  * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A failed open is reported, never retried.
138
145
  * @evidence contracts/development/implementation.md#efficient-algorithms One page per call.
139
146
  * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each call is a fresh page, because props differ between subjects.
@@ -146,15 +153,40 @@ export class AutoMovieCaptureHost {
146
153
  /** Data the subject module reads, as JSON, or null. */
147
154
  props: unknown;
148
155
  }): Promise<Render.AutoMovieDrawSession> {
149
- const page: Render.IAutoMovieDrawPage = await this.browser.newPage();
150
- try {
151
- return await this.render.AutoMovieDrawSession.open({
152
- page,
153
- url: this.page.url,
154
- props: { subject: props.subject, props: props.props },
155
- backend: this.backend,
156
- timeout: TIMEOUT,
156
+ const page: Awaited<ReturnType<IAutoMovieChromium.IBrowser["newPage"]>> =
157
+ await this.browser.newPage();
158
+
159
+ // A module can fail before installing the draw port, leaving only a timeout.
160
+ // Forward its original browser error while the failed page is still alive.
161
+ const failed: Promise<never> = new Promise((_resolve, reject): void => {
162
+ page.on?.("pageerror", (error: Error): void => {
163
+ console.error("Draw page error:", error.stack ?? error.message);
164
+ reject(
165
+ new Error(
166
+ `The draw page at ${this.page.url} failed during initialization`,
167
+ { cause: error },
168
+ ),
169
+ );
157
170
  });
171
+ });
172
+ page.on?.(
173
+ "console",
174
+ (message: { type(): string; text(): string }): void => {
175
+ if (message.type() === "error")
176
+ console.error("Draw page console:", message.text());
177
+ },
178
+ );
179
+ try {
180
+ return await Promise.race([
181
+ this.render.AutoMovieDrawSession.open({
182
+ page,
183
+ url: this.page.url,
184
+ props: { subject: props.subject, props: props.props },
185
+ backend: this.backend,
186
+ timeout: TIMEOUT,
187
+ }),
188
+ failed,
189
+ ]);
158
190
  } catch (error) {
159
191
  await page.close();
160
192
  throw error;
@@ -176,7 +208,7 @@ export class AutoMovieCaptureHost {
176
208
  */
177
209
  public async capture(props: {
178
210
  /** The request, as `parseAutoMovieCapturePlanRequest` read it. */
179
- request: Render.IAutoMovieCapturePlanRequest;
211
+ request: IAutoMovieCapturePlanRequest;
180
212
 
181
213
  /** Data the subject module reads, as JSON, or null. */
182
214
  props: unknown;
@@ -186,14 +218,14 @@ export class AutoMovieCaptureHost {
186
218
 
187
219
  /** The subject owner's own section of the record, or absent. */
188
220
  section?: Readonly<Record<string, unknown>>;
189
- }): Promise<Extract<Render.IAutoMovieCaptureRecord, { state: "complete" }>> {
221
+ }): Promise<Extract<IAutoMovieCaptureRecord, { state: "complete" }>> {
190
222
  const { render } = this;
191
223
  const session: Render.AutoMovieDrawSession = await this.session({
192
224
  subject: props.request.subject,
193
225
  props: props.props,
194
226
  });
195
227
  try {
196
- const plan: Render.IAutoMovieCapturePlan = render.planAutoMovieCapture({
228
+ const plan: IAutoMovieCapturePlan = render.planAutoMovieCapture({
197
229
  request: props.request,
198
230
  subject: session.subject,
199
231
  cuts: [],
@@ -211,9 +243,8 @@ export class AutoMovieCaptureHost {
211
243
  return await render.runAutoMovieCapture({
212
244
  plan,
213
245
  draw: (
214
- cell: Render.IAutoMovieCaptureCell,
215
- ): Promise<Render.IAutoMovieCaptureDrawing> =>
216
- session.drawing(cell, plan),
246
+ cell: IAutoMovieCaptureCell,
247
+ ): Promise<IAutoMovieCaptureDrawing> => session.drawing(cell, plan),
217
248
  folder,
218
249
  revision: readAutoMovieRevision(this.root),
219
250
  match: "cell",
@@ -60,7 +60,18 @@ export namespace IAutoMovieChromium {
60
60
  * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work A signature has no body; Playwright answers.
61
61
  * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources A signature has no body; Playwright answers.
62
62
  */
63
- newPage(): Promise<IAutoMovieDrawPage>;
63
+ newPage(): Promise<
64
+ IAutoMovieDrawPage & {
65
+ /** Optional browser diagnostics; portable draw-only drivers need not emit browser events. */
66
+ on?: {
67
+ (event: "pageerror", listener: (error: Error) => void): unknown;
68
+ (
69
+ event: "console",
70
+ listener: (message: { type(): string; text(): string }) => void,
71
+ ): unknown;
72
+ };
73
+ }
74
+ >;
64
75
 
65
76
  /**
66
77
  * End the browser and every page it holds.
@@ -1,3 +1,9 @@
1
+ import type {
2
+ IAutoMovieCaptureCellComparison,
3
+ IAutoMovieCaptureCellRecord,
4
+ IAutoMovieCapturePlanRequest,
5
+ IAutoMovieCaptureRecord,
6
+ } from "@automovie/interface";
1
7
  import type * as Render from "@automovie/render";
2
8
  import * as fs from "node:fs/promises";
3
9
  import * as path from "node:path";
@@ -44,10 +50,10 @@ export async function captureAutoMovie(props: {
44
50
  readAutoMovieCaptureHostOptions(
45
51
  render.readAutoMovieCaptureArguments(props.args),
46
52
  );
47
- const request: Render.IAutoMovieCapturePlanRequest =
53
+ const request: IAutoMovieCapturePlanRequest =
48
54
  render.parseAutoMovieCapturePlanRequest(options.request);
49
55
 
50
- let record: Extract<Render.IAutoMovieCaptureRecord, { state: "complete" }>;
56
+ let record: Extract<IAutoMovieCaptureRecord, { state: "complete" }>;
51
57
  let backend: string;
52
58
  let folder: string;
53
59
  if (options.file !== null) {
@@ -112,30 +118,26 @@ export async function captureAutoMovie(props: {
112
118
  }
113
119
 
114
120
  // What was written, and what was not drawn.
115
- const failed: Extract<
116
- Render.IAutoMovieCaptureRecord.Row,
117
- { state: "failed" }
118
- >[] = record.rows.filter(
119
- (
120
- row: Render.IAutoMovieCaptureRecord.Row,
121
- ): row is Extract<
122
- Render.IAutoMovieCaptureRecord.Row,
123
- { state: "failed" }
124
- > => row.state === "failed",
125
- );
121
+ const failed: Extract<IAutoMovieCaptureCellRecord, { state: "failed" }>[] =
122
+ record.rows.filter(
123
+ (
124
+ row: IAutoMovieCaptureCellRecord,
125
+ ): row is Extract<IAutoMovieCaptureCellRecord, { state: "failed" }> =>
126
+ row.state === "failed",
127
+ );
126
128
  const lines: string[] = [
127
129
  `capture ${record.subject.name}: ${record.rows.length - failed.length} of ${record.rows.length} cells drawn into ${folder}`,
128
130
  `backend ${backend}`,
129
131
  ...record.sheets.map((sheet: string): string => path.join(folder, sheet)),
130
132
  ...failed.map(
131
133
  (
132
- row: Extract<Render.IAutoMovieCaptureRecord.Row, { state: "failed" }>,
134
+ row: Extract<IAutoMovieCaptureCellRecord, { state: "failed" }>,
133
135
  ): string => `not drawn ${row.name}: ${row.cause}`,
134
136
  ),
135
137
  ...(record.comparison === null
136
138
  ? []
137
139
  : record.comparison.entries.flatMap(
138
- (entry: Render.IAutoMovieCaptureComparison.Entry): string[] =>
140
+ (entry: IAutoMovieCaptureCellComparison): string[] =>
139
141
  entry.state === "unmatched"
140
142
  ? [`unmatched ${entry.current ?? entry.earlier}: ${entry.cause}`]
141
143
  : entry.mode === "difference" && entry.changed !== 0
@@ -1,3 +1,4 @@
1
+ import type { IAutoMovieCapturePlanRequest } from "@automovie/interface";
1
2
  import type * as Render from "@automovie/render";
2
3
  import * as fs from "node:fs";
3
4
  import * as path from "node:path";
@@ -36,7 +37,7 @@ export async function inspectAutoMovie(props: {
36
37
  readAutoMovieInspectHostOptions(
37
38
  render.readAutoMovieCaptureArguments(props.args),
38
39
  );
39
- const request: Render.IAutoMovieCapturePlanRequest =
40
+ const request: IAutoMovieCapturePlanRequest =
40
41
  render.parseAutoMovieCapturePlanRequest(options.request);
41
42
 
42
43
  // The module's props, read before anything is served.
@@ -64,7 +64,7 @@ interface IRecordingLocator {
64
64
  *
65
65
  * The browser draws on the GPU backend, since playback is judged in real time; the recording is Playwright's own video of the page at a 1280 by 900 viewport, which `npx playwright-core install ffmpeg` provides. The page's Play button is found by its role and name, and the readout as the `output` showing `<second> / <duration> s`, both as the inspector renders them. The readout is read at most every half second for `seconds` of wall time after the click, and the page's script errors are collected. The video begins at navigation, so it includes the page's preparation; a reading's elapsed seconds count from the click.
66
66
  *
67
- * It rejects when the page shows no Play button or readout within ten minutes and when the browser produced no video. The browser is closed on every outcome.
67
+ * An uncaught page error before the controls are ready rejects immediately with that error as its cause; every page error also prints its stack, so a failed preparation leaves a usable diagnostic. It rejects when the page shows no Play button or readout within ten minutes and when the browser produced no video. Errors during playback remain in the returned report. The browser is closed on every outcome.
68
68
  *
69
69
  * @evidence contracts/development/common.md#meaningful-documentation States what is recorded and how, which backend and why, how the controls are found, the reading cadence, the clocks of the video and the readings, the refusals and the release.
70
70
  * @evidence contracts/development/implementation.md#principled-implementation Playback is observed on the page a person uses, through its own controls, so the recording shows the real loop's pacing instead of seeks turned into a supposed playback; Playwright closes the context to finish writing the video.
@@ -125,12 +125,17 @@ export async function recordAutoMoviePlayback(props: {
125
125
  });
126
126
  const page: IRecordingPage = await context.newPage();
127
127
  const errors: string[] = [];
128
- page.on("pageerror", (error: Error): void => {
129
- errors.push(error.message);
130
- });
131
- await page.goto(props.url, {
132
- waitUntil: "domcontentloaded",
133
- timeout: PREPARE,
128
+ const failed: Promise<never> = new Promise((_resolve, reject): void => {
129
+ page.on("pageerror", (error: Error): void => {
130
+ errors.push(error.message);
131
+ console.error("Inspector page error:", error.stack ?? error.message);
132
+ reject(
133
+ new Error(
134
+ `The inspector page at ${props.url} failed during initialization`,
135
+ { cause: error },
136
+ ),
137
+ );
138
+ });
134
139
  });
135
140
  const play: IRecordingLocator = page
136
141
  .getByRole("button", { name: "Play", exact: true })
@@ -138,8 +143,17 @@ export async function recordAutoMoviePlayback(props: {
138
143
  const readout: IRecordingLocator = page
139
144
  .locator("output", { hasText: READOUT })
140
145
  .first();
141
- await play.waitFor({ timeout: PREPARE });
142
- await readout.waitFor({ timeout: PREPARE });
146
+ await Promise.race([
147
+ (async (): Promise<void> => {
148
+ await page.goto(props.url, {
149
+ waitUntil: "domcontentloaded",
150
+ timeout: PREPARE,
151
+ });
152
+ await play.waitFor({ timeout: PREPARE });
153
+ await readout.waitFor({ timeout: PREPARE });
154
+ })(),
155
+ failed,
156
+ ]);
143
157
 
144
158
  // Press Play and read the readout for the observed seconds.
145
159
  await play.click();
@@ -1,3 +1,4 @@
1
+ import type { IAutoMovieCapturePlanRequest } from "@automovie/interface";
1
2
  import type * as Render from "@automovie/render";
2
3
  import * as fs from "node:fs/promises";
3
4
  import * as path from "node:path";
@@ -42,7 +43,7 @@ export async function renderAutoMovie(props: {
42
43
  );
43
44
 
44
45
  // The request names the subject; a render draws its whole clock through its own camera, so no other key applies.
45
- const request: Render.IAutoMovieCapturePlanRequest =
46
+ const request: IAutoMovieCapturePlanRequest =
46
47
  render.parseAutoMovieCapturePlanRequest(options.request);
47
48
  for (const key of options.request.keys())
48
49
  if (key !== "subject")
package/src/run.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import {
2
2
  type IAutoMovieScaffoldProps,
3
3
  createAutoMovieScaffold,
4
+ renderAutoMovieWorkspace,
4
5
  } from "@automovie/template";
6
+ import { randomUUID } from "node:crypto";
5
7
  import * as fs from "node:fs";
6
8
  import * as path from "node:path";
7
9
 
@@ -77,7 +79,7 @@ Options:
77
79
  *
78
80
  * - `help` and `version` write to stdout; the version is read from this package's `package.json`.
79
81
  * - `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.
80
- * - `add` requires `pnpm-workspace.yaml` in the working directory, which it takes as the workspace root without searching elsewhere, and writes 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.
82
+ * - `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.
81
83
  * - `capture` runs `captureAutoMovie` in the working directory as the production, resolving to its status: 1 when a cell was not drawn.
82
84
  * - `inspect` runs `inspectAutoMovie` in the working directory, serving the inspector page until the process is interrupted.
83
85
  * - `render` runs `renderAutoMovie` in the working directory as the production, resolving to 0 once the video is written.
@@ -147,6 +149,7 @@ export async function run(argv: readonly string[]): Promise<number> {
147
149
  name: command.name ?? deriveAutoMovieProjectName(command.directory),
148
150
  },
149
151
  command.force,
152
+ path.join(root, "pnpm-workspace.yaml"),
150
153
  );
151
154
  return 0;
152
155
  }
@@ -179,6 +182,7 @@ function write(
179
182
  directory: string,
180
183
  props: IAutoMovieScaffoldProps,
181
184
  force: boolean,
185
+ workspaceFile?: string,
182
186
  ): void {
183
187
  const files: Record<string, string> = createAutoMovieScaffold(props);
184
188
  if (
@@ -189,6 +193,7 @@ function write(
189
193
  throw new Error(
190
194
  `${directory} is not empty; pass --force to write into it, replacing same-path files.`,
191
195
  );
196
+ if (workspaceFile !== undefined) completeCatalogs(workspaceFile);
192
197
  for (const [relative, content] of Object.entries(files)) {
193
198
  const file: string = path.join(directory, relative);
194
199
  fs.mkdirSync(path.dirname(file), { recursive: true });
@@ -203,6 +208,39 @@ function write(
203
208
  );
204
209
  }
205
210
 
211
+ /** Replace an incomplete catalog atomically. A concurrent updater or editor leaves this invocation free to retry. */
212
+ function completeCatalogs(file: string): void {
213
+ const target: string = fs.realpathSync(file);
214
+ const source: string = fs.readFileSync(target, "utf8");
215
+ const next: string = renderAutoMovieWorkspace({
216
+ directory: path.dirname(file),
217
+ source,
218
+ });
219
+ if (next === source) return;
220
+ const pending: string = `${target}.${randomUUID()}.tmp`;
221
+ const descriptor: number = fs.openSync(
222
+ pending,
223
+ "wx",
224
+ fs.statSync(target).mode,
225
+ );
226
+ let renamed: boolean = false;
227
+ try {
228
+ try {
229
+ fs.writeFileSync(descriptor, next);
230
+ } finally {
231
+ fs.closeSync(descriptor);
232
+ }
233
+ const current: string = fs.readFileSync(target, "utf8");
234
+ if (current === next) return;
235
+ if (current !== source)
236
+ throw new Error(`${file} changed during add. Run the command again.`);
237
+ fs.renameSync(pending, target);
238
+ renamed = true;
239
+ } finally {
240
+ if (!renamed) fs.unlinkSync(pending);
241
+ }
242
+ }
243
+
206
244
  /**
207
245
  * This package's version, read at runtime from the sibling `package.json` (`require`, not an `import`, so it stays outside `rootDir`). `__dirname` resolves to `src` under ttsx and `lib` when published; the file sits one level up in both.
208
246
  */