automovie 0.0.0-stage → 0.0.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/LICENSE +21 -0
- package/README.md +37 -2
- package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.d.ts +4 -0
- package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.js +8 -0
- package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.js.map +1 -0
- package/lib/AutoMovieCommand.d.ts +48 -0
- package/lib/AutoMovieCommand.js +3 -0
- package/lib/AutoMovieCommand.js.map +1 -0
- package/lib/IAutoMoviePackageManager.d.ts +14 -0
- package/lib/IAutoMoviePackageManager.js +3 -0
- package/lib/IAutoMoviePackageManager.js.map +1 -0
- package/lib/bin.d.ts +2 -0
- package/lib/bin.js +11 -0
- package/lib/bin.js.map +1 -0
- package/lib/deriveAutoMovieProjectName.d.ts +16 -0
- package/lib/deriveAutoMovieProjectName.js +65 -0
- package/lib/deriveAutoMovieProjectName.js.map +1 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +30 -0
- package/lib/index.js.map +1 -0
- package/lib/promptAutoMovieProjectName.d.ts +16 -0
- package/lib/promptAutoMovieProjectName.js +69 -0
- package/lib/promptAutoMovieProjectName.js.map +1 -0
- package/lib/readAutoMovieAddArguments.d.ts +19 -0
- package/lib/readAutoMovieAddArguments.js +69 -0
- package/lib/readAutoMovieAddArguments.js.map +1 -0
- package/lib/readAutoMovieCommandArguments.d.ts +19 -0
- package/lib/readAutoMovieCommandArguments.js +46 -0
- package/lib/readAutoMovieCommandArguments.js.map +1 -0
- package/lib/readAutoMovieCreateArguments.d.ts +19 -0
- package/lib/readAutoMovieCreateArguments.js +62 -0
- package/lib/readAutoMovieCreateArguments.js.map +1 -0
- package/lib/readAutoMovieNameOption.d.ts +18 -0
- package/lib/readAutoMovieNameOption.js +26 -0
- package/lib/readAutoMovieNameOption.js.map +1 -0
- package/lib/readAutoMovieSyncArguments.d.ts +13 -0
- package/lib/readAutoMovieSyncArguments.js +49 -0
- package/lib/readAutoMovieSyncArguments.js.map +1 -0
- package/lib/renderAutoMovieScaffoldNextSteps.d.ts +20 -0
- package/lib/renderAutoMovieScaffoldNextSteps.js +48 -0
- package/lib/renderAutoMovieScaffoldNextSteps.js.map +1 -0
- package/lib/run.d.ts +24 -0
- package/lib/run.js +196 -0
- package/lib/run.js.map +1 -0
- package/lib/selectAutoMoviePackageManager.d.ts +23 -0
- package/lib/selectAutoMoviePackageManager.js +70 -0
- package/lib/selectAutoMoviePackageManager.js.map +1 -0
- package/lib/selectAutoMovieProjectName.d.ts +24 -0
- package/lib/selectAutoMovieProjectName.js +63 -0
- package/lib/selectAutoMovieProjectName.js.map +1 -0
- package/package.json +55 -3
- package/src/AUTOMOVIE_DEFAULT_PROJECT_NAME.ts +4 -0
- package/src/AutoMovieCommand.ts +64 -0
- package/src/IAutoMoviePackageManager.ts +15 -0
- package/src/bin.ts +9 -0
- package/src/deriveAutoMovieProjectName.ts +31 -0
- package/src/index.ts +13 -0
- package/src/promptAutoMovieProjectName.ts +35 -0
- package/src/readAutoMovieAddArguments.ts +77 -0
- package/src/readAutoMovieCommandArguments.ts +48 -0
- package/src/readAutoMovieCreateArguments.ts +62 -0
- package/src/readAutoMovieNameOption.ts +22 -0
- package/src/readAutoMovieSyncArguments.ts +48 -0
- package/src/renderAutoMovieScaffoldNextSteps.ts +58 -0
- package/src/run.ts +220 -0
- package/src/selectAutoMoviePackageManager.ts +45 -0
- package/src/selectAutoMovieProjectName.ts +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jeongho Nam
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
-
#
|
|
1
|
+
# automovie
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The command that starts an AutoMovie production. It installs the scaffold a coding agent works in: instructions, configuration and package dependencies, with no film content.
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
npx automovie create <directory> [--workspace] [--name <name>] [--force]
|
|
7
|
+
pnpm automovie add <shorts|series>/<name> [--name <name>] [--force]
|
|
8
|
+
npx automovie sync <directory> [--check] [--baseline <directory>]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The smallest use is `npx automovie create my-film`.
|
|
12
|
+
|
|
13
|
+
A generated production needs Node.js 22.23.2 or later, and a workspace also needs pnpm. The commands of the generated production are in its [README](../template/scaffold/production/README.md).
|
|
14
|
+
|
|
15
|
+
## `create`
|
|
16
|
+
|
|
17
|
+
`create` takes one target directory and installs a single production there. With `--workspace` it installs a pnpm workspace root instead: one shared `AGENTS.md`, `CLAUDE.md` and `.agents/skills`, and a `pnpm-workspace.yaml` whose members are `movies/shorts/*`, `movies/series/*` and `packages/*` and whose catalogs pin every production dependency.
|
|
18
|
+
|
|
19
|
+
The package name is `--name` when given and otherwise comes from the directory name. For the current directory (`create .`) the command asks for a name and offers `automovie-examples`, which it uses without asking when no terminal is attached.
|
|
20
|
+
|
|
21
|
+
## `add`
|
|
22
|
+
|
|
23
|
+
Run `add` from a workspace root, the directory that holds `pnpm-workspace.yaml`. It does not search parent directories. `add shorts/<name>` writes a production into `movies/shorts/<name>`, and `add series/<name>` into `movies/series/<name>`. A short is written as a brief and then the screenplay; a series is written in four layers: settings, treatments, scripts and screenplay. The new production takes its dependencies from the root's catalogs and its skills from the root's `.agents/skills`, so it gets no instruction copy of its own. `--name` sets the package name as in `create`.
|
|
24
|
+
|
|
25
|
+
## `sync`
|
|
26
|
+
|
|
27
|
+
Upgrading `automovie` never changes an installed project. `sync` is the explicit update, run on a single production or a workspace root. It rewrites `AGENTS.md`, `CLAUDE.md` and the bundled skill files, except the contracts, the checklists a production's code and writing answer. Contracts, your own skills, `PROJECT.md`, the README, configuration, source and written content stay as they are.
|
|
28
|
+
|
|
29
|
+
- `--check` writes nothing and exits 1 when updates or conflicts remain.
|
|
30
|
+
- `--baseline <directory>` names the instruction files the project was installed from. It is required when files differ and the project has no `.automovie/scaffold-state.json`, and it takes precedence over that state for the files it holds.
|
|
31
|
+
|
|
32
|
+
An instruction file you edited locally is reported as a conflict, and nothing is written until it is resolved. Resolve it by restoring the file and keeping your edit in a skill of your own, then run `sync` again. Instruction files that the new scaffold no longer ships are reported and kept.
|
|
33
|
+
|
|
34
|
+
## Other options
|
|
35
|
+
|
|
36
|
+
`create` and `add` refuse a non-empty target unless `--force` is given. With `--force`, files at the same paths are replaced.
|
|
37
|
+
|
|
38
|
+
`-h`, `--help`, `-v` and `--version` must each be the only argument. Any unknown command or option is refused before anything is written.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AUTOMOVIE_DEFAULT_PROJECT_NAME = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The project name used when none is typed and none can be derived: offered as the prompt's default, used as-is without a terminal, and the fallback for a directory name with no usable character.
|
|
6
|
+
*/
|
|
7
|
+
exports.AUTOMOVIE_DEFAULT_PROJECT_NAME = "automovie-examples";
|
|
8
|
+
//# sourceMappingURL=AUTOMOVIE_DEFAULT_PROJECT_NAME.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AUTOMOVIE_DEFAULT_PROJECT_NAME.js","sourceRoot":"","sources":["../src/AUTOMOVIE_DEFAULT_PROJECT_NAME.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,8BAA8B,GAAW,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One admitted CLI request, discriminated by `command`.
|
|
3
|
+
*
|
|
4
|
+
* `help` and `version` carry nothing because they are standalone requests. `create`, `add` and `sync` carry their targets exactly as typed; `run` resolves them against the working directory. An explicit `name` is carried as typed; `run` chooses the name when it is absent.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/development/design.md#principled-representation Each variant carries exactly what its command needs after admission, so `run` performs no further argument parsing.
|
|
7
|
+
* @evidence contracts/development/design.md#minimal-and-owned-surface A closed union over the command name lets `run` switch on one field, and the workspace family is a closed pair instead of a free path.
|
|
8
|
+
* @evidence contracts/development/design.md#prohibited-design-shortcuts No variant has an escape field for unparsed tokens.
|
|
9
|
+
* @evidence contracts/development/common.md#meaningful-documentation Every variant and member states its meaning and who resolves it.
|
|
10
|
+
*/
|
|
11
|
+
export type AutoMovieCommand = {
|
|
12
|
+
/** Print the usage text. */
|
|
13
|
+
command: "help";
|
|
14
|
+
} | {
|
|
15
|
+
/** Print this package's version. */
|
|
16
|
+
command: "version";
|
|
17
|
+
} | {
|
|
18
|
+
/** Install a single production, or with `workspace` a workspace root, into `directory`. */
|
|
19
|
+
command: "create";
|
|
20
|
+
/** Target directory as typed, never blank; `run` resolves it against the working directory. */
|
|
21
|
+
directory: string;
|
|
22
|
+
/** Install a pnpm workspace root instead of a single production. */
|
|
23
|
+
workspace: boolean;
|
|
24
|
+
/** Admit a non-empty target, as `publishFiles`' `force` option defines it. */
|
|
25
|
+
force: boolean;
|
|
26
|
+
/** Package name as typed; absent, `run` derives or asks for one. */
|
|
27
|
+
name?: string;
|
|
28
|
+
} | {
|
|
29
|
+
/** Add one production to the workspace whose root is the working directory. */
|
|
30
|
+
command: "add";
|
|
31
|
+
/** `shorts` for brief → screenplay, `series` for the whole long route. */
|
|
32
|
+
family: "shorts" | "series";
|
|
33
|
+
/** The production's directory under `movies/<family>`, one admitted path segment. */
|
|
34
|
+
directory: string;
|
|
35
|
+
/** Admit a non-empty production directory, as `publishFiles`' `force` option defines it. */
|
|
36
|
+
force: boolean;
|
|
37
|
+
/** Package name as typed; absent, `run` derives one from the directory segment. */
|
|
38
|
+
name?: string;
|
|
39
|
+
} | {
|
|
40
|
+
/** Update only generated instructions. */
|
|
41
|
+
command: "sync";
|
|
42
|
+
/** The directory holding `AGENTS.md`, resolved by run. */
|
|
43
|
+
directory: string;
|
|
44
|
+
/** Inspect pending changes and conflicts without writing. */
|
|
45
|
+
check: boolean;
|
|
46
|
+
/** Explicit prior adopted instruction root; the files it supplies govern over stored sync state. */
|
|
47
|
+
baseline?: string;
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoMovieCommand.js","sourceRoot":"","sources":["../src/AutoMovieCommand.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
/** Absolute root of the enclosing pnpm workspace, where `pnpm install` runs. */
|
|
13
|
+
workspace?: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAutoMoviePackageManager.js","sourceRoot":"","sources":["../src/IAutoMoviePackageManager.ts"],"names":[],"mappings":""}
|
package/lib/bin.d.ts
ADDED
package/lib/bin.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const run_1 = require("./run");
|
|
5
|
+
// The executable entry runs unconditionally: a `require.main === module` guard
|
|
6
|
+
// is false under ttsx, whose bootstrap is the main module and loads this file
|
|
7
|
+
// by `require`, so `pnpm start` would exit without running.
|
|
8
|
+
void (0, run_1.run)(process.argv).then((code) => {
|
|
9
|
+
process.exitCode = code;
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=bin.js.map
|
package/lib/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";;;AACA,+BAA4B;AAE5B,+EAA+E;AAC/E,8EAA8E;AAC9E,4DAA4D;AAC5D,KAAK,IAAA,SAAG,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAY,EAAQ,EAAE;IACjD,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;AAC1B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derive a lowercase project-name candidate from the target directory's basename.
|
|
3
|
+
*
|
|
4
|
+
* The basename is lowercased, each run of characters other than `a-z`, `0-9`, `.`, `_` and `-` becomes one `-`, the result is cut to npm's 214-character limit, and leading `-`, `.` or `_` and trailing `-` or `.` are removed. A basename with nothing left, such as a filesystem root, yields `AUTOMOVIE_DEFAULT_PROJECT_NAME`. `selectAutoMovieProjectName` passes a `create` request's absolute target, `run` passes an `add` request's directory segment, and `run` hands the result to the template renderer as the project name.
|
|
5
|
+
*
|
|
6
|
+
* This transformation does not validate npm's reserved names; `node_modules` and `favicon.ico` remain unchanged. Windows device names such as `con` also remain unchanged and are refused by `renderScaffold` before publication.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/development/implementation.md#principled-implementation Lowercasing and character replacement produce an unscoped-name candidate from the basename in the host's path syntax, then the 214-character cut precedes trimming so the result stays within that limit. This is normalization rather than complete npm admission: reserved names remain unchanged, while the downstream scaffold renderer separately refuses Windows device names.
|
|
9
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One pure function owns the directory-to-name rule, so `run` keeps only dispatch and the rule is checked without publishing a scaffold.
|
|
10
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No directory name is special-cased; the fallback applies whenever normalization leaves an empty candidate, including an all-underscore basename whose characters are removed by leading trim.
|
|
11
|
+
* @evidence contracts/development/common.md#meaningful-documentation The comment states each transformation in order, the limit, the fallback, the caller and consumer, and the difference between an unchanged npm reserved name and a device name refused by the renderer.
|
|
12
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Time and space are linear in the basename's length: one lowercase pass, one replacement and one slice; the final trim's trailing alternative can rescan a run of `-` and `.` that does not end the string, which is quadratic only within that run and bounded by the 214-character cut.
|
|
13
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work `run` derives one name per scaffold request, so no equivalent derivation is requested twice.
|
|
14
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources The function returns a new string and keeps no state, handle, or task.
|
|
15
|
+
*/
|
|
16
|
+
export declare function deriveAutoMovieProjectName(targetDir: string): string;
|
|
@@ -0,0 +1,65 @@
|
|
|
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.deriveAutoMovieProjectName = deriveAutoMovieProjectName;
|
|
37
|
+
const path = __importStar(require("node:path"));
|
|
38
|
+
const AUTOMOVIE_DEFAULT_PROJECT_NAME_1 = require("./AUTOMOVIE_DEFAULT_PROJECT_NAME");
|
|
39
|
+
/** Longest package name npm accepts. */
|
|
40
|
+
const NPM_NAME_LIMIT = 214;
|
|
41
|
+
/**
|
|
42
|
+
* Derive a lowercase project-name candidate from the target directory's basename.
|
|
43
|
+
*
|
|
44
|
+
* The basename is lowercased, each run of characters other than `a-z`, `0-9`, `.`, `_` and `-` becomes one `-`, the result is cut to npm's 214-character limit, and leading `-`, `.` or `_` and trailing `-` or `.` are removed. A basename with nothing left, such as a filesystem root, yields `AUTOMOVIE_DEFAULT_PROJECT_NAME`. `selectAutoMovieProjectName` passes a `create` request's absolute target, `run` passes an `add` request's directory segment, and `run` hands the result to the template renderer as the project name.
|
|
45
|
+
*
|
|
46
|
+
* This transformation does not validate npm's reserved names; `node_modules` and `favicon.ico` remain unchanged. Windows device names such as `con` also remain unchanged and are refused by `renderScaffold` before publication.
|
|
47
|
+
*
|
|
48
|
+
* @evidence contracts/development/implementation.md#principled-implementation Lowercasing and character replacement produce an unscoped-name candidate from the basename in the host's path syntax, then the 214-character cut precedes trimming so the result stays within that limit. This is normalization rather than complete npm admission: reserved names remain unchanged, while the downstream scaffold renderer separately refuses Windows device names.
|
|
49
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One pure function owns the directory-to-name rule, so `run` keeps only dispatch and the rule is checked without publishing a scaffold.
|
|
50
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No directory name is special-cased; the fallback applies whenever normalization leaves an empty candidate, including an all-underscore basename whose characters are removed by leading trim.
|
|
51
|
+
* @evidence contracts/development/common.md#meaningful-documentation The comment states each transformation in order, the limit, the fallback, the caller and consumer, and the difference between an unchanged npm reserved name and a device name refused by the renderer.
|
|
52
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Time and space are linear in the basename's length: one lowercase pass, one replacement and one slice; the final trim's trailing alternative can rescan a run of `-` and `.` that does not end the string, which is quadratic only within that run and bounded by the 214-character cut.
|
|
53
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work `run` derives one name per scaffold request, so no equivalent derivation is requested twice.
|
|
54
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources The function returns a new string and keeps no state, handle, or task.
|
|
55
|
+
*/
|
|
56
|
+
function deriveAutoMovieProjectName(targetDir) {
|
|
57
|
+
const name = path
|
|
58
|
+
.basename(targetDir)
|
|
59
|
+
.toLowerCase()
|
|
60
|
+
.replace(/[^a-z0-9._-]+/g, "-")
|
|
61
|
+
.slice(0, NPM_NAME_LIMIT)
|
|
62
|
+
.replace(/^[-._]+|[-.]+$/g, "");
|
|
63
|
+
return name.length === 0 ? AUTOMOVIE_DEFAULT_PROJECT_NAME_1.AUTOMOVIE_DEFAULT_PROJECT_NAME : name;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=deriveAutoMovieProjectName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deriveAutoMovieProjectName.js","sourceRoot":"","sources":["../src/deriveAutoMovieProjectName.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,IAAI,sCAAkB;AAElC,qFAAkF;AAElF,wCAAwC;AACxC,MAAM,cAAc,GAAW,GAAG,CAAC;AAEnC;;;;;;;;;;;;;;GAcG;AACH,oCAA2C,SAAiB;IAC1D,MAAM,IAAI,GAAW,IAAI;SACtB,QAAQ,CAAC,SAAS,CAAC;SACnB,WAAW,EAAE;SACb,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC;SAC9B,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC;SACxB,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,+DAA8B,CAAC,CAAC,CAAC,IAAI,CAAC;AACnE,CAAC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./AutoMovieCommand";
|
|
2
|
+
export * from "./readAutoMovieCommandArguments";
|
|
3
|
+
export * from "./deriveAutoMovieProjectName";
|
|
4
|
+
export * from "./AUTOMOVIE_DEFAULT_PROJECT_NAME";
|
|
5
|
+
export * from "./readAutoMovieCreateArguments";
|
|
6
|
+
export * from "./readAutoMovieAddArguments";
|
|
7
|
+
export * from "./readAutoMovieNameOption";
|
|
8
|
+
export * from "./selectAutoMovieProjectName";
|
|
9
|
+
export * from "./IAutoMoviePackageManager";
|
|
10
|
+
export * from "./selectAutoMoviePackageManager";
|
|
11
|
+
export * from "./promptAutoMovieProjectName";
|
|
12
|
+
export * from "./run";
|
|
13
|
+
export * from "./renderAutoMovieScaffoldNextSteps";
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AutoMovieCommand"), exports);
|
|
18
|
+
__exportStar(require("./readAutoMovieCommandArguments"), exports);
|
|
19
|
+
__exportStar(require("./deriveAutoMovieProjectName"), exports);
|
|
20
|
+
__exportStar(require("./AUTOMOVIE_DEFAULT_PROJECT_NAME"), exports);
|
|
21
|
+
__exportStar(require("./readAutoMovieCreateArguments"), exports);
|
|
22
|
+
__exportStar(require("./readAutoMovieAddArguments"), exports);
|
|
23
|
+
__exportStar(require("./readAutoMovieNameOption"), exports);
|
|
24
|
+
__exportStar(require("./selectAutoMovieProjectName"), exports);
|
|
25
|
+
__exportStar(require("./IAutoMoviePackageManager"), exports);
|
|
26
|
+
__exportStar(require("./selectAutoMoviePackageManager"), exports);
|
|
27
|
+
__exportStar(require("./promptAutoMovieProjectName"), exports);
|
|
28
|
+
__exportStar(require("./run"), exports);
|
|
29
|
+
__exportStar(require("./renderAutoMovieScaffoldNextSteps"), exports);
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,kEAAgD;AAChD,+DAA6C;AAC7C,mEAAiD;AACjD,iEAA+C;AAC/C,8DAA4C;AAC5C,4DAA0C;AAC1C,+DAA6C;AAC7C,6DAA2C;AAC3C,kEAAgD;AAChD,+DAA6C;AAC7C,wCAAsB;AACtB,qEAAmD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ask the terminal for a project name, offering {@link AUTOMOVIE_DEFAULT_PROJECT_NAME}.
|
|
3
|
+
*
|
|
4
|
+
* Without an interactive terminal on both standard input and output, no question is asked and the default is returned, so scripted runs never wait. A blank answer also takes the default; any other answer is returned as typed for the template's name rule to admit.
|
|
5
|
+
*
|
|
6
|
+
* @returns The answered or default name.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/development/implementation.md#principled-implementation `isTTY` on both streams identifies an interactive terminal; the readline interface is closed in `finally`, so standard input is released even when the question fails.
|
|
9
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The prompt is the CLI's only interactive I/O, separate from the pure name decision.
|
|
10
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The answer is not normalized here; the template's one name rule admits it.
|
|
11
|
+
* @evidence contracts/development/common.md#meaningful-documentation The comment states when the question is asked, the default, and how a blank answer is treated.
|
|
12
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One question and one trim.
|
|
13
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each request asks at most once.
|
|
14
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The readline interface is closed before returning.
|
|
15
|
+
*/
|
|
16
|
+
export declare function promptAutoMovieProjectName(): Promise<string>;
|
|
@@ -0,0 +1,69 @@
|
|
|
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.promptAutoMovieProjectName = promptAutoMovieProjectName;
|
|
37
|
+
const readline = __importStar(require("node:readline/promises"));
|
|
38
|
+
const AUTOMOVIE_DEFAULT_PROJECT_NAME_1 = require("./AUTOMOVIE_DEFAULT_PROJECT_NAME");
|
|
39
|
+
/**
|
|
40
|
+
* Ask the terminal for a project name, offering {@link AUTOMOVIE_DEFAULT_PROJECT_NAME}.
|
|
41
|
+
*
|
|
42
|
+
* Without an interactive terminal on both standard input and output, no question is asked and the default is returned, so scripted runs never wait. A blank answer also takes the default; any other answer is returned as typed for the template's name rule to admit.
|
|
43
|
+
*
|
|
44
|
+
* @returns The answered or default name.
|
|
45
|
+
*
|
|
46
|
+
* @evidence contracts/development/implementation.md#principled-implementation `isTTY` on both streams identifies an interactive terminal; the readline interface is closed in `finally`, so standard input is released even when the question fails.
|
|
47
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The prompt is the CLI's only interactive I/O, separate from the pure name decision.
|
|
48
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The answer is not normalized here; the template's one name rule admits it.
|
|
49
|
+
* @evidence contracts/development/common.md#meaningful-documentation The comment states when the question is asked, the default, and how a blank answer is treated.
|
|
50
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One question and one trim.
|
|
51
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each request asks at most once.
|
|
52
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The readline interface is closed before returning.
|
|
53
|
+
*/
|
|
54
|
+
async function promptAutoMovieProjectName() {
|
|
55
|
+
if (process.stdin.isTTY !== true || process.stdout.isTTY !== true)
|
|
56
|
+
return AUTOMOVIE_DEFAULT_PROJECT_NAME_1.AUTOMOVIE_DEFAULT_PROJECT_NAME;
|
|
57
|
+
const terminal = readline.createInterface({
|
|
58
|
+
input: process.stdin,
|
|
59
|
+
output: process.stdout,
|
|
60
|
+
});
|
|
61
|
+
try {
|
|
62
|
+
const answer = await terminal.question(`Project name (${AUTOMOVIE_DEFAULT_PROJECT_NAME_1.AUTOMOVIE_DEFAULT_PROJECT_NAME}): `);
|
|
63
|
+
return answer.trim() === "" ? AUTOMOVIE_DEFAULT_PROJECT_NAME_1.AUTOMOVIE_DEFAULT_PROJECT_NAME : answer;
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
terminal.close();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=promptAutoMovieProjectName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promptAutoMovieProjectName.js","sourceRoot":"","sources":["../src/promptAutoMovieProjectName.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,QAAQ,mDAA+B;AAEnD,qFAAkF;AAElF;;;;;;;;;;;;;;GAcG;AACI,KAAK;IACV,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI;QAC/D,OAAO,+DAA8B,CAAC;IACxC,MAAM,QAAQ,GAAuB,QAAQ,CAAC,eAAe,CAAC;QAC5D,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IACH,IAAI,CAAC;QACH,MAAM,MAAM,GAAW,MAAM,QAAQ,CAAC,QAAQ,CAC5C,iBAAiB,+DAA8B,KAAK,CACrD,CAAC;QACF,OAAO,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,+DAA8B,CAAC,CAAC,CAAC,MAAM,CAAC;IACxE,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AutoMovieCommand } from "./AutoMovieCommand";
|
|
2
|
+
/**
|
|
3
|
+
* Admit one `add` request: exactly one `shorts/<directory>` or `series/<directory>` target with optional single `--force` and `--name <name>`, in any order.
|
|
4
|
+
*
|
|
5
|
+
* The target is split at its one `/`; the family must be `shorts` or `series`, and the directory must be one segment that the template's project-name rule admits unchanged, so `movies/<family>/<directory>` cannot leave the workspace. Every refusal throws an `Error` whose message names the correction.
|
|
6
|
+
*
|
|
7
|
+
* @param args The tokens after `add`.
|
|
8
|
+
* @returns The admitted request.
|
|
9
|
+
* @throws On an unknown or repeated option, a missing name value, a target count other than one, an unknown family, or a refused directory segment.
|
|
10
|
+
*
|
|
11
|
+
* @evidence contracts/development/implementation.md#principled-implementation The directory segment passes the same portable-segment rule as a project name and must equal its trimmed form, so no separator, `.`, `..` or padding reaches the joined path.
|
|
12
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The add grammar is separate from create and sync; the template owns the segment rule and `run` owns the workspace path.
|
|
13
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No family is inferred from the name and no workspace is searched for; the family is typed explicitly.
|
|
14
|
+
* @evidence contracts/development/common.md#meaningful-documentation The comment states the grammar, the family pair, the segment rule and why it matters, and what throws.
|
|
15
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One scan over the tokens and one split of the target.
|
|
16
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work This pure parser owns no cross-request effect to reuse.
|
|
17
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Local strings and arrays expire after return and no handle is acquired.
|
|
18
|
+
*/
|
|
19
|
+
export declare function readAutoMovieAddArguments(args: readonly string[]): AutoMovieCommand;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readAutoMovieAddArguments = readAutoMovieAddArguments;
|
|
4
|
+
const template_1 = require("@automovie/template");
|
|
5
|
+
const readAutoMovieNameOption_1 = require("./readAutoMovieNameOption");
|
|
6
|
+
/**
|
|
7
|
+
* Admit one `add` request: exactly one `shorts/<directory>` or `series/<directory>` target with optional single `--force` and `--name <name>`, in any order.
|
|
8
|
+
*
|
|
9
|
+
* The target is split at its one `/`; the family must be `shorts` or `series`, and the directory must be one segment that the template's project-name rule admits unchanged, so `movies/<family>/<directory>` cannot leave the workspace. Every refusal throws an `Error` whose message names the correction.
|
|
10
|
+
*
|
|
11
|
+
* @param args The tokens after `add`.
|
|
12
|
+
* @returns The admitted request.
|
|
13
|
+
* @throws On an unknown or repeated option, a missing name value, a target count other than one, an unknown family, or a refused directory segment.
|
|
14
|
+
*
|
|
15
|
+
* @evidence contracts/development/implementation.md#principled-implementation The directory segment passes the same portable-segment rule as a project name and must equal its trimmed form, so no separator, `.`, `..` or padding reaches the joined path.
|
|
16
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The add grammar is separate from create and sync; the template owns the segment rule and `run` owns the workspace path.
|
|
17
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No family is inferred from the name and no workspace is searched for; the family is typed explicitly.
|
|
18
|
+
* @evidence contracts/development/common.md#meaningful-documentation The comment states the grammar, the family pair, the segment rule and why it matters, and what throws.
|
|
19
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One scan over the tokens and one split of the target.
|
|
20
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work This pure parser owns no cross-request effect to reuse.
|
|
21
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Local strings and arrays expire after return and no handle is acquired.
|
|
22
|
+
*/
|
|
23
|
+
function readAutoMovieAddArguments(args) {
|
|
24
|
+
const positionals = [];
|
|
25
|
+
let force = false;
|
|
26
|
+
let name;
|
|
27
|
+
for (let index = 0; index < args.length; index++) {
|
|
28
|
+
const token = args[index];
|
|
29
|
+
if (token === "--force") {
|
|
30
|
+
if (force)
|
|
31
|
+
throw new Error("--force may be supplied only once for add.");
|
|
32
|
+
force = true;
|
|
33
|
+
}
|
|
34
|
+
else if (token === "--name") {
|
|
35
|
+
if (name !== undefined)
|
|
36
|
+
throw new Error("--name may be supplied only once for add.");
|
|
37
|
+
name = (0, readAutoMovieNameOption_1.readAutoMovieNameOption)(args[++index]);
|
|
38
|
+
}
|
|
39
|
+
else if (token.startsWith("-"))
|
|
40
|
+
throw new Error(`Unknown add option ${JSON.stringify(token)}; add accepts --name and --force.`);
|
|
41
|
+
else
|
|
42
|
+
positionals.push(token);
|
|
43
|
+
}
|
|
44
|
+
if (positionals.length !== 1)
|
|
45
|
+
throw new Error(`add needs exactly one shorts/<name> or series/<name> target; received ${positionals.length}.`);
|
|
46
|
+
// Split the one target into its closed family and one directory segment.
|
|
47
|
+
const parts = positionals[0].split("/");
|
|
48
|
+
const family = parts[0];
|
|
49
|
+
if (parts.length !== 2 || (family !== "shorts" && family !== "series"))
|
|
50
|
+
throw new Error(`add needs a shorts/<name> or series/<name> target; received ${JSON.stringify(positionals[0])}.`);
|
|
51
|
+
const directory = parts[1];
|
|
52
|
+
let admitted;
|
|
53
|
+
try {
|
|
54
|
+
admitted = (0, template_1.assertScaffoldProjectName)(directory);
|
|
55
|
+
}
|
|
56
|
+
catch (cause) {
|
|
57
|
+
throw new Error(`add needs one portable directory name after ${family}/; received ${JSON.stringify(directory)}.`, { cause });
|
|
58
|
+
}
|
|
59
|
+
if (admitted !== directory)
|
|
60
|
+
throw new Error(`add needs a directory name without surrounding spaces; received ${JSON.stringify(directory)}.`);
|
|
61
|
+
return {
|
|
62
|
+
command: "add",
|
|
63
|
+
family,
|
|
64
|
+
directory,
|
|
65
|
+
force,
|
|
66
|
+
...(name === undefined ? {} : { name }),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=readAutoMovieAddArguments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readAutoMovieAddArguments.js","sourceRoot":"","sources":["../src/readAutoMovieAddArguments.ts"],"names":[],"mappings":";;;AAAA,kDAAgE;AAGhE,uEAAoE;AAEpE;;;;;;;;;;;;;;;;GAgBG;AACH,mCACE,IAAuB;IAEvB,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,IAAI,KAAK,GAAY,KAAK,CAAC;IAC3B,IAAI,IAAwB,CAAC;IAC7B,KAAK,IAAI,KAAK,GAAW,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACzD,MAAM,KAAK,GAAW,IAAI,CAAC,KAAK,CAAE,CAAC;QACnC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,IAAI,KAAK;gBAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;YACzE,KAAK,GAAG,IAAI,CAAC;QACf,CAAC;aAAM,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,IAAI,IAAI,KAAK,SAAS;gBACpB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;YAC/D,IAAI,GAAG,IAAA,iDAAuB,EAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QAChD,CAAC;aAAM,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;YAC9B,MAAM,IAAI,KAAK,CACb,sBAAsB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,mCAAmC,CAC/E,CAAC;;YACC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,yEAAyE,WAAW,CAAC,MAAM,GAAG,CAC/F,CAAC;IAEJ,yEAAyE;IACzE,MAAM,KAAK,GAAa,WAAW,CAAC,CAAC,CAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnD,MAAM,MAAM,GAAW,KAAK,CAAC,CAAC,CAAE,CAAC;IACjC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,QAAQ,CAAC;QACpE,MAAM,IAAI,KAAK,CACb,+DAA+D,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CACjG,CAAC;IACJ,MAAM,SAAS,GAAW,KAAK,CAAC,CAAC,CAAE,CAAC;IACpC,IAAI,QAAgB,CAAC;IACrB,IAAI,CAAC;QACH,QAAQ,GAAG,IAAA,oCAAyB,EAAC,SAAS,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,+CAA+C,MAAM,eAAe,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,EAChG,EAAE,KAAK,EAAE,CACV,CAAC;IACJ,CAAC;IACD,IAAI,QAAQ,KAAK,SAAS;QACxB,MAAM,IAAI,KAAK,CACb,mEAAmE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAChG,CAAC;IACJ,OAAO;QACL,OAAO,EAAE,KAAK;QACd,MAAM;QACN,SAAS;QACT,KAAK;QACL,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;KACxC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type AutoMovieCommand } from "./AutoMovieCommand";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve one complete CLI request before any scaffold publication begins.
|
|
4
|
+
*
|
|
5
|
+
* `args` excludes the node executable and script positions. No arguments, or a lone `-h`/`--help`, means help; a lone `-v`/`--version` means version. `create`, `add` and `sync` delegate their grammars to {@link readAutoMovieCreateArguments}, {@link readAutoMovieAddArguments} and {@link readAutoMovieSyncArguments}. Every refusal throws an `Error` whose message names the correction.
|
|
6
|
+
*
|
|
7
|
+
* @param args The command-line tokens after the executable and script.
|
|
8
|
+
* @returns The admitted request.
|
|
9
|
+
* @throws On an unknown command or any refusal of the delegated grammar.
|
|
10
|
+
*
|
|
11
|
+
* @evidence contracts/development/implementation.md#principled-implementation Standalone flags are decided before any command because they admit no other token, and each command's grammar validates the whole request before returning, so `run` never begins publication on a partially understood command line.
|
|
12
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure This function only dispatches on the first token; each command owns its own grammar file, avoiding an argument-parsing dependency.
|
|
13
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The command spellings are the documented CLI contract; every other first token is refused with a message rather than ignored, and no fallback admits a removed command such as `start`.
|
|
14
|
+
* @evidence contracts/development/common.md#meaningful-documentation The comment states which argv positions `args` excludes, what the standalone flags mean, which owner parses each command, and that every refusal names the correction.
|
|
15
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One destructuring copy and one comparison chain before the delegated linear scan.
|
|
16
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work This pure parser handles one supplied vector per call and coordinates no requests or effectful work.
|
|
17
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources The parser opens no handle or task and retains no array after return; returned requests keep only their admitted strings and flags.
|
|
18
|
+
*/
|
|
19
|
+
export declare function readAutoMovieCommandArguments(args: readonly string[]): AutoMovieCommand;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readAutoMovieCommandArguments = readAutoMovieCommandArguments;
|
|
4
|
+
const readAutoMovieAddArguments_1 = require("./readAutoMovieAddArguments");
|
|
5
|
+
const readAutoMovieCreateArguments_1 = require("./readAutoMovieCreateArguments");
|
|
6
|
+
const readAutoMovieSyncArguments_1 = require("./readAutoMovieSyncArguments");
|
|
7
|
+
/**
|
|
8
|
+
* Resolve one complete CLI request before any scaffold publication begins.
|
|
9
|
+
*
|
|
10
|
+
* `args` excludes the node executable and script positions. No arguments, or a lone `-h`/`--help`, means help; a lone `-v`/`--version` means version. `create`, `add` and `sync` delegate their grammars to {@link readAutoMovieCreateArguments}, {@link readAutoMovieAddArguments} and {@link readAutoMovieSyncArguments}. Every refusal throws an `Error` whose message names the correction.
|
|
11
|
+
*
|
|
12
|
+
* @param args The command-line tokens after the executable and script.
|
|
13
|
+
* @returns The admitted request.
|
|
14
|
+
* @throws On an unknown command or any refusal of the delegated grammar.
|
|
15
|
+
*
|
|
16
|
+
* @evidence contracts/development/implementation.md#principled-implementation Standalone flags are decided before any command because they admit no other token, and each command's grammar validates the whole request before returning, so `run` never begins publication on a partially understood command line.
|
|
17
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure This function only dispatches on the first token; each command owns its own grammar file, avoiding an argument-parsing dependency.
|
|
18
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The command spellings are the documented CLI contract; every other first token is refused with a message rather than ignored, and no fallback admits a removed command such as `start`.
|
|
19
|
+
* @evidence contracts/development/common.md#meaningful-documentation The comment states which argv positions `args` excludes, what the standalone flags mean, which owner parses each command, and that every refusal names the correction.
|
|
20
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One destructuring copy and one comparison chain before the delegated linear scan.
|
|
21
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work This pure parser handles one supplied vector per call and coordinates no requests or effectful work.
|
|
22
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources The parser opens no handle or task and retains no array after return; returned requests keep only their admitted strings and flags.
|
|
23
|
+
*/
|
|
24
|
+
function readAutoMovieCommandArguments(args) {
|
|
25
|
+
if (args.length === 0)
|
|
26
|
+
return { command: "help" };
|
|
27
|
+
const [command, ...rest] = args;
|
|
28
|
+
if (command === "-h" || command === "--help")
|
|
29
|
+
return standalone(command, rest, { command: "help" });
|
|
30
|
+
if (command === "-v" || command === "--version")
|
|
31
|
+
return standalone(command, rest, { command: "version" });
|
|
32
|
+
if (command === "create")
|
|
33
|
+
return (0, readAutoMovieCreateArguments_1.readAutoMovieCreateArguments)(rest);
|
|
34
|
+
if (command === "add")
|
|
35
|
+
return (0, readAutoMovieAddArguments_1.readAutoMovieAddArguments)(rest);
|
|
36
|
+
if (command === "sync")
|
|
37
|
+
return (0, readAutoMovieSyncArguments_1.readAutoMovieSyncArguments)(rest);
|
|
38
|
+
throw new Error(`Unknown command ${JSON.stringify(command)}; the commands are create, add and sync (see --help).`);
|
|
39
|
+
}
|
|
40
|
+
/** Admit a standalone flag only when no other argument follows it. */
|
|
41
|
+
function standalone(flag, rest, request) {
|
|
42
|
+
if (rest.length !== 0)
|
|
43
|
+
throw new Error(`${flag} must be the only argument.`);
|
|
44
|
+
return request;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=readAutoMovieCommandArguments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readAutoMovieCommandArguments.js","sourceRoot":"","sources":["../src/readAutoMovieCommandArguments.ts"],"names":[],"mappings":";;;AACA,2EAAwE;AACxE,iFAA8E;AAC9E,6EAA0E;AAE1E;;;;;;;;;;;;;;;;GAgBG;AACH,uCACE,IAAuB;IAEvB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClD,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAsB,IAAI,CAAC;IACnD,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,QAAQ;QAC1C,OAAO,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACxD,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,WAAW;QAC7C,OAAO,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IAC3D,IAAI,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAA,2DAA4B,EAAC,IAAI,CAAC,CAAC;IACpE,IAAI,OAAO,KAAK,KAAK;QAAE,OAAO,IAAA,qDAAyB,EAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,OAAO,KAAK,MAAM;QAAE,OAAO,IAAA,uDAA0B,EAAC,IAAI,CAAC,CAAC;IAChE,MAAM,IAAI,KAAK,CACb,mBAAmB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,uDAAuD,CAClG,CAAC;AACJ,CAAC;AAED,sEAAsE;AACtE,SAAS,UAAU,CACjB,IAAY,EACZ,IAAuB,EACvB,OAAyB;IAEzB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,6BAA6B,CAAC,CAAC;IAC7E,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AutoMovieCommand } from "./AutoMovieCommand";
|
|
2
|
+
/**
|
|
3
|
+
* Admit one `create` request: exactly one non-blank target directory with optional single `--workspace`, `--force` and `--name <name>`, in any order.
|
|
4
|
+
*
|
|
5
|
+
* There is no `--` terminator, so a directory beginning with `-` must be spelled `./-name`. Every refusal throws an `Error` whose message names the correction.
|
|
6
|
+
*
|
|
7
|
+
* @param args The tokens after `create`.
|
|
8
|
+
* @returns The admitted request.
|
|
9
|
+
* @throws On an unknown or repeated option, a missing name value, or anything other than one non-blank directory.
|
|
10
|
+
*
|
|
11
|
+
* @evidence contracts/development/implementation.md#principled-implementation A complete left-to-right scan admits each flag once and consumes `--name`'s value, so every token is classified before any filesystem work.
|
|
12
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The create grammar is separate from add and sync; `readAutoMovieNameOption` owns the shared value rule and `run` owns resolution.
|
|
13
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No default directory, inferred workspace mode or derived name is introduced here.
|
|
14
|
+
* @evidence contracts/development/common.md#meaningful-documentation The comment states the grammar, the dash-leading spelling and that refusals name their correction.
|
|
15
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One scan over the tokens.
|
|
16
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work This pure parser owns no cross-request effect to reuse.
|
|
17
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Local strings and arrays expire after return and no handle is acquired.
|
|
18
|
+
*/
|
|
19
|
+
export declare function readAutoMovieCreateArguments(args: readonly string[]): AutoMovieCommand;
|