nestia 14.0.0 → 14.0.2

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
@@ -60,7 +60,7 @@ Check out the document in the [website](https://nestia.io/docs/):
60
60
  ### 🏠 Home
61
61
  - [Introduction](https://nestia.io/docs/)
62
62
  - [Setup](https://nestia.io/docs/setup/)
63
- - [Pure TypeScript](https://nestia.io/docs/pure)
63
+ - [Pure TypeScript](https://nestia.io/docs/core/TypedBody/)
64
64
 
65
65
  ### 📖 Features
66
66
  - Core Library
@@ -1,22 +1,93 @@
1
+ /**
2
+ * Scaffolds a project from a template repository for `nestia start` and `nestia
3
+ * template`.
4
+ *
5
+ * The flow clones the repository, installs, builds, optionally tests, and then
6
+ * deletes the repository-only files. Command and file-system operations go
7
+ * through an injected `IContext`, so unit tests need no network or package
8
+ * manager. Logging and the corepack prompt environment flag remain process
9
+ * effects.
10
+ *
11
+ * @evidence contracts/common.md#principled-implementation The scaffold is the fixed sequence clone, install, build, optional test, cleanup, each step one explicit-argument command; the package manager is chosen by probing `pnpm` and then `corepack` because the template repositories are pnpm monorepos whose `catalog:` protocol npm cannot resolve.
12
+ * @evidence contracts/common.md#clear-and-simple-design One namespace owns the flow: clone is the sequence, IContext is the injected command/file-system boundary, and private parse, getPackageManager and commandOf each answer one question; NestiaStarter and NestiaTemplate bind a title, URL and test flag.
13
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Both templates run the identical flow parameterized by props, with no repository-name branches; the only ambient write is the documented corepack variable `COREPACK_ENABLE_DOWNLOAD_PROMPT`, set in the corepack branch to keep the prompt from blocking a scripted run.
14
+ * @evidence contracts/common.md#meaningful-documentation The namespace prose states what the flow does, its ordering, and why side effects are injected; the nested types and `clone` carry their own documentation.
15
+ * @evidence contracts/portability.md#os-neutral-implementation The only platform difference is how a program is launched. `git` runs directly through `execFileSync` with an argument array, while `pnpm` and `corepack`, which Windows installs as `.cmd` shims that Node refuses to start without a shell, run through `cmd.exe /d /s /c` with their fixed arguments on Windows and directly elsewhere. The repository and the destination are never part of a shell command line. The destination is a path relative to the current directory, its existence is the filesystem's own answer, and the directory change and the removal use Node's native calls. Remaining assumptions: `git` and a package manager are on `PATH`, and on a case-insensitive volume a destination spelled in another case than an existing directory is refused while a case-sensitive volume would accept it.
16
+ */
1
17
  export declare namespace NestiaProjectTemplate {
2
18
  /**
3
19
  * Side effects performed while scaffolding a template project.
4
20
  *
5
21
  * Injected so that the scaffolding flow can be unit tested without touching
6
22
  * the network, the file system, or a real package manager.
23
+ *
24
+ * @evidence contracts/common.md#principled-implementation The interface represents command execution/probing, directory changes, existence checks and removal as function members, so a fake can record those operations and production can delegate them to child_process and fs. Logging and the corepack prompt flag are separate process effects documented by the namespace.
25
+ * @evidence contracts/common.md#clear-and-simple-design Five members, one per distinct effect, with no default behavior in the type; the real implementation is the private `CONTEXT` constant, which keeps the interface a pure seam.
26
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The seam exists because the flow performs process and file-system effects, not to serve a particular test: the production `CONTEXT` implements every member with the real operation.
27
+ * @evidence contracts/common.md#meaningful-documentation The type documentation says the effects are injected for offline testing, and each member states its contract in one sentence.
28
+ * @evidence contracts/portability.md#os-neutral-implementation The interface names the effects whose platform spelling lives in the production context: launching a program with an argument vector, silent probing of an executable, changing the working directory, testing existence and removing a tree.
7
29
  */
8
30
  interface IContext {
9
- /** Runs an executable with explicit arguments, inheriting stdio. */
31
+ /**
32
+ * Runs an executable with explicit arguments, inheriting stdio.
33
+ *
34
+ * @evidence contracts/common.md#principled-implementation An executable and an argument array, never a command string, mirror `execFileSync` semantics, so the flow never depends on shell quoting; inherited stdio lets the user see the clone and install output.
35
+ * @evidence contracts/common.md#clear-and-simple-design One member for commands whose output the user must see and whose failure must stop the flow, separate from the silent `probe`.
36
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The production implementation runs the requested command; no command is skipped or rewritten based on the repository or destination.
37
+ * @evidence contracts/common.md#meaningful-documentation The comment states the argument representation and that stdio is inherited.
38
+ * @evidence contracts/portability.md#os-neutral-implementation The executable and its arguments are separate values, so no quoting rule of any shell is part of the contract, and standard streams are inherited so the platform's terminal shows the program's output.
39
+ */
10
40
  execute: (executable: string, args: readonly string[]) => void;
11
- /** Silently checks whether an executable accepts the supplied arguments. */
41
+ /**
42
+ * Silently checks whether an executable accepts the supplied arguments.
43
+ *
44
+ * @evidence contracts/common.md#principled-implementation A probe runs the executable with the given arguments and reports success as a boolean, which is enough to decide whether `pnpm --version` or `corepack --version` is available without interpreting output.
45
+ * @evidence contracts/common.md#clear-and-simple-design Separate from `execute` because a probe is silent and its failure is an answer rather than an error.
46
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Availability is decided by actually invoking the tool; no PATH scan is guessed and no tool name is assumed present.
47
+ * @evidence contracts/common.md#meaningful-documentation The comment states that the check is silent and returns whether the executable accepted the arguments.
48
+ * @evidence contracts/portability.md#os-neutral-implementation A program that cannot be started, as a missing executable on any platform, and one that exits non-zero both answer `false`, because the production context catches the failure of `execFileSync` instead of distinguishing platform error codes.
49
+ */
12
50
  probe: (executable: string, args: readonly string[]) => boolean;
13
- /** Changes the working directory. */
51
+ /**
52
+ * Changes the working directory.
53
+ *
54
+ * @evidence contracts/common.md#principled-implementation The flow must run install and build inside the cloned directory, and changing the working directory of the process is the one operation that redirects every later relative command.
55
+ * @evidence contracts/common.md#clear-and-simple-design A single-purpose member so a fake can record the directory the flow entered.
56
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The production implementation calls `process.chdir` on the requested path, with no fallback directory.
57
+ * @evidence contracts/common.md#meaningful-documentation The comment names the effect, a working-directory change.
58
+ * @evidence contracts/portability.md#os-neutral-implementation `process.chdir` changes the working directory of the whole process, so the flow supports one scaffold per process at a time.
59
+ */
14
60
  chdir: (directory: string) => void;
15
- /** Checks whether a path exists. */
61
+ /**
62
+ * Checks whether a path exists.
63
+ *
64
+ * @evidence contracts/common.md#principled-implementation Refusing to scaffold into an existing directory needs one boolean existence check for the destination path.
65
+ * @evidence contracts/common.md#clear-and-simple-design One question with one boolean answer, kept apart from removal.
66
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The production implementation asks the file system directly, with no cached listing.
67
+ * @evidence contracts/common.md#meaningful-documentation The comment states that it checks whether a path exists.
68
+ * @evidence contracts/portability.md#os-neutral-implementation Node's `existsSync` lets the volume decide the case policy and the links, and nothing is canonicalized.
69
+ */
16
70
  exists: (path: string) => boolean;
17
- /** Removes a path recursively, ignoring missing entries. */
71
+ /**
72
+ * Removes a path recursively, ignoring missing entries.
73
+ *
74
+ * @evidence contracts/common.md#principled-implementation Deleting the repository-only files (`.git`, `.github/dependabot.yml`) after scaffolding is a recursive removal that must succeed when the entry is already absent.
75
+ * @evidence contracts/common.md#clear-and-simple-design One effect, isolated so a fake can record which paths the flow removed.
76
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The production implementation uses `fs.rmSync` with `recursive` and `force`, which is the supported way to make a missing path a no-op, not a swallowed error handler.
77
+ * @evidence contracts/common.md#meaningful-documentation The comment states that removal is recursive and ignores missing entries.
78
+ * @evidence contracts/portability.md#os-neutral-implementation `fs.rmSync` with `recursive` and `force` also removes the read-only files a clone leaves in `.git` on Windows, and a missing entry is not an error on any platform.
79
+ */
18
80
  remove: (path: string) => void;
19
81
  }
82
+ /**
83
+ * Per-template constants that parameterize the shared scaffolding flow.
84
+ *
85
+ * @evidence contracts/common.md#principled-implementation The three fields are the only differences between the starter and the template kits: what to announce, where to clone from, and whether to run the tests.
86
+ * @evidence contracts/common.md#clear-and-simple-design A flat record of per-template constants with no behavior.
87
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Template-specific values live in data passed to one flow, which avoids branching on a template name inside the flow.
88
+ * @evidence contracts/common.md#meaningful-documentation Each field documents its role, including that the repository is overridable through `--repository <url>`.
89
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The record holds a banner, a URL string and a flag, which are ordinary options and not a path or process representation; the repository is passed to git as one argument.
90
+ */
20
91
  interface IProps {
21
92
  /** Banner title printed before cloning. */
22
93
  title: string;
@@ -25,5 +96,20 @@ export declare namespace NestiaProjectTemplate {
25
96
  /** Whether to run the test suite after building. */
26
97
  test: boolean;
27
98
  }
99
+ /**
100
+ * Creates the `nestia start` or `nestia template` command for one template.
101
+ *
102
+ * The returned function takes a halter that terminates the process, an
103
+ * optional context, and the command-line arguments after the sub-command. It
104
+ * halts when the destination is missing or already exists, when the
105
+ * destination or the repository starts with a dash, when `--repository` has
106
+ * no value, or when neither pnpm nor corepack is available.
107
+ *
108
+ * @evidence contracts/common.md#principled-implementation Currying separates the per-template props from the halter and context injected at the call site. Argument and destination validation precede cloning, and a destination or repository that starts with a dash is refused because git would read it as an option; package-manager availability is checked after entering the clone, so an unavailable manager leaves that clone in place without installing or building it. Ordered execute calls implement the documented scaffold sequence.
109
+ * @evidence contracts/common.md#clear-and-simple-design One curried function keeps the sequence readable in one place, delegating parsing, package-manager selection, and command shaping to private helpers rather than to options.
110
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The flow contains no fixture or repository names, and the injected context is the production seam: the default `CONTEXT` performs the real clone, install, build, and cleanup.
111
+ * @evidence contracts/common.md#meaningful-documentation The comment states the halting conditions and the injected parameters, and section comments inside the body mark the phases.
112
+ * @evidence contracts/portability.md#os-neutral-implementation Every program invocation is one `execute` call with an argument vector, and the pnpm or corepack choice is made by probing, not by an operating-system name. A destination or repository starting with a dash is refused, since git would read it as an option and the vector has no separator.
113
+ */
28
114
  const clone: (props: IProps) => (halter: (msg?: string) => never, context?: IContext) => (argv: string[]) => Promise<void>;
29
115
  }
@@ -15,13 +15,46 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.NestiaProjectTemplate = void 0;
16
16
  const child_process_1 = __importDefault(require("child_process"));
17
17
  const fs_1 = __importDefault(require("fs"));
18
+ /**
19
+ * Scaffolds a project from a template repository for `nestia start` and `nestia
20
+ * template`.
21
+ *
22
+ * The flow clones the repository, installs, builds, optionally tests, and then
23
+ * deletes the repository-only files. Command and file-system operations go
24
+ * through an injected `IContext`, so unit tests need no network or package
25
+ * manager. Logging and the corepack prompt environment flag remain process
26
+ * effects.
27
+ *
28
+ * @evidence contracts/common.md#principled-implementation The scaffold is the fixed sequence clone, install, build, optional test, cleanup, each step one explicit-argument command; the package manager is chosen by probing `pnpm` and then `corepack` because the template repositories are pnpm monorepos whose `catalog:` protocol npm cannot resolve.
29
+ * @evidence contracts/common.md#clear-and-simple-design One namespace owns the flow: clone is the sequence, IContext is the injected command/file-system boundary, and private parse, getPackageManager and commandOf each answer one question; NestiaStarter and NestiaTemplate bind a title, URL and test flag.
30
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Both templates run the identical flow parameterized by props, with no repository-name branches; the only ambient write is the documented corepack variable `COREPACK_ENABLE_DOWNLOAD_PROMPT`, set in the corepack branch to keep the prompt from blocking a scripted run.
31
+ * @evidence contracts/common.md#meaningful-documentation The namespace prose states what the flow does, its ordering, and why side effects are injected; the nested types and `clone` carry their own documentation.
32
+ * @evidence contracts/portability.md#os-neutral-implementation The only platform difference is how a program is launched. `git` runs directly through `execFileSync` with an argument array, while `pnpm` and `corepack`, which Windows installs as `.cmd` shims that Node refuses to start without a shell, run through `cmd.exe /d /s /c` with their fixed arguments on Windows and directly elsewhere. The repository and the destination are never part of a shell command line. The destination is a path relative to the current directory, its existence is the filesystem's own answer, and the directory change and the removal use Node's native calls. Remaining assumptions: `git` and a package manager are on `PATH`, and on a case-insensitive volume a destination spelled in another case than an existing directory is refused while a case-sensitive volume would accept it.
33
+ */
18
34
  var NestiaProjectTemplate;
19
35
  (function (NestiaProjectTemplate) {
36
+ /**
37
+ * Creates the `nestia start` or `nestia template` command for one template.
38
+ *
39
+ * The returned function takes a halter that terminates the process, an
40
+ * optional context, and the command-line arguments after the sub-command. It
41
+ * halts when the destination is missing or already exists, when the
42
+ * destination or the repository starts with a dash, when `--repository` has
43
+ * no value, or when neither pnpm nor corepack is available.
44
+ *
45
+ * @evidence contracts/common.md#principled-implementation Currying separates the per-template props from the halter and context injected at the call site. Argument and destination validation precede cloning, and a destination or repository that starts with a dash is refused because git would read it as an option; package-manager availability is checked after entering the clone, so an unavailable manager leaves that clone in place without installing or building it. Ordered execute calls implement the documented scaffold sequence.
46
+ * @evidence contracts/common.md#clear-and-simple-design One curried function keeps the sequence readable in one place, delegating parsing, package-manager selection, and command shaping to private helpers rather than to options.
47
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The flow contains no fixture or repository names, and the injected context is the production seam: the default `CONTEXT` performs the real clone, install, build, and cleanup.
48
+ * @evidence contracts/common.md#meaningful-documentation The comment states the halting conditions and the injected parameters, and section comments inside the body mark the phases.
49
+ * @evidence contracts/portability.md#os-neutral-implementation Every program invocation is one `execute` call with an argument vector, and the pnpm or corepack choice is made by probing, not by an operating-system name. A destination or repository starting with a dash is refused, since git would read it as an option and the vector has no separator.
50
+ */
20
51
  NestiaProjectTemplate.clone = (props) => (halter, context = CONTEXT) => (argv) => __awaiter(this, void 0, void 0, function* () {
21
52
  // VALIDATION
22
53
  const { dest, repository } = parse(argv, halter);
23
54
  if (dest === undefined)
24
55
  halter();
56
+ else if (dest.startsWith("-") || (repository === null || repository === void 0 ? void 0 : repository.startsWith("-")) === true)
57
+ halter("The destination and the repository must not start with a dash, which git would read as an option.");
25
58
  else if (context.exists(dest) === true)
26
59
  halter("The target directory already exists.");
27
60
  console.log("-----------------------------------------");
@@ -77,8 +110,9 @@ var NestiaProjectTemplate;
77
110
  "",
78
111
  " npm install --global pnpm",
79
112
  "",
80
- "or activate it through corepack (bundled with Node.js):",
113
+ "or install and activate corepack:",
81
114
  "",
115
+ " npm install --global corepack",
82
116
  " corepack enable",
83
117
  ].join("\n"));
84
118
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NestiaProjectTemplate.js","sourceRoot":"","sources":["../src/NestiaProjectTemplate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kEAA+B;AAC/B,4CAAoB;A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,CAAC,KAAK,CAAC,SAAS,CAAC;QAC5D,MAAM,EAAE,CAAC,IAAY,EAAW,EAAE,CAAC,YAAE,CAAC,UAAU,CAAC,IAAI,CAAC;QACtD,MAAM,EAAE,CAAC,IAAY,EAAQ,EAAE,CAC7B,YAAE,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;KACpD,CAAC;IAEF,MAAM,SAAS,GAAG,CAAC,UAAkB,EAAE,IAAuB,EAAY,EAAE,CAC1E,OAAO,CAAC,QAAQ,KAAK,OAAO;QAC5B,CAAC,UAAU,KAAK,MAAM,IAAI,UAAU,KAAK,UAAU,CAAC;QAClD,CAAC,CAAC;YACE,UAAU,EAAE,SAAS;YACrB,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;SAC9C;QACH,CAAC,CAAC;YACE,UAAU;YACV,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;SAChB,CAAC;AACV,CAAC,EAzOgB,qBAAqB,aAArB,qBAAqB,GAArB,qBAAqB,QAyOrC"}
@@ -1,4 +1,14 @@
1
1
  import { NestiaProjectTemplate } from "./NestiaProjectTemplate.js";
2
+ /**
3
+ * The `nestia start` command: clones the Nestia starter kit, builds it, and
4
+ * runs its tests.
5
+ *
6
+ * @evidence contracts/common.md#principled-implementation It binds the starter kit's title and repository and enables the test step, which is all that distinguishes it from the template command, so its behavior is exactly the shared flow's.
7
+ * @evidence contracts/common.md#clear-and-simple-design A one-member namespace whose only job is naming the bound command that `index.ts` imports lazily.
8
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The values are contract constants (the published starter repository URL), not special cases of any consumer.
9
+ * @evidence contracts/common.md#meaningful-documentation The comment names the command and what it does; the shared flow documents the details.
10
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation This namespace supplies a title, repository URL and test flag to the shared scaffolder; it does not launch processes or interpret native paths.
11
+ */
2
12
  export declare namespace NestiaStarter {
3
13
  const clone: (halter: (msg?: string) => never, context?: NestiaProjectTemplate.IContext) => (argv: string[]) => Promise<void>;
4
14
  }
@@ -2,6 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NestiaStarter = void 0;
4
4
  const NestiaProjectTemplate_js_1 = require("./NestiaProjectTemplate.js");
5
+ /**
6
+ * The `nestia start` command: clones the Nestia starter kit, builds it, and
7
+ * runs its tests.
8
+ *
9
+ * @evidence contracts/common.md#principled-implementation It binds the starter kit's title and repository and enables the test step, which is all that distinguishes it from the template command, so its behavior is exactly the shared flow's.
10
+ * @evidence contracts/common.md#clear-and-simple-design A one-member namespace whose only job is naming the bound command that `index.ts` imports lazily.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The values are contract constants (the published starter repository URL), not special cases of any consumer.
12
+ * @evidence contracts/common.md#meaningful-documentation The comment names the command and what it does; the shared flow documents the details.
13
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation This namespace supplies a title, repository URL and test flag to the shared scaffolder; it does not launch processes or interpret native paths.
14
+ */
5
15
  var NestiaStarter;
6
16
  (function (NestiaStarter) {
7
17
  NestiaStarter.clone = NestiaProjectTemplate_js_1.NestiaProjectTemplate.clone({
@@ -1 +1 @@
1
- {"version":3,"file":"NestiaStarter.js","sourceRoot":"","sources":["../src/NestiaStarter.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AAEnE,IAAiB,aAAa,CAM7B;AAND,WAAiB,aAAa;IACf,mBAAK,GAAG,gDAAqB,CAAC,KAAK,CAAC;QAC/C,KAAK,EAAE,oBAAoB;QAC3B,UAAU,EAAE,yCAAyC;QACrD,IAAI,EAAE,IAAI;KACX,CAAC,CAAC;AACL,CAAC,EANgB,aAAa,aAAb,aAAa,GAAb,aAAa,QAM7B"}
1
+ {"version":3,"file":"NestiaStarter.js","sourceRoot":"","sources":["../src/NestiaStarter.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AAEnE;;;;;;;;;GASG;AACH,IAAiB,aAAa,CAM7B;AAND,WAAiB,aAAa;IACf,mBAAK,GAAG,gDAAqB,CAAC,KAAK,CAAC;QAC/C,KAAK,EAAE,oBAAoB;QAC3B,UAAU,EAAE,yCAAyC;QACrD,IAAI,EAAE,IAAI;KACX,CAAC,CAAC;AACL,CAAC,EANgB,aAAa,aAAb,aAAa,GAAb,aAAa,QAM7B"}
@@ -1,4 +1,14 @@
1
1
  import { NestiaProjectTemplate } from "./NestiaProjectTemplate.js";
2
+ /**
3
+ * The `nestia template` command: clones the backend template kit and builds it
4
+ * without running its tests.
5
+ *
6
+ * @evidence contracts/common.md#principled-implementation It binds the template kit's title and repository with the test step disabled, so its behavior is exactly the shared flow's with that one difference.
7
+ * @evidence contracts/common.md#clear-and-simple-design A one-member namespace whose only job is naming the bound command that `index.ts` imports lazily.
8
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The values are contract constants (the published template repository URL), not special cases of any consumer.
9
+ * @evidence contracts/common.md#meaningful-documentation The comment names the command and its difference from the starter; the shared flow documents the details.
10
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation This namespace supplies a title, repository URL and test flag to the shared scaffolder; it does not launch processes or interpret native paths.
11
+ */
2
12
  export declare namespace NestiaTemplate {
3
13
  const clone: (halter: (msg?: string) => never, context?: NestiaProjectTemplate.IContext) => (argv: string[]) => Promise<void>;
4
14
  }
@@ -2,6 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NestiaTemplate = void 0;
4
4
  const NestiaProjectTemplate_js_1 = require("./NestiaProjectTemplate.js");
5
+ /**
6
+ * The `nestia template` command: clones the backend template kit and builds it
7
+ * without running its tests.
8
+ *
9
+ * @evidence contracts/common.md#principled-implementation It binds the template kit's title and repository with the test step disabled, so its behavior is exactly the shared flow's with that one difference.
10
+ * @evidence contracts/common.md#clear-and-simple-design A one-member namespace whose only job is naming the bound command that `index.ts` imports lazily.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The values are contract constants (the published template repository URL), not special cases of any consumer.
12
+ * @evidence contracts/common.md#meaningful-documentation The comment names the command and its difference from the starter; the shared flow documents the details.
13
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation This namespace supplies a title, repository URL and test flag to the shared scaffolder; it does not launch processes or interpret native paths.
14
+ */
5
15
  var NestiaTemplate;
6
16
  (function (NestiaTemplate) {
7
17
  NestiaTemplate.clone = NestiaProjectTemplate_js_1.NestiaProjectTemplate.clone({
@@ -1 +1 @@
1
- {"version":3,"file":"NestiaTemplate.js","sourceRoot":"","sources":["../src/NestiaTemplate.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AAEnE,IAAiB,cAAc,CAM9B;AAND,WAAiB,cAAc;IAChB,oBAAK,GAAG,gDAAqB,CAAC,KAAK,CAAC;QAC/C,KAAK,EAAE,qBAAqB;QAC5B,UAAU,EAAE,oCAAoC;QAChD,IAAI,EAAE,KAAK;KACZ,CAAC,CAAC;AACL,CAAC,EANgB,cAAc,aAAd,cAAc,GAAd,cAAc,QAM9B"}
1
+ {"version":3,"file":"NestiaTemplate.js","sourceRoot":"","sources":["../src/NestiaTemplate.ts"],"names":[],"mappings":";;;AAAA,yEAAmE;AAEnE;;;;;;;;;GASG;AACH,IAAiB,cAAc,CAM9B;AAND,WAAiB,cAAc;IAChB,oBAAK,GAAG,gDAAqB,CAAC,KAAK,CAAC;QAC/C,KAAK,EAAE,qBAAqB;QAC5B,UAAU,EAAE,oCAAoC;QAChD,IAAI,EAAE,KAAK;KACZ,CAAC,CAAC;AACL,CAAC,EANgB,cAAc,aAAd,cAAc,GAAd,cAAc,QAM9B"}
package/bin/index.d.ts CHANGED
@@ -1,4 +1,15 @@
1
1
  #!/usr/bin/env node
2
- declare const USAGE = "Wrong command has been detected. Use like below:\n\nnpx nestia [command] [options?]\n\n 1. npx nestia start <directory> [--repository <url>]\n 2. npx nestia template <directory> [--repository <url>]\n 3. npx nestia dependencies\n 4. npx nestia init\n 5. npx nestia sdk\n 6. npx nestia swagger [--watch]\n 7. npx nestia e2e\n 8. npx nestia all\n";
3
- declare function halt(desc: string): never;
4
- declare function main(): Promise<void>;
2
+ /**
3
+ * Dispatches the command in the current process arguments.
4
+ *
5
+ * Scaffold commands load only their engine. Generator commands require the
6
+ * installed SDK executable, which reads the unchanged process arguments itself.
7
+ * Missing SDK installation and unsupported commands terminate with guidance.
8
+ *
9
+ * @evidence contracts/common.md#principled-implementation The command discriminant chooses the corresponding scaffold or the SDK executable; slicing arguments after the subcommand preserves the scaffolder's option values, while importing the SDK retains its process-argument contract.
10
+ * @evidence contracts/common.md#clear-and-simple-design One dispatcher owns command selection and SDK installation guidance. The scaffold engines own their lifecycle, and the SDK executable owns generator behavior.
11
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The recognized names are the documented CLI commands, and require.resolve checks the installed SDK instead of guessing a workspace location or replacing its implementation.
12
+ * @evidence contracts/common.md#meaningful-documentation The comment identifies lazy dispatch, the SDK argument ownership and terminal failures; USAGE lists the supported invocations.
13
+ * @evidence contracts/portability.md#os-neutral-implementation Node module resolution locates the SDK through its package address on the current installation; relative module imports locate scaffold engines. The dispatcher launches no subprocess and leaves native executable handling to those engines.
14
+ */
15
+ export declare function main(): Promise<void>;
package/bin/index.js CHANGED
@@ -42,6 +42,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
42
42
  step((generator = generator.apply(thisArg, _arguments || [])).next());
43
43
  });
44
44
  };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.main = main;
45
47
  const USAGE = `Wrong command has been detected. Use like below:
46
48
 
47
49
  npx nestia [command] [options?]
@@ -59,6 +61,19 @@ function halt(desc) {
59
61
  console.error(desc);
60
62
  process.exit(-1);
61
63
  }
64
+ /**
65
+ * Dispatches the command in the current process arguments.
66
+ *
67
+ * Scaffold commands load only their engine. Generator commands require the
68
+ * installed SDK executable, which reads the unchanged process arguments itself.
69
+ * Missing SDK installation and unsupported commands terminate with guidance.
70
+ *
71
+ * @evidence contracts/common.md#principled-implementation The command discriminant chooses the corresponding scaffold or the SDK executable; slicing arguments after the subcommand preserves the scaffolder's option values, while importing the SDK retains its process-argument contract.
72
+ * @evidence contracts/common.md#clear-and-simple-design One dispatcher owns command selection and SDK installation guidance. The scaffold engines own their lifecycle, and the SDK executable owns generator behavior.
73
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The recognized names are the documented CLI commands, and require.resolve checks the installed SDK instead of guessing a workspace location or replacing its implementation.
74
+ * @evidence contracts/common.md#meaningful-documentation The comment identifies lazy dispatch, the SDK argument ownership and terminal failures; USAGE lists the supported invocations.
75
+ * @evidence contracts/portability.md#os-neutral-implementation Node module resolution locates the SDK through its package address on the current installation; relative module imports locate scaffold engines. The dispatcher launches no subprocess and leaves native executable handling to those engines.
76
+ */
62
77
  function main() {
63
78
  return __awaiter(this, void 0, void 0, function* () {
64
79
  const type = process.argv[2];
package/bin/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,MAAM,KAAK,GAAG;;;;;;;;;;;;CAYb,CAAC;AAEF,SAAS,IAAI,CAAC,IAAY;IACxB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC;AAED,SAAe,IAAI;;QACjB,MAAM,IAAI,GAAuB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjD,MAAM,IAAI,GAAa,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAE7C,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YACrB,MAAM,CACJ,wDAAa,oBAAoB,GAAC,CACnC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,I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AAI,CACF;oBACE,qCAAqC;oBACrC,0BAA0B;oBAC1B,4BAA4B;oBAC5B,wDAAwD;oBACxD,mBAAmB;iBACpB,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;YACJ,CAAC;YACD,yBAAa,QAAQ,uCAAC,CAAC;QACzB,CAAC;;YAAM,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;CAAA;AACD,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nestia",
3
- "version": "14.0.0",
3
+ "version": "14.0.2",
4
4
  "description": "Nestia CLI tool",
5
5
  "main": "bin/index.js",
6
6
  "bin": {
@@ -35,8 +35,8 @@
35
35
  "devDependencies": {
36
36
  "@types/node": "^25.3.3",
37
37
  "rimraf": "^6.1.3",
38
- "@nestia/core": "^14.0.0",
39
- "@nestia/sdk": "^14.0.0"
38
+ "@nestia/core": "^14.0.2",
39
+ "@nestia/sdk": "^14.0.2"
40
40
  },
41
41
  "files": [
42
42
  "bin",
@@ -50,7 +50,8 @@
50
50
  },
51
51
  "scripts": {
52
52
  "build": "rimraf bin && ttsc",
53
- "dev": "rimraf bin && ttsc --watch"
53
+ "dev": "rimraf bin && ttsc --watch",
54
+ "evidence": "evidence"
54
55
  },
55
56
  "types": "bin/index.d.ts"
56
57
  }
@@ -1,35 +1,127 @@
1
1
  import cp from "child_process";
2
2
  import fs from "fs";
3
3
 
4
+ /**
5
+ * Scaffolds a project from a template repository for `nestia start` and `nestia
6
+ * template`.
7
+ *
8
+ * The flow clones the repository, installs, builds, optionally tests, and then
9
+ * deletes the repository-only files. Command and file-system operations go
10
+ * through an injected `IContext`, so unit tests need no network or package
11
+ * manager. Logging and the corepack prompt environment flag remain process
12
+ * effects.
13
+ *
14
+ * @evidence contracts/common.md#principled-implementation The scaffold is the fixed sequence clone, install, build, optional test, cleanup, each step one explicit-argument command; the package manager is chosen by probing `pnpm` and then `corepack` because the template repositories are pnpm monorepos whose `catalog:` protocol npm cannot resolve.
15
+ * @evidence contracts/common.md#clear-and-simple-design One namespace owns the flow: clone is the sequence, IContext is the injected command/file-system boundary, and private parse, getPackageManager and commandOf each answer one question; NestiaStarter and NestiaTemplate bind a title, URL and test flag.
16
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Both templates run the identical flow parameterized by props, with no repository-name branches; the only ambient write is the documented corepack variable `COREPACK_ENABLE_DOWNLOAD_PROMPT`, set in the corepack branch to keep the prompt from blocking a scripted run.
17
+ * @evidence contracts/common.md#meaningful-documentation The namespace prose states what the flow does, its ordering, and why side effects are injected; the nested types and `clone` carry their own documentation.
18
+ * @evidence contracts/portability.md#os-neutral-implementation The only platform difference is how a program is launched. `git` runs directly through `execFileSync` with an argument array, while `pnpm` and `corepack`, which Windows installs as `.cmd` shims that Node refuses to start without a shell, run through `cmd.exe /d /s /c` with their fixed arguments on Windows and directly elsewhere. The repository and the destination are never part of a shell command line. The destination is a path relative to the current directory, its existence is the filesystem's own answer, and the directory change and the removal use Node's native calls. Remaining assumptions: `git` and a package manager are on `PATH`, and on a case-insensitive volume a destination spelled in another case than an existing directory is refused while a case-sensitive volume would accept it.
19
+ */
4
20
  export namespace NestiaProjectTemplate {
5
21
  /**
6
22
  * Side effects performed while scaffolding a template project.
7
23
  *
8
24
  * Injected so that the scaffolding flow can be unit tested without touching
9
25
  * the network, the file system, or a real package manager.
26
+ *
27
+ * @evidence contracts/common.md#principled-implementation The interface represents command execution/probing, directory changes, existence checks and removal as function members, so a fake can record those operations and production can delegate them to child_process and fs. Logging and the corepack prompt flag are separate process effects documented by the namespace.
28
+ * @evidence contracts/common.md#clear-and-simple-design Five members, one per distinct effect, with no default behavior in the type; the real implementation is the private `CONTEXT` constant, which keeps the interface a pure seam.
29
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The seam exists because the flow performs process and file-system effects, not to serve a particular test: the production `CONTEXT` implements every member with the real operation.
30
+ * @evidence contracts/common.md#meaningful-documentation The type documentation says the effects are injected for offline testing, and each member states its contract in one sentence.
31
+ * @evidence contracts/portability.md#os-neutral-implementation The interface names the effects whose platform spelling lives in the production context: launching a program with an argument vector, silent probing of an executable, changing the working directory, testing existence and removing a tree.
10
32
  */
11
33
  export interface IContext {
12
- /** Runs an executable with explicit arguments, inheriting stdio. */
34
+ /**
35
+ * Runs an executable with explicit arguments, inheriting stdio.
36
+ *
37
+ * @evidence contracts/common.md#principled-implementation An executable and an argument array, never a command string, mirror `execFileSync` semantics, so the flow never depends on shell quoting; inherited stdio lets the user see the clone and install output.
38
+ * @evidence contracts/common.md#clear-and-simple-design One member for commands whose output the user must see and whose failure must stop the flow, separate from the silent `probe`.
39
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The production implementation runs the requested command; no command is skipped or rewritten based on the repository or destination.
40
+ * @evidence contracts/common.md#meaningful-documentation The comment states the argument representation and that stdio is inherited.
41
+ * @evidence contracts/portability.md#os-neutral-implementation The executable and its arguments are separate values, so no quoting rule of any shell is part of the contract, and standard streams are inherited so the platform's terminal shows the program's output.
42
+ */
13
43
  execute: (executable: string, args: readonly string[]) => void;
14
- /** Silently checks whether an executable accepts the supplied arguments. */
44
+
45
+ /**
46
+ * Silently checks whether an executable accepts the supplied arguments.
47
+ *
48
+ * @evidence contracts/common.md#principled-implementation A probe runs the executable with the given arguments and reports success as a boolean, which is enough to decide whether `pnpm --version` or `corepack --version` is available without interpreting output.
49
+ * @evidence contracts/common.md#clear-and-simple-design Separate from `execute` because a probe is silent and its failure is an answer rather than an error.
50
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Availability is decided by actually invoking the tool; no PATH scan is guessed and no tool name is assumed present.
51
+ * @evidence contracts/common.md#meaningful-documentation The comment states that the check is silent and returns whether the executable accepted the arguments.
52
+ * @evidence contracts/portability.md#os-neutral-implementation A program that cannot be started, as a missing executable on any platform, and one that exits non-zero both answer `false`, because the production context catches the failure of `execFileSync` instead of distinguishing platform error codes.
53
+ */
15
54
  probe: (executable: string, args: readonly string[]) => boolean;
16
- /** Changes the working directory. */
55
+
56
+ /**
57
+ * Changes the working directory.
58
+ *
59
+ * @evidence contracts/common.md#principled-implementation The flow must run install and build inside the cloned directory, and changing the working directory of the process is the one operation that redirects every later relative command.
60
+ * @evidence contracts/common.md#clear-and-simple-design A single-purpose member so a fake can record the directory the flow entered.
61
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The production implementation calls `process.chdir` on the requested path, with no fallback directory.
62
+ * @evidence contracts/common.md#meaningful-documentation The comment names the effect, a working-directory change.
63
+ * @evidence contracts/portability.md#os-neutral-implementation `process.chdir` changes the working directory of the whole process, so the flow supports one scaffold per process at a time.
64
+ */
17
65
  chdir: (directory: string) => void;
18
- /** Checks whether a path exists. */
66
+
67
+ /**
68
+ * Checks whether a path exists.
69
+ *
70
+ * @evidence contracts/common.md#principled-implementation Refusing to scaffold into an existing directory needs one boolean existence check for the destination path.
71
+ * @evidence contracts/common.md#clear-and-simple-design One question with one boolean answer, kept apart from removal.
72
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The production implementation asks the file system directly, with no cached listing.
73
+ * @evidence contracts/common.md#meaningful-documentation The comment states that it checks whether a path exists.
74
+ * @evidence contracts/portability.md#os-neutral-implementation Node's `existsSync` lets the volume decide the case policy and the links, and nothing is canonicalized.
75
+ */
19
76
  exists: (path: string) => boolean;
20
- /** Removes a path recursively, ignoring missing entries. */
77
+
78
+ /**
79
+ * Removes a path recursively, ignoring missing entries.
80
+ *
81
+ * @evidence contracts/common.md#principled-implementation Deleting the repository-only files (`.git`, `.github/dependabot.yml`) after scaffolding is a recursive removal that must succeed when the entry is already absent.
82
+ * @evidence contracts/common.md#clear-and-simple-design One effect, isolated so a fake can record which paths the flow removed.
83
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The production implementation uses `fs.rmSync` with `recursive` and `force`, which is the supported way to make a missing path a no-op, not a swallowed error handler.
84
+ * @evidence contracts/common.md#meaningful-documentation The comment states that removal is recursive and ignores missing entries.
85
+ * @evidence contracts/portability.md#os-neutral-implementation `fs.rmSync` with `recursive` and `force` also removes the read-only files a clone leaves in `.git` on Windows, and a missing entry is not an error on any platform.
86
+ */
21
87
  remove: (path: string) => void;
22
88
  }
23
89
 
90
+ /**
91
+ * Per-template constants that parameterize the shared scaffolding flow.
92
+ *
93
+ * @evidence contracts/common.md#principled-implementation The three fields are the only differences between the starter and the template kits: what to announce, where to clone from, and whether to run the tests.
94
+ * @evidence contracts/common.md#clear-and-simple-design A flat record of per-template constants with no behavior.
95
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Template-specific values live in data passed to one flow, which avoids branching on a template name inside the flow.
96
+ * @evidence contracts/common.md#meaningful-documentation Each field documents its role, including that the repository is overridable through `--repository <url>`.
97
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation The record holds a banner, a URL string and a flag, which are ordinary options and not a path or process representation; the repository is passed to git as one argument.
98
+ */
24
99
  export interface IProps {
25
100
  /** Banner title printed before cloning. */
26
101
  title: string;
102
+
27
103
  /** Default repository URL, overridable through `--repository <url>`. */
28
104
  repository: string;
105
+
29
106
  /** Whether to run the test suite after building. */
30
107
  test: boolean;
31
108
  }
32
109
 
110
+ /**
111
+ * Creates the `nestia start` or `nestia template` command for one template.
112
+ *
113
+ * The returned function takes a halter that terminates the process, an
114
+ * optional context, and the command-line arguments after the sub-command. It
115
+ * halts when the destination is missing or already exists, when the
116
+ * destination or the repository starts with a dash, when `--repository` has
117
+ * no value, or when neither pnpm nor corepack is available.
118
+ *
119
+ * @evidence contracts/common.md#principled-implementation Currying separates the per-template props from the halter and context injected at the call site. Argument and destination validation precede cloning, and a destination or repository that starts with a dash is refused because git would read it as an option; package-manager availability is checked after entering the clone, so an unavailable manager leaves that clone in place without installing or building it. Ordered execute calls implement the documented scaffold sequence.
120
+ * @evidence contracts/common.md#clear-and-simple-design One curried function keeps the sequence readable in one place, delegating parsing, package-manager selection, and command shaping to private helpers rather than to options.
121
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The flow contains no fixture or repository names, and the injected context is the production seam: the default `CONTEXT` performs the real clone, install, build, and cleanup.
122
+ * @evidence contracts/common.md#meaningful-documentation The comment states the halting conditions and the injected parameters, and section comments inside the body mark the phases.
123
+ * @evidence contracts/portability.md#os-neutral-implementation Every program invocation is one `execute` call with an argument vector, and the pnpm or corepack choice is made by probing, not by an operating-system name. A destination or repository starting with a dash is refused, since git would read it as an option and the vector has no separator.
124
+ */
33
125
  export const clone =
34
126
  (props: IProps) =>
35
127
  (halter: (msg?: string) => never, context: IContext = CONTEXT) =>
@@ -37,6 +129,10 @@ export namespace NestiaProjectTemplate {
37
129
  // VALIDATION
38
130
  const { dest, repository } = parse(argv, halter);
39
131
  if (dest === undefined) halter();
132
+ else if (dest.startsWith("-") || repository?.startsWith("-") === true)
133
+ halter(
134
+ "The destination and the repository must not start with a dash, which git would read as an option.",
135
+ );
40
136
  else if (context.exists(dest) === true)
41
137
  halter("The target directory already exists.");
42
138
 
@@ -114,8 +210,9 @@ export namespace NestiaProjectTemplate {
114
210
  "",
115
211
  " npm install --global pnpm",
116
212
  "",
117
- "or activate it through corepack (bundled with Node.js):",
213
+ "or install and activate corepack:",
118
214
  "",
215
+ " npm install --global corepack",
119
216
  " corepack enable",
120
217
  ].join("\n"),
121
218
  );
@@ -1,5 +1,15 @@
1
1
  import { NestiaProjectTemplate } from "./NestiaProjectTemplate.js";
2
2
 
3
+ /**
4
+ * The `nestia start` command: clones the Nestia starter kit, builds it, and
5
+ * runs its tests.
6
+ *
7
+ * @evidence contracts/common.md#principled-implementation It binds the starter kit's title and repository and enables the test step, which is all that distinguishes it from the template command, so its behavior is exactly the shared flow's.
8
+ * @evidence contracts/common.md#clear-and-simple-design A one-member namespace whose only job is naming the bound command that `index.ts` imports lazily.
9
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The values are contract constants (the published starter repository URL), not special cases of any consumer.
10
+ * @evidence contracts/common.md#meaningful-documentation The comment names the command and what it does; the shared flow documents the details.
11
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation This namespace supplies a title, repository URL and test flag to the shared scaffolder; it does not launch processes or interpret native paths.
12
+ */
3
13
  export namespace NestiaStarter {
4
14
  export const clone = NestiaProjectTemplate.clone({
5
15
  title: "Nestia Starter Kit",
@@ -1,5 +1,15 @@
1
1
  import { NestiaProjectTemplate } from "./NestiaProjectTemplate.js";
2
2
 
3
+ /**
4
+ * The `nestia template` command: clones the backend template kit and builds it
5
+ * without running its tests.
6
+ *
7
+ * @evidence contracts/common.md#principled-implementation It binds the template kit's title and repository with the test step disabled, so its behavior is exactly the shared flow's with that one difference.
8
+ * @evidence contracts/common.md#clear-and-simple-design A one-member namespace whose only job is naming the bound command that `index.ts` imports lazily.
9
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The values are contract constants (the published template repository URL), not special cases of any consumer.
10
+ * @evidence contracts/common.md#meaningful-documentation The comment names the command and its difference from the starter; the shared flow documents the details.
11
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation This namespace supplies a title, repository URL and test flag to the shared scaffolder; it does not launch processes or interpret native paths.
12
+ */
3
13
  export namespace NestiaTemplate {
4
14
  export const clone = NestiaProjectTemplate.clone({
5
15
  title: "Nestia Template Kit",
package/src/index.ts CHANGED
@@ -18,7 +18,20 @@ function halt(desc: string): never {
18
18
  process.exit(-1);
19
19
  }
20
20
 
21
- async function main(): Promise<void> {
21
+ /**
22
+ * Dispatches the command in the current process arguments.
23
+ *
24
+ * Scaffold commands load only their engine. Generator commands require the
25
+ * installed SDK executable, which reads the unchanged process arguments itself.
26
+ * Missing SDK installation and unsupported commands terminate with guidance.
27
+ *
28
+ * @evidence contracts/common.md#principled-implementation The command discriminant chooses the corresponding scaffold or the SDK executable; slicing arguments after the subcommand preserves the scaffolder's option values, while importing the SDK retains its process-argument contract.
29
+ * @evidence contracts/common.md#clear-and-simple-design One dispatcher owns command selection and SDK installation guidance. The scaffold engines own their lifecycle, and the SDK executable owns generator behavior.
30
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The recognized names are the documented CLI commands, and require.resolve checks the installed SDK instead of guessing a workspace location or replacing its implementation.
31
+ * @evidence contracts/common.md#meaningful-documentation The comment identifies lazy dispatch, the SDK argument ownership and terminal failures; USAGE lists the supported invocations.
32
+ * @evidence contracts/portability.md#os-neutral-implementation Node module resolution locates the SDK through its package address on the current installation; relative module imports locate scaffold engines. The dispatcher launches no subprocess and leaves native executable handling to those engines.
33
+ */
34
+ export async function main(): Promise<void> {
22
35
  const type: string | undefined = process.argv[2];
23
36
  const argv: string[] = process.argv.slice(3);
24
37