@pristine-ts/cli 2.0.7 → 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 (243) hide show
  1. package/dist/lib/cjs/bootstrap/build-staleness-prompt.js +12 -13
  2. package/dist/lib/cjs/bootstrap/build-staleness-prompt.js.map +1 -1
  3. package/dist/lib/cjs/bootstrap/init-prompt.js +16 -47
  4. package/dist/lib/cjs/bootstrap/init-prompt.js.map +1 -1
  5. package/dist/lib/cjs/cli.configuration-keys.js +24 -0
  6. package/dist/lib/cjs/cli.configuration-keys.js.map +1 -0
  7. package/dist/lib/cjs/cli.js +23 -10
  8. package/dist/lib/cjs/cli.js.map +1 -1
  9. package/dist/lib/cjs/cli.module.js +29 -1
  10. package/dist/lib/cjs/cli.module.js.map +1 -1
  11. package/dist/lib/cjs/commands/commands.js +6 -0
  12. package/dist/lib/cjs/commands/commands.js.map +1 -1
  13. package/dist/lib/cjs/commands/logs-alias.command.js +49 -0
  14. package/dist/lib/cjs/commands/logs-alias.command.js.map +1 -0
  15. package/dist/lib/cjs/commands/logs.command-options.js +72 -0
  16. package/dist/lib/cjs/commands/logs.command-options.js.map +1 -0
  17. package/dist/lib/cjs/commands/logs.command.js +102 -0
  18. package/dist/lib/cjs/commands/logs.command.js.map +1 -0
  19. package/dist/lib/cjs/commands/requests-alias.command.js +49 -0
  20. package/dist/lib/cjs/commands/requests-alias.command.js.map +1 -0
  21. package/dist/lib/cjs/commands/requests.command-options.js +26 -0
  22. package/dist/lib/cjs/commands/requests.command-options.js.map +1 -0
  23. package/dist/lib/cjs/commands/requests.command.js +88 -0
  24. package/dist/lib/cjs/commands/requests.command.js.map +1 -0
  25. package/dist/lib/cjs/commands/trace-alias.command.js +49 -0
  26. package/dist/lib/cjs/commands/trace-alias.command.js.map +1 -0
  27. package/dist/lib/cjs/commands/trace.command-options.js +59 -0
  28. package/dist/lib/cjs/commands/trace.command-options.js.map +1 -0
  29. package/dist/lib/cjs/commands/trace.command.js +84 -0
  30. package/dist/lib/cjs/commands/trace.command.js.map +1 -0
  31. package/dist/lib/cjs/config/config-loader.js +34 -13
  32. package/dist/lib/cjs/config/config-loader.js.map +1 -1
  33. package/dist/lib/cjs/decorators/command-parameter.decorator.js +40 -0
  34. package/dist/lib/cjs/decorators/command-parameter.decorator.js.map +1 -0
  35. package/dist/lib/cjs/decorators/decorators.js +18 -0
  36. package/dist/lib/cjs/decorators/decorators.js.map +1 -0
  37. package/dist/lib/cjs/enums/cli-decorator-metadata-keyname.enum.js +14 -0
  38. package/dist/lib/cjs/enums/cli-decorator-metadata-keyname.enum.js.map +1 -0
  39. package/dist/lib/cjs/enums/enums.js +19 -0
  40. package/dist/lib/cjs/enums/enums.js.map +1 -0
  41. package/dist/lib/cjs/enums/terminal-key-name.enum.js +21 -0
  42. package/dist/lib/cjs/enums/terminal-key-name.enum.js.map +1 -0
  43. package/dist/lib/cjs/errors/cli-error-code.enum.js +11 -1
  44. package/dist/lib/cjs/errors/cli-error-code.enum.js.map +1 -1
  45. package/dist/lib/cjs/errors/errors.js +1 -0
  46. package/dist/lib/cjs/errors/errors.js.map +1 -1
  47. package/dist/lib/cjs/errors/prompt-cancelled.error.js +25 -0
  48. package/dist/lib/cjs/errors/prompt-cancelled.error.js.map +1 -0
  49. package/dist/lib/cjs/event-handlers/cli.event-handler.js +21 -65
  50. package/dist/lib/cjs/event-handlers/cli.event-handler.js.map +1 -1
  51. package/dist/lib/cjs/event-handlers/event-handlers.js +1 -0
  52. package/dist/lib/cjs/event-handlers/event-handlers.js.map +1 -1
  53. package/dist/lib/cjs/event-handlers/repl-start.event-handler.js +280 -0
  54. package/dist/lib/cjs/event-handlers/repl-start.event-handler.js.map +1 -0
  55. package/dist/lib/cjs/event-payloads/event-payloads.js +1 -0
  56. package/dist/lib/cjs/event-payloads/event-payloads.js.map +1 -1
  57. package/dist/lib/cjs/event-payloads/start-repl.event-payload.js +19 -0
  58. package/dist/lib/cjs/event-payloads/start-repl.event-payload.js.map +1 -0
  59. package/dist/lib/cjs/interfaces/interfaces.js +1 -0
  60. package/dist/lib/cjs/interfaces/interfaces.js.map +1 -1
  61. package/dist/lib/cjs/interfaces/terminal-key.interface.js +3 -0
  62. package/dist/lib/cjs/interfaces/terminal-key.interface.js.map +1 -0
  63. package/dist/lib/cjs/managers/cli-prompt.manager.js +181 -15
  64. package/dist/lib/cjs/managers/cli-prompt.manager.js.map +1 -1
  65. package/dist/lib/cjs/managers/managers.js +1 -0
  66. package/dist/lib/cjs/managers/managers.js.map +1 -1
  67. package/dist/lib/cjs/managers/terminal-key-reader.manager.js +99 -0
  68. package/dist/lib/cjs/managers/terminal-key-reader.manager.js.map +1 -0
  69. package/dist/lib/cjs/mappers/command-event.mapper.js +48 -8
  70. package/dist/lib/cjs/mappers/command-event.mapper.js.map +1 -1
  71. package/dist/lib/cjs/mappers/mappers.js +1 -0
  72. package/dist/lib/cjs/mappers/mappers.js.map +1 -1
  73. package/dist/lib/cjs/mappers/repl-start-event.mapper.js +80 -0
  74. package/dist/lib/cjs/mappers/repl-start-event.mapper.js.map +1 -0
  75. package/dist/lib/cjs/options/command-parameter.options.js +3 -0
  76. package/dist/lib/cjs/options/command-parameter.options.js.map +1 -0
  77. package/dist/lib/cjs/options/options.js +1 -0
  78. package/dist/lib/cjs/options/options.js.map +1 -1
  79. package/dist/lib/cjs/services/command-argument-resolver.js +62 -0
  80. package/dist/lib/cjs/services/command-argument-resolver.js.map +1 -0
  81. package/dist/lib/cjs/services/command-options-resolver.js +114 -0
  82. package/dist/lib/cjs/services/command-options-resolver.js.map +1 -0
  83. package/dist/lib/cjs/services/command-parameter-prompter.js +311 -0
  84. package/dist/lib/cjs/services/command-parameter-prompter.js.map +1 -0
  85. package/dist/lib/cjs/services/services.js +20 -0
  86. package/dist/lib/cjs/services/services.js.map +1 -0
  87. package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  88. package/dist/lib/cjs/types/start-repl-event-response.type.js +13 -0
  89. package/dist/lib/cjs/types/start-repl-event-response.type.js.map +1 -0
  90. package/dist/lib/cjs/types/types.js +1 -0
  91. package/dist/lib/cjs/types/types.js.map +1 -1
  92. package/dist/lib/cjs/utils/boolean-answer-parser.js +25 -0
  93. package/dist/lib/cjs/utils/boolean-answer-parser.js.map +1 -0
  94. package/dist/lib/cjs/utils/pristine-argv.js +87 -0
  95. package/dist/lib/cjs/utils/pristine-argv.js.map +1 -0
  96. package/dist/lib/cjs/utils/terminal-key-decoder.js +71 -0
  97. package/dist/lib/cjs/utils/terminal-key-decoder.js.map +1 -0
  98. package/dist/lib/esm/bootstrap/build-staleness-prompt.js +12 -13
  99. package/dist/lib/esm/bootstrap/build-staleness-prompt.js.map +1 -1
  100. package/dist/lib/esm/bootstrap/init-prompt.js +16 -47
  101. package/dist/lib/esm/bootstrap/init-prompt.js.map +1 -1
  102. package/dist/lib/esm/cli.configuration-keys.js +21 -0
  103. package/dist/lib/esm/cli.configuration-keys.js.map +1 -0
  104. package/dist/lib/esm/cli.js +23 -10
  105. package/dist/lib/esm/cli.js.map +1 -1
  106. package/dist/lib/esm/cli.module.js +29 -1
  107. package/dist/lib/esm/cli.module.js.map +1 -1
  108. package/dist/lib/esm/commands/commands.js +6 -0
  109. package/dist/lib/esm/commands/commands.js.map +1 -1
  110. package/dist/lib/esm/commands/logs-alias.command.js +46 -0
  111. package/dist/lib/esm/commands/logs-alias.command.js.map +1 -0
  112. package/dist/lib/esm/commands/logs.command-options.js +68 -0
  113. package/dist/lib/esm/commands/logs.command-options.js.map +1 -0
  114. package/dist/lib/esm/commands/logs.command.js +99 -0
  115. package/dist/lib/esm/commands/logs.command.js.map +1 -0
  116. package/dist/lib/esm/commands/requests-alias.command.js +46 -0
  117. package/dist/lib/esm/commands/requests-alias.command.js.map +1 -0
  118. package/dist/lib/esm/commands/requests.command-options.js +22 -0
  119. package/dist/lib/esm/commands/requests.command-options.js.map +1 -0
  120. package/dist/lib/esm/commands/requests.command.js +85 -0
  121. package/dist/lib/esm/commands/requests.command.js.map +1 -0
  122. package/dist/lib/esm/commands/trace-alias.command.js +46 -0
  123. package/dist/lib/esm/commands/trace-alias.command.js.map +1 -0
  124. package/dist/lib/esm/commands/trace.command-options.js +55 -0
  125. package/dist/lib/esm/commands/trace.command-options.js.map +1 -0
  126. package/dist/lib/esm/commands/trace.command.js +81 -0
  127. package/dist/lib/esm/commands/trace.command.js.map +1 -0
  128. package/dist/lib/esm/config/config-loader.js +34 -13
  129. package/dist/lib/esm/config/config-loader.js.map +1 -1
  130. package/dist/lib/esm/decorators/command-parameter.decorator.js +36 -0
  131. package/dist/lib/esm/decorators/command-parameter.decorator.js.map +1 -0
  132. package/dist/lib/esm/decorators/decorators.js +2 -0
  133. package/dist/lib/esm/decorators/decorators.js.map +1 -0
  134. package/dist/lib/esm/enums/cli-decorator-metadata-keyname.enum.js +11 -0
  135. package/dist/lib/esm/enums/cli-decorator-metadata-keyname.enum.js.map +1 -0
  136. package/dist/lib/esm/enums/enums.js +3 -0
  137. package/dist/lib/esm/enums/enums.js.map +1 -0
  138. package/dist/lib/esm/enums/terminal-key-name.enum.js +18 -0
  139. package/dist/lib/esm/enums/terminal-key-name.enum.js.map +1 -0
  140. package/dist/lib/esm/errors/cli-error-code.enum.js +11 -1
  141. package/dist/lib/esm/errors/cli-error-code.enum.js.map +1 -1
  142. package/dist/lib/esm/errors/errors.js +1 -0
  143. package/dist/lib/esm/errors/errors.js.map +1 -1
  144. package/dist/lib/esm/errors/prompt-cancelled.error.js +21 -0
  145. package/dist/lib/esm/errors/prompt-cancelled.error.js.map +1 -0
  146. package/dist/lib/esm/event-handlers/cli.event-handler.js +22 -66
  147. package/dist/lib/esm/event-handlers/cli.event-handler.js.map +1 -1
  148. package/dist/lib/esm/event-handlers/event-handlers.js +1 -0
  149. package/dist/lib/esm/event-handlers/event-handlers.js.map +1 -1
  150. package/dist/lib/esm/event-handlers/repl-start.event-handler.js +244 -0
  151. package/dist/lib/esm/event-handlers/repl-start.event-handler.js.map +1 -0
  152. package/dist/lib/esm/event-payloads/event-payloads.js +1 -0
  153. package/dist/lib/esm/event-payloads/event-payloads.js.map +1 -1
  154. package/dist/lib/esm/event-payloads/start-repl.event-payload.js +15 -0
  155. package/dist/lib/esm/event-payloads/start-repl.event-payload.js.map +1 -0
  156. package/dist/lib/esm/interfaces/interfaces.js +1 -0
  157. package/dist/lib/esm/interfaces/interfaces.js.map +1 -1
  158. package/dist/lib/esm/interfaces/terminal-key.interface.js +2 -0
  159. package/dist/lib/esm/interfaces/terminal-key.interface.js.map +1 -0
  160. package/dist/lib/esm/managers/cli-prompt.manager.js +182 -16
  161. package/dist/lib/esm/managers/cli-prompt.manager.js.map +1 -1
  162. package/dist/lib/esm/managers/managers.js +1 -0
  163. package/dist/lib/esm/managers/managers.js.map +1 -1
  164. package/dist/lib/esm/managers/terminal-key-reader.manager.js +96 -0
  165. package/dist/lib/esm/managers/terminal-key-reader.manager.js.map +1 -0
  166. package/dist/lib/esm/mappers/command-event.mapper.js +49 -9
  167. package/dist/lib/esm/mappers/command-event.mapper.js.map +1 -1
  168. package/dist/lib/esm/mappers/mappers.js +1 -0
  169. package/dist/lib/esm/mappers/mappers.js.map +1 -1
  170. package/dist/lib/esm/mappers/repl-start-event.mapper.js +77 -0
  171. package/dist/lib/esm/mappers/repl-start-event.mapper.js.map +1 -0
  172. package/dist/lib/esm/options/command-parameter.options.js +2 -0
  173. package/dist/lib/esm/options/command-parameter.options.js.map +1 -0
  174. package/dist/lib/esm/options/options.js +1 -0
  175. package/dist/lib/esm/options/options.js.map +1 -1
  176. package/dist/lib/esm/services/command-argument-resolver.js +59 -0
  177. package/dist/lib/esm/services/command-argument-resolver.js.map +1 -0
  178. package/dist/lib/esm/services/command-options-resolver.js +111 -0
  179. package/dist/lib/esm/services/command-options-resolver.js.map +1 -0
  180. package/dist/lib/esm/services/command-parameter-prompter.js +308 -0
  181. package/dist/lib/esm/services/command-parameter-prompter.js.map +1 -0
  182. package/dist/lib/esm/services/services.js +4 -0
  183. package/dist/lib/esm/services/services.js.map +1 -0
  184. package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
  185. package/dist/lib/esm/types/start-repl-event-response.type.js +9 -0
  186. package/dist/lib/esm/types/start-repl-event-response.type.js.map +1 -0
  187. package/dist/lib/esm/types/types.js +1 -0
  188. package/dist/lib/esm/types/types.js.map +1 -1
  189. package/dist/lib/esm/utils/boolean-answer-parser.js +21 -0
  190. package/dist/lib/esm/utils/boolean-answer-parser.js.map +1 -0
  191. package/dist/lib/esm/utils/pristine-argv.js +50 -0
  192. package/dist/lib/esm/utils/pristine-argv.js.map +1 -0
  193. package/dist/lib/esm/utils/terminal-key-decoder.js +67 -0
  194. package/dist/lib/esm/utils/terminal-key-decoder.js.map +1 -0
  195. package/dist/types/bootstrap/build-staleness-prompt.d.ts +3 -3
  196. package/dist/types/bootstrap/init-prompt.d.ts +5 -5
  197. package/dist/types/cli.configuration-keys.d.ts +32 -0
  198. package/dist/types/cli.d.ts +8 -4
  199. package/dist/types/cli.module.d.ts +4 -0
  200. package/dist/types/commands/commands.d.ts +6 -0
  201. package/dist/types/commands/logs-alias.command.d.ts +14 -0
  202. package/dist/types/commands/logs.command-options.d.ts +38 -0
  203. package/dist/types/commands/logs.command.d.ts +31 -0
  204. package/dist/types/commands/requests-alias.command.d.ts +14 -0
  205. package/dist/types/commands/requests.command-options.d.ts +8 -0
  206. package/dist/types/commands/requests.command.d.ts +25 -0
  207. package/dist/types/commands/trace-alias.command.d.ts +14 -0
  208. package/dist/types/commands/trace.command-options.d.ts +31 -0
  209. package/dist/types/commands/trace.command.d.ts +21 -0
  210. package/dist/types/config/config-loader.d.ts +15 -3
  211. package/dist/types/decorators/command-parameter.decorator.d.ts +30 -0
  212. package/dist/types/decorators/decorators.d.ts +1 -0
  213. package/dist/types/enums/cli-decorator-metadata-keyname.enum.d.ts +9 -0
  214. package/dist/types/enums/enums.d.ts +2 -0
  215. package/dist/types/enums/terminal-key-name.enum.d.ts +16 -0
  216. package/dist/types/errors/cli-error-code.enum.d.ts +12 -2
  217. package/dist/types/errors/errors.d.ts +1 -0
  218. package/dist/types/errors/prompt-cancelled.error.d.ts +13 -0
  219. package/dist/types/event-handlers/cli.event-handler.d.ts +16 -13
  220. package/dist/types/event-handlers/event-handlers.d.ts +1 -0
  221. package/dist/types/event-handlers/repl-start.event-handler.d.ts +70 -0
  222. package/dist/types/event-payloads/event-payloads.d.ts +1 -0
  223. package/dist/types/event-payloads/start-repl.event-payload.d.ts +13 -0
  224. package/dist/types/interfaces/interfaces.d.ts +1 -0
  225. package/dist/types/interfaces/terminal-key.interface.d.ts +11 -0
  226. package/dist/types/managers/cli-prompt.manager.d.ts +63 -6
  227. package/dist/types/managers/managers.d.ts +1 -0
  228. package/dist/types/managers/terminal-key-reader.manager.d.ts +31 -0
  229. package/dist/types/mappers/command-event.mapper.d.ts +10 -1
  230. package/dist/types/mappers/mappers.d.ts +1 -0
  231. package/dist/types/mappers/repl-start-event.mapper.d.ts +28 -0
  232. package/dist/types/options/command-parameter.options.d.ts +29 -0
  233. package/dist/types/options/options.d.ts +1 -0
  234. package/dist/types/services/command-argument-resolver.d.ts +24 -0
  235. package/dist/types/services/command-options-resolver.d.ts +35 -0
  236. package/dist/types/services/command-parameter-prompter.d.ts +113 -0
  237. package/dist/types/services/services.d.ts +3 -0
  238. package/dist/types/types/start-repl-event-response.type.d.ts +10 -0
  239. package/dist/types/types/types.d.ts +1 -0
  240. package/dist/types/utils/boolean-answer-parser.d.ts +11 -0
  241. package/dist/types/utils/pristine-argv.d.ts +33 -0
  242. package/dist/types/utils/terminal-key-decoder.d.ts +28 -0
  243. package/package.json +16 -12
@@ -3,10 +3,20 @@
3
3
  * (typed `PristineErrorCode | string`, so any enum value is accepted).
4
4
  *
5
5
  * Codes here describe CLI-specific failures — command resolution, argument mapping,
6
- * and argument validation.
6
+ * argument validation, and command-parameter binding.
7
7
  */
8
8
  export declare enum CliErrorCode {
9
9
  CommandNotFound = "COMMAND_NOT_FOUND",
10
10
  ArgumentMappingFailed = "ARGUMENT_MAPPING_FAILED",
11
- ArgumentValidationFailed = "ARGUMENT_VALIDATION_FAILED"
11
+ ArgumentValidationFailed = "ARGUMENT_VALIDATION_FAILED",
12
+ /**
13
+ * Two `@commandParameter` properties on the same options class resolve to the same flag.
14
+ * A programming error in the command's options definition, not bad user input.
15
+ */
16
+ CommandParameterFlagConflict = "COMMAND_PARAMETER_FLAG_CONFLICT",
17
+ /**
18
+ * The user cancelled an interactive prompt with `Ctrl+C`. Carried by
19
+ * `PromptCancelledError` — a clean, user-initiated cancellation, not a failure.
20
+ */
21
+ PromptCancelled = "PROMPT_CANCELLED"
12
22
  }
@@ -1,2 +1,3 @@
1
1
  export * from "./cli-error-code.enum";
2
2
  export * from "./command-not-found.error";
3
+ export * from "./prompt-cancelled.error";
@@ -0,0 +1,13 @@
1
+ import { PristineError } from "@pristine-ts/common";
2
+ /**
3
+ * Thrown when the user cancels an interactive prompt with `Ctrl+C`. A clean, user-initiated
4
+ * cancellation — not a crash — so it carries `kind: UserError` (the `CliErrorReporter`
5
+ * renders the message verbatim instead of a stack dump) and exit code `130`, following the
6
+ * POSIX `128 + SIGINT(2)` convention so shell pipelines can detect the interrupt.
7
+ *
8
+ * Callers that treat cancellation as a normal branch (e.g. `BuildStalenessPrompt`) catch it
9
+ * via `instanceof`; everywhere else it propagates to the reporter for a tidy exit.
10
+ */
11
+ export declare class PromptCancelledError extends PristineError {
12
+ constructor();
13
+ }
@@ -3,24 +3,27 @@ import { CommandEvent } from "../types/command-event.type";
3
3
  import { CommandEventResponse } from "../types/command-event-response.type";
4
4
  import { CommandInterface } from "../interfaces/command.interface";
5
5
  import { LogHandlerInterface } from "@pristine-ts/logging";
6
- import { Validator } from "@pristine-ts/class-validator";
6
+ import { CommandArgumentResolver } from "../services/command-argument-resolver";
7
7
  export declare class CliEventHandler implements EventHandlerInterface<any, any> {
8
8
  private readonly logHandler;
9
- private readonly validator;
9
+ private readonly commandArgumentResolver;
10
10
  private readonly commands;
11
- constructor(logHandler: LogHandlerInterface, validator: Validator, commands: CommandInterface<any>[]);
12
- handle(event: CommandEvent): Promise<CommandEventResponse>;
11
+ constructor(logHandler: LogHandlerInterface, commandArgumentResolver: CommandArgumentResolver, commands: CommandInterface<any>[]);
13
12
  /**
14
- * Maps `rawArgs` (the parsed argv shape produced by `CommandEventMapper`) into a typed
15
- * instance of `command.optionsType`, then runs `class-validator` against the instance.
16
- *
17
- * For commands that opt out of typed options (`optionsType === null`), passes the raw
18
- * args through unchanged — the legacy escape hatch for commands that want to handle
19
- * argv parsing themselves.
13
+ * Resolves and runs the command, then **returns** its exit code wrapped in a
14
+ * `CommandEventResponse` it does not call `process.exit`.
20
15
  *
21
- * Throws `UsageError` for mapping failures and `ValidationError` for class-validator
22
- * failures. Both carry structured `details` so `CliErrorReporter` can render them as
23
- * readable stderr lines without this method touching the console directly.
16
+ * Process lifecycle is the bin's job: `kernel.handle` resolves with this exit code,
17
+ * `Cli.bootstrap` returns it, and `bin.ts` does the actual `process.exit`. Returning
18
+ * (rather than exiting) is also what lets the interactive REPL dispatch commands
19
+ * through this very handler — `kernel.handle(argv, {keyname: Cli})` per typed line —
20
+ * without the process dying after the first command.
21
+ */
22
+ handle(event: CommandEvent): Promise<CommandEventResponse>;
23
+ /**
24
+ * Maps + validates a command's raw arguments. Delegates to the shared
25
+ * `CommandArgumentResolver`. Since the REPL dispatches through this same handler, the
26
+ * one-shot CLI and the REPL resolve arguments through identical logic.
24
27
  */
25
28
  resolveArgs(command: CommandInterface<any>, rawArgs: any): Promise<any>;
26
29
  supports(event: Event<any>): boolean;
@@ -1 +1,2 @@
1
1
  export * from "./cli.event-handler";
2
+ export * from "./repl-start.event-handler";
@@ -0,0 +1,70 @@
1
+ import { DependencyContainer } from "tsyringe";
2
+ import { Event, EventHandlerInterface, Kernel } from "@pristine-ts/core";
3
+ import { ExitCode } from "@pristine-ts/common";
4
+ import { TraceStore } from "@pristine-ts/observability";
5
+ import { CliOutput } from "../managers/cli-output.manager";
6
+ import { StartReplEventPayload } from "../event-payloads/start-repl.event-payload";
7
+ import { StartReplEventResponse } from "../types/start-repl-event-response.type";
8
+ /**
9
+ * The interactive `pristine` console, modelled as a long-running event handler. Launched
10
+ * when the bin is invoked with no command (or `pristine repl`) — `ReplStartEventMapper`
11
+ * produces a `StartReplEventPayload` and this handler runs the readline loop for the rest
12
+ * of the process lifetime.
13
+ *
14
+ * **Why an event handler.** The REPL is the same shape as `pristine start` (or any
15
+ * long-running command): an EventHandler whose `handle()` doesn't return until the
16
+ * session ends. This gives the CLI bootstrap a uniform shape — `cli.ts` just calls
17
+ * `kernel.handle(argv, {keyname: Cli})` regardless of whether the user invoked a one-shot
18
+ * command or wants the interactive console. There is no driver/handler asymmetry left in
19
+ * the bootstrap; the mapping layer routes argv to the right payload.
20
+ *
21
+ * **Per-line dispatch.** Each typed line is re-entered through `kernel.handle(...,
22
+ * {keyname: Cli})` — using `Kernel` (the proper re-entry seam — it owns trace lifecycle,
23
+ * child container creation, the works). The `Kernel` is `registerInstance`-d into its
24
+ * own container by `Cli.bootstrap()`, so this handler injects it via DI like any other
25
+ * service.
26
+ *
27
+ * Plus the session verbs `/help`, `/clear`, `/exit` handled in-process (they're not
28
+ * commands — they don't re-enter the kernel). Tab-completion is driven by the live
29
+ * command registry and by recent trace ids for `/trace` / `/logs`.
30
+ */
31
+ export declare class ReplStartEventHandler implements EventHandlerInterface<StartReplEventPayload, ExitCode | number> {
32
+ private readonly kernel;
33
+ private readonly container;
34
+ private readonly cliOutput;
35
+ private readonly traceStore;
36
+ private static readonly PROMPT;
37
+ private static readonly SESSION_VERBS;
38
+ private static readonly TRACE_ID_COMPLETION_LIMIT;
39
+ private commands;
40
+ constructor(kernel: Kernel, container: DependencyContainer, cliOutput: CliOutput, traceStore: TraceStore);
41
+ supports<T>(event: Event<T>): boolean;
42
+ /**
43
+ * Runs the read-eval-print loop until `/exit` or EOF (Ctrl-D). Resolves with the exit
44
+ * code wrapped in a `StartReplEventResponse`; the mapper surfaces that to `Cli.bootstrap`.
45
+ */
46
+ handle(event: Event<StartReplEventPayload>): Promise<StartReplEventResponse>;
47
+ /**
48
+ * Handles one input line. Returns true when the session should end.
49
+ */
50
+ private handleLine;
51
+ /**
52
+ * Readline completer. Completes `/`-prefixed command names and session verbs; for
53
+ * `/trace` and `/logs` it completes the trailing token with recent trace ids.
54
+ */
55
+ private complete;
56
+ private printBanner;
57
+ private printHelp;
58
+ private shutdown;
59
+ /**
60
+ * Enumerates every registered command. Resolved from the per-event child container the
61
+ * kernel handed this handler when it dispatched the REPL-start event — same container
62
+ * `HelpCommand`/`ListCommand` themselves use, so commands that depend on
63
+ * `CurrentChildContainer` resolve cleanly.
64
+ *
65
+ * `resolveAll`, justified: framework REPL infrastructure at session start — enumerating
66
+ * every `Command`-tagged service is a container-introspection operation with no
67
+ * constructor seam.
68
+ */
69
+ private resolveCommands;
70
+ }
@@ -1 +1,2 @@
1
1
  export * from "./command.event-payload";
2
+ export * from "./start-repl.event-payload";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Payload that signals "launch the interactive REPL." Produced by `ReplStartEventMapper`
3
+ * for argv shapes with no command (`pristine`) or with the explicit `repl` command
4
+ * (`pristine repl`). Consumed by `ReplStartEventHandler` which runs the readline loop
5
+ * for the rest of the process lifetime.
6
+ *
7
+ * The payload carries the `scriptPath` (argv[1]) for parity with `CommandEventPayload`
8
+ * and for diagnostics; the REPL itself reads its input from stdin, not from the payload.
9
+ */
10
+ export declare class StartReplEventPayload {
11
+ scriptPath: string;
12
+ constructor(scriptPath: string);
13
+ }
@@ -1 +1,2 @@
1
1
  export * from "./command.interface";
2
+ export * from "./terminal-key.interface";
@@ -0,0 +1,11 @@
1
+ import { TerminalKeyName } from "../enums/terminal-key-name.enum";
2
+ /**
3
+ * A single decoded keypress from an interactive terminal. `name` classifies the key;
4
+ * `sequence` is the raw character(s) it produced — meaningful for `Character` keys (the
5
+ * literal typed character, echoed/accumulated by callers) and retained for the rest for
6
+ * diagnostics.
7
+ */
8
+ export interface TerminalKey {
9
+ name: TerminalKeyName;
10
+ sequence: string;
11
+ }
@@ -1,9 +1,24 @@
1
1
  import { ConsoleReadlineOptions } from "../options/console-readline.options";
2
+ import { TerminalKeyReader } from "./terminal-key-reader.manager";
2
3
  /**
3
- * Interactive stdin reader for CLI commands. Wraps Node's `readline/promises` and offers
4
- * a single `readLine` method with optional masking after input is received.
4
+ * Interactive terminal prompts for CLI commands, implemented entirely on Node's `readline`
5
+ * and raw-mode stdin no third-party prompt library. Line-based prompts (`readLine`,
6
+ * `input`, `confirm`) go through `readline/promises`; the keystroke-level prompts (`select`
7
+ * arrow menu, masked `readSecret`) go through {@link TerminalKeyReader}.
8
+ *
9
+ * `Ctrl+C` rejects with {@link PromptCancelledError} across all of them — the line prompts
10
+ * via a `readline` SIGINT handler, the raw-mode prompts via the key reader — so callers get
11
+ * one consistent cancellation signal.
5
12
  */
6
13
  export declare class CliPrompt {
14
+ private readonly terminalKeyReader;
15
+ private static readonly CYAN;
16
+ private static readonly DIM;
17
+ private static readonly RESET;
18
+ private static readonly HIDE_CURSOR;
19
+ private static readonly SHOW_CURSOR;
20
+ private static readonly POINTER;
21
+ constructor(terminalKeyReader: TerminalKeyReader);
7
22
  /**
8
23
  * Reads a string from stdin synchronously. Returns whatever `process.stdin.read()`
9
24
  * gives back (which may be `null` when no data is buffered).
@@ -12,11 +27,53 @@ export declare class CliPrompt {
12
27
  /**
13
28
  * Reads a line from stdin after displaying a prompt. When
14
29
  * `options.showCharactersOnTyping` is false, the answered line is cleared and replaced
15
- * with a masked echo so the typed value isn't left visible on screen.
30
+ * with a masked echo so the typed value isn't left visible on screen (a post-input clear,
31
+ * not true keystroke suppression — use {@link readSecret} for real masking).
16
32
  *
17
- * Note: this is not a true keystroke-suppressing password input — Node's stock
18
- * `readline` does not support that without raw-mode handling. The current behavior is
19
- * a post-input clear, sufficient for most CLI prompts.
33
+ * `Ctrl+C` rejects with {@link PromptCancelledError}: registering a `SIGINT` listener on
34
+ * the readline interface overrides Node's default interrupt handling, turning it into a
35
+ * clean rejection rather than a hung promise.
20
36
  */
21
37
  readLine(question: string, options?: ConsoleReadlineOptions): Promise<string>;
38
+ /**
39
+ * Asks a free-text question, optionally with a default. The default is shown as a hint and
40
+ * returned verbatim when the user submits an empty line. The answer is trimmed.
41
+ */
42
+ input(message: string, defaultValue?: string): Promise<string>;
43
+ /**
44
+ * Asks a yes/no question. An empty answer takes the default; anything `BooleanAnswerParser`
45
+ * understands (`y`/`yes`/`true`/`1`, `n`/`no`/`false`/`0`) is accepted; anything else is
46
+ * re-asked. The default is shown capitalized in the `(Y/n)` / `(y/N)` hint.
47
+ */
48
+ confirm(message: string, defaultValue?: boolean): Promise<boolean>;
49
+ /**
50
+ * Presents an arrow-key menu and returns the chosen choice's `value`. `↑`/`↓` move the
51
+ * highlight (wrapping at the ends), `Enter` selects, `Ctrl+C` cancels. When `defaultValue`
52
+ * matches a choice, the menu starts on it. The cursor is hidden while the menu is active
53
+ * and restored afterward.
54
+ */
55
+ select<T>(message: string, choices: {
56
+ name: string;
57
+ value: T;
58
+ }[], defaultValue?: T): Promise<T>;
59
+ /**
60
+ * Reads a secret (password, token, …) from stdin with the typed characters masked as `*`.
61
+ * Real keystroke suppression via raw mode (unlike {@link readLine}'s post-input clear):
62
+ * each character echoes a `*`, `Backspace` erases one, `Enter` submits, `Ctrl+C` cancels.
63
+ * The value is returned untrimmed — a secret may legitimately contain surrounding
64
+ * whitespace.
65
+ */
66
+ readSecret(question: string): Promise<string>;
67
+ /**
68
+ * Writes the choice rows, highlighting the active one with a colored pointer. Each row is
69
+ * cleared before it's written so a repaint never leaves a longer previous label behind.
70
+ * @private
71
+ */
72
+ private renderChoices;
73
+ /**
74
+ * Moves the cursor back up over the previously-rendered choice rows and rewrites them, so
75
+ * the menu updates in place as the selection moves.
76
+ * @private
77
+ */
78
+ private repaintChoices;
22
79
  }
@@ -2,4 +2,5 @@ export * from "./cli-output.manager";
2
2
  export * from "./cli-progress-bar.manager";
3
3
  export * from "./cli-prompt.manager";
4
4
  export * from "./cli-spinner.manager";
5
+ export * from "./terminal-key-reader.manager";
5
6
  export * from "./shell.manager";
@@ -0,0 +1,31 @@
1
+ import { TerminalKey } from "../interfaces/terminal-key.interface";
2
+ /**
3
+ * Owns the raw-mode keystroke reading the interactive prompts need (arrow-key `select`,
4
+ * masked `readSecret`) — the one place in the CLI that flips stdin into raw mode. Node's
5
+ * stock `readline` is line-buffered and echoes input, so it can't drive an arrow-key menu
6
+ * or suppress a password's characters; this reads keys one at a time instead.
7
+ *
8
+ * Two responsibilities are handled centrally so callers don't each reimplement them:
9
+ * - **Cancellation:** `Ctrl+C` rejects the read with {@link PromptCancelledError}.
10
+ * - **Terminal restore:** raw mode is entered on start and restored in every exit path,
11
+ * so a thrown handler or a cancellation never leaves the terminal in raw mode.
12
+ *
13
+ * The `input`/`output` fields default to the process streams and exist as a seam so tests
14
+ * can drive synthetic keystrokes without a real TTY.
15
+ */
16
+ export declare class TerminalKeyReader {
17
+ input: NodeJS.ReadStream;
18
+ output: NodeJS.WriteStream;
19
+ /**
20
+ * Whether both stdin and stdout are interactive terminals. Raw-mode reading is only
21
+ * meaningful on a real TTY; callers fall back (or skip prompting) when this is false.
22
+ */
23
+ isInteractive(): boolean;
24
+ /**
25
+ * Reads keystrokes in raw mode, handing each decoded {@link TerminalKey} to `onKey` until
26
+ * `onKey` ends the read by invoking its `resolve` callback with the result. Resolves to
27
+ * that value; rejects with {@link PromptCancelledError} on `Ctrl+C`. Raw mode is entered
28
+ * on start and restored to its prior state in every exit path.
29
+ */
30
+ read<T>(onKey: (key: TerminalKey, resolve: (value: T) => void) => void): Promise<T>;
31
+ }
@@ -1,6 +1,15 @@
1
- import { EventMapperInterface, EventResponse, EventsExecutionOptionsInterface, ExecutionContextInterface } from "@pristine-ts/core";
1
+ import { EventIdManager, EventMapperInterface, EventResponse, EventsExecutionOptionsInterface, ExecutionContextInterface } from "@pristine-ts/core";
2
2
  import { CommandEventPayload } from "../event-payloads/command.event-payload";
3
3
  export declare class CommandEventMapper implements EventMapperInterface<CommandEventPayload, number> {
4
+ private readonly eventIdManager;
5
+ constructor(eventIdManager: EventIdManager);
6
+ /**
7
+ * Matches argv that names an explicit command. The no-command shape and the bare
8
+ * `pristine repl` form are deliberately rejected here; `ReplStartEventMapper` claims
9
+ * those. Commands typed inside the interactive session are also re-dispatched under
10
+ * `Cli`, so this mapper handles them too. Argv parsing is delegated to `PristineArgv`,
11
+ * which scans for the bin token rather than relying on positional indexing.
12
+ */
4
13
  supportsMapping(rawEvent: any, executionContext: ExecutionContextInterface<any>): boolean;
5
14
  /**
6
15
  * Inspired from: https://github.com/eveningkid/args-parser
@@ -1 +1,2 @@
1
1
  export * from "./command-event.mapper";
2
+ export * from "./repl-start-event.mapper";
@@ -0,0 +1,28 @@
1
+ import { EventIdManager, EventMapperInterface, EventResponse, EventsExecutionOptionsInterface, ExecutionContextInterface } from "@pristine-ts/core";
2
+ import { StartReplEventPayload } from "../event-payloads/start-repl.event-payload";
3
+ /**
4
+ * Maps the "no command" / `repl` argv shapes onto a `StartReplEventPayload` so the kernel
5
+ * can dispatch the REPL launch through the normal event pipeline — `cli.ts` just calls
6
+ * `kernel.handle(process.argv, {keyname: Cli})` regardless of whether the user invoked
7
+ * `pristine`, `pristine repl`, or `pristine <some-command>`.
8
+ *
9
+ * Argv parsing is delegated to `PristineArgv`, which scans for the bin token rather than
10
+ * assuming positional layout — so the rule is runtime-agnostic and survives launchers
11
+ * that shape argv differently.
12
+ *
13
+ * `CommandEventMapper` explicitly excludes these same shapes from its own
14
+ * `supportsMapping` so the two mappers partition argv space cleanly — no shape is claimed
15
+ * by both.
16
+ */
17
+ export declare class ReplStartEventMapper implements EventMapperInterface<StartReplEventPayload, number> {
18
+ private readonly eventIdManager;
19
+ constructor(eventIdManager: EventIdManager);
20
+ supportsMapping(rawEvent: any, executionContext: ExecutionContextInterface<any>): boolean;
21
+ map(rawEvent: any, executionContext: ExecutionContextInterface<any>): EventsExecutionOptionsInterface<StartReplEventPayload>;
22
+ supportsReverseMapping(eventResponse: EventResponse<StartReplEventPayload, number>, response: any, executionContext: ExecutionContextInterface<any>): boolean;
23
+ /**
24
+ * The REPL handler resolves with the session's exit code; surface it as-is so
25
+ * `Cli.bootstrap()` can return it to the bin (which calls `process.exit`).
26
+ */
27
+ reverseMap(eventResponse: EventResponse<StartReplEventPayload, number>, response: any, executionContext: ExecutionContextInterface<any>): any;
28
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Options accepted by the `@commandParameter` decorator. Every field is optional: an empty
3
+ * `@commandParameter()` is valid and simply marks the property as a known command-line
4
+ * parameter, while individual fields opt into extra behavior.
5
+ */
6
+ export interface CommandParameterOptions {
7
+ /**
8
+ * The command-line flag this property binds to. Defaults to the property name.
9
+ *
10
+ * Arguments are bound to options by property name, so without an override the property
11
+ * must be named exactly like the flag. Set this to let the property name and the flag
12
+ * differ (e.g. a camelCase property bound to a dash-separated flag).
13
+ */
14
+ flag?: string;
15
+ /**
16
+ * The question to ask interactively when this parameter is absent from the command line.
17
+ *
18
+ * When set — and interactive parameters are enabled (see `CliConfigurationKeys`) and the
19
+ * input is an interactive terminal — the CLI asks this question and uses the answer.
20
+ * When omitted, the parameter is never asked for; a missing value is left to validation.
21
+ */
22
+ question?: string;
23
+ /**
24
+ * Marks the value as a secret (password, token, connection string with credentials, …).
25
+ * When asked for interactively, the input is masked rather than echoed, and the answer is
26
+ * never trimmed or printed back in any re-ask/validation feedback.
27
+ */
28
+ sensitive?: boolean;
29
+ }
@@ -1 +1,2 @@
1
+ export * from "./command-parameter.options";
1
2
  export * from "./console-readline.options";
@@ -0,0 +1,24 @@
1
+ import { CommandInterface } from "../interfaces/command.interface";
2
+ import { CommandOptionsResolver } from "./command-options-resolver";
3
+ /**
4
+ * Maps a command's raw parsed arguments onto a typed, validated instance of its
5
+ * `optionsType`. Used by both the one-shot dispatch path (`CliEventHandler.resolveArgs`)
6
+ * and the interactive REPL (which dispatches via that same handler), so command
7
+ * arguments are resolved through identical logic everywhere.
8
+ *
9
+ * Thin wrapper over `CommandOptionsResolver`: it passes the raw argv straight through for
10
+ * commands that opt out of typed options (`optionsType === null`) and otherwise delegates
11
+ * the prompt → map → validate pipeline. Commands (or dynamic flows) that need to fill an
12
+ * options class directly can inject `CommandOptionsResolver` instead.
13
+ */
14
+ export declare class CommandArgumentResolver {
15
+ private readonly commandOptionsResolver;
16
+ constructor(commandOptionsResolver: CommandOptionsResolver);
17
+ /**
18
+ * For commands that opt out of typed options (`optionsType === null`), passes the raw
19
+ * args through unchanged. Otherwise delegates to `CommandOptionsResolver`, which fills any
20
+ * missing `@commandParameter` values by prompting, maps the result onto `optionsType`, and
21
+ * validates it.
22
+ */
23
+ resolve(command: CommandInterface<any>, rawArgs: any): Promise<any>;
24
+ }
@@ -0,0 +1,35 @@
1
+ import { ClassConstructor } from "class-transformer";
2
+ import { Validator } from "@pristine-ts/class-validator";
3
+ import { DataMapper } from "@pristine-ts/data-mapping";
4
+ import { CommandParameterPrompter } from "./command-parameter-prompter";
5
+ /**
6
+ * Resolves a typed, validated options instance from raw arguments: it fills any missing
7
+ * `@commandParameter` values by prompting, maps the result onto a real `optionsType`
8
+ * instance (prototype + decorator metadata intact, so `class-validator` finds its rules),
9
+ * and validates it.
10
+ *
11
+ * This is the reusable core behind command dispatch — `CommandArgumentResolver` delegates
12
+ * here — exposed so commands and dynamic flows can fill an options class from prompts on
13
+ * demand, including ones not tied to a registered command:
14
+ *
15
+ * ```ts
16
+ * constructor(private readonly optionsResolver: CommandOptionsResolver) {}
17
+ * // ...later, possibly choosing the class at runtime:
18
+ * const options = await this.optionsResolver.resolve(MyOptions, {region: "us"});
19
+ * ```
20
+ *
21
+ * Throws `UsageError` for mapping failures and `ValidationError` for validation failures —
22
+ * both carry structured `details` for `CliErrorReporter`.
23
+ */
24
+ export declare class CommandOptionsResolver {
25
+ private readonly validator;
26
+ private readonly dataMapper;
27
+ private readonly commandParameterPrompter;
28
+ constructor(validator: Validator, dataMapper: DataMapper, commandParameterPrompter: CommandParameterPrompter);
29
+ /**
30
+ * Prompts for any missing parameters declared on `optionsType`, then maps `rawArgs` (plus
31
+ * the prompted answers) onto a real instance and validates it. `rawArgs` seeds the values
32
+ * already known — anything absent that carries a `question` is asked for interactively.
33
+ */
34
+ resolve<T>(optionsType: ClassConstructor<T>, rawArgs?: Record<string, any>): Promise<T>;
35
+ }
@@ -0,0 +1,113 @@
1
+ import "reflect-metadata";
2
+ import { ClassConstructor } from "class-transformer";
3
+ import { Validator } from "@pristine-ts/class-validator";
4
+ import { DataMapper } from "@pristine-ts/data-mapping";
5
+ import { CliPrompt } from "../managers/cli-prompt.manager";
6
+ import { CliOutput } from "../managers/cli-output.manager";
7
+ /**
8
+ * Applies a command's `@commandParameter` metadata to its raw, parsed arguments before they
9
+ * are mapped onto the options instance and validated. Two things happen here:
10
+ *
11
+ * 1. **Flag binding** — a parameter whose `flag` differs from its property name is copied
12
+ * from the flag key onto the property key, so the by-property-name data mapper picks it
13
+ * up. Two parameters resolving to the same flag is a programming error and throws.
14
+ * 2. **Interactive fill** — a parameter that is absent and declares a `question` is asked
15
+ * for interactively. Answers are rendered and checked against the property's declared
16
+ * type (booleans as `(y/n)`, enum-constrained values list their choices) and coerced +
17
+ * validated through the same mapper/validator the command pipeline uses, re-asking on an
18
+ * invalid answer. Gated by the `InteractiveParameters` configuration and only run against
19
+ * an interactive terminal; otherwise the absent value is left for validation to report.
20
+ *
21
+ * Parameters without a `@commandParameter` decorator are untouched, so commands that don't
22
+ * use it pay nothing.
23
+ */
24
+ export declare class CommandParameterPrompter {
25
+ private readonly cliPrompt;
26
+ private readonly cliOutput;
27
+ private readonly validator;
28
+ private readonly dataMapper;
29
+ private readonly interactiveParametersEnabled;
30
+ /**
31
+ * `@pristine-ts/class-validator` stores its instantiated validators (one per `@IsX`
32
+ * decorator) as an array under this property-metadata key. We read it only to surface enum
33
+ * choices in the prompt; all actual validation goes through `Validator`.
34
+ */
35
+ private static readonly ClassValidatorMetadataKey;
36
+ /**
37
+ * How many times a single value is re-asked before giving up and letting the missing /
38
+ * invalid value fall through to the normal validation error. A bound (rather than an
39
+ * unbounded loop) keeps a misconfigured validator that can never pass from hanging the CLI.
40
+ */
41
+ private static readonly MaxAttempts;
42
+ constructor(cliPrompt: CliPrompt, cliOutput: CliOutput, validator: Validator, dataMapper: DataMapper, interactiveParametersEnabled: boolean);
43
+ /**
44
+ * Returns a copy of `rawArgs` with aliased flags bound to their property and any missing,
45
+ * question-carrying parameters filled in interactively. The input object is never mutated
46
+ * — the original command event payload stays intact.
47
+ */
48
+ fillMissingParameters(optionsType: ClassConstructor<any>, rawArgs: Record<string, any>): Promise<Record<string, any>>;
49
+ /**
50
+ * Reads every `@commandParameter` off `optionsType`, resolving each to its effective flag
51
+ * and detecting two parameters that would claim the same flag (a programming error).
52
+ * @private
53
+ */
54
+ private collectParameters;
55
+ /**
56
+ * Asks for a single parameter's value, rendering and validating it according to the
57
+ * property's declared type:
58
+ *
59
+ * - sensitive values are read with the input masked and never trimmed;
60
+ * - booleans render as `(y/n)` and accept y/yes/true/1 & n/no/false/0;
61
+ * - enum-constrained values (`@IsIn` / `@IsEnum`) list their choices;
62
+ * - every other answer is coerced (via the data mapper) and validated (via the validator)
63
+ * exactly as a typed flag would be, re-asking with the real constraint message when it
64
+ * doesn't pass.
65
+ *
66
+ * Returns the coerced value, or `undefined` when the user enters nothing or the attempt
67
+ * budget is exhausted — in which case the absent value falls through to validation.
68
+ * @private
69
+ */
70
+ private promptForValue;
71
+ /**
72
+ * Maps a single raw answer onto a probe instance of `optionsType` and validates just that
73
+ * property, returning the coerced value when it passes or the constraint messages when it
74
+ * doesn't. Reuses the same mapper + validator the command pipeline uses, so coercion and
75
+ * constraints behave identically whether a value was typed as a flag or answered here.
76
+ * @private
77
+ */
78
+ private coerceAndValidate;
79
+ /**
80
+ * Flattens `class-validator`'s per-property constraint objects into plain, user-facing
81
+ * lines. `@pristine-ts/class-validator` stores each constraint as `{keyname, message}`
82
+ * rather than a bare string, so prefer `.message`, falling back so we never print
83
+ * `[object Object]`.
84
+ * @private
85
+ */
86
+ private describeErrors;
87
+ /**
88
+ * The allowed values declared by an `@IsIn([...])` or `@IsEnum(Enum)` on the property, for
89
+ * display in the prompt. Reads `@pristine-ts/class-validator`'s stored validator instances
90
+ * defensively — any shape mismatch just yields no menu (validation still rejects bad input
91
+ * and re-asks). Returns undefined when the property isn't enum-constrained.
92
+ * @private
93
+ */
94
+ private getChoices;
95
+ /**
96
+ * Appends a type hint to the question: `(y/n)` for booleans, `(a/b/c)` for enum choices.
97
+ * @private
98
+ */
99
+ private decorateQuestion;
100
+ /**
101
+ * Whether stdin is an interactive terminal. Pulled out so the gate is easy to reason about
102
+ * (and to stub in tests) — there is no point asking a question when input is piped or runs
103
+ * under CI, where a read would either hang or return EOF.
104
+ * @private
105
+ */
106
+ private isInputInteractive;
107
+ /**
108
+ * Ensures the rendered question ends with a trailing space so the typed answer doesn't butt
109
+ * up against the prompt text.
110
+ * @private
111
+ */
112
+ private formatQuestion;
113
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./command-argument-resolver";
2
+ export * from "./command-options-resolver";
3
+ export * from "./command-parameter-prompter";
@@ -0,0 +1,10 @@
1
+ import { EventResponse } from "@pristine-ts/core";
2
+ import { ExitCode } from "@pristine-ts/common";
3
+ import { StartReplEventPayload } from "../event-payloads/start-repl.event-payload";
4
+ /**
5
+ * The response shape produced by `ReplStartEventHandler` when the interactive session
6
+ * ends (`/exit` or EOF). Carries the exit code the bin should pass to `process.exit`,
7
+ * surfaced through `ReplStartEventMapper.reverseMap`.
8
+ */
9
+ export declare class StartReplEventResponse extends EventResponse<StartReplEventPayload, ExitCode | number> {
10
+ }
@@ -1,2 +1,3 @@
1
1
  export * from "./command-event.type";
2
2
  export * from "./command-event-response.type";
3
+ export * from "./start-repl-event-response.type";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Interprets a free-text answer as a boolean the way traditional CLIs do — accepting
3
+ * `y`/`yes`/`true`/`1` and `n`/`no`/`false`/`0` (case-insensitive, surrounding whitespace
4
+ * ignored). Returns `undefined` for anything unrecognized so callers can re-ask.
5
+ *
6
+ * Shared by `CliPrompt.confirm` (yes/no prompts) and `CommandParameterPrompter` (typed
7
+ * boolean parameters) so both accept exactly the same set of answers.
8
+ */
9
+ export declare class BooleanAnswerParser {
10
+ static parse(raw: string): boolean | undefined;
11
+ }