@pristine-ts/cli 2.0.6 → 2.0.16

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 (342) hide show
  1. package/dist/lib/cjs/bin.js +0 -0
  2. package/dist/lib/cjs/bootstrap/app-module-cache.js +71 -0
  3. package/dist/lib/cjs/bootstrap/app-module-cache.js.map +1 -0
  4. package/dist/lib/cjs/bootstrap/app-module-discoverer.js +119 -0
  5. package/dist/lib/cjs/bootstrap/app-module-discoverer.js.map +1 -0
  6. package/dist/lib/cjs/bootstrap/app-module-discovery-candidate.js +21 -0
  7. package/dist/lib/cjs/bootstrap/app-module-discovery-candidate.js.map +1 -0
  8. package/dist/lib/cjs/bootstrap/app-module-discovery-reason.enum.js +15 -0
  9. package/dist/lib/cjs/bootstrap/app-module-discovery-reason.enum.js.map +1 -0
  10. package/dist/lib/cjs/bootstrap/app-module-prompt.js +78 -0
  11. package/dist/lib/cjs/bootstrap/app-module-prompt.js.map +1 -0
  12. package/dist/lib/cjs/bootstrap/build-runner.js +1 -1
  13. package/dist/lib/cjs/bootstrap/build-staleness-prompt.js +12 -13
  14. package/dist/lib/cjs/bootstrap/build-staleness-prompt.js.map +1 -1
  15. package/dist/lib/cjs/bootstrap/init-prompt.js +16 -47
  16. package/dist/lib/cjs/bootstrap/init-prompt.js.map +1 -1
  17. package/dist/lib/cjs/cli.configuration-keys.js +24 -0
  18. package/dist/lib/cjs/cli.configuration-keys.js.map +1 -0
  19. package/dist/lib/cjs/cli.js +23 -10
  20. package/dist/lib/cjs/cli.js.map +1 -1
  21. package/dist/lib/cjs/cli.module.js +41 -8
  22. package/dist/lib/cjs/cli.module.js.map +1 -1
  23. package/dist/lib/cjs/commands/build.command.js +15 -14
  24. package/dist/lib/cjs/commands/build.command.js.map +1 -1
  25. package/dist/lib/cjs/commands/commands.js +6 -0
  26. package/dist/lib/cjs/commands/commands.js.map +1 -1
  27. package/dist/lib/cjs/commands/config-init.command.js +133 -0
  28. package/dist/lib/cjs/commands/config-init.command.js.map +1 -0
  29. package/dist/lib/cjs/commands/config-print.command.js +16 -11
  30. package/dist/lib/cjs/commands/config-print.command.js.map +1 -1
  31. package/dist/lib/cjs/commands/help.command.js +17 -17
  32. package/dist/lib/cjs/commands/help.command.js.map +1 -1
  33. package/dist/lib/cjs/commands/info.command.js +26 -21
  34. package/dist/lib/cjs/commands/info.command.js.map +1 -1
  35. package/dist/lib/cjs/commands/init.command.js +22 -21
  36. package/dist/lib/cjs/commands/init.command.js.map +1 -1
  37. package/dist/lib/cjs/commands/list.command.js +6 -6
  38. package/dist/lib/cjs/commands/list.command.js.map +1 -1
  39. package/dist/lib/cjs/commands/logs-alias.command.js +49 -0
  40. package/dist/lib/cjs/commands/logs-alias.command.js.map +1 -0
  41. package/dist/lib/cjs/commands/logs.command-options.js +72 -0
  42. package/dist/lib/cjs/commands/logs.command-options.js.map +1 -0
  43. package/dist/lib/cjs/commands/logs.command.js +102 -0
  44. package/dist/lib/cjs/commands/logs.command.js.map +1 -0
  45. package/dist/lib/cjs/commands/requests-alias.command.js +49 -0
  46. package/dist/lib/cjs/commands/requests-alias.command.js.map +1 -0
  47. package/dist/lib/cjs/commands/requests.command-options.js +26 -0
  48. package/dist/lib/cjs/commands/requests.command-options.js.map +1 -0
  49. package/dist/lib/cjs/commands/requests.command.js +88 -0
  50. package/dist/lib/cjs/commands/requests.command.js.map +1 -0
  51. package/dist/lib/cjs/commands/start.command.js +12 -13
  52. package/dist/lib/cjs/commands/start.command.js.map +1 -1
  53. package/dist/lib/cjs/commands/trace-alias.command.js +49 -0
  54. package/dist/lib/cjs/commands/trace-alias.command.js.map +1 -0
  55. package/dist/lib/cjs/commands/trace.command-options.js +59 -0
  56. package/dist/lib/cjs/commands/trace.command-options.js.map +1 -0
  57. package/dist/lib/cjs/commands/trace.command.js +84 -0
  58. package/dist/lib/cjs/commands/trace.command.js.map +1 -0
  59. package/dist/lib/cjs/config/config-loader.js +34 -13
  60. package/dist/lib/cjs/config/config-loader.js.map +1 -1
  61. package/dist/lib/cjs/decorators/command-parameter.decorator.js +40 -0
  62. package/dist/lib/cjs/decorators/command-parameter.decorator.js.map +1 -0
  63. package/dist/lib/cjs/decorators/decorators.js +18 -0
  64. package/dist/lib/cjs/decorators/decorators.js.map +1 -0
  65. package/dist/lib/cjs/enums/cli-decorator-metadata-keyname.enum.js +14 -0
  66. package/dist/lib/cjs/enums/cli-decorator-metadata-keyname.enum.js.map +1 -0
  67. package/dist/lib/cjs/enums/enums.js +19 -0
  68. package/dist/lib/cjs/enums/enums.js.map +1 -0
  69. package/dist/lib/cjs/enums/exit-code.enum.js +9 -0
  70. package/dist/lib/cjs/enums/exit-code.enum.js.map +1 -0
  71. package/dist/lib/cjs/enums/terminal-key-name.enum.js +21 -0
  72. package/dist/lib/cjs/enums/terminal-key-name.enum.js.map +1 -0
  73. package/dist/lib/cjs/errors/cli-error-code.enum.js +11 -1
  74. package/dist/lib/cjs/errors/cli-error-code.enum.js.map +1 -1
  75. package/dist/lib/cjs/errors/errors.js +1 -0
  76. package/dist/lib/cjs/errors/errors.js.map +1 -1
  77. package/dist/lib/cjs/errors/prompt-cancelled.error.js +25 -0
  78. package/dist/lib/cjs/errors/prompt-cancelled.error.js.map +1 -0
  79. package/dist/lib/cjs/event-handlers/cli.event-handler.js +28 -70
  80. package/dist/lib/cjs/event-handlers/cli.event-handler.js.map +1 -1
  81. package/dist/lib/cjs/event-handlers/event-handlers.js +1 -0
  82. package/dist/lib/cjs/event-handlers/event-handlers.js.map +1 -1
  83. package/dist/lib/cjs/event-handlers/repl-start.event-handler.js +280 -0
  84. package/dist/lib/cjs/event-handlers/repl-start.event-handler.js.map +1 -0
  85. package/dist/lib/cjs/event-payloads/event-payloads.js +1 -0
  86. package/dist/lib/cjs/event-payloads/event-payloads.js.map +1 -1
  87. package/dist/lib/cjs/event-payloads/start-repl.event-payload.js +19 -0
  88. package/dist/lib/cjs/event-payloads/start-repl.event-payload.js.map +1 -0
  89. package/dist/lib/cjs/interfaces/interfaces.js +1 -0
  90. package/dist/lib/cjs/interfaces/interfaces.js.map +1 -1
  91. package/dist/lib/cjs/interfaces/terminal-key.interface.js +3 -0
  92. package/dist/lib/cjs/interfaces/terminal-key.interface.js.map +1 -0
  93. package/dist/lib/cjs/managers/cli-output.manager.js +45 -0
  94. package/dist/lib/cjs/managers/cli-output.manager.js.map +1 -0
  95. package/dist/lib/cjs/managers/cli-progress-bar.manager.js +49 -0
  96. package/dist/lib/cjs/managers/cli-progress-bar.manager.js.map +1 -0
  97. package/dist/lib/cjs/managers/cli-prompt.manager.js +265 -0
  98. package/dist/lib/cjs/managers/cli-prompt.manager.js.map +1 -0
  99. package/dist/lib/cjs/managers/cli-spinner.manager.js +93 -0
  100. package/dist/lib/cjs/managers/cli-spinner.manager.js.map +1 -0
  101. package/dist/lib/cjs/managers/managers.js +5 -1
  102. package/dist/lib/cjs/managers/managers.js.map +1 -1
  103. package/dist/lib/cjs/managers/repl-session.js +251 -0
  104. package/dist/lib/cjs/managers/repl-session.js.map +1 -0
  105. package/dist/lib/cjs/managers/shell.manager.js +25 -20
  106. package/dist/lib/cjs/managers/shell.manager.js.map +1 -1
  107. package/dist/lib/cjs/managers/terminal-key-reader.manager.js +99 -0
  108. package/dist/lib/cjs/managers/terminal-key-reader.manager.js.map +1 -0
  109. package/dist/lib/cjs/mappers/command-event.mapper.js +48 -8
  110. package/dist/lib/cjs/mappers/command-event.mapper.js.map +1 -1
  111. package/dist/lib/cjs/mappers/mappers.js +1 -0
  112. package/dist/lib/cjs/mappers/mappers.js.map +1 -1
  113. package/dist/lib/cjs/mappers/repl-start-event.mapper.js +80 -0
  114. package/dist/lib/cjs/mappers/repl-start-event.mapper.js.map +1 -0
  115. package/dist/lib/cjs/options/command-parameter.options.js +3 -0
  116. package/dist/lib/cjs/options/command-parameter.options.js.map +1 -0
  117. package/dist/lib/cjs/options/options.js +1 -0
  118. package/dist/lib/cjs/options/options.js.map +1 -1
  119. package/dist/lib/cjs/services/command-argument-resolver.js +62 -0
  120. package/dist/lib/cjs/services/command-argument-resolver.js.map +1 -0
  121. package/dist/lib/cjs/services/command-options-resolver.js +114 -0
  122. package/dist/lib/cjs/services/command-options-resolver.js.map +1 -0
  123. package/dist/lib/cjs/services/command-parameter-prompter.js +311 -0
  124. package/dist/lib/cjs/services/command-parameter-prompter.js.map +1 -0
  125. package/dist/lib/cjs/services/services.js +20 -0
  126. package/dist/lib/cjs/services/services.js.map +1 -0
  127. package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  128. package/dist/lib/cjs/types/start-repl-event-response.type.js +13 -0
  129. package/dist/lib/cjs/types/start-repl-event-response.type.js.map +1 -0
  130. package/dist/lib/cjs/types/types.js +1 -0
  131. package/dist/lib/cjs/types/types.js.map +1 -1
  132. package/dist/lib/cjs/utils/boolean-answer-parser.js +25 -0
  133. package/dist/lib/cjs/utils/boolean-answer-parser.js.map +1 -0
  134. package/dist/lib/cjs/utils/pristine-argv.js +87 -0
  135. package/dist/lib/cjs/utils/pristine-argv.js.map +1 -0
  136. package/dist/lib/cjs/utils/terminal-key-decoder.js +71 -0
  137. package/dist/lib/cjs/utils/terminal-key-decoder.js.map +1 -0
  138. package/dist/lib/esm/bootstrap/app-module-cache.js +65 -0
  139. package/dist/lib/esm/bootstrap/app-module-cache.js.map +1 -0
  140. package/dist/lib/esm/bootstrap/app-module-discoverer.js +113 -0
  141. package/dist/lib/esm/bootstrap/app-module-discoverer.js.map +1 -0
  142. package/dist/lib/esm/bootstrap/app-module-discovery-candidate.js +17 -0
  143. package/dist/lib/esm/bootstrap/app-module-discovery-candidate.js.map +1 -0
  144. package/dist/lib/esm/bootstrap/app-module-discovery-reason.enum.js +12 -0
  145. package/dist/lib/esm/bootstrap/app-module-discovery-reason.enum.js.map +1 -0
  146. package/dist/lib/esm/bootstrap/app-module-prompt.js +75 -0
  147. package/dist/lib/esm/bootstrap/app-module-prompt.js.map +1 -0
  148. package/dist/lib/esm/bootstrap/build-runner.js +1 -1
  149. package/dist/lib/esm/bootstrap/build-staleness-prompt.js +12 -13
  150. package/dist/lib/esm/bootstrap/build-staleness-prompt.js.map +1 -1
  151. package/dist/lib/esm/bootstrap/init-prompt.js +16 -47
  152. package/dist/lib/esm/bootstrap/init-prompt.js.map +1 -1
  153. package/dist/lib/esm/cli.configuration-keys.js +21 -0
  154. package/dist/lib/esm/cli.configuration-keys.js.map +1 -0
  155. package/dist/lib/esm/cli.js +23 -10
  156. package/dist/lib/esm/cli.js.map +1 -1
  157. package/dist/lib/esm/cli.module.js +41 -8
  158. package/dist/lib/esm/cli.module.js.map +1 -1
  159. package/dist/lib/esm/commands/build.command.js +16 -15
  160. package/dist/lib/esm/commands/build.command.js.map +1 -1
  161. package/dist/lib/esm/commands/commands.js +6 -0
  162. package/dist/lib/esm/commands/commands.js.map +1 -1
  163. package/dist/lib/esm/commands/config-init.command.js +127 -0
  164. package/dist/lib/esm/commands/config-init.command.js.map +1 -0
  165. package/dist/lib/esm/commands/config-print.command.js +16 -11
  166. package/dist/lib/esm/commands/config-print.command.js.map +1 -1
  167. package/dist/lib/esm/commands/help.command.js +17 -17
  168. package/dist/lib/esm/commands/help.command.js.map +1 -1
  169. package/dist/lib/esm/commands/info.command.js +27 -22
  170. package/dist/lib/esm/commands/info.command.js.map +1 -1
  171. package/dist/lib/esm/commands/init.command.js +23 -22
  172. package/dist/lib/esm/commands/init.command.js.map +1 -1
  173. package/dist/lib/esm/commands/list.command.js +6 -6
  174. package/dist/lib/esm/commands/list.command.js.map +1 -1
  175. package/dist/lib/esm/commands/logs-alias.command.js +46 -0
  176. package/dist/lib/esm/commands/logs-alias.command.js.map +1 -0
  177. package/dist/lib/esm/commands/logs.command-options.js +68 -0
  178. package/dist/lib/esm/commands/logs.command-options.js.map +1 -0
  179. package/dist/lib/esm/commands/logs.command.js +99 -0
  180. package/dist/lib/esm/commands/logs.command.js.map +1 -0
  181. package/dist/lib/esm/commands/requests-alias.command.js +46 -0
  182. package/dist/lib/esm/commands/requests-alias.command.js.map +1 -0
  183. package/dist/lib/esm/commands/requests.command-options.js +22 -0
  184. package/dist/lib/esm/commands/requests.command-options.js.map +1 -0
  185. package/dist/lib/esm/commands/requests.command.js +85 -0
  186. package/dist/lib/esm/commands/requests.command.js.map +1 -0
  187. package/dist/lib/esm/commands/start.command.js +13 -14
  188. package/dist/lib/esm/commands/start.command.js.map +1 -1
  189. package/dist/lib/esm/commands/trace-alias.command.js +46 -0
  190. package/dist/lib/esm/commands/trace-alias.command.js.map +1 -0
  191. package/dist/lib/esm/commands/trace.command-options.js +55 -0
  192. package/dist/lib/esm/commands/trace.command-options.js.map +1 -0
  193. package/dist/lib/esm/commands/trace.command.js +81 -0
  194. package/dist/lib/esm/commands/trace.command.js.map +1 -0
  195. package/dist/lib/esm/config/config-loader.js +34 -13
  196. package/dist/lib/esm/config/config-loader.js.map +1 -1
  197. package/dist/lib/esm/decorators/command-parameter.decorator.js +36 -0
  198. package/dist/lib/esm/decorators/command-parameter.decorator.js.map +1 -0
  199. package/dist/lib/esm/decorators/decorators.js +2 -0
  200. package/dist/lib/esm/decorators/decorators.js.map +1 -0
  201. package/dist/lib/esm/enums/cli-decorator-metadata-keyname.enum.js +11 -0
  202. package/dist/lib/esm/enums/cli-decorator-metadata-keyname.enum.js.map +1 -0
  203. package/dist/lib/esm/enums/enums.js +3 -0
  204. package/dist/lib/esm/enums/enums.js.map +1 -0
  205. package/dist/lib/esm/enums/exit-code.enum.js +6 -0
  206. package/dist/lib/esm/enums/exit-code.enum.js.map +1 -0
  207. package/dist/lib/esm/enums/terminal-key-name.enum.js +18 -0
  208. package/dist/lib/esm/enums/terminal-key-name.enum.js.map +1 -0
  209. package/dist/lib/esm/errors/cli-error-code.enum.js +11 -1
  210. package/dist/lib/esm/errors/cli-error-code.enum.js.map +1 -1
  211. package/dist/lib/esm/errors/errors.js +1 -0
  212. package/dist/lib/esm/errors/errors.js.map +1 -1
  213. package/dist/lib/esm/errors/prompt-cancelled.error.js +21 -0
  214. package/dist/lib/esm/errors/prompt-cancelled.error.js.map +1 -0
  215. package/dist/lib/esm/event-handlers/cli.event-handler.js +29 -71
  216. package/dist/lib/esm/event-handlers/cli.event-handler.js.map +1 -1
  217. package/dist/lib/esm/event-handlers/event-handlers.js +1 -0
  218. package/dist/lib/esm/event-handlers/event-handlers.js.map +1 -1
  219. package/dist/lib/esm/event-handlers/repl-start.event-handler.js +244 -0
  220. package/dist/lib/esm/event-handlers/repl-start.event-handler.js.map +1 -0
  221. package/dist/lib/esm/event-payloads/event-payloads.js +1 -0
  222. package/dist/lib/esm/event-payloads/event-payloads.js.map +1 -1
  223. package/dist/lib/esm/event-payloads/start-repl.event-payload.js +15 -0
  224. package/dist/lib/esm/event-payloads/start-repl.event-payload.js.map +1 -0
  225. package/dist/lib/esm/interfaces/interfaces.js +1 -0
  226. package/dist/lib/esm/interfaces/interfaces.js.map +1 -1
  227. package/dist/lib/esm/interfaces/terminal-key.interface.js +2 -0
  228. package/dist/lib/esm/interfaces/terminal-key.interface.js.map +1 -0
  229. package/dist/lib/esm/managers/cli-output.manager.js +42 -0
  230. package/dist/lib/esm/managers/cli-output.manager.js.map +1 -0
  231. package/dist/lib/esm/managers/cli-progress-bar.manager.js +46 -0
  232. package/dist/lib/esm/managers/cli-progress-bar.manager.js.map +1 -0
  233. package/dist/lib/esm/managers/cli-prompt.manager.js +229 -0
  234. package/dist/lib/esm/managers/cli-prompt.manager.js.map +1 -0
  235. package/dist/lib/esm/managers/cli-spinner.manager.js +90 -0
  236. package/dist/lib/esm/managers/cli-spinner.manager.js.map +1 -0
  237. package/dist/lib/esm/managers/managers.js +5 -1
  238. package/dist/lib/esm/managers/managers.js.map +1 -1
  239. package/dist/lib/esm/managers/repl-session.js +215 -0
  240. package/dist/lib/esm/managers/repl-session.js.map +1 -0
  241. package/dist/lib/esm/managers/shell.manager.js +26 -21
  242. package/dist/lib/esm/managers/shell.manager.js.map +1 -1
  243. package/dist/lib/esm/managers/terminal-key-reader.manager.js +96 -0
  244. package/dist/lib/esm/managers/terminal-key-reader.manager.js.map +1 -0
  245. package/dist/lib/esm/mappers/command-event.mapper.js +49 -9
  246. package/dist/lib/esm/mappers/command-event.mapper.js.map +1 -1
  247. package/dist/lib/esm/mappers/mappers.js +1 -0
  248. package/dist/lib/esm/mappers/mappers.js.map +1 -1
  249. package/dist/lib/esm/mappers/repl-start-event.mapper.js +77 -0
  250. package/dist/lib/esm/mappers/repl-start-event.mapper.js.map +1 -0
  251. package/dist/lib/esm/options/command-parameter.options.js +2 -0
  252. package/dist/lib/esm/options/command-parameter.options.js.map +1 -0
  253. package/dist/lib/esm/options/options.js +1 -0
  254. package/dist/lib/esm/options/options.js.map +1 -1
  255. package/dist/lib/esm/services/command-argument-resolver.js +59 -0
  256. package/dist/lib/esm/services/command-argument-resolver.js.map +1 -0
  257. package/dist/lib/esm/services/command-options-resolver.js +111 -0
  258. package/dist/lib/esm/services/command-options-resolver.js.map +1 -0
  259. package/dist/lib/esm/services/command-parameter-prompter.js +308 -0
  260. package/dist/lib/esm/services/command-parameter-prompter.js.map +1 -0
  261. package/dist/lib/esm/services/services.js +4 -0
  262. package/dist/lib/esm/services/services.js.map +1 -0
  263. package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
  264. package/dist/lib/esm/types/start-repl-event-response.type.js +9 -0
  265. package/dist/lib/esm/types/start-repl-event-response.type.js.map +1 -0
  266. package/dist/lib/esm/types/types.js +1 -0
  267. package/dist/lib/esm/types/types.js.map +1 -1
  268. package/dist/lib/esm/utils/boolean-answer-parser.js +21 -0
  269. package/dist/lib/esm/utils/boolean-answer-parser.js.map +1 -0
  270. package/dist/lib/esm/utils/pristine-argv.js +50 -0
  271. package/dist/lib/esm/utils/pristine-argv.js.map +1 -0
  272. package/dist/lib/esm/utils/terminal-key-decoder.js +67 -0
  273. package/dist/lib/esm/utils/terminal-key-decoder.js.map +1 -0
  274. package/dist/types/bootstrap/app-module-cache.d.ts +15 -0
  275. package/dist/types/bootstrap/app-module-discoverer.d.ts +30 -0
  276. package/dist/types/bootstrap/app-module-discovery-candidate.d.ts +18 -0
  277. package/dist/types/bootstrap/app-module-discovery-reason.enum.d.ts +10 -0
  278. package/dist/types/bootstrap/app-module-prompt.d.ts +20 -0
  279. package/dist/types/bootstrap/build-runner.d.ts +1 -1
  280. package/dist/types/bootstrap/build-staleness-prompt.d.ts +3 -3
  281. package/dist/types/bootstrap/init-prompt.d.ts +5 -5
  282. package/dist/types/cli.configuration-keys.d.ts +32 -0
  283. package/dist/types/cli.d.ts +8 -4
  284. package/dist/types/cli.module.d.ts +4 -0
  285. package/dist/types/commands/build.command.d.ts +3 -3
  286. package/dist/types/commands/commands.d.ts +6 -0
  287. package/dist/types/commands/config-init.command.d.ts +18 -0
  288. package/dist/types/commands/config-print.command.d.ts +8 -3
  289. package/dist/types/commands/help.command.d.ts +3 -3
  290. package/dist/types/commands/info.command.d.ts +5 -3
  291. package/dist/types/commands/init.command.d.ts +3 -3
  292. package/dist/types/commands/list.command.d.ts +3 -3
  293. package/dist/types/commands/logs-alias.command.d.ts +14 -0
  294. package/dist/types/commands/logs.command-options.d.ts +38 -0
  295. package/dist/types/commands/logs.command.d.ts +31 -0
  296. package/dist/types/commands/requests-alias.command.d.ts +14 -0
  297. package/dist/types/commands/requests.command-options.d.ts +8 -0
  298. package/dist/types/commands/requests.command.d.ts +25 -0
  299. package/dist/types/commands/start.command.d.ts +3 -3
  300. package/dist/types/commands/trace-alias.command.d.ts +14 -0
  301. package/dist/types/commands/trace.command-options.d.ts +31 -0
  302. package/dist/types/commands/trace.command.d.ts +21 -0
  303. package/dist/types/config/config-loader.d.ts +15 -3
  304. package/dist/types/decorators/command-parameter.decorator.d.ts +30 -0
  305. package/dist/types/decorators/decorators.d.ts +1 -0
  306. package/dist/types/enums/cli-decorator-metadata-keyname.enum.d.ts +9 -0
  307. package/dist/types/enums/enums.d.ts +2 -0
  308. package/dist/types/enums/exit-code.enum.d.ts +4 -0
  309. package/dist/types/enums/terminal-key-name.enum.d.ts +16 -0
  310. package/dist/types/errors/cli-error-code.enum.d.ts +12 -2
  311. package/dist/types/errors/errors.d.ts +1 -0
  312. package/dist/types/errors/prompt-cancelled.error.d.ts +13 -0
  313. package/dist/types/event-handlers/cli.event-handler.d.ts +16 -15
  314. package/dist/types/event-handlers/event-handlers.d.ts +1 -0
  315. package/dist/types/event-handlers/repl-start.event-handler.d.ts +70 -0
  316. package/dist/types/event-payloads/event-payloads.d.ts +1 -0
  317. package/dist/types/event-payloads/start-repl.event-payload.d.ts +13 -0
  318. package/dist/types/interfaces/interfaces.d.ts +1 -0
  319. package/dist/types/interfaces/terminal-key.interface.d.ts +11 -0
  320. package/dist/types/managers/cli-output.manager.d.ts +21 -0
  321. package/dist/types/managers/cli-progress-bar.manager.d.ts +17 -0
  322. package/dist/types/managers/cli-prompt.manager.d.ts +79 -0
  323. package/dist/types/managers/cli-spinner.manager.d.ts +34 -0
  324. package/dist/types/managers/managers.d.ts +5 -1
  325. package/dist/types/managers/repl-session.d.ts +62 -0
  326. package/dist/types/managers/shell.manager.d.ts +3 -3
  327. package/dist/types/managers/terminal-key-reader.manager.d.ts +31 -0
  328. package/dist/types/mappers/command-event.mapper.d.ts +10 -1
  329. package/dist/types/mappers/mappers.d.ts +1 -0
  330. package/dist/types/mappers/repl-start-event.mapper.d.ts +28 -0
  331. package/dist/types/options/command-parameter.options.d.ts +29 -0
  332. package/dist/types/options/options.d.ts +1 -0
  333. package/dist/types/services/command-argument-resolver.d.ts +24 -0
  334. package/dist/types/services/command-options-resolver.d.ts +35 -0
  335. package/dist/types/services/command-parameter-prompter.d.ts +113 -0
  336. package/dist/types/services/services.d.ts +3 -0
  337. package/dist/types/types/start-repl-event-response.type.d.ts +10 -0
  338. package/dist/types/types/types.d.ts +1 -0
  339. package/dist/types/utils/boolean-answer-parser.d.ts +11 -0
  340. package/dist/types/utils/pristine-argv.d.ts +33 -0
  341. package/dist/types/utils/terminal-key-decoder.d.ts +28 -0
  342. package/package.json +16 -12
@@ -0,0 +1,79 @@
1
+ import { ConsoleReadlineOptions } from "../options/console-readline.options";
2
+ import { TerminalKeyReader } from "./terminal-key-reader.manager";
3
+ /**
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.
12
+ */
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);
22
+ /**
23
+ * Reads a string from stdin synchronously. Returns whatever `process.stdin.read()`
24
+ * gives back (which may be `null` when no data is buffered).
25
+ */
26
+ read(): string;
27
+ /**
28
+ * Reads a line from stdin after displaying a prompt. When
29
+ * `options.showCharactersOnTyping` is false, the answered line is cleared and replaced
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).
32
+ *
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.
36
+ */
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;
79
+ }
@@ -0,0 +1,34 @@
1
+ import { LogHandlerInterface } from "@pristine-ts/logging";
2
+ /**
3
+ * Animated spinner for indicating long-running work in a TTY. Hides the cursor while
4
+ * spinning, redraws the current line every 80ms, and routes the completion message
5
+ * through the injected `LogHandler` so success/failure rendering matches the rest of
6
+ * the framework.
7
+ *
8
+ * Avoid emitting other output (especially LogHandler narration) while the spinner is
9
+ * active — concurrent writes will fight the spinner's line clearing and produce visual
10
+ * artifacts.
11
+ */
12
+ export declare class CliSpinner {
13
+ private readonly logHandler;
14
+ private spinnerInterval;
15
+ private isSpinning;
16
+ private static readonly FRAMES;
17
+ private static readonly FRAME_INTERVAL_MS;
18
+ private static readonly CYAN;
19
+ private static readonly RESET;
20
+ private static readonly HIDE_CURSOR;
21
+ private static readonly SHOW_CURSOR;
22
+ constructor(logHandler: LogHandlerInterface);
23
+ /**
24
+ * Starts the spinner with the given label. Subsequent calls are no-ops until `stop()`
25
+ * is invoked.
26
+ */
27
+ start(message: string): void;
28
+ /**
29
+ * Stops the spinner, restores the cursor, and optionally emits a final completion
30
+ * message. `success` controls whether the message is rendered as a success log
31
+ * (`logHandler.success`) or an error log (`logHandler.error`).
32
+ */
33
+ stop(message?: string, success?: boolean): void;
34
+ }
@@ -1,2 +1,6 @@
1
- export * from "./console.manager";
1
+ export * from "./cli-output.manager";
2
+ export * from "./cli-progress-bar.manager";
3
+ export * from "./cli-prompt.manager";
4
+ export * from "./cli-spinner.manager";
5
+ export * from "./terminal-key-reader.manager";
2
6
  export * from "./shell.manager";
@@ -0,0 +1,62 @@
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
+ }
@@ -1,12 +1,12 @@
1
1
  import { ChildProcessWithoutNullStreams } from "child_process";
2
- import { ConsoleManager } from "./console.manager";
3
2
  import { PathManager } from "@pristine-ts/core";
4
3
  import { DateUtil } from "@pristine-ts/common";
4
+ import { LogHandlerInterface } from "@pristine-ts/logging";
5
5
  export declare class ShellManager {
6
- private readonly consoleManager;
6
+ private readonly logHandler;
7
7
  private readonly pathManager;
8
8
  private readonly dateUtil;
9
- constructor(consoleManager: ConsoleManager, pathManager: PathManager, dateUtil: DateUtil);
9
+ constructor(logHandler: LogHandlerInterface, pathManager: PathManager, dateUtil: DateUtil);
10
10
  execute(command: string, options?: {
11
11
  directory?: string;
12
12
  streamStdout?: boolean;
@@ -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
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Parses an argv array — typically `process.argv` — to locate the pristine bin and
3
+ * extract the user-typed arguments that follow it.
4
+ *
5
+ * Why scan rather than positional-index: argv shape is runtime-dependent. Node and Bun
6
+ * happen to put `[executable, scriptPath, ...userArgs]` today, but a different runtime
7
+ * (or a launcher that prepends flags before the script) can violate that. Locating the
8
+ * bin by name — an element whose basename (stripped of any extension like `.cjs` /
9
+ * `.js` / `.mjs`) is `pristine` — is robust across:
10
+ *
11
+ * - global installs (`pristine repl` → argv contains `/usr/local/.../pristine.cjs`)
12
+ * - local installs (`./node_modules/.bin/pristine`)
13
+ * - `npx pristine`
14
+ * - direct `node dist/bin/pristine.cjs`
15
+ * - alternative runtimes that may shape argv differently
16
+ * - the synthetic argv the REPL handler builds for each typed line
17
+ *
18
+ * Stateless after construction; instantiate per parse.
19
+ */
20
+ export declare class PristineArgv {
21
+ private static readonly BIN_NAME;
22
+ /** The argv element identified as the pristine bin (empty when not found). */
23
+ readonly scriptPath: string;
24
+ /** Every argv element after the pristine bin, in order. */
25
+ readonly userArgs: readonly string[];
26
+ constructor(rawArgv: readonly unknown[]);
27
+ /**
28
+ * True when the argv was recognizable as a pristine invocation (the bin token was
29
+ * located). Mappers short-circuit `supportsMapping` on this.
30
+ */
31
+ get isValid(): boolean;
32
+ private static isPristineBin;
33
+ }
@@ -0,0 +1,28 @@
1
+ import { TerminalKey } from "../interfaces/terminal-key.interface";
2
+ /**
3
+ * Translates the raw bytes Node delivers from a raw-mode stdin into structured
4
+ * {@link TerminalKey}s. Pure and static so it can be unit-tested without a real TTY.
5
+ *
6
+ * A single `data` chunk can carry more than one keystroke (notably a paste, or fast
7
+ * typing), so this returns an array. Control and escape sequences are recognized as one
8
+ * key each; a run of printable characters is split into one `Character` key per character
9
+ * so callers (masked input, menus) can echo and handle them uniformly.
10
+ */
11
+ export declare class TerminalKeyDecoder {
12
+ /**
13
+ * Decodes a raw stdin chunk into the keys it represents.
14
+ *
15
+ * - A recognized control byte / escape sequence that spans the whole chunk → one key.
16
+ * - An unrecognized escape sequence (starts with ESC) → a single `Other` key, rather
17
+ * than splitting it into bogus printable characters.
18
+ * - Anything else → one key per character, with non-printable control bytes mapped to
19
+ * `Other` so they're ignored rather than echoed.
20
+ */
21
+ static decode(data: string): TerminalKey[];
22
+ /**
23
+ * Maps a single recognized control byte or escape sequence to its key, or `undefined`
24
+ * when the input isn't one we handle.
25
+ * @private
26
+ */
27
+ private static decodeControl;
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pristine-ts/cli",
3
- "version": "2.0.6",
3
+ "version": "2.0.16",
4
4
  "description": "",
5
5
  "module": "dist/lib/esm/cli.module.js",
6
6
  "main": "dist/lib/cjs/cli.module.js",
@@ -20,20 +20,24 @@
20
20
  ],
21
21
  "author": "",
22
22
  "license": "ISC",
23
+ "engines": {
24
+ "node": ">=22.18.0"
25
+ },
23
26
  "publishConfig": {
24
27
  "access": "public"
25
28
  },
26
29
  "dependencies": {
27
- "@inquirer/prompts": "^7.2.0",
28
- "@pristine-ts/common": "^2.0.6",
29
- "@pristine-ts/core": "^2.0.6",
30
- "@pristine-ts/data-mapping": "^2.0.6",
31
- "@pristine-ts/data-mapping-common": "^2.0.6",
32
- "@pristine-ts/file": "^2.0.6",
33
- "@pristine-ts/logging": "^2.0.6",
34
- "@pristine-ts/validation": "^2.0.6",
35
- "jiti": "^2.4.0",
36
- "uuid": "^9.0.1"
30
+ "@pristine-ts/common": "^2.0.16",
31
+ "@pristine-ts/configuration": "^2.0.16",
32
+ "@pristine-ts/core": "^2.0.16",
33
+ "@pristine-ts/data-mapping": "^2.0.16",
34
+ "@pristine-ts/data-mapping-common": "^2.0.16",
35
+ "@pristine-ts/file": "^2.0.16",
36
+ "@pristine-ts/logging": "^2.0.16",
37
+ "@pristine-ts/metadata": "^1.0.16",
38
+ "@pristine-ts/observability": "^2.0.16",
39
+ "@pristine-ts/telemetry": "^2.0.16",
40
+ "@pristine-ts/validation": "^2.0.16"
37
41
  },
38
42
  "devDependencies": {
39
43
  "esbuild": "^0.24.0"
@@ -72,7 +76,7 @@
72
76
  "src/*.{js,ts}"
73
77
  ]
74
78
  },
75
- "gitHead": "539029d624372f9bb1e22e09da7152eabb95c105",
79
+ "gitHead": "a55d7d59862672a8cbbca4088fed090779b37705",
76
80
  "repository": {
77
81
  "type": "git",
78
82
  "url": "https://github.com/magieno/pristine-ts.git",