@pristine-ts/cli 2.0.16 → 2.0.17

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.
Files changed (49) hide show
  1. package/dist/lib/cjs/bin.js +0 -0
  2. package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  3. package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
  4. package/package.json +12 -12
  5. package/dist/lib/cjs/bootstrap/app-module-cache.js +0 -71
  6. package/dist/lib/cjs/bootstrap/app-module-cache.js.map +0 -1
  7. package/dist/lib/cjs/bootstrap/app-module-discoverer.js +0 -119
  8. package/dist/lib/cjs/bootstrap/app-module-discoverer.js.map +0 -1
  9. package/dist/lib/cjs/bootstrap/app-module-discovery-candidate.js +0 -21
  10. package/dist/lib/cjs/bootstrap/app-module-discovery-candidate.js.map +0 -1
  11. package/dist/lib/cjs/bootstrap/app-module-discovery-reason.enum.js +0 -15
  12. package/dist/lib/cjs/bootstrap/app-module-discovery-reason.enum.js.map +0 -1
  13. package/dist/lib/cjs/bootstrap/app-module-prompt.js +0 -78
  14. package/dist/lib/cjs/bootstrap/app-module-prompt.js.map +0 -1
  15. package/dist/lib/cjs/commands/config-init.command.js +0 -133
  16. package/dist/lib/cjs/commands/config-init.command.js.map +0 -1
  17. package/dist/lib/cjs/enums/exit-code.enum.js +0 -9
  18. package/dist/lib/cjs/enums/exit-code.enum.js.map +0 -1
  19. package/dist/lib/cjs/managers/console.manager.js +0 -277
  20. package/dist/lib/cjs/managers/console.manager.js.map +0 -1
  21. package/dist/lib/cjs/managers/repl-session.js +0 -251
  22. package/dist/lib/cjs/managers/repl-session.js.map +0 -1
  23. package/dist/lib/esm/bootstrap/app-module-cache.js +0 -65
  24. package/dist/lib/esm/bootstrap/app-module-cache.js.map +0 -1
  25. package/dist/lib/esm/bootstrap/app-module-discoverer.js +0 -113
  26. package/dist/lib/esm/bootstrap/app-module-discoverer.js.map +0 -1
  27. package/dist/lib/esm/bootstrap/app-module-discovery-candidate.js +0 -17
  28. package/dist/lib/esm/bootstrap/app-module-discovery-candidate.js.map +0 -1
  29. package/dist/lib/esm/bootstrap/app-module-discovery-reason.enum.js +0 -12
  30. package/dist/lib/esm/bootstrap/app-module-discovery-reason.enum.js.map +0 -1
  31. package/dist/lib/esm/bootstrap/app-module-prompt.js +0 -75
  32. package/dist/lib/esm/bootstrap/app-module-prompt.js.map +0 -1
  33. package/dist/lib/esm/commands/config-init.command.js +0 -127
  34. package/dist/lib/esm/commands/config-init.command.js.map +0 -1
  35. package/dist/lib/esm/enums/exit-code.enum.js +0 -6
  36. package/dist/lib/esm/enums/exit-code.enum.js.map +0 -1
  37. package/dist/lib/esm/managers/console.manager.js +0 -241
  38. package/dist/lib/esm/managers/console.manager.js.map +0 -1
  39. package/dist/lib/esm/managers/repl-session.js +0 -215
  40. package/dist/lib/esm/managers/repl-session.js.map +0 -1
  41. package/dist/types/bootstrap/app-module-cache.d.ts +0 -15
  42. package/dist/types/bootstrap/app-module-discoverer.d.ts +0 -30
  43. package/dist/types/bootstrap/app-module-discovery-candidate.d.ts +0 -18
  44. package/dist/types/bootstrap/app-module-discovery-reason.enum.d.ts +0 -10
  45. package/dist/types/bootstrap/app-module-prompt.d.ts +0 -20
  46. package/dist/types/commands/config-init.command.d.ts +0 -18
  47. package/dist/types/enums/exit-code.enum.d.ts +0 -4
  48. package/dist/types/managers/console.manager.d.ts +0 -93
  49. package/dist/types/managers/repl-session.d.ts +0 -62
@@ -1,215 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
- };
10
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
11
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
12
- return new (P || (P = Promise))(function (resolve, reject) {
13
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
14
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
15
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
16
- step((generator = generator.apply(thisArg, _arguments || [])).next());
17
- });
18
- };
19
- var ReplSession_1;
20
- import * as readline from "node:readline";
21
- import { injectable } from "tsyringe";
22
- import { ExitCode, moduleScoped, ServiceDefinitionTagEnum } from "@pristine-ts/common";
23
- import { ExecutionContextKeynameEnum } from "@pristine-ts/core";
24
- import { ObservabilityStoreReader } from "@pristine-ts/observability";
25
- import { CliOutput } from "./cli-output.manager";
26
- import { CliModuleKeyname } from "../cli.module.keyname";
27
- /**
28
- * The interactive `pristine` console — launched when the bin is invoked with no command
29
- * (or `pristine repl`). It keeps the kernel booted for the whole session, so every
30
- * command runs instantly with no per-invocation boot cost.
31
- *
32
- * Slash-prefixed commands dispatch through the *same* path as a one-shot
33
- * `pristine <command>` invocation — `kernel.handle(argv, {keyname: Cli})` — so the REPL
34
- * and the command line resolve, validate and run commands identically. (This works
35
- * because `CliEventHandler` returns the exit code instead of calling `process.exit`.)
36
- * Plus the session verbs `/help`, `/clear`, `/exit`. Tab-completion is driven by the live
37
- * command registry and by recent trace ids for `/trace` / `/logs`.
38
- *
39
- * The kernel is **not** a constructor dependency — `ReplSession` is a driver *of* the
40
- * kernel, so the running kernel is handed to `start()` by whoever owns it (`Cli`). Only
41
- * genuine collaborator services are injected.
42
- */
43
- let ReplSession = ReplSession_1 = class ReplSession {
44
- constructor(cliOutput, storeReader) {
45
- this.cliOutput = cliOutput;
46
- this.storeReader = storeReader;
47
- this.commands = [];
48
- }
49
- /**
50
- * Runs the read-eval-print loop until `/exit` or EOF (Ctrl-D). Resolves with the exit
51
- * code the bin should return.
52
- *
53
- * @param kernel The already-started kernel this session drives — passed in by the
54
- * caller that owns it, rather than injected.
55
- */
56
- start(kernel) {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- this.commands = this.resolveCommands(kernel);
59
- this.printBanner();
60
- const rl = readline.createInterface({
61
- input: process.stdin,
62
- output: process.stdout,
63
- prompt: ReplSession_1.PROMPT,
64
- completer: (line) => this.complete(line),
65
- });
66
- return new Promise((resolve) => {
67
- rl.prompt();
68
- rl.on("line", (line) => {
69
- const trimmed = line.trim();
70
- if (trimmed.length === 0) {
71
- rl.prompt();
72
- return;
73
- }
74
- // Pause input while a command runs so its own SIGINT handling (e.g. `logs -f`)
75
- // owns Ctrl-C, and so a second line can't interleave mid-dispatch.
76
- rl.pause();
77
- void this.handleLine(trimmed, kernel).then((shouldExit) => {
78
- if (shouldExit) {
79
- rl.close();
80
- return;
81
- }
82
- rl.resume();
83
- rl.prompt();
84
- });
85
- });
86
- // Ctrl-C at an idle prompt clears the line rather than killing the session.
87
- rl.on("SIGINT", () => {
88
- this.cliOutput.writeLine("(type /exit to quit)");
89
- rl.prompt();
90
- });
91
- rl.on("close", () => {
92
- void this.shutdown(kernel).then(() => resolve(ExitCode.Success));
93
- });
94
- });
95
- });
96
- }
97
- /**
98
- * Handles one input line. Returns true when the session should end.
99
- */
100
- handleLine(input, kernel) {
101
- return __awaiter(this, void 0, void 0, function* () {
102
- const withoutSlash = input.startsWith("/") ? input.slice(1) : input;
103
- const tokens = withoutSlash.split(/\s+/).filter(token => token.length > 0);
104
- const name = tokens[0];
105
- const rest = tokens.slice(1);
106
- if (name === "exit" || name === "quit") {
107
- return true;
108
- }
109
- if (name === "clear") {
110
- console.clear();
111
- return false;
112
- }
113
- if (name === "help") {
114
- this.printHelp();
115
- return false;
116
- }
117
- try {
118
- // Dispatch through the exact same path as a one-shot `pristine <command>`: a
119
- // synthetic argv handed to `kernel.handle` with the `Cli` execution context. The
120
- // kernel maps it, `CliEventHandler` resolves + validates + runs it and returns the
121
- // exit code (no `process.exit`), so the loop survives. An unknown command throws
122
- // `CommandNotFoundError`, caught below.
123
- yield kernel.handle(["node", "repl", name, ...rest], { keyname: ExecutionContextKeynameEnum.Cli, context: null });
124
- }
125
- catch (error) {
126
- this.cliOutput.writeLine(`Error: ${error instanceof Error ? error.message : String(error)}`);
127
- }
128
- return false;
129
- });
130
- }
131
- /**
132
- * Readline completer. Completes `/`-prefixed command names and session verbs; for
133
- * `/trace` and `/logs` it completes the trailing token with recent trace ids.
134
- */
135
- complete(line) {
136
- const traceIdMatch = /^\/(trace|logs)\s+(\S*)$/.exec(line);
137
- if (traceIdMatch !== null) {
138
- const partial = traceIdMatch[2];
139
- const hits = this.storeReader.recentTraceIds(ReplSession_1.TRACE_ID_COMPLETION_LIMIT)
140
- .filter(id => id.startsWith(partial));
141
- return [hits, partial];
142
- }
143
- const candidates = [
144
- ...this.commands.map(command => `/${command.name}`),
145
- ...ReplSession_1.SESSION_VERBS,
146
- ];
147
- const hits = candidates.filter(candidate => candidate.startsWith(line));
148
- return [hits.length > 0 ? hits : candidates, line];
149
- }
150
- printBanner() {
151
- this.cliOutput.writeLine("Pristine — interactive console");
152
- this.cliOutput.writeLine("Type /help for commands, /exit to quit.");
153
- this.cliOutput.writeLine("");
154
- }
155
- printHelp() {
156
- var _a;
157
- this.cliOutput.writeLine("Session:");
158
- this.cliOutput.writeLine(" /help show this message");
159
- this.cliOutput.writeLine(" /clear clear the screen");
160
- this.cliOutput.writeLine(" /exit leave the console");
161
- this.cliOutput.writeLine("");
162
- this.cliOutput.writeLine("Commands (also runnable as `pristine <name>`):");
163
- const sorted = [...this.commands].sort((a, b) => a.name.localeCompare(b.name));
164
- const longest = sorted.reduce((max, command) => Math.max(max, command.name.length), 0);
165
- for (const command of sorted) {
166
- const padded = `/${command.name}`.padEnd(longest + 3, " ");
167
- this.cliOutput.writeLine(` ${padded}${(_a = command.description) !== null && _a !== void 0 ? _a : ""}`);
168
- }
169
- }
170
- shutdown(kernel) {
171
- return __awaiter(this, void 0, void 0, function* () {
172
- try {
173
- yield kernel.stop();
174
- }
175
- catch (_a) {
176
- // Best-effort — we're leaving the process anyway.
177
- }
178
- });
179
- }
180
- /**
181
- * Enumerates every registered command.
182
- *
183
- * Resolved from a dedicated child container with the `CurrentChildContainer` token
184
- * registered — some commands (`HelpCommand`, `ListCommand`) inject that token, which
185
- * only the kernel's per-event child containers carry. The one-shot path gets it for
186
- * free because `CliEventHandler` runs inside such a child container; the REPL builds an
187
- * equivalent one once for the whole session.
188
- *
189
- * `resolveAll`, justified: this is framework REPL infrastructure resolved at session
190
- * start, mirroring `Cli.warnOnCommandCollisions`. Enumerating every `Command`-tagged
191
- * service is inherently a container-introspection operation with no constructor seam.
192
- */
193
- resolveCommands(kernel) {
194
- try {
195
- const childContainer = kernel.container.createChildContainer();
196
- childContainer.registerInstance(ServiceDefinitionTagEnum.CurrentChildContainer, childContainer);
197
- return childContainer.resolveAll(ServiceDefinitionTagEnum.Command);
198
- }
199
- catch (error) {
200
- process.stderr.write(`[repl] could not load commands: ${error instanceof Error ? error.message : String(error)}\n`);
201
- return [];
202
- }
203
- }
204
- };
205
- ReplSession.PROMPT = "pristine ❯ ";
206
- ReplSession.SESSION_VERBS = ["/help", "/clear", "/exit"];
207
- ReplSession.TRACE_ID_COMPLETION_LIMIT = 25;
208
- ReplSession = ReplSession_1 = __decorate([
209
- injectable(),
210
- moduleScoped(CliModuleKeyname),
211
- __metadata("design:paramtypes", [CliOutput,
212
- ObservabilityStoreReader])
213
- ], ReplSession);
214
- export { ReplSession };
215
- //# sourceMappingURL=repl-session.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"repl-session.js","sourceRoot":"","sources":["../../../../src/managers/repl-session.ts"],"names":[],"mappings":";;;;;;;;;;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,CAAC;YACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpH,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;;AA/KuB,kBAAM,GAAG,aAAa,AAAhB,CAAiB;AACvB,yBAAa,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,AAA/B,CAAgC;AAC7C,qCAAyB,GAAG,EAAE,AAAL,CAAM;AAH5C,WAAW;IAFvB,UAAU,EAAE;IACZ,YAAY,CAAC,gBAAgB,CAAC;qCASC,SAAS;QACP,wBAAwB;GAT7C,WAAW,CAiLvB"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Persists the user's selection from the disambiguation prompt so subsequent invocations of
3
- * `pristine` in the same project skip the prompt. Stale entries (target file deleted since
4
- * the cache was written) are auto-cleaned on read.
5
- *
6
- * Best-effort throughout — failures to read or write the cache file are swallowed because
7
- * the cache is a UX optimization, not correctness-critical.
8
- */
9
- export declare class AppModuleCache {
10
- private readonly cacheDirName;
11
- private readonly cacheFileName;
12
- read(projectRoot: string): string | undefined;
13
- write(projectRoot: string, absolutePath: string): void;
14
- private cachePath;
15
- }
@@ -1,30 +0,0 @@
1
- import { AppModuleDiscoveryCandidate } from "./app-module-discovery-candidate";
2
- /**
3
- * Scans well-known directories for files that look like AppModule definitions. Non-recursive
4
- * (each search root is scanned at depth 1 only) so it stays fast on large repos and predictable
5
- * when users have many nested module files.
6
- *
7
- * A file is a candidate when:
8
- * - its filename matches `*.module.{js,mjs,cjs}` (and is not a test/spec file), AND
9
- * - either the filename literally matches `app.module.{js,mjs,cjs}` (highest confidence,
10
- * scored 0), OR the file's exports include a symbol named `AppModule` (scored 10).
11
- */
12
- export declare class AppModuleDiscoverer {
13
- /**
14
- * Search roots scanned for candidates, relative to the project root. Order is intentional:
15
- * compiled output first (most likely runtime entry), then build/, then the project root
16
- * itself for trivial single-file demos.
17
- */
18
- private readonly searchRoots;
19
- private readonly moduleFileRegex;
20
- private readonly appModuleNameRegex;
21
- discover(projectRoot: string): Promise<AppModuleDiscoveryCandidate[]>;
22
- /**
23
- * Synchronous probe: does this file's exports include an `AppModule` symbol? Uses
24
- * `require()` rather than dynamic `import()` because (a) we only accept `.js/.mjs/.cjs`
25
- * whose CJS variants load synchronously, and (b) discarded probes shouldn't hold open
26
- * `import()` promises.
27
- * @private
28
- */
29
- private exportsAppModule;
30
- }
@@ -1,18 +0,0 @@
1
- import { AppModuleDiscoveryReasonEnum } from "./app-module-discovery-reason.enum";
2
- /**
3
- * A plausible AppModule found by the convention-based scan. Lower `score` beats higher;
4
- * ties are ambiguous and trigger the disambiguation prompt.
5
- */
6
- export declare class AppModuleDiscoveryCandidate {
7
- readonly absolutePath: string;
8
- /** Path relative to the project root. Used purely for human-facing display. */
9
- readonly displayPath: string;
10
- /** Lower = better. Files literally named `app.module.*` get 0; AppModule-exporting `*.module.*` files get 10. */
11
- readonly score: number;
12
- readonly reason: AppModuleDiscoveryReasonEnum;
13
- constructor(absolutePath: string,
14
- /** Path relative to the project root. Used purely for human-facing display. */
15
- displayPath: string,
16
- /** Lower = better. Files literally named `app.module.*` get 0; AppModule-exporting `*.module.*` files get 10. */
17
- score: number, reason: AppModuleDiscoveryReasonEnum);
18
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Why a candidate file was considered a possible AppModule. Used by the disambiguation prompt
3
- * so the user sees "(matches app.module.*)" vs "(exports AppModule)" alongside each option.
4
- */
5
- export declare enum AppModuleDiscoveryReasonEnum {
6
- /** The filename matches `app.module.{js,mjs,cjs}`. Highest confidence. */
7
- Named = "named",
8
- /** The filename is `*.module.{js,mjs,cjs}` and the file's exports include an `AppModule` symbol. */
9
- Exports = "exports"
10
- }
@@ -1,20 +0,0 @@
1
- import { AppModuleDiscoveryCandidate } from "./app-module-discovery-candidate";
2
- import { DynamicImporter } from "./dynamic-importer";
3
- /**
4
- * TTY disambiguation for the AppModule discovery cascade. When multiple equally-ranked
5
- * candidates exist and stdin/stdout are both connected to a real terminal, ask the user
6
- * to pick one. When non-interactive (CI, Docker, redirected stdin), the caller should
7
- * fall back to throwing an actionable error rather than guessing.
8
- *
9
- * `@inquirer/prompts` is dynamic-imported through `DynamicImporter` so the prompt UI
10
- * dependency only loads when actually prompting — keeps non-interactive startup fast and
11
- * avoids paying for inquirer's TTY-detection overhead on every invocation.
12
- */
13
- export declare class AppModulePrompt {
14
- private readonly dynamicImporter;
15
- private readonly cancelLabel;
16
- constructor(dynamicImporter: DynamicImporter);
17
- isInteractive(): boolean;
18
- prompt(candidates: AppModuleDiscoveryCandidate[]): Promise<string | undefined>;
19
- private reasonLabel;
20
- }
@@ -1,18 +0,0 @@
1
- import { CommandInterface } from "../interfaces/command.interface";
2
- import { ConsoleManager } from "../managers/console.manager";
3
- import { ExitCodeEnum } from "../enums/exit-code.enum";
4
- /**
5
- * Generates a starter `pristine.config.ts` in the current directory. If the consumer's
6
- * `package.json` already declares `pristine.appModule.path` or `pristine.appModule.cjsPath`,
7
- * the value is migrated into the new config and the user is told to remove the old field.
8
- */
9
- export declare class ConfigInitCommand implements CommandInterface<null> {
10
- private readonly consoleManager;
11
- optionsType: null;
12
- name: string;
13
- description: string;
14
- constructor(consoleManager: ConsoleManager);
15
- run(args: any): Promise<ExitCodeEnum | number>;
16
- private detectExistingAppModulePath;
17
- private renderConfigTemplate;
18
- }
@@ -1,4 +0,0 @@
1
- export declare enum ExitCodeEnum {
2
- Success = 0,
3
- Error = 1
4
- }
@@ -1,93 +0,0 @@
1
- import { ConsoleReadlineOptions } from "../options/console-readline.options";
2
- export declare class ConsoleManager {
3
- private spinnerInterval;
4
- private isSpinning;
5
- /**
6
- * Writes a message to stdout without a newline.
7
- * @param message The message to write.
8
- */
9
- write(message: string): void;
10
- /**
11
- * Writes a message to stdout with a newline.
12
- * @param message The message to write.
13
- */
14
- writeLine(message: string): void;
15
- /**
16
- * Writes a table to stdout.
17
- * @param table The array of objects to display as a table.
18
- */
19
- writeTable(table: any[]): void;
20
- /**
21
- * Writes an error message in red with an 'Error:' prefix.
22
- * @param message The error message to display.
23
- */
24
- writeError(message: string): void;
25
- /**
26
- * Writes a success message in green with a 'Success:' prefix.
27
- * @param message The success message to display.
28
- */
29
- writeSuccess(message: string): void;
30
- /**
31
- * Writes a warning message in yellow with a 'Warning:' prefix.
32
- * @param message The warning message to display.
33
- */
34
- writeWarning(message: string): void;
35
- /**
36
- * Writes an info message in cyan with an 'Info:' prefix.
37
- * @param message The info message to display.
38
- */
39
- writeInfo(message: string): void;
40
- /**
41
- * Starts a loading spinner with a message.
42
- *
43
- * @param message The message to display next to the spinner.
44
- * @remarks
45
- * This method hides the cursor and continuously updates the current line.
46
- * Avoid calling other write methods while the spinner is active as they may conflict with the spinner's line clearing.
47
- */
48
- startSpinner(message: string): void;
49
- /**
50
- * Stops the loading spinner and optionally prints a completion message.
51
- *
52
- * @param message Optional completion message to display.
53
- * @param success Whether the operation was successful. Defaults to true.
54
- * @remarks
55
- * Stops the spinner, shows the cursor, and prints a final success or error message on the same line.
56
- */
57
- stopSpinner(message?: string, success?: boolean): void;
58
- /**
59
- * Displays or updates a progress bar.
60
- *
61
- * @param current The current progress value.
62
- * @param total The total value to reach (100%).
63
- * @param message Optional message to display next to the bar.
64
- * @param width The visual width of the progress bar in characters. Defaults to 30.
65
- *
66
- * @remarks
67
- * This method clears the *current* line and writes the progress bar.
68
- *
69
- * **Important:** If you call `writeLine()` (or any other method that outputs a newline) between calls to `updateProgressBar()`,
70
- * the next call to `updateProgressBar()` will start on the *new* line, leaving the previous progress bar state on the line above.
71
- *
72
- * **Example of creating artifacts:**
73
- * ```typescript
74
- * manager.updateProgressBar(10, 100); // Draws bar at line N
75
- * manager.writeLine("Log message"); // Moves cursor to line N+1
76
- * manager.updateProgressBar(20, 100); // Draws bar at line N+1 (Line N has the old bar)
77
- * ```
78
- */
79
- updateProgressBar(current: number, total: number, message?: string, width?: number): void;
80
- /**
81
- * Reads a string from stdin.
82
- * @returns The raw string read from stdin.
83
- */
84
- read(): string;
85
- /**
86
- * Reads a line from stdin with a prompt.
87
- *
88
- * @param question The prompt text to display.
89
- * @param options Configuration options for the input (e.g., masking characters).
90
- * @returns A promise resolving to the user's input string.
91
- */
92
- readLine(question: string, options?: ConsoleReadlineOptions): Promise<string>;
93
- }
@@ -1,62 +0,0 @@
1
- import { Kernel } from "@pristine-ts/core";
2
- import { ObservabilityStoreReader } from "@pristine-ts/observability";
3
- import { CliOutput } from "./cli-output.manager";
4
- /**
5
- * The interactive `pristine` console — launched when the bin is invoked with no command
6
- * (or `pristine repl`). It keeps the kernel booted for the whole session, so every
7
- * command runs instantly with no per-invocation boot cost.
8
- *
9
- * Slash-prefixed commands dispatch through the *same* path as a one-shot
10
- * `pristine <command>` invocation — `kernel.handle(argv, {keyname: Cli})` — so the REPL
11
- * and the command line resolve, validate and run commands identically. (This works
12
- * because `CliEventHandler` returns the exit code instead of calling `process.exit`.)
13
- * Plus the session verbs `/help`, `/clear`, `/exit`. Tab-completion is driven by the live
14
- * command registry and by recent trace ids for `/trace` / `/logs`.
15
- *
16
- * The kernel is **not** a constructor dependency — `ReplSession` is a driver *of* the
17
- * kernel, so the running kernel is handed to `start()` by whoever owns it (`Cli`). Only
18
- * genuine collaborator services are injected.
19
- */
20
- export declare class ReplSession {
21
- private readonly cliOutput;
22
- private readonly storeReader;
23
- private static readonly PROMPT;
24
- private static readonly SESSION_VERBS;
25
- private static readonly TRACE_ID_COMPLETION_LIMIT;
26
- private commands;
27
- constructor(cliOutput: CliOutput, storeReader: ObservabilityStoreReader);
28
- /**
29
- * Runs the read-eval-print loop until `/exit` or EOF (Ctrl-D). Resolves with the exit
30
- * code the bin should return.
31
- *
32
- * @param kernel The already-started kernel this session drives — passed in by the
33
- * caller that owns it, rather than injected.
34
- */
35
- start(kernel: Kernel): Promise<number>;
36
- /**
37
- * Handles one input line. Returns true when the session should end.
38
- */
39
- private handleLine;
40
- /**
41
- * Readline completer. Completes `/`-prefixed command names and session verbs; for
42
- * `/trace` and `/logs` it completes the trailing token with recent trace ids.
43
- */
44
- private complete;
45
- private printBanner;
46
- private printHelp;
47
- private shutdown;
48
- /**
49
- * Enumerates every registered command.
50
- *
51
- * Resolved from a dedicated child container with the `CurrentChildContainer` token
52
- * registered — some commands (`HelpCommand`, `ListCommand`) inject that token, which
53
- * only the kernel's per-event child containers carry. The one-shot path gets it for
54
- * free because `CliEventHandler` runs inside such a child container; the REPL builds an
55
- * equivalent one once for the whole session.
56
- *
57
- * `resolveAll`, justified: this is framework REPL infrastructure resolved at session
58
- * start, mirroring `Cli.warnOnCommandCollisions`. Enumerating every `Command`-tagged
59
- * service is inherently a container-introspection operation with no constructor seam.
60
- */
61
- private resolveCommands;
62
- }