automovie 0.0.0 → 0.2.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 +145 -18
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.d.ts +6 -0
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js +16 -0
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js.map +1 -0
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.d.ts +6 -0
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.js +14 -0
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.js.map +1 -0
- package/lib/AUTOMOVIE_RENDER_OPTIONS.d.ts +6 -0
- package/lib/AUTOMOVIE_RENDER_OPTIONS.js +15 -0
- package/lib/AUTOMOVIE_RENDER_OPTIONS.js.map +1 -0
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.d.ts +6 -0
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.js +14 -0
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.js.map +1 -0
- package/lib/AutoMovieCaptureBackend.d.ts +9 -0
- package/lib/{IAutoMoviePackageManager.js → AutoMovieCaptureBackend.js} +1 -1
- package/lib/AutoMovieCaptureBackend.js.map +1 -0
- package/lib/AutoMovieCaptureHost.d.ts +114 -0
- package/lib/AutoMovieCaptureHost.js +219 -0
- package/lib/AutoMovieCaptureHost.js.map +1 -0
- package/lib/AutoMovieCommand.d.ts +24 -13
- package/lib/IAutoMovieChromium.d.ts +75 -0
- package/lib/IAutoMovieChromium.js +3 -0
- package/lib/IAutoMovieChromium.js.map +1 -0
- package/lib/captureAutoMovie.d.ts +23 -0
- package/lib/captureAutoMovie.js +133 -0
- package/lib/captureAutoMovie.js.map +1 -0
- package/lib/deriveAutoMovieProjectName.d.ts +1 -1
- package/lib/deriveAutoMovieProjectName.js +1 -1
- package/lib/findAutoMovieFreePort.d.ts +14 -0
- package/lib/findAutoMovieFreePort.js +61 -0
- package/lib/findAutoMovieFreePort.js.map +1 -0
- package/lib/formatAutoMovieInspectUrl.d.ts +14 -0
- package/lib/formatAutoMovieInspectUrl.js +24 -0
- package/lib/formatAutoMovieInspectUrl.js.map +1 -0
- package/lib/index.d.ts +30 -2
- package/lib/index.js +30 -2
- package/lib/index.js.map +1 -1
- package/lib/inspectAutoMovie.d.ts +19 -0
- package/lib/inspectAutoMovie.js +97 -0
- package/lib/inspectAutoMovie.js.map +1 -0
- package/lib/launchAutoMovieChromium.d.ts +28 -0
- package/lib/launchAutoMovieChromium.js +42 -0
- package/lib/launchAutoMovieChromium.js.map +1 -0
- package/lib/loadAutoMovieProductionModule.d.ts +14 -0
- package/lib/loadAutoMovieProductionModule.js +61 -0
- package/lib/loadAutoMovieProductionModule.js.map +1 -0
- package/lib/planAutoMovieChromiumLaunch.d.ts +27 -0
- package/lib/planAutoMovieChromiumLaunch.js +34 -0
- package/lib/planAutoMovieChromiumLaunch.js.map +1 -0
- package/lib/planAutoMovieModulePageViteConfig.d.ts +37 -0
- package/lib/planAutoMovieModulePageViteConfig.js +27 -0
- package/lib/planAutoMovieModulePageViteConfig.js.map +1 -0
- package/lib/readAutoMovieAddArguments.d.ts +1 -1
- package/lib/readAutoMovieAddArguments.js +1 -1
- package/lib/readAutoMovieCaptureHostOptions.d.ts +36 -0
- package/lib/readAutoMovieCaptureHostOptions.js +57 -0
- package/lib/readAutoMovieCaptureHostOptions.js.map +1 -0
- package/lib/readAutoMovieCommandArguments.d.ts +1 -1
- package/lib/readAutoMovieCommandArguments.js +10 -5
- package/lib/readAutoMovieCommandArguments.js.map +1 -1
- package/lib/readAutoMovieCreateArguments.d.ts +1 -1
- package/lib/readAutoMovieCreateArguments.js +1 -1
- package/lib/readAutoMovieInspectHostOptions.d.ts +29 -0
- package/lib/readAutoMovieInspectHostOptions.js +48 -0
- package/lib/readAutoMovieInspectHostOptions.js.map +1 -0
- package/lib/readAutoMovieRenderOptions.d.ts +33 -0
- package/lib/readAutoMovieRenderOptions.js +51 -0
- package/lib/readAutoMovieRenderOptions.js.map +1 -0
- package/lib/readAutoMovieReviewOptions.d.ts +27 -0
- package/lib/readAutoMovieReviewOptions.js +54 -0
- package/lib/readAutoMovieReviewOptions.js.map +1 -0
- package/lib/readAutoMovieRevision.d.ts +12 -0
- package/lib/readAutoMovieRevision.js +32 -0
- package/lib/readAutoMovieRevision.js.map +1 -0
- package/lib/readAutoMovieVideoProbe.d.ts +23 -0
- package/lib/readAutoMovieVideoProbe.js +39 -0
- package/lib/readAutoMovieVideoProbe.js.map +1 -0
- package/lib/recordAutoMoviePlayback.d.ts +37 -0
- package/lib/recordAutoMoviePlayback.js +122 -0
- package/lib/recordAutoMoviePlayback.js.map +1 -0
- package/lib/renderAutoMovie.d.ts +21 -0
- package/lib/renderAutoMovie.js +95 -0
- package/lib/renderAutoMovie.js.map +1 -0
- package/lib/renderAutoMovieScaffoldNextSteps.d.ts +3 -5
- package/lib/renderAutoMovieScaffoldNextSteps.js +5 -14
- package/lib/renderAutoMovieScaffoldNextSteps.js.map +1 -1
- package/lib/renderAutoMovieVideo.d.ts +35 -0
- package/lib/renderAutoMovieVideo.js +110 -0
- package/lib/renderAutoMovieVideo.js.map +1 -0
- package/lib/resolveAutoMovieFfmpeg.d.ts +19 -0
- package/lib/resolveAutoMovieFfmpeg.js +32 -0
- package/lib/resolveAutoMovieFfmpeg.js.map +1 -0
- package/lib/reviewAutoMovie.d.ts +21 -0
- package/lib/reviewAutoMovie.js +71 -0
- package/lib/reviewAutoMovie.js.map +1 -0
- package/lib/run.d.ts +14 -11
- package/lib/run.js +103 -67
- package/lib/run.js.map +1 -1
- package/lib/runAutoMovieFfmpeg.d.ts +14 -0
- package/lib/runAutoMovieFfmpeg.js +40 -0
- package/lib/runAutoMovieFfmpeg.js.map +1 -0
- package/lib/serveAutoMovieDrawPage.d.ts +28 -0
- package/lib/serveAutoMovieDrawPage.js +108 -0
- package/lib/serveAutoMovieDrawPage.js.map +1 -0
- package/lib/serveAutoMovieInspectorPage.d.ts +32 -0
- package/lib/serveAutoMovieInspectorPage.js +52 -0
- package/lib/serveAutoMovieInspectorPage.js.map +1 -0
- package/lib/writeAutoMovieModulePage.d.ts +38 -0
- package/lib/writeAutoMovieModulePage.js +75 -0
- package/lib/writeAutoMovieModulePage.js.map +1 -0
- package/package.json +27 -6
- package/src/AUTOMOVIE_CAPTURE_OPTIONS.ts +12 -0
- package/src/AUTOMOVIE_INSPECT_OPTIONS.ts +10 -0
- package/src/AUTOMOVIE_RENDER_OPTIONS.ts +11 -0
- package/src/AUTOMOVIE_REVIEW_OPTIONS.ts +10 -0
- package/src/AutoMovieCaptureBackend.ts +9 -0
- package/src/AutoMovieCaptureHost.ts +245 -0
- package/src/AutoMovieCommand.ts +28 -13
- package/src/IAutoMovieChromium.ts +78 -0
- package/src/captureAutoMovie.ts +148 -0
- package/src/deriveAutoMovieProjectName.ts +1 -1
- package/src/findAutoMovieFreePort.ts +27 -0
- package/src/formatAutoMovieInspectUrl.ts +25 -0
- package/src/index.ts +30 -2
- package/src/inspectAutoMovie.ts +81 -0
- package/src/launchAutoMovieChromium.ts +61 -0
- package/src/loadAutoMovieProductionModule.ts +30 -0
- package/src/planAutoMovieChromiumLaunch.ts +45 -0
- package/src/planAutoMovieModulePageViteConfig.ts +53 -0
- package/src/readAutoMovieAddArguments.ts +1 -1
- package/src/readAutoMovieCaptureHostOptions.ts +76 -0
- package/src/readAutoMovieCommandArguments.ts +6 -4
- package/src/readAutoMovieCreateArguments.ts +1 -1
- package/src/readAutoMovieInspectHostOptions.ts +66 -0
- package/src/readAutoMovieRenderOptions.ts +67 -0
- package/src/readAutoMovieReviewOptions.ts +70 -0
- package/src/readAutoMovieRevision.ts +29 -0
- package/src/readAutoMovieVideoProbe.ts +55 -0
- package/src/recordAutoMoviePlayback.ts +168 -0
- package/src/renderAutoMovie.ts +86 -0
- package/src/renderAutoMovieScaffoldNextSteps.ts +4 -18
- package/src/renderAutoMovieVideo.ts +127 -0
- package/src/resolveAutoMovieFfmpeg.ts +33 -0
- package/src/reviewAutoMovie.ts +65 -0
- package/src/run.ts +116 -105
- package/src/runAutoMovieFfmpeg.ts +50 -0
- package/src/serveAutoMovieDrawPage.ts +105 -0
- package/src/serveAutoMovieInspectorPage.ts +82 -0
- package/src/writeAutoMovieModulePage.ts +83 -0
- package/lib/IAutoMoviePackageManager.d.ts +0 -14
- package/lib/IAutoMoviePackageManager.js.map +0 -1
- package/lib/readAutoMovieSyncArguments.d.ts +0 -13
- package/lib/readAutoMovieSyncArguments.js +0 -49
- package/lib/readAutoMovieSyncArguments.js.map +0 -1
- package/lib/selectAutoMoviePackageManager.d.ts +0 -23
- package/lib/selectAutoMoviePackageManager.js +0 -70
- package/lib/selectAutoMoviePackageManager.js.map +0 -1
- package/src/IAutoMoviePackageManager.ts +0 -15
- package/src/readAutoMovieSyncArguments.ts +0 -48
- package/src/selectAutoMoviePackageManager.ts +0 -45
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IAutoMoviePackageManager.js","sourceRoot":"","sources":["../src/IAutoMoviePackageManager.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { AutoMovieCommand } from "./AutoMovieCommand";
|
|
2
|
-
/**
|
|
3
|
-
* Admit one explicit instruction-sync request before reading the production.
|
|
4
|
-
*
|
|
5
|
-
* @evidence contracts/development/implementation.md#principled-implementation A complete left-to-right token scan admits one target, at most one check flag and one nonblank baseline, rejecting unknown or repeated options before filesystem work.
|
|
6
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure This sync grammar is separate from create's and add's force semantics; run owns resolution and template owns planning/publication.
|
|
7
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No default target, wildcard expansion, force overwrite or inferred baseline is admitted; directory names beginning with a dash require ./ spelling.
|
|
8
|
-
* @evidence contracts/development/common.md#meaningful-documentation The comment identifies admission before reads, while errors give flag, value and target corrections.
|
|
9
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms One argument scan and value blank checks cost total input characters; the local positional list is bounded by argument count.
|
|
10
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work This pure parser owns no cross-request effects to reuse.
|
|
11
|
-
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Local strings/arrays expire after return and no handle or task is acquired.
|
|
12
|
-
*/
|
|
13
|
-
export declare function readAutoMovieSyncArguments(args: readonly string[]): AutoMovieCommand;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readAutoMovieSyncArguments = readAutoMovieSyncArguments;
|
|
4
|
-
/**
|
|
5
|
-
* Admit one explicit instruction-sync request before reading the production.
|
|
6
|
-
*
|
|
7
|
-
* @evidence contracts/development/implementation.md#principled-implementation A complete left-to-right token scan admits one target, at most one check flag and one nonblank baseline, rejecting unknown or repeated options before filesystem work.
|
|
8
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure This sync grammar is separate from create's and add's force semantics; run owns resolution and template owns planning/publication.
|
|
9
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No default target, wildcard expansion, force overwrite or inferred baseline is admitted; directory names beginning with a dash require ./ spelling.
|
|
10
|
-
* @evidence contracts/development/common.md#meaningful-documentation The comment identifies admission before reads, while errors give flag, value and target corrections.
|
|
11
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms One argument scan and value blank checks cost total input characters; the local positional list is bounded by argument count.
|
|
12
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work This pure parser owns no cross-request effects to reuse.
|
|
13
|
-
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Local strings/arrays expire after return and no handle or task is acquired.
|
|
14
|
-
*/
|
|
15
|
-
function readAutoMovieSyncArguments(args) {
|
|
16
|
-
const directories = [];
|
|
17
|
-
let check = false;
|
|
18
|
-
let baseline;
|
|
19
|
-
for (let index = 0; index < args.length; index++) {
|
|
20
|
-
const token = args[index];
|
|
21
|
-
if (token === "--check") {
|
|
22
|
-
if (check)
|
|
23
|
-
throw new Error("--check may be supplied only once for sync.");
|
|
24
|
-
check = true;
|
|
25
|
-
}
|
|
26
|
-
else if (token === "--baseline") {
|
|
27
|
-
if (baseline !== undefined)
|
|
28
|
-
throw new Error("--baseline may be supplied only once.");
|
|
29
|
-
const value = args[++index];
|
|
30
|
-
if (value === undefined || value.startsWith("-") || value.trim() === "")
|
|
31
|
-
throw new Error("--baseline needs one non-blank directory (spell a dash-leading directory as ./-name).");
|
|
32
|
-
baseline = value;
|
|
33
|
-
}
|
|
34
|
-
else if (token.startsWith("-")) {
|
|
35
|
-
throw new Error(`Unknown sync option ${JSON.stringify(token)}; sync accepts --check and --baseline.`);
|
|
36
|
-
}
|
|
37
|
-
else
|
|
38
|
-
directories.push(token);
|
|
39
|
-
}
|
|
40
|
-
if (directories.length !== 1 || directories[0].trim() === "")
|
|
41
|
-
throw new Error("sync needs exactly one non-blank target directory.");
|
|
42
|
-
return {
|
|
43
|
-
command: "sync",
|
|
44
|
-
directory: directories[0],
|
|
45
|
-
check,
|
|
46
|
-
...(baseline === undefined ? {} : { baseline }),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=readAutoMovieSyncArguments.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"readAutoMovieSyncArguments.js","sourceRoot":"","sources":["../src/readAutoMovieSyncArguments.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;GAUG;AACH,oCACE,IAAuB;IAEvB,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,IAAI,KAAK,GAAY,KAAK,CAAC;IAC3B,IAAI,QAA4B,CAAC;IACjC,KAAK,IAAI,KAAK,GAAW,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACzD,MAAM,KAAK,GAAW,IAAI,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,IAAI,KAAK;gBAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;YAC1E,KAAK,GAAG,IAAI,CAAC;QACf,CAAC;aAAM,IAAI,KAAK,KAAK,YAAY,EAAE,CAAC;YAClC,IAAI,QAAQ,KAAK,SAAS;gBACxB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;YAC3D,MAAM,KAAK,GAAuB,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;YAChD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;gBACrE,MAAM,IAAI,KAAK,CACb,uFAAuF,CACxF,CAAC;YACJ,QAAQ,GAAG,KAAK,CAAC;QACnB,CAAC;aAAM,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CACb,uBAAuB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,wCAAwC,CACrF,CAAC;QACJ,CAAC;;YAAM,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE;QAC1D,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,OAAO;QACL,OAAO,EAAE,MAAM;QACf,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;QACzB,KAAK;QACL,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;KAChD,CAAC;AACJ,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { IAutoMoviePackageManager } from "./IAutoMoviePackageManager";
|
|
2
|
-
/**
|
|
3
|
-
* Choose the package manager a freshly created single production is installed with, for its next-step text.
|
|
4
|
-
*
|
|
5
|
-
* The nearest `pnpm-workspace.yaml` at the target or one of its ancestors wins and is returned as `workspace`, because a production inside a pnpm workspace installs once with `pnpm install` at that root, as the production README states. Otherwise a `pnpm-lock.yaml` or `package-lock.json` already in the target decides, then a `pnpm/` prefix of `userAgent` (`npm_config_user_agent`, set by the invoking package manager); npm is the default the production README documents.
|
|
6
|
-
*
|
|
7
|
-
* @param props The absolute target directory and the invoking user agent, if any.
|
|
8
|
-
* @returns The manager, with the workspace root when one encloses the target.
|
|
9
|
-
*
|
|
10
|
-
* @evidence contracts/development/implementation.md#principled-implementation The enclosing workspace outranks how the CLI was launched, because `npx automovie create` inside a pnpm monorepo still lands in pnpm's install graph; a lockfile in the target outranks the launcher for the same reason.
|
|
11
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure One decision separate from the text rendering, with the environment passed in so `run` owns the process read.
|
|
12
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Only pnpm and npm are named, the two managers the scaffold documents; yarn, bun or an unknown agent fall back to the documented npm steps instead of guessed commands.
|
|
13
|
-
* @evidence contracts/development/common.md#meaningful-documentation The comment states the precedence, why the workspace wins, and the default.
|
|
14
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms One existence check per ancestor, linear in path depth, plus two in the target.
|
|
15
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work `run` calls this once per successful creation.
|
|
16
|
-
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Existence checks hold no handle and the result retains nothing.
|
|
17
|
-
*/
|
|
18
|
-
export declare function selectAutoMoviePackageManager(props: {
|
|
19
|
-
/** Absolute target directory. */
|
|
20
|
-
directory: string;
|
|
21
|
-
/** The invoking `npm_config_user_agent`, if any. */
|
|
22
|
-
userAgent?: string;
|
|
23
|
-
}): IAutoMoviePackageManager;
|
|
@@ -1,70 +0,0 @@
|
|
|
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.selectAutoMoviePackageManager = selectAutoMoviePackageManager;
|
|
37
|
-
const fs = __importStar(require("node:fs"));
|
|
38
|
-
const path = __importStar(require("node:path"));
|
|
39
|
-
/**
|
|
40
|
-
* Choose the package manager a freshly created single production is installed with, for its next-step text.
|
|
41
|
-
*
|
|
42
|
-
* The nearest `pnpm-workspace.yaml` at the target or one of its ancestors wins and is returned as `workspace`, because a production inside a pnpm workspace installs once with `pnpm install` at that root, as the production README states. Otherwise a `pnpm-lock.yaml` or `package-lock.json` already in the target decides, then a `pnpm/` prefix of `userAgent` (`npm_config_user_agent`, set by the invoking package manager); npm is the default the production README documents.
|
|
43
|
-
*
|
|
44
|
-
* @param props The absolute target directory and the invoking user agent, if any.
|
|
45
|
-
* @returns The manager, with the workspace root when one encloses the target.
|
|
46
|
-
*
|
|
47
|
-
* @evidence contracts/development/implementation.md#principled-implementation The enclosing workspace outranks how the CLI was launched, because `npx automovie create` inside a pnpm monorepo still lands in pnpm's install graph; a lockfile in the target outranks the launcher for the same reason.
|
|
48
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure One decision separate from the text rendering, with the environment passed in so `run` owns the process read.
|
|
49
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Only pnpm and npm are named, the two managers the scaffold documents; yarn, bun or an unknown agent fall back to the documented npm steps instead of guessed commands.
|
|
50
|
-
* @evidence contracts/development/common.md#meaningful-documentation The comment states the precedence, why the workspace wins, and the default.
|
|
51
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms One existence check per ancestor, linear in path depth, plus two in the target.
|
|
52
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work `run` calls this once per successful creation.
|
|
53
|
-
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Existence checks hold no handle and the result retains nothing.
|
|
54
|
-
*/
|
|
55
|
-
function selectAutoMoviePackageManager(props) {
|
|
56
|
-
for (let current = path.resolve(props.directory);; current = path.dirname(current)) {
|
|
57
|
-
if (fs.existsSync(path.join(current, "pnpm-workspace.yaml")))
|
|
58
|
-
return { manager: "pnpm", workspace: current };
|
|
59
|
-
if (path.dirname(current) === current)
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
if (fs.existsSync(path.join(props.directory, "pnpm-lock.yaml")))
|
|
63
|
-
return { manager: "pnpm" };
|
|
64
|
-
if (fs.existsSync(path.join(props.directory, "package-lock.json")))
|
|
65
|
-
return { manager: "npm" };
|
|
66
|
-
return {
|
|
67
|
-
manager: props.userAgent?.startsWith("pnpm/") === true ? "pnpm" : "npm",
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=selectAutoMoviePackageManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"selectAutoMoviePackageManager.js","sourceRoot":"","sources":["../src/selectAutoMoviePackageManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,EAAE,oCAAgB;AAC9B,MAAY,IAAI,sCAAkB;AAIlC;;;;;;;;;;;;;;;GAeG;AACH,uCAA8C,KAM7C;IACC,KACE,IAAI,OAAO,GAAW,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,GAEnD,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAC/B,CAAC;QACD,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;YAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;QACjD,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,OAAO;YAAE,MAAM;IAC/C,CAAC;IACD,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;QAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAC7B,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;QAChE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK;KACxE,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The package manager a created production's next steps name, with the enclosing pnpm workspace root when one exists.
|
|
3
|
-
*
|
|
4
|
-
* @evidence contracts/development/design.md#principled-representation The manager and the optional workspace root are exactly what `renderAutoMovieScaffoldNextSteps` needs to print the install location and script commands.
|
|
5
|
-
* @evidence contracts/development/design.md#minimal-and-owned-surface A closed pair of managers, the two the scaffold documents; `selectAutoMoviePackageManager` produces it and the next-steps renderer consumes it.
|
|
6
|
-
* @evidence contracts/development/design.md#prohibited-design-shortcuts No free-form manager string or command template lets a caller print undocumented commands.
|
|
7
|
-
* @evidence contracts/development/common.md#meaningful-documentation Each member states what it controls in the printed steps.
|
|
8
|
-
*/
|
|
9
|
-
export interface IAutoMoviePackageManager {
|
|
10
|
-
/** The manager whose install and script commands the next steps print. */
|
|
11
|
-
manager: "npm" | "pnpm";
|
|
12
|
-
|
|
13
|
-
/** Absolute root of the enclosing pnpm workspace, where `pnpm install` runs. */
|
|
14
|
-
workspace?: string;
|
|
15
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { AutoMovieCommand } from "./AutoMovieCommand";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Admit one explicit instruction-sync request before reading the production.
|
|
5
|
-
*
|
|
6
|
-
* @evidence contracts/development/implementation.md#principled-implementation A complete left-to-right token scan admits one target, at most one check flag and one nonblank baseline, rejecting unknown or repeated options before filesystem work.
|
|
7
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure This sync grammar is separate from create's and add's force semantics; run owns resolution and template owns planning/publication.
|
|
8
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No default target, wildcard expansion, force overwrite or inferred baseline is admitted; directory names beginning with a dash require ./ spelling.
|
|
9
|
-
* @evidence contracts/development/common.md#meaningful-documentation The comment identifies admission before reads, while errors give flag, value and target corrections.
|
|
10
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms One argument scan and value blank checks cost total input characters; the local positional list is bounded by argument count.
|
|
11
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work This pure parser owns no cross-request effects to reuse.
|
|
12
|
-
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Local strings/arrays expire after return and no handle or task is acquired.
|
|
13
|
-
*/
|
|
14
|
-
export function readAutoMovieSyncArguments(
|
|
15
|
-
args: readonly string[],
|
|
16
|
-
): AutoMovieCommand {
|
|
17
|
-
const directories: string[] = [];
|
|
18
|
-
let check: boolean = false;
|
|
19
|
-
let baseline: string | undefined;
|
|
20
|
-
for (let index: number = 0; index < args.length; index++) {
|
|
21
|
-
const token: string = args[index];
|
|
22
|
-
if (token === "--check") {
|
|
23
|
-
if (check) throw new Error("--check may be supplied only once for sync.");
|
|
24
|
-
check = true;
|
|
25
|
-
} else if (token === "--baseline") {
|
|
26
|
-
if (baseline !== undefined)
|
|
27
|
-
throw new Error("--baseline may be supplied only once.");
|
|
28
|
-
const value: string | undefined = args[++index];
|
|
29
|
-
if (value === undefined || value.startsWith("-") || value.trim() === "")
|
|
30
|
-
throw new Error(
|
|
31
|
-
"--baseline needs one non-blank directory (spell a dash-leading directory as ./-name).",
|
|
32
|
-
);
|
|
33
|
-
baseline = value;
|
|
34
|
-
} else if (token.startsWith("-")) {
|
|
35
|
-
throw new Error(
|
|
36
|
-
`Unknown sync option ${JSON.stringify(token)}; sync accepts --check and --baseline.`,
|
|
37
|
-
);
|
|
38
|
-
} else directories.push(token);
|
|
39
|
-
}
|
|
40
|
-
if (directories.length !== 1 || directories[0].trim() === "")
|
|
41
|
-
throw new Error("sync needs exactly one non-blank target directory.");
|
|
42
|
-
return {
|
|
43
|
-
command: "sync",
|
|
44
|
-
directory: directories[0],
|
|
45
|
-
check,
|
|
46
|
-
...(baseline === undefined ? {} : { baseline }),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import * as fs from "node:fs";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
|
|
4
|
-
import type { IAutoMoviePackageManager } from "./IAutoMoviePackageManager";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Choose the package manager a freshly created single production is installed with, for its next-step text.
|
|
8
|
-
*
|
|
9
|
-
* The nearest `pnpm-workspace.yaml` at the target or one of its ancestors wins and is returned as `workspace`, because a production inside a pnpm workspace installs once with `pnpm install` at that root, as the production README states. Otherwise a `pnpm-lock.yaml` or `package-lock.json` already in the target decides, then a `pnpm/` prefix of `userAgent` (`npm_config_user_agent`, set by the invoking package manager); npm is the default the production README documents.
|
|
10
|
-
*
|
|
11
|
-
* @param props The absolute target directory and the invoking user agent, if any.
|
|
12
|
-
* @returns The manager, with the workspace root when one encloses the target.
|
|
13
|
-
*
|
|
14
|
-
* @evidence contracts/development/implementation.md#principled-implementation The enclosing workspace outranks how the CLI was launched, because `npx automovie create` inside a pnpm monorepo still lands in pnpm's install graph; a lockfile in the target outranks the launcher for the same reason.
|
|
15
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure One decision separate from the text rendering, with the environment passed in so `run` owns the process read.
|
|
16
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Only pnpm and npm are named, the two managers the scaffold documents; yarn, bun or an unknown agent fall back to the documented npm steps instead of guessed commands.
|
|
17
|
-
* @evidence contracts/development/common.md#meaningful-documentation The comment states the precedence, why the workspace wins, and the default.
|
|
18
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms One existence check per ancestor, linear in path depth, plus two in the target.
|
|
19
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work `run` calls this once per successful creation.
|
|
20
|
-
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Existence checks hold no handle and the result retains nothing.
|
|
21
|
-
*/
|
|
22
|
-
export function selectAutoMoviePackageManager(props: {
|
|
23
|
-
/** Absolute target directory. */
|
|
24
|
-
directory: string;
|
|
25
|
-
|
|
26
|
-
/** The invoking `npm_config_user_agent`, if any. */
|
|
27
|
-
userAgent?: string;
|
|
28
|
-
}): IAutoMoviePackageManager {
|
|
29
|
-
for (
|
|
30
|
-
let current: string = path.resolve(props.directory);
|
|
31
|
-
;
|
|
32
|
-
current = path.dirname(current)
|
|
33
|
-
) {
|
|
34
|
-
if (fs.existsSync(path.join(current, "pnpm-workspace.yaml")))
|
|
35
|
-
return { manager: "pnpm", workspace: current };
|
|
36
|
-
if (path.dirname(current) === current) break;
|
|
37
|
-
}
|
|
38
|
-
if (fs.existsSync(path.join(props.directory, "pnpm-lock.yaml")))
|
|
39
|
-
return { manager: "pnpm" };
|
|
40
|
-
if (fs.existsSync(path.join(props.directory, "package-lock.json")))
|
|
41
|
-
return { manager: "npm" };
|
|
42
|
-
return {
|
|
43
|
-
manager: props.userAgent?.startsWith("pnpm/") === true ? "pnpm" : "npm",
|
|
44
|
-
};
|
|
45
|
-
}
|