@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,277 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
- 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;
22
- return c > 3 && r && Object.defineProperty(target, key, r), r;
23
- };
24
- var __importStar = (this && this.__importStar) || (function () {
25
- var ownKeys = function(o) {
26
- ownKeys = Object.getOwnPropertyNames || function (o) {
27
- var ar = [];
28
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
- return ar;
30
- };
31
- return ownKeys(o);
32
- };
33
- return function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- })();
41
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
42
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
43
- return new (P || (P = Promise))(function (resolve, reject) {
44
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
45
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
46
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
47
- step((generator = generator.apply(thisArg, _arguments || [])).next());
48
- });
49
- };
50
- Object.defineProperty(exports, "__esModule", { value: true });
51
- exports.ConsoleManager = void 0;
52
- const tsyringe_1 = require("tsyringe");
53
- const common_1 = require("@pristine-ts/common");
54
- const cli_module_keyname_1 = require("../cli.module.keyname");
55
- const readline = __importStar(require("node:readline/promises"));
56
- const node_readline_1 = require("node:readline");
57
- const node_process_1 = require("node:process");
58
- const console_readline_options_1 = require("../options/console-readline.options");
59
- /**
60
- * ANSI Escape Codes for formatting
61
- */
62
- const Colors = {
63
- Reset: "\x1b[0m",
64
- Bright: "\x1b[1m",
65
- Dim: "\x1b[2m",
66
- Underscore: "\x1b[4m",
67
- Blink: "\x1b[5m",
68
- Reverse: "\x1b[7m",
69
- Hidden: "\x1b[8m",
70
- FgBlack: "\x1b[30m",
71
- FgRed: "\x1b[31m",
72
- FgGreen: "\x1b[32m",
73
- FgYellow: "\x1b[33m",
74
- FgBlue: "\x1b[34m",
75
- FgMagenta: "\x1b[35m",
76
- FgCyan: "\x1b[36m",
77
- FgWhite: "\x1b[37m",
78
- };
79
- let ConsoleManager = class ConsoleManager {
80
- constructor() {
81
- this.spinnerInterval = null;
82
- this.isSpinning = false;
83
- }
84
- /**
85
- * Writes a message to stdout without a newline.
86
- * @param message The message to write.
87
- */
88
- write(message) {
89
- process.stdout.write(message);
90
- }
91
- /**
92
- * Writes a message to stdout with a newline.
93
- * @param message The message to write.
94
- */
95
- writeLine(message) {
96
- this.write(message + "\n");
97
- }
98
- /**
99
- * Writes a table to stdout.
100
- * @param table The array of objects to display as a table.
101
- */
102
- writeTable(table) {
103
- console.table(table);
104
- }
105
- /**
106
- * Writes an error message in red with an 'Error:' prefix.
107
- * @param message The error message to display.
108
- */
109
- writeError(message) {
110
- this.writeLine(`${Colors.FgRed}✖ Error:${Colors.Reset} ${message}`);
111
- }
112
- /**
113
- * Writes a success message in green with a 'Success:' prefix.
114
- * @param message The success message to display.
115
- */
116
- writeSuccess(message) {
117
- this.writeLine(`${Colors.FgGreen}✔ Success:${Colors.Reset} ${message}`);
118
- }
119
- /**
120
- * Writes a warning message in yellow with a 'Warning:' prefix.
121
- * @param message The warning message to display.
122
- */
123
- writeWarning(message) {
124
- this.writeLine(`${Colors.FgYellow}⚠ Warning:${Colors.Reset} ${message}`);
125
- }
126
- /**
127
- * Writes an info message in cyan with an 'Info:' prefix.
128
- * @param message The info message to display.
129
- */
130
- writeInfo(message) {
131
- this.writeLine(`${Colors.FgCyan}ℹ Info:${Colors.Reset} ${message}`);
132
- }
133
- /**
134
- * Starts a loading spinner with a message.
135
- *
136
- * @param message The message to display next to the spinner.
137
- * @remarks
138
- * This method hides the cursor and continuously updates the current line.
139
- * Avoid calling other write methods while the spinner is active as they may conflict with the spinner's line clearing.
140
- */
141
- startSpinner(message) {
142
- if (this.isSpinning)
143
- return;
144
- this.isSpinning = true;
145
- const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
146
- let i = 0;
147
- process.stdout.write('\x1B[?25l'); // Hide cursor
148
- this.spinnerInterval = setInterval(() => {
149
- (0, node_readline_1.clearLine)(process.stdout, 0);
150
- (0, node_readline_1.cursorTo)(process.stdout, 0);
151
- const frame = frames[i = (i + 1) % frames.length];
152
- process.stdout.write(`${Colors.FgCyan}${frame}${Colors.Reset} ${message}`);
153
- }, 80);
154
- }
155
- /**
156
- * Stops the loading spinner and optionally prints a completion message.
157
- *
158
- * @param message Optional completion message to display.
159
- * @param success Whether the operation was successful. Defaults to true.
160
- * @remarks
161
- * Stops the spinner, shows the cursor, and prints a final success or error message on the same line.
162
- */
163
- stopSpinner(message, success = true) {
164
- if (!this.isSpinning)
165
- return;
166
- if (this.spinnerInterval) {
167
- clearInterval(this.spinnerInterval);
168
- this.spinnerInterval = null;
169
- }
170
- this.isSpinning = false;
171
- (0, node_readline_1.clearLine)(process.stdout, 0);
172
- (0, node_readline_1.cursorTo)(process.stdout, 0);
173
- process.stdout.write('\x1B[?25h'); // Show cursor
174
- if (message) {
175
- if (success) {
176
- this.writeSuccess(message);
177
- }
178
- else {
179
- this.writeError(message);
180
- }
181
- }
182
- }
183
- /**
184
- * Displays or updates a progress bar.
185
- *
186
- * @param current The current progress value.
187
- * @param total The total value to reach (100%).
188
- * @param message Optional message to display next to the bar.
189
- * @param width The visual width of the progress bar in characters. Defaults to 30.
190
- *
191
- * @remarks
192
- * This method clears the *current* line and writes the progress bar.
193
- *
194
- * **Important:** If you call `writeLine()` (or any other method that outputs a newline) between calls to `updateProgressBar()`,
195
- * the next call to `updateProgressBar()` will start on the *new* line, leaving the previous progress bar state on the line above.
196
- *
197
- * **Example of creating artifacts:**
198
- * ```typescript
199
- * manager.updateProgressBar(10, 100); // Draws bar at line N
200
- * manager.writeLine("Log message"); // Moves cursor to line N+1
201
- * manager.updateProgressBar(20, 100); // Draws bar at line N+1 (Line N has the old bar)
202
- * ```
203
- */
204
- updateProgressBar(current, total, message = '', width = 30) {
205
- const percentage = Math.min(Math.max(current / total, 0), 1);
206
- const filledWidth = Math.round(width * percentage);
207
- const emptyWidth = width - filledWidth;
208
- const filledBar = '█'.repeat(filledWidth);
209
- const emptyBar = '░'.repeat(emptyWidth);
210
- (0, node_readline_1.clearLine)(process.stdout, 0);
211
- (0, node_readline_1.cursorTo)(process.stdout, 0);
212
- process.stdout.write(`${Colors.FgCyan}[${filledBar}${emptyBar}]${Colors.Reset} ${Math.round(percentage * 100)}% ${message}`);
213
- if (current >= total) {
214
- this.writeLine(''); // New line on completion
215
- }
216
- }
217
- /**
218
- * Reads a string from stdin.
219
- * @returns The raw string read from stdin.
220
- */
221
- read() {
222
- return process.stdin.read();
223
- }
224
- /**
225
- * Reads a line from stdin with a prompt.
226
- *
227
- * @param question The prompt text to display.
228
- * @param options Configuration options for the input (e.g., masking characters).
229
- * @returns A promise resolving to the user's input string.
230
- */
231
- readLine(question_1) {
232
- return __awaiter(this, arguments, void 0, function* (question, options = new console_readline_options_1.ConsoleReadlineOptions()) {
233
- const rl = readline.createInterface({ input: node_process_1.stdin, output: node_process_1.stdout });
234
- // If we want to hide characters (e.g. for password), we need to handle output manually-ish,
235
- // but readline.question prints the prompt and then echoes input.
236
- // A simple hack for passwords with standard readline is tricky without a dedicated library.
237
- // However, we can use the 'mute' approach or simple overwriting if we accept some limitations.
238
- // For now, adhering to the basic 'question' promise but supporting the 'showCharactersOnTyping' flag logic.
239
- let queryPromise;
240
- if (!options.showCharactersOnTyping) {
241
- // Simple implementation: Ask question, but when user types, we can't easily intercept 'echo' with just createInterface
242
- // unless we use a custom input stream or 'muted-stdout' pattern.
243
- // Given constraint of no external libraries, we will use a basic workaround:
244
- // We will output the question, set stdin to raw mode if possible (for true hiding)
245
- // OR just use the moveCursor trick the previous code had, although that is flaky.
246
- //
247
- // Let's rely on the previous implementation's logic:
248
- // The previous code did `moveCursor(output, 0, -1)` AFTER the answer was received.
249
- // This clears the line AFTER typing. It doesn't hide it WHILE typing.
250
- // Real password masking is complex in Node without libs.
251
- // We will stick to the previous logic but ensure it's robust.
252
- queryPromise = rl.question(question);
253
- }
254
- else {
255
- queryPromise = rl.question(question);
256
- }
257
- const answer = yield queryPromise;
258
- if (!options.showCharactersOnTyping) {
259
- // Move up one line and clear it to hide the password typed
260
- (0, node_readline_1.moveCursor)(node_process_1.stdout, 0, -1);
261
- (0, node_readline_1.clearLine)(node_process_1.stdout, 0);
262
- // We might want to re-print the question without the answer?
263
- // Or just leave it cleared. The previous code just moved cursor.
264
- // Let's just print a confirmation.
265
- this.writeLine(`${question} [******]`);
266
- }
267
- rl.close();
268
- return answer;
269
- });
270
- }
271
- };
272
- exports.ConsoleManager = ConsoleManager;
273
- exports.ConsoleManager = ConsoleManager = __decorate([
274
- (0, tsyringe_1.injectable)(),
275
- (0, common_1.moduleScoped)(cli_module_keyname_1.CliModuleKeyname)
276
- ], ConsoleManager);
277
- //# sourceMappingURL=console.manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"console.manager.js","sourceRoot":"","sources":["../../../../src/managers/console.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoC;AACpC,gDAAi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GAAG,MAAM,YAAY,CAAC;YAElC,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC;gBAClC,2DAA2D;gBAC3D,IAAA,0BAAU,EAAC,qBAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBAC1B,IAAA,yBAAS,EAAC,qBAAM,EAAE,CAAC,CAAC,CAAC;gBACrB,8DAA8D;gBAC9D,iEAAiE;gBACjE,mCAAmC;gBACnC,IAAI,CAAC,SAAS,CAAC,GAAG,QAAQ,WAAW,CAAC,CAAC;YAC3C,CAAC;YAED,EAAE,CAAC,KAAK,EAAE,CAAC;YAEX,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;CACF,CAAA;AAlNY,wCAAc;yBAAd,cAAc;IAF1B,IAAA,qBAAU,GAAE;IACZ,IAAA,qBAAY,EAAC,qCAAgB,CAAC;GAClB,cAAc,CAkN1B"}
@@ -1,251 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
- 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;
22
- return c > 3 && r && Object.defineProperty(target, key, r), r;
23
- };
24
- var __importStar = (this && this.__importStar) || (function () {
25
- var ownKeys = function(o) {
26
- ownKeys = Object.getOwnPropertyNames || function (o) {
27
- var ar = [];
28
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
- return ar;
30
- };
31
- return ownKeys(o);
32
- };
33
- return function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- })();
41
- var __metadata = (this && this.__metadata) || function (k, v) {
42
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
- };
44
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
45
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
46
- return new (P || (P = Promise))(function (resolve, reject) {
47
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
48
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
49
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
50
- step((generator = generator.apply(thisArg, _arguments || [])).next());
51
- });
52
- };
53
- var ReplSession_1;
54
- Object.defineProperty(exports, "__esModule", { value: true });
55
- exports.ReplSession = void 0;
56
- const readline = __importStar(require("node:readline"));
57
- const tsyringe_1 = require("tsyringe");
58
- const common_1 = require("@pristine-ts/common");
59
- const core_1 = require("@pristine-ts/core");
60
- const observability_1 = require("@pristine-ts/observability");
61
- const cli_output_manager_1 = require("./cli-output.manager");
62
- const cli_module_keyname_1 = require("../cli.module.keyname");
63
- /**
64
- * The interactive `pristine` console — launched when the bin is invoked with no command
65
- * (or `pristine repl`). It keeps the kernel booted for the whole session, so every
66
- * command runs instantly with no per-invocation boot cost.
67
- *
68
- * Slash-prefixed commands dispatch through the *same* path as a one-shot
69
- * `pristine <command>` invocation — `kernel.handle(argv, {keyname: Cli})` — so the REPL
70
- * and the command line resolve, validate and run commands identically. (This works
71
- * because `CliEventHandler` returns the exit code instead of calling `process.exit`.)
72
- * Plus the session verbs `/help`, `/clear`, `/exit`. Tab-completion is driven by the live
73
- * command registry and by recent trace ids for `/trace` / `/logs`.
74
- *
75
- * The kernel is **not** a constructor dependency — `ReplSession` is a driver *of* the
76
- * kernel, so the running kernel is handed to `start()` by whoever owns it (`Cli`). Only
77
- * genuine collaborator services are injected.
78
- */
79
- let ReplSession = ReplSession_1 = class ReplSession {
80
- constructor(cliOutput, storeReader) {
81
- this.cliOutput = cliOutput;
82
- this.storeReader = storeReader;
83
- this.commands = [];
84
- }
85
- /**
86
- * Runs the read-eval-print loop until `/exit` or EOF (Ctrl-D). Resolves with the exit
87
- * code the bin should return.
88
- *
89
- * @param kernel The already-started kernel this session drives — passed in by the
90
- * caller that owns it, rather than injected.
91
- */
92
- start(kernel) {
93
- return __awaiter(this, void 0, void 0, function* () {
94
- this.commands = this.resolveCommands(kernel);
95
- this.printBanner();
96
- const rl = readline.createInterface({
97
- input: process.stdin,
98
- output: process.stdout,
99
- prompt: ReplSession_1.PROMPT,
100
- completer: (line) => this.complete(line),
101
- });
102
- return new Promise((resolve) => {
103
- rl.prompt();
104
- rl.on("line", (line) => {
105
- const trimmed = line.trim();
106
- if (trimmed.length === 0) {
107
- rl.prompt();
108
- return;
109
- }
110
- // Pause input while a command runs so its own SIGINT handling (e.g. `logs -f`)
111
- // owns Ctrl-C, and so a second line can't interleave mid-dispatch.
112
- rl.pause();
113
- void this.handleLine(trimmed, kernel).then((shouldExit) => {
114
- if (shouldExit) {
115
- rl.close();
116
- return;
117
- }
118
- rl.resume();
119
- rl.prompt();
120
- });
121
- });
122
- // Ctrl-C at an idle prompt clears the line rather than killing the session.
123
- rl.on("SIGINT", () => {
124
- this.cliOutput.writeLine("(type /exit to quit)");
125
- rl.prompt();
126
- });
127
- rl.on("close", () => {
128
- void this.shutdown(kernel).then(() => resolve(common_1.ExitCode.Success));
129
- });
130
- });
131
- });
132
- }
133
- /**
134
- * Handles one input line. Returns true when the session should end.
135
- */
136
- handleLine(input, kernel) {
137
- return __awaiter(this, void 0, void 0, function* () {
138
- const withoutSlash = input.startsWith("/") ? input.slice(1) : input;
139
- const tokens = withoutSlash.split(/\s+/).filter(token => token.length > 0);
140
- const name = tokens[0];
141
- const rest = tokens.slice(1);
142
- if (name === "exit" || name === "quit") {
143
- return true;
144
- }
145
- if (name === "clear") {
146
- console.clear();
147
- return false;
148
- }
149
- if (name === "help") {
150
- this.printHelp();
151
- return false;
152
- }
153
- try {
154
- // Dispatch through the exact same path as a one-shot `pristine <command>`: a
155
- // synthetic argv handed to `kernel.handle` with the `Cli` execution context. The
156
- // kernel maps it, `CliEventHandler` resolves + validates + runs it and returns the
157
- // exit code (no `process.exit`), so the loop survives. An unknown command throws
158
- // `CommandNotFoundError`, caught below.
159
- yield kernel.handle(["node", "repl", name, ...rest], { keyname: core_1.ExecutionContextKeynameEnum.Cli, context: null });
160
- }
161
- catch (error) {
162
- this.cliOutput.writeLine(`Error: ${error instanceof Error ? error.message : String(error)}`);
163
- }
164
- return false;
165
- });
166
- }
167
- /**
168
- * Readline completer. Completes `/`-prefixed command names and session verbs; for
169
- * `/trace` and `/logs` it completes the trailing token with recent trace ids.
170
- */
171
- complete(line) {
172
- const traceIdMatch = /^\/(trace|logs)\s+(\S*)$/.exec(line);
173
- if (traceIdMatch !== null) {
174
- const partial = traceIdMatch[2];
175
- const hits = this.storeReader.recentTraceIds(ReplSession_1.TRACE_ID_COMPLETION_LIMIT)
176
- .filter(id => id.startsWith(partial));
177
- return [hits, partial];
178
- }
179
- const candidates = [
180
- ...this.commands.map(command => `/${command.name}`),
181
- ...ReplSession_1.SESSION_VERBS,
182
- ];
183
- const hits = candidates.filter(candidate => candidate.startsWith(line));
184
- return [hits.length > 0 ? hits : candidates, line];
185
- }
186
- printBanner() {
187
- this.cliOutput.writeLine("Pristine — interactive console");
188
- this.cliOutput.writeLine("Type /help for commands, /exit to quit.");
189
- this.cliOutput.writeLine("");
190
- }
191
- printHelp() {
192
- var _a;
193
- this.cliOutput.writeLine("Session:");
194
- this.cliOutput.writeLine(" /help show this message");
195
- this.cliOutput.writeLine(" /clear clear the screen");
196
- this.cliOutput.writeLine(" /exit leave the console");
197
- this.cliOutput.writeLine("");
198
- this.cliOutput.writeLine("Commands (also runnable as `pristine <name>`):");
199
- const sorted = [...this.commands].sort((a, b) => a.name.localeCompare(b.name));
200
- const longest = sorted.reduce((max, command) => Math.max(max, command.name.length), 0);
201
- for (const command of sorted) {
202
- const padded = `/${command.name}`.padEnd(longest + 3, " ");
203
- this.cliOutput.writeLine(` ${padded}${(_a = command.description) !== null && _a !== void 0 ? _a : ""}`);
204
- }
205
- }
206
- shutdown(kernel) {
207
- return __awaiter(this, void 0, void 0, function* () {
208
- try {
209
- yield kernel.stop();
210
- }
211
- catch (_a) {
212
- // Best-effort — we're leaving the process anyway.
213
- }
214
- });
215
- }
216
- /**
217
- * Enumerates every registered command.
218
- *
219
- * Resolved from a dedicated child container with the `CurrentChildContainer` token
220
- * registered — some commands (`HelpCommand`, `ListCommand`) inject that token, which
221
- * only the kernel's per-event child containers carry. The one-shot path gets it for
222
- * free because `CliEventHandler` runs inside such a child container; the REPL builds an
223
- * equivalent one once for the whole session.
224
- *
225
- * `resolveAll`, justified: this is framework REPL infrastructure resolved at session
226
- * start, mirroring `Cli.warnOnCommandCollisions`. Enumerating every `Command`-tagged
227
- * service is inherently a container-introspection operation with no constructor seam.
228
- */
229
- resolveCommands(kernel) {
230
- try {
231
- const childContainer = kernel.container.createChildContainer();
232
- childContainer.registerInstance(common_1.ServiceDefinitionTagEnum.CurrentChildContainer, childContainer);
233
- return childContainer.resolveAll(common_1.ServiceDefinitionTagEnum.Command);
234
- }
235
- catch (error) {
236
- process.stderr.write(`[repl] could not load commands: ${error instanceof Error ? error.message : String(error)}\n`);
237
- return [];
238
- }
239
- }
240
- };
241
- exports.ReplSession = ReplSession;
242
- ReplSession.PROMPT = "pristine ❯ ";
243
- ReplSession.SESSION_VERBS = ["/help", "/clear", "/exit"];
244
- ReplSession.TRACE_ID_COMPLETION_LIMIT = 25;
245
- exports.ReplSession = ReplSession = ReplSession_1 = __decorate([
246
- (0, tsyringe_1.injectable)(),
247
- (0, common_1.moduleScoped)(cli_module_keyname_1.CliModuleKeyname),
248
- __metadata("design:paramtypes", [cli_output_manager_1.CliOutput,
249
- observability_1.ObservabilityStoreReader])
250
- ], ReplSession);
251
- //# sourceMappingURL=repl-session.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"repl-session.js","sourceRoot":"","sources":["../../../../src/managers/repl-session.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA0C;AAC1C,uCAAoC;AACpC,gDAAqF;AACrF,4CAAsE;AACtE,8DAAoE;AAEpE,6DAA+C;AAC/C,8DAAuD;AAEvD;;;;;;;;;;;;;;;GAeG;AAGI,IAAM,WAAW,mBAAjB,MAAM,WAAW;IAOtB,YACmB,SAAoB,EACpB,WAAqC;QADrC,cAAS,GAAT,SAAS,CAAW;QACpB,gBAAW,GAAX,WAAW,CAA0B;QAJhD,aAAQ,GAA4B,EAAE,CAAC;IAM/C,CAAC;IAED;;;;;;OAMG;IACG,KAAK,CAAC,MAAc;;YACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC7C,IAAI,CAAC,WAAW,EAAE,CAAC;YAEnB,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;gBAClC,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,MAAM,EAAE,aAAW,CAAC,MAAM;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;;;;;;;;;;;OAYG;IACK,eAAe,CAAC,MAAc;QACpC,IAAI,CAAC;YACH,MAAM,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,EAAE,CAAC;YAC/D,cAAc,CAAC,gBAAgB,CAAC,iCAAwB,CAAC,qBAAqB,EAAE,cAAc,CAAC,CAAC;YAChG,OAAO,cAAc,CAAC,UAAU,CAAwB,iCAAwB,CAAC,OAAO,CAAC,CAAC;QAC5F,CAAC;QAAC,OAAO,KAAK,EAAE,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;;AAhLU,kCAAW;AACE,kBAAM,GAAG,aAAa,AAAhB,CAAiB;AACvB,yBAAa,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,AAA/B,CAAgC;AAC7C,qCAAyB,GAAG,EAAE,AAAL,CAAM;sBAH5C,WAAW;IAFvB,IAAA,qBAAU,GAAE;IACZ,IAAA,qBAAY,EAAC,qCAAgB,CAAC;qCASC,8BAAS;QACP,wCAAwB;GAT7C,WAAW,CAiLvB"}
@@ -1,65 +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
- import { injectable } from "tsyringe";
8
- import fs from "fs";
9
- import path from "path";
10
- /**
11
- * Persists the user's selection from the disambiguation prompt so subsequent invocations of
12
- * `pristine` in the same project skip the prompt. Stale entries (target file deleted since
13
- * the cache was written) are auto-cleaned on read.
14
- *
15
- * Best-effort throughout — failures to read or write the cache file are swallowed because
16
- * the cache is a UX optimization, not correctness-critical.
17
- */
18
- let AppModuleCache = class AppModuleCache {
19
- constructor() {
20
- this.cacheDirName = ".pristine";
21
- this.cacheFileName = "last-app-module";
22
- }
23
- read(projectRoot) {
24
- const cachePath = this.cachePath(projectRoot);
25
- if (fs.existsSync(cachePath) === false) {
26
- return undefined;
27
- }
28
- let cached;
29
- try {
30
- cached = fs.readFileSync(cachePath, "utf8").trim();
31
- }
32
- catch (_a) {
33
- return undefined;
34
- }
35
- if (cached.length === 0 || fs.existsSync(cached) === false) {
36
- // Stale cache — the user must have deleted or moved the file. Drop it so it doesn't
37
- // keep being suggested on every subsequent invocation.
38
- try {
39
- fs.unlinkSync(cachePath);
40
- }
41
- catch (_b) {
42
- // Best-effort cleanup.
43
- }
44
- return undefined;
45
- }
46
- return cached;
47
- }
48
- write(projectRoot, absolutePath) {
49
- try {
50
- fs.mkdirSync(path.resolve(projectRoot, this.cacheDirName), { recursive: true });
51
- fs.writeFileSync(this.cachePath(projectRoot), absolutePath, "utf8");
52
- }
53
- catch (_a) {
54
- // Best-effort.
55
- }
56
- }
57
- cachePath(projectRoot) {
58
- return path.resolve(projectRoot, this.cacheDirName, this.cacheFileName);
59
- }
60
- };
61
- AppModuleCache = __decorate([
62
- injectable()
63
- ], AppModuleCache);
64
- export { AppModuleCache };
65
- //# sourceMappingURL=app-module-cache.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-module-cache.js","sourceRoot":"","sources":["../../../../src/bootstrap/app-module-cache.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;;;;;GAO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