@elsikora/commitizen-plugin-commitlint-ai 1.2.0 → 2.0.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (417) hide show
  1. package/README.md +256 -57
  2. package/dist/cjs/application/constant/config-file-directory.constant.d.ts +4 -0
  3. package/dist/cjs/application/constant/config-file-directory.constant.js +9 -0
  4. package/dist/cjs/application/constant/config-file-directory.constant.js.map +1 -0
  5. package/dist/cjs/application/constant/config-module-name.constant.d.ts +4 -0
  6. package/dist/cjs/application/constant/config-module-name.constant.js +9 -0
  7. package/dist/cjs/application/constant/config-module-name.constant.js.map +1 -0
  8. package/dist/cjs/application/constant/index.d.ts +2 -0
  9. package/dist/cjs/application/index.d.ts +2 -0
  10. package/dist/cjs/application/interface/cli-interface-service-select-options.interface.d.ts +21 -0
  11. package/dist/cjs/application/interface/cli-interface-service.interface.d.ts +105 -0
  12. package/dist/cjs/application/interface/command-service.interface.d.ts +19 -0
  13. package/dist/cjs/application/interface/commit-repository.interface.d.ts +32 -0
  14. package/dist/cjs/application/interface/commit-validator.interface.d.ts +29 -0
  15. package/dist/cjs/application/interface/config-service.interface.d.ts +47 -0
  16. package/dist/cjs/application/interface/config.interface.d.ts +27 -0
  17. package/dist/cjs/application/interface/file-system-service.interface.d.ts +61 -0
  18. package/dist/cjs/application/interface/index.d.ts +9 -0
  19. package/dist/cjs/application/interface/llm-service.interface.d.ts +43 -0
  20. package/dist/cjs/application/use-case/configure-llm.use-case.d.ts +39 -0
  21. package/dist/cjs/application/use-case/configure-llm.use-case.js +373 -0
  22. package/dist/cjs/application/use-case/configure-llm.use-case.js.map +1 -0
  23. package/dist/cjs/application/use-case/generate-commit-message.use-case.d.ts +18 -0
  24. package/dist/cjs/application/use-case/generate-commit-message.use-case.js +49 -0
  25. package/dist/cjs/application/use-case/generate-commit-message.use-case.js.map +1 -0
  26. package/dist/cjs/application/use-case/index.d.ts +4 -0
  27. package/dist/cjs/application/use-case/manual-commit.use-case.d.ts +16 -0
  28. package/dist/cjs/application/use-case/manual-commit.use-case.js +81 -0
  29. package/dist/cjs/application/use-case/manual-commit.use-case.js.map +1 -0
  30. package/dist/cjs/application/use-case/validate-commit-message.use-case.d.ts +26 -0
  31. package/dist/cjs/application/use-case/validate-commit-message.use-case.js +76 -0
  32. package/dist/cjs/application/use-case/validate-commit-message.use-case.js.map +1 -0
  33. package/dist/cjs/domain/constant/index.d.ts +1 -0
  34. package/dist/cjs/domain/constant/numeric.constant.d.ts +25 -0
  35. package/dist/cjs/domain/constant/numeric.constant.js +42 -0
  36. package/dist/cjs/domain/constant/numeric.constant.js.map +1 -0
  37. package/dist/cjs/domain/entity/commit-message.entity.d.ts +47 -0
  38. package/dist/cjs/domain/entity/commit-message.entity.js +71 -0
  39. package/dist/cjs/domain/entity/commit-message.entity.js.map +1 -0
  40. package/dist/cjs/domain/entity/index.d.ts +2 -0
  41. package/dist/cjs/domain/entity/llm-configuration.entity.d.ts +73 -0
  42. package/dist/cjs/domain/entity/llm-configuration.entity.js +107 -0
  43. package/dist/cjs/domain/entity/llm-configuration.entity.js.map +1 -0
  44. package/dist/cjs/domain/enum/anthropic-model.enum.d.ts +18 -0
  45. package/dist/cjs/domain/enum/anthropic-model.enum.js +26 -0
  46. package/dist/cjs/domain/enum/anthropic-model.enum.js.map +1 -0
  47. package/dist/cjs/domain/enum/aws-bedrock-model.enum.d.ts +33 -0
  48. package/dist/cjs/domain/enum/aws-bedrock-model.enum.js +47 -0
  49. package/dist/cjs/domain/enum/aws-bedrock-model.enum.js.map +1 -0
  50. package/dist/cjs/domain/enum/azure-openai-model.enum.d.ts +17 -0
  51. package/dist/cjs/domain/enum/azure-openai-model.enum.js +26 -0
  52. package/dist/cjs/domain/enum/azure-openai-model.enum.js.map +1 -0
  53. package/dist/cjs/domain/enum/commit-mode.enum.d.ts +7 -0
  54. package/dist/cjs/domain/enum/commit-mode.enum.js +11 -0
  55. package/dist/cjs/domain/enum/commit-mode.enum.js.map +1 -0
  56. package/dist/cjs/domain/enum/google-model.enum.d.ts +16 -0
  57. package/dist/cjs/domain/enum/google-model.enum.js +25 -0
  58. package/dist/cjs/domain/enum/google-model.enum.js.map +1 -0
  59. package/dist/cjs/domain/enum/index.d.ts +9 -0
  60. package/dist/cjs/domain/enum/llm-provider.enum.d.ts +11 -0
  61. package/dist/cjs/domain/enum/llm-provider.enum.js +15 -0
  62. package/dist/cjs/domain/enum/llm-provider.enum.js.map +1 -0
  63. package/dist/cjs/domain/enum/log-level.enum.d.ts +9 -0
  64. package/dist/cjs/domain/enum/log-level.enum.js +13 -0
  65. package/dist/cjs/domain/enum/log-level.enum.js.map +1 -0
  66. package/dist/cjs/domain/enum/ollama-model.enum.d.ts +24 -0
  67. package/dist/cjs/domain/enum/ollama-model.enum.js +30 -0
  68. package/dist/cjs/domain/enum/ollama-model.enum.js.map +1 -0
  69. package/dist/cjs/domain/enum/openai-model.enum.d.ts +25 -0
  70. package/dist/cjs/domain/enum/openai-model.enum.js +35 -0
  71. package/dist/cjs/domain/enum/openai-model.enum.js.map +1 -0
  72. package/dist/cjs/domain/index.d.ts +3 -0
  73. package/dist/cjs/domain/value-object/api-key.value-object.d.ts +28 -0
  74. package/dist/cjs/domain/value-object/api-key.value-object.js +51 -0
  75. package/dist/cjs/domain/value-object/api-key.value-object.js.map +1 -0
  76. package/dist/cjs/domain/value-object/commit-body.value-object.d.ts +39 -0
  77. package/dist/cjs/domain/value-object/commit-body.value-object.js +66 -0
  78. package/dist/cjs/domain/value-object/commit-body.value-object.js.map +1 -0
  79. package/dist/cjs/domain/value-object/commit-header.value-object.d.ts +35 -0
  80. package/dist/cjs/domain/value-object/commit-header.value-object.js +63 -0
  81. package/dist/cjs/domain/value-object/commit-header.value-object.js.map +1 -0
  82. package/dist/cjs/domain/value-object/index.d.ts +3 -0
  83. package/dist/cjs/index.d.ts +14 -12
  84. package/dist/cjs/index.js +85 -83
  85. package/dist/cjs/index.js.map +1 -1
  86. package/dist/cjs/infrastructure/commit-validator/commitlint-validator.service.d.ts +38 -0
  87. package/dist/cjs/infrastructure/commit-validator/commitlint-validator.service.js +207 -0
  88. package/dist/cjs/infrastructure/commit-validator/commitlint-validator.service.js.map +1 -0
  89. package/dist/cjs/infrastructure/commit-validator/index.d.ts +1 -0
  90. package/dist/cjs/infrastructure/di/container.d.ts +17 -0
  91. package/dist/cjs/infrastructure/di/container.js +76 -0
  92. package/dist/cjs/infrastructure/di/container.js.map +1 -0
  93. package/dist/cjs/infrastructure/di/index.d.ts +1 -0
  94. package/dist/cjs/infrastructure/git/git-commit.repository.d.ts +36 -0
  95. package/dist/cjs/infrastructure/git/git-commit.repository.js +78 -0
  96. package/dist/cjs/infrastructure/git/git-commit.repository.js.map +1 -0
  97. package/dist/cjs/infrastructure/git/index.d.ts +1 -0
  98. package/dist/cjs/infrastructure/index.d.ts +4 -0
  99. package/dist/cjs/infrastructure/llm/anthropic-llm.service.d.ts +39 -0
  100. package/dist/cjs/infrastructure/llm/anthropic-llm.service.js +323 -0
  101. package/dist/cjs/infrastructure/llm/anthropic-llm.service.js.map +1 -0
  102. package/dist/cjs/infrastructure/llm/aws-bedrock-llm.service.d.ts +60 -0
  103. package/dist/cjs/infrastructure/llm/aws-bedrock-llm.service.js +514 -0
  104. package/dist/cjs/infrastructure/llm/aws-bedrock-llm.service.js.map +1 -0
  105. package/dist/cjs/infrastructure/llm/azure-openai-llm.service.d.ts +45 -0
  106. package/dist/cjs/infrastructure/llm/azure-openai-llm.service.js +351 -0
  107. package/dist/cjs/infrastructure/llm/azure-openai-llm.service.js.map +1 -0
  108. package/dist/cjs/infrastructure/llm/google-llm.service.d.ts +45 -0
  109. package/dist/cjs/infrastructure/llm/google-llm.service.js +335 -0
  110. package/dist/cjs/infrastructure/llm/google-llm.service.js.map +1 -0
  111. package/dist/cjs/infrastructure/llm/index.d.ts +6 -0
  112. package/dist/cjs/infrastructure/llm/ollama-llm.service.d.ts +45 -0
  113. package/dist/cjs/infrastructure/llm/ollama-llm.service.js +387 -0
  114. package/dist/cjs/infrastructure/llm/ollama-llm.service.js.map +1 -0
  115. package/dist/cjs/infrastructure/llm/openai-llm.service.d.ts +45 -0
  116. package/dist/cjs/infrastructure/llm/openai-llm.service.js +339 -0
  117. package/dist/cjs/infrastructure/llm/openai-llm.service.js.map +1 -0
  118. package/dist/cjs/infrastructure/service/cosmic-config.service.d.ts +66 -0
  119. package/dist/cjs/infrastructure/service/cosmic-config.service.js +176 -0
  120. package/dist/cjs/infrastructure/service/cosmic-config.service.js.map +1 -0
  121. package/dist/cjs/infrastructure/service/index.d.ts +4 -0
  122. package/dist/cjs/infrastructure/service/node-command.service.d.ts +45 -0
  123. package/dist/cjs/infrastructure/service/node-command.service.js +154 -0
  124. package/dist/cjs/infrastructure/service/node-command.service.js.map +1 -0
  125. package/dist/cjs/infrastructure/service/node-file-system.service.d.ts +62 -0
  126. package/dist/cjs/infrastructure/service/node-file-system.service.js +102 -0
  127. package/dist/cjs/infrastructure/service/node-file-system.service.js.map +1 -0
  128. package/dist/cjs/infrastructure/service/prompts-cli-interface.service.d.ts +117 -0
  129. package/dist/cjs/infrastructure/service/prompts-cli-interface.service.js +318 -0
  130. package/dist/cjs/infrastructure/service/prompts-cli-interface.service.js.map +1 -0
  131. package/dist/cjs/presentation/commitizen.adapter.d.ts +28 -0
  132. package/dist/cjs/presentation/commitizen.adapter.js +304 -0
  133. package/dist/cjs/presentation/commitizen.adapter.js.map +1 -0
  134. package/dist/cjs/presentation/index.d.ts +1 -0
  135. package/dist/esm/application/constant/config-file-directory.constant.d.ts +4 -0
  136. package/dist/esm/application/constant/config-file-directory.constant.js +7 -0
  137. package/dist/esm/application/constant/config-file-directory.constant.js.map +1 -0
  138. package/dist/esm/application/constant/config-module-name.constant.d.ts +4 -0
  139. package/dist/esm/application/constant/config-module-name.constant.js +7 -0
  140. package/dist/esm/application/constant/config-module-name.constant.js.map +1 -0
  141. package/dist/esm/application/constant/index.d.ts +2 -0
  142. package/dist/esm/application/index.d.ts +2 -0
  143. package/dist/esm/application/interface/cli-interface-service-select-options.interface.d.ts +21 -0
  144. package/dist/esm/application/interface/cli-interface-service.interface.d.ts +105 -0
  145. package/dist/esm/application/interface/command-service.interface.d.ts +19 -0
  146. package/dist/esm/application/interface/commit-repository.interface.d.ts +32 -0
  147. package/dist/esm/application/interface/commit-validator.interface.d.ts +29 -0
  148. package/dist/esm/application/interface/config-service.interface.d.ts +47 -0
  149. package/dist/esm/application/interface/config.interface.d.ts +27 -0
  150. package/dist/esm/application/interface/file-system-service.interface.d.ts +61 -0
  151. package/dist/esm/application/interface/index.d.ts +9 -0
  152. package/dist/esm/application/interface/llm-service.interface.d.ts +43 -0
  153. package/dist/esm/application/use-case/configure-llm.use-case.d.ts +39 -0
  154. package/dist/esm/application/use-case/configure-llm.use-case.js +371 -0
  155. package/dist/esm/application/use-case/configure-llm.use-case.js.map +1 -0
  156. package/dist/esm/application/use-case/generate-commit-message.use-case.d.ts +18 -0
  157. package/dist/esm/application/use-case/generate-commit-message.use-case.js +47 -0
  158. package/dist/esm/application/use-case/generate-commit-message.use-case.js.map +1 -0
  159. package/dist/esm/application/use-case/index.d.ts +4 -0
  160. package/dist/esm/application/use-case/manual-commit.use-case.d.ts +16 -0
  161. package/dist/esm/application/use-case/manual-commit.use-case.js +79 -0
  162. package/dist/esm/application/use-case/manual-commit.use-case.js.map +1 -0
  163. package/dist/esm/application/use-case/validate-commit-message.use-case.d.ts +26 -0
  164. package/dist/esm/application/use-case/validate-commit-message.use-case.js +74 -0
  165. package/dist/esm/application/use-case/validate-commit-message.use-case.js.map +1 -0
  166. package/dist/esm/domain/constant/index.d.ts +1 -0
  167. package/dist/esm/domain/constant/numeric.constant.d.ts +25 -0
  168. package/dist/esm/domain/constant/numeric.constant.js +26 -0
  169. package/dist/esm/domain/constant/numeric.constant.js.map +1 -0
  170. package/dist/esm/domain/entity/commit-message.entity.d.ts +47 -0
  171. package/dist/esm/domain/entity/commit-message.entity.js +69 -0
  172. package/dist/esm/domain/entity/commit-message.entity.js.map +1 -0
  173. package/dist/esm/domain/entity/index.d.ts +2 -0
  174. package/dist/esm/domain/entity/llm-configuration.entity.d.ts +73 -0
  175. package/dist/esm/domain/entity/llm-configuration.entity.js +105 -0
  176. package/dist/esm/domain/entity/llm-configuration.entity.js.map +1 -0
  177. package/dist/esm/domain/enum/anthropic-model.enum.d.ts +18 -0
  178. package/dist/esm/domain/enum/anthropic-model.enum.js +26 -0
  179. package/dist/esm/domain/enum/anthropic-model.enum.js.map +1 -0
  180. package/dist/esm/domain/enum/aws-bedrock-model.enum.d.ts +33 -0
  181. package/dist/esm/domain/enum/aws-bedrock-model.enum.js +47 -0
  182. package/dist/esm/domain/enum/aws-bedrock-model.enum.js.map +1 -0
  183. package/dist/esm/domain/enum/azure-openai-model.enum.d.ts +17 -0
  184. package/dist/esm/domain/enum/azure-openai-model.enum.js +26 -0
  185. package/dist/esm/domain/enum/azure-openai-model.enum.js.map +1 -0
  186. package/dist/esm/domain/enum/commit-mode.enum.d.ts +7 -0
  187. package/dist/esm/domain/enum/commit-mode.enum.js +11 -0
  188. package/dist/esm/domain/enum/commit-mode.enum.js.map +1 -0
  189. package/dist/esm/domain/enum/google-model.enum.d.ts +16 -0
  190. package/dist/esm/domain/enum/google-model.enum.js +25 -0
  191. package/dist/esm/domain/enum/google-model.enum.js.map +1 -0
  192. package/dist/esm/domain/enum/index.d.ts +9 -0
  193. package/dist/esm/domain/enum/llm-provider.enum.d.ts +11 -0
  194. package/dist/esm/domain/enum/llm-provider.enum.js +15 -0
  195. package/dist/esm/domain/enum/llm-provider.enum.js.map +1 -0
  196. package/dist/esm/domain/enum/log-level.enum.d.ts +9 -0
  197. package/dist/esm/domain/enum/log-level.enum.js +13 -0
  198. package/dist/esm/domain/enum/log-level.enum.js.map +1 -0
  199. package/dist/esm/domain/enum/ollama-model.enum.d.ts +24 -0
  200. package/dist/esm/domain/enum/ollama-model.enum.js +30 -0
  201. package/dist/esm/domain/enum/ollama-model.enum.js.map +1 -0
  202. package/dist/esm/domain/enum/openai-model.enum.d.ts +25 -0
  203. package/dist/esm/domain/enum/openai-model.enum.js +35 -0
  204. package/dist/esm/domain/enum/openai-model.enum.js.map +1 -0
  205. package/dist/esm/domain/index.d.ts +3 -0
  206. package/dist/esm/domain/value-object/api-key.value-object.d.ts +28 -0
  207. package/dist/esm/domain/value-object/api-key.value-object.js +49 -0
  208. package/dist/esm/domain/value-object/api-key.value-object.js.map +1 -0
  209. package/dist/esm/domain/value-object/commit-body.value-object.d.ts +39 -0
  210. package/dist/esm/domain/value-object/commit-body.value-object.js +64 -0
  211. package/dist/esm/domain/value-object/commit-body.value-object.js.map +1 -0
  212. package/dist/esm/domain/value-object/commit-header.value-object.d.ts +35 -0
  213. package/dist/esm/domain/value-object/commit-header.value-object.js +61 -0
  214. package/dist/esm/domain/value-object/commit-header.value-object.js.map +1 -0
  215. package/dist/esm/domain/value-object/index.d.ts +3 -0
  216. package/dist/esm/index.d.ts +14 -12
  217. package/dist/esm/index.js +38 -82
  218. package/dist/esm/index.js.map +1 -1
  219. package/dist/esm/infrastructure/commit-validator/commitlint-validator.service.d.ts +38 -0
  220. package/dist/esm/infrastructure/commit-validator/commitlint-validator.service.js +205 -0
  221. package/dist/esm/infrastructure/commit-validator/commitlint-validator.service.js.map +1 -0
  222. package/dist/esm/infrastructure/commit-validator/index.d.ts +1 -0
  223. package/dist/esm/infrastructure/di/container.d.ts +17 -0
  224. package/dist/esm/infrastructure/di/container.js +63 -0
  225. package/dist/esm/infrastructure/di/container.js.map +1 -0
  226. package/dist/esm/infrastructure/di/index.d.ts +1 -0
  227. package/dist/esm/infrastructure/git/git-commit.repository.d.ts +36 -0
  228. package/dist/esm/infrastructure/git/git-commit.repository.js +76 -0
  229. package/dist/esm/infrastructure/git/git-commit.repository.js.map +1 -0
  230. package/dist/esm/infrastructure/git/index.d.ts +1 -0
  231. package/dist/esm/infrastructure/index.d.ts +4 -0
  232. package/dist/esm/infrastructure/llm/anthropic-llm.service.d.ts +39 -0
  233. package/dist/esm/infrastructure/llm/anthropic-llm.service.js +321 -0
  234. package/dist/esm/infrastructure/llm/anthropic-llm.service.js.map +1 -0
  235. package/dist/esm/infrastructure/llm/aws-bedrock-llm.service.d.ts +60 -0
  236. package/dist/esm/infrastructure/llm/aws-bedrock-llm.service.js +512 -0
  237. package/dist/esm/infrastructure/llm/aws-bedrock-llm.service.js.map +1 -0
  238. package/dist/esm/infrastructure/llm/azure-openai-llm.service.d.ts +45 -0
  239. package/dist/esm/infrastructure/llm/azure-openai-llm.service.js +349 -0
  240. package/dist/esm/infrastructure/llm/azure-openai-llm.service.js.map +1 -0
  241. package/dist/esm/infrastructure/llm/google-llm.service.d.ts +45 -0
  242. package/dist/esm/infrastructure/llm/google-llm.service.js +333 -0
  243. package/dist/esm/infrastructure/llm/google-llm.service.js.map +1 -0
  244. package/dist/esm/infrastructure/llm/index.d.ts +6 -0
  245. package/dist/esm/infrastructure/llm/ollama-llm.service.d.ts +45 -0
  246. package/dist/esm/infrastructure/llm/ollama-llm.service.js +385 -0
  247. package/dist/esm/infrastructure/llm/ollama-llm.service.js.map +1 -0
  248. package/dist/esm/infrastructure/llm/openai-llm.service.d.ts +45 -0
  249. package/dist/esm/infrastructure/llm/openai-llm.service.js +337 -0
  250. package/dist/esm/infrastructure/llm/openai-llm.service.js.map +1 -0
  251. package/dist/esm/infrastructure/service/cosmic-config.service.d.ts +66 -0
  252. package/dist/esm/infrastructure/service/cosmic-config.service.js +174 -0
  253. package/dist/esm/infrastructure/service/cosmic-config.service.js.map +1 -0
  254. package/dist/esm/infrastructure/service/index.d.ts +4 -0
  255. package/dist/esm/infrastructure/service/node-command.service.d.ts +45 -0
  256. package/dist/esm/infrastructure/service/node-command.service.js +152 -0
  257. package/dist/esm/infrastructure/service/node-command.service.js.map +1 -0
  258. package/dist/esm/infrastructure/service/node-file-system.service.d.ts +62 -0
  259. package/dist/esm/infrastructure/service/node-file-system.service.js +100 -0
  260. package/dist/esm/infrastructure/service/node-file-system.service.js.map +1 -0
  261. package/dist/esm/infrastructure/service/prompts-cli-interface.service.d.ts +117 -0
  262. package/dist/esm/infrastructure/service/prompts-cli-interface.service.js +316 -0
  263. package/dist/esm/infrastructure/service/prompts-cli-interface.service.js.map +1 -0
  264. package/dist/esm/package.json +19 -0
  265. package/dist/esm/presentation/commitizen.adapter.d.ts +28 -0
  266. package/dist/esm/presentation/commitizen.adapter.js +302 -0
  267. package/dist/esm/presentation/commitizen.adapter.js.map +1 -0
  268. package/dist/esm/presentation/index.d.ts +1 -0
  269. package/index.cjs +1 -2
  270. package/package.json +42 -25
  271. package/dist/cjs/ManualProcess.d.ts +0 -6
  272. package/dist/cjs/ManualProcess.d.ts.map +0 -1
  273. package/dist/cjs/ManualProcess.js +0 -111
  274. package/dist/cjs/ManualProcess.js.map +0 -1
  275. package/dist/cjs/Process.d.ts +0 -6
  276. package/dist/cjs/Process.d.ts.map +0 -1
  277. package/dist/cjs/Process.js +0 -176
  278. package/dist/cjs/Process.js.map +0 -1
  279. package/dist/cjs/Question.d.ts +0 -46
  280. package/dist/cjs/Question.d.ts.map +0 -1
  281. package/dist/cjs/SectionBody.d.ts +0 -4
  282. package/dist/cjs/SectionBody.d.ts.map +0 -1
  283. package/dist/cjs/SectionFooter.d.ts +0 -13
  284. package/dist/cjs/SectionFooter.d.ts.map +0 -1
  285. package/dist/cjs/SectionHeader.d.ts +0 -15
  286. package/dist/cjs/SectionHeader.d.ts.map +0 -1
  287. package/dist/cjs/index.d.ts.map +0 -1
  288. package/dist/cjs/services/commitConfirmation.d.ts +0 -3
  289. package/dist/cjs/services/commitConfirmation.d.ts.map +0 -1
  290. package/dist/cjs/services/commitConfirmation.js +0 -122
  291. package/dist/cjs/services/commitConfirmation.js.map +0 -1
  292. package/dist/cjs/services/commitlintConfig.d.ts +0 -4
  293. package/dist/cjs/services/commitlintConfig.d.ts.map +0 -1
  294. package/dist/cjs/services/commitlintConfig.js +0 -198
  295. package/dist/cjs/services/commitlintConfig.js.map +0 -1
  296. package/dist/cjs/services/commitlintValidator.d.ts +0 -26
  297. package/dist/cjs/services/commitlintValidator.d.ts.map +0 -1
  298. package/dist/cjs/services/commitlintValidator.js +0 -146
  299. package/dist/cjs/services/commitlintValidator.js.map +0 -1
  300. package/dist/cjs/services/getRuleQuestionConfig.d.ts +0 -4
  301. package/dist/cjs/services/getRuleQuestionConfig.d.ts.map +0 -1
  302. package/dist/cjs/services/llm/anthropic.d.ts +0 -3
  303. package/dist/cjs/services/llm/anthropic.d.ts.map +0 -1
  304. package/dist/cjs/services/llm/anthropic.js +0 -118
  305. package/dist/cjs/services/llm/anthropic.js.map +0 -1
  306. package/dist/cjs/services/llm/config.d.ts +0 -5
  307. package/dist/cjs/services/llm/config.d.ts.map +0 -1
  308. package/dist/cjs/services/llm/config.js +0 -181
  309. package/dist/cjs/services/llm/config.js.map +0 -1
  310. package/dist/cjs/services/llm/index.d.ts +0 -6
  311. package/dist/cjs/services/llm/index.d.ts.map +0 -1
  312. package/dist/cjs/services/llm/index.js +0 -399
  313. package/dist/cjs/services/llm/index.js.map +0 -1
  314. package/dist/cjs/services/llm/models.d.ts +0 -34
  315. package/dist/cjs/services/llm/models.d.ts.map +0 -1
  316. package/dist/cjs/services/llm/models.js +0 -65
  317. package/dist/cjs/services/llm/models.js.map +0 -1
  318. package/dist/cjs/services/llm/openai.d.ts +0 -3
  319. package/dist/cjs/services/llm/openai.d.ts.map +0 -1
  320. package/dist/cjs/services/llm/openai.js +0 -111
  321. package/dist/cjs/services/llm/openai.js.map +0 -1
  322. package/dist/cjs/services/llm/types.d.ts +0 -71
  323. package/dist/cjs/services/llm/types.d.ts.map +0 -1
  324. package/dist/cjs/store/defaultPromptConfigs.d.ts +0 -33
  325. package/dist/cjs/store/defaultPromptConfigs.d.ts.map +0 -1
  326. package/dist/cjs/store/defaultPromptConfigs.js +0 -39
  327. package/dist/cjs/store/defaultPromptConfigs.js.map +0 -1
  328. package/dist/cjs/store/prompts.d.ts +0 -6
  329. package/dist/cjs/store/prompts.d.ts.map +0 -1
  330. package/dist/cjs/store/prompts.js +0 -40
  331. package/dist/cjs/store/prompts.js.map +0 -1
  332. package/dist/cjs/store/rules.d.ts +0 -7
  333. package/dist/cjs/store/rules.d.ts.map +0 -1
  334. package/dist/cjs/types.d.ts +0 -3
  335. package/dist/cjs/types.d.ts.map +0 -1
  336. package/dist/cjs/utils/case-function.d.ts +0 -9
  337. package/dist/cjs/utils/case-function.d.ts.map +0 -1
  338. package/dist/cjs/utils/full-stop-function.d.ts +0 -9
  339. package/dist/cjs/utils/full-stop-function.d.ts.map +0 -1
  340. package/dist/cjs/utils/leading-blank-function.d.ts +0 -8
  341. package/dist/cjs/utils/leading-blank-function.d.ts.map +0 -1
  342. package/dist/cjs/utils/rules.d.ts +0 -26
  343. package/dist/cjs/utils/rules.d.ts.map +0 -1
  344. package/dist/esm/ManualProcess.d.ts +0 -6
  345. package/dist/esm/ManualProcess.d.ts.map +0 -1
  346. package/dist/esm/ManualProcess.js +0 -107
  347. package/dist/esm/ManualProcess.js.map +0 -1
  348. package/dist/esm/Process.d.ts +0 -6
  349. package/dist/esm/Process.d.ts.map +0 -1
  350. package/dist/esm/Process.js +0 -172
  351. package/dist/esm/Process.js.map +0 -1
  352. package/dist/esm/Question.d.ts +0 -46
  353. package/dist/esm/Question.d.ts.map +0 -1
  354. package/dist/esm/SectionBody.d.ts +0 -4
  355. package/dist/esm/SectionBody.d.ts.map +0 -1
  356. package/dist/esm/SectionFooter.d.ts +0 -13
  357. package/dist/esm/SectionFooter.d.ts.map +0 -1
  358. package/dist/esm/SectionHeader.d.ts +0 -15
  359. package/dist/esm/SectionHeader.d.ts.map +0 -1
  360. package/dist/esm/index.d.ts.map +0 -1
  361. package/dist/esm/services/commitConfirmation.d.ts +0 -3
  362. package/dist/esm/services/commitConfirmation.d.ts.map +0 -1
  363. package/dist/esm/services/commitConfirmation.js +0 -120
  364. package/dist/esm/services/commitConfirmation.js.map +0 -1
  365. package/dist/esm/services/commitlintConfig.d.ts +0 -4
  366. package/dist/esm/services/commitlintConfig.d.ts.map +0 -1
  367. package/dist/esm/services/commitlintConfig.js +0 -196
  368. package/dist/esm/services/commitlintConfig.js.map +0 -1
  369. package/dist/esm/services/commitlintValidator.d.ts +0 -26
  370. package/dist/esm/services/commitlintValidator.d.ts.map +0 -1
  371. package/dist/esm/services/commitlintValidator.js +0 -142
  372. package/dist/esm/services/commitlintValidator.js.map +0 -1
  373. package/dist/esm/services/getRuleQuestionConfig.d.ts +0 -4
  374. package/dist/esm/services/getRuleQuestionConfig.d.ts.map +0 -1
  375. package/dist/esm/services/llm/anthropic.d.ts +0 -3
  376. package/dist/esm/services/llm/anthropic.d.ts.map +0 -1
  377. package/dist/esm/services/llm/anthropic.js +0 -116
  378. package/dist/esm/services/llm/anthropic.js.map +0 -1
  379. package/dist/esm/services/llm/config.d.ts +0 -5
  380. package/dist/esm/services/llm/config.d.ts.map +0 -1
  381. package/dist/esm/services/llm/config.js +0 -178
  382. package/dist/esm/services/llm/config.js.map +0 -1
  383. package/dist/esm/services/llm/index.d.ts +0 -6
  384. package/dist/esm/services/llm/index.d.ts.map +0 -1
  385. package/dist/esm/services/llm/index.js +0 -394
  386. package/dist/esm/services/llm/index.js.map +0 -1
  387. package/dist/esm/services/llm/models.d.ts +0 -34
  388. package/dist/esm/services/llm/models.d.ts.map +0 -1
  389. package/dist/esm/services/llm/models.js +0 -60
  390. package/dist/esm/services/llm/models.js.map +0 -1
  391. package/dist/esm/services/llm/openai.d.ts +0 -3
  392. package/dist/esm/services/llm/openai.d.ts.map +0 -1
  393. package/dist/esm/services/llm/openai.js +0 -109
  394. package/dist/esm/services/llm/openai.js.map +0 -1
  395. package/dist/esm/services/llm/types.d.ts +0 -71
  396. package/dist/esm/services/llm/types.d.ts.map +0 -1
  397. package/dist/esm/store/defaultPromptConfigs.d.ts +0 -33
  398. package/dist/esm/store/defaultPromptConfigs.d.ts.map +0 -1
  399. package/dist/esm/store/defaultPromptConfigs.js +0 -35
  400. package/dist/esm/store/defaultPromptConfigs.js.map +0 -1
  401. package/dist/esm/store/prompts.d.ts +0 -6
  402. package/dist/esm/store/prompts.d.ts.map +0 -1
  403. package/dist/esm/store/prompts.js +0 -38
  404. package/dist/esm/store/prompts.js.map +0 -1
  405. package/dist/esm/store/rules.d.ts +0 -7
  406. package/dist/esm/store/rules.d.ts.map +0 -1
  407. package/dist/esm/types.d.ts +0 -3
  408. package/dist/esm/types.d.ts.map +0 -1
  409. package/dist/esm/utils/case-function.d.ts +0 -9
  410. package/dist/esm/utils/case-function.d.ts.map +0 -1
  411. package/dist/esm/utils/full-stop-function.d.ts +0 -9
  412. package/dist/esm/utils/full-stop-function.d.ts.map +0 -1
  413. package/dist/esm/utils/leading-blank-function.d.ts +0 -8
  414. package/dist/esm/utils/leading-blank-function.d.ts.map +0 -1
  415. package/dist/esm/utils/rules.d.ts +0 -26
  416. package/dist/esm/utils/rules.d.ts.map +0 -1
  417. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,45 @@
1
+ import type { ICliInterfaceService } from '../../application/interface/cli-interface-service.interface';
2
+ import type { ICommandService } from '../../application/interface/command-service.interface';
3
+ /**
4
+ * Implementation of the command service using Node.js child_process.
5
+ * Provides functionality to execute shell commands.
6
+ */
7
+ export declare class NodeCommandService implements ICommandService {
8
+ /** CLI interface service for user interaction */
9
+ readonly CLI_INTERFACE_SERVICE: ICliInterfaceService;
10
+ /**
11
+ * Promisified version of the exec function from child_process.
12
+ * Allows for async/await usage of command execution.
13
+ */
14
+ private readonly EXEC_ASYNC;
15
+ /**
16
+ * @param {ICliInterfaceService} cliInterfaceService - The CLI interface service for user interactions
17
+ */
18
+ constructor(cliInterfaceService: ICliInterfaceService);
19
+ /**
20
+ * Executes a shell command.
21
+ * @param {string} command - The shell command to execute
22
+ * @returns {Promise<void>} Promise that resolves when the command completes successfully
23
+ * @throws Will throw an error if the command execution fails, except for npm install which offers retry options
24
+ */
25
+ execute(command: string): Promise<void>;
26
+ /**
27
+ * Execute a command and return its output
28
+ * @param {string} command - The command to execute
29
+ * @returns {Promise<string>} Promise that resolves to the command output
30
+ */
31
+ executeWithOutput(command: string): Promise<string>;
32
+ /**
33
+ * Format and parse npm error to readable format
34
+ * @param {string} command - The original npm command that failed
35
+ * @param {INodeError} error - Error npm object
36
+ */
37
+ private formatAndParseNpmError;
38
+ /**
39
+ * Handles npm install command failures by offering retry options to the user.
40
+ * @param {string} originalCommand - The original npm command that failed
41
+ * @returns {Promise<void>} Promise that resolves when the chosen action completes
42
+ * @throws Will throw an error if the user chooses to cancel or if retried command still fails
43
+ */
44
+ private handleNpmInstallFailure;
45
+ }
@@ -0,0 +1,154 @@
1
+ 'use strict';
2
+
3
+ var node_child_process = require('node:child_process');
4
+ var node_util = require('node:util');
5
+ var chalk = require('chalk');
6
+
7
+ /**
8
+ * Implementation of the command service using Node.js child_process.
9
+ * Provides functionality to execute shell commands.
10
+ */
11
+ class NodeCommandService {
12
+ /** CLI interface service for user interaction */
13
+ CLI_INTERFACE_SERVICE;
14
+ /**
15
+ * Promisified version of the exec function from child_process.
16
+ * Allows for async/await usage of command execution.
17
+ */
18
+ EXEC_ASYNC = node_util.promisify(node_child_process.exec);
19
+ /**
20
+ * @param {ICliInterfaceService} cliInterfaceService - The CLI interface service for user interactions
21
+ */
22
+ constructor(cliInterfaceService) {
23
+ this.CLI_INTERFACE_SERVICE = cliInterfaceService;
24
+ }
25
+ /**
26
+ * Executes a shell command.
27
+ * @param {string} command - The shell command to execute
28
+ * @returns {Promise<void>} Promise that resolves when the command completes successfully
29
+ * @throws Will throw an error if the command execution fails, except for npm install which offers retry options
30
+ */
31
+ async execute(command) {
32
+ try {
33
+ await this.EXEC_ASYNC(command);
34
+ }
35
+ catch (error) {
36
+ // Check if the failed command is npm
37
+ if (command.trim().startsWith("npm install") || command.trim().startsWith("npm ci") || command.trim().startsWith("npm update") || command.trim().startsWith("npm uninstall")) {
38
+ this.formatAndParseNpmError(command, error);
39
+ await this.handleNpmInstallFailure(command);
40
+ }
41
+ else {
42
+ // For non-npm commands, throw the error as before
43
+ throw error;
44
+ }
45
+ }
46
+ }
47
+ /**
48
+ * Execute a command and return its output
49
+ * @param {string} command - The command to execute
50
+ * @returns {Promise<string>} Promise that resolves to the command output
51
+ */
52
+ async executeWithOutput(command) {
53
+ try {
54
+ const { stdout } = await this.EXEC_ASYNC(command);
55
+ return stdout.trim();
56
+ }
57
+ catch (error) {
58
+ this.CLI_INTERFACE_SERVICE.handleError(`Failed to execute command: ${command}`, error);
59
+ throw error;
60
+ }
61
+ }
62
+ /**
63
+ * Format and parse npm error to readable format
64
+ * @param {string} command - The original npm command that failed
65
+ * @param {INodeError} error - Error npm object
66
+ */
67
+ formatAndParseNpmError(command, error) {
68
+ // Форматируем и выводим ошибку
69
+ console.error(chalk.red.bold("🚨 NPM Command Failed"));
70
+ console.error(chalk.gray(`Command: ${command}`));
71
+ console.error(chalk.red("Error Details:"));
72
+ // Парсим stderr для структурированного вывода
73
+ if (error.stderr) {
74
+ const lines = error.stderr.split("\n").filter((line) => line.trim());
75
+ let errorCode = null;
76
+ const conflictDetails = [];
77
+ let resolutionAdvice = null;
78
+ let logFile = null;
79
+ for (const line of lines) {
80
+ if (line.includes("npm error code")) {
81
+ errorCode = line.replace("npm error code", "").trim();
82
+ }
83
+ else if (line.includes("While resolving") || line.includes("Found") || line.includes("Could not resolve dependency") || line.includes("Conflicting peer dependency")) {
84
+ conflictDetails.push(line.replace("npm error", "").trim());
85
+ }
86
+ else if (line.includes("Fix the upstream dependency conflict") || line.includes("--force") || line.includes("--legacy-peer-deps")) {
87
+ resolutionAdvice = line.replace("npm error", "").trim();
88
+ }
89
+ else if (line.includes("A complete log of this run can be found in")) {
90
+ logFile = line.replace("npm error", "").trim();
91
+ }
92
+ }
93
+ // Выводим структурированную ошибку
94
+ if (errorCode) {
95
+ console.error(chalk.red(` Code: ${errorCode}`));
96
+ }
97
+ if (conflictDetails.length > 0) {
98
+ console.error(chalk.yellow(" Dependency Conflict:"));
99
+ for (const detail of conflictDetails)
100
+ console.error(chalk.yellow(` - ${detail}`));
101
+ }
102
+ if (resolutionAdvice) {
103
+ console.error(chalk.cyan(" Resolution:"));
104
+ console.error(chalk.cyan(` ${resolutionAdvice}`));
105
+ }
106
+ if (logFile) {
107
+ console.error(chalk.gray(` Log File: ${logFile}`));
108
+ }
109
+ }
110
+ else {
111
+ // Если stderr пустой, выводим общую информацию об ошибке
112
+ console.error(chalk.red("Unknown error occurred"));
113
+ }
114
+ }
115
+ /**
116
+ * Handles npm install command failures by offering retry options to the user.
117
+ * @param {string} originalCommand - The original npm command that failed
118
+ * @returns {Promise<void>} Promise that resolves when the chosen action completes
119
+ * @throws Will throw an error if the user chooses to cancel or if retried command still fails
120
+ */
121
+ async handleNpmInstallFailure(originalCommand) {
122
+ this.CLI_INTERFACE_SERVICE.warn("npm command exection failed.");
123
+ const options = [
124
+ { label: "Retry with --force", value: "force" },
125
+ { label: "Retry with --legacy-peer-deps", value: "legacy-peer-deps" },
126
+ { label: "Cancel command execution", value: "cancel" },
127
+ ];
128
+ const choice = await this.CLI_INTERFACE_SERVICE.select("How would you like to proceed?", options);
129
+ switch (choice) {
130
+ case "force": {
131
+ this.CLI_INTERFACE_SERVICE.info("Retrying with --force flag...");
132
+ await this.EXEC_ASYNC(`${originalCommand} --force`);
133
+ this.CLI_INTERFACE_SERVICE.success("Execution completed with --force flag.");
134
+ break;
135
+ }
136
+ case "legacy-peer-deps": {
137
+ this.CLI_INTERFACE_SERVICE.info("Retrying with --legacy-peer-deps flag...");
138
+ await this.EXEC_ASYNC(`${originalCommand} --legacy-peer-deps`);
139
+ this.CLI_INTERFACE_SERVICE.success("Execution completed with --legacy-peer-deps flag.");
140
+ break;
141
+ }
142
+ case "cancel": {
143
+ this.CLI_INTERFACE_SERVICE.info("Execution cancelled by user.");
144
+ throw new Error("npm command execution was cancelled by user.");
145
+ }
146
+ default: {
147
+ throw new Error("Invalid option selected.");
148
+ }
149
+ }
150
+ }
151
+ }
152
+
153
+ exports.NodeCommandService = NodeCommandService;
154
+ //# sourceMappingURL=node-command.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-command.service.js","sources":["../../../../../src/infrastructure/service/node-command.service.ts"],"sourcesContent":[null],"names":["promisify","exec"],"mappings":";;;;;;AAkBA;;;AAGG;MACU,kBAAkB,CAAA;;AAErB,IAAA,qBAAqB;AAE9B;;;AAGG;AACc,IAAA,UAAU,GAAuEA,mBAAS,CAACC,uBAAI,CAAC;AAEjH;;AAEG;AACH,IAAA,WAAA,CAAY,mBAAyC,EAAA;AACpD,QAAA,IAAI,CAAC,qBAAqB,GAAG,mBAAmB;;AAGjD;;;;;AAKG;IACH,MAAM,OAAO,CAAC,OAAe,EAAA;AAC5B,QAAA,IAAI;AACH,YAAA,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;;QAC7B,OAAO,KAAK,EAAE;;AAEf,YAAA,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;AAC7K,gBAAA,IAAI,CAAC,sBAAsB,CAAC,OAAO,EAAE,KAAmB,CAAC;AACzD,gBAAA,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC;;iBACrC;;AAEN,gBAAA,MAAM,KAAK;;;;AAKd;;;;AAIG;IACH,MAAM,iBAAiB,CAAC,OAAe,EAAA;AACtC,QAAA,IAAI;YACH,MAAM,EAAE,MAAM,EAAE,GAAuB,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;AAErE,YAAA,OAAO,MAAM,CAAC,IAAI,EAAE;;QACnB,OAAO,KAAK,EAAE;YACf,IAAI,CAAC,qBAAqB,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AAC,0BAA0B,CAAC;;;;AAI9C;;;;"}
@@ -0,0 +1,62 @@
1
+ import type { IFileSystemService } from '../../application/interface/file-system-service.interface';
2
+ /**
3
+ * Implementation of the file system service using Node.js fs/promises API.
4
+ * Provides methods for managing files and directories.
5
+ */
6
+ export declare class NodeFileSystemService implements IFileSystemService {
7
+ /**
8
+ * Creates a directory at the specified path.
9
+ * @param {string} directoryPath - The path to the directory to create
10
+ * @param {{ isRecursive: boolean }} options - Optional configuration for directory creation
11
+ * @param {boolean} options.isRecursive - Whether to create parent directories if they don't exist
12
+ * @returns {Promise<void>} Promise that resolves when the directory is created
13
+ */
14
+ createDirectory(directoryPath: string, options?: {
15
+ isRecursive: boolean;
16
+ }): Promise<void>;
17
+ /**
18
+ * Deletes a file at the specified path.
19
+ * @param {string} filePath - The path to the file to delete
20
+ * @returns {Promise<void>} Promise that resolves when the file is deleted
21
+ */
22
+ deleteFile(filePath: string): Promise<void>;
23
+ /**
24
+ * Gets the directory name from a file path.
25
+ * @param {string} filePath - The file path to extract the directory from
26
+ * @returns {string} The directory name
27
+ */
28
+ getDirectoryNameFromFilePath(filePath: string): string;
29
+ /**
30
+ * Gets the extension from a file path.
31
+ * @param {string} filePath - The file path to extract the extension from
32
+ * @returns {string} The file extension
33
+ */
34
+ getExtensionFromFilePath(filePath: string): string;
35
+ /**
36
+ * Checks if any of the provided paths exist and returns the first existing path.
37
+ * @param {Array<string>} paths - Array of paths to check
38
+ * @returns {Promise<string | undefined>} Promise that resolves to the first existing path or undefined if none exist
39
+ */
40
+ isOneOfPathsExists(paths: Array<string>): Promise<string | undefined>;
41
+ /**
42
+ * Checks if a file or directory exists at the specified path.
43
+ * @param {string} filePath - The path to check
44
+ * @returns {Promise<boolean>} Promise that resolves to true if the path exists, false otherwise
45
+ */
46
+ isPathExists(filePath: string): Promise<boolean>;
47
+ /**
48
+ * Reads the contents of a file.
49
+ * @param {string} filePath - The path to the file to read
50
+ * @param {string} encoding - The encoding to use when reading the file, defaults to "utf8"
51
+ * @returns {Promise<string>} Promise that resolves to the file contents as a string
52
+ */
53
+ readFile(filePath: string, encoding?: BufferEncoding): Promise<string>;
54
+ /**
55
+ * Writes content to a file, creating the file and parent directories if they don't exist.
56
+ * @param {string} filePath - The path to the file to write
57
+ * @param {string} content - The content to write to the file
58
+ * @param {string} encoding - The encoding to use when writing the file, defaults to "utf8"
59
+ * @returns {Promise<void>} Promise that resolves when the file is written
60
+ */
61
+ writeFile(filePath: string, content: string, encoding?: BufferEncoding): Promise<void>;
62
+ }
@@ -0,0 +1,102 @@
1
+ 'use strict';
2
+
3
+ var fs = require('node:fs/promises');
4
+ var path = require('node:path');
5
+
6
+ /**
7
+ * Implementation of the file system service using Node.js fs/promises API.
8
+ * Provides methods for managing files and directories.
9
+ */
10
+ class NodeFileSystemService {
11
+ /**
12
+ * Creates a directory at the specified path.
13
+ * @param {string} directoryPath - The path to the directory to create
14
+ * @param {{ isRecursive: boolean }} options - Optional configuration for directory creation
15
+ * @param {boolean} options.isRecursive - Whether to create parent directories if they don't exist
16
+ * @returns {Promise<void>} Promise that resolves when the directory is created
17
+ */
18
+ async createDirectory(directoryPath, options) {
19
+ directoryPath = path.dirname(directoryPath);
20
+ // eslint-disable-next-line @elsikora/typescript/naming-convention
21
+ await fs.mkdir(directoryPath, { recursive: options?.isRecursive });
22
+ }
23
+ /**
24
+ * Deletes a file at the specified path.
25
+ * @param {string} filePath - The path to the file to delete
26
+ * @returns {Promise<void>} Promise that resolves when the file is deleted
27
+ */
28
+ async deleteFile(filePath) {
29
+ await fs.unlink(filePath);
30
+ }
31
+ /**
32
+ * Gets the directory name from a file path.
33
+ * @param {string} filePath - The file path to extract the directory from
34
+ * @returns {string} The directory name
35
+ */
36
+ getDirectoryNameFromFilePath(filePath) {
37
+ return path.dirname(filePath);
38
+ }
39
+ /**
40
+ * Gets the extension from a file path.
41
+ * @param {string} filePath - The file path to extract the extension from
42
+ * @returns {string} The file extension
43
+ */
44
+ getExtensionFromFilePath(filePath) {
45
+ return path.extname(filePath);
46
+ }
47
+ /**
48
+ * Checks if any of the provided paths exist and returns the first existing path.
49
+ * @param {Array<string>} paths - Array of paths to check
50
+ * @returns {Promise<string | undefined>} Promise that resolves to the first existing path or undefined if none exist
51
+ */
52
+ async isOneOfPathsExists(paths) {
53
+ let existingFilePath = undefined;
54
+ for (const path of paths) {
55
+ if (await this.isPathExists(path)) {
56
+ existingFilePath = path;
57
+ break;
58
+ }
59
+ }
60
+ return existingFilePath;
61
+ }
62
+ /**
63
+ * Checks if a file or directory exists at the specified path.
64
+ * @param {string} filePath - The path to check
65
+ * @returns {Promise<boolean>} Promise that resolves to true if the path exists, false otherwise
66
+ */
67
+ async isPathExists(filePath) {
68
+ try {
69
+ await fs.access(filePath);
70
+ return true;
71
+ }
72
+ catch {
73
+ return false;
74
+ }
75
+ }
76
+ /**
77
+ * Reads the contents of a file.
78
+ * @param {string} filePath - The path to the file to read
79
+ * @param {string} encoding - The encoding to use when reading the file, defaults to "utf8"
80
+ * @returns {Promise<string>} Promise that resolves to the file contents as a string
81
+ */
82
+ // eslint-disable-next-line @elsikora/javascript/no-undef
83
+ async readFile(filePath, encoding = "utf8") {
84
+ return await fs.readFile(filePath, { encoding });
85
+ }
86
+ /**
87
+ * Writes content to a file, creating the file and parent directories if they don't exist.
88
+ * @param {string} filePath - The path to the file to write
89
+ * @param {string} content - The content to write to the file
90
+ * @param {string} encoding - The encoding to use when writing the file, defaults to "utf8"
91
+ * @returns {Promise<void>} Promise that resolves when the file is written
92
+ */
93
+ // eslint-disable-next-line @elsikora/javascript/no-undef
94
+ async writeFile(filePath, content, encoding = "utf8") {
95
+ // eslint-disable-next-line @elsikora/typescript/naming-convention
96
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
97
+ await fs.writeFile(filePath, content, { encoding });
98
+ }
99
+ }
100
+
101
+ exports.NodeFileSystemService = NodeFileSystemService;
102
+ //# sourceMappingURL=node-file-system.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-file-system.service.js","sources":["../../../../../src/infrastructure/service/node-file-system.service.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAKA;;;AAGG;MACU,qBAAqB,CAAA;AACjC;;;;;;AAMG;AACH,IAAA,MAAM,eAAe,CAAC,aAAqB,EAAE,OAAkC,EAAA;AAC9E,QAAA,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;;AAE3C,QAAA,MAAM,EAAE,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;;AAGnE;;;;AAIG;IACH,MAAM,UAAU,CAAC,QAAgB,EAAA;AAChC,QAAA,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;;AAG1B;;;;AAIG;AACH,IAAA,4BAA4B,CAAC,QAAgB,EAAA;AAC5C,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;;AAG9B;;;;AAIG;AACH,IAAA,wBAAwB,CAAC,QAAgB,EAAA;AACxC,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;;AAG9B;;;;AAIG;IACH,MAAM,kBAAkB,CAAC,KAAoB,EAAA;QAC5C,IAAI,gBAAgB,GAAuB,SAAS;AAEpD,QAAA,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACzB,IAAI,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;gBAClC,gBAAgB,GAAG,IAAI;gBAEvB;;;AAIF,QAAA,OAAO,gBAAgB;;AAGxB;;;;AAIG;IACH,MAAM,YAAY,CAAC,QAAgB,EAAA;AAClC,QAAA,IAAI;AACH,YAAA,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;AAEzB,YAAA,OAAO,IAAI;;AACV,QAAA,MAAM;AACP,YAAA,OAAO,KAAK;;;AAId;;;;;AAKG;;AAEH,IAAA,MAAM,QAAQ,CAAC,QAAgB,EAAE,WAA2B,MAAM,EAAA;QACjE,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,CAAC;;AAGjD;;;;;;AAMG;;IAEH,MAAM,SAAS,CAAC,QAAgB,EAAE,OAAe,EAAE,WAA2B,MAAM,EAAA;;AAEnF,QAAA,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAC3D,QAAA,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC;;AAEpD;;;;"}
@@ -0,0 +1,117 @@
1
+ import type { ICliInterfaceServiceSelectOptions } from '../../application/interface/cli-interface-service-select-options.interface';
2
+ import type { ICliInterfaceService } from '../../application/interface/cli-interface-service.interface';
3
+ /**
4
+ * Implementation of the CLI interface service using the prompts library.
5
+ * Provides methods for interacting with the user through the command line.
6
+ */
7
+ export declare class PromptsCliInterface implements ICliInterfaceService {
8
+ /** Reference to the active spinner instance */
9
+ private spinner;
10
+ /**
11
+ * Initializes a new instance of the PromptsCliInterface.
12
+ * Sets up the spinner for providing visual feedback during operations.
13
+ */
14
+ constructor();
15
+ /**
16
+ * Clears the console screen.
17
+ */
18
+ clear(): void;
19
+ /**
20
+ * Displays a confirmation prompt to the user.
21
+ * @param {string} message - The message to display to the user
22
+ * @param {boolean} isConfirmedByDefault - The default value for the confirmation, defaults to false
23
+ * @returns {Promise<boolean>} Promise that resolves to the user's response (true for confirmed, false for declined)
24
+ */
25
+ confirm(message: string, isConfirmedByDefault?: boolean): Promise<boolean>;
26
+ /**
27
+ * Displays an error message to the user.
28
+ * @param {string} message - The error message to display
29
+ */
30
+ error(message: string): void;
31
+ /**
32
+ * Displays a grouped multi-select prompt to the user.
33
+ * @param {string} message - The message to display to the user
34
+ * @param {Record<string, Array<ICliInterfaceServiceSelectOptions>>} options - Record of groups and their options
35
+ * @param {boolean} isRequired - Whether a selection is required, defaults to false
36
+ * @param {Array<string>} initialValues - Initial selected values
37
+ * @returns {Promise<Array<T>>} Promise that resolves to an array of selected values
38
+ * @template T - The type of the selected values
39
+ */
40
+ groupMultiselect<T>(message: string, options: Record<string, Array<ICliInterfaceServiceSelectOptions>>, isRequired?: boolean, initialValues?: Array<string>): Promise<Array<T>>;
41
+ /**
42
+ * Handles and displays an error message with additional error details.
43
+ * @param {string} message - The error message to display
44
+ * @param {unknown} error - The error object or details
45
+ */
46
+ handleError(message: string, error: unknown): void;
47
+ /**
48
+ * Displays an informational message to the user.
49
+ * @param {string} message - The info message to display
50
+ */
51
+ info(message: string): void;
52
+ /**
53
+ * Displays a standard message to the user.
54
+ * @param {string} message - The message to display
55
+ */
56
+ log(message: string): void;
57
+ /**
58
+ * Displays a multi-select prompt to the user.
59
+ * @param {string} message - The message to display to the user
60
+ * @param {Array<ICliInterfaceServiceSelectOptions>} options - Array of options to select from
61
+ * @param {boolean} isRequired - Whether a selection is required, defaults to false
62
+ * @param {Array<string>} initialValues - Initial selected values
63
+ * @returns {Promise<Array<T>>} Promise that resolves to an array of selected values
64
+ * @template T - The type of the selected values
65
+ */
66
+ multiselect<T>(message: string, options: Array<ICliInterfaceServiceSelectOptions>, isRequired?: boolean, initialValues?: Array<string>): Promise<Array<T>>;
67
+ /**
68
+ * Displays a note to the user with a title and message.
69
+ * @param {string} title - The title of the note
70
+ * @param {string} message - The message content of the note
71
+ */
72
+ note(title: string, message: string): void;
73
+ /**
74
+ * Displays a single select prompt to the user.
75
+ * @param {string} message - The message to display to the user
76
+ * @param {Array<ICliInterfaceServiceSelectOptions>} options - Array of options to select from
77
+ * @param {string} initialValue - Initial selected value
78
+ * @returns {Promise<T>} Promise that resolves to the selected value
79
+ * @template T - The type of the selected value
80
+ */
81
+ select<T>(message: string, options: Array<ICliInterfaceServiceSelectOptions>, initialValue?: string): Promise<T>;
82
+ /**
83
+ * Starts a spinner with the specified message.
84
+ * Stops any existing spinner first.
85
+ * @param {string} message - The message to display while the spinner is active
86
+ */
87
+ startSpinner(message: string): void;
88
+ /**
89
+ * Stops the current spinner with an optional completion message.
90
+ * @param {string} message - Optional message to display when the spinner stops
91
+ */
92
+ stopSpinner(message?: string): void;
93
+ /**
94
+ * Displays a success message to the user.
95
+ * @param {string} message - The success message to display
96
+ */
97
+ success(message: string): void;
98
+ /**
99
+ * Displays a text input prompt to the user.
100
+ * @param {string} message - The message to display to the user
101
+ * @param {string} _placeholder - Optional placeholder text for the input field (unused)
102
+ * @param {string} initialValue - Optional initial value for the input field
103
+ * @param {(value: string) => Error | string | undefined} validate - Optional validation function for the input
104
+ * @returns {Promise<string>} Promise that resolves to the user's input text
105
+ */
106
+ text(message: string, _placeholder?: string, initialValue?: string, validate?: (value: string) => Error | string | undefined): Promise<string>;
107
+ /**
108
+ * Update the spinner message without stopping it.
109
+ * @param {string} message - The new message to display
110
+ */
111
+ updateSpinner(message: string): void;
112
+ /**
113
+ * Displays a warning message to the user.
114
+ * @param {string} message - The warning message to display
115
+ */
116
+ warn(message: string): void;
117
+ }