@intlayer/cli 8.1.2 → 8.1.3
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.
- package/dist/cjs/IntlayerEventListener.cjs +1 -186
- package/dist/cjs/IntlayerEventListener.cjs.map +1 -1
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -29
- package/dist/cjs/_virtual/_utils_asset.cjs +2 -98
- package/dist/cjs/auth/login.cjs +2 -85
- package/dist/cjs/auth/login.cjs.map +1 -1
- package/dist/cjs/build.cjs +1 -27
- package/dist/cjs/build.cjs.map +1 -1
- package/dist/cjs/ci.cjs +1 -73
- package/dist/cjs/ci.cjs.map +1 -1
- package/dist/cjs/cli.cjs +1 -476
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/config.cjs +1 -12
- package/dist/cjs/config.cjs.map +1 -1
- package/dist/cjs/editor.cjs +1 -50
- package/dist/cjs/editor.cjs.map +1 -1
- package/dist/cjs/extract.cjs +1 -96
- package/dist/cjs/extract.cjs.map +1 -1
- package/dist/cjs/fill/deepMergeContent.cjs +1 -27
- package/dist/cjs/fill/deepMergeContent.cjs.map +1 -1
- package/dist/cjs/fill/fill.cjs +1 -78
- package/dist/cjs/fill/fill.cjs.map +1 -1
- package/dist/cjs/fill/formatAutoFilledFilePath.cjs +1 -29
- package/dist/cjs/fill/formatAutoFilledFilePath.cjs.map +1 -1
- package/dist/cjs/fill/formatFillData.cjs +1 -50
- package/dist/cjs/fill/formatFillData.cjs.map +1 -1
- package/dist/cjs/fill/getAvailableLocalesInDictionary.cjs +1 -26
- package/dist/cjs/fill/getAvailableLocalesInDictionary.cjs.map +1 -1
- package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs +1 -50
- package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs.map +1 -1
- package/dist/cjs/fill/index.cjs +1 -6
- package/dist/cjs/fill/listTranslationsTasks.cjs +1 -70
- package/dist/cjs/fill/listTranslationsTasks.cjs.map +1 -1
- package/dist/cjs/fill/mergeChunks.cjs +1 -28
- package/dist/cjs/fill/mergeChunks.cjs.map +1 -1
- package/dist/cjs/fill/translateDictionary.cjs +1 -205
- package/dist/cjs/fill/translateDictionary.cjs.map +1 -1
- package/dist/cjs/fill/writeFill.cjs +1 -54
- package/dist/cjs/fill/writeFill.cjs.map +1 -1
- package/dist/cjs/getTargetDictionary.cjs +1 -36
- package/dist/cjs/getTargetDictionary.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -39
- package/dist/cjs/init.cjs +1 -322
- package/dist/cjs/init.cjs.map +1 -1
- package/dist/cjs/initSkills.cjs +2 -0
- package/dist/cjs/initSkills.cjs.map +1 -0
- package/dist/cjs/listContentDeclaration.cjs +1 -41
- package/dist/cjs/listContentDeclaration.cjs.map +1 -1
- package/dist/cjs/listProjects.cjs +1 -28
- package/dist/cjs/listProjects.cjs.map +1 -1
- package/dist/cjs/liveSync.cjs +8 -151
- package/dist/cjs/liveSync.cjs.map +1 -1
- package/dist/cjs/pull.cjs +1 -146
- package/dist/cjs/pull.cjs.map +1 -1
- package/dist/cjs/push/pullLog.cjs +3 -102
- package/dist/cjs/push/pullLog.cjs.map +1 -1
- package/dist/cjs/push/push.cjs +1 -206
- package/dist/cjs/push/push.cjs.map +1 -1
- package/dist/cjs/pushConfig.cjs +1 -19
- package/dist/cjs/pushConfig.cjs.map +1 -1
- package/dist/cjs/pushLog.cjs +3 -84
- package/dist/cjs/pushLog.cjs.map +1 -1
- package/dist/cjs/reviewDoc/reviewDoc.cjs +1 -68
- package/dist/cjs/reviewDoc/reviewDoc.cjs.map +1 -1
- package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs +1 -94
- package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs.map +1 -1
- package/dist/cjs/searchDoc.cjs +1 -38
- package/dist/cjs/searchDoc.cjs.map +1 -1
- package/dist/cjs/test/index.cjs +1 -7
- package/dist/cjs/test/listMissingTranslations.cjs +1 -49
- package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
- package/dist/cjs/test/test.cjs +1 -53
- package/dist/cjs/test/test.cjs.map +1 -1
- package/dist/cjs/translateDoc/index.cjs +1 -9
- package/dist/cjs/translateDoc/translateDoc.cjs +1 -74
- package/dist/cjs/translateDoc/translateDoc.cjs.map +1 -1
- package/dist/cjs/translateDoc/translateFile.cjs +2 -103
- package/dist/cjs/translateDoc/translateFile.cjs.map +1 -1
- package/dist/cjs/translateDoc/validation.cjs +5 -49
- package/dist/cjs/translateDoc/validation.cjs.map +1 -1
- package/dist/cjs/translation-alignment/alignBlocks.cjs +1 -67
- package/dist/cjs/translation-alignment/alignBlocks.cjs.map +1 -1
- package/dist/cjs/translation-alignment/computeSimilarity.cjs +1 -25
- package/dist/cjs/translation-alignment/computeSimilarity.cjs.map +1 -1
- package/dist/cjs/translation-alignment/fingerprintBlock.cjs +1 -23
- package/dist/cjs/translation-alignment/fingerprintBlock.cjs.map +1 -1
- package/dist/cjs/translation-alignment/index.cjs +1 -22
- package/dist/cjs/translation-alignment/mapChangedLinesToBlocks.cjs +1 -18
- package/dist/cjs/translation-alignment/mapChangedLinesToBlocks.cjs.map +1 -1
- package/dist/cjs/translation-alignment/normalizeBlock.cjs +1 -22
- package/dist/cjs/translation-alignment/normalizeBlock.cjs.map +1 -1
- package/dist/cjs/translation-alignment/pipeline.cjs +1 -37
- package/dist/cjs/translation-alignment/pipeline.cjs.map +1 -1
- package/dist/cjs/translation-alignment/planActions.cjs +1 -46
- package/dist/cjs/translation-alignment/planActions.cjs.map +1 -1
- package/dist/cjs/translation-alignment/rebuildDocument.cjs +2 -49
- package/dist/cjs/translation-alignment/rebuildDocument.cjs.map +1 -1
- package/dist/cjs/translation-alignment/segmentDocument.cjs +5 -66
- package/dist/cjs/translation-alignment/segmentDocument.cjs.map +1 -1
- package/dist/cjs/utils/calculateChunks.cjs +2 -89
- package/dist/cjs/utils/calculateChunks.cjs.map +1 -1
- package/dist/cjs/utils/checkAccess.cjs +1 -81
- package/dist/cjs/utils/checkAccess.cjs.map +1 -1
- package/dist/cjs/utils/checkConfigConsistency.cjs +1 -16
- package/dist/cjs/utils/checkConfigConsistency.cjs.map +1 -1
- package/dist/cjs/utils/checkFileModifiedRange.cjs +1 -81
- package/dist/cjs/utils/checkFileModifiedRange.cjs.map +1 -1
- package/dist/cjs/utils/checkLastUpdateTime.cjs +1 -19
- package/dist/cjs/utils/checkLastUpdateTime.cjs.map +1 -1
- package/dist/cjs/utils/chunkInference.cjs +1 -45
- package/dist/cjs/utils/chunkInference.cjs.map +1 -1
- package/dist/cjs/utils/fixChunkStartEndChars.cjs +3 -27
- package/dist/cjs/utils/fixChunkStartEndChars.cjs.map +1 -1
- package/dist/cjs/utils/formatTimeDiff.cjs +1 -20
- package/dist/cjs/utils/formatTimeDiff.cjs.map +1 -1
- package/dist/cjs/utils/getIsFileUpdatedRecently.cjs +1 -16
- package/dist/cjs/utils/getIsFileUpdatedRecently.cjs.map +1 -1
- package/dist/cjs/utils/getOutputFilePath.cjs +1 -74
- package/dist/cjs/utils/getOutputFilePath.cjs.map +1 -1
- package/dist/cjs/utils/getParentPackageJSON.cjs +1 -20
- package/dist/cjs/utils/getParentPackageJSON.cjs.map +1 -1
- package/dist/cjs/utils/listSpecialChars.cjs +2 -54
- package/dist/cjs/utils/listSpecialChars.cjs.map +1 -1
- package/dist/cjs/utils/mapChunksBetweenFiles.cjs +1 -102
- package/dist/cjs/utils/mapChunksBetweenFiles.cjs.map +1 -1
- package/dist/cjs/utils/openBrowser.cjs +1 -19
- package/dist/cjs/utils/openBrowser.cjs.map +1 -1
- package/dist/cjs/utils/reorderParagraphs.cjs +3 -91
- package/dist/cjs/utils/reorderParagraphs.cjs.map +1 -1
- package/dist/cjs/utils/setupAI.cjs +1 -64
- package/dist/cjs/utils/setupAI.cjs.map +1 -1
- package/dist/cjs/watch.cjs +1 -43
- package/dist/cjs/watch.cjs.map +1 -1
- package/dist/esm/IntlayerEventListener.mjs +1 -183
- package/dist/esm/IntlayerEventListener.mjs.map +1 -1
- package/dist/esm/_virtual/_rolldown/runtime.mjs +1 -8
- package/dist/esm/_virtual/_utils_asset.mjs +2 -97
- package/dist/esm/auth/login.mjs +2 -82
- package/dist/esm/auth/login.mjs.map +1 -1
- package/dist/esm/build.mjs +1 -25
- package/dist/esm/build.mjs.map +1 -1
- package/dist/esm/ci.mjs +1 -71
- package/dist/esm/ci.mjs.map +1 -1
- package/dist/esm/cli.mjs +1 -473
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/config.mjs +1 -10
- package/dist/esm/config.mjs.map +1 -1
- package/dist/esm/editor.mjs +1 -49
- package/dist/esm/editor.mjs.map +1 -1
- package/dist/esm/extract.mjs +1 -93
- package/dist/esm/extract.mjs.map +1 -1
- package/dist/esm/fill/deepMergeContent.mjs +1 -25
- package/dist/esm/fill/deepMergeContent.mjs.map +1 -1
- package/dist/esm/fill/fill.mjs +1 -76
- package/dist/esm/fill/fill.mjs.map +1 -1
- package/dist/esm/fill/formatAutoFilledFilePath.mjs +1 -27
- package/dist/esm/fill/formatAutoFilledFilePath.mjs.map +1 -1
- package/dist/esm/fill/formatFillData.mjs +1 -49
- package/dist/esm/fill/formatFillData.mjs.map +1 -1
- package/dist/esm/fill/getAvailableLocalesInDictionary.mjs +1 -24
- package/dist/esm/fill/getAvailableLocalesInDictionary.mjs.map +1 -1
- package/dist/esm/fill/getFilterMissingContentPerLocale.mjs +1 -48
- package/dist/esm/fill/getFilterMissingContentPerLocale.mjs.map +1 -1
- package/dist/esm/fill/index.mjs +1 -4
- package/dist/esm/fill/listTranslationsTasks.mjs +1 -68
- package/dist/esm/fill/listTranslationsTasks.mjs.map +1 -1
- package/dist/esm/fill/mergeChunks.mjs +1 -26
- package/dist/esm/fill/mergeChunks.mjs.map +1 -1
- package/dist/esm/fill/translateDictionary.mjs +1 -203
- package/dist/esm/fill/translateDictionary.mjs.map +1 -1
- package/dist/esm/fill/writeFill.mjs +1 -52
- package/dist/esm/fill/writeFill.mjs.map +1 -1
- package/dist/esm/getTargetDictionary.mjs +1 -33
- package/dist/esm/getTargetDictionary.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -18
- package/dist/esm/init.mjs +1 -317
- package/dist/esm/init.mjs.map +1 -1
- package/dist/esm/initSkills.mjs +2 -0
- package/dist/esm/initSkills.mjs.map +1 -0
- package/dist/esm/listContentDeclaration.mjs +1 -38
- package/dist/esm/listContentDeclaration.mjs.map +1 -1
- package/dist/esm/listProjects.mjs +1 -26
- package/dist/esm/listProjects.mjs.map +1 -1
- package/dist/esm/liveSync.mjs +8 -148
- package/dist/esm/liveSync.mjs.map +1 -1
- package/dist/esm/pull.mjs +1 -144
- package/dist/esm/pull.mjs.map +1 -1
- package/dist/esm/push/pullLog.mjs +3 -100
- package/dist/esm/push/pullLog.mjs.map +1 -1
- package/dist/esm/push/push.mjs +1 -203
- package/dist/esm/push/push.mjs.map +1 -1
- package/dist/esm/pushConfig.mjs +1 -17
- package/dist/esm/pushConfig.mjs.map +1 -1
- package/dist/esm/pushLog.mjs +3 -82
- package/dist/esm/pushLog.mjs.map +1 -1
- package/dist/esm/reviewDoc/reviewDoc.mjs +1 -65
- package/dist/esm/reviewDoc/reviewDoc.mjs.map +1 -1
- package/dist/esm/reviewDoc/reviewDocBlockAware.mjs +1 -92
- package/dist/esm/reviewDoc/reviewDocBlockAware.mjs.map +1 -1
- package/dist/esm/searchDoc.mjs +1 -36
- package/dist/esm/searchDoc.mjs.map +1 -1
- package/dist/esm/test/index.mjs +1 -4
- package/dist/esm/test/listMissingTranslations.mjs +1 -46
- package/dist/esm/test/listMissingTranslations.mjs.map +1 -1
- package/dist/esm/test/test.mjs +1 -51
- package/dist/esm/test/test.mjs.map +1 -1
- package/dist/esm/translateDoc/index.mjs +1 -5
- package/dist/esm/translateDoc/translateDoc.mjs +1 -71
- package/dist/esm/translateDoc/translateDoc.mjs.map +1 -1
- package/dist/esm/translateDoc/translateFile.mjs +2 -101
- package/dist/esm/translateDoc/translateFile.mjs.map +1 -1
- package/dist/esm/translateDoc/validation.mjs +5 -46
- package/dist/esm/translateDoc/validation.mjs.map +1 -1
- package/dist/esm/translation-alignment/alignBlocks.mjs +1 -66
- package/dist/esm/translation-alignment/alignBlocks.mjs.map +1 -1
- package/dist/esm/translation-alignment/computeSimilarity.mjs +1 -22
- package/dist/esm/translation-alignment/computeSimilarity.mjs.map +1 -1
- package/dist/esm/translation-alignment/fingerprintBlock.mjs +1 -20
- package/dist/esm/translation-alignment/fingerprintBlock.mjs.map +1 -1
- package/dist/esm/translation-alignment/index.mjs +1 -11
- package/dist/esm/translation-alignment/mapChangedLinesToBlocks.mjs +1 -16
- package/dist/esm/translation-alignment/mapChangedLinesToBlocks.mjs.map +1 -1
- package/dist/esm/translation-alignment/normalizeBlock.mjs +1 -20
- package/dist/esm/translation-alignment/normalizeBlock.mjs.map +1 -1
- package/dist/esm/translation-alignment/pipeline.mjs +1 -35
- package/dist/esm/translation-alignment/pipeline.mjs.map +1 -1
- package/dist/esm/translation-alignment/planActions.mjs +1 -44
- package/dist/esm/translation-alignment/planActions.mjs.map +1 -1
- package/dist/esm/translation-alignment/rebuildDocument.mjs +2 -46
- package/dist/esm/translation-alignment/rebuildDocument.mjs.map +1 -1
- package/dist/esm/translation-alignment/segmentDocument.mjs +5 -64
- package/dist/esm/translation-alignment/segmentDocument.mjs.map +1 -1
- package/dist/esm/utils/calculateChunks.mjs +2 -87
- package/dist/esm/utils/calculateChunks.mjs.map +1 -1
- package/dist/esm/utils/checkAccess.mjs +1 -78
- package/dist/esm/utils/checkAccess.mjs.map +1 -1
- package/dist/esm/utils/checkConfigConsistency.mjs +1 -14
- package/dist/esm/utils/checkConfigConsistency.mjs.map +1 -1
- package/dist/esm/utils/checkFileModifiedRange.mjs +1 -80
- package/dist/esm/utils/checkFileModifiedRange.mjs.map +1 -1
- package/dist/esm/utils/checkLastUpdateTime.mjs +1 -17
- package/dist/esm/utils/checkLastUpdateTime.mjs.map +1 -1
- package/dist/esm/utils/chunkInference.mjs +1 -43
- package/dist/esm/utils/chunkInference.mjs.map +1 -1
- package/dist/esm/utils/fixChunkStartEndChars.mjs +3 -25
- package/dist/esm/utils/fixChunkStartEndChars.mjs.map +1 -1
- package/dist/esm/utils/formatTimeDiff.mjs +1 -18
- package/dist/esm/utils/formatTimeDiff.mjs.map +1 -1
- package/dist/esm/utils/getIsFileUpdatedRecently.mjs +1 -14
- package/dist/esm/utils/getIsFileUpdatedRecently.mjs.map +1 -1
- package/dist/esm/utils/getOutputFilePath.mjs +1 -72
- package/dist/esm/utils/getOutputFilePath.mjs.map +1 -1
- package/dist/esm/utils/getParentPackageJSON.mjs +1 -18
- package/dist/esm/utils/getParentPackageJSON.mjs.map +1 -1
- package/dist/esm/utils/listSpecialChars.mjs +2 -52
- package/dist/esm/utils/listSpecialChars.mjs.map +1 -1
- package/dist/esm/utils/mapChunksBetweenFiles.mjs +1 -100
- package/dist/esm/utils/mapChunksBetweenFiles.mjs.map +1 -1
- package/dist/esm/utils/openBrowser.mjs +1 -17
- package/dist/esm/utils/openBrowser.mjs.map +1 -1
- package/dist/esm/utils/reorderParagraphs.mjs +3 -90
- package/dist/esm/utils/reorderParagraphs.mjs.map +1 -1
- package/dist/esm/utils/setupAI.mjs +1 -62
- package/dist/esm/utils/setupAI.mjs.map +1 -1
- package/dist/esm/watch.mjs +1 -41
- package/dist/esm/watch.mjs.map +1 -1
- package/dist/types/auth/login.d.ts +1 -1
- package/dist/types/auth/login.d.ts.map +1 -1
- package/dist/types/build.d.ts +1 -1
- package/dist/types/build.d.ts.map +1 -1
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/types/extract.d.ts +1 -1
- package/dist/types/extract.d.ts.map +1 -1
- package/dist/types/fill/fill.d.ts +1 -1
- package/dist/types/fill/fill.d.ts.map +1 -1
- package/dist/types/fill/translateDictionary.d.ts +2 -2
- package/dist/types/fill/translateDictionary.d.ts.map +1 -1
- package/dist/types/fill/writeFill.d.ts.map +1 -1
- package/dist/types/getTargetDictionary.d.ts +2 -2
- package/dist/types/index.d.ts +7 -3
- package/dist/types/init.d.ts +2 -5
- package/dist/types/init.d.ts.map +1 -1
- package/dist/types/initSkills.d.ts +8 -0
- package/dist/types/initSkills.d.ts.map +1 -0
- package/dist/types/listContentDeclaration.d.ts +1 -1
- package/dist/types/listContentDeclaration.d.ts.map +1 -1
- package/dist/types/liveSync.d.ts +1 -1
- package/dist/types/pull.d.ts +1 -1
- package/dist/types/pull.d.ts.map +1 -1
- package/dist/types/push/pullLog.d.ts +1 -1
- package/dist/types/push/pullLog.d.ts.map +1 -1
- package/dist/types/push/push.d.ts +2 -2
- package/dist/types/pushConfig.d.ts +1 -1
- package/dist/types/reviewDoc/reviewDoc.d.ts +2 -2
- package/dist/types/reviewDoc/reviewDoc.d.ts.map +1 -1
- package/dist/types/reviewDoc/reviewDocBlockAware.d.ts +1 -1
- package/dist/types/reviewDoc/reviewDocBlockAware.d.ts.map +1 -1
- package/dist/types/searchDoc.d.ts +1 -1
- package/dist/types/searchDoc.d.ts.map +1 -1
- package/dist/types/test/listMissingTranslations.d.ts +1 -1
- package/dist/types/test/test.d.ts +1 -1
- package/dist/types/test/test.d.ts.map +1 -1
- package/dist/types/translateDoc/translateDoc.d.ts.map +1 -1
- package/dist/types/translateDoc/types.d.ts +2 -2
- package/dist/types/translateDoc/validation.d.ts +1 -1
- package/dist/types/utils/checkAccess.d.ts.map +1 -1
- package/dist/types/watch.d.ts +1 -1
- package/dist/types/watch.d.ts.map +1 -1
- package/package.json +11 -11
package/dist/esm/ci.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ci.mjs","names":[],"sources":["../../src/ci.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport { normalize, resolve } from 'node:path';\nimport { listProjects } from '@intlayer/chokidar';\nimport { logger } from '@intlayer/config';\n\n// Helper to detect the package manager used to run the command\nconst getPackageManagerCommand = () => {\n const userAgent = process.env.npm_config_user_agent;\n\n if (userAgent?.startsWith('bun')) {\n return { command: 'bun', args: ['intlayer'] }; // Bun runs local bins natively\n }\n if (userAgent?.startsWith('pnpm')) {\n return { command: 'pnpm', args: ['exec', 'intlayer'] }; // pnpm requires 'exec'\n }\n if (userAgent?.startsWith('yarn')) {\n return { command: 'yarn', args: ['run', 'intlayer'] }; // yarn requires 'run' or 'exec'\n }\n\n // Default fallback\n return { command: 'npx', args: ['intlayer'] };\n};\n\nexport const runCI = async (commands: string[]) => {\n const credentialsEnv = process.env.INTLAYER_PROJECT_CREDENTIALS;\n let credentials: Record<string, { clientId: string; clientSecret: string }> =\n {};\n\n // Parse Credentials (Optional now)\n if (credentialsEnv) {\n try {\n credentials = JSON.parse(credentialsEnv);\n } catch {\n logger(\n 'INTLAYER_PROJECT_CREDENTIALS is not valid JSON. Proceeding without credentials.',\n {\n level: 'warn',\n }\n );\n }\n }\n\n const cwd = process.cwd();\n\n // Discover Projects\n const { projectsPath } = await listProjects();\n\n if (projectsPath.length === 0) {\n logger('No Intlayer projects found.', { level: 'warn' });\n return;\n }\n\n // 3. Determine Context: Single Project vs All Projects\n // Check if the current directory matches one of the discovered project paths\n const currentProject = projectsPath.find((p) => cwd === p);\n const projectsToRun = currentProject ? [currentProject] : projectsPath;\n\n const { command, args: pmArgs } = getPackageManagerCommand();\n const finalArgs = [...pmArgs, ...commands];\n\n logger(`CI: Using package manager: ${command}`, { level: 'verbose' });\n\n if (currentProject) {\n logger(`CI: Detected project context: ${currentProject}`, {\n level: 'info',\n });\n } else {\n logger(\n `CI: No specific project context detected. Iterating over ${projectsToRun.length} discovered projects...`,\n {\n level: 'info',\n }\n );\n }\n\n let hasError = false;\n\n // Iterate and Execute\n for (const projectPath of projectsToRun) {\n // Attempt to match credentials to the project path\n // We check if the key (relative or absolute) matches the resolved project path\n const credsEntry = Object.entries(credentials).find(([key]) => {\n const absKey = resolve(key);\n return absKey === projectPath || projectPath.endsWith(normalize(key));\n });\n\n const creds = credsEntry?.[1];\n\n logger(`\\nCI: Executing for ${projectPath}...`, {\n level: 'info',\n });\n\n const envVars = { ...process.env };\n\n if (creds) {\n envVars.INTLAYER_CLIENT_ID = creds.clientId;\n envVars.INTLAYER_CLIENT_SECRET = creds.clientSecret;\n } else if (credentialsEnv) {\n logger(\n `CI: No matching credentials found for ${projectPath} in INTLAYER_PROJECT_CREDENTIALS.`,\n { level: 'verbose' }\n );\n }\n\n const result = spawnSync(command, finalArgs, {\n cwd: projectPath,\n stdio: 'inherit',\n env: envVars,\n });\n\n if (result.status !== 0) {\n logger(`CI: Failed for ${projectPath}`, {\n level: 'error',\n });\n hasError = true;\n }\n }\n\n if (hasError) process.exit(1);\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ci.mjs","names":[],"sources":["../../src/ci.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport { normalize, resolve } from 'node:path';\nimport { listProjects } from '@intlayer/chokidar/cli';\nimport { logger } from '@intlayer/config/logger';\n\n// Helper to detect the package manager used to run the command\nconst getPackageManagerCommand = () => {\n const userAgent = process.env.npm_config_user_agent;\n\n if (userAgent?.startsWith('bun')) {\n return { command: 'bun', args: ['intlayer'] }; // Bun runs local bins natively\n }\n if (userAgent?.startsWith('pnpm')) {\n return { command: 'pnpm', args: ['exec', 'intlayer'] }; // pnpm requires 'exec'\n }\n if (userAgent?.startsWith('yarn')) {\n return { command: 'yarn', args: ['run', 'intlayer'] }; // yarn requires 'run' or 'exec'\n }\n\n // Default fallback\n return { command: 'npx', args: ['intlayer'] };\n};\n\nexport const runCI = async (commands: string[]) => {\n const credentialsEnv = process.env.INTLAYER_PROJECT_CREDENTIALS;\n let credentials: Record<string, { clientId: string; clientSecret: string }> =\n {};\n\n // Parse Credentials (Optional now)\n if (credentialsEnv) {\n try {\n credentials = JSON.parse(credentialsEnv);\n } catch {\n logger(\n 'INTLAYER_PROJECT_CREDENTIALS is not valid JSON. Proceeding without credentials.',\n {\n level: 'warn',\n }\n );\n }\n }\n\n const cwd = process.cwd();\n\n // Discover Projects\n const { projectsPath } = await listProjects();\n\n if (projectsPath.length === 0) {\n logger('No Intlayer projects found.', { level: 'warn' });\n return;\n }\n\n // 3. Determine Context: Single Project vs All Projects\n // Check if the current directory matches one of the discovered project paths\n const currentProject = projectsPath.find((p) => cwd === p);\n const projectsToRun = currentProject ? [currentProject] : projectsPath;\n\n const { command, args: pmArgs } = getPackageManagerCommand();\n const finalArgs = [...pmArgs, ...commands];\n\n logger(`CI: Using package manager: ${command}`, { level: 'verbose' });\n\n if (currentProject) {\n logger(`CI: Detected project context: ${currentProject}`, {\n level: 'info',\n });\n } else {\n logger(\n `CI: No specific project context detected. Iterating over ${projectsToRun.length} discovered projects...`,\n {\n level: 'info',\n }\n );\n }\n\n let hasError = false;\n\n // Iterate and Execute\n for (const projectPath of projectsToRun) {\n // Attempt to match credentials to the project path\n // We check if the key (relative or absolute) matches the resolved project path\n const credsEntry = Object.entries(credentials).find(([key]) => {\n const absKey = resolve(key);\n return absKey === projectPath || projectPath.endsWith(normalize(key));\n });\n\n const creds = credsEntry?.[1];\n\n logger(`\\nCI: Executing for ${projectPath}...`, {\n level: 'info',\n });\n\n const envVars = { ...process.env };\n\n if (creds) {\n envVars.INTLAYER_CLIENT_ID = creds.clientId;\n envVars.INTLAYER_CLIENT_SECRET = creds.clientSecret;\n } else if (credentialsEnv) {\n logger(\n `CI: No matching credentials found for ${projectPath} in INTLAYER_PROJECT_CREDENTIALS.`,\n { level: 'verbose' }\n );\n }\n\n const result = spawnSync(command, finalArgs, {\n cwd: projectPath,\n stdio: 'inherit',\n env: envVars,\n });\n\n if (result.status !== 0) {\n logger(`CI: Failed for ${projectPath}`, {\n level: 'error',\n });\n hasError = true;\n }\n }\n\n if (hasError) process.exit(1);\n};\n"],"mappings":"yMAMA,MAAM,MAAiC,CACrC,IAAM,EAAY,QAAQ,IAAI,sBAa9B,OAXI,GAAW,WAAW,MAAM,CACvB,CAAE,QAAS,MAAO,KAAM,CAAC,WAAW,CAAE,CAE3C,GAAW,WAAW,OAAO,CACxB,CAAE,QAAS,OAAQ,KAAM,CAAC,OAAQ,WAAW,CAAE,CAEpD,GAAW,WAAW,OAAO,CACxB,CAAE,QAAS,OAAQ,KAAM,CAAC,MAAO,WAAW,CAAE,CAIhD,CAAE,QAAS,MAAO,KAAM,CAAC,WAAW,CAAE,EAGlC,EAAQ,KAAO,IAAuB,CACjD,IAAM,EAAiB,QAAQ,IAAI,6BAC/B,EACF,EAAE,CAGJ,GAAI,EACF,GAAI,CACF,EAAc,KAAK,MAAM,EAAe,MAClC,CACN,EACE,kFACA,CACE,MAAO,OACR,CACF,CAIL,IAAM,EAAM,QAAQ,KAAK,CAGnB,CAAE,gBAAiB,MAAM,GAAc,CAE7C,GAAI,EAAa,SAAW,EAAG,CAC7B,EAAO,8BAA+B,CAAE,MAAO,OAAQ,CAAC,CACxD,OAKF,IAAM,EAAiB,EAAa,KAAM,GAAM,IAAQ,EAAE,CACpD,EAAgB,EAAiB,CAAC,EAAe,CAAG,EAEpD,CAAE,UAAS,KAAM,GAAW,GAA0B,CACtD,EAAY,CAAC,GAAG,EAAQ,GAAG,EAAS,CAE1C,EAAO,8BAA8B,IAAW,CAAE,MAAO,UAAW,CAAC,CAGnE,EADE,EACK,iCAAiC,IAKtC,4DAA4D,EAAc,OAAO,yBALzB,CACxD,MAAO,OACR,CAOA,CAGH,IAAI,EAAW,GAGf,IAAK,IAAM,KAAe,EAAe,CAQvC,IAAM,EALa,OAAO,QAAQ,EAAY,CAAC,MAAM,CAAC,KACrC,EAAQ,EAAI,GACT,GAAe,EAAY,SAAS,EAAU,EAAI,CAAC,CACrE,GAEyB,GAE3B,EAAO,uBAAuB,EAAY,KAAM,CAC9C,MAAO,OACR,CAAC,CAEF,IAAM,EAAU,CAAE,GAAG,QAAQ,IAAK,CAE9B,GACF,EAAQ,mBAAqB,EAAM,SACnC,EAAQ,uBAAyB,EAAM,cAC9B,GACT,EACE,yCAAyC,EAAY,mCACrD,CAAE,MAAO,UAAW,CACrB,CAGY,EAAU,EAAS,EAAW,CAC3C,IAAK,EACL,MAAO,UACP,IAAK,EACN,CAAC,CAES,SAAW,IACpB,EAAO,kBAAkB,IAAe,CACtC,MAAO,QACR,CAAC,CACF,EAAW,IAIX,GAAU,QAAQ,KAAK,EAAE"}
|
package/dist/esm/cli.mjs
CHANGED
|
@@ -1,474 +1,2 @@
|
|
|
1
|
-
import { build } from "./build.mjs";
|
|
2
|
-
import { runCI } from "./ci.mjs";
|
|
3
|
-
import { login } from "./auth/login.mjs";
|
|
4
|
-
import { getConfig } from "./config.mjs";
|
|
5
|
-
import { startEditor } from "./editor.mjs";
|
|
6
|
-
import { extract } from "./extract.mjs";
|
|
7
|
-
import { testMissingTranslations } from "./test/test.mjs";
|
|
8
|
-
import { fill } from "./fill/fill.mjs";
|
|
9
|
-
import { init, initSkills } from "./init.mjs";
|
|
10
|
-
import { listContentDeclaration } from "./listContentDeclaration.mjs";
|
|
11
|
-
import { listProjectsCommand } from "./listProjects.mjs";
|
|
12
|
-
import { liveSync } from "./liveSync.mjs";
|
|
13
|
-
import { pull } from "./pull.mjs";
|
|
14
|
-
import { push } from "./push/push.mjs";
|
|
15
|
-
import { pushConfig } from "./pushConfig.mjs";
|
|
16
|
-
import { reviewDoc } from "./reviewDoc/reviewDoc.mjs";
|
|
17
|
-
import { searchDoc } from "./searchDoc.mjs";
|
|
18
|
-
import { translateDoc } from "./translateDoc/translateDoc.mjs";
|
|
19
|
-
import { getParentPackageJSON } from "./utils/getParentPackageJSON.mjs";
|
|
20
|
-
import { watchContentDeclaration } from "./watch.mjs";
|
|
21
|
-
import { getConfiguration, setPrefix } from "@intlayer/config";
|
|
22
|
-
import { dirname as dirname$1 } from "node:path";
|
|
23
|
-
import { fileURLToPath } from "node:url";
|
|
24
|
-
import { Command } from "commander";
|
|
25
|
-
|
|
26
|
-
//#region src/cli.ts
|
|
27
|
-
const isESModule$1 = typeof import.meta.url === "string";
|
|
28
|
-
const dirname = isESModule$1 ? dirname$1(fileURLToPath(import.meta.url)) : __dirname;
|
|
29
|
-
const packageJson = getParentPackageJSON(dirname);
|
|
30
|
-
const configurationOptions = [
|
|
31
|
-
["--env-file [envFile]", "Environment file"],
|
|
32
|
-
["-e, --env [env]", "Environment"],
|
|
33
|
-
["--base-dir [baseDir]", "Base directory"],
|
|
34
|
-
["--no-cache [noCache]", "No cache"],
|
|
35
|
-
...[["--verbose", "Verbose (default to true using CLI)"], ["--prefix [prefix]", "Prefix"]]
|
|
36
|
-
];
|
|
37
|
-
const aiOptions = [
|
|
38
|
-
["--provider [provider]", "Provider"],
|
|
39
|
-
["--temperature [temperature]", "Temperature"],
|
|
40
|
-
["--model [model]", "Model"],
|
|
41
|
-
["--api-key [apiKey]", "Provider API key"],
|
|
42
|
-
["--custom-prompt [prompt]", "Custom prompt"],
|
|
43
|
-
["--application-context [applicationContext]", "Application context"],
|
|
44
|
-
["--data-serialization [dataSerialization]", "Data serialization"]
|
|
45
|
-
];
|
|
46
|
-
const gitOptions = [
|
|
47
|
-
["--git-diff [gitDiff]", "Git diff mode - Check git diff between two refs"],
|
|
48
|
-
["--git-diff-base [gitDiffBase]", "Git diff base ref"],
|
|
49
|
-
["--git-diff-current [gitDiffCurrent]", "Git diff current ref"],
|
|
50
|
-
["--uncommitted [uncommitted]", "Uncommitted"],
|
|
51
|
-
["--unpushed [unpushed]", "Unpushed"],
|
|
52
|
-
["--untracked [untracked]", "Untracked"]
|
|
53
|
-
];
|
|
54
|
-
const extractKeysFromOptions = (options, keys) => keys.filter((key) => options[key]);
|
|
55
|
-
/**
|
|
56
|
-
* Helper functions to apply common options to commands
|
|
57
|
-
*/
|
|
58
|
-
const applyOptions = (command, options) => {
|
|
59
|
-
options.forEach(([flag, description]) => {
|
|
60
|
-
command.option(flag, description);
|
|
61
|
-
});
|
|
62
|
-
return command;
|
|
63
|
-
};
|
|
64
|
-
const removeUndefined = (obj) => Object.fromEntries(Object.entries(obj).filter(([_, value]) => value !== void 0));
|
|
65
|
-
const applyConfigOptions = (command) => applyOptions(command, configurationOptions);
|
|
66
|
-
const applyAIOptions = (command) => applyOptions(command, aiOptions);
|
|
67
|
-
const applyGitOptions = (command) => applyOptions(command, gitOptions);
|
|
68
|
-
const extractAiOptions = (options) => {
|
|
69
|
-
const { apiKey, provider, model, temperature, applicationContext, customPrompt, dataSerialization } = options;
|
|
70
|
-
const configuration = getConfiguration();
|
|
71
|
-
const { ai } = configuration;
|
|
72
|
-
return removeUndefined({
|
|
73
|
-
...ai,
|
|
74
|
-
apiKey: apiKey ?? configuration.ai?.apiKey,
|
|
75
|
-
provider: provider ?? configuration.ai?.provider,
|
|
76
|
-
model: model ?? configuration.ai?.model,
|
|
77
|
-
temperature: temperature ?? configuration.ai?.temperature,
|
|
78
|
-
applicationContext: applicationContext ?? configuration.ai?.applicationContext,
|
|
79
|
-
customPrompt: customPrompt ?? configuration.ai?.customPrompt,
|
|
80
|
-
dataSerialization: dataSerialization ?? configuration.ai?.dataSerialization
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
const gitOptionKeys = [
|
|
84
|
-
"gitDiff",
|
|
85
|
-
"gitDiffBase",
|
|
86
|
-
"gitDiffCurrent",
|
|
87
|
-
"uncommitted",
|
|
88
|
-
"unpushed",
|
|
89
|
-
"untracked"
|
|
90
|
-
];
|
|
91
|
-
const extractGitOptions = (options) => {
|
|
92
|
-
const filteredOptions = extractKeysFromOptions(options, gitOptionKeys);
|
|
93
|
-
if (!Object.values(filteredOptions).some(Boolean)) return void 0;
|
|
94
|
-
const { gitDiff, gitDiffBase, gitDiffCurrent, uncommitted, unpushed, untracked } = options;
|
|
95
|
-
return removeUndefined({
|
|
96
|
-
mode: [
|
|
97
|
-
gitDiff && "gitDiff",
|
|
98
|
-
uncommitted && "uncommitted",
|
|
99
|
-
unpushed && "unpushed",
|
|
100
|
-
untracked && "untracked"
|
|
101
|
-
].filter(Boolean),
|
|
102
|
-
baseRef: gitDiffBase,
|
|
103
|
-
currentRef: gitDiffCurrent,
|
|
104
|
-
absolute: true
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
const configurationOptionKeys = [
|
|
108
|
-
"baseDir",
|
|
109
|
-
"env",
|
|
110
|
-
"envFile",
|
|
111
|
-
"verbose",
|
|
112
|
-
"prefix"
|
|
113
|
-
];
|
|
114
|
-
const extractConfigOptions = (options) => {
|
|
115
|
-
const configuration = getConfiguration(options);
|
|
116
|
-
const filteredOptions = extractKeysFromOptions(options, configurationOptionKeys);
|
|
117
|
-
if (!Object.values(filteredOptions).some(Boolean)) return;
|
|
118
|
-
const { baseDir, env, envFile, verbose, prefix, noCache } = options;
|
|
119
|
-
const addPrefix = Boolean(options.with);
|
|
120
|
-
if (typeof prefix === "string") setPrefix(prefix);
|
|
121
|
-
else if (addPrefix) setPrefix(configuration.log.prefix);
|
|
122
|
-
return removeUndefined({
|
|
123
|
-
baseDir,
|
|
124
|
-
env,
|
|
125
|
-
envFile,
|
|
126
|
-
override: { log: { verbose: verbose ?? true } },
|
|
127
|
-
cache: !noCache
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Set the API for the CLI
|
|
132
|
-
*
|
|
133
|
-
* Example of commands:
|
|
134
|
-
*
|
|
135
|
-
* npm run intlayer build --watch
|
|
136
|
-
* npm run intlayer push --dictionaries id1 id2 id3 --deleteLocaleDir
|
|
137
|
-
*/
|
|
138
|
-
const setAPI = () => {
|
|
139
|
-
setPrefix("");
|
|
140
|
-
const program = new Command();
|
|
141
|
-
program.version(packageJson.version).description("Intlayer CLI");
|
|
142
|
-
program.command("version").description("Print the Intlayer CLI version").action(() => {
|
|
143
|
-
console.log(packageJson.version ?? "unknown");
|
|
144
|
-
});
|
|
145
|
-
/**
|
|
146
|
-
* AUTH
|
|
147
|
-
*/
|
|
148
|
-
const loginCmd = program.command("login").description("Login to Intlayer").option("--cms-url [cmsUrl]", "CMS URL");
|
|
149
|
-
applyConfigOptions(loginCmd);
|
|
150
|
-
loginCmd.action((options) => {
|
|
151
|
-
const configOptions = extractConfigOptions(options) ?? { override: { log: {
|
|
152
|
-
prefix: "",
|
|
153
|
-
verbose: true
|
|
154
|
-
} } };
|
|
155
|
-
return login({
|
|
156
|
-
cmsUrl: options.cmsUrl,
|
|
157
|
-
configOptions
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
program.command("init").description("Initialize Intlayer in the project").option("--project-root [projectRoot]", "Project root directory").action((options) => init(options.projectRoot)).command("skills").description("Initialize Intlayer skills in the project").option("--project-root [projectRoot]", "Project root directory").action((options) => initSkills(options.projectRoot));
|
|
161
|
-
/**
|
|
162
|
-
* DICTIONARIES
|
|
163
|
-
*/
|
|
164
|
-
const dictionariesProgram = program.command("dictionary").alias("dictionaries").alias("dic").description("Dictionaries operations");
|
|
165
|
-
const buildOptions = {
|
|
166
|
-
description: "Build the dictionaries",
|
|
167
|
-
options: [
|
|
168
|
-
["-w, --watch", "Watch for changes"],
|
|
169
|
-
["--skip-prepare", "Skip the prepare step"],
|
|
170
|
-
["--with [with...]", "Start command in parallel with the build"]
|
|
171
|
-
]
|
|
172
|
-
};
|
|
173
|
-
const dictionariesBuildCmd = dictionariesProgram.command("build").description(buildOptions.description);
|
|
174
|
-
applyOptions(dictionariesBuildCmd, buildOptions.options);
|
|
175
|
-
applyConfigOptions(dictionariesBuildCmd);
|
|
176
|
-
dictionariesBuildCmd.action((options) => {
|
|
177
|
-
build({
|
|
178
|
-
...options,
|
|
179
|
-
configOptions: extractConfigOptions(options)
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
const rootBuildCmd = program.command("build").description(buildOptions.description);
|
|
183
|
-
applyOptions(rootBuildCmd, buildOptions.options);
|
|
184
|
-
applyConfigOptions(rootBuildCmd);
|
|
185
|
-
rootBuildCmd.action((options) => {
|
|
186
|
-
build({
|
|
187
|
-
...options,
|
|
188
|
-
configOptions: extractConfigOptions(options)
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
const watchOptions = {
|
|
192
|
-
description: "Watch the dictionaries changes",
|
|
193
|
-
options: [["--with [with...]", "Start command in parallel with the build"]]
|
|
194
|
-
};
|
|
195
|
-
const dictionariesWatchCmd = dictionariesProgram.command("watch").description(buildOptions.description);
|
|
196
|
-
applyOptions(dictionariesWatchCmd, watchOptions.options);
|
|
197
|
-
applyConfigOptions(dictionariesWatchCmd);
|
|
198
|
-
dictionariesWatchCmd.action((options) => {
|
|
199
|
-
watchContentDeclaration({
|
|
200
|
-
...options,
|
|
201
|
-
configOptions: extractConfigOptions(options)
|
|
202
|
-
});
|
|
203
|
-
});
|
|
204
|
-
const rootWatchCmd = program.command("watch").description(buildOptions.description);
|
|
205
|
-
applyOptions(rootWatchCmd, watchOptions.options);
|
|
206
|
-
applyConfigOptions(rootWatchCmd);
|
|
207
|
-
rootWatchCmd.action((options) => {
|
|
208
|
-
watchContentDeclaration({
|
|
209
|
-
...options,
|
|
210
|
-
configOptions: extractConfigOptions(options)
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
const pullOptions = {
|
|
214
|
-
description: "Pull dictionaries from the server",
|
|
215
|
-
options: [
|
|
216
|
-
["-d, --dictionaries [ids...]", "List of dictionary IDs to pull"],
|
|
217
|
-
["--dictionary [ids...]", "List of dictionary IDs to pull (alias for --dictionaries)"],
|
|
218
|
-
["--new-dictionaries-path [path]", "Path to save the new dictionaries"],
|
|
219
|
-
["--newDictionariesPath [path]", "[alias] Path to save the new dictionaries"]
|
|
220
|
-
]
|
|
221
|
-
};
|
|
222
|
-
const dictionariesPullCmd = dictionariesProgram.command("pull").description(pullOptions.description);
|
|
223
|
-
applyOptions(dictionariesPullCmd, pullOptions.options);
|
|
224
|
-
applyConfigOptions(dictionariesPullCmd);
|
|
225
|
-
dictionariesPullCmd.action((options) => {
|
|
226
|
-
const dictionaries = [...options.dictionaries ?? [], ...options.dictionary ?? []];
|
|
227
|
-
pull({
|
|
228
|
-
...options,
|
|
229
|
-
dictionaries: dictionaries.length > 0 ? dictionaries : void 0,
|
|
230
|
-
configOptions: {
|
|
231
|
-
...options.configOptions,
|
|
232
|
-
baseDir: options.baseDir
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
const rootPullCmd = program.command("pull").description(pullOptions.description);
|
|
237
|
-
applyOptions(rootPullCmd, pullOptions.options);
|
|
238
|
-
applyConfigOptions(rootPullCmd);
|
|
239
|
-
rootPullCmd.action((options) => {
|
|
240
|
-
const dictionaries = [...options.dictionaries ?? [], ...options.dictionary ?? []];
|
|
241
|
-
pull({
|
|
242
|
-
...options,
|
|
243
|
-
dictionaries: dictionaries.length > 0 ? dictionaries : void 0,
|
|
244
|
-
configOptions: extractConfigOptions(options)
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
const pushOptions = {
|
|
248
|
-
description: "Push all dictionaries. Create or update the pushed dictionaries",
|
|
249
|
-
options: [
|
|
250
|
-
["-d, --dictionaries [ids...]", "List of dictionary IDs to push"],
|
|
251
|
-
["--dictionary [ids...]", "List of dictionary IDs to push (alias for --dictionaries)"],
|
|
252
|
-
["-r, --delete-locale-dictionary", "Delete the local dictionaries after pushing"],
|
|
253
|
-
["-k, --keep-locale-dictionary", "Keep the local dictionaries after pushing"],
|
|
254
|
-
["--deleteLocaleDictionary", "[alias] Delete the local dictionaries after pushing"],
|
|
255
|
-
["--keepLocaleDictionary", "[alias] Keep the local dictionaries after pushing"],
|
|
256
|
-
["--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"]
|
|
257
|
-
]
|
|
258
|
-
};
|
|
259
|
-
const dictionariesPushCmd = dictionariesProgram.command("push").description(pushOptions.description);
|
|
260
|
-
applyOptions(dictionariesPushCmd, pushOptions.options);
|
|
261
|
-
applyConfigOptions(dictionariesPushCmd);
|
|
262
|
-
applyGitOptions(dictionariesPushCmd);
|
|
263
|
-
dictionariesPushCmd.action((options) => {
|
|
264
|
-
const dictionaries = [...options.dictionaries || [], ...options.dictionary || []];
|
|
265
|
-
return push({
|
|
266
|
-
...options,
|
|
267
|
-
dictionaries: dictionaries.length > 0 ? dictionaries : void 0,
|
|
268
|
-
gitOptions: extractGitOptions(options),
|
|
269
|
-
configOptions: extractConfigOptions(options)
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
const rootPushCmd = program.command("push").description(pushOptions.description);
|
|
273
|
-
applyOptions(rootPushCmd, pushOptions.options);
|
|
274
|
-
applyConfigOptions(rootPushCmd);
|
|
275
|
-
applyGitOptions(rootPushCmd);
|
|
276
|
-
rootPushCmd.action((options) => {
|
|
277
|
-
const dictionaries = [...options.dictionaries || [], ...options.dictionary || []];
|
|
278
|
-
return push({
|
|
279
|
-
...options,
|
|
280
|
-
dictionaries: dictionaries.length > 0 ? dictionaries : void 0,
|
|
281
|
-
gitOptions: extractGitOptions(options),
|
|
282
|
-
configOptions: extractConfigOptions(options)
|
|
283
|
-
});
|
|
284
|
-
});
|
|
285
|
-
/**
|
|
286
|
-
* CONFIGURATION
|
|
287
|
-
*/
|
|
288
|
-
const configurationProgram = program.command("configuration").alias("config").alias("conf").description("Configuration operations");
|
|
289
|
-
const configGetCmd = configurationProgram.command("get").description("Get the configuration");
|
|
290
|
-
applyConfigOptions(configGetCmd);
|
|
291
|
-
configGetCmd.action((options) => {
|
|
292
|
-
getConfig({
|
|
293
|
-
...options,
|
|
294
|
-
configOptions: extractConfigOptions(options)
|
|
295
|
-
});
|
|
296
|
-
});
|
|
297
|
-
const configPushCmd = configurationProgram.command("push").description("Push the configuration");
|
|
298
|
-
applyConfigOptions(configPushCmd);
|
|
299
|
-
configPushCmd.action((options) => {
|
|
300
|
-
pushConfig({
|
|
301
|
-
...options,
|
|
302
|
-
configOptions: extractConfigOptions(options)
|
|
303
|
-
});
|
|
304
|
-
});
|
|
305
|
-
program.command("projects").alias("project").description("List Intlayer projects").command("list").description("List all Intlayer projects in the directory").option("--base-dir [baseDir]", "Base directory to search from").option("--git-root", "Search from the git root directory instead of the base directory").option("--json", "Output the results as JSON").action((options) => {
|
|
306
|
-
listProjectsCommand({
|
|
307
|
-
baseDir: options.baseDir,
|
|
308
|
-
gitRoot: options.gitRoot,
|
|
309
|
-
json: options.json
|
|
310
|
-
});
|
|
311
|
-
});
|
|
312
|
-
program.command("projects-list").alias("pl").description("List all Intlayer projects in the directory").option("--base-dir [baseDir]", "Base directory to search from").option("--git-root", "Search from the git root directory instead of the base directory").option("--absolute", "Output the results as absolute paths").option("--json", "Output the results as JSON").action((options) => {
|
|
313
|
-
listProjectsCommand({
|
|
314
|
-
baseDir: options.baseDir,
|
|
315
|
-
gitRoot: options.gitRoot,
|
|
316
|
-
json: options.json,
|
|
317
|
-
absolute: options.absolute
|
|
318
|
-
});
|
|
319
|
-
});
|
|
320
|
-
/**
|
|
321
|
-
* CONTENT DECLARATION
|
|
322
|
-
*/
|
|
323
|
-
const contentProgram = program.command("content").description("Content declaration operations");
|
|
324
|
-
contentProgram.command("list").description("List the content declaration files").option("--json", "Output the results as JSON").option("--absolute", "Output the results as absolute paths").action((options) => {
|
|
325
|
-
listContentDeclaration({
|
|
326
|
-
json: options.json,
|
|
327
|
-
absolute: options.absolute
|
|
328
|
-
});
|
|
329
|
-
});
|
|
330
|
-
program.command("list").description("List the content declaration files").option("--json", "Output the results as JSON").option("--absolute", "Output the results as absolute paths").action((options) => {
|
|
331
|
-
listContentDeclaration({
|
|
332
|
-
json: options.json,
|
|
333
|
-
absolute: options.absolute
|
|
334
|
-
});
|
|
335
|
-
});
|
|
336
|
-
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");
|
|
337
|
-
applyConfigOptions(testProgram);
|
|
338
|
-
testProgram.action((options) => {
|
|
339
|
-
testMissingTranslations({
|
|
340
|
-
...options,
|
|
341
|
-
configOptions: extractConfigOptions(options)
|
|
342
|
-
});
|
|
343
|
-
});
|
|
344
|
-
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");
|
|
345
|
-
applyConfigOptions(rootTestCmd);
|
|
346
|
-
rootTestCmd.action((options) => {
|
|
347
|
-
testMissingTranslations({
|
|
348
|
-
...options,
|
|
349
|
-
configOptions: extractConfigOptions(options)
|
|
350
|
-
});
|
|
351
|
-
});
|
|
352
|
-
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");
|
|
353
|
-
applyConfigOptions(fillProgram);
|
|
354
|
-
applyAIOptions(fillProgram);
|
|
355
|
-
applyGitOptions(fillProgram);
|
|
356
|
-
fillProgram.action((options) => {
|
|
357
|
-
const keys = [...options.keys ?? [], ...options.key ?? []];
|
|
358
|
-
const excludedKeys = [...options.excludedKeys ?? [], ...options.excludedKey ?? []];
|
|
359
|
-
const dictionaries = [...options.dictionaries ?? [], ...options.dictionary ?? []];
|
|
360
|
-
return fill({
|
|
361
|
-
...options,
|
|
362
|
-
keys: keys.length > 0 ? keys : void 0,
|
|
363
|
-
excludedKeys: excludedKeys.length > 0 ? excludedKeys : void 0,
|
|
364
|
-
dictionaries: dictionaries.length > 0 ? dictionaries : void 0,
|
|
365
|
-
aiOptions: extractAiOptions(options),
|
|
366
|
-
gitOptions: extractGitOptions(options),
|
|
367
|
-
configOptions: extractConfigOptions(options)
|
|
368
|
-
});
|
|
369
|
-
});
|
|
370
|
-
/**
|
|
371
|
-
* DOCS
|
|
372
|
-
*/
|
|
373
|
-
const docParams = [
|
|
374
|
-
["--doc-pattern [docPattern...]", "Documentation pattern"],
|
|
375
|
-
["--excluded-glob-pattern [excludedGlobPattern...]", "Excluded glob pattern"],
|
|
376
|
-
["--nb-simultaneous-file-processed [nbSimultaneousFileProcessed]", "Number of simultaneous file processed"],
|
|
377
|
-
["--locales [locales...]", "Locales"],
|
|
378
|
-
["--base-locale [baseLocale]", "Base locale"],
|
|
379
|
-
["--custom-instructions [customInstructions]", "Custom instructions added to the prompt. Usefull to apply specific rules regarding formatting, urls translation, etc."],
|
|
380
|
-
["--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."],
|
|
381
|
-
["--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."],
|
|
382
|
-
["--skip-if-exists", "Skip the file if it already exists"]
|
|
383
|
-
];
|
|
384
|
-
const docProgram = program.command("doc").description("Documentation operations");
|
|
385
|
-
const translateProgram = docProgram.command("translate").description("Translate the documentation");
|
|
386
|
-
applyConfigOptions(translateProgram);
|
|
387
|
-
applyAIOptions(translateProgram);
|
|
388
|
-
applyGitOptions(translateProgram);
|
|
389
|
-
applyOptions(translateProgram, docParams);
|
|
390
|
-
translateProgram.action((options) => translateDoc({
|
|
391
|
-
docPattern: options.docPattern,
|
|
392
|
-
excludedGlobPattern: options.excludedGlobPattern,
|
|
393
|
-
locales: options.locales,
|
|
394
|
-
baseLocale: options.baseLocale,
|
|
395
|
-
aiOptions: extractAiOptions(options),
|
|
396
|
-
gitOptions: extractGitOptions(options),
|
|
397
|
-
nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,
|
|
398
|
-
configOptions: extractConfigOptions(options),
|
|
399
|
-
customInstructions: options.customInstructions,
|
|
400
|
-
skipIfModifiedBefore: options.skipIfModifiedBefore,
|
|
401
|
-
skipIfModifiedAfter: options.skipIfModifiedAfter,
|
|
402
|
-
skipIfExists: options.skipIfExists
|
|
403
|
-
}));
|
|
404
|
-
const reviewProgram = docProgram.command("review").description("Review the documentation");
|
|
405
|
-
applyConfigOptions(reviewProgram);
|
|
406
|
-
applyAIOptions(reviewProgram);
|
|
407
|
-
applyGitOptions(reviewProgram);
|
|
408
|
-
applyOptions(reviewProgram, docParams);
|
|
409
|
-
reviewProgram.action((options) => reviewDoc({
|
|
410
|
-
docPattern: options.docPattern,
|
|
411
|
-
excludedGlobPattern: options.excludedGlobPattern,
|
|
412
|
-
locales: options.locales,
|
|
413
|
-
baseLocale: options.baseLocale,
|
|
414
|
-
aiOptions: extractAiOptions(options),
|
|
415
|
-
gitOptions: extractGitOptions(options),
|
|
416
|
-
nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,
|
|
417
|
-
configOptions: extractConfigOptions(options),
|
|
418
|
-
customInstructions: options.customInstructions,
|
|
419
|
-
skipIfModifiedBefore: options.skipIfModifiedBefore,
|
|
420
|
-
skipIfModifiedAfter: options.skipIfModifiedAfter,
|
|
421
|
-
skipIfExists: options.skipIfExists
|
|
422
|
-
}));
|
|
423
|
-
const searchProgram = docProgram.command("search").description("Search the documentation").argument("<query>", "Search query").option("--limit [limit]", "Limit the number of results", "10");
|
|
424
|
-
applyConfigOptions(searchProgram);
|
|
425
|
-
searchProgram.action((query, options) => searchDoc({
|
|
426
|
-
query,
|
|
427
|
-
limit: options.limit ? parseInt(options.limit, 10) : 10,
|
|
428
|
-
configOptions: extractConfigOptions(options)
|
|
429
|
-
}));
|
|
430
|
-
/**
|
|
431
|
-
* LIVE SYNC
|
|
432
|
-
*/
|
|
433
|
-
const liveOptions = [["--with [with...]", "Start command in parallel with the live sync"]];
|
|
434
|
-
const liveCmd = program.command("live").description("Live sync - Watch for changes made on the CMS and update the application content accordingly");
|
|
435
|
-
applyOptions(liveCmd, liveOptions);
|
|
436
|
-
applyConfigOptions(liveCmd);
|
|
437
|
-
liveCmd.action((options) => liveSync(options));
|
|
438
|
-
const editorStartCmd = program.command("editor").description("Visual editor operations").command("start").description("Start the Intlayer visual editor");
|
|
439
|
-
applyConfigOptions(editorStartCmd);
|
|
440
|
-
editorStartCmd.action((options) => {
|
|
441
|
-
startEditor({
|
|
442
|
-
env: options.env,
|
|
443
|
-
envFile: options.envFile
|
|
444
|
-
});
|
|
445
|
-
});
|
|
446
|
-
/**
|
|
447
|
-
* EXTRACT
|
|
448
|
-
*/
|
|
449
|
-
const extractProgram = program.command("extract").alias("ext").description("Extract strings from components to be placed in a .content file close to the component");
|
|
450
|
-
extractProgram.option("-f, --file [files...]", "List of files to extract").option("-o, --output-content-declarations [outputContentDeclarations]", "Path to output content declaration files").option("--code-only", "Only extract the component code", false).option("--declaration-only", "Only generate content declaration", false).action((options) => {
|
|
451
|
-
extract({
|
|
452
|
-
files: options.file,
|
|
453
|
-
outputContentDeclarations: options.outputContentDeclarations,
|
|
454
|
-
configOptions: extractConfigOptions(options),
|
|
455
|
-
codeOnly: options.codeOnly,
|
|
456
|
-
declarationOnly: options.declarationOnly
|
|
457
|
-
});
|
|
458
|
-
});
|
|
459
|
-
applyConfigOptions(extractProgram);
|
|
460
|
-
program.parse(process.argv);
|
|
461
|
-
/**
|
|
462
|
-
* CI / AUTOMATION
|
|
463
|
-
*
|
|
464
|
-
* Used to iterate over all projects in a monorepo, and help to parse secrets
|
|
465
|
-
*/
|
|
466
|
-
program.command("ci").description("Run Intlayer commands with auto-injected credentials from INTLAYER_PROJECT_CREDENTIALS. Detects current project or iterates over all projects.").argument("<command...>", "The intlayer command to execute (e.g., \"fill\", \"push\")").allowUnknownOption().action((args) => {
|
|
467
|
-
runCI(args);
|
|
468
|
-
});
|
|
469
|
-
return program;
|
|
470
|
-
};
|
|
471
|
-
|
|
472
|
-
//#endregion
|
|
473
|
-
export { dirname, setAPI };
|
|
1
|
+
import{build as e}from"./build.mjs";import{runCI as t}from"./ci.mjs";import{login as n}from"./auth/login.mjs";import{getConfig as r}from"./config.mjs";import{startEditor as i}from"./editor.mjs";import{extract as a}from"./extract.mjs";import{testMissingTranslations as o}from"./test/test.mjs";import{fill as s}from"./fill/fill.mjs";import{init as c}from"./init.mjs";import{initSkills as l}from"./initSkills.mjs";import{listContentDeclaration as u}from"./listContentDeclaration.mjs";import{listProjectsCommand as d}from"./listProjects.mjs";import{liveSync as ee}from"./liveSync.mjs";import{pull as f}from"./pull.mjs";import{push as p}from"./push/push.mjs";import{pushConfig as te}from"./pushConfig.mjs";import{reviewDoc as ne}from"./reviewDoc/reviewDoc.mjs";import{searchDoc as re}from"./searchDoc.mjs";import{translateDoc as ie}from"./translateDoc/translateDoc.mjs";import{getParentPackageJSON as m}from"./utils/getParentPackageJSON.mjs";import{watchContentDeclaration as h}from"./watch.mjs";import{getConfiguration as g}from"@intlayer/config/node";import{dirname as _}from"node:path";import{setPrefix as v}from"@intlayer/config/logger";import{fileURLToPath as y}from"node:url";import{Command as ae}from"commander";const b=typeof import.meta.url==`string`?_(y(import.meta.url)):__dirname,x=m(b),S=[[`--env-file [envFile]`,`Environment file`],[`-e, --env [env]`,`Environment`],[`--base-dir [baseDir]`,`Base directory`],[`--no-cache [noCache]`,`No cache`],...[[`--verbose`,`Verbose (default to true using CLI)`],[`--prefix [prefix]`,`Prefix`]]],C=[[`--provider [provider]`,`Provider`],[`--temperature [temperature]`,`Temperature`],[`--model [model]`,`Model`],[`--api-key [apiKey]`,`Provider API key`],[`--custom-prompt [prompt]`,`Custom prompt`],[`--application-context [applicationContext]`,`Application context`],[`--data-serialization [dataSerialization]`,`Data serialization`]],w=[[`--git-diff [gitDiff]`,`Git diff mode - Check git diff between two refs`],[`--git-diff-base [gitDiffBase]`,`Git diff base ref`],[`--git-diff-current [gitDiffCurrent]`,`Git diff current ref`],[`--uncommitted [uncommitted]`,`Uncommitted`],[`--unpushed [unpushed]`,`Unpushed`],[`--untracked [untracked]`,`Untracked`]],T=(e,t)=>t.filter(t=>e[t]),E=(e,t)=>(t.forEach(([t,n])=>{e.option(t,n)}),e),D=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!==void 0)),O=e=>E(e,S),k=e=>E(e,C),A=e=>E(e,w),j=e=>{let{apiKey:t,provider:n,model:r,temperature:i,applicationContext:a,customPrompt:o,dataSerialization:s}=e,c=g(),{ai:l}=c;return D({...l,apiKey:t??c.ai?.apiKey,provider:n??c.ai?.provider,model:r??c.ai?.model,temperature:i??c.ai?.temperature,applicationContext:a??c.ai?.applicationContext,customPrompt:o??c.ai?.customPrompt,dataSerialization:s??c.ai?.dataSerialization})},M=[`gitDiff`,`gitDiffBase`,`gitDiffCurrent`,`uncommitted`,`unpushed`,`untracked`],N=e=>{let t=T(e,M);if(!Object.values(t).some(Boolean))return;let{gitDiff:n,gitDiffBase:r,gitDiffCurrent:i,uncommitted:a,unpushed:o,untracked:s}=e;return D({mode:[n&&`gitDiff`,a&&`uncommitted`,o&&`unpushed`,s&&`untracked`].filter(Boolean),baseRef:r,currentRef:i,absolute:!0})},P=[`baseDir`,`env`,`envFile`,`verbose`,`prefix`],F=e=>{let t=g(e),n=T(e,P);if(!Object.values(n).some(Boolean))return;let{baseDir:r,env:i,envFile:a,verbose:o,prefix:s,noCache:c}=e,l=!!e.with;return typeof s==`string`?v(s):l&&v(t.log.prefix),D({baseDir:r,env:i,envFile:a,override:{log:{verbose:o??!0}},cache:!c})},I=()=>{v(``);let m=new ae;m.version(x.version).description(`Intlayer CLI`),m.command(`version`).description(`Print the Intlayer CLI version`).action(()=>{console.log(x.version??`unknown`)});let g=m.command(`login`).description(`Login to Intlayer`).option(`--cms-url [cmsUrl]`,`CMS URL`);O(g),g.action(e=>{let t=F(e)??{override:{log:{prefix:``,verbose:!0}}};return n({cmsUrl:e.cmsUrl,configOptions:t})}),m.command(`init`).description(`Initialize Intlayer in the project`).option(`--project-root [projectRoot]`,`Project root directory`).action(e=>c(e.projectRoot)).command(`skills`).description(`Initialize Intlayer skills in the project`).option(`--project-root [projectRoot]`,`Project root directory`).action(e=>l(e.projectRoot));let _=m.command(`dictionary`).alias(`dictionaries`).alias(`dic`).description(`Dictionaries operations`),y={description:`Build the dictionaries`,options:[[`-w, --watch`,`Watch for changes`],[`--skip-prepare`,`Skip the prepare step`],[`--with [with...]`,`Start command in parallel with the build`]]},b=_.command(`build`).description(y.description);E(b,y.options),O(b),b.action(t=>{e({...t,configOptions:F(t)})});let S=m.command(`build`).description(y.description);E(S,y.options),O(S),S.action(t=>{e({...t,configOptions:F(t)})});let C={description:`Watch the dictionaries changes`,options:[[`--with [with...]`,`Start command in parallel with the build`]]},w=_.command(`watch`).description(y.description);E(w,C.options),O(w),w.action(e=>{h({...e,configOptions:F(e)})});let T=m.command(`watch`).description(y.description);E(T,C.options),O(T),T.action(e=>{h({...e,configOptions:F(e)})});let D={description:`Pull dictionaries from the server`,options:[[`-d, --dictionaries [ids...]`,`List of dictionary IDs to pull`],[`--dictionary [ids...]`,`List of dictionary IDs to pull (alias for --dictionaries)`],[`--new-dictionaries-path [path]`,`Path to save the new dictionaries`],[`--newDictionariesPath [path]`,`[alias] Path to save the new dictionaries`]]},M=_.command(`pull`).description(D.description);E(M,D.options),O(M),M.action(e=>{let t=[...e.dictionaries??[],...e.dictionary??[]];f({...e,dictionaries:t.length>0?t:void 0,configOptions:{...e.configOptions,baseDir:e.baseDir}})});let P=m.command(`pull`).description(D.description);E(P,D.options),O(P),P.action(e=>{let t=[...e.dictionaries??[],...e.dictionary??[]];f({...e,dictionaries:t.length>0?t:void 0,configOptions:F(e)})});let I={description:`Push all dictionaries. Create or update the pushed dictionaries`,options:[[`-d, --dictionaries [ids...]`,`List of dictionary IDs to push`],[`--dictionary [ids...]`,`List of dictionary IDs to push (alias for --dictionaries)`],[`-r, --delete-locale-dictionary`,`Delete the local dictionaries after pushing`],[`-k, --keep-locale-dictionary`,`Keep the local dictionaries after pushing`],[`--deleteLocaleDictionary`,`[alias] Delete the local dictionaries after pushing`],[`--keepLocaleDictionary`,`[alias] Keep the local dictionaries after pushing`],[`--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`]]},L=_.command(`push`).description(I.description);E(L,I.options),O(L),A(L),L.action(e=>{let t=[...e.dictionaries||[],...e.dictionary||[]];return p({...e,dictionaries:t.length>0?t:void 0,gitOptions:N(e),configOptions:F(e)})});let R=m.command(`push`).description(I.description);E(R,I.options),O(R),A(R),R.action(e=>{let t=[...e.dictionaries||[],...e.dictionary||[]];return p({...e,dictionaries:t.length>0?t:void 0,gitOptions:N(e),configOptions:F(e)})});let z=m.command(`configuration`).alias(`config`).alias(`conf`).description(`Configuration operations`),B=z.command(`get`).description(`Get the configuration`);O(B),B.action(e=>{r({...e,configOptions:F(e)})});let V=z.command(`push`).description(`Push the configuration`);O(V),V.action(e=>{te({...e,configOptions:F(e)})}),m.command(`projects`).alias(`project`).description(`List Intlayer projects`).command(`list`).description(`List all Intlayer projects in the directory`).option(`--base-dir [baseDir]`,`Base directory to search from`).option(`--git-root`,`Search from the git root directory instead of the base directory`).option(`--json`,`Output the results as JSON`).action(e=>{d({baseDir:e.baseDir,gitRoot:e.gitRoot,json:e.json})}),m.command(`projects-list`).alias(`pl`).description(`List all Intlayer projects in the directory`).option(`--base-dir [baseDir]`,`Base directory to search from`).option(`--git-root`,`Search from the git root directory instead of the base directory`).option(`--absolute`,`Output the results as absolute paths`).option(`--json`,`Output the results as JSON`).action(e=>{d({baseDir:e.baseDir,gitRoot:e.gitRoot,json:e.json,absolute:e.absolute})});let H=m.command(`content`).description(`Content declaration operations`);H.command(`list`).description(`List the content declaration files`).option(`--json`,`Output the results as JSON`).option(`--absolute`,`Output the results as absolute paths`).action(e=>{u({json:e.json,absolute:e.absolute})}),m.command(`list`).description(`List the content declaration files`).option(`--json`,`Output the results as JSON`).option(`--absolute`,`Output the results as absolute paths`).action(e=>{u({json:e.json,absolute:e.absolute})});let U=H.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`);O(U),U.action(e=>{o({...e,configOptions:F(e)})});let W=m.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`);O(W),W.action(e=>{o({...e,configOptions:F(e)})});let G=m.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`);O(G),k(G),A(G),G.action(e=>{let t=[...e.keys??[],...e.key??[]],n=[...e.excludedKeys??[],...e.excludedKey??[]],r=[...e.dictionaries??[],...e.dictionary??[]];return s({...e,keys:t.length>0?t:void 0,excludedKeys:n.length>0?n:void 0,dictionaries:r.length>0?r:void 0,aiOptions:j(e),gitOptions:N(e),configOptions:F(e)})});let K=[[`--doc-pattern [docPattern...]`,`Documentation pattern`],[`--excluded-glob-pattern [excludedGlobPattern...]`,`Excluded glob pattern`],[`--nb-simultaneous-file-processed [nbSimultaneousFileProcessed]`,`Number of simultaneous file processed`],[`--locales [locales...]`,`Locales`],[`--base-locale [baseLocale]`,`Base locale`],[`--custom-instructions [customInstructions]`,`Custom instructions added to the prompt. Usefull to apply specific rules regarding formatting, urls translation, etc.`],[`--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.'],[`--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.'],[`--skip-if-exists`,`Skip the file if it already exists`]],q=m.command(`doc`).description(`Documentation operations`),J=q.command(`translate`).description(`Translate the documentation`);O(J),k(J),A(J),E(J,K),J.action(e=>ie({docPattern:e.docPattern,excludedGlobPattern:e.excludedGlobPattern,locales:e.locales,baseLocale:e.baseLocale,aiOptions:j(e),gitOptions:N(e),nbSimultaneousFileProcessed:e.nbSimultaneousFileProcessed,configOptions:F(e),customInstructions:e.customInstructions,skipIfModifiedBefore:e.skipIfModifiedBefore,skipIfModifiedAfter:e.skipIfModifiedAfter,skipIfExists:e.skipIfExists}));let Y=q.command(`review`).description(`Review the documentation`);O(Y),k(Y),A(Y),E(Y,K),Y.action(e=>ne({docPattern:e.docPattern,excludedGlobPattern:e.excludedGlobPattern,locales:e.locales,baseLocale:e.baseLocale,aiOptions:j(e),gitOptions:N(e),nbSimultaneousFileProcessed:e.nbSimultaneousFileProcessed,configOptions:F(e),customInstructions:e.customInstructions,skipIfModifiedBefore:e.skipIfModifiedBefore,skipIfModifiedAfter:e.skipIfModifiedAfter,skipIfExists:e.skipIfExists}));let X=q.command(`search`).description(`Search the documentation`).argument(`<query>`,`Search query`).option(`--limit [limit]`,`Limit the number of results`,`10`);O(X),X.action((e,t)=>re({query:e,limit:t.limit?parseInt(t.limit,10):10,configOptions:F(t)}));let oe=[[`--with [with...]`,`Start command in parallel with the live sync`]],Z=m.command(`live`).description(`Live sync - Watch for changes made on the CMS and update the application content accordingly`);E(Z,oe),O(Z),Z.action(e=>ee(e));let Q=m.command(`editor`).description(`Visual editor operations`).command(`start`).description(`Start the Intlayer visual editor`);O(Q),Q.action(e=>{i({env:e.env,envFile:e.envFile})});let $=m.command(`extract`).alias(`ext`).description(`Extract strings from components to be placed in a .content file close to the component`);return $.option(`-f, --file [files...]`,`List of files to extract`).option(`-o, --output-content-declarations [outputContentDeclarations]`,`Path to output content declaration files`).option(`--code-only`,`Only extract the component code`,!1).option(`--declaration-only`,`Only generate content declaration`,!1).action(e=>{a({files:e.file,outputContentDeclarations:e.outputContentDeclarations,configOptions:F(e),codeOnly:e.codeOnly,declarationOnly:e.declarationOnly})}),O($),m.parse(process.argv),m.command(`ci`).description(`Run Intlayer commands with auto-injected credentials from INTLAYER_PROJECT_CREDENTIALS. Detects current project or iterates over all projects.`).argument(`<command...>`,`The intlayer command to execute (e.g., "fill", "push")`).allowUnknownOption().action(e=>{t(e)}),m};export{b as dirname,I as setAPI};
|
|
474
2
|
//# sourceMappingURL=cli.mjs.map
|