@intlayer/cli 9.0.0-canary.2 → 9.0.0-canary.20

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 (333) hide show
  1. package/dist/cjs/IntlayerEventListener.cjs +1 -1
  2. package/dist/cjs/IntlayerEventListener.cjs.map +1 -1
  3. package/dist/cjs/_virtual/_utils_asset.cjs +4 -3
  4. package/dist/cjs/auth/login.cjs +44 -31
  5. package/dist/cjs/auth/login.cjs.map +1 -1
  6. package/dist/cjs/auth/sessionToken.cjs +0 -1
  7. package/dist/cjs/auth/sessionToken.cjs.map +1 -1
  8. package/dist/cjs/build.cjs +6 -7
  9. package/dist/cjs/build.cjs.map +1 -1
  10. package/dist/cjs/bundle.cjs +32 -1
  11. package/dist/cjs/bundle.cjs.map +1 -1
  12. package/dist/cjs/ci.cjs +96 -29
  13. package/dist/cjs/ci.cjs.map +1 -1
  14. package/dist/cjs/cli.cjs +163 -125
  15. package/dist/cjs/cli.cjs.map +1 -1
  16. package/dist/cjs/config.cjs +2 -3
  17. package/dist/cjs/config.cjs.map +1 -1
  18. package/dist/cjs/editor.cjs +0 -1
  19. package/dist/cjs/editor.cjs.map +1 -1
  20. package/dist/cjs/extract.cjs +7 -7
  21. package/dist/cjs/extract.cjs.map +1 -1
  22. package/dist/cjs/fill/deepMergeContent.cjs.map +1 -1
  23. package/dist/cjs/fill/extractTranslatableContent.cjs.map +1 -1
  24. package/dist/cjs/fill/fill.cjs +11 -11
  25. package/dist/cjs/fill/fill.cjs.map +1 -1
  26. package/dist/cjs/fill/formatAutoFilledFilePath.cjs +2 -3
  27. package/dist/cjs/fill/formatAutoFilledFilePath.cjs.map +1 -1
  28. package/dist/cjs/fill/formatFillData.cjs +3 -4
  29. package/dist/cjs/fill/formatFillData.cjs.map +1 -1
  30. package/dist/cjs/fill/getAvailableLocalesInDictionary.cjs.map +1 -1
  31. package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs.map +1 -1
  32. package/dist/cjs/fill/listTranslationsTasks.cjs +2 -2
  33. package/dist/cjs/fill/listTranslationsTasks.cjs.map +1 -1
  34. package/dist/cjs/fill/translateDictionary.cjs +7 -7
  35. package/dist/cjs/fill/translateDictionary.cjs.map +1 -1
  36. package/dist/cjs/fill/writeFill.cjs +5 -6
  37. package/dist/cjs/fill/writeFill.cjs.map +1 -1
  38. package/dist/cjs/getTargetDictionary.cjs +2 -3
  39. package/dist/cjs/getTargetDictionary.cjs.map +1 -1
  40. package/dist/cjs/index.cjs +4 -4
  41. package/dist/cjs/init.cjs +369 -3
  42. package/dist/cjs/init.cjs.map +1 -1
  43. package/dist/cjs/initBuildOptimization.cjs +81 -0
  44. package/dist/cjs/initBuildOptimization.cjs.map +1 -0
  45. package/dist/cjs/initCompiler.cjs +117 -0
  46. package/dist/cjs/initCompiler.cjs.map +1 -0
  47. package/dist/cjs/initMCP.cjs +24 -21
  48. package/dist/cjs/initMCP.cjs.map +1 -1
  49. package/dist/cjs/initSkills.cjs +31 -28
  50. package/dist/cjs/initSkills.cjs.map +1 -1
  51. package/dist/cjs/listContentDeclaration.cjs +4 -5
  52. package/dist/cjs/listContentDeclaration.cjs.map +1 -1
  53. package/dist/cjs/listProjects.cjs +2 -3
  54. package/dist/cjs/listProjects.cjs.map +1 -1
  55. package/dist/cjs/liveSync.cjs +4 -4
  56. package/dist/cjs/liveSync.cjs.map +1 -1
  57. package/dist/cjs/pull.cjs +7 -7
  58. package/dist/cjs/pull.cjs.map +1 -1
  59. package/dist/cjs/push/pullLog.cjs +2 -2
  60. package/dist/cjs/push/pullLog.cjs.map +1 -1
  61. package/dist/cjs/push/push.cjs +13 -13
  62. package/dist/cjs/push/push.cjs.map +1 -1
  63. package/dist/cjs/pushConfig.cjs +2 -3
  64. package/dist/cjs/pushConfig.cjs.map +1 -1
  65. package/dist/cjs/pushLog.cjs.map +1 -1
  66. package/dist/cjs/reviewDoc/reviewDoc.cjs +16 -16
  67. package/dist/cjs/reviewDoc/reviewDoc.cjs.map +1 -1
  68. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs +12 -12
  69. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs.map +1 -1
  70. package/dist/cjs/reviewDoc/reviewDocLog.cjs +7 -8
  71. package/dist/cjs/reviewDoc/reviewDocLog.cjs.map +1 -1
  72. package/dist/cjs/scan.cjs +5 -5
  73. package/dist/cjs/scan.cjs.map +1 -1
  74. package/dist/cjs/searchDoc.cjs +2 -3
  75. package/dist/cjs/searchDoc.cjs.map +1 -1
  76. package/dist/cjs/test/listMissingTranslations.cjs +3 -4
  77. package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
  78. package/dist/cjs/test/test.cjs +11 -11
  79. package/dist/cjs/test/test.cjs.map +1 -1
  80. package/dist/cjs/translateDoc/translateDoc.cjs +6 -6
  81. package/dist/cjs/translateDoc/translateDoc.cjs.map +1 -1
  82. package/dist/cjs/translateDoc/translateFile.cjs +6 -6
  83. package/dist/cjs/translateDoc/translateFile.cjs.map +1 -1
  84. package/dist/cjs/translateDoc/validation.cjs.map +1 -1
  85. package/dist/cjs/utils/calculateChunks.cjs +4 -5
  86. package/dist/cjs/utils/calculateChunks.cjs.map +1 -1
  87. package/dist/cjs/utils/checkAccess.cjs.map +1 -1
  88. package/dist/cjs/utils/checkConfigConsistency.cjs.map +1 -1
  89. package/dist/cjs/utils/checkFileModifiedRange.cjs.map +1 -1
  90. package/dist/cjs/utils/checkLastUpdateTime.cjs +0 -1
  91. package/dist/cjs/utils/checkLastUpdateTime.cjs.map +1 -1
  92. package/dist/cjs/utils/chunkInference.cjs +0 -1
  93. package/dist/cjs/utils/chunkInference.cjs.map +1 -1
  94. package/dist/cjs/utils/fixChunkStartEndChars.cjs.map +1 -1
  95. package/dist/cjs/utils/formatLineRanges.cjs.map +1 -1
  96. package/dist/cjs/utils/formatTimeDiff.cjs.map +1 -1
  97. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs +1 -2
  98. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs.map +1 -1
  99. package/dist/cjs/utils/getOutputFilePath.cjs +2 -3
  100. package/dist/cjs/utils/getOutputFilePath.cjs.map +1 -1
  101. package/dist/cjs/utils/getParentPackageJSON.cjs +0 -1
  102. package/dist/cjs/utils/getParentPackageJSON.cjs.map +1 -1
  103. package/dist/cjs/utils/listSpecialChars.cjs.map +1 -1
  104. package/dist/cjs/utils/mapChunksBetweenFiles.cjs +4 -5
  105. package/dist/cjs/utils/mapChunksBetweenFiles.cjs.map +1 -1
  106. package/dist/cjs/utils/openBrowser.cjs +0 -1
  107. package/dist/cjs/utils/openBrowser.cjs.map +1 -1
  108. package/dist/cjs/utils/reorderParagraphs.cjs.map +1 -1
  109. package/dist/cjs/utils/selectCmsEnvironment.cjs.map +1 -1
  110. package/dist/cjs/utils/setupAI.cjs.map +1 -1
  111. package/dist/cjs/watch.cjs +28 -9
  112. package/dist/cjs/watch.cjs.map +1 -1
  113. package/dist/esm/IntlayerEventListener.mjs +1 -0
  114. package/dist/esm/IntlayerEventListener.mjs.map +1 -1
  115. package/dist/esm/_virtual/_utils_asset.mjs +4 -2
  116. package/dist/esm/auth/login.mjs +43 -30
  117. package/dist/esm/auth/login.mjs.map +1 -1
  118. package/dist/esm/auth/sessionToken.mjs.map +1 -1
  119. package/dist/esm/build.mjs +3 -3
  120. package/dist/esm/build.mjs.map +1 -1
  121. package/dist/esm/bundle.mjs +32 -1
  122. package/dist/esm/bundle.mjs.map +1 -1
  123. package/dist/esm/ci.mjs +95 -30
  124. package/dist/esm/ci.mjs.map +1 -1
  125. package/dist/esm/cli.mjs +141 -102
  126. package/dist/esm/cli.mjs.map +1 -1
  127. package/dist/esm/config.mjs +1 -1
  128. package/dist/esm/config.mjs.map +1 -1
  129. package/dist/esm/editor.mjs.map +1 -1
  130. package/dist/esm/extract.mjs +3 -3
  131. package/dist/esm/extract.mjs.map +1 -1
  132. package/dist/esm/fill/deepMergeContent.mjs.map +1 -1
  133. package/dist/esm/fill/extractTranslatableContent.mjs.map +1 -1
  134. package/dist/esm/fill/fill.mjs +3 -3
  135. package/dist/esm/fill/fill.mjs.map +1 -1
  136. package/dist/esm/fill/formatAutoFilledFilePath.mjs +1 -1
  137. package/dist/esm/fill/formatAutoFilledFilePath.mjs.map +1 -1
  138. package/dist/esm/fill/formatFillData.mjs +1 -1
  139. package/dist/esm/fill/formatFillData.mjs.map +1 -1
  140. package/dist/esm/fill/getAvailableLocalesInDictionary.mjs.map +1 -1
  141. package/dist/esm/fill/getFilterMissingContentPerLocale.mjs.map +1 -1
  142. package/dist/esm/fill/listTranslationsTasks.mjs +1 -1
  143. package/dist/esm/fill/listTranslationsTasks.mjs.map +1 -1
  144. package/dist/esm/fill/translateDictionary.mjs +1 -1
  145. package/dist/esm/fill/translateDictionary.mjs.map +1 -1
  146. package/dist/esm/fill/writeFill.mjs +2 -2
  147. package/dist/esm/fill/writeFill.mjs.map +1 -1
  148. package/dist/esm/getTargetDictionary.mjs +1 -1
  149. package/dist/esm/getTargetDictionary.mjs.map +1 -1
  150. package/dist/esm/index.mjs +4 -4
  151. package/dist/esm/init.mjs +368 -4
  152. package/dist/esm/init.mjs.map +1 -1
  153. package/dist/esm/initBuildOptimization.mjs +78 -0
  154. package/dist/esm/initBuildOptimization.mjs.map +1 -0
  155. package/dist/esm/initCompiler.mjs +114 -0
  156. package/dist/esm/initCompiler.mjs.map +1 -0
  157. package/dist/esm/initMCP.mjs +23 -20
  158. package/dist/esm/initMCP.mjs.map +1 -1
  159. package/dist/esm/initSkills.mjs +22 -19
  160. package/dist/esm/initSkills.mjs.map +1 -1
  161. package/dist/esm/listContentDeclaration.mjs +2 -2
  162. package/dist/esm/listContentDeclaration.mjs.map +1 -1
  163. package/dist/esm/listProjects.mjs +1 -1
  164. package/dist/esm/listProjects.mjs.map +1 -1
  165. package/dist/esm/liveSync.mjs +2 -2
  166. package/dist/esm/liveSync.mjs.map +1 -1
  167. package/dist/esm/pull.mjs +4 -4
  168. package/dist/esm/pull.mjs.map +1 -1
  169. package/dist/esm/push/pullLog.mjs +2 -2
  170. package/dist/esm/push/pullLog.mjs.map +1 -1
  171. package/dist/esm/push/push.mjs +3 -3
  172. package/dist/esm/push/push.mjs.map +1 -1
  173. package/dist/esm/pushConfig.mjs +1 -1
  174. package/dist/esm/pushConfig.mjs.map +1 -1
  175. package/dist/esm/pushLog.mjs.map +1 -1
  176. package/dist/esm/reviewDoc/reviewDoc.mjs +3 -3
  177. package/dist/esm/reviewDoc/reviewDoc.mjs.map +1 -1
  178. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs +3 -3
  179. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs.map +1 -1
  180. package/dist/esm/reviewDoc/reviewDocLog.mjs +2 -2
  181. package/dist/esm/reviewDoc/reviewDocLog.mjs.map +1 -1
  182. package/dist/esm/scan.mjs +1 -1
  183. package/dist/esm/scan.mjs.map +1 -1
  184. package/dist/esm/searchDoc.mjs +1 -1
  185. package/dist/esm/searchDoc.mjs.map +1 -1
  186. package/dist/esm/test/listMissingTranslations.mjs +2 -2
  187. package/dist/esm/test/listMissingTranslations.mjs.map +1 -1
  188. package/dist/esm/test/test.mjs +2 -2
  189. package/dist/esm/test/test.mjs.map +1 -1
  190. package/dist/esm/translateDoc/translateDoc.mjs +2 -2
  191. package/dist/esm/translateDoc/translateDoc.mjs.map +1 -1
  192. package/dist/esm/translateDoc/translateFile.mjs +2 -2
  193. package/dist/esm/translateDoc/translateFile.mjs.map +1 -1
  194. package/dist/esm/translateDoc/validation.mjs.map +1 -1
  195. package/dist/esm/utils/calculateChunks.mjs +1 -1
  196. package/dist/esm/utils/calculateChunks.mjs.map +1 -1
  197. package/dist/esm/utils/checkAccess.mjs.map +1 -1
  198. package/dist/esm/utils/checkConfigConsistency.mjs.map +1 -1
  199. package/dist/esm/utils/checkFileModifiedRange.mjs.map +1 -1
  200. package/dist/esm/utils/checkLastUpdateTime.mjs.map +1 -1
  201. package/dist/esm/utils/chunkInference.mjs.map +1 -1
  202. package/dist/esm/utils/fixChunkStartEndChars.mjs.map +1 -1
  203. package/dist/esm/utils/formatLineRanges.mjs.map +1 -1
  204. package/dist/esm/utils/formatTimeDiff.mjs.map +1 -1
  205. package/dist/esm/utils/getIsFileUpdatedRecently.mjs +1 -1
  206. package/dist/esm/utils/getIsFileUpdatedRecently.mjs.map +1 -1
  207. package/dist/esm/utils/getOutputFilePath.mjs +1 -1
  208. package/dist/esm/utils/getOutputFilePath.mjs.map +1 -1
  209. package/dist/esm/utils/getParentPackageJSON.mjs.map +1 -1
  210. package/dist/esm/utils/listSpecialChars.mjs.map +1 -1
  211. package/dist/esm/utils/mapChunksBetweenFiles.mjs +1 -1
  212. package/dist/esm/utils/mapChunksBetweenFiles.mjs.map +1 -1
  213. package/dist/esm/utils/openBrowser.mjs.map +1 -1
  214. package/dist/esm/utils/reorderParagraphs.mjs.map +1 -1
  215. package/dist/esm/utils/selectCmsEnvironment.mjs.map +1 -1
  216. package/dist/esm/utils/setupAI.mjs.map +1 -1
  217. package/dist/esm/watch.mjs +25 -5
  218. package/dist/esm/watch.mjs.map +1 -1
  219. package/dist/types/IntlayerEventListener.d.ts +0 -1
  220. package/dist/types/IntlayerEventListener.d.ts.map +1 -1
  221. package/dist/types/auth/login.d.ts +13 -5
  222. package/dist/types/auth/login.d.ts.map +1 -1
  223. package/dist/types/auth/sessionToken.d.ts +0 -1
  224. package/dist/types/auth/sessionToken.d.ts.map +1 -1
  225. package/dist/types/build.d.ts +0 -1
  226. package/dist/types/build.d.ts.map +1 -1
  227. package/dist/types/bundle.d.ts +0 -1
  228. package/dist/types/bundle.d.ts.map +1 -1
  229. package/dist/types/ci.d.ts +40 -1
  230. package/dist/types/ci.d.ts.map +1 -1
  231. package/dist/types/cli.d.ts +0 -1
  232. package/dist/types/cli.d.ts.map +1 -1
  233. package/dist/types/config.d.ts +0 -1
  234. package/dist/types/config.d.ts.map +1 -1
  235. package/dist/types/editor.d.ts.map +1 -1
  236. package/dist/types/extract.d.ts +0 -1
  237. package/dist/types/extract.d.ts.map +1 -1
  238. package/dist/types/fill/deepMergeContent.d.ts.map +1 -1
  239. package/dist/types/fill/extractTranslatableContent.d.ts.map +1 -1
  240. package/dist/types/fill/fill.d.ts +1 -2
  241. package/dist/types/fill/fill.d.ts.map +1 -1
  242. package/dist/types/fill/formatAutoFilledFilePath.d.ts +0 -1
  243. package/dist/types/fill/formatAutoFilledFilePath.d.ts.map +1 -1
  244. package/dist/types/fill/formatFillData.d.ts +0 -1
  245. package/dist/types/fill/formatFillData.d.ts.map +1 -1
  246. package/dist/types/fill/getAvailableLocalesInDictionary.d.ts +0 -1
  247. package/dist/types/fill/getAvailableLocalesInDictionary.d.ts.map +1 -1
  248. package/dist/types/fill/getFilterMissingContentPerLocale.d.ts +0 -1
  249. package/dist/types/fill/getFilterMissingContentPerLocale.d.ts.map +1 -1
  250. package/dist/types/fill/listTranslationsTasks.d.ts +1 -2
  251. package/dist/types/fill/listTranslationsTasks.d.ts.map +1 -1
  252. package/dist/types/fill/translateDictionary.d.ts +1 -3
  253. package/dist/types/fill/translateDictionary.d.ts.map +1 -1
  254. package/dist/types/fill/writeFill.d.ts +0 -1
  255. package/dist/types/fill/writeFill.d.ts.map +1 -1
  256. package/dist/types/getTargetDictionary.d.ts +1 -2
  257. package/dist/types/getTargetDictionary.d.ts.map +1 -1
  258. package/dist/types/index.d.ts +5 -4
  259. package/dist/types/init.d.ts +2 -3
  260. package/dist/types/init.d.ts.map +1 -1
  261. package/dist/types/initBuildOptimization.d.ts +20 -0
  262. package/dist/types/initBuildOptimization.d.ts.map +1 -0
  263. package/dist/types/initCompiler.d.ts +18 -0
  264. package/dist/types/initCompiler.d.ts.map +1 -0
  265. package/dist/types/initMCP.d.ts +2 -1
  266. package/dist/types/initMCP.d.ts.map +1 -1
  267. package/dist/types/initSkills.d.ts +2 -3
  268. package/dist/types/initSkills.d.ts.map +1 -1
  269. package/dist/types/listContentDeclaration.d.ts +0 -1
  270. package/dist/types/listContentDeclaration.d.ts.map +1 -1
  271. package/dist/types/listProjects.d.ts +1 -2
  272. package/dist/types/listProjects.d.ts.map +1 -1
  273. package/dist/types/liveSync.d.ts +0 -1
  274. package/dist/types/liveSync.d.ts.map +1 -1
  275. package/dist/types/pull.d.ts +0 -1
  276. package/dist/types/pull.d.ts.map +1 -1
  277. package/dist/types/push/pullLog.d.ts +1 -2
  278. package/dist/types/push/pullLog.d.ts.map +1 -1
  279. package/dist/types/push/push.d.ts +1 -2
  280. package/dist/types/push/push.d.ts.map +1 -1
  281. package/dist/types/pushConfig.d.ts +0 -1
  282. package/dist/types/pushConfig.d.ts.map +1 -1
  283. package/dist/types/pushLog.d.ts.map +1 -1
  284. package/dist/types/reviewDoc/reviewDoc.d.ts +2 -17
  285. package/dist/types/reviewDoc/reviewDoc.d.ts.map +1 -1
  286. package/dist/types/reviewDoc/reviewDocBlockAware.d.ts +0 -1
  287. package/dist/types/reviewDoc/reviewDocBlockAware.d.ts.map +1 -1
  288. package/dist/types/reviewDoc/reviewDocLog.d.ts +1 -2
  289. package/dist/types/reviewDoc/reviewDocLog.d.ts.map +1 -1
  290. package/dist/types/scan.d.ts +3 -2
  291. package/dist/types/scan.d.ts.map +1 -1
  292. package/dist/types/searchDoc.d.ts +1 -6
  293. package/dist/types/searchDoc.d.ts.map +1 -1
  294. package/dist/types/test/listMissingTranslations.d.ts +0 -1
  295. package/dist/types/test/listMissingTranslations.d.ts.map +1 -1
  296. package/dist/types/test/test.d.ts +0 -1
  297. package/dist/types/test/test.d.ts.map +1 -1
  298. package/dist/types/translateDoc/translateDoc.d.ts +1 -16
  299. package/dist/types/translateDoc/translateDoc.d.ts.map +1 -1
  300. package/dist/types/translateDoc/translateFile.d.ts +1 -16
  301. package/dist/types/translateDoc/translateFile.d.ts.map +1 -1
  302. package/dist/types/translateDoc/types.d.ts +1 -2
  303. package/dist/types/translateDoc/types.d.ts.map +1 -1
  304. package/dist/types/translateDoc/validation.d.ts +0 -1
  305. package/dist/types/translateDoc/validation.d.ts.map +1 -1
  306. package/dist/types/utils/calculateChunks.d.ts.map +1 -1
  307. package/dist/types/utils/checkAccess.d.ts +0 -1
  308. package/dist/types/utils/checkAccess.d.ts.map +1 -1
  309. package/dist/types/utils/checkConfigConsistency.d.ts.map +1 -1
  310. package/dist/types/utils/checkFileModifiedRange.d.ts.map +1 -1
  311. package/dist/types/utils/checkLastUpdateTime.d.ts.map +1 -1
  312. package/dist/types/utils/chunkInference.d.ts +0 -1
  313. package/dist/types/utils/chunkInference.d.ts.map +1 -1
  314. package/dist/types/utils/fixChunkStartEndChars.d.ts.map +1 -1
  315. package/dist/types/utils/formatLineRanges.d.ts.map +1 -1
  316. package/dist/types/utils/formatTimeDiff.d.ts.map +1 -1
  317. package/dist/types/utils/getIsFileUpdatedRecently.d.ts.map +1 -1
  318. package/dist/types/utils/getOutputFilePath.d.ts +0 -1
  319. package/dist/types/utils/getOutputFilePath.d.ts.map +1 -1
  320. package/dist/types/utils/getParentPackageJSON.d.ts.map +1 -1
  321. package/dist/types/utils/listSpecialChars.d.ts +4 -2
  322. package/dist/types/utils/listSpecialChars.d.ts.map +1 -1
  323. package/dist/types/utils/mapChunksBetweenFiles.d.ts +0 -1
  324. package/dist/types/utils/mapChunksBetweenFiles.d.ts.map +1 -1
  325. package/dist/types/utils/openBrowser.d.ts.map +1 -1
  326. package/dist/types/utils/reorderParagraphs.d.ts.map +1 -1
  327. package/dist/types/utils/selectCmsEnvironment.d.ts +0 -1
  328. package/dist/types/utils/selectCmsEnvironment.d.ts.map +1 -1
  329. package/dist/types/utils/setupAI.d.ts +1 -3
  330. package/dist/types/utils/setupAI.d.ts.map +1 -1
  331. package/dist/types/watch.d.ts +0 -1
  332. package/dist/types/watch.d.ts.map +1 -1
  333. package/package.json +17 -17
@@ -1 +1 @@
1
- {"version":3,"file":"pullLog.cjs","names":["spinnerFrames","ANSIColors"],"sources":["../../../src/push/pullLog.ts"],"sourcesContent":["import type { DictionaryStatus } from '@intlayer/chokidar/build';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, spinnerFrames } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\n\nexport type PullStatus = {\n dictionaryKey: string;\n status: DictionaryStatus | 'pending' | 'fetching';\n errorMessage?: string;\n};\n\nexport class PullLogger {\n private statuses: PullStatus[] = [];\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private readonly spinnerFrames = spinnerFrames;\n private isFinished = false;\n private readonly prefix: string;\n private lastRenderedState: string = '';\n\n constructor() {\n const configuration = getConfiguration();\n this.prefix = configuration.log.prefix;\n }\n\n update(newStatuses: PullStatus[]) {\n if (this.isFinished) return;\n for (const status of newStatuses) {\n const index = this.statuses.findIndex(\n (s) => s.dictionaryKey === status.dictionaryKey\n );\n if (index >= 0) {\n this.statuses[index] = status;\n } else {\n this.statuses.push(status);\n }\n }\n\n this.startSpinner();\n this.render();\n }\n\n finish() {\n this.isFinished = true;\n this.stopSpinner();\n this.render();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n private render() {\n const { total, done, success, errors } = this.computeProgress();\n\n const frame = this.spinnerFrames[this.spinnerIndex];\n const lines: string[] = [];\n\n const isDone = done === total;\n const progressLabel = `dictionaries: ${done}/${total}`;\n const details: string[] = [];\n if (success > 0) details.push(`ok: ${success}`);\n if (errors > 0) details.push(colorize(`errors: ${errors}`, ANSIColors.RED));\n\n const suffix = details.length > 0 ? ` (${details.join(', ')})` : '';\n\n if (isDone) {\n lines.push(\n `${this.prefix} ${colorize('✔', ANSIColors.GREEN)} fetched ${progressLabel}${suffix}`\n );\n } else {\n lines.push(\n `${this.prefix} ${colorize(frame, ANSIColors.BLUE)} fetching ${progressLabel}${suffix}`\n );\n }\n\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) {\n return;\n }\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n const line = lines[i];\n if (line !== undefined) {\n process.stdout.write(line);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines = lines.length;\n }\n\n private computeProgress() {\n const keys = new Set(this.statuses.map((s) => s.dictionaryKey));\n\n const doneSet = new Set<DictionaryStatus | 'error'>([\n 'fetched',\n 'imported',\n 'updated',\n 'up-to-date',\n 'reimported in JSON',\n 'new content file',\n 'error',\n ] as const);\n\n const successesSet = new Set<DictionaryStatus>([\n 'fetched',\n 'imported',\n 'updated',\n 'up-to-date',\n 'reimported in JSON',\n 'new content file',\n ] as const);\n\n const done = this.statuses.filter((s) =>\n doneSet.has(s.status as any)\n ).length;\n const success = this.statuses.filter((s) =>\n successesSet.has(s.status as any)\n ).length;\n const errors = this.statuses.filter((s) => s.status === 'error').length;\n\n return {\n total: keys.size,\n done,\n success,\n errors,\n } as const;\n }\n}\n"],"mappings":";;;;;;;;AAWA,IAAa,aAAb,MAAwB;CACtB,AAAQ,WAAyB,EAAE;CACnC,AAAQ,eAAsC;CAC9C,AAAQ,eAAe;CACvB,AAAQ,gBAAgB;CACxB,AAAiB,gBAAgBA;CACjC,AAAQ,aAAa;CACrB,AAAiB;CACjB,AAAQ,oBAA4B;CAEpC,cAAc;EACZ,MAAM,6DAAkC;AACxC,OAAK,SAAS,cAAc,IAAI;;CAGlC,OAAO,aAA2B;AAChC,MAAI,KAAK,WAAY;AACrB,OAAK,MAAM,UAAU,aAAa;GAChC,MAAM,QAAQ,KAAK,SAAS,WACzB,MAAM,EAAE,kBAAkB,OAAO,cACnC;AACD,OAAI,SAAS,EACX,MAAK,SAAS,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,KAAK,eAAe,MAAM,OAAO;AACpE,OAAK,IAAI,IAAI,GAAG,IAAI,mBAAmB,KAAK;AAC1C,WAAQ,OAAO,MAAM,UAAU;GAC/B,MAAM,OAAO,MAAM;AACnB,OAAI,SAAS,OACX,SAAQ,OAAO,MAAM,KAAK;AAE5B,WAAQ,OAAO,MAAM,KAAK;;AAG5B,OAAK,gBAAgB,MAAM;;CAG7B,AAAQ,kBAAkB;EACxB,MAAM,OAAO,IAAI,IAAI,KAAK,SAAS,KAAK,MAAM,EAAE,cAAc,CAAC;EAE/D,MAAM,UAAU,IAAI,IAAgC;GAClD;GACA;GACA;GACA;GACA;GACA;GACA;GACD,CAAU;EAEX,MAAM,eAAe,IAAI,IAAsB;GAC7C;GACA;GACA;GACA;GACA;GACA;GACD,CAAU;EAEX,MAAM,OAAO,KAAK,SAAS,QAAQ,MACjC,QAAQ,IAAI,EAAE,OAAc,CAC7B,CAAC;EACF,MAAM,UAAU,KAAK,SAAS,QAAQ,MACpC,aAAa,IAAI,EAAE,OAAc,CAClC,CAAC;EACF,MAAM,SAAS,KAAK,SAAS,QAAQ,MAAM,EAAE,WAAW,QAAQ,CAAC;AAEjE,SAAO;GACL,OAAO,KAAK;GACZ;GACA;GACA;GACD"}
1
+ {"version":3,"file":"pullLog.cjs","names":["spinnerFrames","ANSIColors"],"sources":["../../../src/push/pullLog.ts"],"sourcesContent":["import * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, spinnerFrames } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { DictionaryStatus } from '@intlayer/engine/build';\n\nexport type PullStatus = {\n dictionaryKey: string;\n status: DictionaryStatus | 'pending' | 'fetching';\n errorMessage?: string;\n};\n\nexport class PullLogger {\n private statuses: PullStatus[] = [];\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private readonly spinnerFrames = spinnerFrames;\n private isFinished = false;\n private readonly prefix: string;\n private lastRenderedState: string = '';\n\n constructor() {\n const configuration = getConfiguration();\n this.prefix = configuration.log.prefix;\n }\n\n update(newStatuses: PullStatus[]) {\n if (this.isFinished) return;\n for (const status of newStatuses) {\n const index = this.statuses.findIndex(\n (s) => s.dictionaryKey === status.dictionaryKey\n );\n if (index >= 0) {\n this.statuses[index] = status;\n } else {\n this.statuses.push(status);\n }\n }\n\n this.startSpinner();\n this.render();\n }\n\n finish() {\n this.isFinished = true;\n this.stopSpinner();\n this.render();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n private render() {\n const { total, done, success, errors } = this.computeProgress();\n\n const frame = this.spinnerFrames[this.spinnerIndex];\n const lines: string[] = [];\n\n const isDone = done === total;\n const progressLabel = `dictionaries: ${done}/${total}`;\n const details: string[] = [];\n if (success > 0) details.push(`ok: ${success}`);\n if (errors > 0) details.push(colorize(`errors: ${errors}`, ANSIColors.RED));\n\n const suffix = details.length > 0 ? ` (${details.join(', ')})` : '';\n\n if (isDone) {\n lines.push(\n `${this.prefix} ${colorize('✔', ANSIColors.GREEN)} fetched ${progressLabel}${suffix}`\n );\n } else {\n lines.push(\n `${this.prefix} ${colorize(frame, ANSIColors.BLUE)} fetching ${progressLabel}${suffix}`\n );\n }\n\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) {\n return;\n }\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n const line = lines[i];\n if (line !== undefined) {\n process.stdout.write(line);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines = lines.length;\n }\n\n private computeProgress() {\n const keys = new Set(this.statuses.map((s) => s.dictionaryKey));\n\n const doneSet = new Set<DictionaryStatus | 'error'>([\n 'fetched',\n 'imported',\n 'updated',\n 'up-to-date',\n 'reimported in JSON',\n 'new content file',\n 'error',\n ] as const);\n\n const successesSet = new Set<DictionaryStatus>([\n 'fetched',\n 'imported',\n 'updated',\n 'up-to-date',\n 'reimported in JSON',\n 'new content file',\n ] as const);\n\n const done = this.statuses.filter((s) =>\n doneSet.has(s.status as any)\n ).length;\n const success = this.statuses.filter((s) =>\n successesSet.has(s.status as any)\n ).length;\n const errors = this.statuses.filter((s) => s.status === 'error').length;\n\n return {\n total: keys.size,\n done,\n success,\n errors,\n } as const;\n }\n}\n"],"mappings":";;;;;;;;AAWA,IAAa,aAAb,MAAwB;CACtB,AAAQ,WAAyB,CAAC;CAClC,AAAQ,eAAsC;CAC9C,AAAQ,eAAe;CACvB,AAAQ,gBAAgB;CACxB,AAAiB,gBAAgBA;CACjC,AAAQ,aAAa;CACrB,AAAiB;CACjB,AAAQ,oBAA4B;CAEpC,cAAc;EACZ,MAAM,4DAAiC;EACvC,KAAK,SAAS,cAAc,IAAI;CAClC;CAEA,OAAO,aAA2B;EAChC,IAAI,KAAK,YAAY;EACrB,KAAK,MAAM,UAAU,aAAa;GAChC,MAAM,QAAQ,KAAK,SAAS,WACzB,MAAM,EAAE,kBAAkB,OAAO,aACpC;GACA,IAAI,SAAS,GACX,KAAK,SAAS,SAAS;QAEvB,KAAK,SAAS,KAAK,MAAM;EAE7B;EAEA,KAAK,aAAa;EAClB,KAAK,OAAO;CACd;CAEA,SAAS;EACP,KAAK,aAAa;EAClB,KAAK,YAAY;EACjB,KAAK,OAAO;CACd;CAEA,AAAQ,eAAe;EACrB,IAAI,KAAK,gBAAgB,KAAK,YAAY;EAC1C,KAAK,eAAe,kBAAkB;GACpC,KAAK,gBAAgB,KAAK,eAAe,KAAK,KAAK,cAAc;GACjE,KAAK,OAAO;EACd,GAAG,GAA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AAI,KAAK,SAAS,KAAK,MAAM,EAAE,aAAa,CAAC;EAE9D,MAAM,0BAAU,IAAI,IAAgC;GAClD;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAAU;EAEV,MAAM,+BAAe,IAAI,IAAsB;GAC7C;GACA;GACA;GACA;GACA;GACA;EACF,CAAU;EAEV,MAAM,OAAO,KAAK,SAAS,QAAQ,MACjC,QAAQ,IAAI,EAAE,MAAa,CAC7B,CAAC,CAAC;EACF,MAAM,UAAU,KAAK,SAAS,QAAQ,MACpC,aAAa,IAAI,EAAE,MAAa,CAClC,CAAC,CAAC;EACF,MAAM,SAAS,KAAK,SAAS,QAAQ,MAAM,EAAE,WAAW,OAAO,CAAC,CAAC;EAEjE,OAAO;GACL,OAAO,KAAK;GACZ;GACA;GACA;EACF;CACF;AACF"}
@@ -4,13 +4,13 @@ const require_utils_checkAccess = require('../utils/checkAccess.cjs');
4
4
  const require_utils_selectCmsEnvironment = require('../utils/selectCmsEnvironment.cjs');
5
5
  const require_pushLog = require('../pushLog.cjs');
6
6
  let node_path = require("node:path");
7
- let _intlayer_chokidar_build = require("@intlayer/chokidar/build");
8
- let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
9
- let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
10
7
  let _intlayer_config_colors = require("@intlayer/config/colors");
11
8
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
12
9
  let _intlayer_config_logger = require("@intlayer/config/logger");
13
10
  let _intlayer_config_node = require("@intlayer/config/node");
11
+ let _intlayer_engine_build = require("@intlayer/engine/build");
12
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
13
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
14
14
  let _intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
15
15
  let node_fs_promises = require("node:fs/promises");
16
16
  node_fs_promises = require_runtime.__toESM(node_fs_promises);
@@ -46,10 +46,10 @@ const getIconAndColor = (status) => {
46
46
  */
47
47
  const push = async (options) => {
48
48
  const config = (0, _intlayer_config_node.getConfiguration)(options?.configOptions);
49
- (0, _intlayer_chokidar_cli.logConfigDetails)(options?.configOptions);
49
+ (0, _intlayer_engine_cli.logConfigDetails)(options?.configOptions);
50
50
  const appLogger = (0, _intlayer_config_logger.getAppLogger)(config);
51
- if (options?.build === true) await (0, _intlayer_chokidar_build.prepareIntlayer)(config, { forceRun: true });
52
- else if (typeof options?.build === "undefined") await (0, _intlayer_chokidar_build.prepareIntlayer)(config);
51
+ if (options?.build === true) await (0, _intlayer_engine_build.prepareIntlayer)(config, { forceRun: true });
52
+ else if (typeof options?.build === "undefined") await (0, _intlayer_engine_build.prepareIntlayer)(config);
53
53
  try {
54
54
  if (!await require_utils_checkAccess.checkCMSAuth(config)) return;
55
55
  const intlayerAPI = await require_utils_checkAccess.getAuthenticatedAPI(config);
@@ -77,7 +77,7 @@ const push = async (options) => {
77
77
  dictionaries = dictionaries.filter((dictionary) => options.dictionaries?.includes(dictionary.key));
78
78
  }
79
79
  if (options?.gitOptions) {
80
- const gitFiles = await (0, _intlayer_chokidar_cli.listGitFiles)(options.gitOptions);
80
+ const gitFiles = await (0, _intlayer_engine_cli.listGitFiles)(options.gitOptions);
81
81
  dictionaries = dictionaries.filter((dictionary) => gitFiles.includes((0, node_path.join)(config.system.baseDir, dictionary.filePath ?? "")));
82
82
  }
83
83
  if (dictionaries.length === 0) {
@@ -114,7 +114,7 @@ const push = async (options) => {
114
114
  for (const remoteDictionaryData of allDictionaries) {
115
115
  const localDictionary = unmergedDictionariesRecord[remoteDictionaryData.key]?.find((dictionary) => dictionary.localId === remoteDictionaryData.localId);
116
116
  if (!localDictionary) continue;
117
- await (0, _intlayer_chokidar_build.writeContentDeclaration)({
117
+ await (0, _intlayer_engine_build.writeContentDeclaration)({
118
118
  ...localDictionary,
119
119
  id: remoteDictionaryData.id
120
120
  }, config);
@@ -150,7 +150,7 @@ const push = async (options) => {
150
150
  }]);
151
151
  }
152
152
  };
153
- await (0, _intlayer_chokidar_utils.parallelize)(dictionariesStatuses, processDictionary, 5);
153
+ await (0, _intlayer_engine_utils.parallelize)(dictionariesStatuses, processDictionary, 5);
154
154
  logger.finish();
155
155
  for (const dictionaryStatus of dictionariesStatuses) {
156
156
  const { icon, color } = getIconAndColor(dictionaryStatus.status);
@@ -193,11 +193,11 @@ const deleteLocalDictionaries = async (dictionariesToDelete, options) => {
193
193
  const stats = await node_fs_promises.lstat(filePath);
194
194
  if (stats.isFile()) {
195
195
  await node_fs_promises.unlink(filePath);
196
- appLogger(`Deleted file ${(0, _intlayer_chokidar_utils.formatPath)(filePath)}`, {});
197
- } else if (stats.isDirectory()) appLogger(`Path is a directory ${(0, _intlayer_chokidar_utils.formatPath)(filePath)}, skipping.`, {});
198
- else appLogger(`Unknown file type for ${(0, _intlayer_chokidar_utils.formatPath)(filePath)}, skipping.`, {});
196
+ appLogger(`Deleted file ${(0, _intlayer_engine_utils.formatPath)(filePath)}`, {});
197
+ } else if (stats.isDirectory()) appLogger(`Path is a directory ${(0, _intlayer_engine_utils.formatPath)(filePath)}, skipping.`, {});
198
+ else appLogger(`Unknown file type for ${(0, _intlayer_engine_utils.formatPath)(filePath)}, skipping.`, {});
199
199
  } catch (err) {
200
- appLogger(`Error deleting ${(0, _intlayer_chokidar_utils.formatPath)(filePath)}: ${err}`, { level: "error" });
200
+ appLogger(`Error deleting ${(0, _intlayer_engine_utils.formatPath)(filePath)}: ${err}`, { level: "error" });
201
201
  }
202
202
  };
203
203
 
@@ -1 +1 @@
1
- {"version":3,"file":"push.cjs","names":["ANSIColors","checkCMSAuth","getAuthenticatedAPI","selectCmsEnvironment","PushLogger","fsPromises"],"sources":["../../../src/push/push.ts"],"sourcesContent":["import * as fsPromises from 'node:fs/promises';\nimport { join } from 'node:path';\nimport {\n prepareIntlayer,\n writeContentDeclaration,\n} from '@intlayer/chokidar/build';\nimport {\n type ListGitFilesOptions,\n listGitFiles,\n logConfigDetails,\n} from '@intlayer/chokidar/cli';\nimport { formatPath, parallelize } from '@intlayer/chokidar/utils';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizeKey, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport { PushLogger, type PushStatus } from '../pushLog';\nimport { checkCMSAuth, getAuthenticatedAPI } from '../utils/checkAccess';\nimport { selectCmsEnvironment } from '../utils/selectCmsEnvironment';\n\ntype PushOptions = {\n deleteLocaleDictionary?: boolean;\n keepLocaleDictionary?: boolean;\n dictionaries?: string[];\n gitOptions?: ListGitFilesOptions;\n configOptions?: GetConfigurationOptions;\n build?: boolean;\n};\n\ntype DictionariesStatus = {\n dictionary: Dictionary;\n status:\n | 'pending'\n | 'pushing'\n | 'modified'\n | 'pushed'\n | 'up-to-date'\n | 'unknown'\n | 'error';\n error?: Error;\n errorMessage?: string;\n};\n\n// Print per-dictionary summary similar to loadDictionaries\nconst statusIconsAndColors = {\n pushed: { icon: '✔', color: ANSIColors.GREEN },\n modified: { icon: '✔', color: ANSIColors.GREEN },\n 'up-to-date': { icon: '=', color: ANSIColors.GREY },\n error: { icon: '✖', color: ANSIColors.RED },\n default: { icon: '⏲', color: ANSIColors.BLUE },\n};\n\nconst getIconAndColor = (status: DictionariesStatus['status']) => {\n return (\n statusIconsAndColors[status as keyof typeof statusIconsAndColors] ??\n statusIconsAndColors.default\n );\n};\n\n/**\n * Get all local dictionaries and push them simultaneously.\n */\nexport const push = async (options?: PushOptions): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n if (options?.build === true) {\n await prepareIntlayer(config, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(config);\n }\n\n try {\n const hasCMSAuth = await checkCMSAuth(config);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = await getAuthenticatedAPI(config);\n\n await selectCmsEnvironment(\n options?.configOptions?.env,\n intlayerAPI,\n config\n );\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n const allDictionaries = Object.values(unmergedDictionariesRecord).flat();\n\n const customLocations = Array.from(\n new Set(\n allDictionaries\n .map((dictionary) => dictionary.location)\n .filter(\n (location) =>\n location && !['remote', 'local', 'hybrid'].includes(location)\n )\n )\n ) as string[];\n\n // Include all custom locations automatically — no interactive prompt needed.\n const selectedCustomLocations: string[] = customLocations;\n\n let dictionaries: Dictionary[] = allDictionaries.filter((dictionary) => {\n const location =\n dictionary.location ?? config.dictionary?.location ?? 'local';\n\n return (\n location === 'remote' ||\n location === 'hybrid' ||\n selectedCustomLocations.includes(location)\n );\n });\n\n // Check if the dictionaries list is empty after filtering by location\n if (dictionaries.length === 0) {\n appLogger(\n `No dictionaries found to push. Only dictionaries with location ${colorize('remote', ANSIColors.BLUE, ANSIColors.RESET)}, ${colorize('hybrid', ANSIColors.BLUE, ANSIColors.RESET)} or selected custom locations are pushed.`,\n { level: 'warn' }\n );\n appLogger(\n `You can set the location in your dictionary file (e.g. ${colorize(\"{ key: 'my-key', location: 'hybrid', ... }\", ANSIColors.BLUE, ANSIColors.RESET)} or globally in your intlayer.config.ts file (e.g. ${colorize(\"{ dictionary: { location: 'hybrid' } }\", ANSIColors.BLUE, ANSIColors.RESET)}).`,\n { level: 'info' }\n );\n return;\n }\n\n const existingDictionariesKeys: string[] = Object.keys(\n unmergedDictionariesRecord\n );\n\n if (options?.dictionaries) {\n // Check if the provided dictionaries exist\n const noneExistingDictionariesOption = options.dictionaries.filter(\n (dictionaryId) => !existingDictionariesKeys.includes(dictionaryId)\n );\n\n if (noneExistingDictionariesOption.length > 0) {\n appLogger(\n `The following dictionaries do not exist: ${noneExistingDictionariesOption.join(\n ', '\n )} and have been ignored.`,\n {\n level: 'error',\n }\n );\n }\n\n // Filter the dictionaries from the provided list of IDs\n dictionaries = dictionaries.filter((dictionary) =>\n options.dictionaries?.includes(dictionary.key)\n );\n }\n\n if (options?.gitOptions) {\n const gitFiles = await listGitFiles(options.gitOptions);\n\n dictionaries = dictionaries.filter((dictionary) =>\n gitFiles.includes(\n join(config.system.baseDir, dictionary.filePath ?? '')\n )\n );\n }\n\n // Check if the dictionaries list is empty\n if (dictionaries.length === 0) {\n appLogger('No local dictionaries found', {\n level: 'error',\n });\n return;\n }\n\n appLogger('Pushing dictionaries:');\n\n // Prepare dictionaries statuses\n const dictionariesStatuses: DictionariesStatus[] = dictionaries.map(\n (dictionary) => ({\n dictionary,\n status: 'pending',\n })\n );\n\n // Initialize aggregated logger similar to loadDictionaries\n const logger = new PushLogger();\n logger.update(\n dictionariesStatuses.map<PushStatus>((s) => ({\n dictionaryKey: s.dictionary.key,\n status: 'pending',\n }))\n );\n\n const successfullyPushedDictionaries: Dictionary[] = [];\n\n const processDictionary = async (\n statusObj: DictionariesStatus\n ): Promise<void> => {\n statusObj.status = 'pushing';\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushing' },\n ]);\n\n try {\n const pushResult = await intlayerAPI.dictionary.pushDictionaries([\n statusObj.dictionary,\n ]);\n\n const updatedDictionaries = pushResult.data?.updatedDictionaries ?? [];\n const newDictionaries = pushResult.data?.newDictionaries ?? [];\n const upToDateDictionaries =\n pushResult.data?.upToDateDictionaries ?? [];\n\n const allDictionaries = [\n ...updatedDictionaries,\n ...newDictionaries,\n ...upToDateDictionaries,\n ];\n\n for (const remoteDictionaryData of allDictionaries) {\n const localDictionary = unmergedDictionariesRecord[\n remoteDictionaryData.key\n ]?.find(\n (dictionary) => dictionary.localId === remoteDictionaryData.localId\n );\n\n if (!localDictionary) continue;\n\n await writeContentDeclaration(\n { ...localDictionary, id: remoteDictionaryData.id },\n config\n );\n }\n\n if (\n updatedDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'modified';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'modified' },\n ]);\n } else if (\n newDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'pushed';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushed' },\n ]);\n } else if (\n upToDateDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'up-to-date';\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'up-to-date' },\n ]);\n } else {\n statusObj.status = 'unknown';\n }\n } catch (error) {\n statusObj.status = 'error';\n statusObj.error = error as Error;\n statusObj.errorMessage = `Error pushing dictionary ${statusObj.dictionary.key}: ${error}`;\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'error' },\n ]);\n }\n };\n\n // Process dictionaries in parallel with a concurrency limit (reuse parallelize)\n await parallelize(dictionariesStatuses, processDictionary, 5);\n\n // Stop the logger and render final state\n logger.finish();\n\n for (const dictionaryStatus of dictionariesStatuses) {\n const { icon, color } = getIconAndColor(dictionaryStatus.status);\n appLogger(\n ` - ${colorizeKey(dictionaryStatus.dictionary.key)} ${ANSIColors.GREY}[${color}${icon} ${dictionaryStatus.status}${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n // Output any error messages\n for (const statusObj of dictionariesStatuses) {\n if (statusObj.errorMessage) {\n appLogger(statusObj.errorMessage, {\n level: 'error',\n });\n }\n }\n\n // Handle delete or keep options\n const deleteOption = options?.deleteLocaleDictionary;\n const keepOption = options?.keepLocaleDictionary;\n\n if (deleteOption && keepOption) {\n throw new Error(\n 'Cannot specify both --deleteLocaleDictionary and --keepLocaleDictionary options.'\n );\n }\n\n if (deleteOption) {\n // Delete only the successfully pushed dictionaries\n await deleteLocalDictionaries(successfullyPushedDictionaries, options);\n } else if (keepOption) {\n // Do nothing, keep the local dictionaries\n } else {\n // Ask the user\n const remoteDictionaries = successfullyPushedDictionaries.filter(\n (dictionary) => dictionary.location === 'remote'\n );\n const remoteDictionariesKeys = remoteDictionaries.map(\n (dictionary) => dictionary.key\n );\n\n if (remoteDictionaries.length > 0) {\n const { confirm, isCancel } = await import('@clack/prompts');\n\n const shouldDelete = await confirm({\n message: `Do you want to delete the local dictionaries that were successfully pushed? ${colorize('(Dictionaries:', ANSIColors.GREY, ANSIColors.RESET)} ${colorizeKey(remoteDictionariesKeys)}${colorize(')', ANSIColors.GREY, ANSIColors.RESET)}`,\n initialValue: false,\n });\n\n if (isCancel(shouldDelete)) {\n return;\n }\n\n if (shouldDelete) {\n await deleteLocalDictionaries(remoteDictionaries, options);\n }\n }\n }\n } catch (error) {\n appLogger(error, {\n level: 'error',\n });\n }\n};\n\nconst deleteLocalDictionaries = async (\n dictionariesToDelete: Dictionary[],\n options?: PushOptions\n): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n // Use a Set to collect all unique file paths\n const filePathsSet: Set<string> = new Set();\n\n for (const dictionary of dictionariesToDelete) {\n const { filePath } = dictionary;\n\n if (!filePath) {\n appLogger(\n `Dictionary ${colorizeKey(dictionary.key)} does not have a file path`,\n {\n level: 'error',\n }\n );\n continue;\n }\n\n filePathsSet.add(filePath);\n }\n\n for (const filePath of filePathsSet) {\n try {\n const stats = await fsPromises.lstat(filePath);\n\n if (stats.isFile()) {\n await fsPromises.unlink(filePath);\n appLogger(`Deleted file ${formatPath(filePath)}`, {});\n } else if (stats.isDirectory()) {\n appLogger(`Path is a directory ${formatPath(filePath)}, skipping.`, {});\n } else {\n appLogger(\n `Unknown file type for ${formatPath(filePath)}, skipping.`,\n {}\n );\n }\n } catch (err) {\n appLogger(`Error deleting ${formatPath(filePath)}: ${err}`, {\n level: 'error',\n });\n }\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgDA,MAAM,uBAAuB;CAC3B,QAAQ;EAAE,MAAM;EAAK,OAAOA,wBAAW;EAAO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MAAMK,iBAAW,MAAM,SAAS;AAE9C,MAAI,MAAM,QAAQ,EAAE;AAClB,SAAMA,iBAAW,OAAO,SAAS;AACjC,aAAU,yDAA2B,SAAS,IAAI,EAAE,CAAC;aAC5C,MAAM,aAAa,CAC5B,WAAU,gEAAkC,SAAS,CAAC,cAAc,EAAE,CAAC;MAEvE,WACE,kEAAoC,SAAS,CAAC,cAC9C,EAAE,CACH;UAEI,KAAK;AACZ,YAAU,2DAA6B,SAAS,CAAC,IAAI,OAAO,EAC1D,OAAO,SACR,CAAC"}
1
+ {"version":3,"file":"push.cjs","names":["ANSIColors","checkCMSAuth","getAuthenticatedAPI","selectCmsEnvironment","PushLogger","fsPromises"],"sources":["../../../src/push/push.ts"],"sourcesContent":["import * as fsPromises from 'node:fs/promises';\nimport { join } from 'node:path';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizeKey, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport {\n prepareIntlayer,\n writeContentDeclaration,\n} from '@intlayer/engine/build';\nimport {\n type ListGitFilesOptions,\n listGitFiles,\n logConfigDetails,\n} from '@intlayer/engine/cli';\nimport { formatPath, parallelize } from '@intlayer/engine/utils';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport { PushLogger, type PushStatus } from '../pushLog';\nimport { checkCMSAuth, getAuthenticatedAPI } from '../utils/checkAccess';\nimport { selectCmsEnvironment } from '../utils/selectCmsEnvironment';\n\ntype PushOptions = {\n deleteLocaleDictionary?: boolean;\n keepLocaleDictionary?: boolean;\n dictionaries?: string[];\n gitOptions?: ListGitFilesOptions;\n configOptions?: GetConfigurationOptions;\n build?: boolean;\n};\n\ntype DictionariesStatus = {\n dictionary: Dictionary;\n status:\n | 'pending'\n | 'pushing'\n | 'modified'\n | 'pushed'\n | 'up-to-date'\n | 'unknown'\n | 'error';\n error?: Error;\n errorMessage?: string;\n};\n\n// Print per-dictionary summary similar to loadDictionaries\nconst statusIconsAndColors = {\n pushed: { icon: '✔', color: ANSIColors.GREEN },\n modified: { icon: '✔', color: ANSIColors.GREEN },\n 'up-to-date': { icon: '=', color: ANSIColors.GREY },\n error: { icon: '✖', color: ANSIColors.RED },\n default: { icon: '⏲', color: ANSIColors.BLUE },\n};\n\nconst getIconAndColor = (status: DictionariesStatus['status']) => {\n return (\n statusIconsAndColors[status as keyof typeof statusIconsAndColors] ??\n statusIconsAndColors.default\n );\n};\n\n/**\n * Get all local dictionaries and push them simultaneously.\n */\nexport const push = async (options?: PushOptions): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n if (options?.build === true) {\n await prepareIntlayer(config, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(config);\n }\n\n try {\n const hasCMSAuth = await checkCMSAuth(config);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = await getAuthenticatedAPI(config);\n\n await selectCmsEnvironment(\n options?.configOptions?.env,\n intlayerAPI,\n config\n );\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n const allDictionaries = Object.values(unmergedDictionariesRecord).flat();\n\n const customLocations = Array.from(\n new Set(\n allDictionaries\n .map((dictionary) => dictionary.location)\n .filter(\n (location) =>\n location && !['remote', 'local', 'hybrid'].includes(location)\n )\n )\n ) as string[];\n\n // Include all custom locations automatically — no interactive prompt needed.\n const selectedCustomLocations: string[] = customLocations;\n\n let dictionaries: Dictionary[] = allDictionaries.filter((dictionary) => {\n const location =\n dictionary.location ?? config.dictionary?.location ?? 'local';\n\n return (\n location === 'remote' ||\n location === 'hybrid' ||\n selectedCustomLocations.includes(location)\n );\n });\n\n // Check if the dictionaries list is empty after filtering by location\n if (dictionaries.length === 0) {\n appLogger(\n `No dictionaries found to push. Only dictionaries with location ${colorize('remote', ANSIColors.BLUE, ANSIColors.RESET)}, ${colorize('hybrid', ANSIColors.BLUE, ANSIColors.RESET)} or selected custom locations are pushed.`,\n { level: 'warn' }\n );\n appLogger(\n `You can set the location in your dictionary file (e.g. ${colorize(\"{ key: 'my-key', location: 'hybrid', ... }\", ANSIColors.BLUE, ANSIColors.RESET)} or globally in your intlayer.config.ts file (e.g. ${colorize(\"{ dictionary: { location: 'hybrid' } }\", ANSIColors.BLUE, ANSIColors.RESET)}).`,\n { level: 'info' }\n );\n return;\n }\n\n const existingDictionariesKeys: string[] = Object.keys(\n unmergedDictionariesRecord\n );\n\n if (options?.dictionaries) {\n // Check if the provided dictionaries exist\n const noneExistingDictionariesOption = options.dictionaries.filter(\n (dictionaryId) => !existingDictionariesKeys.includes(dictionaryId)\n );\n\n if (noneExistingDictionariesOption.length > 0) {\n appLogger(\n `The following dictionaries do not exist: ${noneExistingDictionariesOption.join(\n ', '\n )} and have been ignored.`,\n {\n level: 'error',\n }\n );\n }\n\n // Filter the dictionaries from the provided list of IDs\n dictionaries = dictionaries.filter((dictionary) =>\n options.dictionaries?.includes(dictionary.key)\n );\n }\n\n if (options?.gitOptions) {\n const gitFiles = await listGitFiles(options.gitOptions);\n\n dictionaries = dictionaries.filter((dictionary) =>\n gitFiles.includes(\n join(config.system.baseDir, dictionary.filePath ?? '')\n )\n );\n }\n\n // Check if the dictionaries list is empty\n if (dictionaries.length === 0) {\n appLogger('No local dictionaries found', {\n level: 'error',\n });\n return;\n }\n\n appLogger('Pushing dictionaries:');\n\n // Prepare dictionaries statuses\n const dictionariesStatuses: DictionariesStatus[] = dictionaries.map(\n (dictionary) => ({\n dictionary,\n status: 'pending',\n })\n );\n\n // Initialize aggregated logger similar to loadDictionaries\n const logger = new PushLogger();\n logger.update(\n dictionariesStatuses.map<PushStatus>((s) => ({\n dictionaryKey: s.dictionary.key,\n status: 'pending',\n }))\n );\n\n const successfullyPushedDictionaries: Dictionary[] = [];\n\n const processDictionary = async (\n statusObj: DictionariesStatus\n ): Promise<void> => {\n statusObj.status = 'pushing';\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushing' },\n ]);\n\n try {\n const pushResult = await intlayerAPI.dictionary.pushDictionaries([\n statusObj.dictionary,\n ]);\n\n const updatedDictionaries = pushResult.data?.updatedDictionaries ?? [];\n const newDictionaries = pushResult.data?.newDictionaries ?? [];\n const upToDateDictionaries =\n pushResult.data?.upToDateDictionaries ?? [];\n\n const allDictionaries = [\n ...updatedDictionaries,\n ...newDictionaries,\n ...upToDateDictionaries,\n ];\n\n for (const remoteDictionaryData of allDictionaries) {\n const localDictionary = unmergedDictionariesRecord[\n remoteDictionaryData.key\n ]?.find(\n (dictionary) => dictionary.localId === remoteDictionaryData.localId\n );\n\n if (!localDictionary) continue;\n\n await writeContentDeclaration(\n { ...localDictionary, id: remoteDictionaryData.id },\n config\n );\n }\n\n if (\n updatedDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'modified';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'modified' },\n ]);\n } else if (\n newDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'pushed';\n successfullyPushedDictionaries.push(statusObj.dictionary);\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'pushed' },\n ]);\n } else if (\n upToDateDictionaries.some(\n (dictionary) => dictionary.key === statusObj.dictionary.key\n )\n ) {\n statusObj.status = 'up-to-date';\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'up-to-date' },\n ]);\n } else {\n statusObj.status = 'unknown';\n }\n } catch (error) {\n statusObj.status = 'error';\n statusObj.error = error as Error;\n statusObj.errorMessage = `Error pushing dictionary ${statusObj.dictionary.key}: ${error}`;\n logger.update([\n { dictionaryKey: statusObj.dictionary.key, status: 'error' },\n ]);\n }\n };\n\n // Process dictionaries in parallel with a concurrency limit (reuse parallelize)\n await parallelize(dictionariesStatuses, processDictionary, 5);\n\n // Stop the logger and render final state\n logger.finish();\n\n for (const dictionaryStatus of dictionariesStatuses) {\n const { icon, color } = getIconAndColor(dictionaryStatus.status);\n appLogger(\n ` - ${colorizeKey(dictionaryStatus.dictionary.key)} ${ANSIColors.GREY}[${color}${icon} ${dictionaryStatus.status}${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n // Output any error messages\n for (const statusObj of dictionariesStatuses) {\n if (statusObj.errorMessage) {\n appLogger(statusObj.errorMessage, {\n level: 'error',\n });\n }\n }\n\n // Handle delete or keep options\n const deleteOption = options?.deleteLocaleDictionary;\n const keepOption = options?.keepLocaleDictionary;\n\n if (deleteOption && keepOption) {\n throw new Error(\n 'Cannot specify both --deleteLocaleDictionary and --keepLocaleDictionary options.'\n );\n }\n\n if (deleteOption) {\n // Delete only the successfully pushed dictionaries\n await deleteLocalDictionaries(successfullyPushedDictionaries, options);\n } else if (keepOption) {\n // Do nothing, keep the local dictionaries\n } else {\n // Ask the user\n const remoteDictionaries = successfullyPushedDictionaries.filter(\n (dictionary) => dictionary.location === 'remote'\n );\n const remoteDictionariesKeys = remoteDictionaries.map(\n (dictionary) => dictionary.key\n );\n\n if (remoteDictionaries.length > 0) {\n const { confirm, isCancel } = await import('@clack/prompts');\n\n const shouldDelete = await confirm({\n message: `Do you want to delete the local dictionaries that were successfully pushed? ${colorize('(Dictionaries:', ANSIColors.GREY, ANSIColors.RESET)} ${colorizeKey(remoteDictionariesKeys)}${colorize(')', ANSIColors.GREY, ANSIColors.RESET)}`,\n initialValue: false,\n });\n\n if (isCancel(shouldDelete)) {\n return;\n }\n\n if (shouldDelete) {\n await deleteLocalDictionaries(remoteDictionaries, options);\n }\n }\n }\n } catch (error) {\n appLogger(error, {\n level: 'error',\n });\n }\n};\n\nconst deleteLocalDictionaries = async (\n dictionariesToDelete: Dictionary[],\n options?: PushOptions\n): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n // Use a Set to collect all unique file paths\n const filePathsSet: Set<string> = new Set();\n\n for (const dictionary of dictionariesToDelete) {\n const { filePath } = dictionary;\n\n if (!filePath) {\n appLogger(\n `Dictionary ${colorizeKey(dictionary.key)} does not have a file path`,\n {\n level: 'error',\n }\n );\n continue;\n }\n\n filePathsSet.add(filePath);\n }\n\n for (const filePath of filePathsSet) {\n try {\n const stats = await fsPromises.lstat(filePath);\n\n if (stats.isFile()) {\n await fsPromises.unlink(filePath);\n appLogger(`Deleted file ${formatPath(filePath)}`, {});\n } else if (stats.isDirectory()) {\n appLogger(`Path is a directory ${formatPath(filePath)}, skipping.`, {});\n } else {\n appLogger(\n `Unknown file type for ${formatPath(filePath)}, skipping.`,\n {}\n );\n }\n } catch (err) {\n appLogger(`Error deleting ${formatPath(filePath)}: ${err}`, {\n level: 'error',\n });\n }\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgDA,MAAM,uBAAuB;CAC3B,QAAQ;EAAE,MAAM;EAAK,OAAOA,wBAAW;CAAM;CAC7C,UAAU;EAAE,MAAM;EAAK,OAAOA,wBAAW;CAAM;CAC/C,cAAc;EAAE,MAAM;EAAK,OAAOA,wBAAW;CAAK;CAClD,OAAO;EAAE,MAAM;EAAK,OAAOA,wBAAW;CAAI;CAC1C,SAAS;EAAE,MAAM;EAAK,OAAOA,wBAAW;CAAK;AAC/C;AAEA,MAAM,mBAAmB,WAAyC;CAChE,OACE,qBAAqB,WACrB,qBAAqB;AAEzB;;;;AAKA,MAAa,OAAO,OAAO,YAAyC;CAClE,MAAM,qDAA0B,SAAS,aAAa;CACtD,2CAAiB,SAAS,aAAa;CAEvC,MAAM,sDAAyB,MAAM;CAErC,IAAI,SAAS,UAAU,MACrB,kDAAsB,QAAQ,EAAE,UAAU,KAAK,CAAC;MAC3C,IAAI,OAAO,SAAS,UAAU,aACnC,kDAAsB,MAAM;CAG9B,IAAI;EAGF,IAAI,CAAC,MAFoBC,uCAAa,MAAM,GAE3B;EAEjB,MAAM,cAAc,MAAMC,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tual/_rolldown/runtime.cjs');
3
2
  const require_utils_checkAccess = require('./utils/checkAccess.cjs');
4
3
  const require_utils_selectCmsEnvironment = require('./utils/selectCmsEnvironment.cjs');
5
- let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
6
4
  let _intlayer_config_colors = require("@intlayer/config/colors");
7
5
  let _intlayer_config_logger = require("@intlayer/config/logger");
8
6
  let _intlayer_config_node = require("@intlayer/config/node");
7
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
9
8
 
10
9
  //#region src/pushConfig.ts
11
10
  const pushConfig = async (options) => {
12
11
  const config = (0, _intlayer_config_node.getConfiguration)(options?.configOptions);
13
- (0, _intlayer_chokidar_cli.logConfigDetails)(options?.configOptions);
12
+ (0, _intlayer_engine_cli.logConfigDetails)(options?.configOptions);
14
13
  const appLogger = (0, _intlayer_config_logger.getAppLogger)(config);
15
14
  if (!await require_utils_checkAccess.checkCMSAuth(config, false)) return;
16
15
  const intlayerAPI = await require_utils_checkAccess.getAuthenticatedAPI(config);
@@ -1 +1 @@
1
- {"version":3,"file":"pushConfig.cjs","names":["checkCMSAuth","getAuthenticatedAPI","selectCmsEnvironment","CYAN","GREY_DARK"],"sources":["../../src/pushConfig.ts"],"sourcesContent":["import { logConfigDetails } from '@intlayer/chokidar/cli';\nimport { CYAN, GREY_DARK } from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeObject,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { checkCMSAuth, getAuthenticatedAPI } from './utils/checkAccess';\nimport { selectCmsEnvironment } from './utils/selectCmsEnvironment';\n\ntype PushOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const pushConfig = async (options?: PushOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n const hasCMSAuth = await checkCMSAuth(config, false);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = await getAuthenticatedAPI(config);\n\n await selectCmsEnvironment(options?.configOptions?.env, intlayerAPI, config);\n\n // Push the project configuration\n const getDictionariesKeysResult =\n await intlayerAPI.project.pushProjectConfiguration(config);\n\n if (!getDictionariesKeysResult.data) {\n appLogger(\n `Error pushing project configuration. Run ${colorize('npx intlayer login', CYAN)} command to authenticate.`,\n {\n level: 'error',\n }\n );\n throw new Error('Error pushing project configuration');\n }\n\n appLogger('Project configuration pushed successfully');\n\n appLogger(colorize('--------------------------------', GREY_DARK));\n appLogger(colorizeObject(getDictionariesKeysResult.data.configuration));\n appLogger(colorize('--------------------------------', GREY_DARK));\n};\n"],"mappings":";;;;;;;;;;AAkBA,MAAa,aAAa,OAAO,YAA0B;CACzD,MAAM,qDAA0B,SAAS,cAAc;AACvD,8CAAiB,SAAS,cAAc;CAExC,MAAM,sDAAyB,OAAO;AAItC,KAAI,CAAC,MAFoBA,uCAAa,QAAQ,MAAM,CAEnC;CAEjB,MAAM,cAAc,MAAMC,8CAAoB,OAAO;AAErD,OAAMC,wDAAqB,SAAS,eAAe,KAAK,aAAa,OAAO;CAG5E,MAAM,4BACJ,MAAM,YAAY,QAAQ,yBAAyB,OAAO;AAE5D,KAAI,CAAC,0BAA0B,MAAM;AACnC,YACE,kFAAqD,sBAAsBC,6BAAK,CAAC,4BACjF,EACE,OAAO,SACR,CACF;AACD,QAAM,IAAI,MAAM,sCAAsC;;AAGxD,WAAU,4CAA4C;AAEtD,iDAAmB,oCAAoCC,kCAAU,CAAC;AAClE,uDAAyB,0BAA0B,KAAK,cAAc,CAAC;AACvE,iDAAmB,oCAAoCA,kCAAU,CAAC"}
1
+ {"version":3,"file":"pushConfig.cjs","names":["checkCMSAuth","getAuthenticatedAPI","selectCmsEnvironment","CYAN","GREY_DARK"],"sources":["../../src/pushConfig.ts"],"sourcesContent":["import { CYAN, GREY_DARK } from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeObject,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { logConfigDetails } from '@intlayer/engine/cli';\nimport { checkCMSAuth, getAuthenticatedAPI } from './utils/checkAccess';\nimport { selectCmsEnvironment } from './utils/selectCmsEnvironment';\n\ntype PushOptions = {\n configOptions?: GetConfigurationOptions;\n};\n\nexport const pushConfig = async (options?: PushOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(config);\n\n const hasCMSAuth = await checkCMSAuth(config, false);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = await getAuthenticatedAPI(config);\n\n await selectCmsEnvironment(options?.configOptions?.env, intlayerAPI, config);\n\n // Push the project configuration\n const getDictionariesKeysResult =\n await intlayerAPI.project.pushProjectConfiguration(config);\n\n if (!getDictionariesKeysResult.data) {\n appLogger(\n `Error pushing project configuration. Run ${colorize('npx intlayer login', CYAN)} command to authenticate.`,\n {\n level: 'error',\n }\n );\n throw new Error('Error pushing project configuration');\n }\n\n appLogger('Project configuration pushed successfully');\n\n appLogger(colorize('--------------------------------', GREY_DARK));\n appLogger(colorizeObject(getDictionariesKeysResult.data.configuration));\n appLogger(colorize('--------------------------------', GREY_DARK));\n};\n"],"mappings":";;;;;;;;;AAkBA,MAAa,aAAa,OAAO,YAA0B;CACzD,MAAM,qDAA0B,SAAS,aAAa;CACtD,2CAAiB,SAAS,aAAa;CAEvC,MAAM,sDAAyB,MAAM;CAIrC,IAAI,CAAC,MAFoBA,uCAAa,QAAQ,KAAK,GAElC;CAEjB,MAAM,cAAc,MAAMC,8CAAoB,MAAM;CAEpD,MAAMC,wDAAqB,SAAS,eAAe,KAAK,aAAa,MAAM;CAG3E,MAAM,4BACJ,MAAM,YAAY,QAAQ,yBAAyB,MAAM;CAE3D,IAAI,CAAC,0BAA0B,MAAM;EACnC,UACE,kFAAqD,sBAAsBC,4BAAI,EAAE,4BACjF,EACE,OAAO,QACT,CACF;EACA,MAAM,IAAI,MAAM,qCAAqC;CACvD;CAEA,UAAU,2CAA2C;CAErD,gDAAmB,oCAAoCC,iCAAS,CAAC;CACjE,sDAAyB,0BAA0B,KAAK,aAAa,CAAC;CACtE,gDAAmB,oCAAoCA,iCAAS,CAAC;AACnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"pushLog.cjs","names":["spinnerFrames","ANSIColors"],"sources":["../../src/pushLog.ts"],"sourcesContent":["import * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeNumber,\n spinnerFrames,\n} from '@intlayer/config/logger';\n\nexport type PushStatus = {\n dictionaryKey: string;\n status:\n | 'pending'\n | 'pushing'\n | 'pushed'\n | 'modified'\n | 'up-to-date'\n | 'error';\n errorMessage?: string;\n};\n\nexport class PushLogger {\n private statuses: PushStatus[] = [];\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private readonly spinnerFrames = spinnerFrames;\n private isFinished = false;\n private lastRenderedState: string = '';\n\n update(newStatuses: PushStatus[]) {\n if (this.isFinished) return;\n for (const status of newStatuses) {\n const index = this.statuses.findIndex(\n (s) => s.dictionaryKey === status.dictionaryKey\n );\n if (index >= 0) {\n this.statuses[index] = status;\n } else {\n this.statuses.push(status);\n }\n }\n\n this.startSpinner();\n this.render();\n }\n\n finish() {\n this.isFinished = true;\n this.stopSpinner();\n this.render();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n private render() {\n const { total, done, pushed, modified, upToDate, errors } =\n this.computeProgress();\n\n const frame = this.spinnerFrames[this.spinnerIndex];\n const lines: string[] = [];\n\n const isDone = done === total;\n\n const progressLabel = `dictionaries: ${colorizeNumber(done)}/${colorizeNumber(total)}`;\n const details: string[] = [];\n if (pushed > 0) details.push(`new: ${colorizeNumber(pushed)}`);\n if (modified > 0) details.push(`modified: ${colorizeNumber(modified)}`);\n if (upToDate > 0)\n details.push(\n colorize(`up-to-date: ${colorizeNumber(upToDate)}`, ANSIColors.GREY)\n );\n if (errors > 0)\n details.push(\n colorize(`errors: ${colorizeNumber(errors)}`, ANSIColors.RED)\n );\n\n const suffix = details.length > 0 ? ` (${details.join(', ')})` : '';\n\n if (isDone) {\n lines.push(\n `${colorize('✔', ANSIColors.GREEN)} pushed ${progressLabel}${suffix}`\n );\n } else {\n lines.push(\n `${colorize(frame, ANSIColors.BLUE)} pushing ${progressLabel}${suffix}`\n );\n }\n\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) {\n return;\n }\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n const line = lines[i];\n if (line !== undefined) {\n process.stdout.write(line);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines = lines.length;\n }\n\n private computeProgress() {\n const keys = new Set(this.statuses.map((s) => s.dictionaryKey));\n\n const pushed = this.statuses.filter((s) => s.status === 'pushed').length;\n const modified = this.statuses.filter(\n (s) => s.status === 'modified'\n ).length;\n const upToDate = this.statuses.filter(\n (s) => s.status === 'up-to-date'\n ).length;\n const errors = this.statuses.filter((s) => s.status === 'error').length;\n const done = pushed + modified + upToDate + errors;\n\n return {\n total: keys.size,\n done,\n pushed,\n modified,\n upToDate,\n errors,\n } as const;\n }\n}\n"],"mappings":";;;;;;;AAmBA,IAAa,aAAb,MAAwB;CACtB,AAAQ,WAAyB,EAAE;CACnC,AAAQ,eAAsC;CAC9C,AAAQ,eAAe;CACvB,AAAQ,gBAAgB;CACxB,AAAiB,gBAAgBA;CACjC,AAAQ,aAAa;CACrB,AAAQ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CAAY,KAAKA,wBAAW,MAAM,CAAC,UAAU,gBAAgB,SAC9D;MAED,OAAM,KACJ,yCAAY,OAAOA,wBAAW,KAAK,CAAC,WAAW,gBAAgB,SAChE;EAGH,MAAM,eAAe,MAAM,KAAK,KAAK;AACrC,MAAI,iBAAiB,KAAK,kBACxB;AAEF,OAAK,oBAAoB;AAEzB,MAAI,KAAK,gBAAgB,EACvB,SAAQ,OAAO,MAAM,QAAQ,KAAK,cAAc,GAAG;EAGrD,MAAM,oBAAoB,KAAK,IAAI,KAAK,eAAe,MAAM,OAAO;AACpE,OAAK,IAAI,IAAI,GAAG,IAAI,mBAAmB,KAAK;AAC1C,WAAQ,OAAO,MAAM,UAAU;GAC/B,MAAM,OAAO,MAAM;AACnB,OAAI,SAAS,OACX,SAAQ,OAAO,MAAM,KAAK;AAE5B,WAAQ,OAAO,MAAM,KAAK;;AAG5B,OAAK,gBAAgB,MAAM;;CAG7B,AAAQ,kBAAkB;EACxB,MAAM,OAAO,IAAI,IAAI,KAAK,SAAS,KAAK,MAAM,EAAE,cAAc,CAAC;EAE/D,MAAM,SAAS,KAAK,SAAS,QAAQ,MAAM,EAAE,WAAW,SAAS,CAAC;EAClE,MAAM,WAAW,KAAK,SAAS,QAC5B,MAAM,EAAE,WAAW,WACrB,CAAC;EACF,MAAM,WAAW,KAAK,SAAS,QAC5B,MAAM,EAAE,WAAW,aACrB,CAAC;EACF,MAAM,SAAS,KAAK,SAAS,QAAQ,MAAM,EAAE,WAAW,QAAQ,CAAC;EACjE,MAAM,OAAO,SAAS,WAAW,WAAW;AAE5C,SAAO;GACL,OAAO,KAAK;GACZ;GACA;GACA;GACA;GACA;GACD"}
1
+ {"version":3,"file":"pushLog.cjs","names":["spinnerFrames","ANSIColors"],"sources":["../../src/pushLog.ts"],"sourcesContent":["import * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeNumber,\n spinnerFrames,\n} from '@intlayer/config/logger';\n\nexport type PushStatus = {\n dictionaryKey: string;\n status:\n | 'pending'\n | 'pushing'\n | 'pushed'\n | 'modified'\n | 'up-to-date'\n | 'error';\n errorMessage?: string;\n};\n\nexport class PushLogger {\n private statuses: PushStatus[] = [];\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private readonly spinnerFrames = spinnerFrames;\n private isFinished = false;\n private lastRenderedState: string = '';\n\n update(newStatuses: PushStatus[]) {\n if (this.isFinished) return;\n for (const status of newStatuses) {\n const index = this.statuses.findIndex(\n (s) => s.dictionaryKey === status.dictionaryKey\n );\n if (index >= 0) {\n this.statuses[index] = status;\n } else {\n this.statuses.push(status);\n }\n }\n\n this.startSpinner();\n this.render();\n }\n\n finish() {\n this.isFinished = true;\n this.stopSpinner();\n this.render();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n private render() {\n const { total, done, pushed, modified, upToDate, errors } =\n this.computeProgress();\n\n const frame = this.spinnerFrames[this.spinnerIndex];\n const lines: string[] = [];\n\n const isDone = done === total;\n\n const progressLabel = `dictionaries: ${colorizeNumber(done)}/${colorizeNumber(total)}`;\n const details: string[] = [];\n if (pushed > 0) details.push(`new: ${colorizeNumber(pushed)}`);\n if (modified > 0) details.push(`modified: ${colorizeNumber(modified)}`);\n if (upToDate > 0)\n details.push(\n colorize(`up-to-date: ${colorizeNumber(upToDate)}`, ANSIColors.GREY)\n );\n if (errors > 0)\n details.push(\n colorize(`errors: ${colorizeNumber(errors)}`, ANSIColors.RED)\n );\n\n const suffix = details.length > 0 ? ` (${details.join(', ')})` : '';\n\n if (isDone) {\n lines.push(\n `${colorize('✔', ANSIColors.GREEN)} pushed ${progressLabel}${suffix}`\n );\n } else {\n lines.push(\n `${colorize(frame, ANSIColors.BLUE)} pushing ${progressLabel}${suffix}`\n );\n }\n\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) {\n return;\n }\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n const line = lines[i];\n if (line !== undefined) {\n process.stdout.write(line);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines = lines.length;\n }\n\n private computeProgress() {\n const keys = new Set(this.statuses.map((s) => s.dictionaryKey));\n\n const pushed = this.statuses.filter((s) => s.status === 'pushed').length;\n const modified = this.statuses.filter(\n (s) => s.status === 'modified'\n ).length;\n const upToDate = this.statuses.filter(\n (s) => s.status === 'up-to-date'\n ).length;\n const errors = this.statuses.filter((s) => s.status === 'error').length;\n const done = pushed + modified + upToDate + errors;\n\n return {\n total: keys.size,\n done,\n pushed,\n modified,\n upToDate,\n errors,\n } as const;\n }\n}\n"],"mappings":";;;;;;;AAmBA,IAAa,aAAb,MAAwB;CACtB,AAAQ,WAAyB,CAAC;CAClC,AAAQ,eAAsC;CAC9C,AAAQ,eAAe;CACvB,AAAQ,gBAAgB;CACxB,AAAiB,gBAAgBA;CACjC,AAAQ,aAAa;CACrB,AAAQ,oBAA4B;CAEpC,OAAO,aAA2B;EAChC,IAAI,KAAK,YAAY;EACrB,KAAK,MAAM,UAAU,aAAa;GAChC,MAAM,QAAQ,KAAK,SAAS,WACzB,MAAM,EAAE,kBAAkB,OAAO,aACpC;GACA,IAAI,SAAS,GACX,KAAK,SAAS,SAAS;QAEvB,KAAK,SAAS,KAAK,MAAM;EAE7B;EAEA,KAAK,aAAa;EAClB,KAAK,OAAO;CACd;CAEA,SAAS;EACP,KAAK,aAAa;EAClB,KAAK,YAAY;EACjB,KAAK,OAAO;CACd;CAEA,AAAQ,eAAe;EACrB,IAAI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AM;EACnE,KAAK,IAAI,IAAI,GAAG,IAAI,mBAAmB,KAAK;GAC1C,QAAQ,OAAO,MAAM,SAAS;GAC9B,MAAM,OAAO,MAAM;GACnB,IAAI,SAAS,QACX,QAAQ,OAAO,MAAM,IAAI;GAE3B,QAAQ,OAAO,MAAM,IAAI;EAC3B;EAEA,KAAK,gBAAgB,MAAM;CAC7B;CAEA,AAAQ,kBAAkB;EACxB,MAAM,OAAO,IAAI,IAAI,KAAK,SAAS,KAAK,MAAM,EAAE,aAAa,CAAC;EAE9D,MAAM,SAAS,KAAK,SAAS,QAAQ,MAAM,EAAE,WAAW,QAAQ,CAAC,CAAC;EAClE,MAAM,WAAW,KAAK,SAAS,QAC5B,MAAM,EAAE,WAAW,UACtB,CAAC,CAAC;EACF,MAAM,WAAW,KAAK,SAAS,QAC5B,MAAM,EAAE,WAAW,YACtB,CAAC,CAAC;EACF,MAAM,SAAS,KAAK,SAAS,QAAQ,MAAM,EAAE,WAAW,OAAO,CAAC,CAAC;EACjE,MAAM,OAAO,SAAS,WAAW,WAAW;EAE5C,OAAO;GACL,OAAO,KAAK;GACZ;GACA;GACA;GACA;GACA;EACF;CACF;AACF"}
@@ -8,14 +8,14 @@ const require_reviewDoc_reviewDocBlockAware = require('./reviewDocBlockAware.cjs
8
8
  const require_reviewDoc_reviewDocLog = require('./reviewDocLog.cjs');
9
9
  let node_fs = require("node:fs");
10
10
  let node_path = require("node:path");
11
- let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
12
- let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
13
11
  let _intlayer_config_colors = require("@intlayer/config/colors");
14
12
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
15
13
  let _intlayer_config_logger = require("@intlayer/config/logger");
16
14
  let _intlayer_config_node = require("@intlayer/config/node");
15
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
16
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
17
17
  let node_fs_promises = require("node:fs/promises");
18
- let _intlayer_chokidar_docReview = require("@intlayer/chokidar/docReview");
18
+ let _intlayer_engine_docReview = require("@intlayer/engine/docReview");
19
19
  let fast_glob = require("fast-glob");
20
20
  fast_glob = require_runtime.__toESM(fast_glob);
21
21
 
@@ -26,7 +26,7 @@ fast_glob = require_runtime.__toESM(fast_glob);
26
26
  */
27
27
  const reviewDoc = async ({ docPattern, locales, excludedGlobPattern, baseLocale, aiOptions, nbSimultaneousFileProcessed, configOptions, customInstructions, skipIfModifiedBefore, skipIfModifiedAfter, skipIfExists, gitOptions, log }) => {
28
28
  const configuration = (0, _intlayer_config_node.getConfiguration)(configOptions);
29
- (0, _intlayer_chokidar_cli.logConfigDetails)(configOptions);
29
+ (0, _intlayer_engine_cli.logConfigDetails)(configOptions);
30
30
  const appLogger = (0, _intlayer_config_logger.getAppLogger)({ log: {
31
31
  ...configuration.log,
32
32
  prefix: ""
@@ -52,20 +52,20 @@ const reviewDoc = async ({ docPattern, locales, excludedGlobPattern, baseLocale,
52
52
  }
53
53
  let docList = await (0, fast_glob.default)(docPattern, { ignore: excludedGlobPattern });
54
54
  if (gitOptions) {
55
- const gitChangedFiles = await (0, _intlayer_chokidar_cli.listGitFiles)(gitOptions);
55
+ const gitChangedFiles = await (0, _intlayer_engine_cli.listGitFiles)(gitOptions);
56
56
  if (gitChangedFiles) docList = docList.filter((path) => gitChangedFiles.some((gitFile) => (0, node_path.join)(process.cwd(), path) === gitFile));
57
57
  }
58
- appLogger(`Base locale is ${(0, _intlayer_chokidar_utils.formatLocale)(baseLocale)}`);
59
- appLogger(`Reviewing ${(0, _intlayer_config_logger.colorizeNumber)(locales.length)} locales: [ ${(0, _intlayer_chokidar_utils.formatLocale)(locales)} ]`);
58
+ appLogger(`Base locale is ${(0, _intlayer_engine_utils.formatLocale)(baseLocale)}`);
59
+ appLogger(`Reviewing ${(0, _intlayer_config_logger.colorizeNumber)(locales.length)} locales: [ ${(0, _intlayer_engine_utils.formatLocale)(locales)} ]`);
60
60
  appLogger(`Reviewing ${(0, _intlayer_config_logger.colorizeNumber)(docList.length)} files:`);
61
- appLogger(docList.map((path) => ` - ${(0, _intlayer_chokidar_utils.formatPath)(path)}\n`));
62
- await (0, _intlayer_chokidar_utils.parallelize)(docList.flatMap((docPath) => locales.map((locale) => async () => {
63
- appLogger(`Reviewing file: ${(0, _intlayer_chokidar_utils.formatPath)(docPath)} to ${(0, _intlayer_chokidar_utils.formatLocale)(locale)}`);
61
+ appLogger(docList.map((path) => ` - ${(0, _intlayer_engine_utils.formatPath)(path)}\n`));
62
+ await (0, _intlayer_engine_utils.parallelize)(docList.flatMap((docPath) => locales.map((locale) => async () => {
63
+ appLogger(`Reviewing file: ${(0, _intlayer_engine_utils.formatPath)(docPath)} to ${(0, _intlayer_engine_utils.formatLocale)(locale)}`);
64
64
  const absoluteBaseFilePath = (0, node_path.join)(configuration.system.baseDir, docPath);
65
65
  const outputFilePath = require_utils_getOutputFilePath.getOutputFilePath(absoluteBaseFilePath, locale, baseLocale);
66
66
  if (skipIfExists && (0, node_fs.existsSync)(outputFilePath)) {
67
67
  const relativePath = (0, node_path.relative)(configuration.system.baseDir, outputFilePath);
68
- appLogger(`${(0, _intlayer_config_logger.colorize)("⊘", _intlayer_config_colors.YELLOW)} File ${(0, _intlayer_chokidar_utils.formatPath)(relativePath)} already exists, skipping.`);
68
+ appLogger(`${(0, _intlayer_config_logger.colorize)("⊘", _intlayer_config_colors.YELLOW)} File ${(0, _intlayer_engine_utils.formatPath)(relativePath)} already exists, skipping.`);
69
69
  return;
70
70
  }
71
71
  if ((0, node_fs.existsSync)(outputFilePath)) {
@@ -77,13 +77,13 @@ const reviewDoc = async ({ docPattern, locales, excludedGlobPattern, baseLocale,
77
77
  appLogger(fileModificationData.message);
78
78
  return;
79
79
  }
80
- } else if (skipIfModifiedBefore || skipIfModifiedAfter) appLogger(`${(0, _intlayer_config_logger.colorize)("!", _intlayer_config_colors.YELLOW)} File ${(0, _intlayer_chokidar_utils.formatPath)(outputFilePath)} does not exist, skipping modification date check.`);
80
+ } else if (skipIfModifiedBefore || skipIfModifiedAfter) appLogger(`${(0, _intlayer_config_logger.colorize)("!", _intlayer_config_colors.YELLOW)} File ${(0, _intlayer_engine_utils.formatPath)(outputFilePath)} does not exist, skipping modification date check.`);
81
81
  let changedLines;
82
82
  if (gitOptions) {
83
- const gitChangedLines = await (0, _intlayer_chokidar_cli.listGitLines)(absoluteBaseFilePath, gitOptions);
83
+ const gitChangedLines = await (0, _intlayer_engine_cli.listGitLines)(absoluteBaseFilePath, gitOptions);
84
84
  changedLines = gitChangedLines;
85
- appLogger(`Changed lines (${(0, _intlayer_chokidar_utils.formatLocale)(baseLocale)}): ${require_utils_formatLineRanges.formatLineRanges(gitChangedLines)}`);
86
- const { blocks } = (0, _intlayer_chokidar_docReview.buildReviewReport)({
85
+ appLogger(`Changed lines (${(0, _intlayer_engine_utils.formatLocale)(baseLocale)}): ${require_utils_formatLineRanges.formatLineRanges(gitChangedLines)}`);
86
+ const { blocks } = (0, _intlayer_engine_docReview.buildReviewReport)({
87
87
  baseText: await (0, node_fs_promises.readFile)(absoluteBaseFilePath, "utf-8").catch(() => ""),
88
88
  targetText: (0, node_fs.existsSync)(outputFilePath) ? await (0, node_fs_promises.readFile)(outputFilePath, "utf-8").catch(() => "") : "",
89
89
  changedLines: gitChangedLines
@@ -93,7 +93,7 @@ const reviewDoc = async ({ docPattern, locales, excludedGlobPattern, baseLocale,
93
93
  const { start, end } = block.targetLineRange;
94
94
  return Array.from({ length: end - start + 1 }, (_unused, offset) => start + offset);
95
95
  });
96
- appLogger(`Corresponding block (${(0, _intlayer_chokidar_utils.formatLocale)(locale)}): ${require_utils_formatLineRanges.formatLineRanges(correspondingTargetLines)}`);
96
+ appLogger(`Corresponding block (${(0, _intlayer_engine_utils.formatLocale)(locale)}): ${require_utils_formatLineRanges.formatLineRanges(correspondingTargetLines)}`);
97
97
  }
98
98
  if (log) {
99
99
  await require_reviewDoc_reviewDocLog.logReviewFileBlocks(absoluteBaseFilePath, outputFilePath, locale, baseLocale, configOptions, changedLines);
@@ -1 +1 @@
1
- {"version":3,"file":"reviewDoc.cjs","names":["setupAI","x","getOutputFilePath","ANSIColors","checkFileModifiedRange","formatLineRanges","logReviewFileBlocks","reviewFileBlockAware"],"sources":["../../../src/reviewDoc/reviewDoc.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport type { AIConfig } from '@intlayer/ai';\nimport type { AIOptions } from '@intlayer/api';\nimport {\n type ListGitFilesOptions,\n listGitFiles,\n listGitLines,\n logConfigDetails,\n} from '@intlayer/chokidar/cli';\nimport { buildReviewReport } from '@intlayer/chokidar/docReview';\nimport {\n formatLocale,\n formatPath,\n parallelize,\n} from '@intlayer/chokidar/utils';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeNumber,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport fg from 'fast-glob';\nimport { checkFileModifiedRange } from '../utils/checkFileModifiedRange';\nimport { formatLineRanges } from '../utils/formatLineRanges';\nimport { getOutputFilePath } from '../utils/getOutputFilePath';\nimport { type AIClient, setupAI } from '../utils/setupAI';\nimport { reviewFileBlockAware } from './reviewDocBlockAware';\nimport { logReviewFileBlocks } from './reviewDocLog';\n\ntype ReviewDocOptions = {\n docPattern: string[];\n locales: Locale[];\n excludedGlobPattern: string[];\n baseLocale: Locale;\n aiOptions?: AIOptions;\n nbSimultaneousFileProcessed?: number;\n configOptions?: GetConfigurationOptions;\n customInstructions?: string;\n skipIfModifiedBefore?: number | string | Date;\n skipIfModifiedAfter?: number | string | Date;\n skipIfExists?: boolean;\n gitOptions?: ListGitFilesOptions;\n /**\n * Log-only mode. Instead of translating the changed blocks with AI, log the\n * blocks that need attention (with line numbers and content) for the base and\n * target locales, so another agent can generate the translations.\n */\n log?: boolean;\n};\n\n/**\n * Main audit function: scans all .md files in \"en/\" (unless you specified DOC_LIST),\n * then audits them to each locale in LOCALE_LIST.\n */\nexport const reviewDoc = async ({\n docPattern,\n locales,\n excludedGlobPattern,\n baseLocale,\n aiOptions,\n nbSimultaneousFileProcessed,\n configOptions,\n customInstructions,\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n skipIfExists,\n gitOptions,\n log,\n}: ReviewDocOptions) => {\n const configuration = getConfiguration(configOptions);\n logConfigDetails(configOptions);\n\n const appLogger = getAppLogger({ log: { ...configuration.log, prefix: '' } });\n\n // Log-only mode does not call any AI, so the AI access checks are skipped.\n let aiClient: AIClient | undefined;\n let aiConfig: AIConfig | undefined;\n\n if (!log) {\n const aiResult = await setupAI(configuration, aiOptions);\n\n if (!aiResult?.hasAIAccess) return;\n\n aiClient = aiResult.aiClient;\n aiConfig = aiResult.aiConfig;\n\n if (aiResult.isCustomAI && aiClient && aiConfig) {\n const { hasAIAccess, error } = await aiClient.checkAISDKAccess(aiConfig);\n if (!hasAIAccess) {\n appLogger(`${x} ${error}`);\n return;\n }\n }\n }\n\n if (nbSimultaneousFileProcessed && nbSimultaneousFileProcessed > 10) {\n appLogger(\n `Warning: nbSimultaneousFileProcessed is set to ${nbSimultaneousFileProcessed}, which is greater than 10. Setting it to 10.`\n );\n nbSimultaneousFileProcessed = 10; // Limit the number of simultaneous file processed to 10\n }\n\n let docList: string[] = await fg(docPattern, {\n ignore: excludedGlobPattern,\n });\n\n if (gitOptions) {\n const gitChangedFiles = await listGitFiles(gitOptions);\n\n if (gitChangedFiles) {\n // Convert dictionary file paths to be relative to git root for comparison\n\n // Filter dictionaries based on git changed files\n docList = docList.filter((path) =>\n gitChangedFiles.some((gitFile) => join(process.cwd(), path) === gitFile)\n );\n }\n }\n\n // OAuth handled by API proxy internally\n\n appLogger(`Base locale is ${formatLocale(baseLocale)}`);\n appLogger(\n `Reviewing ${colorizeNumber(locales.length)} locales: [ ${formatLocale(locales)} ]`\n );\n\n appLogger(`Reviewing ${colorizeNumber(docList.length)} files:`);\n appLogger(docList.map((path) => ` - ${formatPath(path)}\\n`));\n\n // Create all tasks to be processed\n const allTasks = docList.flatMap((docPath) =>\n locales.map((locale) => async () => {\n appLogger(\n `Reviewing file: ${formatPath(docPath)} to ${formatLocale(locale)}`\n );\n\n const absoluteBaseFilePath = join(configuration.system.baseDir, docPath);\n const outputFilePath = getOutputFilePath(\n absoluteBaseFilePath,\n locale,\n baseLocale\n );\n\n // Skip if file exists and skipIfExists option is enabled\n if (skipIfExists && existsSync(outputFilePath)) {\n const relativePath = relative(\n configuration.system.baseDir,\n outputFilePath\n );\n appLogger(\n `${colorize('⊘', ANSIColors.YELLOW)} File ${formatPath(relativePath)} already exists, skipping.`\n );\n return;\n }\n\n // Check modification range only if the file exists\n if (existsSync(outputFilePath)) {\n const fileModificationData = checkFileModifiedRange(outputFilePath, {\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n });\n\n if (fileModificationData.isSkipped) {\n appLogger(fileModificationData.message);\n return;\n }\n } else if (skipIfModifiedBefore || skipIfModifiedAfter) {\n // Log if we intended to check modification time but couldn't because the file doesn't exist\n appLogger(\n `${colorize('!', ANSIColors.YELLOW)} File ${formatPath(outputFilePath)} does not exist, skipping modification date check.`\n );\n }\n\n let changedLines: number[] | undefined;\n // FIXED: Enable git optimization that was previously commented out\n if (gitOptions) {\n const gitChangedLines = await listGitLines(\n absoluteBaseFilePath,\n gitOptions\n );\n changedLines = gitChangedLines;\n\n // Report the base lines that changed, then the corresponding line span\n // in the target document — i.e. the blocks the alignment will actually\n // re-translate. `review` blocks are exactly the aligned base blocks the\n // changed lines touched, so their `targetLineRange` is the matching span\n // in the existing translation.\n appLogger(\n `Changed lines (${formatLocale(baseLocale)}): ${formatLineRanges(gitChangedLines)}`\n );\n\n const baseText = await readFile(absoluteBaseFilePath, 'utf-8').catch(\n () => ''\n );\n const targetText = existsSync(outputFilePath)\n ? await readFile(outputFilePath, 'utf-8').catch(() => '')\n : '';\n\n const { blocks } = buildReviewReport({\n baseText,\n targetText,\n changedLines: gitChangedLines,\n });\n\n const correspondingTargetLines = blocks.flatMap((block) => {\n if (block.action !== 'review' || !block.targetLineRange) return [];\n\n const { start, end } = block.targetLineRange;\n return Array.from(\n { length: end - start + 1 },\n (_unused, offset) => start + offset\n );\n });\n\n appLogger(\n `Corresponding block (${formatLocale(locale)}): ${formatLineRanges(correspondingTargetLines)}`\n );\n }\n\n if (log) {\n await logReviewFileBlocks(\n absoluteBaseFilePath,\n outputFilePath,\n locale as Locale,\n baseLocale,\n configOptions,\n changedLines\n );\n return;\n }\n\n await reviewFileBlockAware(\n absoluteBaseFilePath,\n outputFilePath,\n locale as Locale,\n baseLocale,\n aiOptions,\n configOptions,\n customInstructions,\n changedLines,\n aiClient,\n aiConfig\n );\n })\n );\n\n await parallelize(\n allTasks,\n (task) => task(),\n nbSimultaneousFileProcessed ?? 3\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,MAAa,YAAY,OAAO,EAC9B,YACA,SACA,qBACA,YACA,WACA,6BACA,eACA,oBACA,sBACA,qBACA,cACA,YACA,UACsB;CACtB,MAAM,4DAAiC,cAAc;AACrD,8CAAiB,cAAc;CAE/B,MAAM,sDAAyB,EAAE,KAAK;EAAE,GAAG,cAAc;EAAK,QAAQ;EAAI,EAAE,CAAC;CAG7E,IAAI;CACJ,IAAI;AAEJ,KAAI,CAAC,KAAK;EACR,MAAM,WAAW,MAAMA,8BAAQ,eAAe,UAAU;AAExD,MAAI,CAAC,UAAU,YAAa;AAE5B,aAAW,SAAS;AACpB,aAAW,SAAS;AAEpB,MAAI,SAAS,cAAc,YAAY,UAAU;GAC/C,MAAM,EAAE,aAAa,UAAU,MAAM,SAAS,iBAAiB,SAAS;AACxE,OAAI,CAAC,aAAa;AAChB,cAAU,GAAGC,0BAAE,GAAG,QAAQ;AAC1B;;;;AAKN,KAAI,+BAA+B,8BAA8B,IAAI;AACnE,YAC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A6B;IACnC,+CAR8B,sBAAsB,QAAQ,CAAC,YACvD,GACP;IAOC,oCAN4B,eAAe,GACzC,qCAAe,gBAAgB,QAAQ,CAAC,YAAY,GAAG,GACvD;IAKF,cAAc;IACf,CAAC;GAEF,MAAM,2BAA2B,OAAO,SAAS,UAAU;AACzD,QAAI,MAAM,WAAW,YAAY,CAAC,MAAM,gBAAiB,QAAO,EAAE;IAElE,MAAM,EAAE,OAAO,QAAQ,MAAM;AAC7B,WAAO,MAAM,KACX,EAAE,QAAQ,MAAM,QAAQ,GAAG,GAC1B,SAAS,WAAW,QAAQ,OAC9B;KACD;AAEF,aACE,mEAAqC,OAAO,CAAC,KAAKA,gDAAiB,yBAAyB,GAC7F;;AAGH,MAAI,KAAK;AACP,SAAMC,mDACJ,sBACA,gBACA,QACA,YACA,eACA,aACD;AACD;;AAGF,QAAMC,2DACJ,sBACA,gBACA,QACA,YACA,WACA,eACA,oBACA,cACA,UACA,SACD;GACD,CAIM,GACP,SAAS,MAAM,EAChB,+BAA+B,EAChC"}
1
+ {"version":3,"file":"reviewDoc.cjs","names":["setupAI","x","getOutputFilePath","ANSIColors","checkFileModifiedRange","formatLineRanges","logReviewFileBlocks","reviewFileBlockAware"],"sources":["../../../src/reviewDoc/reviewDoc.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport type { AIConfig } from '@intlayer/ai';\nimport type { AIOptions } from '@intlayer/api';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeNumber,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport {\n type ListGitFilesOptions,\n listGitFiles,\n listGitLines,\n logConfigDetails,\n} from '@intlayer/engine/cli';\nimport { buildReviewReport } from '@intlayer/engine/docReview';\nimport { formatLocale, formatPath, parallelize } from '@intlayer/engine/utils';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport fg from 'fast-glob';\nimport { checkFileModifiedRange } from '../utils/checkFileModifiedRange';\nimport { formatLineRanges } from '../utils/formatLineRanges';\nimport { getOutputFilePath } from '../utils/getOutputFilePath';\nimport { type AIClient, setupAI } from '../utils/setupAI';\nimport { reviewFileBlockAware } from './reviewDocBlockAware';\nimport { logReviewFileBlocks } from './reviewDocLog';\n\ntype ReviewDocOptions = {\n docPattern: string[];\n locales: Locale[];\n excludedGlobPattern: string[];\n baseLocale: Locale;\n aiOptions?: AIOptions;\n nbSimultaneousFileProcessed?: number;\n configOptions?: GetConfigurationOptions;\n customInstructions?: string;\n skipIfModifiedBefore?: number | string | Date;\n skipIfModifiedAfter?: number | string | Date;\n skipIfExists?: boolean;\n gitOptions?: ListGitFilesOptions;\n /**\n * Log-only mode. Instead of translating the changed blocks with AI, log the\n * blocks that need attention (with line numbers and content) for the base and\n * target locales, so another agent can generate the translations.\n */\n log?: boolean;\n};\n\n/**\n * Main audit function: scans all .md files in \"en/\" (unless you specified DOC_LIST),\n * then audits them to each locale in LOCALE_LIST.\n */\nexport const reviewDoc = async ({\n docPattern,\n locales,\n excludedGlobPattern,\n baseLocale,\n aiOptions,\n nbSimultaneousFileProcessed,\n configOptions,\n customInstructions,\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n skipIfExists,\n gitOptions,\n log,\n}: ReviewDocOptions) => {\n const configuration = getConfiguration(configOptions);\n logConfigDetails(configOptions);\n\n const appLogger = getAppLogger({ log: { ...configuration.log, prefix: '' } });\n\n // Log-only mode does not call any AI, so the AI access checks are skipped.\n let aiClient: AIClient | undefined;\n let aiConfig: AIConfig | undefined;\n\n if (!log) {\n const aiResult = await setupAI(configuration, aiOptions);\n\n if (!aiResult?.hasAIAccess) return;\n\n aiClient = aiResult.aiClient;\n aiConfig = aiResult.aiConfig;\n\n if (aiResult.isCustomAI && aiClient && aiConfig) {\n const { hasAIAccess, error } = await aiClient.checkAISDKAccess(aiConfig);\n if (!hasAIAccess) {\n appLogger(`${x} ${error}`);\n return;\n }\n }\n }\n\n if (nbSimultaneousFileProcessed && nbSimultaneousFileProcessed > 10) {\n appLogger(\n `Warning: nbSimultaneousFileProcessed is set to ${nbSimultaneousFileProcessed}, which is greater than 10. Setting it to 10.`\n );\n nbSimultaneousFileProcessed = 10; // Limit the number of simultaneous file processed to 10\n }\n\n let docList: string[] = await fg(docPattern, {\n ignore: excludedGlobPattern,\n });\n\n if (gitOptions) {\n const gitChangedFiles = await listGitFiles(gitOptions);\n\n if (gitChangedFiles) {\n // Convert dictionary file paths to be relative to git root for comparison\n\n // Filter dictionaries based on git changed files\n docList = docList.filter((path) =>\n gitChangedFiles.some((gitFile) => join(process.cwd(), path) === gitFile)\n );\n }\n }\n\n // OAuth handled by API proxy internally\n\n appLogger(`Base locale is ${formatLocale(baseLocale)}`);\n appLogger(\n `Reviewing ${colorizeNumber(locales.length)} locales: [ ${formatLocale(locales)} ]`\n );\n\n appLogger(`Reviewing ${colorizeNumber(docList.length)} files:`);\n appLogger(docList.map((path) => ` - ${formatPath(path)}\\n`));\n\n // Create all tasks to be processed\n const allTasks = docList.flatMap((docPath) =>\n locales.map((locale) => async () => {\n appLogger(\n `Reviewing file: ${formatPath(docPath)} to ${formatLocale(locale)}`\n );\n\n const absoluteBaseFilePath = join(configuration.system.baseDir, docPath);\n const outputFilePath = getOutputFilePath(\n absoluteBaseFilePath,\n locale,\n baseLocale\n );\n\n // Skip if file exists and skipIfExists option is enabled\n if (skipIfExists && existsSync(outputFilePath)) {\n const relativePath = relative(\n configuration.system.baseDir,\n outputFilePath\n );\n appLogger(\n `${colorize('⊘', ANSIColors.YELLOW)} File ${formatPath(relativePath)} already exists, skipping.`\n );\n return;\n }\n\n // Check modification range only if the file exists\n if (existsSync(outputFilePath)) {\n const fileModificationData = checkFileModifiedRange(outputFilePath, {\n skipIfModifiedBefore,\n skipIfModifiedAfter,\n });\n\n if (fileModificationData.isSkipped) {\n appLogger(fileModificationData.message);\n return;\n }\n } else if (skipIfModifiedBefore || skipIfModifiedAfter) {\n // Log if we intended to check modification time but couldn't because the file doesn't exist\n appLogger(\n `${colorize('!', ANSIColors.YELLOW)} File ${formatPath(outputFilePath)} does not exist, skipping modification date check.`\n );\n }\n\n let changedLines: number[] | undefined;\n // FIXED: Enable git optimization that was previously commented out\n if (gitOptions) {\n const gitChangedLines = await listGitLines(\n absoluteBaseFilePath,\n gitOptions\n );\n changedLines = gitChangedLines;\n\n // Report the base lines that changed, then the corresponding line span\n // in the target document — i.e. the blocks the alignment will actually\n // re-translate. `review` blocks are exactly the aligned base blocks the\n // changed lines touched, so their `targetLineRange` is the matching span\n // in the existing translation.\n appLogger(\n `Changed lines (${formatLocale(baseLocale)}): ${formatLineRanges(gitChangedLines)}`\n );\n\n const baseText = await readFile(absoluteBaseFilePath, 'utf-8').catch(\n () => ''\n );\n const targetText = existsSync(outputFilePath)\n ? await readFile(outputFilePath, 'utf-8').catch(() => '')\n : '';\n\n const { blocks } = buildReviewReport({\n baseText,\n targetText,\n changedLines: gitChangedLines,\n });\n\n const correspondingTargetLines = blocks.flatMap((block) => {\n if (block.action !== 'review' || !block.targetLineRange) return [];\n\n const { start, end } = block.targetLineRange;\n return Array.from(\n { length: end - start + 1 },\n (_unused, offset) => start + offset\n );\n });\n\n appLogger(\n `Corresponding block (${formatLocale(locale)}): ${formatLineRanges(correspondingTargetLines)}`\n );\n }\n\n if (log) {\n await logReviewFileBlocks(\n absoluteBaseFilePath,\n outputFilePath,\n locale as Locale,\n baseLocale,\n configOptions,\n changedLines\n );\n return;\n }\n\n await reviewFileBlockAware(\n absoluteBaseFilePath,\n outputFilePath,\n locale as Locale,\n baseLocale,\n aiOptions,\n configOptions,\n customInstructions,\n changedLines,\n aiClient,\n aiConfig\n );\n })\n );\n\n await parallelize(\n allTasks,\n (task) => task(),\n nbSimultaneousFileProcessed ?? 3\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,MAAa,YAAY,OAAO,EAC9B,YACA,S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,SAAS,KAAK,GACf,+BAA+B,CACjC;AACF"}
@@ -6,14 +6,14 @@ const require_utils_chunkInference = require('../utils/chunkInference.cjs');
6
6
  const require_utils_fixChunkStartEndChars = require('../utils/fixChunkStartEndChars.cjs');
7
7
  let node_fs = require("node:fs");
8
8
  let node_path = require("node:path");
9
- let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
10
9
  let _intlayer_config_colors = require("@intlayer/config/colors");
11
10
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
12
11
  let _intlayer_config_logger = require("@intlayer/config/logger");
13
12
  let _intlayer_config_node = require("@intlayer/config/node");
14
- let _intlayer_config_utils = require("@intlayer/config/utils");
13
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
15
14
  let node_fs_promises = require("node:fs/promises");
16
- let _intlayer_chokidar_docReview = require("@intlayer/chokidar/docReview");
15
+ let _intlayer_config_utils = require("@intlayer/config/utils");
16
+ let _intlayer_engine_docReview = require("@intlayer/engine/docReview");
17
17
  let _intlayer_core_localization = require("@intlayer/core/localization");
18
18
  let _intlayer_types_locales = require("@intlayer/types/locales");
19
19
 
@@ -37,10 +37,10 @@ const reviewFileBlockAware = async (baseFilePath, outputFilePath, locale, baseLo
37
37
  } });
38
38
  const baseText = await (0, node_fs_promises.readFile)(baseFilePath, "utf-8");
39
39
  const targetText = await (0, node_fs_promises.readFile)(outputFilePath, "utf-8").catch(() => "");
40
- const basePrompt = require__utils_asset.readAsset("./prompts/REVIEW_PROMPT.md", "utf-8").replaceAll("{{localeName}}", `${(0, _intlayer_chokidar_utils.formatLocale)(locale, false)}`).replaceAll("{{baseLocaleName}}", `${(0, _intlayer_chokidar_utils.formatLocale)(baseLocale, false)}`).replace("{{applicationContext}}", aiOptions?.applicationContext ?? "-").replace("{{customInstructions}}", customInstructions ?? "-");
41
- const filePrefix = [(0, _intlayer_config_logger.colon)(`${_intlayer_config_colors.GREY_DARK}[${(0, _intlayer_chokidar_utils.formatPath)(baseFilePath)}${_intlayer_config_colors.GREY_DARK}] `, { colSize: 40 }), `→ ${_intlayer_config_colors.RESET}`].join("");
42
- const prefix = [(0, _intlayer_config_logger.colon)(`${_intlayer_config_colors.GREY_DARK}[${(0, _intlayer_chokidar_utils.formatPath)(baseFilePath)}${_intlayer_config_colors.GREY_DARK}][${(0, _intlayer_chokidar_utils.formatLocale)(locale)}${_intlayer_config_colors.GREY_DARK}] `, { colSize: 40 }), `→ ${_intlayer_config_colors.RESET}`].join("");
43
- const { baseBlocks, targetBlocks, plan, segmentsToReview } = (0, _intlayer_chokidar_docReview.buildAlignmentPlan)({
40
+ const basePrompt = require__utils_asset.readAsset("./prompts/REVIEW_PROMPT.md", "utf-8").replaceAll("{{localeName}}", `${(0, _intlayer_engine_utils.formatLocale)(locale, false)}`).replaceAll("{{baseLocaleName}}", `${(0, _intlayer_engine_utils.formatLocale)(baseLocale, false)}`).replace("{{applicationContext}}", aiOptions?.applicationContext ?? "-").replace("{{customInstructions}}", customInstructions ?? "-");
41
+ const filePrefix = [(0, _intlayer_config_logger.colon)(`${_intlayer_config_colors.GREY_DARK}[${(0, _intlayer_engine_utils.formatPath)(baseFilePath)}${_intlayer_config_colors.GREY_DARK}] `, { colSize: 40 }), `→ ${_intlayer_config_colors.RESET}`].join("");
42
+ const prefix = [(0, _intlayer_config_logger.colon)(`${_intlayer_config_colors.GREY_DARK}[${(0, _intlayer_engine_utils.formatPath)(baseFilePath)}${_intlayer_config_colors.GREY_DARK}][${(0, _intlayer_engine_utils.formatLocale)(locale)}${_intlayer_config_colors.GREY_DARK}] `, { colSize: 40 }), `→ ${_intlayer_config_colors.RESET}`].join("");
43
+ const { baseBlocks, targetBlocks, plan, segmentsToReview } = (0, _intlayer_engine_docReview.buildAlignmentPlan)({
44
44
  baseText,
45
45
  targetText,
46
46
  changedLines
@@ -51,7 +51,7 @@ const reviewFileBlockAware = async (baseFilePath, outputFilePath, locale, baseLo
51
51
  const reviewedSegmentsMap = /* @__PURE__ */ new Map();
52
52
  for (const [actionIndex, action] of plan.actions.entries()) if (action.kind === "delete") reviewedSegmentsMap.set(actionIndex, "");
53
53
  const writeCurrentState = () => {
54
- const output = (0, _intlayer_chokidar_docReview.mergeReviewedSegments)(plan, targetBlocks, reviewedSegmentsMap);
54
+ const output = (0, _intlayer_engine_docReview.mergeReviewedSegments)(plan, targetBlocks, reviewedSegmentsMap);
55
55
  (0, node_fs.mkdirSync)((0, node_path.dirname)(outputFilePath), { recursive: true });
56
56
  (0, node_fs.writeFileSync)(outputFilePath, output);
57
57
  };
@@ -64,7 +64,7 @@ const reviewFileBlockAware = async (baseFilePath, outputFilePath, locale, baseLo
64
64
  applicationLogger(`${filePrefix}No segments need review, reusing existing translation`);
65
65
  writeCurrentState();
66
66
  }
67
- applicationLogger(`${(0, _intlayer_config_logger.colorize)("✔", _intlayer_config_colors.GREEN)} File ${(0, _intlayer_chokidar_utils.formatPath)(outputFilePath)} updated successfully (no AI changes needed).`);
67
+ applicationLogger(`${(0, _intlayer_config_logger.colorize)("✔", _intlayer_config_colors.GREEN)} File ${(0, _intlayer_engine_utils.formatPath)(outputFilePath)} updated successfully (no AI changes needed).`);
68
68
  return;
69
69
  }
70
70
  applicationLogger(`${filePrefix}Segments to review: ${(0, _intlayer_config_logger.colorizeNumber)(segmentsToReview.length)} (processing bottom-up)`);
@@ -74,8 +74,8 @@ const reviewFileBlockAware = async (baseFilePath, outputFilePath, locale, baseLo
74
74
  })).reverse();
75
75
  for (const { segment, displayNumber } of segmentsBottomUp) {
76
76
  const baseBlock = segment.baseBlock;
77
- const getBaseChunkContextPrompt = () => `**BLOCK ${displayNumber} of ${segmentsToReview.length}** is the base block in ${(0, _intlayer_chokidar_utils.formatLocale)(baseLocale, false)} as reference.\n///chunksStart///\n` + baseBlock.content + `///chunksEnd///`;
78
- const getTargetChunkPrompt = () => `**BLOCK ${displayNumber} of ${segmentsToReview.length}** is the current block to review in ${(0, _intlayer_chokidar_utils.formatLocale)(locale, false)}.\n///chunksStart///\n` + (segment.targetBlockText ?? "") + `///chunksEnd///`;
77
+ const getBaseChunkContextPrompt = () => `**BLOCK ${displayNumber} of ${segmentsToReview.length}** is the base block in ${(0, _intlayer_engine_utils.formatLocale)(baseLocale, false)} as reference.\n///chunksStart///\n` + baseBlock.content + `///chunksEnd///`;
78
+ const getTargetChunkPrompt = () => `**BLOCK ${displayNumber} of ${segmentsToReview.length}** is the current block to review in ${(0, _intlayer_engine_utils.formatLocale)(locale, false)}.\n///chunksStart///\n` + (segment.targetBlockText ?? "") + `///chunksEnd///`;
79
79
  const reviewedChunkResult = await (0, _intlayer_config_utils.retryManager)(async () => {
80
80
  const result = await require_utils_chunkInference.chunkInference([
81
81
  {
@@ -107,7 +107,7 @@ const reviewFileBlockAware = async (baseFilePath, outputFilePath, locale, baseLo
107
107
  reviewedSegmentsMap.set(segment.actionIndex, reviewedChunkResult);
108
108
  writeCurrentState();
109
109
  }
110
- applicationLogger(`${(0, _intlayer_config_logger.colorize)("✔", _intlayer_config_colors.GREEN)} File ${(0, _intlayer_chokidar_utils.formatPath)(outputFilePath)} created/updated successfully.`);
110
+ applicationLogger(`${(0, _intlayer_config_logger.colorize)("✔", _intlayer_config_colors.GREEN)} File ${(0, _intlayer_engine_utils.formatPath)(outputFilePath)} created/updated successfully.`);
111
111
  };
112
112
 
113
113
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"reviewDocBlockAware.cjs","names":["readAsset","ANSIColors","chunkInference","ENGLISH","sanitizeChunk","fixChunkStartEndChars","validateTranslation"],"sources":["../../../src/reviewDoc/reviewDocBlockAware.ts"],"sourcesContent":["import { mkdirSync, writeFileSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { dirname } from 'node:path';\nimport { readAsset } from 'utils:asset';\nimport type { AIConfig } from '@intlayer/ai';\nimport type { AIOptions } from '@intlayer/api';\nimport {\n buildAlignmentPlan,\n mergeReviewedSegments,\n} from '@intlayer/chokidar/docReview';\nimport { formatLocale, formatPath } from '@intlayer/chokidar/utils';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colon,\n colorize,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { retryManager } from '@intlayer/config/utils';\nimport { getLocaleName } from '@intlayer/core/localization';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { ENGLISH } from '@intlayer/types/locales';\nimport { sanitizeChunk, validateTranslation } from '../translateDoc/validation';\nimport { chunkInference } from '../utils/chunkInference';\nimport { fixChunkStartEndChars } from '../utils/fixChunkStartEndChars';\nimport type { AIClient } from '../utils/setupAI';\n\n/**\n * Review a file using block-aware alignment.\n *\n * 1. Segments both base and target documents into semantic blocks.\n * 2. Aligns blocks using structure (special chars, numbers) and context.\n * 3. Detects which blocks changed, were added, or deleted.\n * 4. Applies deletions immediately without AI.\n * 5. Sends changed/new blocks to AI in bottom-up order (last block first), so\n * line numbers of earlier blocks are not shifted by edits below them.\n * 6. Rewrites the file after each block so progress is persisted incrementally.\n */\nexport const reviewFileBlockAware = async (\n baseFilePath: string,\n outputFilePath: string,\n locale: Locale,\n baseLocale: Locale,\n aiOptions?: AIOptions,\n configOptions?: GetConfigurationOptions,\n customInstructions?: string,\n changedLines?: number[],\n aiClient?: AIClient,\n aiConfig?: AIConfig\n) => {\n const configuration = getConfiguration(configOptions);\n const applicationLogger = getAppLogger({\n log: { ...configuration.log, prefix: '' },\n });\n\n const baseText = await readFile(baseFilePath, 'utf-8');\n const targetText = await readFile(outputFilePath, 'utf-8').catch(() => '');\n\n const basePrompt = readAsset('./prompts/REVIEW_PROMPT.md', 'utf-8')\n .replaceAll('{{localeName}}', `${formatLocale(locale, false)}`)\n .replaceAll('{{baseLocaleName}}', `${formatLocale(baseLocale, false)}`)\n .replace('{{applicationContext}}', aiOptions?.applicationContext ?? '-')\n .replace('{{customInstructions}}', customInstructions ?? '-');\n\n const filePrefixText = `${ANSIColors.GREY_DARK}[${formatPath(baseFilePath)}${ANSIColors.GREY_DARK}] `;\n const filePrefix = [\n colon(filePrefixText, { colSize: 40 }),\n `→ ${ANSIColors.RESET}`,\n ].join('');\n const prefixText = `${ANSIColors.GREY_DARK}[${formatPath(baseFilePath)}${ANSIColors.GREY_DARK}][${formatLocale(locale)}${ANSIColors.GREY_DARK}] `;\n const prefix = [\n colon(prefixText, { colSize: 40 }),\n `→ ${ANSIColors.RESET}`,\n ].join('');\n\n // Build block-aware alignment and plan\n const { baseBlocks, targetBlocks, plan, segmentsToReview } =\n buildAlignmentPlan({\n baseText,\n targetText,\n changedLines,\n });\n\n const deleteCount = plan.actions.filter((a) => a.kind === 'delete').length;\n\n applicationLogger(\n `${filePrefix}Block-aware alignment complete. Total blocks: base=${colorizeNumber(baseBlocks.length)}, target=${colorizeNumber(targetBlocks.length)}`\n );\n applicationLogger(\n `${filePrefix}Actions: reuse=${colorizeNumber(plan.actions.filter((a) => a.kind === 'reuse').length)}, review=${colorizeNumber(plan.actions.filter((a) => a.kind === 'review').length)}, new=${colorizeNumber(plan.actions.filter((a) => a.kind === 'insert_new').length)}, delete=${colorizeNumber(deleteCount)}`\n );\n\n // Map shared across the entire run: each entry overrides the default behavior\n // of mergeReviewedSegments for that action index.\n const reviewedSegmentsMap = new Map<number, string>();\n\n // --- Step 1: apply deletions immediately (no AI needed) ---\n for (const [actionIndex, action] of plan.actions.entries()) {\n if (action.kind === 'delete') {\n reviewedSegmentsMap.set(actionIndex, '');\n }\n }\n\n const writeCurrentState = (): void => {\n const output = mergeReviewedSegments(\n plan,\n targetBlocks,\n reviewedSegmentsMap\n );\n mkdirSync(dirname(outputFilePath), { recursive: true });\n writeFileSync(outputFilePath, output);\n };\n\n if (deleteCount > 0) {\n writeCurrentState();\n applicationLogger(\n `${filePrefix}${colorizeNumber(deleteCount)} block(s) deleted without AI.`\n );\n }\n\n if (segmentsToReview.length === 0) {\n if (deleteCount === 0) {\n applicationLogger(\n `${filePrefix}No segments need review, reusing existing translation`\n );\n writeCurrentState();\n }\n applicationLogger(\n `${colorize('✔', ANSIColors.GREEN)} File ${formatPath(outputFilePath)} updated successfully (no AI changes needed).`\n );\n return;\n }\n\n applicationLogger(\n `${filePrefix}Segments to review: ${colorizeNumber(segmentsToReview.length)} (processing bottom-up)`\n );\n\n // --- Step 2: process AI segments in bottom-up order ---\n // Reversing ensures edits near the end of the file don't shift line numbers\n // that matter for blocks higher up, and each intermediate file write is valid.\n const segmentsBottomUp = segmentsToReview\n .map((segment, originalIndex) => ({\n segment,\n displayNumber: originalIndex + 1,\n }))\n .reverse();\n\n for (const { segment, displayNumber } of segmentsBottomUp) {\n const baseBlock = segment.baseBlock;\n\n const getBaseChunkContextPrompt = () =>\n `**BLOCK ${displayNumber} of ${segmentsToReview.length}** is the base block in ${formatLocale(baseLocale, false)} as reference.\\n` +\n `///chunksStart///\\n` +\n baseBlock.content +\n `///chunksEnd///`;\n\n const getTargetChunkPrompt = () =>\n `**BLOCK ${displayNumber} of ${segmentsToReview.length}** is the current block to review in ${formatLocale(locale, false)}.\\n` +\n `///chunksStart///\\n` +\n (segment.targetBlockText ?? '') +\n `///chunksEnd///`;\n\n const reviewedChunkResult = await retryManager(async () => {\n const result = await chunkInference(\n [\n { role: 'system', content: basePrompt },\n { role: 'system', content: getBaseChunkContextPrompt() },\n { role: 'system', content: getTargetChunkPrompt() },\n {\n role: 'system',\n content: `The next user message will be the **BLOCK ${colorizeNumber(displayNumber)} of ${colorizeNumber(segmentsToReview.length)}** that should be translated in ${getLocaleName(locale, ENGLISH)} (${locale}).`,\n },\n ],\n [{ role: 'user', content: baseBlock.content }],\n aiOptions,\n configuration,\n aiClient,\n aiConfig\n );\n\n applicationLogger(\n `${prefix}${colorizeNumber(result.tokenUsed)} tokens used - Block ${colorizeNumber(displayNumber)} of ${colorizeNumber(segmentsToReview.length)}`\n );\n\n let processedChunk = sanitizeChunk(\n result?.fileContent,\n baseBlock.content\n );\n processedChunk = fixChunkStartEndChars(processedChunk, baseBlock.content);\n\n const isValid = validateTranslation(\n baseBlock.content,\n processedChunk,\n applicationLogger\n );\n\n if (!isValid) {\n throw new Error(\n 'Validation failed for chunk (structure or length mismatch). Retrying...'\n );\n }\n\n return processedChunk;\n })();\n\n reviewedSegmentsMap.set(segment.actionIndex, reviewedChunkResult);\n\n // Rewrite the file after every block so progress is never lost.\n writeCurrentState();\n }\n\n applicationLogger(\n `${colorize('✔', ANSIColors.GREEN)} File ${formatPath(outputFilePath)} created/updated successfully.`\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,uBAAuB,OAClC,cACA,gBACA,QACA,YACA,WACA,eACA,oBACA,cACA,UACA,aACG;CACH,MAAM,4DAAiC,cAAc;CACrD,MAAM,8DAAiC,EACrC,KAAK;EAAE,GAAG,cAAc;EAAK,QAAQ;EAAI,EAC1C,CAAC;CAEF,MAAM,WAAW,qCAAe,cAAc,QAAQ;CACtD,MAAM,aAAa,qCAAe,gBAAgB,QAAQ,CAAC,YAAY,GAAG;CAE1E,MAAM,aAAaA,+BAAU,8BAA8B,QAAQ,CAChE,WAAW,kBAAkB,8CAAgB,QAAQ,MAAM,GAAG,CAC9D,WAAW,sBAAsB,8CAAgB,YAAY,MAAM,GAAG,CACtE,QAAQ,0BAA0B,WAAW,sBAAsB,IAAI,CACvE,QAAQ,0BAA0B,sBAAsB,IAAI;CAG/D,MAAM,aAAa,oCACX,GAFkBC,wBAAW,UAAU,4CAAc,aAAa,GAAGA,wBAAW,UAAU,KAE1E,EAAE,SAAS,IAAI,CAAC,EACtC,KAAKA,wBAAW,QACjB,CAAC,KAAK,GAAG;CAEV,MAAM,SAAS,oCACP,GAFcA,wBAAW,UAAU,4CAAc,aAAa,GAAGA,wBAAW,UAAU,+CAAiB,OAAO,GAAGA,wBAAW,UAAU,KAE1H,EAAE,SAAS,IAAI,CAAC,EAClC,KAAKA,wBAAW,QACjB,CAAC,KAAK,GAAG;CAGV,MAAM,EAAE,YAAY,cAAc,MAAM,0EACnB;EACj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WAAW,cAAc,MAAM,iBAAiB,OAAO,qEAAuC,YAAY,MAAM,CAAC,uCAEjH,UAAU,UACV;EAEF,MAAM,6BACJ,WAAW,cAAc,MAAM,iBAAiB,OAAO,kFAAoD,QAAQ,MAAM,CAAC,2BAEzH,QAAQ,mBAAmB,MAC5B;EAEF,MAAM,sBAAsB,+CAAmB,YAAY;GACzD,MAAM,SAAS,MAAMC,4CACnB;IACE;KAAE,MAAM;KAAU,SAAS;KAAY;IACvC;KAAE,MAAM;KAAU,SAAS,2BAA2B;KAAE;IACxD;KAAE,MAAM;KAAU,SAAS,sBAAsB;KAAE;IACnD;KACE,MAAM;KACN,SAAS,yFAA4D,cAAc,CAAC,kDAAqB,iBAAiB,OAAO,CAAC,iFAAgD,QAAQC,gCAAQ,CAAC,IAAI,OAAO;KAC/M;IACF,EACD,CAAC;IAAE,MAAM;IAAQ,SAAS,UAAU;IAAS,CAAC,EAC9C,WACA,eACA,UACA,SACD;AAED,qBACE,GAAG,qDAAwB,OAAO,UAAU,CAAC,mEAAsC,cAAc,CAAC,kDAAqB,iBAAiB,OAAO,GAChJ;GAED,IAAI,iBAAiBC,8CACnB,QAAQ,aACR,UAAU,QACX;AACD,oBAAiBC,0DAAsB,gBAAgB,UAAU,QAAQ;AAQzE,OAAI,CANYC,oDACd,UAAU,SACV,gBACA,kBAGU,CACV,OAAM,IAAI,MACR,0EACD;AAGH,UAAO;IACP,EAAE;AAEJ,sBAAoB,IAAI,QAAQ,aAAa,oBAAoB;AAGjE,qBAAmB;;AAGrB,mBACE,yCAAY,KAAKL,wBAAW,MAAM,CAAC,iDAAmB,eAAe,CAAC,gCACvE"}
1
+ {"version":3,"file":"reviewDocBlockAware.cjs","names":["readAsset","ANSIColors","chunkInference","ENGLISH","sanitizeChunk","fixChunkStartEndChars","validateTranslation"],"sources":["../../../src/reviewDoc/reviewDocBlockAware.ts"],"sourcesContent":["import { mkdirSync, writeFileSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { dirname } from 'node:path';\nimport { readAsset } from 'utils:asset';\nimport type { AIConfig } from '@intlayer/ai';\nimport type { AIOptions } from '@intlayer/api';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colon,\n colorize,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { retryManager } from '@intlayer/config/utils';\nimport { getLocaleName } from '@intlayer/core/localization';\nimport {\n buildAlignmentPlan,\n mergeReviewedSegments,\n} from '@intlayer/engine/docReview';\nimport { formatLocale, formatPath } from '@intlayer/engine/utils';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport { ENGLISH } from '@intlayer/types/locales';\nimport { sanitizeChunk, validateTranslation } from '../translateDoc/validation';\nimport { chunkInference } from '../utils/chunkInference';\nimport { fixChunkStartEndChars } from '../utils/fixChunkStartEndChars';\nimport type { AIClient } from '../utils/setupAI';\n\n/**\n * Review a file using block-aware alignment.\n *\n * 1. Segments both base and target documents into semantic blocks.\n * 2. Aligns blocks using structure (special chars, numbers) and context.\n * 3. Detects which blocks changed, were added, or deleted.\n * 4. Applies deletions immediately without AI.\n * 5. Sends changed/new blocks to AI in bottom-up order (last block first), so\n * line numbers of earlier blocks are not shifted by edits below them.\n * 6. Rewrites the file after each block so progress is persisted incrementally.\n */\nexport const reviewFileBlockAware = async (\n baseFilePath: string,\n outputFilePath: string,\n locale: Locale,\n baseLocale: Locale,\n aiOptions?: AIOptions,\n configOptions?: GetConfigurationOptions,\n customInstructions?: string,\n changedLines?: number[],\n aiClient?: AIClient,\n aiConfig?: AIConfig\n) => {\n const configuration = getConfiguration(configOptions);\n const applicationLogger = getAppLogger({\n log: { ...configuration.log, prefix: '' },\n });\n\n const baseText = await readFile(baseFilePath, 'utf-8');\n const targetText = await readFile(outputFilePath, 'utf-8').catch(() => '');\n\n const basePrompt = readAsset('./prompts/REVIEW_PROMPT.md', 'utf-8')\n .replaceAll('{{localeName}}', `${formatLocale(locale, false)}`)\n .replaceAll('{{baseLocaleName}}', `${formatLocale(baseLocale, false)}`)\n .replace('{{applicationContext}}', aiOptions?.applicationContext ?? '-')\n .replace('{{customInstructions}}', customInstructions ?? '-');\n\n const filePrefixText = `${ANSIColors.GREY_DARK}[${formatPath(baseFilePath)}${ANSIColors.GREY_DARK}] `;\n const filePrefix = [\n colon(filePrefixText, { colSize: 40 }),\n `→ ${ANSIColors.RESET}`,\n ].join('');\n const prefixText = `${ANSIColors.GREY_DARK}[${formatPath(baseFilePath)}${ANSIColors.GREY_DARK}][${formatLocale(locale)}${ANSIColors.GREY_DARK}] `;\n const prefix = [\n colon(prefixText, { colSize: 40 }),\n `→ ${ANSIColors.RESET}`,\n ].join('');\n\n // Build block-aware alignment and plan\n const { baseBlocks, targetBlocks, plan, segmentsToReview } =\n buildAlignmentPlan({\n baseText,\n targetText,\n changedLines,\n });\n\n const deleteCount = plan.actions.filter((a) => a.kind === 'delete').length;\n\n applicationLogger(\n `${filePrefix}Block-aware alignment complete. Total blocks: base=${colorizeNumber(baseBlocks.length)}, target=${colorizeNumber(targetBlocks.length)}`\n );\n applicationLogger(\n `${filePrefix}Actions: reuse=${colorizeNumber(plan.actions.filter((a) => a.kind === 'reuse').length)}, review=${colorizeNumber(plan.actions.filter((a) => a.kind === 'review').length)}, new=${colorizeNumber(plan.actions.filter((a) => a.kind === 'insert_new').length)}, delete=${colorizeNumber(deleteCount)}`\n );\n\n // Map shared across the entire run: each entry overrides the default behavior\n // of mergeReviewedSegments for that action index.\n const reviewedSegmentsMap = new Map<number, string>();\n\n // --- Step 1: apply deletions immediately (no AI needed) ---\n for (const [actionIndex, action] of plan.actions.entries()) {\n if (action.kind === 'delete') {\n reviewedSegmentsMap.set(actionIndex, '');\n }\n }\n\n const writeCurrentState = (): void => {\n const output = mergeReviewedSegments(\n plan,\n targetBlocks,\n reviewedSegmentsMap\n );\n mkdirSync(dirname(outputFilePath), { recursive: true });\n writeFileSync(outputFilePath, output);\n };\n\n if (deleteCount > 0) {\n writeCurrentState();\n applicationLogger(\n `${filePrefix}${colorizeNumber(deleteCount)} block(s) deleted without AI.`\n );\n }\n\n if (segmentsToReview.length === 0) {\n if (deleteCount === 0) {\n applicationLogger(\n `${filePrefix}No segments need review, reusing existing translation`\n );\n writeCurrentState();\n }\n applicationLogger(\n `${colorize('✔', ANSIColors.GREEN)} File ${formatPath(outputFilePath)} updated successfully (no AI changes needed).`\n );\n return;\n }\n\n applicationLogger(\n `${filePrefix}Segments to review: ${colorizeNumber(segmentsToReview.length)} (processing bottom-up)`\n );\n\n // --- Step 2: process AI segments in bottom-up order ---\n // Reversing ensures edits near the end of the file don't shift line numbers\n // that matter for blocks higher up, and each intermediate file write is valid.\n const segmentsBottomUp = segmentsToReview\n .map((segment, originalIndex) => ({\n segment,\n displayNumber: originalIndex + 1,\n }))\n .reverse();\n\n for (const { segment, displayNumber } of segmentsBottomUp) {\n const baseBlock = segment.baseBlock;\n\n const getBaseChunkContextPrompt = () =>\n `**BLOCK ${displayNumber} of ${segmentsToReview.length}** is the base block in ${formatLocale(baseLocale, false)} as reference.\\n` +\n `///chunksStart///\\n` +\n baseBlock.content +\n `///chunksEnd///`;\n\n const getTargetChunkPrompt = () =>\n `**BLOCK ${displayNumber} of ${segmentsToReview.length}** is the current block to review in ${formatLocale(locale, false)}.\\n` +\n `///chunksStart///\\n` +\n (segment.targetBlockText ?? '') +\n `///chunksEnd///`;\n\n const reviewedChunkResult = await retryManager(async () => {\n const result = await chunkInference(\n [\n { role: 'system', content: basePrompt },\n { role: 'system', content: getBaseChunkContextPrompt() },\n { role: 'system', content: getTargetChunkPrompt() },\n {\n role: 'system',\n content: `The next user message will be the **BLOCK ${colorizeNumber(displayNumber)} of ${colorizeNumber(segmentsToReview.length)}** that should be translated in ${getLocaleName(locale, ENGLISH)} (${locale}).`,\n },\n ],\n [{ role: 'user', content: baseBlock.content }],\n aiOptions,\n configuration,\n aiClient,\n aiConfig\n );\n\n applicationLogger(\n `${prefix}${colorizeNumber(result.tokenUsed)} tokens used - Block ${colorizeNumber(displayNumber)} of ${colorizeNumber(segmentsToReview.length)}`\n );\n\n let processedChunk = sanitizeChunk(\n result?.fileContent,\n baseBlock.content\n );\n processedChunk = fixChunkStartEndChars(processedChunk, baseBlock.content);\n\n const isValid = validateTranslation(\n baseBlock.content,\n processedChunk,\n applicationLogger\n );\n\n if (!isValid) {\n throw new Error(\n 'Validation failed for chunk (structure or length mismatch). Retrying...'\n );\n }\n\n return processedChunk;\n })();\n\n reviewedSegmentsMap.set(segment.actionIndex, reviewedChunkResult);\n\n // Rewrite the file after every block so progress is never lost.\n writeCurrentState();\n }\n\n applicationLogger(\n `${colorize('✔', ANSIColors.GREEN)} File ${formatPath(outputFilePath)} created/updated successfully.`\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,uBAAuB,OAClC,cACA,gBACA,QACA,YACA,WACA,eACA,oBACA,cACA,UACA,aACG;CACH,MAAM,4DAAiC,aAAa;CACpD,MAAM,8DAAiC,EACrC,KAAK;EAAE,GAAG,cAAc;EAAK,QAAQ;CAAG,EAC1C,CAAC;CAED,MAAM,WAAW,qCAAe,cAAc,OAAO;CACrD,MAAM,aAAa,qCAAe,gBAAgB,OAAO,CAAC,CAAC,YAAY,EAAE;CAEzE,MAAM,aAAaA,+BAAU,8BAA8B,OAAO,CAAC,CAChE,WAAW,kBAAkB,4CAAgB,QAAQ,KAAK,GAAG,CAAC,CAC9D,WAAW,sBAAsB,4CAAgB,YAAY,KAAK,GAAG,CAAC,CACtE,QAAQ,0BAA0B,WAAW,sBAAsB,GAAG,CAAC,CACvE,QAAQ,0BAA0B,sBAAsB,GAAG;CAG9D,MAAM,aAAa,oCACX,GAFkBC,wBAAW,UAAU,0CAAc,YAAY,IAAIA,wBAAW,UAAU,KAE1E,EAAE,SAAS,GAAG,CAAC,GACrC,KAAKA,wBAAW,OAClB,CAAC,CAAC,KAAK,EAAE;CAET,MAAM,SAAS,o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A,kBACE,yCAAY,KAAKL,wBAAW,KAAK,EAAE,+CAAmB,cAAc,EAAE,+BACxE;AACF"}
@@ -1,11 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  let node_fs = require("node:fs");
4
- let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
5
3
  let _intlayer_config_logger = require("@intlayer/config/logger");
6
4
  let _intlayer_config_node = require("@intlayer/config/node");
5
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
7
6
  let node_fs_promises = require("node:fs/promises");
8
- let _intlayer_chokidar_docReview = require("@intlayer/chokidar/docReview");
7
+ let _intlayer_engine_docReview = require("@intlayer/engine/docReview");
9
8
 
10
9
  //#region src/reviewDoc/reviewDocLog.ts
11
10
  /**
@@ -29,16 +28,16 @@ const logReviewFileBlocks = async (baseFilePath, outputFilePath, locale, baseLoc
29
28
  ...(0, _intlayer_config_node.getConfiguration)(configOptions).log,
30
29
  prefix: ""
31
30
  } });
32
- const report = (0, _intlayer_chokidar_docReview.buildReviewReport)({
31
+ const report = (0, _intlayer_engine_docReview.buildReviewReport)({
33
32
  baseText: await (0, node_fs_promises.readFile)(baseFilePath, "utf-8"),
34
33
  targetText: (0, node_fs.existsSync)(outputFilePath) ? await (0, node_fs_promises.readFile)(outputFilePath, "utf-8").catch(() => "") : "",
35
34
  changedLines
36
35
  });
37
- const formatted = (0, _intlayer_chokidar_docReview.formatReviewReport)(report, {
38
- baseLabel: (0, _intlayer_chokidar_utils.formatLocale)(baseLocale),
39
- targetLabel: (0, _intlayer_chokidar_utils.formatLocale)(locale)
36
+ const formatted = (0, _intlayer_engine_docReview.formatReviewReport)(report, {
37
+ baseLabel: (0, _intlayer_engine_utils.formatLocale)(baseLocale),
38
+ targetLabel: (0, _intlayer_engine_utils.formatLocale)(locale)
40
39
  });
41
- appLogger(`${(0, _intlayer_chokidar_utils.formatPath)(baseFilePath)} → ${(0, _intlayer_chokidar_utils.formatLocale)(locale)}`);
40
+ appLogger(`${(0, _intlayer_engine_utils.formatPath)(baseFilePath)} → ${(0, _intlayer_engine_utils.formatLocale)(locale)}`);
42
41
  for (const line of formatted.split("\n")) appLogger(line);
43
42
  return report;
44
43
  };