@intlayer/cli 6.1.6 → 7.0.0-canary.1

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 (287) hide show
  1. package/dist/cjs/IntlayerEventListener.cjs +187 -239
  2. package/dist/cjs/IntlayerEventListener.cjs.map +1 -1
  3. package/dist/cjs/_virtual/_utils_asset.cjs +104 -0
  4. package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
  5. package/dist/cjs/build.cjs +23 -42
  6. package/dist/cjs/build.cjs.map +1 -1
  7. package/dist/cjs/cli.cjs +370 -431
  8. package/dist/cjs/cli.cjs.map +1 -1
  9. package/dist/cjs/config.cjs +10 -35
  10. package/dist/cjs/config.cjs.map +1 -1
  11. package/dist/cjs/editor.cjs +51 -66
  12. package/dist/cjs/editor.cjs.map +1 -1
  13. package/dist/cjs/fill/fill.cjs +73 -301
  14. package/dist/cjs/fill/fill.cjs.map +1 -1
  15. package/dist/cjs/fill/formatAutoFillData.cjs +48 -106
  16. package/dist/cjs/fill/formatAutoFillData.cjs.map +1 -1
  17. package/dist/cjs/fill/formatAutoFilledFilePath.cjs +27 -43
  18. package/dist/cjs/fill/formatAutoFilledFilePath.cjs.map +1 -1
  19. package/dist/cjs/fill/formatFillData.cjs +50 -0
  20. package/dist/cjs/fill/formatFillData.cjs.map +1 -0
  21. package/dist/cjs/fill/groupLimiter.cjs +42 -0
  22. package/dist/cjs/fill/groupLimiter.cjs.map +1 -0
  23. package/dist/cjs/fill/index.cjs +5 -25
  24. package/dist/cjs/fill/listTranslationsTasks.cjs +77 -0
  25. package/dist/cjs/fill/listTranslationsTasks.cjs.map +1 -0
  26. package/dist/cjs/fill/test-original-case.cjs +10 -0
  27. package/dist/cjs/fill/test-original-case.cjs.map +1 -0
  28. package/dist/cjs/fill/translateDictionary.cjs +148 -0
  29. package/dist/cjs/fill/translateDictionary.cjs.map +1 -0
  30. package/dist/cjs/fill/writeAutoFill.cjs +48 -0
  31. package/dist/cjs/fill/writeAutoFill.cjs.map +1 -0
  32. package/dist/cjs/fill/writeFill.cjs +50 -0
  33. package/dist/cjs/fill/writeFill.cjs.map +1 -0
  34. package/dist/cjs/getTargetDictionary.cjs +36 -76
  35. package/dist/cjs/getTargetDictionary.cjs.map +1 -1
  36. package/dist/cjs/index.cjs +31 -45
  37. package/dist/cjs/listContentDeclaration.cjs +36 -64
  38. package/dist/cjs/listContentDeclaration.cjs.map +1 -1
  39. package/dist/cjs/liveSync.cjs +146 -221
  40. package/dist/cjs/liveSync.cjs.map +1 -1
  41. package/dist/cjs/pull.cjs +132 -195
  42. package/dist/cjs/pull.cjs.map +1 -1
  43. package/dist/cjs/push/pullLog.cjs +101 -144
  44. package/dist/cjs/push/pullLog.cjs.map +1 -1
  45. package/dist/cjs/push/push.cjs +159 -249
  46. package/dist/cjs/push/push.cjs.map +1 -1
  47. package/dist/cjs/pushConfig.cjs +18 -45
  48. package/dist/cjs/pushConfig.cjs.map +1 -1
  49. package/dist/cjs/pushLog.cjs +87 -128
  50. package/dist/cjs/pushLog.cjs.map +1 -1
  51. package/dist/cjs/reviewDoc.cjs +183 -291
  52. package/dist/cjs/reviewDoc.cjs.map +1 -1
  53. package/dist/cjs/test/index.cjs +52 -91
  54. package/dist/cjs/test/index.cjs.map +1 -1
  55. package/dist/cjs/test/listMissingTranslations.cjs +35 -62
  56. package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
  57. package/dist/cjs/translateDoc.cjs +127 -221
  58. package/dist/cjs/translateDoc.cjs.map +1 -1
  59. package/dist/cjs/utils/calculateChunks.cjs +85 -115
  60. package/dist/cjs/utils/calculateChunks.cjs.map +1 -1
  61. package/dist/cjs/utils/checkAccess.cjs +33 -72
  62. package/dist/cjs/utils/checkAccess.cjs.map +1 -1
  63. package/dist/cjs/utils/checkFileModifiedRange.cjs +75 -91
  64. package/dist/cjs/utils/checkFileModifiedRange.cjs.map +1 -1
  65. package/dist/cjs/utils/checkLastUpdateTime.cjs +17 -30
  66. package/dist/cjs/utils/checkLastUpdateTime.cjs.map +1 -1
  67. package/dist/cjs/utils/chunkInference.cjs +28 -47
  68. package/dist/cjs/utils/chunkInference.cjs.map +1 -1
  69. package/dist/cjs/utils/fixChunkStartEndChars.cjs +23 -42
  70. package/dist/cjs/utils/fixChunkStartEndChars.cjs.map +1 -1
  71. package/dist/cjs/utils/formatTimeDiff.cjs +17 -43
  72. package/dist/cjs/utils/formatTimeDiff.cjs.map +1 -1
  73. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs +13 -32
  74. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs.map +1 -1
  75. package/dist/cjs/utils/getOutputFilePath.cjs +71 -86
  76. package/dist/cjs/utils/getOutputFilePath.cjs.map +1 -1
  77. package/dist/cjs/utils/getParentPackageJSON.cjs +19 -44
  78. package/dist/cjs/utils/getParentPackageJSON.cjs.map +1 -1
  79. package/dist/cjs/utils/listSpecialChars.cjs +49 -73
  80. package/dist/cjs/utils/listSpecialChars.cjs.map +1 -1
  81. package/dist/cjs/utils/mapChunksBetweenFiles.cjs +90 -132
  82. package/dist/cjs/utils/mapChunksBetweenFiles.cjs.map +1 -1
  83. package/dist/cjs/utils/reorderParagraphs.cjs +86 -118
  84. package/dist/cjs/utils/reorderParagraphs.cjs.map +1 -1
  85. package/dist/cjs/watch.cjs +21 -39
  86. package/dist/cjs/watch.cjs.map +1 -1
  87. package/dist/esm/IntlayerEventListener.mjs +178 -201
  88. package/dist/esm/IntlayerEventListener.mjs.map +1 -1
  89. package/dist/esm/_virtual/_utils_asset.mjs +100 -0
  90. package/dist/esm/_virtual/rolldown_runtime.mjs +8 -0
  91. package/dist/esm/build.mjs +20 -23
  92. package/dist/esm/build.mjs.map +1 -1
  93. package/dist/esm/cli.mjs +349 -380
  94. package/dist/esm/cli.mjs.map +1 -1
  95. package/dist/esm/config.mjs +8 -14
  96. package/dist/esm/config.mjs.map +1 -1
  97. package/dist/esm/editor.mjs +47 -41
  98. package/dist/esm/editor.mjs.map +1 -1
  99. package/dist/esm/fill/fill.mjs +68 -300
  100. package/dist/esm/fill/fill.mjs.map +1 -1
  101. package/dist/esm/fill/formatAutoFillData.mjs +47 -81
  102. package/dist/esm/fill/formatAutoFillData.mjs.map +1 -1
  103. package/dist/esm/fill/formatAutoFilledFilePath.mjs +25 -19
  104. package/dist/esm/fill/formatAutoFilledFilePath.mjs.map +1 -1
  105. package/dist/esm/fill/formatFillData.mjs +50 -0
  106. package/dist/esm/fill/formatFillData.mjs.map +1 -0
  107. package/dist/esm/fill/groupLimiter.mjs +40 -0
  108. package/dist/esm/fill/groupLimiter.mjs.map +1 -0
  109. package/dist/esm/fill/index.mjs +4 -3
  110. package/dist/esm/fill/listTranslationsTasks.mjs +70 -0
  111. package/dist/esm/fill/listTranslationsTasks.mjs.map +1 -0
  112. package/dist/esm/fill/test-original-case.mjs +10 -0
  113. package/dist/esm/fill/test-original-case.mjs.map +1 -0
  114. package/dist/esm/fill/translateDictionary.mjs +141 -0
  115. package/dist/esm/fill/translateDictionary.mjs.map +1 -0
  116. package/dist/esm/fill/writeAutoFill.mjs +44 -0
  117. package/dist/esm/fill/writeAutoFill.mjs.map +1 -0
  118. package/dist/esm/fill/writeFill.mjs +45 -0
  119. package/dist/esm/fill/writeFill.mjs.map +1 -0
  120. package/dist/esm/getTargetDictionary.mjs +27 -48
  121. package/dist/esm/getTargetDictionary.mjs.map +1 -1
  122. package/dist/esm/index.mjs +15 -13
  123. package/dist/esm/listContentDeclaration.mjs +28 -43
  124. package/dist/esm/listContentDeclaration.mjs.map +1 -1
  125. package/dist/esm/liveSync.mjs +135 -187
  126. package/dist/esm/liveSync.mjs.map +1 -1
  127. package/dist/esm/pull.mjs +125 -178
  128. package/dist/esm/pull.mjs.map +1 -1
  129. package/dist/esm/push/pullLog.mjs +99 -125
  130. package/dist/esm/push/pullLog.mjs.map +1 -1
  131. package/dist/esm/push/push.mjs +149 -221
  132. package/dist/esm/push/push.mjs.map +1 -1
  133. package/dist/esm/pushConfig.mjs +14 -23
  134. package/dist/esm/pushConfig.mjs.map +1 -1
  135. package/dist/esm/pushLog.mjs +85 -109
  136. package/dist/esm/pushLog.mjs.map +1 -1
  137. package/dist/esm/reviewDoc.mjs +167 -264
  138. package/dist/esm/reviewDoc.mjs.map +1 -1
  139. package/dist/esm/test/index.mjs +47 -73
  140. package/dist/esm/test/index.mjs.map +1 -1
  141. package/dist/esm/test/listMissingTranslations.mjs +30 -41
  142. package/dist/esm/test/listMissingTranslations.mjs.map +1 -1
  143. package/dist/esm/translateDoc.mjs +114 -193
  144. package/dist/esm/translateDoc.mjs.map +1 -1
  145. package/dist/esm/utils/calculateChunks.mjs +83 -91
  146. package/dist/esm/utils/calculateChunks.mjs.map +1 -1
  147. package/dist/esm/utils/checkAccess.mjs +28 -46
  148. package/dist/esm/utils/checkAccess.mjs.map +1 -1
  149. package/dist/esm/utils/checkFileModifiedRange.mjs +73 -65
  150. package/dist/esm/utils/checkFileModifiedRange.mjs.map +1 -1
  151. package/dist/esm/utils/checkLastUpdateTime.mjs +15 -6
  152. package/dist/esm/utils/checkLastUpdateTime.mjs.map +1 -1
  153. package/dist/esm/utils/chunkInference.mjs +24 -24
  154. package/dist/esm/utils/chunkInference.mjs.map +1 -1
  155. package/dist/esm/utils/fixChunkStartEndChars.mjs +22 -18
  156. package/dist/esm/utils/fixChunkStartEndChars.mjs.map +1 -1
  157. package/dist/esm/utils/formatTimeDiff.mjs +16 -19
  158. package/dist/esm/utils/formatTimeDiff.mjs.map +1 -1
  159. package/dist/esm/utils/getIsFileUpdatedRecently.mjs +11 -8
  160. package/dist/esm/utils/getIsFileUpdatedRecently.mjs.map +1 -1
  161. package/dist/esm/utils/getOutputFilePath.mjs +70 -62
  162. package/dist/esm/utils/getOutputFilePath.mjs.map +1 -1
  163. package/dist/esm/utils/getParentPackageJSON.mjs +16 -20
  164. package/dist/esm/utils/getParentPackageJSON.mjs.map +1 -1
  165. package/dist/esm/utils/listSpecialChars.mjs +48 -49
  166. package/dist/esm/utils/listSpecialChars.mjs.map +1 -1
  167. package/dist/esm/utils/mapChunksBetweenFiles.mjs +87 -107
  168. package/dist/esm/utils/mapChunksBetweenFiles.mjs.map +1 -1
  169. package/dist/esm/utils/reorderParagraphs.mjs +85 -93
  170. package/dist/esm/utils/reorderParagraphs.mjs.map +1 -1
  171. package/dist/esm/watch.mjs +17 -17
  172. package/dist/esm/watch.mjs.map +1 -1
  173. package/dist/types/IntlayerEventListener.d.ts +63 -59
  174. package/dist/types/IntlayerEventListener.d.ts.map +1 -1
  175. package/dist/types/build.d.ts +10 -7
  176. package/dist/types/build.d.ts.map +1 -1
  177. package/dist/types/cli.d.ts +13 -10
  178. package/dist/types/cli.d.ts.map +1 -1
  179. package/dist/types/config.d.ts +7 -4
  180. package/dist/types/config.d.ts.map +1 -1
  181. package/dist/types/editor.d.ts +6 -4
  182. package/dist/types/editor.d.ts.map +1 -1
  183. package/dist/types/fill/fill.d.ts +20 -14
  184. package/dist/types/fill/fill.d.ts.map +1 -1
  185. package/dist/types/fill/formatAutoFillData.d.ts +10 -7
  186. package/dist/types/fill/formatAutoFillData.d.ts.map +1 -1
  187. package/dist/types/fill/formatAutoFilledFilePath.d.ts +6 -2
  188. package/dist/types/fill/formatAutoFilledFilePath.d.ts.map +1 -1
  189. package/dist/types/fill/formatFillData.d.ts +12 -0
  190. package/dist/types/fill/formatFillData.d.ts.map +1 -0
  191. package/dist/types/fill/groupLimiter.d.ts +15 -0
  192. package/dist/types/fill/groupLimiter.d.ts.map +1 -0
  193. package/dist/types/fill/index.d.ts +3 -3
  194. package/dist/types/fill/listTranslationsTasks.d.ts +15 -0
  195. package/dist/types/fill/listTranslationsTasks.d.ts.map +1 -0
  196. package/dist/types/fill/test-original-case.d.ts +1 -0
  197. package/dist/types/fill/translateDictionary.d.ts +19 -0
  198. package/dist/types/fill/translateDictionary.d.ts.map +1 -0
  199. package/dist/types/fill/writeAutoFill.d.ts +7 -0
  200. package/dist/types/fill/writeAutoFill.d.ts.map +1 -0
  201. package/dist/types/fill/writeFill.d.ts +7 -0
  202. package/dist/types/fill/writeFill.d.ts.map +1 -0
  203. package/dist/types/getTargetDictionary.d.ts +17 -13
  204. package/dist/types/getTargetDictionary.d.ts.map +1 -1
  205. package/dist/types/index.d.ts +15 -14
  206. package/dist/types/listContentDeclaration.d.ts +10 -7
  207. package/dist/types/listContentDeclaration.d.ts.map +1 -1
  208. package/dist/types/liveSync.d.ts +8 -3
  209. package/dist/types/liveSync.d.ts.map +1 -1
  210. package/dist/types/pull.d.ts +9 -6
  211. package/dist/types/pull.d.ts.map +1 -1
  212. package/dist/types/push/pullLog.d.ts +25 -21
  213. package/dist/types/push/pullLog.d.ts.map +1 -1
  214. package/dist/types/push/push.d.ts +13 -9
  215. package/dist/types/push/push.d.ts.map +1 -1
  216. package/dist/types/pushConfig.d.ts +7 -4
  217. package/dist/types/pushConfig.d.ts.map +1 -1
  218. package/dist/types/pushLog.d.ts +23 -20
  219. package/dist/types/pushLog.d.ts.map +1 -1
  220. package/dist/types/reviewDoc.d.ts +34 -17
  221. package/dist/types/reviewDoc.d.ts.map +1 -1
  222. package/dist/types/test/index.d.ts +9 -5
  223. package/dist/types/test/index.d.ts.map +1 -1
  224. package/dist/types/test/listMissingTranslations.d.ts +14 -10
  225. package/dist/types/test/listMissingTranslations.d.ts.map +1 -1
  226. package/dist/types/translateDoc.d.ts +34 -17
  227. package/dist/types/translateDoc.d.ts.map +1 -1
  228. package/dist/types/utils/calculateChunks.d.ts +10 -7
  229. package/dist/types/utils/calculateChunks.d.ts.map +1 -1
  230. package/dist/types/utils/checkAccess.d.ts +8 -4
  231. package/dist/types/utils/checkAccess.d.ts.map +1 -1
  232. package/dist/types/utils/checkFileModifiedRange.d.ts +8 -6
  233. package/dist/types/utils/checkFileModifiedRange.d.ts.map +1 -1
  234. package/dist/types/utils/checkLastUpdateTime.d.ts +4 -1
  235. package/dist/types/utils/checkLastUpdateTime.d.ts.map +1 -1
  236. package/dist/types/utils/chunkInference.d.ts +9 -6
  237. package/dist/types/utils/chunkInference.d.ts.map +1 -1
  238. package/dist/types/utils/fixChunkStartEndChars.d.ts +4 -1
  239. package/dist/types/utils/fixChunkStartEndChars.d.ts.map +1 -1
  240. package/dist/types/utils/formatTimeDiff.d.ts +4 -1
  241. package/dist/types/utils/formatTimeDiff.d.ts.map +1 -1
  242. package/dist/types/utils/getIsFileUpdatedRecently.d.ts +4 -1
  243. package/dist/types/utils/getIsFileUpdatedRecently.d.ts.map +1 -1
  244. package/dist/types/utils/getOutputFilePath.d.ts +7 -2
  245. package/dist/types/utils/getOutputFilePath.d.ts.map +1 -1
  246. package/dist/types/utils/getParentPackageJSON.d.ts +30 -28
  247. package/dist/types/utils/getParentPackageJSON.d.ts.map +1 -1
  248. package/dist/types/utils/listSpecialChars.d.ts +9 -7
  249. package/dist/types/utils/listSpecialChars.d.ts.map +1 -1
  250. package/dist/types/utils/mapChunksBetweenFiles.d.ts +10 -6
  251. package/dist/types/utils/mapChunksBetweenFiles.d.ts.map +1 -1
  252. package/dist/types/utils/reorderParagraphs.d.ts +4 -1
  253. package/dist/types/utils/reorderParagraphs.d.ts.map +1 -1
  254. package/dist/types/watch.d.ts +9 -6
  255. package/dist/types/watch.d.ts.map +1 -1
  256. package/package.json +42 -47
  257. package/LICENSE +0 -202
  258. package/dist/cjs/fill/autoFill.cjs +0 -105
  259. package/dist/cjs/fill/autoFill.cjs.map +0 -1
  260. package/dist/cjs/fill/index.cjs.map +0 -1
  261. package/dist/cjs/index.cjs.map +0 -1
  262. package/dist/cjs/utils/getChunk.cjs +0 -77
  263. package/dist/cjs/utils/getChunk.cjs.map +0 -1
  264. package/dist/cjs/utils/splitTextByLine.cjs +0 -35
  265. package/dist/cjs/utils/splitTextByLine.cjs.map +0 -1
  266. package/dist/esm/fill/autoFill.mjs +0 -92
  267. package/dist/esm/fill/autoFill.mjs.map +0 -1
  268. package/dist/esm/fill/index.mjs.map +0 -1
  269. package/dist/esm/index.mjs.map +0 -1
  270. package/dist/esm/prompts/REVIEW_PROMPT.md +0 -37
  271. package/dist/esm/prompts/TRANSLATE_PROMPT.md +0 -38
  272. package/dist/esm/utils/calculrateChunkTest.md +0 -9
  273. package/dist/esm/utils/getChunk.mjs +0 -53
  274. package/dist/esm/utils/getChunk.mjs.map +0 -1
  275. package/dist/esm/utils/splitTextByLine.mjs +0 -11
  276. package/dist/esm/utils/splitTextByLine.mjs.map +0 -1
  277. package/dist/types/fill/autoFill.d.ts +0 -4
  278. package/dist/types/fill/autoFill.d.ts.map +0 -1
  279. package/dist/types/fill/index.d.ts.map +0 -1
  280. package/dist/types/index.d.ts.map +0 -1
  281. package/dist/types/utils/getChunk.d.ts +0 -9
  282. package/dist/types/utils/getChunk.d.ts.map +0 -1
  283. package/dist/types/utils/splitTextByLine.d.ts +0 -2
  284. package/dist/types/utils/splitTextByLine.d.ts.map +0 -1
  285. /package/dist/{cjs → assets}/prompts/REVIEW_PROMPT.md +0 -0
  286. /package/dist/{cjs → assets}/prompts/TRANSLATE_PROMPT.md +0 -0
  287. /package/dist/{cjs/utils/calculrateChunkTest.md → assets/utils/_calculateChunkTest.md} +0 -0
package/dist/cjs/cli.cjs CHANGED
@@ -1,456 +1,395 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var cli_exports = {};
30
- __export(cli_exports, {
31
- dirname: () => dirname,
32
- setAPI: () => setAPI
33
- });
34
- module.exports = __toCommonJS(cli_exports);
35
- var import_built = __toESM(require("@intlayer/config/built"));
36
- var import_commander = require("commander");
37
- var import_path = require("path");
38
- var import_url = require("url");
39
- var import_build = require('./build.cjs');
40
- var import_config = require('./config.cjs');
41
- var import_editor = require('./editor.cjs');
42
- var import_fill = require('./fill/fill.cjs');
43
- var import_listContentDeclaration = require('./listContentDeclaration.cjs');
44
- var import_liveSync = require('./liveSync.cjs');
45
- var import_pull = require('./pull.cjs');
46
- var import_push = require('./push/push.cjs');
47
- var import_pushConfig = require('./pushConfig.cjs');
48
- var import_reviewDoc = require('./reviewDoc.cjs');
49
- var import_test = require('./test/index.cjs');
50
- var import_translateDoc = require('./translateDoc.cjs');
51
- var import_getParentPackageJSON = require('./utils/getParentPackageJSON.cjs');
52
- var import_watch = require('./watch.cjs');
53
- const import_meta = {};
54
- const isESModule = typeof import_meta.url === "string";
55
- const dirname = isESModule ? (0, import_path.dirname)((0, import_url.fileURLToPath)(import_meta.url)) : __dirname;
56
- const packageJson = (0, import_getParentPackageJSON.getParentPackageJSON)(dirname);
57
- const logOptions = [
58
- ["--verbose", "Verbose (default to true using CLI)"],
59
- ["--prefix [prefix]", "Prefix"]
60
- ];
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
+ const require_build = require('./build.cjs');
3
+ const require_config = require('./config.cjs');
4
+ const require_editor = require('./editor.cjs');
5
+ const require_fill_fill = require('./fill/fill.cjs');
6
+ const require_listContentDeclaration = require('./listContentDeclaration.cjs');
7
+ const require_liveSync = require('./liveSync.cjs');
8
+ const require_pull = require('./pull.cjs');
9
+ const require_push_push = require('./push/push.cjs');
10
+ const require_pushConfig = require('./pushConfig.cjs');
11
+ const require_reviewDoc = require('./reviewDoc.cjs');
12
+ const require_test_index = require('./test/index.cjs');
13
+ const require_translateDoc = require('./translateDoc.cjs');
14
+ const require_utils_getParentPackageJSON = require('./utils/getParentPackageJSON.cjs');
15
+ const require_watch = require('./watch.cjs');
16
+ let __intlayer_config = require("@intlayer/config");
17
+ __intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
18
+ let node_path = require("node:path");
19
+ node_path = require_rolldown_runtime.__toESM(node_path);
20
+ let node_url = require("node:url");
21
+ node_url = require_rolldown_runtime.__toESM(node_url);
22
+ let commander = require("commander");
23
+ commander = require_rolldown_runtime.__toESM(commander);
24
+
25
+ //#region src/cli.ts
26
+ const isESModule = typeof require("url").pathToFileURL(__filename).href === "string";
27
+ const dirname = isESModule ? (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href)) : __dirname;
28
+ const packageJson = require_utils_getParentPackageJSON.getParentPackageJSON(dirname);
61
29
  const configurationOptions = [
62
- ["--env-file [envFile]", "Environment file"],
63
- ["-e, --env [env]", "Environment"],
64
- ["--base-dir [baseDir]", "Base directory"],
65
- ...logOptions
30
+ ["--env-file [envFile]", "Environment file"],
31
+ ["-e, --env [env]", "Environment"],
32
+ ["--base-dir [baseDir]", "Base directory"],
33
+ ...[["--verbose", "Verbose (default to true using CLI)"], ["--prefix [prefix]", "Prefix"]]
66
34
  ];
67
35
  const aiOptions = [
68
- ["--provider [provider]", "Provider"],
69
- ["--temperature [temperature]", "Temperature"],
70
- ["--model [model]", "Model"],
71
- ["--api-key [apiKey]", "Provider API key"],
72
- ["--custom-prompt [prompt]", "Custom prompt"],
73
- ["--application-context [applicationContext]", "Application context"]
36
+ ["--provider [provider]", "Provider"],
37
+ ["--temperature [temperature]", "Temperature"],
38
+ ["--model [model]", "Model"],
39
+ ["--api-key [apiKey]", "Provider API key"],
40
+ ["--custom-prompt [prompt]", "Custom prompt"],
41
+ ["--application-context [applicationContext]", "Application context"]
74
42
  ];
75
43
  const gitOptions = [
76
- ["--git-diff [gitDiff]", "Git diff mode - Check git diff between two refs"],
77
- ["--git-diff-base [gitDiffBase]", "Git diff base ref"],
78
- ["--git-diff-current [gitDiffCurrent]", "Git diff current ref"],
79
- ["--uncommitted [uncommitted]", "Uncommitted"],
80
- ["--unpushed [unpushed]", "Unpushed"],
81
- ["--untracked [untracked]", "Untracked"]
44
+ ["--git-diff [gitDiff]", "Git diff mode - Check git diff between two refs"],
45
+ ["--git-diff-base [gitDiffBase]", "Git diff base ref"],
46
+ ["--git-diff-current [gitDiffCurrent]", "Git diff current ref"],
47
+ ["--uncommitted [uncommitted]", "Uncommitted"],
48
+ ["--unpushed [unpushed]", "Unpushed"],
49
+ ["--untracked [untracked]", "Untracked"]
82
50
  ];
83
51
  const extractKeysFromOptions = (options, keys) => keys.filter((key) => options[key]);
52
+ /**
53
+ * Helper functions to apply common options to commands
54
+ */
84
55
  const applyOptions = (command, options) => {
85
- options.forEach(([flag, description]) => command.option(flag, description));
86
- return command;
56
+ options.forEach(([flag, description]) => {
57
+ command.option(flag, description);
58
+ });
59
+ return command;
87
60
  };
88
- const removeUndefined = (obj) => Object.fromEntries(
89
- Object.entries(obj).filter(([_, value]) => value !== void 0)
90
- );
61
+ const removeUndefined = (obj) => Object.fromEntries(Object.entries(obj).filter(([_, value]) => value !== void 0));
91
62
  const applyConfigOptions = (command) => applyOptions(command, configurationOptions);
92
63
  const applyAIOptions = (command) => applyOptions(command, aiOptions);
93
64
  const applyGitOptions = (command) => applyOptions(command, gitOptions);
94
65
  const extractAiOptions = (options) => {
95
- const {
96
- apiKey,
97
- provider,
98
- model,
99
- temperature,
100
- applicationContext,
101
- customPrompt
102
- } = options;
103
- return removeUndefined({
104
- apiKey: apiKey ?? import_built.default.ai?.apiKey,
105
- provider: provider ?? import_built.default.ai?.provider,
106
- model: model ?? import_built.default.ai?.model,
107
- temperature: temperature ?? import_built.default.ai?.temperature,
108
- applicationContext: applicationContext ?? import_built.default.ai?.applicationContext,
109
- customPrompt: customPrompt ?? import_built.default.ai?.customPrompt
110
- });
66
+ const { apiKey, provider, model, temperature, applicationContext, customPrompt } = options;
67
+ const configuration = (0, __intlayer_config.getConfiguration)();
68
+ return removeUndefined({
69
+ apiKey: apiKey ?? configuration.ai?.apiKey,
70
+ provider: provider ?? configuration.ai?.provider,
71
+ model: model ?? configuration.ai?.model,
72
+ temperature: temperature ?? configuration.ai?.temperature,
73
+ applicationContext: applicationContext ?? configuration.ai?.applicationContext,
74
+ customPrompt: customPrompt ?? configuration.ai?.customPrompt
75
+ });
111
76
  };
112
77
  const gitOptionKeys = [
113
- "gitDiff",
114
- "gitDiffBase",
115
- "gitDiffCurrent",
116
- "uncommitted",
117
- "unpushed",
118
- "untracked"
78
+ "gitDiff",
79
+ "gitDiffBase",
80
+ "gitDiffCurrent",
81
+ "uncommitted",
82
+ "unpushed",
83
+ "untracked"
119
84
  ];
120
85
  const extractGitOptions = (options) => {
121
- const filteredOptions = extractKeysFromOptions(options, gitOptionKeys);
122
- const isOptionEmpty = !Object.values(filteredOptions).some(Boolean);
123
- if (isOptionEmpty) return void 0;
124
- const {
125
- gitDiff,
126
- gitDiffBase,
127
- gitDiffCurrent,
128
- uncommitted,
129
- unpushed,
130
- untracked
131
- } = options;
132
- const mode = [
133
- gitDiff && "gitDiff",
134
- uncommitted && "uncommitted",
135
- unpushed && "unpushed",
136
- untracked && "untracked"
137
- ].filter(Boolean);
138
- return removeUndefined({
139
- mode,
140
- baseRef: gitDiffBase,
141
- currentRef: gitDiffCurrent,
142
- absolute: true
143
- });
86
+ const filteredOptions = extractKeysFromOptions(options, gitOptionKeys);
87
+ if (!Object.values(filteredOptions).some(Boolean)) return void 0;
88
+ const { gitDiff, gitDiffBase, gitDiffCurrent, uncommitted, unpushed, untracked } = options;
89
+ return removeUndefined({
90
+ mode: [
91
+ gitDiff && "gitDiff",
92
+ uncommitted && "uncommitted",
93
+ unpushed && "unpushed",
94
+ untracked && "untracked"
95
+ ].filter(Boolean),
96
+ baseRef: gitDiffBase,
97
+ currentRef: gitDiffCurrent,
98
+ absolute: true
99
+ });
144
100
  };
145
101
  const configurationOptionKeys = [
146
- "baseDir",
147
- "env",
148
- "envFile",
149
- "verbose",
150
- "prefix"
102
+ "baseDir",
103
+ "env",
104
+ "envFile",
105
+ "verbose",
106
+ "prefix"
151
107
  ];
152
108
  const extractConfigOptions = (options) => {
153
- const filteredOptions = extractKeysFromOptions(
154
- options,
155
- configurationOptionKeys
156
- );
157
- const isOptionEmpty = !Object.values(filteredOptions).some(Boolean);
158
- if (isOptionEmpty) {
159
- return void 0;
160
- }
161
- const { baseDir, env, envFile, verbose, prefix } = options;
162
- const log = {
163
- prefix: prefix ?? "",
164
- // Should not consider the prefix set in the intlayer configuration file
165
- verbose: verbose ?? true
166
- };
167
- const override = {
168
- log
169
- };
170
- return removeUndefined({
171
- baseDir,
172
- env,
173
- envFile,
174
- override
175
- });
109
+ const configuration = (0, __intlayer_config.getConfiguration)(options);
110
+ const filteredOptions = extractKeysFromOptions(options, configurationOptionKeys);
111
+ if (!Object.values(filteredOptions).some(Boolean)) return;
112
+ const { baseDir, env, envFile, verbose, prefix } = options;
113
+ const addPrefix = Boolean(options.with);
114
+ return removeUndefined({
115
+ baseDir,
116
+ env,
117
+ envFile,
118
+ override: { log: {
119
+ prefix: prefix ?? addPrefix ? configuration.log.prefix : "",
120
+ verbose: verbose ?? true
121
+ } }
122
+ });
176
123
  };
124
+ /**
125
+ * Set the API for the CLI
126
+ *
127
+ * Example of commands:
128
+ *
129
+ * npm run intlayer build --watch
130
+ * npm run intlayer push --dictionaries id1 id2 id3 --deleteLocaleDir
131
+ */
177
132
  const setAPI = () => {
178
- const program = new import_commander.Command();
179
- program.version(packageJson.version).description("Intlayer CLI");
180
- program.command("version").description("Print the Intlayer CLI version").action(() => {
181
- console.log(packageJson.version ?? "unknown");
182
- });
183
- const dictionariesProgram = program.command("dictionary").alias("dictionaries").alias("dic").description("Dictionaries operations");
184
- const buildOptions = {
185
- description: "Build the dictionaries",
186
- options: [
187
- ["-w, --watch", "Watch for changes"],
188
- ["--skip-prepare", "Skip the prepare step"],
189
- ["--with [with...]", "Start command in parallel with the build"]
190
- ]
191
- };
192
- const dictionariesBuildCmd = dictionariesProgram.command("build").description(buildOptions.description);
193
- applyOptions(dictionariesBuildCmd, buildOptions.options);
194
- applyConfigOptions(dictionariesBuildCmd);
195
- dictionariesBuildCmd.action((options) => {
196
- (0, import_build.build)({
197
- ...options,
198
- configOptions: extractConfigOptions(options)
199
- });
200
- });
201
- const rootBuildCmd = program.command("build").description(buildOptions.description);
202
- applyOptions(rootBuildCmd, buildOptions.options);
203
- applyConfigOptions(rootBuildCmd);
204
- rootBuildCmd.action((options) => {
205
- (0, import_build.build)({
206
- ...options,
207
- configOptions: extractConfigOptions(options)
208
- });
209
- });
210
- const watchOptions = {
211
- description: "Watch the dictionaries changes",
212
- options: [["--with [with...]", "Start command in parallel with the build"]]
213
- };
214
- const dictionariesWatchCmd = dictionariesProgram.command("watch").description(buildOptions.description);
215
- applyOptions(dictionariesWatchCmd, watchOptions.options);
216
- applyConfigOptions(dictionariesWatchCmd);
217
- dictionariesWatchCmd.action((options) => {
218
- (0, import_watch.watchContentDeclaration)({
219
- ...options,
220
- configOptions: extractConfigOptions(options)
221
- });
222
- });
223
- const rootWatchCmd = program.command("watch").description(buildOptions.description);
224
- applyOptions(rootWatchCmd, watchOptions.options);
225
- applyConfigOptions(rootWatchCmd);
226
- rootWatchCmd.action((options) => {
227
- (0, import_watch.watchContentDeclaration)({
228
- ...options,
229
- configOptions: extractConfigOptions(options)
230
- });
231
- });
232
- const pullOptions = {
233
- description: "Pull dictionaries from the server",
234
- options: [
235
- ["-d, --dictionaries [ids...]", "List of dictionary IDs to pull"],
236
- ["--new-dictionaries-path [path]", "Path to save the new dictionaries"],
237
- // Backward-compatibility for older tests/flags (camelCase)
238
- [
239
- "--newDictionariesPath [path]",
240
- "[alias] Path to save the new dictionaries"
241
- ]
242
- ]
243
- };
244
- const dictionariesPullCmd = dictionariesProgram.command("pull").description(pullOptions.description);
245
- applyOptions(dictionariesPullCmd, pullOptions.options);
246
- applyConfigOptions(dictionariesPullCmd);
247
- dictionariesPullCmd.action((options) => {
248
- (0, import_pull.pull)({
249
- ...options,
250
- configOptions: {
251
- ...options.configOptions,
252
- baseDir: options.baseDir
253
- }
254
- });
255
- });
256
- const rootPullCmd = program.command("pull").description(pullOptions.description);
257
- applyOptions(rootPullCmd, pullOptions.options);
258
- applyConfigOptions(rootPullCmd);
259
- rootPullCmd.action((options) => {
260
- (0, import_pull.pull)({
261
- ...options,
262
- configOptions: extractConfigOptions(options)
263
- });
264
- });
265
- const pushOptions = {
266
- description: "Push all dictionaries. Create or update the pushed dictionaries",
267
- options: [
268
- ["-d, --dictionaries [ids...]", "List of dictionary IDs to push"],
269
- [
270
- "-r, --delete-locale-dictionary",
271
- "Delete the local dictionaries after pushing"
272
- ],
273
- [
274
- "-k, --keep-locale-dictionary",
275
- "Keep the local dictionaries after pushing"
276
- ],
277
- // Backward-compatibility for older tests/flags (camelCase)
278
- [
279
- "--deleteLocaleDictionary",
280
- "[alias] Delete the local dictionaries after pushing"
281
- ],
282
- [
283
- "--keepLocaleDictionary",
284
- "[alias] Keep the local dictionaries after pushing"
285
- ]
286
- ]
287
- };
288
- const dictionariesPushCmd = dictionariesProgram.command("push").description(pushOptions.description);
289
- applyOptions(dictionariesPushCmd, pushOptions.options);
290
- applyConfigOptions(dictionariesPushCmd);
291
- applyGitOptions(dictionariesPushCmd);
292
- dictionariesPushCmd.action(
293
- (options) => (0, import_push.push)({
294
- ...options,
295
- gitOptions: extractGitOptions(options),
296
- configOptions: extractConfigOptions(options)
297
- })
298
- );
299
- const rootPushCmd = program.command("push").description(pushOptions.description);
300
- applyOptions(rootPushCmd, pushOptions.options);
301
- applyConfigOptions(rootPushCmd);
302
- applyGitOptions(rootPushCmd);
303
- rootPushCmd.action(
304
- (options) => (0, import_push.push)({
305
- ...options,
306
- gitOptions: extractGitOptions(options),
307
- configOptions: extractConfigOptions(options)
308
- })
309
- );
310
- const configurationProgram = program.command("configuration").alias("config").alias("conf").description("Configuration operations");
311
- const configGetCmd = configurationProgram.command("get").description("Get the configuration");
312
- applyConfigOptions(configGetCmd);
313
- configGetCmd.action((options) => {
314
- (0, import_config.getConfig)({
315
- ...options,
316
- configOptions: extractConfigOptions(options)
317
- });
318
- });
319
- const configPushCmd = configurationProgram.command("push").description("Push the configuration");
320
- applyConfigOptions(configPushCmd);
321
- configPushCmd.action((options) => {
322
- (0, import_pushConfig.pushConfig)({
323
- ...options,
324
- configOptions: extractConfigOptions(options)
325
- });
326
- });
327
- const contentProgram = program.command("content").description("Content declaration operations");
328
- contentProgram.command("list").description("List the content declaration files").action(import_listContentDeclaration.listContentDeclaration);
329
- const testProgram = contentProgram.command("test").description("Test if there are missing translations");
330
- applyConfigOptions(testProgram);
331
- testProgram.action((options) => {
332
- (0, import_test.testMissingTranslations)({
333
- ...options,
334
- configOptions: extractConfigOptions(options)
335
- });
336
- });
337
- const fillProgram = program.command("fill").description("Fill the dictionaries").option("-f, --file [files...]", "List of Dictionary files to fill").option("--source-locale [sourceLocale]", "Source locale to translate from").option(
338
- "--output-locales [outputLocales...]",
339
- "Target locales to translate to"
340
- ).option(
341
- "--mode [mode]",
342
- "Fill mode: complete, review. Complete will fill all missing content, review will fill missing content and review existing keys",
343
- "complete"
344
- ).option("-k, --keys [keys...]", "Filter dictionaries based on keys").option(
345
- "--excluded-keys [excludedKeys...]",
346
- "Filter out dictionaries based on keys"
347
- ).option(
348
- "--path-filter [pathFilters...]",
349
- "Filter dictionaries based on glob pattern"
350
- ).option(
351
- "--build [build]",
352
- "Build the dictionaries before filling to ensure the content is up to date"
353
- );
354
- applyConfigOptions(fillProgram);
355
- applyAIOptions(fillProgram);
356
- applyGitOptions(fillProgram);
357
- fillProgram.action(
358
- (options) => (0, import_fill.fill)({
359
- ...options,
360
- aiOptions: extractAiOptions(options),
361
- gitOptions: extractGitOptions(options),
362
- configOptions: extractConfigOptions(options)
363
- })
364
- );
365
- const docParams = [
366
- ["--doc-pattern [docPattern...]", "Documentation pattern"],
367
- [
368
- "--excluded-glob-pattern [excludedGlobPattern...]",
369
- "Excluded glob pattern"
370
- ],
371
- [
372
- "--nb-simultaneous-file-processed [nbSimultaneousFileProcessed]",
373
- "Number of simultaneous file processed"
374
- ],
375
- ["--locales [locales...]", "Locales"],
376
- ["--base-locale [baseLocale]", "Base locale"],
377
- [
378
- "--custom-instructions [customInstructions]",
379
- "Custom instructions added to the prompt. Usefull to apply specific rules regarding formatting, urls translation, etc."
380
- ],
381
- [
382
- "--skip-if-modified-before [skipIfModifiedBefore]",
383
- 'Skip the file if it has been modified before the given time. Can be an absolute time as "2025-12-05" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.'
384
- ],
385
- [
386
- "--skip-if-modified-after [skipIfModifiedAfter]",
387
- 'Skip the file if it has been modified within the given time. Can be an absolute time as "2025-12-05" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.'
388
- ]
389
- ];
390
- const docProgram = program.command("doc").description("Documentation operations");
391
- const translateProgram = docProgram.command("translate").description("Translate the documentation");
392
- applyConfigOptions(translateProgram);
393
- applyAIOptions(translateProgram);
394
- applyGitOptions(translateProgram);
395
- applyOptions(translateProgram, docParams);
396
- translateProgram.action(
397
- (options) => (0, import_translateDoc.translateDoc)({
398
- docPattern: options.docPattern,
399
- excludedGlobPattern: options.excludedGlobPattern,
400
- locales: options.locales,
401
- baseLocale: options.baseLocale,
402
- aiOptions: extractAiOptions(options),
403
- gitOptions: extractGitOptions(options),
404
- nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,
405
- configOptions: extractConfigOptions(options),
406
- customInstructions: options.customInstructions,
407
- skipIfModifiedBefore: options.skipIfModifiedBefore,
408
- skipIfModifiedAfter: options.skipIfModifiedAfter
409
- })
410
- );
411
- const reviewProgram = docProgram.command("review").description("Review the documentation");
412
- applyConfigOptions(reviewProgram);
413
- applyAIOptions(reviewProgram);
414
- applyGitOptions(reviewProgram);
415
- applyOptions(reviewProgram, docParams);
416
- reviewProgram.action(
417
- (options) => (0, import_reviewDoc.reviewDoc)({
418
- docPattern: options.docPattern,
419
- excludedGlobPattern: options.excludedGlobPattern,
420
- locales: options.locales,
421
- baseLocale: options.baseLocale,
422
- aiOptions: extractAiOptions(options),
423
- gitOptions: extractGitOptions(options),
424
- nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,
425
- configOptions: extractConfigOptions(options),
426
- customInstructions: options.customInstructions,
427
- skipIfModifiedBefore: options.skipIfModifiedBefore,
428
- skipIfModifiedAfter: options.skipIfModifiedAfter
429
- })
430
- );
431
- const liveOptions = [
432
- ["--with [with...]", "Start command in parallel with the live sync"]
433
- ];
434
- const liveCmd = program.command("live").description(
435
- "Live sync - Watch for changes made on the CMS and update the application content accordingly"
436
- );
437
- applyOptions(liveCmd, liveOptions);
438
- liveCmd.action((options) => (0, import_liveSync.liveSync)(options));
439
- const editorProgram = program.command("editor").description("Visual editor operations");
440
- const editorStartCmd = editorProgram.command("start").description("Start the Intlayer visual editor");
441
- applyConfigOptions(editorStartCmd);
442
- editorStartCmd.action((options) => {
443
- (0, import_editor.startEditor)({
444
- env: options.env,
445
- envFile: options.envFile
446
- });
447
- });
448
- program.parse(process.argv);
449
- return program;
133
+ const program = new commander.Command();
134
+ program.version(packageJson.version).description("Intlayer CLI");
135
+ program.command("version").description("Print the Intlayer CLI version").action(() => {
136
+ console.log(packageJson.version ?? "unknown");
137
+ });
138
+ /**
139
+ * DICTIONARIES
140
+ */
141
+ const dictionariesProgram = program.command("dictionary").alias("dictionaries").alias("dic").description("Dictionaries operations");
142
+ const buildOptions = {
143
+ description: "Build the dictionaries",
144
+ options: [
145
+ ["-w, --watch", "Watch for changes"],
146
+ ["--skip-prepare", "Skip the prepare step"],
147
+ ["--with [with...]", "Start command in parallel with the build"]
148
+ ]
149
+ };
150
+ const dictionariesBuildCmd = dictionariesProgram.command("build").description(buildOptions.description);
151
+ applyOptions(dictionariesBuildCmd, buildOptions.options);
152
+ applyConfigOptions(dictionariesBuildCmd);
153
+ dictionariesBuildCmd.action((options) => {
154
+ require_build.build({
155
+ ...options,
156
+ configOptions: extractConfigOptions(options)
157
+ });
158
+ });
159
+ const rootBuildCmd = program.command("build").description(buildOptions.description);
160
+ applyOptions(rootBuildCmd, buildOptions.options);
161
+ applyConfigOptions(rootBuildCmd);
162
+ rootBuildCmd.action((options) => {
163
+ require_build.build({
164
+ ...options,
165
+ configOptions: extractConfigOptions(options)
166
+ });
167
+ });
168
+ const watchOptions = {
169
+ description: "Watch the dictionaries changes",
170
+ options: [["--with [with...]", "Start command in parallel with the build"]]
171
+ };
172
+ const dictionariesWatchCmd = dictionariesProgram.command("watch").description(buildOptions.description);
173
+ applyOptions(dictionariesWatchCmd, watchOptions.options);
174
+ applyConfigOptions(dictionariesWatchCmd);
175
+ dictionariesWatchCmd.action((options) => {
176
+ require_watch.watchContentDeclaration({
177
+ ...options,
178
+ configOptions: extractConfigOptions(options)
179
+ });
180
+ });
181
+ const rootWatchCmd = program.command("watch").description(buildOptions.description);
182
+ applyOptions(rootWatchCmd, watchOptions.options);
183
+ applyConfigOptions(rootWatchCmd);
184
+ rootWatchCmd.action((options) => {
185
+ require_watch.watchContentDeclaration({
186
+ ...options,
187
+ configOptions: extractConfigOptions(options)
188
+ });
189
+ });
190
+ const pullOptions = {
191
+ description: "Pull dictionaries from the server",
192
+ options: [
193
+ ["-d, --dictionaries [ids...]", "List of dictionary IDs to pull"],
194
+ ["--dictionary [ids...]", "List of dictionary IDs to pull (alias for --dictionaries)"],
195
+ ["--new-dictionaries-path [path]", "Path to save the new dictionaries"],
196
+ ["--newDictionariesPath [path]", "[alias] Path to save the new dictionaries"]
197
+ ]
198
+ };
199
+ const dictionariesPullCmd = dictionariesProgram.command("pull").description(pullOptions.description);
200
+ applyOptions(dictionariesPullCmd, pullOptions.options);
201
+ applyConfigOptions(dictionariesPullCmd);
202
+ dictionariesPullCmd.action((options) => {
203
+ const dictionaries = [...options.dictionaries ?? [], ...options.dictionary ?? []];
204
+ require_pull.pull({
205
+ ...options,
206
+ dictionaries: dictionaries.length > 0 ? dictionaries : void 0,
207
+ configOptions: {
208
+ ...options.configOptions,
209
+ baseDir: options.baseDir
210
+ }
211
+ });
212
+ });
213
+ const rootPullCmd = program.command("pull").description(pullOptions.description);
214
+ applyOptions(rootPullCmd, pullOptions.options);
215
+ applyConfigOptions(rootPullCmd);
216
+ rootPullCmd.action((options) => {
217
+ const dictionaries = [...options.dictionaries ?? [], ...options.dictionary ?? []];
218
+ require_pull.pull({
219
+ ...options,
220
+ dictionaries: dictionaries.length > 0 ? dictionaries : void 0,
221
+ configOptions: extractConfigOptions(options)
222
+ });
223
+ });
224
+ const pushOptions = {
225
+ description: "Push all dictionaries. Create or update the pushed dictionaries",
226
+ options: [
227
+ ["-d, --dictionaries [ids...]", "List of dictionary IDs to push"],
228
+ ["--dictionary [ids...]", "List of dictionary IDs to push (alias for --dictionaries)"],
229
+ ["-r, --delete-locale-dictionary", "Delete the local dictionaries after pushing"],
230
+ ["-k, --keep-locale-dictionary", "Keep the local dictionaries after pushing"],
231
+ ["--deleteLocaleDictionary", "[alias] Delete the local dictionaries after pushing"],
232
+ ["--keepLocaleDictionary", "[alias] Keep the local dictionaries after pushing"],
233
+ ["--build [build]", "Build the dictionaries before pushing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build"]
234
+ ]
235
+ };
236
+ const dictionariesPushCmd = dictionariesProgram.command("push").description(pushOptions.description);
237
+ applyOptions(dictionariesPushCmd, pushOptions.options);
238
+ applyConfigOptions(dictionariesPushCmd);
239
+ applyGitOptions(dictionariesPushCmd);
240
+ dictionariesPushCmd.action((options) => {
241
+ const dictionaries = [...options.dictionaries || [], ...options.dictionary || []];
242
+ return require_push_push.push({
243
+ ...options,
244
+ dictionaries: dictionaries.length > 0 ? dictionaries : void 0,
245
+ gitOptions: extractGitOptions(options),
246
+ configOptions: extractConfigOptions(options)
247
+ });
248
+ });
249
+ const rootPushCmd = program.command("push").description(pushOptions.description);
250
+ applyOptions(rootPushCmd, pushOptions.options);
251
+ applyConfigOptions(rootPushCmd);
252
+ applyGitOptions(rootPushCmd);
253
+ rootPushCmd.action((options) => {
254
+ const dictionaries = [...options.dictionaries || [], ...options.dictionary || []];
255
+ return require_push_push.push({
256
+ ...options,
257
+ dictionaries: dictionaries.length > 0 ? dictionaries : void 0,
258
+ gitOptions: extractGitOptions(options),
259
+ configOptions: extractConfigOptions(options)
260
+ });
261
+ });
262
+ /**
263
+ * CONFIGURATION
264
+ */
265
+ const configurationProgram = program.command("configuration").alias("config").alias("conf").description("Configuration operations");
266
+ const configGetCmd = configurationProgram.command("get").description("Get the configuration");
267
+ applyConfigOptions(configGetCmd);
268
+ configGetCmd.action((options) => {
269
+ require_config.getConfig({
270
+ ...options,
271
+ configOptions: extractConfigOptions(options)
272
+ });
273
+ });
274
+ const configPushCmd = configurationProgram.command("push").description("Push the configuration");
275
+ applyConfigOptions(configPushCmd);
276
+ configPushCmd.action((options) => {
277
+ require_pushConfig.pushConfig({
278
+ ...options,
279
+ configOptions: extractConfigOptions(options)
280
+ });
281
+ });
282
+ /**
283
+ * CONTENT DECLARATION
284
+ */
285
+ const contentProgram = program.command("content").description("Content declaration operations");
286
+ contentProgram.command("list").description("List the content declaration files").action(require_listContentDeclaration.listContentDeclaration);
287
+ program.command("list").description("List the content declaration files").action(require_listContentDeclaration.listContentDeclaration);
288
+ const testProgram = contentProgram.command("test").description("Test if there are missing translations").option("--build [build]", "Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build");
289
+ applyConfigOptions(testProgram);
290
+ testProgram.action((options) => {
291
+ require_test_index.testMissingTranslations({
292
+ ...options,
293
+ configOptions: extractConfigOptions(options)
294
+ });
295
+ });
296
+ const rootTestCmd = program.command("test").description("Test if there are missing translations").option("--build [build]", "Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build");
297
+ applyConfigOptions(rootTestCmd);
298
+ rootTestCmd.action((options) => {
299
+ require_test_index.testMissingTranslations({
300
+ ...options,
301
+ configOptions: extractConfigOptions(options)
302
+ });
303
+ });
304
+ const fillProgram = program.command("fill").description("Fill the dictionaries").option("-f, --file [files...]", "List of Dictionary files to fill").option("--source-locale [sourceLocale]", "Source locale to translate from").option("--output-locales [outputLocales...]", "Target locales to translate to").option("--mode [mode]", "Fill mode: complete, review. Complete will fill all missing content, review will fill missing content and review existing keys", "complete").option("-k, --keys [keys...]", "Filter dictionaries based on keys").option("--key [keys...]", "Filter dictionaries based on keys (alias for --keys)").option("--excluded-keys [excludedKeys...]", "Filter out dictionaries based on keys").option("--excluded-key [excludedKeys...]", "Filter out dictionaries based on keys (alias for --excluded-keys)").option("--path-filter [pathFilters...]", "Filter dictionaries based on glob pattern").option("--build [build]", "Build the dictionaries before filling to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build").option("--skip-metadata", "Skip filling missing metadata (description, title, tags) for dictionaries");
305
+ applyConfigOptions(fillProgram);
306
+ applyAIOptions(fillProgram);
307
+ applyGitOptions(fillProgram);
308
+ fillProgram.action((options) => {
309
+ const keys = [...options.keys ?? [], ...options.key ?? []];
310
+ const excludedKeys = [...options.excludedKeys ?? [], ...options.excludedKey ?? []];
311
+ const dictionaries = [...options.dictionaries ?? [], ...options.dictionary ?? []];
312
+ return require_fill_fill.fill({
313
+ ...options,
314
+ keys: keys.length > 0 ? keys : void 0,
315
+ excludedKeys: excludedKeys.length > 0 ? excludedKeys : void 0,
316
+ dictionaries: dictionaries.length > 0 ? dictionaries : void 0,
317
+ aiOptions: extractAiOptions(options),
318
+ gitOptions: extractGitOptions(options),
319
+ configOptions: extractConfigOptions(options)
320
+ });
321
+ });
322
+ /**
323
+ * DOCS
324
+ */
325
+ const docParams = [
326
+ ["--doc-pattern [docPattern...]", "Documentation pattern"],
327
+ ["--excluded-glob-pattern [excludedGlobPattern...]", "Excluded glob pattern"],
328
+ ["--nb-simultaneous-file-processed [nbSimultaneousFileProcessed]", "Number of simultaneous file processed"],
329
+ ["--locales [locales...]", "Locales"],
330
+ ["--base-locale [baseLocale]", "Base locale"],
331
+ ["--custom-instructions [customInstructions]", "Custom instructions added to the prompt. Usefull to apply specific rules regarding formatting, urls translation, etc."],
332
+ ["--skip-if-modified-before [skipIfModifiedBefore]", "Skip the file if it has been modified before the given time. Can be an absolute time as \"2025-12-05\" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file."],
333
+ ["--skip-if-modified-after [skipIfModifiedAfter]", "Skip the file if it has been modified within the given time. Can be an absolute time as \"2025-12-05\" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file."]
334
+ ];
335
+ const docProgram = program.command("doc").description("Documentation operations");
336
+ const translateProgram = docProgram.command("translate").description("Translate the documentation");
337
+ applyConfigOptions(translateProgram);
338
+ applyAIOptions(translateProgram);
339
+ applyGitOptions(translateProgram);
340
+ applyOptions(translateProgram, docParams);
341
+ translateProgram.action((options) => require_translateDoc.translateDoc({
342
+ docPattern: options.docPattern,
343
+ excludedGlobPattern: options.excludedGlobPattern,
344
+ locales: options.locales,
345
+ baseLocale: options.baseLocale,
346
+ aiOptions: extractAiOptions(options),
347
+ gitOptions: extractGitOptions(options),
348
+ nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,
349
+ configOptions: extractConfigOptions(options),
350
+ customInstructions: options.customInstructions,
351
+ skipIfModifiedBefore: options.skipIfModifiedBefore,
352
+ skipIfModifiedAfter: options.skipIfModifiedAfter
353
+ }));
354
+ const reviewProgram = docProgram.command("review").description("Review the documentation");
355
+ applyConfigOptions(reviewProgram);
356
+ applyAIOptions(reviewProgram);
357
+ applyGitOptions(reviewProgram);
358
+ applyOptions(reviewProgram, docParams);
359
+ reviewProgram.action((options) => require_reviewDoc.reviewDoc({
360
+ docPattern: options.docPattern,
361
+ excludedGlobPattern: options.excludedGlobPattern,
362
+ locales: options.locales,
363
+ baseLocale: options.baseLocale,
364
+ aiOptions: extractAiOptions(options),
365
+ gitOptions: extractGitOptions(options),
366
+ nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,
367
+ configOptions: extractConfigOptions(options),
368
+ customInstructions: options.customInstructions,
369
+ skipIfModifiedBefore: options.skipIfModifiedBefore,
370
+ skipIfModifiedAfter: options.skipIfModifiedAfter
371
+ }));
372
+ /**
373
+ * LIVE SYNC
374
+ */
375
+ const liveOptions = [["--with [with...]", "Start command in parallel with the live sync"]];
376
+ const liveCmd = program.command("live").description("Live sync - Watch for changes made on the CMS and update the application content accordingly");
377
+ applyOptions(liveCmd, liveOptions);
378
+ applyConfigOptions(liveCmd);
379
+ liveCmd.action((options) => require_liveSync.liveSync(options));
380
+ const editorStartCmd = program.command("editor").description("Visual editor operations").command("start").description("Start the Intlayer visual editor");
381
+ applyConfigOptions(editorStartCmd);
382
+ editorStartCmd.action((options) => {
383
+ require_editor.startEditor({
384
+ env: options.env,
385
+ envFile: options.envFile
386
+ });
387
+ });
388
+ program.parse(process.argv);
389
+ return program;
450
390
  };
451
- // Annotate the CommonJS export names for ESM import in node:
452
- 0 && (module.exports = {
453
- dirname,
454
- setAPI
455
- });
391
+
392
+ //#endregion
393
+ exports.dirname = dirname;
394
+ exports.setAPI = setAPI;
456
395
  //# sourceMappingURL=cli.cjs.map