@pristine-ts/cli 1.0.440 → 2.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/dist/bin/pristine.cjs +7 -0
- package/dist/lib/cjs/bin.js +15 -1
- package/dist/lib/cjs/bin.js.map +1 -1
- package/dist/lib/cjs/bootstrap/app-module-loader.js +321 -0
- package/dist/lib/cjs/bootstrap/app-module-loader.js.map +1 -0
- package/dist/lib/cjs/bootstrap/bootstrap.js +31 -0
- package/dist/lib/cjs/bootstrap/bootstrap.js.map +1 -0
- package/dist/lib/cjs/bootstrap/build-manifest-checker.js +67 -0
- package/dist/lib/cjs/bootstrap/build-manifest-checker.js.map +1 -0
- package/dist/lib/cjs/bootstrap/build-manifest-reader.js +44 -0
- package/dist/lib/cjs/bootstrap/build-manifest-reader.js.map +1 -0
- package/dist/lib/cjs/bootstrap/build-manifest-staleness.enum.js +23 -0
- package/dist/lib/cjs/bootstrap/build-manifest-staleness.enum.js.map +1 -0
- package/dist/lib/cjs/bootstrap/build-manifest-writer.js +55 -0
- package/dist/lib/cjs/bootstrap/build-manifest-writer.js.map +1 -0
- package/dist/lib/cjs/bootstrap/build-manifest.js +31 -0
- package/dist/lib/cjs/bootstrap/build-manifest.js.map +1 -0
- package/dist/lib/cjs/bootstrap/build-runner.js +44 -0
- package/dist/lib/cjs/bootstrap/build-runner.js.map +1 -0
- package/dist/lib/cjs/bootstrap/build-staleness-prompt.js +90 -0
- package/dist/lib/cjs/bootstrap/build-staleness-prompt.js.map +1 -0
- package/dist/lib/cjs/bootstrap/dynamic-importer.js +43 -0
- package/dist/lib/cjs/bootstrap/dynamic-importer.js.map +1 -0
- package/dist/lib/cjs/bootstrap/init-prompt.js +127 -0
- package/dist/lib/cjs/bootstrap/init-prompt.js.map +1 -0
- package/dist/lib/cjs/bootstrap/loaded-app-module.js +29 -0
- package/dist/lib/cjs/bootstrap/loaded-app-module.js.map +1 -0
- package/dist/lib/cjs/bootstrap/loaded-plugin.js +22 -0
- package/dist/lib/cjs/bootstrap/loaded-plugin.js.map +1 -0
- package/dist/lib/cjs/bootstrap/plugin-loader.js +149 -0
- package/dist/lib/cjs/bootstrap/plugin-loader.js.map +1 -0
- package/dist/lib/cjs/bootstrap/source-hasher.js +41 -0
- package/dist/lib/cjs/bootstrap/source-hasher.js.map +1 -0
- package/dist/lib/cjs/cli.js +94 -111
- package/dist/lib/cjs/cli.js.map +1 -1
- package/dist/lib/cjs/cli.module.js +9 -1
- package/dist/lib/cjs/cli.module.js.map +1 -1
- package/dist/lib/cjs/commands/build-alias.command.js +50 -0
- package/dist/lib/cjs/commands/build-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/build.command.js +173 -0
- package/dist/lib/cjs/commands/build.command.js.map +1 -0
- package/dist/lib/cjs/commands/commands.js +15 -0
- package/dist/lib/cjs/commands/commands.js.map +1 -1
- package/dist/lib/cjs/commands/config-print.command.js +75 -0
- package/dist/lib/cjs/commands/config-print.command.js.map +1 -0
- package/dist/lib/cjs/commands/help-alias.command.js +52 -0
- package/dist/lib/cjs/commands/help-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/help.command.js +44 -10
- package/dist/lib/cjs/commands/help.command.js.map +1 -1
- package/dist/lib/cjs/commands/info-alias.command.js +50 -0
- package/dist/lib/cjs/commands/info-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/info.command.js +162 -0
- package/dist/lib/cjs/commands/info.command.js.map +1 -0
- package/dist/lib/cjs/commands/init-alias.command.js +51 -0
- package/dist/lib/cjs/commands/init-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/init.command-options.js +53 -0
- package/dist/lib/cjs/commands/init.command-options.js.map +1 -0
- package/dist/lib/cjs/commands/init.command.js +249 -0
- package/dist/lib/cjs/commands/init.command.js.map +1 -0
- package/dist/lib/cjs/commands/list-alias.command.js +50 -0
- package/dist/lib/cjs/commands/list-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/list.command.js +7 -1
- package/dist/lib/cjs/commands/list.command.js.map +1 -1
- package/dist/lib/cjs/commands/start-alias.command.js +51 -0
- package/dist/lib/cjs/commands/start-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/start.command-options.js +34 -0
- package/dist/lib/cjs/commands/start.command-options.js.map +1 -0
- package/dist/lib/cjs/commands/start.command.js +169 -0
- package/dist/lib/cjs/commands/start.command.js.map +1 -0
- package/dist/lib/cjs/commands/verify-alias.command.js +50 -0
- package/dist/lib/cjs/commands/verify-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/verify.command.js +71 -0
- package/dist/lib/cjs/commands/verify.command.js.map +1 -0
- package/dist/lib/cjs/config/config-loader.js +136 -0
- package/dist/lib/cjs/config/config-loader.js.map +1 -0
- package/dist/lib/cjs/config/config-provenance.enum.js +15 -0
- package/dist/lib/cjs/config/config-provenance.enum.js.map +1 -0
- package/dist/lib/cjs/config/config.js +22 -0
- package/dist/lib/cjs/config/config.js.map +1 -0
- package/dist/lib/cjs/config/define-config.js +18 -0
- package/dist/lib/cjs/config/define-config.js.map +1 -0
- package/dist/lib/cjs/config/pristine-config.interface.js +3 -0
- package/dist/lib/cjs/config/pristine-config.interface.js.map +1 -0
- package/dist/lib/cjs/config/resolved-pristine-config.js +25 -0
- package/dist/lib/cjs/config/resolved-pristine-config.js.map +1 -0
- package/dist/lib/cjs/event-handlers/cli.event-handler.js +69 -48
- package/dist/lib/cjs/event-handlers/cli.event-handler.js.map +1 -1
- package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/lib/esm/bin.js +15 -1
- package/dist/lib/esm/bin.js.map +1 -1
- package/dist/lib/esm/bootstrap/app-module-loader.js +315 -0
- package/dist/lib/esm/bootstrap/app-module-loader.js.map +1 -0
- package/dist/lib/esm/bootstrap/bootstrap.js +15 -0
- package/dist/lib/esm/bootstrap/bootstrap.js.map +1 -0
- package/dist/lib/esm/bootstrap/build-manifest-checker.js +61 -0
- package/dist/lib/esm/bootstrap/build-manifest-checker.js.map +1 -0
- package/dist/lib/esm/bootstrap/build-manifest-reader.js +38 -0
- package/dist/lib/esm/bootstrap/build-manifest-reader.js.map +1 -0
- package/dist/lib/esm/bootstrap/build-manifest-staleness.enum.js +20 -0
- package/dist/lib/esm/bootstrap/build-manifest-staleness.enum.js.map +1 -0
- package/dist/lib/esm/bootstrap/build-manifest-writer.js +49 -0
- package/dist/lib/esm/bootstrap/build-manifest-writer.js.map +1 -0
- package/dist/lib/esm/bootstrap/build-manifest.js +27 -0
- package/dist/lib/esm/bootstrap/build-manifest.js.map +1 -0
- package/dist/lib/esm/bootstrap/build-runner.js +41 -0
- package/dist/lib/esm/bootstrap/build-runner.js.map +1 -0
- package/dist/lib/esm/bootstrap/build-staleness-prompt.js +87 -0
- package/dist/lib/esm/bootstrap/build-staleness-prompt.js.map +1 -0
- package/dist/lib/esm/bootstrap/dynamic-importer.js +40 -0
- package/dist/lib/esm/bootstrap/dynamic-importer.js.map +1 -0
- package/dist/lib/esm/bootstrap/init-prompt.js +124 -0
- package/dist/lib/esm/bootstrap/init-prompt.js.map +1 -0
- package/dist/lib/esm/bootstrap/loaded-app-module.js +25 -0
- package/dist/lib/esm/bootstrap/loaded-app-module.js.map +1 -0
- package/dist/lib/esm/bootstrap/loaded-plugin.js +18 -0
- package/dist/lib/esm/bootstrap/loaded-plugin.js.map +1 -0
- package/dist/lib/esm/bootstrap/plugin-loader.js +143 -0
- package/dist/lib/esm/bootstrap/plugin-loader.js.map +1 -0
- package/dist/lib/esm/bootstrap/source-hasher.js +35 -0
- package/dist/lib/esm/bootstrap/source-hasher.js.map +1 -0
- package/dist/lib/esm/cli.js +109 -0
- package/dist/lib/esm/cli.js.map +1 -0
- package/dist/lib/esm/cli.module.js +7 -0
- package/dist/lib/esm/cli.module.js.map +1 -1
- package/dist/lib/esm/commands/build-alias.command.js +47 -0
- package/dist/lib/esm/commands/build-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/build.command.js +167 -0
- package/dist/lib/esm/commands/build.command.js.map +1 -0
- package/dist/lib/esm/commands/commands.js +15 -0
- package/dist/lib/esm/commands/commands.js.map +1 -1
- package/dist/lib/esm/commands/config-print.command.js +69 -0
- package/dist/lib/esm/commands/config-print.command.js.map +1 -0
- package/dist/lib/esm/commands/help-alias.command.js +49 -0
- package/dist/lib/esm/commands/help-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/help.command.js +44 -10
- package/dist/lib/esm/commands/help.command.js.map +1 -1
- package/dist/lib/esm/commands/info-alias.command.js +47 -0
- package/dist/lib/esm/commands/info-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/info.command.js +156 -0
- package/dist/lib/esm/commands/info.command.js.map +1 -0
- package/dist/lib/esm/commands/init-alias.command.js +48 -0
- package/dist/lib/esm/commands/init-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/init.command-options.js +49 -0
- package/dist/lib/esm/commands/init.command-options.js.map +1 -0
- package/dist/lib/esm/commands/init.command.js +243 -0
- package/dist/lib/esm/commands/init.command.js.map +1 -0
- package/dist/lib/esm/commands/list-alias.command.js +47 -0
- package/dist/lib/esm/commands/list-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/list.command.js +8 -2
- package/dist/lib/esm/commands/list.command.js.map +1 -1
- package/dist/lib/esm/commands/start-alias.command.js +48 -0
- package/dist/lib/esm/commands/start-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/start.command-options.js +30 -0
- package/dist/lib/esm/commands/start.command-options.js.map +1 -0
- package/dist/lib/esm/commands/start.command.js +166 -0
- package/dist/lib/esm/commands/start.command.js.map +1 -0
- package/dist/lib/esm/commands/verify-alias.command.js +47 -0
- package/dist/lib/esm/commands/verify-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/verify.command.js +68 -0
- package/dist/lib/esm/commands/verify.command.js.map +1 -0
- package/dist/lib/esm/config/config-loader.js +130 -0
- package/dist/lib/esm/config/config-loader.js.map +1 -0
- package/dist/lib/esm/config/config-provenance.enum.js +12 -0
- package/dist/lib/esm/config/config-provenance.enum.js.map +1 -0
- package/dist/lib/esm/config/config.js +6 -0
- package/dist/lib/esm/config/config.js.map +1 -0
- package/dist/lib/esm/config/define-config.js +14 -0
- package/dist/lib/esm/config/define-config.js.map +1 -0
- package/dist/lib/esm/config/pristine-config.interface.js +2 -0
- package/dist/lib/esm/config/pristine-config.interface.js.map +1 -0
- package/dist/lib/esm/config/resolved-pristine-config.js +21 -0
- package/dist/lib/esm/config/resolved-pristine-config.js.map +1 -0
- package/dist/lib/esm/event-handlers/cli.event-handler.js +69 -48
- package/dist/lib/esm/event-handlers/cli.event-handler.js.map +1 -1
- package/dist/lib/esm/tsconfig.tsbuildinfo +1 -0
- package/dist/types/bootstrap/app-module-loader.d.ts +83 -0
- package/dist/types/bootstrap/bootstrap.d.ts +14 -0
- package/dist/types/bootstrap/build-manifest-checker.d.ts +19 -0
- package/dist/types/bootstrap/build-manifest-reader.d.ts +14 -0
- package/dist/types/bootstrap/build-manifest-staleness.enum.d.ts +18 -0
- package/dist/types/bootstrap/build-manifest-writer.d.ts +19 -0
- package/dist/types/bootstrap/build-manifest.d.ts +29 -0
- package/dist/types/bootstrap/build-runner.d.ts +16 -0
- package/dist/types/bootstrap/build-staleness-prompt.d.ts +27 -0
- package/dist/types/bootstrap/dynamic-importer.d.ts +13 -0
- package/dist/types/bootstrap/init-prompt.d.ts +38 -0
- package/dist/types/bootstrap/loaded-app-module.d.ts +40 -0
- package/dist/types/bootstrap/loaded-plugin.d.ts +20 -0
- package/dist/types/bootstrap/plugin-loader.d.ts +35 -0
- package/dist/types/bootstrap/source-hasher.d.ts +15 -0
- package/dist/types/cli.d.ts +12 -0
- package/dist/types/cli.module.d.ts +3 -0
- package/dist/types/commands/build-alias.command.d.ts +15 -0
- package/dist/types/commands/build.command.d.ts +47 -0
- package/dist/types/commands/commands.d.ts +15 -0
- package/dist/types/commands/config-print.command.d.ts +18 -0
- package/dist/types/commands/help-alias.command.d.ts +17 -0
- package/dist/types/commands/help.command.d.ts +19 -1
- package/dist/types/commands/info-alias.command.d.ts +15 -0
- package/dist/types/commands/info.command.d.ts +41 -0
- package/dist/types/commands/init-alias.command.d.ts +16 -0
- package/dist/types/commands/init.command-options.d.ts +22 -0
- package/dist/types/commands/init.command.d.ts +60 -0
- package/dist/types/commands/list-alias.command.d.ts +15 -0
- package/dist/types/commands/list.command.d.ts +6 -0
- package/dist/types/commands/start-alias.command.d.ts +16 -0
- package/dist/types/commands/start.command-options.d.ts +11 -0
- package/dist/types/commands/start.command.d.ts +47 -0
- package/dist/types/commands/verify-alias.command.d.ts +15 -0
- package/dist/types/commands/verify.command.d.ts +24 -0
- package/dist/types/config/config-loader.d.ts +40 -0
- package/dist/types/config/config-provenance.enum.d.ts +10 -0
- package/dist/types/config/config.d.ts +5 -0
- package/dist/types/config/define-config.d.ts +14 -0
- package/dist/types/config/pristine-config.interface.d.ts +67 -0
- package/dist/types/config/resolved-pristine-config.d.ts +28 -0
- package/dist/types/event-handlers/cli.event-handler.d.ts +30 -3
- package/dist/types/interfaces/command.interface.d.ts +31 -3
- package/package.json +16 -13
- package/readme.md +1023 -17
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./app-module-loader";
|
|
2
|
+
export * from "./build-manifest";
|
|
3
|
+
export * from "./build-manifest-checker";
|
|
4
|
+
export * from "./build-manifest-reader";
|
|
5
|
+
export * from "./build-manifest-staleness.enum";
|
|
6
|
+
export * from "./build-manifest-writer";
|
|
7
|
+
export * from "./build-runner";
|
|
8
|
+
export * from "./build-staleness-prompt";
|
|
9
|
+
export * from "./dynamic-importer";
|
|
10
|
+
export * from "./init-prompt";
|
|
11
|
+
export * from "./loaded-app-module";
|
|
12
|
+
export * from "./loaded-plugin";
|
|
13
|
+
export * from "./plugin-loader";
|
|
14
|
+
export * from "./source-hasher";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BuildManifest } from "./build-manifest";
|
|
2
|
+
import { BuildManifestStalenessEnum } from "./build-manifest-staleness.enum";
|
|
3
|
+
import { SourceHasher } from "./source-hasher";
|
|
4
|
+
/**
|
|
5
|
+
* Decides whether an existing `BuildManifest` still describes the current state of the
|
|
6
|
+
* project. Compares the manifest's stored paths/hash against the live config + source file
|
|
7
|
+
* + filesystem. Returns the most-specific reason the manifest is stale so the caller can
|
|
8
|
+
* render a helpful message ("source changed", "output missing", etc.) rather than a vague
|
|
9
|
+
* "stale".
|
|
10
|
+
*
|
|
11
|
+
* Order of checks matches user impact: things that mean "you definitely need to rebuild"
|
|
12
|
+
* (output missing, source content changed) come before path drift (config edited but build
|
|
13
|
+
* not yet rerun) — both are correct to flag, but the messaging differs.
|
|
14
|
+
*/
|
|
15
|
+
export declare class BuildManifestChecker {
|
|
16
|
+
private readonly sourceHasher;
|
|
17
|
+
constructor(sourceHasher: SourceHasher);
|
|
18
|
+
check(manifest: BuildManifest | undefined, projectRoot: string, configuredSourcePath: string, configuredOutputPath: string): BuildManifestStalenessEnum;
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BuildManifest } from "./build-manifest";
|
|
2
|
+
/**
|
|
3
|
+
* Reads `<projectRoot>/.pristine/build-manifest.json` if present and returns a `BuildManifest`
|
|
4
|
+
* instance. Used by `AppModuleLoader` and `BuildManifestChecker` to inspect the last build.
|
|
5
|
+
*
|
|
6
|
+
* Returns `undefined` (not throws) when the manifest is missing — that's a normal state for
|
|
7
|
+
* fresh projects that haven't run `pristine build` yet. Genuine errors (corrupt JSON, IO
|
|
8
|
+
* failure) do throw, since silently treating those as "no manifest" would mask real problems.
|
|
9
|
+
*/
|
|
10
|
+
export declare class BuildManifestReader {
|
|
11
|
+
private readonly cacheDirName;
|
|
12
|
+
private readonly manifestFileName;
|
|
13
|
+
read(projectRoot: string): BuildManifest | undefined;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why a build manifest is no longer trustworthy. Returned by `BuildManifestChecker` so the
|
|
3
|
+
* caller can render an error message specific to the actual cause rather than a vague "stale".
|
|
4
|
+
*/
|
|
5
|
+
export declare enum BuildManifestStalenessEnum {
|
|
6
|
+
/** Manifest is current — the build output matches what the config + source describe. */
|
|
7
|
+
Fresh = "fresh",
|
|
8
|
+
/** No manifest file on disk. The user hasn't run `pristine build` yet (or deleted the cache). */
|
|
9
|
+
Missing = "missing",
|
|
10
|
+
/** The configured `sourcePath` no longer matches the path stored in the manifest. */
|
|
11
|
+
SourcePathChanged = "source-path-changed",
|
|
12
|
+
/** The configured `outputPath` no longer matches the path stored in the manifest. */
|
|
13
|
+
OutputPathChanged = "output-path-changed",
|
|
14
|
+
/** The source file's content hash no longer matches what was hashed at build time. */
|
|
15
|
+
SourceContentChanged = "source-content-changed",
|
|
16
|
+
/** The compiled output file referenced by the manifest is missing from disk. */
|
|
17
|
+
OutputMissing = "output-missing"
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BuildManifest } from "./build-manifest";
|
|
2
|
+
import { SourceHasher } from "./source-hasher";
|
|
3
|
+
/**
|
|
4
|
+
* Writes the build manifest to `<projectRoot>/.pristine/build-manifest.json` atomically
|
|
5
|
+
* (write-then-rename) so a partial write can never poison subsequent reads. Used by
|
|
6
|
+
* `BuildCommand` after a successful compile.
|
|
7
|
+
*
|
|
8
|
+
* Atomicity matters: if `pristine build` is interrupted (Ctrl+C, OOM kill) mid-write, a
|
|
9
|
+
* half-written JSON file would make the next `pristine start` think the build was good but
|
|
10
|
+
* fail to parse the manifest. Renaming after a complete write ensures readers either see
|
|
11
|
+
* the previous manifest or the new one — never a torn one.
|
|
12
|
+
*/
|
|
13
|
+
export declare class BuildManifestWriter {
|
|
14
|
+
private readonly sourceHasher;
|
|
15
|
+
private readonly cacheDirName;
|
|
16
|
+
private readonly manifestFileName;
|
|
17
|
+
constructor(sourceHasher: SourceHasher);
|
|
18
|
+
write(projectRoot: string, sourcePath: string, outputPath: string): BuildManifest;
|
|
19
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* On-disk record of what `pristine build` produced. Written atomically at the end of a
|
|
3
|
+
* successful build to `.pristine/build-manifest.json`. Read by every downstream command that
|
|
4
|
+
* loads the AppModule (`pristine start`, `pristine verify`, etc.) so the loader can detect
|
|
5
|
+
* staleness — source file changed, config changed, output file missing — without scanning
|
|
6
|
+
* the filesystem.
|
|
7
|
+
*
|
|
8
|
+
* Plain class (no DI / no methods) because manifests serialize to/from JSON and the simpler
|
|
9
|
+
* the shape is, the harder it is to break the on-disk contract by accident.
|
|
10
|
+
*/
|
|
11
|
+
export declare class BuildManifest {
|
|
12
|
+
/** Absolute path to the AppModule source file as it was at build time. */
|
|
13
|
+
readonly appModuleSourcePath: string;
|
|
14
|
+
/** Absolute path to the compiled AppModule output file as it was at build time. */
|
|
15
|
+
readonly appModuleOutputPath: string;
|
|
16
|
+
/** SHA-256 of the source file contents at build time. Drives staleness detection. */
|
|
17
|
+
readonly sourceHash: string;
|
|
18
|
+
/** ISO-8601 timestamp of when the build completed. */
|
|
19
|
+
readonly builtAt: string;
|
|
20
|
+
constructor(
|
|
21
|
+
/** Absolute path to the AppModule source file as it was at build time. */
|
|
22
|
+
appModuleSourcePath: string,
|
|
23
|
+
/** Absolute path to the compiled AppModule output file as it was at build time. */
|
|
24
|
+
appModuleOutputPath: string,
|
|
25
|
+
/** SHA-256 of the source file contents at build time. Drives staleness detection. */
|
|
26
|
+
sourceHash: string,
|
|
27
|
+
/** ISO-8601 timestamp of when the build completed. */
|
|
28
|
+
builtAt: string);
|
|
29
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs `pristine p:build` as a subprocess of the currently-running bin. Used by
|
|
3
|
+
* `AppModuleLoader` when the user accepts the "rebuild now?" prompt — re-running the build
|
|
4
|
+
* inline avoids the awkward "exit, ask the user to type a command, re-enter" loop.
|
|
5
|
+
*
|
|
6
|
+
* Spawning rather than dispatching to `BuildCommand` directly keeps `AppModuleLoader` free
|
|
7
|
+
* of the build pipeline's dependency graph (ConsoleManager, ShellManager, etc.) which only
|
|
8
|
+
* exists in the kernel container — and the kernel hasn't booted yet at the point this is
|
|
9
|
+
* called. The subprocess re-bootstraps the kernel cleanly with all of those services.
|
|
10
|
+
*
|
|
11
|
+
* Returns `true` on a successful build (exit code 0), `false` on any failure or signal.
|
|
12
|
+
*/
|
|
13
|
+
export declare class BuildRunner {
|
|
14
|
+
private readonly buildCommandName;
|
|
15
|
+
run(): boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BuildManifestStalenessEnum } from "./build-manifest-staleness.enum";
|
|
2
|
+
import { DynamicImporter } from "./dynamic-importer";
|
|
3
|
+
/**
|
|
4
|
+
* When the build manifest is stale (source edited, output missing, etc.), `AppModuleLoader`
|
|
5
|
+
* stops the load and consults this prompt. In a TTY, asks the user whether to run
|
|
6
|
+
* `pristine build` now; in non-TTY (CI, Docker), refuses to prompt and lets the caller exit
|
|
7
|
+
* non-zero with the explanation — auto-rebuilding in CI hides bugs.
|
|
8
|
+
*
|
|
9
|
+
* Just the prompt UI here. The actual rebuild dispatch is the caller's responsibility so
|
|
10
|
+
* this class stays small and testable.
|
|
11
|
+
*/
|
|
12
|
+
export declare class BuildStalenessPrompt {
|
|
13
|
+
private readonly dynamicImporter;
|
|
14
|
+
private readonly promptMessage;
|
|
15
|
+
constructor(dynamicImporter: DynamicImporter);
|
|
16
|
+
isInteractive(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Renders a one-line explanation of why the manifest is stale. Used by both the prompt
|
|
19
|
+
* (TTY) and the non-TTY error path so the messaging is identical regardless of channel.
|
|
20
|
+
*/
|
|
21
|
+
describe(reason: BuildManifestStalenessEnum): string;
|
|
22
|
+
/**
|
|
23
|
+
* Asks the user whether to rebuild. Returns `true` for yes, `false` for no, `undefined`
|
|
24
|
+
* for cancellation (Ctrl+C). Caller decides what to do with each outcome.
|
|
25
|
+
*/
|
|
26
|
+
prompt(reason: BuildManifestStalenessEnum): Promise<boolean | undefined>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps Node's real dynamic `import()` so it survives both tsc's CJS lowering and esbuild's
|
|
3
|
+
* bundling. Both transformations otherwise rewrite `await import(x)` to a `require(x)` call —
|
|
4
|
+
* which is wrong for ESM-only packages and for `file://` URLs. The Function constructor's body
|
|
5
|
+
* is opaque to both, so the `import()` inside it goes through unrewritten.
|
|
6
|
+
*
|
|
7
|
+
* Centralized in one class so the same escape hatch isn't reimplemented in every consumer
|
|
8
|
+
* (loaders, plugin discovery, config loading, etc.).
|
|
9
|
+
*/
|
|
10
|
+
export declare class DynamicImporter {
|
|
11
|
+
private readonly importFn;
|
|
12
|
+
import(specifier: string): Promise<any>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DynamicImporter } from "./dynamic-importer";
|
|
2
|
+
/**
|
|
3
|
+
* Answers the init flow needs to gather. Each field corresponds to one config value that
|
|
4
|
+
* `pristine.config.ts` will end up with. The init command resolves these from CLI flags
|
|
5
|
+
* first, then prompts (in TTY) for whatever's missing.
|
|
6
|
+
*/
|
|
7
|
+
export interface InitAnswers {
|
|
8
|
+
sourcePath: string;
|
|
9
|
+
outputPath: string;
|
|
10
|
+
tsconfig: string;
|
|
11
|
+
format: "esm" | "cjs" | "both";
|
|
12
|
+
scaffoldSource: boolean;
|
|
13
|
+
writePackageScripts: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Interactive Q&A for `pristine init`. Lazy-loads `@inquirer/prompts` so the dep cost is
|
|
17
|
+
* only paid when actually prompting (the same pattern as `BuildStalenessPrompt` uses).
|
|
18
|
+
*
|
|
19
|
+
* Each method takes a "current value" so callers can pre-fill answers from CLI flags and
|
|
20
|
+
* only prompt for the gaps. Returning the same value the user passed in is intentional —
|
|
21
|
+
* it keeps the call sites uniform regardless of whether the value came from a flag or a
|
|
22
|
+
* prompt.
|
|
23
|
+
*/
|
|
24
|
+
export declare class InitPrompt {
|
|
25
|
+
private readonly dynamicImporter;
|
|
26
|
+
private readonly defaultSourcePath;
|
|
27
|
+
private readonly defaultOutputPath;
|
|
28
|
+
private readonly defaultTsconfig;
|
|
29
|
+
private readonly defaultFormat;
|
|
30
|
+
constructor(dynamicImporter: DynamicImporter);
|
|
31
|
+
isInteractive(): boolean;
|
|
32
|
+
askSourcePath(current: string | undefined): Promise<string>;
|
|
33
|
+
askOutputPath(current: string | undefined): Promise<string>;
|
|
34
|
+
askTsconfig(current: string | undefined): Promise<string>;
|
|
35
|
+
askFormat(current: "esm" | "cjs" | "both" | undefined): Promise<"esm" | "cjs" | "both">;
|
|
36
|
+
askScaffoldSource(current: boolean | undefined, sourcePath: string): Promise<boolean>;
|
|
37
|
+
askWritePackageScripts(current: boolean | undefined): Promise<boolean>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AppModuleInterface } from "@pristine-ts/common";
|
|
2
|
+
import { ModuleConfigurationValue } from "@pristine-ts/configuration";
|
|
3
|
+
import { LoadedPlugin } from "./loaded-plugin";
|
|
4
|
+
/**
|
|
5
|
+
* The fully-resolved AppModule + ambient configuration that the CLI uses to boot the kernel.
|
|
6
|
+
* Returned by `AppModuleLoader.load()`.
|
|
7
|
+
*/
|
|
8
|
+
export declare class LoadedAppModule {
|
|
9
|
+
readonly appModule: AppModuleInterface;
|
|
10
|
+
readonly configuration: {
|
|
11
|
+
[key: string]: ModuleConfigurationValue;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* True when `LoggingModule` is in the resolved AppModule's import graph. The CLI uses
|
|
15
|
+
* this to decide whether to layer in opinionated default logging configuration (Simple
|
|
16
|
+
* output mode, Error severity threshold) on top of the kernel configuration.
|
|
17
|
+
*/
|
|
18
|
+
readonly isLoggingModulePresent: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Plugins loaded from `pristine.config.ts`'s `plugins` array. Empty when no plugins are
|
|
21
|
+
* declared. Carried through so commands like `pristine info` can show what's contributing
|
|
22
|
+
* extra modules to the runtime.
|
|
23
|
+
*/
|
|
24
|
+
readonly plugins: LoadedPlugin[];
|
|
25
|
+
constructor(appModule: AppModuleInterface, configuration: {
|
|
26
|
+
[key: string]: ModuleConfigurationValue;
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* True when `LoggingModule` is in the resolved AppModule's import graph. The CLI uses
|
|
30
|
+
* this to decide whether to layer in opinionated default logging configuration (Simple
|
|
31
|
+
* output mode, Error severity threshold) on top of the kernel configuration.
|
|
32
|
+
*/
|
|
33
|
+
isLoggingModulePresent: boolean,
|
|
34
|
+
/**
|
|
35
|
+
* Plugins loaded from `pristine.config.ts`'s `plugins` array. Empty when no plugins are
|
|
36
|
+
* declared. Carried through so commands like `pristine info` can show what's contributing
|
|
37
|
+
* extra modules to the runtime.
|
|
38
|
+
*/
|
|
39
|
+
plugins: LoadedPlugin[]);
|
|
40
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ModuleInterface } from "@pristine-ts/common";
|
|
2
|
+
/**
|
|
3
|
+
* A successfully-loaded plugin. Records the package name (for collision diagnostics), the
|
|
4
|
+
* absolute path it was resolved to, and every `*Module` export the plugin's entry produced.
|
|
5
|
+
*/
|
|
6
|
+
export declare class LoadedPlugin {
|
|
7
|
+
/** As declared in `pristine.config.ts` plugins[] (string form or `.name` form). */
|
|
8
|
+
readonly name: string;
|
|
9
|
+
/** Absolute path resolved by `createRequire` from the consumer's project. */
|
|
10
|
+
readonly resolvedPath: string;
|
|
11
|
+
/** Modules harvested from the plugin's exports — one entry per `*Module` named export. */
|
|
12
|
+
readonly modules: ModuleInterface[];
|
|
13
|
+
constructor(
|
|
14
|
+
/** As declared in `pristine.config.ts` plugins[] (string form or `.name` form). */
|
|
15
|
+
name: string,
|
|
16
|
+
/** Absolute path resolved by `createRequire` from the consumer's project. */
|
|
17
|
+
resolvedPath: string,
|
|
18
|
+
/** Modules harvested from the plugin's exports — one entry per `*Module` named export. */
|
|
19
|
+
modules: ModuleInterface[]);
|
|
20
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AppModuleInterface } from "@pristine-ts/common";
|
|
2
|
+
import { PristineConfig } from "../config/pristine-config.interface";
|
|
3
|
+
import { DynamicImporter } from "./dynamic-importer";
|
|
4
|
+
import { LoadedPlugin } from "./loaded-plugin";
|
|
5
|
+
/**
|
|
6
|
+
* Resolves and loads every plugin declared in `config.plugins`. Plugin packages are resolved
|
|
7
|
+
* from the **consumer's project**, not from the CLI's install location — a plugin lives in
|
|
8
|
+
* the consumer's `node_modules`, not in `@pristine-ts/cli/node_modules`. Without
|
|
9
|
+
* `createRequire` pinned to the project location, `import("@my-org/plugin")` would walk up
|
|
10
|
+
* from the bin's install dir and miss it.
|
|
11
|
+
*
|
|
12
|
+
* A plugin that fails to load surfaces as a thrown error rather than being silently skipped —
|
|
13
|
+
* silent plugin loading is a footgun that makes "why isn't my command showing up" debuggable
|
|
14
|
+
* only by reading source.
|
|
15
|
+
*/
|
|
16
|
+
export declare class PluginLoader {
|
|
17
|
+
private readonly dynamicImporter;
|
|
18
|
+
constructor(dynamicImporter: DynamicImporter);
|
|
19
|
+
load(config: PristineConfig, configFilePath: string | undefined, projectRoot: string): Promise<LoadedPlugin[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Synthesizes an outer AppModule whose `importModules` includes the user's AppModule plus
|
|
22
|
+
* every plugin-contributed module, deduplicated by reference. Preserves the user's keyname
|
|
23
|
+
* (suffixed with `.with-plugins`) so introspection tools (`pristine info`) still surface a
|
|
24
|
+
* recognizable label.
|
|
25
|
+
*/
|
|
26
|
+
wrap(appModule: AppModuleInterface, plugins: LoadedPlugin[]): AppModuleInterface;
|
|
27
|
+
private resolvePluginPath;
|
|
28
|
+
private importPlugin;
|
|
29
|
+
/**
|
|
30
|
+
* Walks a plugin's exports collecting every value whose name ends in `Module` and looks
|
|
31
|
+
* like a `ModuleInterface` (has a `keyname` string). Accepts both ESM (default export) and
|
|
32
|
+
* CJS (named exports on the module namespace) plugin shapes.
|
|
33
|
+
*/
|
|
34
|
+
private harvestModuleExports;
|
|
35
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computes the content hash that goes into the build manifest. SHA-256 because it's
|
|
3
|
+
* collision-free for our purposes, ships with Node, and the hex digest is short enough
|
|
4
|
+
* to pretty-print in error messages without truncating.
|
|
5
|
+
*
|
|
6
|
+
* The hash is just a fingerprint of the source file's bytes — no AST awareness, no
|
|
7
|
+
* imports-aware tracing. That's intentional: a deeper hash (e.g. of the whole source tree)
|
|
8
|
+
* adds complexity and IO without changing the staleness story for the common case (user
|
|
9
|
+
* edits app.module.ts → hash changes → CLI tells them to rebuild).
|
|
10
|
+
*/
|
|
11
|
+
export declare class SourceHasher {
|
|
12
|
+
private readonly algorithm;
|
|
13
|
+
private readonly digestPrefix;
|
|
14
|
+
hashFile(absolutePath: string): string;
|
|
15
|
+
}
|
package/dist/types/cli.d.ts
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boots the CLI: discovers the consumer's AppModule, starts the kernel, and dispatches
|
|
3
|
+
* `process.argv` to whichever command matches. Exported so `bin.ts` can call it explicitly
|
|
4
|
+
* — the auto-invoke at module load was removed so library consumers importing this file for
|
|
5
|
+
* its types or `bootstrap` reference do not accidentally trigger an entire kernel boot.
|
|
6
|
+
*
|
|
7
|
+
* The bootstrap-layer collaborators (loaders, discoverers, cache, prompt) are instantiated
|
|
8
|
+
* by hand here rather than resolved through DI. The kernel container does not exist yet at
|
|
9
|
+
* this point, so DI is not available — manually wiring the (small, stable) class graph is the
|
|
10
|
+
* least surprising option. Once the kernel is up, the kernel itself is registered into its
|
|
11
|
+
* own container so commands can inject it.
|
|
12
|
+
*/
|
|
1
13
|
export declare const bootstrap: () => Promise<void>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ModuleInterface } from "@pristine-ts/common";
|
|
2
|
+
export * from "./bootstrap/bootstrap";
|
|
2
3
|
export * from "./commands/commands";
|
|
4
|
+
export * from "./config/config";
|
|
3
5
|
export * from "./enums/enums";
|
|
4
6
|
export * from "./errors/errors";
|
|
5
7
|
export * from "./event-handlers/event-handlers";
|
|
@@ -9,4 +11,5 @@ export * from "./managers/managers";
|
|
|
9
11
|
export * from "./mappers/mappers";
|
|
10
12
|
export * from "./options/options";
|
|
11
13
|
export * from "./types/types";
|
|
14
|
+
export { bootstrap } from "./cli";
|
|
12
15
|
export declare const CliModule: ModuleInterface;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CommandInterface } from "../interfaces/command.interface";
|
|
2
|
+
import { ExitCodeEnum } from "../enums/exit-code.enum";
|
|
3
|
+
import { BuildCommand } from "./build.command";
|
|
4
|
+
/**
|
|
5
|
+
* Top-level alias for the framework-reserved `p:build` command. Injects the delegate
|
|
6
|
+
* directly via standard DI.
|
|
7
|
+
*/
|
|
8
|
+
export declare class BuildAliasCommand implements CommandInterface<null> {
|
|
9
|
+
private readonly delegate;
|
|
10
|
+
optionsType: null;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
constructor(delegate: BuildCommand);
|
|
14
|
+
run(args: any): Promise<ExitCodeEnum | number>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CommandInterface } from "../interfaces/command.interface";
|
|
2
|
+
import { ConsoleManager } from "../managers/console.manager";
|
|
3
|
+
import { ShellManager } from "../managers/shell.manager";
|
|
4
|
+
import { ExitCodeEnum } from "../enums/exit-code.enum";
|
|
5
|
+
import { ConfigLoader } from "../config/config-loader";
|
|
6
|
+
import { BuildManifestWriter } from "../bootstrap/build-manifest-writer";
|
|
7
|
+
/**
|
|
8
|
+
* Compiles the consumer's TypeScript project. Reads `build.{outDir,tsconfig,format,clean}`
|
|
9
|
+
* and `appModule.{sourcePath,outputPath}` from `pristine.config.ts`. After a successful
|
|
10
|
+
* compile, writes a build manifest at `<projectRoot>/.pristine/build-manifest.json` so
|
|
11
|
+
* downstream commands (`pristine start`, `pristine verify`) can detect when the build is
|
|
12
|
+
* stale (source edited, output deleted, paths reconfigured).
|
|
13
|
+
*
|
|
14
|
+
* The manifest is only written when both `appModule.sourcePath` and `appModule.outputPath`
|
|
15
|
+
* are configured. Without both, there's nothing to fingerprint and downstream commands fall
|
|
16
|
+
* through to the next layer of the loader cascade.
|
|
17
|
+
*
|
|
18
|
+
* Defaults (when not configured):
|
|
19
|
+
* - tsconfig: "tsconfig.json"
|
|
20
|
+
* - format: "esm" (single tsc invocation)
|
|
21
|
+
* - format: "cjs" (looks for tsconfig.cjs.json automatically)
|
|
22
|
+
* - format: "both" (runs both invocations sequentially)
|
|
23
|
+
* - outDir: not set; tsc writes to whatever the tsconfig declares
|
|
24
|
+
* - clean: false (set true to wipe outDir before building)
|
|
25
|
+
*/
|
|
26
|
+
export declare class BuildCommand implements CommandInterface<null> {
|
|
27
|
+
private readonly consoleManager;
|
|
28
|
+
private readonly shellManager;
|
|
29
|
+
private readonly configLoader;
|
|
30
|
+
private readonly buildManifestWriter;
|
|
31
|
+
optionsType: null;
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
private readonly defaultTsconfig;
|
|
35
|
+
private readonly defaultFormat;
|
|
36
|
+
constructor(consoleManager: ConsoleManager, shellManager: ShellManager, configLoader: ConfigLoader, buildManifestWriter: BuildManifestWriter);
|
|
37
|
+
run(args: any): Promise<ExitCodeEnum | number>;
|
|
38
|
+
private writeManifestIfConfigured;
|
|
39
|
+
/**
|
|
40
|
+
* For `format: "both"`, we run two passes: the primary tsconfig (assumed ESM-ish), then
|
|
41
|
+
* the `.cjs.json` sibling. For `cjs`/`esm`, we run only the matching one. Returns the
|
|
42
|
+
* absolute tsconfig paths in the order they should run.
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
private resolveTscInvocations;
|
|
46
|
+
private expectedTsconfigsForFormat;
|
|
47
|
+
}
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
+
export * from "./build-alias.command";
|
|
2
|
+
export * from "./build.command";
|
|
3
|
+
export * from "./config-print.command";
|
|
4
|
+
export * from "./help-alias.command";
|
|
1
5
|
export * from "./help.command";
|
|
6
|
+
export * from "./info-alias.command";
|
|
7
|
+
export * from "./info.command";
|
|
8
|
+
export * from "./init-alias.command";
|
|
9
|
+
export * from "./init.command";
|
|
10
|
+
export * from "./init.command-options";
|
|
11
|
+
export * from "./list-alias.command";
|
|
2
12
|
export * from "./list.command";
|
|
13
|
+
export * from "./start-alias.command";
|
|
14
|
+
export * from "./start.command";
|
|
15
|
+
export * from "./start.command-options";
|
|
16
|
+
export * from "./verify-alias.command";
|
|
17
|
+
export * from "./verify.command";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CommandInterface } from "../interfaces/command.interface";
|
|
2
|
+
import { ConsoleManager } from "../managers/console.manager";
|
|
3
|
+
import { ExitCodeEnum } from "../enums/exit-code.enum";
|
|
4
|
+
import { ConfigLoader } from "../config/config-loader";
|
|
5
|
+
/**
|
|
6
|
+
* Prints the resolved Pristine configuration plus where it was loaded from. Useful for
|
|
7
|
+
* debugging discovery — when `pristine` is doing something unexpected, the first question is
|
|
8
|
+
* always "which config file did it actually pick up?"
|
|
9
|
+
*/
|
|
10
|
+
export declare class ConfigPrintCommand implements CommandInterface<null> {
|
|
11
|
+
private readonly consoleManager;
|
|
12
|
+
private readonly configLoader;
|
|
13
|
+
optionsType: null;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
constructor(consoleManager: ConsoleManager, configLoader: ConfigLoader);
|
|
17
|
+
run(args: any): Promise<ExitCodeEnum | number>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CommandInterface } from "../interfaces/command.interface";
|
|
2
|
+
import { ExitCodeEnum } from "../enums/exit-code.enum";
|
|
3
|
+
import { HelpCommand } from "./help.command";
|
|
4
|
+
/**
|
|
5
|
+
* Top-level alias for the framework-reserved `p:help` command. Injects the delegate
|
|
6
|
+
* directly via standard DI — `HelpCommand` is `@injectable()` and tsyringe resolves it
|
|
7
|
+
* recursively when this alias is constructed. The two share state via DI, not via a
|
|
8
|
+
* service-locator handle to the kernel container.
|
|
9
|
+
*/
|
|
10
|
+
export declare class HelpAliasCommand implements CommandInterface<null> {
|
|
11
|
+
private readonly delegate;
|
|
12
|
+
optionsType: null;
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
constructor(delegate: HelpCommand);
|
|
16
|
+
run(args: any): Promise<ExitCodeEnum | number>;
|
|
17
|
+
}
|
|
@@ -1,10 +1,28 @@
|
|
|
1
|
+
import { DependencyContainer } from "tsyringe";
|
|
1
2
|
import { CommandInterface } from "../interfaces/command.interface";
|
|
2
3
|
import { ConsoleManager } from "../managers/console.manager";
|
|
3
4
|
import { ExitCodeEnum } from "../enums/exit-code.enum";
|
|
5
|
+
/**
|
|
6
|
+
* Prints a usage banner plus a one-line summary for every registered command. The output is
|
|
7
|
+
* generated from the actual `CommandInterface[]` resolved from the current DI container, so
|
|
8
|
+
* newly registered (built-in or custom) commands show up automatically.
|
|
9
|
+
*
|
|
10
|
+
* The first column is sized to the longest command name in the set, so the second-column
|
|
11
|
+
* descriptions stay aligned even when commands have wildly different name lengths.
|
|
12
|
+
*
|
|
13
|
+
* **Lazy command resolution.** This command is itself `@tag(Command)`, so a constructor-time
|
|
14
|
+
* `@injectAll(ServiceDefinitionTagEnum.Command)` would create an infinite cycle: tsyringe
|
|
15
|
+
* tries to construct HelpCommand → must inject all Commands → must construct HelpCommand →
|
|
16
|
+
* recursion. We instead inject the current child container (registered by the kernel under
|
|
17
|
+
* `ServiceDefinitionTagEnum.CurrentChildContainer`) and call `resolveAll` from inside `run()`,
|
|
18
|
+
* by which point every Command-tagged class is fully constructed and cached.
|
|
19
|
+
*/
|
|
4
20
|
export declare class HelpCommand implements CommandInterface<null> {
|
|
5
21
|
private readonly consoleManager;
|
|
22
|
+
private readonly container;
|
|
6
23
|
optionsType: null;
|
|
7
24
|
name: string;
|
|
8
|
-
|
|
25
|
+
description: string;
|
|
26
|
+
constructor(consoleManager: ConsoleManager, container: DependencyContainer);
|
|
9
27
|
run(args: any): Promise<ExitCodeEnum | number>;
|
|
10
28
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CommandInterface } from "../interfaces/command.interface";
|
|
2
|
+
import { ExitCodeEnum } from "../enums/exit-code.enum";
|
|
3
|
+
import { InfoCommand } from "./info.command";
|
|
4
|
+
/**
|
|
5
|
+
* Top-level alias for the framework-reserved `p:info` command. Injects the delegate
|
|
6
|
+
* directly via standard DI.
|
|
7
|
+
*/
|
|
8
|
+
export declare class InfoAliasCommand implements CommandInterface<null> {
|
|
9
|
+
private readonly delegate;
|
|
10
|
+
optionsType: null;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
constructor(delegate: InfoCommand);
|
|
14
|
+
run(args: any): Promise<ExitCodeEnum | number>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CommandInterface } from "../interfaces/command.interface";
|
|
2
|
+
import { ConsoleManager } from "../managers/console.manager";
|
|
3
|
+
import { ExitCodeEnum } from "../enums/exit-code.enum";
|
|
4
|
+
import { ConfigLoader } from "../config/config-loader";
|
|
5
|
+
import { AppModuleLoader } from "../bootstrap/app-module-loader";
|
|
6
|
+
/**
|
|
7
|
+
* Diagnostic command. Prints framework version, runtime environment, resolved config +
|
|
8
|
+
* AppModule locations, the recursively-resolved list of imported modules, and the list of
|
|
9
|
+
* loaded plugins. Designed for support tickets and "is my project picking up what I think
|
|
10
|
+
* it's picking up?" sanity checks.
|
|
11
|
+
*
|
|
12
|
+
* Does not boot a fresh kernel — it inspects what *would* be loaded by re-running the
|
|
13
|
+
* loader cascade, so it remains useful even when the AppModule is broken in a way that
|
|
14
|
+
* prevents `kernel.start()`.
|
|
15
|
+
*/
|
|
16
|
+
export declare class InfoCommand implements CommandInterface<null> {
|
|
17
|
+
private readonly consoleManager;
|
|
18
|
+
private readonly configLoader;
|
|
19
|
+
private readonly appModuleLoader;
|
|
20
|
+
optionsType: null;
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
/**
|
|
24
|
+
* Resolved at command construction time so `pristine info` reports the version of the cli
|
|
25
|
+
* that's actually running, not whatever happens to live in the user's project root. The
|
|
26
|
+
* package.json sits four levels up from dist/lib/cjs/commands/.
|
|
27
|
+
*/
|
|
28
|
+
private readonly cliPackageJsonPath;
|
|
29
|
+
constructor(consoleManager: ConsoleManager, configLoader: ConfigLoader, appModuleLoader: AppModuleLoader);
|
|
30
|
+
run(args: any): Promise<ExitCodeEnum | number>;
|
|
31
|
+
private printRuntimeBanner;
|
|
32
|
+
private printConfigSection;
|
|
33
|
+
private printAppModuleSection;
|
|
34
|
+
private readCliVersion;
|
|
35
|
+
/**
|
|
36
|
+
* Walks the import tree, returning every module reachable from the root. Visits each
|
|
37
|
+
* module at most once via a keyname-keyed seen-set so circular imports don't loop.
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
private collectModules;
|
|
41
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CommandInterface } from "../interfaces/command.interface";
|
|
2
|
+
import { ExitCodeEnum } from "../enums/exit-code.enum";
|
|
3
|
+
import { InitCommand } from "./init.command";
|
|
4
|
+
import { InitCommandOptions } from "./init.command-options";
|
|
5
|
+
/**
|
|
6
|
+
* Top-level alias for the framework-reserved `p:init` command. Injects the delegate
|
|
7
|
+
* directly via standard DI.
|
|
8
|
+
*/
|
|
9
|
+
export declare class InitAliasCommand implements CommandInterface<InitCommandOptions> {
|
|
10
|
+
private readonly delegate;
|
|
11
|
+
optionsType: typeof InitCommandOptions;
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
constructor(delegate: InitCommand);
|
|
15
|
+
run(args: InitCommandOptions): Promise<ExitCodeEnum | number>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
/**
|
|
3
|
+
* Non-interactive flags for `pristine init`. In a TTY, the init command prompts the user for
|
|
4
|
+
* each missing value; in CI / non-TTY, every value must be supplied via these flags or the
|
|
5
|
+
* command exits with a clear "missing flag" error.
|
|
6
|
+
*/
|
|
7
|
+
export declare class InitCommandOptions {
|
|
8
|
+
"source-path"?: string;
|
|
9
|
+
"output-path"?: string;
|
|
10
|
+
tsconfig?: string;
|
|
11
|
+
format?: "esm" | "cjs" | "both";
|
|
12
|
+
/**
|
|
13
|
+
* When true, scaffold a starter `<sourcePath>` AppModule file if it doesn't exist.
|
|
14
|
+
* Default true. Pass `--no-scaffold` to skip.
|
|
15
|
+
*/
|
|
16
|
+
scaffold?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* When true, add `pristine build`/`start`/`verify` scripts to package.json (only for
|
|
19
|
+
* scripts that don't already exist — never overwritten). Default true.
|
|
20
|
+
*/
|
|
21
|
+
scripts?: boolean;
|
|
22
|
+
}
|