@intlayer/cli 8.1.11 → 8.2.0
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/cli.cjs +1 -1
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/extract.cjs +1 -1
- package/dist/cjs/extract.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/initMCP.cjs +2 -0
- package/dist/cjs/initMCP.cjs.map +1 -0
- package/dist/cjs/initSkills.cjs +1 -1
- package/dist/cjs/initSkills.cjs.map +1 -1
- package/dist/cjs/liveSync.cjs +3 -3
- package/dist/cjs/pull.cjs +1 -1
- package/dist/cjs/push/push.cjs +1 -1
- package/dist/cjs/utils/checkAccess.cjs +1 -1
- package/dist/cjs/utils/checkAccess.cjs.map +1 -1
- package/dist/cjs/watch.cjs +1 -1
- package/dist/cjs/watch.cjs.map +1 -1
- package/dist/esm/cli.mjs +1 -1
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/extract.mjs +1 -1
- package/dist/esm/extract.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/initMCP.mjs +2 -0
- package/dist/esm/initMCP.mjs.map +1 -0
- package/dist/esm/initSkills.mjs +1 -1
- package/dist/esm/initSkills.mjs.map +1 -1
- package/dist/esm/liveSync.mjs +2 -2
- package/dist/esm/pull.mjs +1 -1
- package/dist/esm/push/push.mjs +1 -1
- package/dist/esm/utils/checkAccess.mjs +1 -1
- package/dist/esm/utils/checkAccess.mjs.map +1 -1
- package/dist/esm/watch.mjs +1 -1
- package/dist/esm/watch.mjs.map +1 -1
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/extract.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -3
- package/dist/types/initMCP.d.ts +5 -0
- package/dist/types/initMCP.d.ts.map +1 -0
- package/dist/types/initSkills.d.ts +6 -1
- package/dist/types/initSkills.d.ts.map +1 -1
- package/dist/types/utils/checkAccess.d.ts.map +1 -1
- package/package.json +3 -2
package/dist/cjs/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./build.cjs`),t=require(`./ci.cjs`),n=require(`./auth/login.cjs`),r=require(`./config.cjs`),i=require(`./editor.cjs`),a=require(`./extract.cjs`),o=require(`./test/test.cjs`),s=require(`./fill/fill.cjs`),c=require(`./init.cjs`),l=require(`./initSkills.cjs`),u=require(`./listContentDeclaration.cjs`),d=require(`./listProjects.cjs`),ee=require(`./liveSync.cjs`),f=require(`./pull.cjs`),p=require(`./push/push.cjs`),te=require(`./pushConfig.cjs`),ne=require(`./reviewDoc/reviewDoc.cjs`),re=require(`./searchDoc.cjs`),ie=require(`./translateDoc/translateDoc.cjs`),m=require(`./utils/getParentPackageJSON.cjs`),h=require(`./watch.cjs`);let g=require(`@intlayer/config/node`),_=require(`node:path`),v=require(`@intlayer/config/logger`),y=require(`node:url`),ae=require(`commander`);const b=typeof require(`url`).pathToFileURL(__filename).href==`string`?(0,_.dirname)((0,y.fileURLToPath)(require(`url`).pathToFileURL(__filename).href)):__dirname,x=m.getParentPackageJSON(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]!==void 0),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=(0,g.getConfiguration)(),{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=>{if(T(e,M).length===0)return;let{gitDiff:t,gitDiffBase:n,gitDiffCurrent:r,uncommitted:i,unpushed:a,untracked:o}=e;return D({mode:[t&&`gitDiff`,i&&`uncommitted`,a&&`unpushed`,o&&`untracked`].filter(Boolean),baseRef:n,currentRef:r,absolute:!0})},P=[`baseDir`,`env`,`envFile`,`verbose`,`prefix`,`checkTypes`],F=e=>{if(T(e,P).length===0)return;e.with===void 0&&(0,v.setPrefix)(``);let{baseDir:t,env:n,envFile:r,verbose:i,noCache:a,checkTypes:o}=e,s=D({mode:i===void 0?void 0:i?`verbose`:`default`}),c=D({checkTypes:o}),l=D({log:Object.keys(s).length>0?s:void 0,build:Object.keys(c).length>0?c:void 0});return D({baseDir:t,env:n,envFile:r,override:Object.keys(l).length>0?l:void 0,cache:a===void 0?void 0:!a})},I=()=>{process.argv.includes(`--with`)||(0,v.setPrefix)(``);let m=new ae.Command;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:``,mode:`verbose`}}};return n.login({cmsUrl:e.cmsUrl,configOptions:t})}),m.command(`init`).description(`Initialize Intlayer in the project`).option(`--project-root [projectRoot]`,`Project root directory`).action(e=>c.init(e.projectRoot)).command(`skills`).description(`Initialize Intlayer skills in the project`).option(`--project-root [projectRoot]`,`Project root directory`).action(e=>l.initSkills(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`],[`--check-types`,`Check TypeScript type and log errors`]]},b=_.command(`build`).description(y.description);E(b,y.options),O(b),b.action(t=>{e.build({...t,configOptions:F(t)})});let S=m.command(`build`).description(y.description);E(S,y.options),O(S),S.action(t=>{e.build({...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.watchContentDeclaration({...e,configOptions:F(e)})});let T=m.command(`watch`).description(y.description);E(T,C.options),O(T),T.action(e=>{h.watchContentDeclaration({...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.pull({...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.pull({...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.push({...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.push({...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.getConfig({...e,configOptions:F(e)})});let V=z.command(`push`).description(`Push the configuration`);O(V),V.action(e=>{te.pushConfig({...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.listProjectsCommand({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.listProjectsCommand({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.listContentDeclaration({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.listContentDeclaration({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.testMissingTranslations({...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.testMissingTranslations({...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.fill({...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.translateDoc({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.reviewDoc({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.searchDoc({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.liveSync(e));let Q=m.command(`editor`).description(`Visual editor operations`).command(`start`).description(`Start the Intlayer visual editor`);O(Q),Q.action(e=>{i.startEditor({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.extract({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.runCI(e)}),m};exports.dirname=b,exports.setAPI=I;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./build.cjs`),t=require(`./ci.cjs`),n=require(`./auth/login.cjs`),r=require(`./config.cjs`),i=require(`./editor.cjs`),a=require(`./extract.cjs`),o=require(`./test/test.cjs`),s=require(`./fill/fill.cjs`),c=require(`./init.cjs`),l=require(`./initSkills.cjs`),ee=require(`./initMCP.cjs`),u=require(`./listContentDeclaration.cjs`),d=require(`./listProjects.cjs`),te=require(`./liveSync.cjs`),f=require(`./pull.cjs`),p=require(`./push/push.cjs`),ne=require(`./pushConfig.cjs`),re=require(`./reviewDoc/reviewDoc.cjs`),ie=require(`./searchDoc.cjs`),ae=require(`./translateDoc/translateDoc.cjs`),m=require(`./utils/getParentPackageJSON.cjs`),h=require(`./watch.cjs`);let g=require(`@intlayer/config/node`),_=require(`node:path`),oe=require(`@intlayer/config/logger`),v=require(`node:url`),se=require(`commander`);const y=typeof require(`url`).pathToFileURL(__filename).href==`string`?(0,_.dirname)((0,v.fileURLToPath)(require(`url`).pathToFileURL(__filename).href)):__dirname,b=m.getParentPackageJSON(y),x=[[`--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`]]],S=[[`--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`]],C=[[`--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`]],w=(e,t)=>t.filter(t=>e[t]!==void 0),T=(e,t)=>(t.forEach(([t,n])=>{e.option(t,n)}),e),E=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!==void 0)),D=e=>T(e,x),O=e=>T(e,S),k=e=>T(e,C),A=e=>{let{apiKey:t,provider:n,model:r,temperature:i,applicationContext:a,customPrompt:o,dataSerialization:s}=e,c=(0,g.getConfiguration)(),{ai:l}=c;return E({...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})},j=[`gitDiff`,`gitDiffBase`,`gitDiffCurrent`,`uncommitted`,`unpushed`,`untracked`],M=e=>{if(w(e,j).length===0)return;let{gitDiff:t,gitDiffBase:n,gitDiffCurrent:r,uncommitted:i,unpushed:a,untracked:o}=e;return E({mode:[t&&`gitDiff`,i&&`uncommitted`,a&&`unpushed`,o&&`untracked`].filter(Boolean),baseRef:n,currentRef:r,absolute:!0})},N=[`baseDir`,`env`,`envFile`,`verbose`,`prefix`,`checkTypes`],P=e=>{if(w(e,N).length===0)return;let{baseDir:t,env:n,envFile:r,verbose:i,noCache:a,checkTypes:o}=e,s=E({mode:i===void 0?void 0:i?`verbose`:`default`}),c=E({checkTypes:o}),l=E({log:Object.keys(s).length>0?s:void 0,build:Object.keys(c).length>0?c:void 0});return E({baseDir:t,env:n,envFile:r,override:Object.keys(l).length>0?l:void 0,cache:a===void 0?void 0:!a})},F=()=>{process.argv.includes(`--with`)||(0,oe.setPrefix)(``);let m=new se.Command;m.version(b.version).description(`Intlayer CLI`),m.command(`version`).description(`Print the Intlayer CLI version`).action(()=>{console.log(b.version??`unknown`)});let g=m.command(`login`).description(`Login to Intlayer`).option(`--cms-url [cmsUrl]`,`CMS URL`);D(g),g.action(e=>{let t=P(e)??{override:{log:{prefix:``,mode:`verbose`}}};return n.login({cmsUrl:e.cmsUrl,configOptions:t})});let _=m.command(`init`).description(`Initialize Intlayer in the project`).option(`--project-root [projectRoot]`,`Project root directory`).action(e=>c.init(e.projectRoot));_.command(`skills`).description(`Initialize Intlayer skills in the project`).option(`--project-root [projectRoot]`,`Project root directory`).action(e=>l.initSkills(e.projectRoot)),_.command(`mcp`).description(`Initialize Intlayer MCP server in the project`).option(`--project-root [projectRoot]`,`Project root directory`).action(e=>ee.initMCP(e.projectRoot));let v=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`],[`--check-types`,`Check TypeScript type and log errors`]]},x=v.command(`build`).description(y.description);T(x,y.options),D(x),x.action(t=>{e.build({...t,configOptions:P(t)})});let S=m.command(`build`).description(y.description);T(S,y.options),D(S),S.action(t=>{e.build({...t,configOptions:P(t)})});let C={description:`Watch the dictionaries changes`,options:[[`--with [with...]`,`Start command in parallel with the build`]]},w=v.command(`watch`).description(y.description);T(w,C.options),D(w),w.action(e=>{h.watchContentDeclaration({...e,configOptions:P(e)})});let E=m.command(`watch`).description(y.description);T(E,C.options),D(E),E.action(e=>{h.watchContentDeclaration({...e,configOptions:P(e)})});let j={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`]]},N=v.command(`pull`).description(j.description);T(N,j.options),D(N),N.action(e=>{let t=[...e.dictionaries??[],...e.dictionary??[]];f.pull({...e,dictionaries:t.length>0?t:void 0,configOptions:{...e.configOptions,baseDir:e.baseDir}})});let F=m.command(`pull`).description(j.description);T(F,j.options),D(F),F.action(e=>{let t=[...e.dictionaries??[],...e.dictionary??[]];f.pull({...e,dictionaries:t.length>0?t:void 0,configOptions:P(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=v.command(`push`).description(I.description);T(L,I.options),D(L),k(L),L.action(e=>{let t=[...e.dictionaries||[],...e.dictionary||[]];return p.push({...e,dictionaries:t.length>0?t:void 0,gitOptions:M(e),configOptions:P(e)})});let R=m.command(`push`).description(I.description);T(R,I.options),D(R),k(R),R.action(e=>{let t=[...e.dictionaries||[],...e.dictionary||[]];return p.push({...e,dictionaries:t.length>0?t:void 0,gitOptions:M(e),configOptions:P(e)})});let z=m.command(`configuration`).alias(`config`).alias(`conf`).description(`Configuration operations`),B=z.command(`get`).description(`Get the configuration`);D(B),B.action(e=>{r.getConfig({...e,configOptions:P(e)})});let V=z.command(`push`).description(`Push the configuration`);D(V),V.action(e=>{ne.pushConfig({...e,configOptions:P(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.listProjectsCommand({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.listProjectsCommand({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.listContentDeclaration({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.listContentDeclaration({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`);D(U),U.action(e=>{o.testMissingTranslations({...e,configOptions:P(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`);D(W),W.action(e=>{o.testMissingTranslations({...e,configOptions:P(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`);D(G),O(G),k(G),G.action(e=>{let t=[...e.keys??[],...e.key??[]],n=[...e.excludedKeys??[],...e.excludedKey??[]],r=[...e.dictionaries??[],...e.dictionary??[]];return s.fill({...e,keys:t.length>0?t:void 0,excludedKeys:n.length>0?n:void 0,dictionaries:r.length>0?r:void 0,aiOptions:A(e),gitOptions:M(e),configOptions:P(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`);D(J),O(J),k(J),T(J,K),J.action(e=>ae.translateDoc({docPattern:e.docPattern,excludedGlobPattern:e.excludedGlobPattern,locales:e.locales,baseLocale:e.baseLocale,aiOptions:A(e),gitOptions:M(e),nbSimultaneousFileProcessed:e.nbSimultaneousFileProcessed,configOptions:P(e),customInstructions:e.customInstructions,skipIfModifiedBefore:e.skipIfModifiedBefore,skipIfModifiedAfter:e.skipIfModifiedAfter,skipIfExists:e.skipIfExists}));let Y=q.command(`review`).description(`Review the documentation`);D(Y),O(Y),k(Y),T(Y,K),Y.action(e=>re.reviewDoc({docPattern:e.docPattern,excludedGlobPattern:e.excludedGlobPattern,locales:e.locales,baseLocale:e.baseLocale,aiOptions:A(e),gitOptions:M(e),nbSimultaneousFileProcessed:e.nbSimultaneousFileProcessed,configOptions:P(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`);D(X),X.action((e,t)=>ie.searchDoc({query:e,limit:t.limit?parseInt(t.limit,10):10,configOptions:P(t)}));let ce=[[`--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`);T(Z,ce),D(Z),Z.action(e=>te.liveSync(e));let Q=m.command(`editor`).description(`Visual editor operations`).command(`start`).description(`Start the Intlayer visual editor`);D(Q),Q.action(e=>{i.startEditor({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.extract({files:e.file,outputContentDeclarations:e.outputContentDeclarations,configOptions:P(e),codeOnly:e.codeOnly,declarationOnly:e.declarationOnly})}),D($),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.runCI(e)}),m};exports.dirname=y,exports.setAPI=F;
|
|
2
2
|
//# sourceMappingURL=cli.cjs.map
|
package/dist/cjs/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.cjs","names":["getParentPackageJSON","Command","login","init","initSkills","push","fill","translateDoc","reviewDoc","searchDoc","liveSync"],"sources":["../../src/cli.ts"],"sourcesContent":["import { dirname as pathDirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { AIOptions as BaseAIOptions } from '@intlayer/api';\nimport type { DiffMode, ListGitFilesOptions } from '@intlayer/chokidar/cli';\nimport { setPrefix } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { CustomIntlayerConfig } from '@intlayer/types';\nimport { Command } from 'commander';\nimport { login } from './auth/login';\nimport { build } from './build';\nimport { runCI } from './ci';\nimport { getConfig } from './config';\nimport { startEditor } from './editor';\nimport { extract } from './extract';\nimport { type FillOptions, fill } from './fill/fill';\nimport { init } from './init';\nimport { initSkills } from './initSkills';\nimport { listContentDeclaration } from './listContentDeclaration';\nimport { listProjectsCommand } from './listProjects';\nimport { liveSync } from './liveSync';\nimport { pull } from './pull';\nimport { push } from './push/push';\nimport { pushConfig } from './pushConfig';\nimport { reviewDoc } from './reviewDoc/reviewDoc';\nimport { searchDoc } from './searchDoc';\nimport { testMissingTranslations } from './test';\nimport { translateDoc } from './translateDoc/translateDoc';\nimport { getParentPackageJSON } from './utils/getParentPackageJSON';\nimport { watchContentDeclaration } from './watch';\n\n// Extended AI options to include customPrompt\ntype AIOptions = BaseAIOptions & {\n customPrompt?: string;\n};\n\nconst isESModule = typeof import.meta.url === 'string';\n\nexport const dirname = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nconst packageJson = getParentPackageJSON(dirname);\n\nconst logOptions = [\n ['--verbose', 'Verbose (default to true using CLI)'],\n ['--prefix [prefix]', 'Prefix'],\n];\n\nconst configurationOptions = [\n ['--env-file [envFile]', 'Environment file'],\n ['-e, --env [env]', 'Environment'],\n ['--base-dir [baseDir]', 'Base directory'],\n ['--no-cache [noCache]', 'No cache'],\n ...logOptions,\n];\n\nconst aiOptions = [\n ['--provider [provider]', 'Provider'],\n ['--temperature [temperature]', 'Temperature'],\n ['--model [model]', 'Model'],\n ['--api-key [apiKey]', 'Provider API key'],\n ['--custom-prompt [prompt]', 'Custom prompt'],\n ['--application-context [applicationContext]', 'Application context'],\n ['--data-serialization [dataSerialization]', 'Data serialization'],\n];\n\nconst gitOptions = [\n ['--git-diff [gitDiff]', 'Git diff mode - Check git diff between two refs'],\n ['--git-diff-base [gitDiffBase]', 'Git diff base ref'],\n ['--git-diff-current [gitDiffCurrent]', 'Git diff current ref'],\n ['--uncommitted [uncommitted]', 'Uncommitted'],\n ['--unpushed [unpushed]', 'Unpushed'],\n ['--untracked [untracked]', 'Untracked'],\n];\n\nconst extractKeysFromOptions = (options: object, keys: string[]) =>\n keys.filter((key) => options[key as keyof typeof options] !== undefined);\n\n/**\n * Helper functions to apply common options to commands\n */\nconst applyOptions = (command: Command, options: string[][]) => {\n options.forEach(([flag, description]) => {\n command.option(flag, description);\n });\n return command;\n};\n\nconst removeUndefined = <T extends Record<string, any>>(obj: T): T =>\n Object.fromEntries(\n Object.entries(obj).filter(([_, value]) => value !== undefined)\n ) as T;\n\nconst applyConfigOptions = (command: Command) =>\n applyOptions(command, configurationOptions);\nconst applyAIOptions = (command: Command) => applyOptions(command, aiOptions);\nconst applyGitOptions = (command: Command) => applyOptions(command, gitOptions);\n\nconst extractAiOptions = (options: AIOptions): AIOptions | undefined => {\n const {\n apiKey,\n provider,\n model,\n temperature,\n applicationContext,\n customPrompt,\n dataSerialization,\n } = options;\n\n const configuration = getConfiguration();\n const { ai } = configuration;\n\n return removeUndefined({\n ...ai,\n apiKey: apiKey ?? configuration.ai?.apiKey,\n provider: provider ?? (configuration.ai?.provider as AIOptions['provider']),\n model: model ?? configuration.ai?.model,\n temperature: temperature ?? configuration.ai?.temperature,\n applicationContext:\n applicationContext ?? configuration.ai?.applicationContext,\n customPrompt: customPrompt ?? (configuration.ai as any)?.customPrompt,\n dataSerialization: dataSerialization ?? configuration.ai?.dataSerialization,\n });\n};\n\ntype GitOptions = {\n gitDiff?: boolean;\n gitDiffBase?: string;\n gitDiffCurrent?: string;\n uncommitted?: boolean;\n unpushed?: boolean;\n untracked?: boolean;\n};\n\nconst gitOptionKeys: (keyof GitOptions)[] = [\n 'gitDiff',\n 'gitDiffBase',\n 'gitDiffCurrent',\n 'uncommitted',\n 'unpushed',\n 'untracked',\n];\n\nconst extractGitOptions = (\n options: GitOptions\n): ListGitFilesOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(options, gitOptionKeys);\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) return undefined;\n\n const {\n gitDiff,\n gitDiffBase,\n gitDiffCurrent,\n uncommitted,\n unpushed,\n untracked,\n } = options;\n\n const mode = [\n gitDiff && 'gitDiff',\n uncommitted && 'uncommitted',\n unpushed && 'unpushed',\n untracked && 'untracked',\n ].filter(Boolean) as DiffMode[];\n\n return removeUndefined({\n mode,\n baseRef: gitDiffBase,\n currentRef: gitDiffCurrent,\n absolute: true,\n });\n};\n\ntype LogOptions = {\n prefix?: string;\n verbose?: boolean;\n};\n\nexport type ConfigurationOptions = {\n baseDir?: string;\n env?: string;\n envFile?: string;\n noCache?: boolean;\n checkTypes?: boolean;\n} & LogOptions;\n\nconst configurationOptionKeys: (keyof ConfigurationOptions)[] = [\n 'baseDir',\n 'env',\n 'envFile',\n 'verbose',\n 'prefix',\n 'checkTypes',\n];\n\nconst extractConfigOptions = (\n options: ConfigurationOptions & { with?: string }\n): GetConfigurationOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(\n options,\n configurationOptionKeys\n );\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) {\n return undefined;\n }\n\n if (typeof options.with === 'undefined') {\n setPrefix('');\n }\n\n const { baseDir, env, envFile, verbose, noCache, checkTypes } = options;\n\n const log = removeUndefined({\n mode:\n typeof verbose !== 'undefined'\n ? verbose\n ? 'verbose'\n : 'default'\n : undefined,\n });\n\n const build = removeUndefined({\n checkTypes,\n });\n\n const override: CustomIntlayerConfig = removeUndefined({\n log:\n Object.keys(log).length > 0\n ? (log as CustomIntlayerConfig['log'])\n : undefined,\n build: Object.keys(build).length > 0 ? build : undefined,\n });\n\n return removeUndefined({\n baseDir,\n env,\n envFile,\n override: Object.keys(override).length > 0 ? override : undefined,\n cache: typeof noCache !== 'undefined' ? !noCache : undefined,\n });\n};\n\n/**\n * Set the API for the CLI\n *\n * Example of commands:\n *\n * npm run intlayer build --watch\n * npm run intlayer push --dictionaries id1 id2 id3 --deleteLocaleDir\n */\nexport const setAPI = (): Command => {\n const isWithCommand = process.argv.includes('--with');\n\n if (!isWithCommand) {\n setPrefix('');\n }\n\n const program = new Command();\n\n program.version(packageJson.version!).description('Intlayer CLI');\n\n // Explicit version subcommand for convenience: `npx intlayer version`\n program\n .command('version')\n .description('Print the Intlayer CLI version')\n .action(() => {\n // Prefer the resolved package.json version; fallback to unknown\n // Keeping output minimal to align with common CLI behavior\n console.log(packageJson.version ?? 'unknown');\n });\n\n /**\n * AUTH\n */\n const loginCmd = program\n .command('login')\n .description('Login to Intlayer')\n .option('--cms-url [cmsUrl]', 'CMS URL');\n\n applyConfigOptions(loginCmd);\n\n loginCmd.action((options) => {\n const configOptions = extractConfigOptions(options) ?? {\n override: {\n log: {\n prefix: '',\n mode: 'verbose',\n },\n },\n };\n\n return login({\n cmsUrl: options.cmsUrl,\n configOptions,\n });\n });\n\n /**\n * INIT\n */\n const initCmd = program\n .command('init')\n .description('Initialize Intlayer in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .action((options) => init(options.projectRoot));\n\n initCmd\n .command('skills')\n .description('Initialize Intlayer skills in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .action((options) => initSkills(options.projectRoot));\n\n /**\n * DICTIONARIES\n */\n\n const dictionariesProgram = program\n .command('dictionary')\n .alias('dictionaries')\n .alias('dic')\n .description('Dictionaries operations');\n\n // Dictionary build command\n const buildOptions = {\n description: 'Build the dictionaries',\n options: [\n ['-w, --watch', 'Watch for changes'],\n ['--skip-prepare', 'Skip the prepare step'],\n ['--with [with...]', 'Start command in parallel with the build'],\n ['--check-types', 'Check TypeScript type and log errors'],\n ],\n };\n\n // Add build command to dictionaries program\n const dictionariesBuildCmd = dictionariesProgram\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(dictionariesBuildCmd, buildOptions.options);\n applyConfigOptions(dictionariesBuildCmd);\n dictionariesBuildCmd.action((options) => {\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootBuildCmd = program\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(rootBuildCmd, buildOptions.options);\n applyConfigOptions(rootBuildCmd);\n rootBuildCmd.action((options) => {\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const watchOptions = {\n description: 'Watch the dictionaries changes',\n options: [['--with [with...]', 'Start command in parallel with the build']],\n };\n\n // Add build command to dictionaries program\n const dictionariesWatchCmd = dictionariesProgram\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(dictionariesWatchCmd, watchOptions.options);\n applyConfigOptions(dictionariesWatchCmd);\n dictionariesWatchCmd.action((options) => {\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootWatchCmd = program\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(rootWatchCmd, watchOptions.options);\n applyConfigOptions(rootWatchCmd);\n rootWatchCmd.action((options) => {\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary pull command\n const pullOptions = {\n description: 'Pull dictionaries from the server',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to pull'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to pull (alias for --dictionaries)',\n ],\n ['--new-dictionaries-path [path]', 'Path to save the new dictionaries'],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--newDictionariesPath [path]',\n '[alias] Path to save the new dictionaries',\n ],\n ],\n };\n\n // Add pull command to dictionaries program\n const dictionariesPullCmd = dictionariesProgram\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(dictionariesPullCmd, pullOptions.options);\n applyConfigOptions(dictionariesPullCmd);\n dictionariesPullCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: {\n ...options.configOptions,\n baseDir: options.baseDir,\n },\n });\n });\n\n // Add pull command to root program as well\n const rootPullCmd = program\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(rootPullCmd, pullOptions.options);\n applyConfigOptions(rootPullCmd);\n rootPullCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary push command\n const pushOptions = {\n description:\n 'Push all dictionaries. Create or update the pushed dictionaries',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to push'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to push (alias for --dictionaries)',\n ],\n [\n '-r, --delete-locale-dictionary',\n 'Delete the local dictionaries after pushing',\n ],\n [\n '-k, --keep-locale-dictionary',\n 'Keep the local dictionaries after pushing',\n ],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--deleteLocaleDictionary',\n '[alias] Delete the local dictionaries after pushing',\n ],\n [\n '--keepLocaleDictionary',\n '[alias] Keep the local dictionaries after pushing',\n ],\n [\n '--build [build]',\n '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',\n ],\n ],\n };\n\n // Add push command to dictionaries program\n const dictionariesPushCmd = dictionariesProgram\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(dictionariesPushCmd, pushOptions.options);\n applyConfigOptions(dictionariesPushCmd);\n applyGitOptions(dictionariesPushCmd);\n\n dictionariesPushCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n // Add push command to root program as well\n const rootPushCmd = program\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(rootPushCmd, pushOptions.options);\n applyConfigOptions(rootPushCmd);\n applyGitOptions(rootPushCmd);\n\n rootPushCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * CONFIGURATION\n */\n\n // Define the parent command\n const configurationProgram = program\n .command('configuration')\n .alias('config')\n .alias('conf')\n .description('Configuration operations');\n\n const configGetCmd = configurationProgram\n .command('get')\n .description('Get the configuration');\n\n applyConfigOptions(configGetCmd);\n configGetCmd.action((options) => {\n getConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Define the `push config` subcommand and add it to the `push` command\n const configPushCmd = configurationProgram\n .command('push')\n .description('Push the configuration');\n\n applyConfigOptions(configPushCmd);\n configPushCmd.action((options) => {\n pushConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * PROJECTS\n */\n\n const projectsProgram = program\n .command('projects')\n .alias('project')\n .description('List Intlayer projects');\n\n const projectsListCmd = projectsProgram\n .command('list')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--json', 'Output the results as JSON');\n\n projectsListCmd.action((options) => {\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n });\n });\n\n // Add alias for projects list command at root level\n const rootProjectsListCmd = program\n .command('projects-list')\n .alias('pl')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--absolute', 'Output the results as absolute paths')\n .option('--json', 'Output the results as JSON');\n\n rootProjectsListCmd.action((options) => {\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n /**\n * CONTENT DECLARATION\n */\n\n const contentProgram = program\n .command('content')\n .description('Content declaration operations');\n\n contentProgram\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action((options) => {\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n // Add alias for content list command\n program\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action((options) => {\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n const testProgram = contentProgram\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n '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'\n );\n\n applyConfigOptions(testProgram);\n testProgram.action((options) => {\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add alias for content test command\n const rootTestCmd = program\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n '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'\n );\n\n applyConfigOptions(rootTestCmd);\n rootTestCmd.action((options) => {\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const fillProgram = program\n .command('fill')\n .description('Fill the dictionaries')\n .option('-f, --file [files...]', 'List of Dictionary files to fill')\n .option('--source-locale [sourceLocale]', 'Source locale to translate from')\n .option(\n '--output-locales [outputLocales...]',\n 'Target locales to translate to'\n )\n .option(\n '--mode [mode]',\n 'Fill mode: complete, review. Complete will fill all missing content, review will fill missing content and review existing keys',\n 'complete'\n )\n .option('-k, --keys [keys...]', 'Filter dictionaries based on keys')\n .option(\n '--key [keys...]',\n 'Filter dictionaries based on keys (alias for --keys)'\n )\n .option(\n '--excluded-keys [excludedKeys...]',\n 'Filter out dictionaries based on keys'\n )\n .option(\n '--excluded-key [excludedKeys...]',\n 'Filter out dictionaries based on keys (alias for --excluded-keys)'\n )\n .option(\n '--path-filter [pathFilters...]',\n 'Filter dictionaries based on glob pattern'\n )\n .option(\n '--build [build]',\n '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'\n )\n .option(\n '--skip-metadata',\n 'Skip filling missing metadata (description, title, tags) for dictionaries'\n );\n\n applyConfigOptions(fillProgram);\n applyAIOptions(fillProgram);\n applyGitOptions(fillProgram);\n\n fillProgram.action((options) => {\n // Merge key aliases\n const keys = [...(options.keys ?? []), ...(options.key ?? [])];\n const excludedKeys = [\n ...(options.excludedKeys ?? []),\n ...(options.excludedKey ?? []),\n ];\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n return fill({\n ...options,\n keys: keys.length > 0 ? keys : undefined,\n excludedKeys: excludedKeys.length > 0 ? excludedKeys : undefined,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * DOCS\n */\n\n const docParams = [\n ['--doc-pattern [docPattern...]', 'Documentation pattern'],\n [\n '--excluded-glob-pattern [excludedGlobPattern...]',\n 'Excluded glob pattern',\n ],\n [\n '--nb-simultaneous-file-processed [nbSimultaneousFileProcessed]',\n 'Number of simultaneous file processed',\n ],\n ['--locales [locales...]', 'Locales'],\n ['--base-locale [baseLocale]', 'Base locale'],\n [\n '--custom-instructions [customInstructions]',\n 'Custom instructions added to the prompt. Usefull to apply specific rules regarding formatting, urls translation, etc.',\n ],\n [\n '--skip-if-modified-before [skipIfModifiedBefore]',\n '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.',\n ],\n [\n '--skip-if-modified-after [skipIfModifiedAfter]',\n '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.',\n ],\n ['--skip-if-exists', 'Skip the file if it already exists'],\n ];\n\n const docProgram = program\n .command('doc')\n .description('Documentation operations');\n\n const translateProgram = docProgram\n .command('translate')\n .description('Translate the documentation');\n\n applyConfigOptions(translateProgram);\n applyAIOptions(translateProgram);\n applyGitOptions(translateProgram);\n applyOptions(translateProgram, docParams);\n\n translateProgram.action((options) =>\n translateDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n })\n );\n\n const reviewProgram = docProgram\n .command('review')\n .description('Review the documentation');\n\n applyConfigOptions(reviewProgram);\n applyAIOptions(reviewProgram);\n applyGitOptions(reviewProgram);\n applyOptions(reviewProgram, docParams);\n\n reviewProgram.action((options) =>\n reviewDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n })\n );\n\n const searchProgram = docProgram\n .command('search')\n .description('Search the documentation')\n .argument('<query>', 'Search query')\n .option('--limit [limit]', 'Limit the number of results', '10');\n\n applyConfigOptions(searchProgram);\n\n searchProgram.action((query, options) =>\n searchDoc({\n query,\n limit: options.limit ? parseInt(options.limit, 10) : 10,\n configOptions: extractConfigOptions(options),\n })\n );\n\n /**\n * LIVE SYNC\n */\n\n const liveOptions = [\n ['--with [with...]', 'Start command in parallel with the live sync'],\n ];\n\n const liveCmd = program\n .command('live')\n .description(\n 'Live sync - Watch for changes made on the CMS and update the application content accordingly'\n );\n\n applyOptions(liveCmd, liveOptions);\n applyConfigOptions(liveCmd);\n\n liveCmd.action((options) => liveSync(options));\n\n /**\n * EDITOR\n */\n\n const editorProgram = program\n .command('editor')\n .description('Visual editor operations');\n\n const editorStartCmd = editorProgram\n .command('start')\n .description('Start the Intlayer visual editor');\n\n applyConfigOptions(editorStartCmd);\n\n editorStartCmd.action((options) => {\n startEditor({\n env: options.env,\n envFile: options.envFile,\n });\n });\n\n /**\n * EXTRACT\n */\n const extractProgram = program\n .command('extract')\n .alias('ext')\n .description(\n 'Extract strings from components to be placed in a .content file close to the component'\n );\n\n extractProgram\n .option('-f, --file [files...]', 'List of files to extract')\n .option(\n '-o, --output-content-declarations [outputContentDeclarations]',\n 'Path to output content declaration files'\n )\n .option('--code-only', 'Only extract the component code', false)\n .option('--declaration-only', 'Only generate content declaration', false)\n .action((options) => {\n extract({\n files: options.file,\n outputContentDeclarations: options.outputContentDeclarations,\n configOptions: extractConfigOptions(options),\n codeOnly: options.codeOnly,\n declarationOnly: options.declarationOnly,\n });\n });\n\n applyConfigOptions(extractProgram);\n\n program.parse(process.argv);\n\n /**\n * CI / AUTOMATION\n *\n * Used to iterate over all projects in a monorepo, and help to parse secrets\n */\n program\n .command('ci')\n .description(\n 'Run Intlayer commands with auto-injected credentials from INTLAYER_PROJECT_CREDENTIALS. Detects current project or iterates over all projects.'\n )\n .argument(\n '<command...>',\n 'The intlayer command to execute (e.g., \"fill\", \"push\")'\n )\n .allowUnknownOption() // Allows passing flags like --verbose to the subcommand\n .action((args) => {\n runCI(args);\n });\n\n return program;\n};\n"],"mappings":"w4BAwCA,MAAa,EAFM,OAAA,QAAA,MAAA,CAAA,cAAA,WAAA,CAAA,MAA2B,UAEvB,EAAA,EAAA,UAAA,EAAA,EAAA,eAAA,QAAA,MAAA,CAAA,cAAA,WAAA,CAAA,KACuB,CAAC,CAC3C,UAEE,EAAcA,EAAAA,qBAAqB,EAAQ,CAO3C,EAAuB,CAC3B,CAAC,uBAAwB,mBAAmB,CAC5C,CAAC,kBAAmB,cAAc,CAClC,CAAC,uBAAwB,iBAAiB,CAC1C,CAAC,uBAAwB,WAAW,CACpC,GAViB,CACjB,CAAC,YAAa,sCAAsC,CACpD,CAAC,oBAAqB,SAAS,CAChC,CAQA,CAEK,EAAY,CAChB,CAAC,wBAAyB,WAAW,CACrC,CAAC,8BAA+B,cAAc,CAC9C,CAAC,kBAAmB,QAAQ,CAC5B,CAAC,qBAAsB,mBAAmB,CAC1C,CAAC,2BAA4B,gBAAgB,CAC7C,CAAC,6CAA8C,sBAAsB,CACrE,CAAC,2CAA4C,qBAAqB,CACnE,CAEK,EAAa,CACjB,CAAC,uBAAwB,kDAAkD,CAC3E,CAAC,gCAAiC,oBAAoB,CACtD,CAAC,sCAAuC,uBAAuB,CAC/D,CAAC,8BAA+B,cAAc,CAC9C,CAAC,wBAAyB,WAAW,CACrC,CAAC,0BAA2B,YAAY,CACzC,CAEK,GAA0B,EAAiB,IAC/C,EAAK,OAAQ,GAAQ,EAAQ,KAAiC,IAAA,GAAU,CAKpE,GAAgB,EAAkB,KACtC,EAAQ,SAAS,CAAC,EAAM,KAAiB,CACvC,EAAQ,OAAO,EAAM,EAAY,EACjC,CACK,GAGH,EAAkD,GACtD,OAAO,YACL,OAAO,QAAQ,EA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ACf,YACC,+FACD,CAEH,EAAa,EAAS,GAAY,CAClC,EAAmB,EAAQ,CAE3B,EAAQ,OAAQ,GAAYC,GAAAA,SAAS,EAAQ,CAAC,CAU9C,IAAM,EAJgB,EACnB,QAAQ,SAAS,CACjB,YAAY,2BAA2B,CAGvC,QAAQ,QAAQ,CAChB,YAAY,mCAAmC,CAElD,EAAmB,EAAe,CAElC,EAAe,OAAQ,GAAY,CACjC,EAAA,YAAY,CACV,IAAK,EAAQ,IACb,QAAS,EAAQ,QAClB,CAAC,EACF,CAKF,IAAM,EAAiB,EACpB,QAAQ,UAAU,CAClB,MAAM,MAAM,CACZ,YACC,yFACD,CA2CH,OAzCA,EACG,OAAO,wBAAyB,2BAA2B,CAC3D,OACC,gEACA,2CACD,CACA,OAAO,cAAe,kCAAmC,GAAM,CAC/D,OAAO,qBAAsB,oCAAqC,GAAM,CACxE,OAAQ,GAAY,CACnB,EAAA,QAAQ,CACN,MAAO,EAAQ,KACf,0BAA2B,EAAQ,0BACnC,cAAe,EAAqB,EAAQ,CAC5C,SAAU,EAAQ,SAClB,gBAAiB,EAAQ,gBAC1B,CAAC,EACF,CAEJ,EAAmB,EAAe,CAElC,EAAQ,MAAM,QAAQ,KAAK,CAO3B,EACG,QAAQ,KAAK,CACb,YACC,iJACD,CACA,SACC,eACA,yDACD,CACA,oBAAoB,CACpB,OAAQ,GAAS,CAChB,EAAA,MAAM,EAAK,EACX,CAEG"}
|
|
1
|
+
{"version":3,"file":"cli.cjs","names":["getParentPackageJSON","Command","login","init","initSkills","initMCP","push","fill","translateDoc","reviewDoc","searchDoc","liveSync"],"sources":["../../src/cli.ts"],"sourcesContent":["import { dirname as pathDirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { AIOptions as BaseAIOptions } from '@intlayer/api';\nimport type { DiffMode, ListGitFilesOptions } from '@intlayer/chokidar/cli';\nimport { setPrefix } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { CustomIntlayerConfig } from '@intlayer/types';\nimport { Command } from 'commander';\nimport { login } from './auth/login';\nimport { build } from './build';\nimport { runCI } from './ci';\nimport { getConfig } from './config';\nimport { startEditor } from './editor';\nimport { extract } from './extract';\nimport { type FillOptions, fill } from './fill/fill';\nimport { init } from './init';\nimport { initMCP } from './initMCP';\nimport { initSkills } from './initSkills';\nimport { listContentDeclaration } from './listContentDeclaration';\nimport { listProjectsCommand } from './listProjects';\nimport { liveSync } from './liveSync';\nimport { pull } from './pull';\nimport { push } from './push/push';\nimport { pushConfig } from './pushConfig';\nimport { reviewDoc } from './reviewDoc/reviewDoc';\nimport { searchDoc } from './searchDoc';\nimport { testMissingTranslations } from './test';\nimport { translateDoc } from './translateDoc/translateDoc';\nimport { getParentPackageJSON } from './utils/getParentPackageJSON';\nimport { watchContentDeclaration } from './watch';\n\n// Extended AI options to include customPrompt\ntype AIOptions = BaseAIOptions & {\n customPrompt?: string;\n};\n\nconst isESModule = typeof import.meta.url === 'string';\n\nexport const dirname = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nconst packageJson = getParentPackageJSON(dirname);\n\nconst logOptions = [\n ['--verbose', 'Verbose (default to true using CLI)'],\n ['--prefix [prefix]', 'Prefix'],\n];\n\nconst configurationOptions = [\n ['--env-file [envFile]', 'Environment file'],\n ['-e, --env [env]', 'Environment'],\n ['--base-dir [baseDir]', 'Base directory'],\n ['--no-cache [noCache]', 'No cache'],\n ...logOptions,\n];\n\nconst aiOptions = [\n ['--provider [provider]', 'Provider'],\n ['--temperature [temperature]', 'Temperature'],\n ['--model [model]', 'Model'],\n ['--api-key [apiKey]', 'Provider API key'],\n ['--custom-prompt [prompt]', 'Custom prompt'],\n ['--application-context [applicationContext]', 'Application context'],\n ['--data-serialization [dataSerialization]', 'Data serialization'],\n];\n\nconst gitOptions = [\n ['--git-diff [gitDiff]', 'Git diff mode - Check git diff between two refs'],\n ['--git-diff-base [gitDiffBase]', 'Git diff base ref'],\n ['--git-diff-current [gitDiffCurrent]', 'Git diff current ref'],\n ['--uncommitted [uncommitted]', 'Uncommitted'],\n ['--unpushed [unpushed]', 'Unpushed'],\n ['--untracked [untracked]', 'Untracked'],\n];\n\nconst extractKeysFromOptions = (options: object, keys: string[]) =>\n keys.filter((key) => options[key as keyof typeof options] !== undefined);\n\n/**\n * Helper functions to apply common options to commands\n */\nconst applyOptions = (command: Command, options: string[][]) => {\n options.forEach(([flag, description]) => {\n command.option(flag, description);\n });\n return command;\n};\n\nconst removeUndefined = <T extends Record<string, any>>(obj: T): T =>\n Object.fromEntries(\n Object.entries(obj).filter(([_, value]) => value !== undefined)\n ) as T;\n\nconst applyConfigOptions = (command: Command) =>\n applyOptions(command, configurationOptions);\nconst applyAIOptions = (command: Command) => applyOptions(command, aiOptions);\nconst applyGitOptions = (command: Command) => applyOptions(command, gitOptions);\n\nconst extractAiOptions = (options: AIOptions): AIOptions | undefined => {\n const {\n apiKey,\n provider,\n model,\n temperature,\n applicationContext,\n customPrompt,\n dataSerialization,\n } = options;\n\n const configuration = getConfiguration();\n const { ai } = configuration;\n\n return removeUndefined({\n ...ai,\n apiKey: apiKey ?? configuration.ai?.apiKey,\n provider: provider ?? (configuration.ai?.provider as AIOptions['provider']),\n model: model ?? configuration.ai?.model,\n temperature: temperature ?? configuration.ai?.temperature,\n applicationContext:\n applicationContext ?? configuration.ai?.applicationContext,\n customPrompt: customPrompt ?? (configuration.ai as any)?.customPrompt,\n dataSerialization: dataSerialization ?? configuration.ai?.dataSerialization,\n });\n};\n\ntype GitOptions = {\n gitDiff?: boolean;\n gitDiffBase?: string;\n gitDiffCurrent?: string;\n uncommitted?: boolean;\n unpushed?: boolean;\n untracked?: boolean;\n};\n\nconst gitOptionKeys: (keyof GitOptions)[] = [\n 'gitDiff',\n 'gitDiffBase',\n 'gitDiffCurrent',\n 'uncommitted',\n 'unpushed',\n 'untracked',\n];\n\nconst extractGitOptions = (\n options: GitOptions\n): ListGitFilesOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(options, gitOptionKeys);\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) return undefined;\n\n const {\n gitDiff,\n gitDiffBase,\n gitDiffCurrent,\n uncommitted,\n unpushed,\n untracked,\n } = options;\n\n const mode = [\n gitDiff && 'gitDiff',\n uncommitted && 'uncommitted',\n unpushed && 'unpushed',\n untracked && 'untracked',\n ].filter(Boolean) as DiffMode[];\n\n return removeUndefined({\n mode,\n baseRef: gitDiffBase,\n currentRef: gitDiffCurrent,\n absolute: true,\n });\n};\n\ntype LogOptions = {\n prefix?: string;\n verbose?: boolean;\n};\n\nexport type ConfigurationOptions = {\n baseDir?: string;\n env?: string;\n envFile?: string;\n noCache?: boolean;\n checkTypes?: boolean;\n} & LogOptions;\n\nconst configurationOptionKeys: (keyof ConfigurationOptions)[] = [\n 'baseDir',\n 'env',\n 'envFile',\n 'verbose',\n 'prefix',\n 'checkTypes',\n];\n\nconst extractConfigOptions = (\n options: ConfigurationOptions & { with?: string }\n): GetConfigurationOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(\n options,\n configurationOptionKeys\n );\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) {\n return undefined;\n }\n\n const { baseDir, env, envFile, verbose, noCache, checkTypes } = options;\n\n const log = removeUndefined({\n mode:\n typeof verbose !== 'undefined'\n ? verbose\n ? 'verbose'\n : 'default'\n : undefined,\n });\n\n const build = removeUndefined({\n checkTypes,\n });\n\n const override: CustomIntlayerConfig = removeUndefined({\n log:\n Object.keys(log).length > 0\n ? (log as CustomIntlayerConfig['log'])\n : undefined,\n build: Object.keys(build).length > 0 ? build : undefined,\n });\n\n return removeUndefined({\n baseDir,\n env,\n envFile,\n override: Object.keys(override).length > 0 ? override : undefined,\n cache: typeof noCache !== 'undefined' ? !noCache : undefined,\n });\n};\n\n/**\n * Set the API for the CLI\n *\n * Example of commands:\n *\n * npm run intlayer build --watch\n * npm run intlayer push --dictionaries id1 id2 id3 --deleteLocaleDir\n */\nexport const setAPI = (): Command => {\n const isWithCommand = process.argv.includes('--with');\n\n if (!isWithCommand) {\n setPrefix('');\n }\n\n const program = new Command();\n\n program.version(packageJson.version!).description('Intlayer CLI');\n\n // Explicit version subcommand for convenience: `npx intlayer version`\n program\n .command('version')\n .description('Print the Intlayer CLI version')\n .action(() => {\n // Prefer the resolved package.json version; fallback to unknown\n // Keeping output minimal to align with common CLI behavior\n console.log(packageJson.version ?? 'unknown');\n });\n\n /**\n * AUTH\n */\n const loginCmd = program\n .command('login')\n .description('Login to Intlayer')\n .option('--cms-url [cmsUrl]', 'CMS URL');\n\n applyConfigOptions(loginCmd);\n\n loginCmd.action((options) => {\n const configOptions = extractConfigOptions(options) ?? {\n override: {\n log: {\n prefix: '',\n mode: 'verbose',\n },\n },\n };\n\n return login({\n cmsUrl: options.cmsUrl,\n configOptions,\n });\n });\n\n /**\n * INIT\n */\n const initCmd = program\n .command('init')\n .description('Initialize Intlayer in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .action((options) => init(options.projectRoot));\n\n initCmd\n .command('skills')\n .description('Initialize Intlayer skills in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .action((options) => initSkills(options.projectRoot));\n\n initCmd\n .command('mcp')\n .description('Initialize Intlayer MCP server in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .action((options) => initMCP(options.projectRoot));\n\n /**\n * DICTIONARIES\n */\n\n const dictionariesProgram = program\n .command('dictionary')\n .alias('dictionaries')\n .alias('dic')\n .description('Dictionaries operations');\n\n // Dictionary build command\n const buildOptions = {\n description: 'Build the dictionaries',\n options: [\n ['-w, --watch', 'Watch for changes'],\n ['--skip-prepare', 'Skip the prepare step'],\n ['--with [with...]', 'Start command in parallel with the build'],\n ['--check-types', 'Check TypeScript type and log errors'],\n ],\n };\n\n // Add build command to dictionaries program\n const dictionariesBuildCmd = dictionariesProgram\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(dictionariesBuildCmd, buildOptions.options);\n applyConfigOptions(dictionariesBuildCmd);\n dictionariesBuildCmd.action((options) => {\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootBuildCmd = program\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(rootBuildCmd, buildOptions.options);\n applyConfigOptions(rootBuildCmd);\n rootBuildCmd.action((options) => {\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const watchOptions = {\n description: 'Watch the dictionaries changes',\n options: [['--with [with...]', 'Start command in parallel with the build']],\n };\n\n // Add build command to dictionaries program\n const dictionariesWatchCmd = dictionariesProgram\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(dictionariesWatchCmd, watchOptions.options);\n applyConfigOptions(dictionariesWatchCmd);\n dictionariesWatchCmd.action((options) => {\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootWatchCmd = program\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(rootWatchCmd, watchOptions.options);\n applyConfigOptions(rootWatchCmd);\n rootWatchCmd.action((options) => {\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary pull command\n const pullOptions = {\n description: 'Pull dictionaries from the server',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to pull'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to pull (alias for --dictionaries)',\n ],\n ['--new-dictionaries-path [path]', 'Path to save the new dictionaries'],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--newDictionariesPath [path]',\n '[alias] Path to save the new dictionaries',\n ],\n ],\n };\n\n // Add pull command to dictionaries program\n const dictionariesPullCmd = dictionariesProgram\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(dictionariesPullCmd, pullOptions.options);\n applyConfigOptions(dictionariesPullCmd);\n dictionariesPullCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: {\n ...options.configOptions,\n baseDir: options.baseDir,\n },\n });\n });\n\n // Add pull command to root program as well\n const rootPullCmd = program\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(rootPullCmd, pullOptions.options);\n applyConfigOptions(rootPullCmd);\n rootPullCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary push command\n const pushOptions = {\n description:\n 'Push all dictionaries. Create or update the pushed dictionaries',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to push'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to push (alias for --dictionaries)',\n ],\n [\n '-r, --delete-locale-dictionary',\n 'Delete the local dictionaries after pushing',\n ],\n [\n '-k, --keep-locale-dictionary',\n 'Keep the local dictionaries after pushing',\n ],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--deleteLocaleDictionary',\n '[alias] Delete the local dictionaries after pushing',\n ],\n [\n '--keepLocaleDictionary',\n '[alias] Keep the local dictionaries after pushing',\n ],\n [\n '--build [build]',\n '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',\n ],\n ],\n };\n\n // Add push command to dictionaries program\n const dictionariesPushCmd = dictionariesProgram\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(dictionariesPushCmd, pushOptions.options);\n applyConfigOptions(dictionariesPushCmd);\n applyGitOptions(dictionariesPushCmd);\n\n dictionariesPushCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n // Add push command to root program as well\n const rootPushCmd = program\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(rootPushCmd, pushOptions.options);\n applyConfigOptions(rootPushCmd);\n applyGitOptions(rootPushCmd);\n\n rootPushCmd.action((options) => {\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * CONFIGURATION\n */\n\n // Define the parent command\n const configurationProgram = program\n .command('configuration')\n .alias('config')\n .alias('conf')\n .description('Configuration operations');\n\n const configGetCmd = configurationProgram\n .command('get')\n .description('Get the configuration');\n\n applyConfigOptions(configGetCmd);\n configGetCmd.action((options) => {\n getConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Define the `push config` subcommand and add it to the `push` command\n const configPushCmd = configurationProgram\n .command('push')\n .description('Push the configuration');\n\n applyConfigOptions(configPushCmd);\n configPushCmd.action((options) => {\n pushConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * PROJECTS\n */\n\n const projectsProgram = program\n .command('projects')\n .alias('project')\n .description('List Intlayer projects');\n\n const projectsListCmd = projectsProgram\n .command('list')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--json', 'Output the results as JSON');\n\n projectsListCmd.action((options) => {\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n });\n });\n\n // Add alias for projects list command at root level\n const rootProjectsListCmd = program\n .command('projects-list')\n .alias('pl')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--absolute', 'Output the results as absolute paths')\n .option('--json', 'Output the results as JSON');\n\n rootProjectsListCmd.action((options) => {\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n /**\n * CONTENT DECLARATION\n */\n\n const contentProgram = program\n .command('content')\n .description('Content declaration operations');\n\n contentProgram\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action((options) => {\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n // Add alias for content list command\n program\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action((options) => {\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n const testProgram = contentProgram\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n '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'\n );\n\n applyConfigOptions(testProgram);\n testProgram.action((options) => {\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add alias for content test command\n const rootTestCmd = program\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n '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'\n );\n\n applyConfigOptions(rootTestCmd);\n rootTestCmd.action((options) => {\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const fillProgram = program\n .command('fill')\n .description('Fill the dictionaries')\n .option('-f, --file [files...]', 'List of Dictionary files to fill')\n .option('--source-locale [sourceLocale]', 'Source locale to translate from')\n .option(\n '--output-locales [outputLocales...]',\n 'Target locales to translate to'\n )\n .option(\n '--mode [mode]',\n 'Fill mode: complete, review. Complete will fill all missing content, review will fill missing content and review existing keys',\n 'complete'\n )\n .option('-k, --keys [keys...]', 'Filter dictionaries based on keys')\n .option(\n '--key [keys...]',\n 'Filter dictionaries based on keys (alias for --keys)'\n )\n .option(\n '--excluded-keys [excludedKeys...]',\n 'Filter out dictionaries based on keys'\n )\n .option(\n '--excluded-key [excludedKeys...]',\n 'Filter out dictionaries based on keys (alias for --excluded-keys)'\n )\n .option(\n '--path-filter [pathFilters...]',\n 'Filter dictionaries based on glob pattern'\n )\n .option(\n '--build [build]',\n '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'\n )\n .option(\n '--skip-metadata',\n 'Skip filling missing metadata (description, title, tags) for dictionaries'\n );\n\n applyConfigOptions(fillProgram);\n applyAIOptions(fillProgram);\n applyGitOptions(fillProgram);\n\n fillProgram.action((options) => {\n // Merge key aliases\n const keys = [...(options.keys ?? []), ...(options.key ?? [])];\n const excludedKeys = [\n ...(options.excludedKeys ?? []),\n ...(options.excludedKey ?? []),\n ];\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n return fill({\n ...options,\n keys: keys.length > 0 ? keys : undefined,\n excludedKeys: excludedKeys.length > 0 ? excludedKeys : undefined,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * DOCS\n */\n\n const docParams = [\n ['--doc-pattern [docPattern...]', 'Documentation pattern'],\n [\n '--excluded-glob-pattern [excludedGlobPattern...]',\n 'Excluded glob pattern',\n ],\n [\n '--nb-simultaneous-file-processed [nbSimultaneousFileProcessed]',\n 'Number of simultaneous file processed',\n ],\n ['--locales [locales...]', 'Locales'],\n ['--base-locale [baseLocale]', 'Base locale'],\n [\n '--custom-instructions [customInstructions]',\n 'Custom instructions added to the prompt. Usefull to apply specific rules regarding formatting, urls translation, etc.',\n ],\n [\n '--skip-if-modified-before [skipIfModifiedBefore]',\n '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.',\n ],\n [\n '--skip-if-modified-after [skipIfModifiedAfter]',\n '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.',\n ],\n ['--skip-if-exists', 'Skip the file if it already exists'],\n ];\n\n const docProgram = program\n .command('doc')\n .description('Documentation operations');\n\n const translateProgram = docProgram\n .command('translate')\n .description('Translate the documentation');\n\n applyConfigOptions(translateProgram);\n applyAIOptions(translateProgram);\n applyGitOptions(translateProgram);\n applyOptions(translateProgram, docParams);\n\n translateProgram.action((options) =>\n translateDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n })\n );\n\n const reviewProgram = docProgram\n .command('review')\n .description('Review the documentation');\n\n applyConfigOptions(reviewProgram);\n applyAIOptions(reviewProgram);\n applyGitOptions(reviewProgram);\n applyOptions(reviewProgram, docParams);\n\n reviewProgram.action((options) =>\n reviewDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n })\n );\n\n const searchProgram = docProgram\n .command('search')\n .description('Search the documentation')\n .argument('<query>', 'Search query')\n .option('--limit [limit]', 'Limit the number of results', '10');\n\n applyConfigOptions(searchProgram);\n\n searchProgram.action((query, options) =>\n searchDoc({\n query,\n limit: options.limit ? parseInt(options.limit, 10) : 10,\n configOptions: extractConfigOptions(options),\n })\n );\n\n /**\n * LIVE SYNC\n */\n\n const liveOptions = [\n ['--with [with...]', 'Start command in parallel with the live sync'],\n ];\n\n const liveCmd = program\n .command('live')\n .description(\n 'Live sync - Watch for changes made on the CMS and update the application content accordingly'\n );\n\n applyOptions(liveCmd, liveOptions);\n applyConfigOptions(liveCmd);\n\n liveCmd.action((options) => liveSync(options));\n\n /**\n * EDITOR\n */\n\n const editorProgram = program\n .command('editor')\n .description('Visual editor operations');\n\n const editorStartCmd = editorProgram\n .command('start')\n .description('Start the Intlayer visual editor');\n\n applyConfigOptions(editorStartCmd);\n\n editorStartCmd.action((options) => {\n startEditor({\n env: options.env,\n envFile: options.envFile,\n });\n });\n\n /**\n * EXTRACT\n */\n const extractProgram = program\n .command('extract')\n .alias('ext')\n .description(\n 'Extract strings from components to be placed in a .content file close to the component'\n );\n\n extractProgram\n .option('-f, --file [files...]', 'List of files to extract')\n .option(\n '-o, --output-content-declarations [outputContentDeclarations]',\n 'Path to output content declaration files'\n )\n .option('--code-only', 'Only extract the component code', false)\n .option('--declaration-only', 'Only generate content declaration', false)\n .action((options) => {\n extract({\n files: options.file,\n outputContentDeclarations: options.outputContentDeclarations,\n configOptions: extractConfigOptions(options),\n codeOnly: options.codeOnly,\n declarationOnly: options.declarationOnly,\n });\n });\n\n applyConfigOptions(extractProgram);\n\n program.parse(process.argv);\n\n /**\n * CI / AUTOMATION\n *\n * Used to iterate over all projects in a monorepo, and help to parse secrets\n */\n program\n .command('ci')\n .description(\n 'Run Intlayer commands with auto-injected credentials from INTLAYER_PROJECT_CREDENTIALS. Detects current project or iterates over all projects.'\n )\n .argument(\n '<command...>',\n 'The intlayer command to execute (e.g., \"fill\", \"push\")'\n )\n .allowUnknownOption() // Allows passing flags like --verbose to the subcommand\n .action((args) => {\n runCI(args);\n });\n\n return program;\n};\n"],"mappings":"q6BAyCA,MAAa,EAFM,OAAA,QAAA,MAAA,CAAA,cAAA,WAAA,CAAA,MAA2B,UAEvB,EAAA,EAAA,UAAA,EAAA,EAAA,eAAA,QAAA,MAAA,CAAA,cAAA,WAAA,CAAA,KACuB,CAAC,CAC3C,UAEE,EAAcA,EAAAA,qBAAqB,EAAQ,CAO3C,EAAuB,CAC3B,CAAC,uBAAwB,mBAAmB,CAC5C,CAAC,kBAAmB,cAAc,CAClC,CAAC,uBAAwB,iBAAiB,CAC1C,CAAC,uBAAwB,WAAW,CACpC,GAViB,CACjB,CAAC,YAAa,sCAAsC,CACpD,CAAC,oBAAqB,SAAS,CAChC,CAQA,CAEK,EAAY,CAChB,CAAC,wBAAyB,WAAW,CACrC,CAAC,8BAA+B,cAAc,CAC9C,CAAC,kBAAmB,QAAQ,CAC5B,CAAC,qBAAsB,mBAAmB,CAC1C,CAAC,2BAA4B,gBAAgB,CAC7C,CAAC,6CAA8C,sBAAsB,CACrE,CAAC,2CAA4C,qBAAqB,CACnE,CAEK,EAAa,CACjB,CAAC,uBAAwB,kDAAkD,CAC3E,CAAC,gCAAiC,oBAAoB,CACtD,CAAC,sCAAuC,uBAAuB,CAC/D,CAAC,8BAA+B,cAAc,CAC9C,CAAC,wBAAyB,WAAW,CACrC,CAAC,0BAA2B,YAAY,CACzC,CAEK,GAA0B,EAAiB,IAC/C,EAAK,OAAQ,GAAQ,EAAQ,KAAiC,IAAA,GAAU,CAKpE,GAAgB,EAAkB,KACtC,EAAQ,SAAS,CAAC,EAAM,KAAiB,CACvC,EAAQ,OAAO,EAAM,EAAY,EACjC,CACK,GAGH,EAAkD,GACtD,OAAO,YACL,OAAO,QAAQ,EAAI,CAAC,QAAQ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,IAAM,GAAc,CAClB,CAAC,mBAAoB,+CAA+C,CACrE,CAEK,EAAU,EACb,QAAQ,OAAO,CACf,YACC,+FACD,CAEH,EAAa,EAAS,GAAY,CAClC,EAAmB,EAAQ,CAE3B,EAAQ,OAAQ,GAAYC,GAAAA,SAAS,EAAQ,CAAC,CAU9C,IAAM,EAJgB,EACnB,QAAQ,SAAS,CACjB,YAAY,2BAA2B,CAGvC,QAAQ,QAAQ,CAChB,YAAY,mCAAmC,CAElD,EAAmB,EAAe,CAElC,EAAe,OAAQ,GAAY,CACjC,EAAA,YAAY,CACV,IAAK,EAAQ,IACb,QAAS,EAAQ,QAClB,CAAC,EACF,CAKF,IAAM,EAAiB,EACpB,QAAQ,UAAU,CAClB,MAAM,MAAM,CACZ,YACC,yFACD,CA2CH,OAzCA,EACG,OAAO,wBAAyB,2BAA2B,CAC3D,OACC,gEACA,2CACD,CACA,OAAO,cAAe,kCAAmC,GAAM,CAC/D,OAAO,qBAAsB,oCAAqC,GAAM,CACxE,OAAQ,GAAY,CACnB,EAAA,QAAQ,CACN,MAAO,EAAQ,KACf,0BAA2B,EAAQ,0BACnC,cAAe,EAAqB,EAAQ,CAC5C,SAAU,EAAQ,SAClB,gBAAiB,EAAQ,gBAC1B,CAAC,EACF,CAEJ,EAAmB,EAAe,CAElC,EAAQ,MAAM,QAAQ,KAAK,CAO3B,EACG,QAAQ,KAAK,CACb,YACC,iJACD,CACA,SACC,eACA,yDACD,CACA,oBAAoB,CACpB,OAAQ,GAAS,CAChB,EAAA,MAAM,EAAK,EACX,CAEG"}
|
package/dist/cjs/extract.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`);let t=require(`@intlayer/config/node`),n=require(`node:path`),r=require(`@intlayer/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`);let t=require(`@intlayer/config/node`),n=require(`node:path`),r=require(`@intlayer/config/logger`),i=require(`node:fs`),a=require(`node:fs/promises`),o=require(`@clack/prompts`),s=require(`@intlayer/babel`),c=require(`@intlayer/unmerged-dictionaries-entry`),l=require(`fast-glob`);l=e.__toESM(l);const u=async e=>{try{let t=(0,n.resolve)(e,`package.json`);if(!(0,i.existsSync)(t))return{};let r=await(0,a.readFile)(t,`utf8`);return JSON.parse(r).dependencies}catch{return{}}},d=async e=>{let a=(0,t.getConfiguration)(e.configOptions),d=(0,r.getAppLogger)(a),{baseDir:f,codeDir:p}=a.content,m=e=>(0,r.colorizePath)((0,n.relative)(f,e)),h=await u(f),g=`react-intlayer`;h[`next-intlayer`]?g=`next-intlayer`:h[`vue-intlayer`]?g=`vue-intlayer`:h[`svelte-intlayer`]?g=`svelte-intlayer`:h[`react-intlayer`]?g=`react-intlayer`:h[`preact-intlayer`]?g=`preact-intlayer`:h[`solid-intlayer`]?g=`solid-intlayer`:h[`angular-intlayer`]?g=`angular-intlayer`:h[`express-intlayer`]&&(g=`express-intlayer`);let _=e.files??[];if(_.length===0){let e=[`**/*.content.{ts,tsx,js,jsx,mjs,cjs}`,`**/*.config.{ts,tsx,js,jsx,mjs,cjs}`,`**/*.test.{ts,tsx,js,jsx,mjs,cjs}`,`**/*.stories.{ts,tsx,js,jsx,mjs,cjs}`,`**/node_modules/**`,`**/dist/**`,`**/build/**`],t=(await Promise.all(p.map(t=>(0,l.default)(`**/*.{tsx,jsx,vue,svelte,ts,js}`,{cwd:t,ignore:e,absolute:!0})))).flat(),r=[...new Set(t)].filter(e=>(0,i.existsSync)(e)).map(e=>({value:e,label:(0,n.relative)(f,e)}));if(r.length===0){d(`No extractable files found in the project.`);return}let a=await(0,o.multiselect)({message:`Select files to extract:`,options:r,required:!1});typeof a==`symbol`&&process.exit(0),_=a}if(_.length===0){d(`No files selected for extraction.`);return}let v=_.map(e=>(0,n.resolve)(f,e)).filter(e=>(0,i.existsSync)(e)?!0:(d(`File not found: ${m(e)}`),!1));if(v.length===0)return;let y=(0,c.getUnmergedDictionaries)(a);await Promise.all(v.map(async t=>{try{await(0,s.extractContent)(t,g,{unmergedDictionaries:y,configuration:a,outputDir:e.outputContentDeclarations,codeOnly:e.codeOnly,declarationOnly:e.declarationOnly})}catch(e){d(`Failed to transform ${t}: ${e.message}`)}}))};exports.extract=d;
|
|
2
2
|
//# sourceMappingURL=extract.cjs.map
|
package/dist/cjs/extract.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.cjs","names":[],"sources":["../../src/extract.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { relative, resolve } from 'node:path';\nimport { multiselect } from '@clack/prompts';\nimport { type PackageName
|
|
1
|
+
{"version":3,"file":"extract.cjs","names":[],"sources":["../../src/extract.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { relative, resolve } from 'node:path';\nimport { multiselect } from '@clack/prompts';\nimport { extractContent, type PackageName } from '@intlayer/babel';\nimport { colorizePath, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport fg from 'fast-glob';\n\ntype ExtractOptions = {\n files?: string[];\n outputContentDeclarations?: string;\n configOptions?: GetConfigurationOptions;\n codeOnly?: boolean;\n declarationOnly?: boolean;\n};\n\n// Helper to read package.json dependencies\nconst getDependencies = async (baseDir: string) => {\n try {\n const packageJsonPath = resolve(baseDir, 'package.json');\n if (!existsSync(packageJsonPath)) {\n // Try parent directory if not found in baseDir\n return {};\n }\n const file = await readFile(packageJsonPath, 'utf8');\n const packageJSON = JSON.parse(file);\n\n return packageJSON.dependencies;\n } catch {\n return {};\n }\n};\n\nexport const extract = async (options: ExtractOptions) => {\n const configuration = getConfiguration(options.configOptions);\n const appLogger = getAppLogger(configuration);\n const { baseDir, codeDir } = configuration.content;\n\n const formatPath = (path: string) => {\n const relativePath = relative(baseDir, path);\n return colorizePath(relativePath);\n };\n\n // Detect package\n const dependencies = await getDependencies(baseDir);\n let packageName: PackageName = 'react-intlayer';\n\n if (dependencies['next-intlayer']) {\n packageName = 'next-intlayer';\n } else if (dependencies['vue-intlayer']) {\n packageName = 'vue-intlayer';\n } else if (dependencies['svelte-intlayer']) {\n packageName = 'svelte-intlayer';\n } else if (dependencies['react-intlayer']) {\n packageName = 'react-intlayer';\n } else if (dependencies['preact-intlayer']) {\n packageName = 'preact-intlayer';\n } else if (dependencies['solid-intlayer']) {\n packageName = 'solid-intlayer';\n } else if (dependencies['angular-intlayer']) {\n packageName = 'angular-intlayer';\n } else if (dependencies['express-intlayer']) {\n packageName = 'express-intlayer';\n }\n\n let filesToExtract = options.files ?? [];\n\n if (filesToExtract.length === 0) {\n const globPattern = '**/*.{tsx,jsx,vue,svelte,ts,js}';\n const excludePattern = [\n '**/*.content.{ts,tsx,js,jsx,mjs,cjs}',\n '**/*.config.{ts,tsx,js,jsx,mjs,cjs}',\n '**/*.test.{ts,tsx,js,jsx,mjs,cjs}',\n '**/*.stories.{ts,tsx,js,jsx,mjs,cjs}',\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**',\n ];\n\n // Await all promises simultaneously\n const resultsArray = await Promise.all(\n codeDir.map((dir) =>\n fg(globPattern, {\n cwd: dir,\n ignore: excludePattern,\n absolute: true,\n })\n )\n );\n\n // Flatten the nested arrays and remove duplicates\n const allFiles = resultsArray.flat();\n\n const uniqueFiles = [...new Set(allFiles)].filter((file) =>\n existsSync(file)\n );\n\n // Relative paths for selection\n const choices = uniqueFiles.map((file) => {\n const relPath = relative(baseDir, file);\n return {\n value: file,\n label: relPath,\n };\n });\n\n if (choices.length === 0) {\n appLogger('No extractable files found in the project.');\n return;\n }\n\n const selectedFiles = await multiselect({\n message: 'Select files to extract:',\n options: choices,\n required: false,\n });\n\n if (typeof selectedFiles === 'symbol') {\n // User cancelled\n process.exit(0);\n }\n\n filesToExtract = selectedFiles as string[];\n }\n\n if (filesToExtract.length === 0) {\n appLogger('No files selected for extraction.');\n return;\n }\n\n const absoluteFiles = filesToExtract\n .map((file) => resolve(baseDir, file))\n .filter((file) => {\n if (!existsSync(file)) {\n appLogger(`File not found: ${formatPath(file)}`);\n return false;\n }\n return true;\n });\n\n if (absoluteFiles.length === 0) {\n return;\n }\n\n const unmergedDictionaries = getUnmergedDictionaries(configuration);\n\n await Promise.all(\n absoluteFiles.map(async (filePath) => {\n try {\n await extractContent(filePath, packageName, {\n unmergedDictionaries,\n configuration,\n outputDir: options.outputContentDeclarations,\n codeOnly: options.codeOnly,\n declarationOnly: options.declarationOnly,\n });\n } catch (error) {\n appLogger(\n `Failed to transform ${filePath}: ${(error as Error).message}`\n );\n }\n })\n );\n};\n"],"mappings":"+ZAsBA,MAAM,EAAkB,KAAO,IAAoB,CACjD,GAAI,CACF,IAAM,GAAA,EAAA,EAAA,SAA0B,EAAS,eAAe,CACxD,GAAI,EAAA,EAAA,EAAA,YAAY,EAAgB,CAE9B,MAAO,EAAE,CAEX,IAAM,EAAO,MAAA,EAAA,EAAA,UAAe,EAAiB,OAAO,CAGpD,OAFoB,KAAK,MAAM,EAAK,CAEjB,kBACb,CACN,MAAO,EAAE,GAIA,EAAU,KAAO,IAA4B,CACxD,IAAM,GAAA,EAAA,EAAA,kBAAiC,EAAQ,cAAc,CACvD,GAAA,EAAA,EAAA,cAAyB,EAAc,CACvC,CAAE,UAAS,WAAY,EAAc,QAErC,EAAc,IAElB,EAAA,EAAA,eAAA,EAAA,EAAA,UAD8B,EAAS,EAAK,CACX,CAI7B,EAAe,MAAM,EAAgB,EAAQ,CAC/C,EAA2B,iBAE3B,EAAa,iBACf,EAAc,gBACL,EAAa,gBACtB,EAAc,eACL,EAAa,mBACtB,EAAc,kBACL,EAAa,kBACtB,EAAc,iBACL,EAAa,mBACtB,EAAc,kBACL,EAAa,kBACtB,EAA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O,CACd,EACE,uBAAuB,EAAS,IAAK,EAAgB,UACtD,GAEH,CACH"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./build.cjs`),t=require(`./editor.cjs`),n=require(`./extract.cjs`),r=require(`./test/listMissingTranslations.cjs`),i=require(`./test/test.cjs`),a=require(`./fill/fill.cjs`),o=require(`./init.cjs`),s=require(`./initSkills.cjs`),c=require(`./listContentDeclaration.cjs`),l=require(`./liveSync.cjs`),u=require(`./pull.cjs`),d=require(`./push/push.cjs`),f=require(`./pushConfig.cjs`),p=require(`./reviewDoc/reviewDoc.cjs`),m=require(`./searchDoc.cjs`),h=require(`./translateDoc/translateDoc.cjs`),g=require(`./cli.cjs`);exports.build=e.build,exports.dirname=g.dirname,exports.extract=n.extract,exports.fill=a.fill,exports.findProjectRoot=o.findProjectRoot,exports.getDetectedPlatform=s.getDetectedPlatform,exports.init=o.init,exports.initSkills=s.initSkills,exports.listContentDeclaration=c.listContentDeclaration,exports.listContentDeclarationRows=c.listContentDeclarationRows,exports.listMissingTranslations=r.listMissingTranslations,exports.listMissingTranslationsWithConfig=r.listMissingTranslationsWithConfig,exports.liveSync=l.liveSync,exports.pull=u.pull,exports.push=d.push,exports.pushConfig=f.pushConfig,exports.reviewDoc=p.reviewDoc,exports.searchDoc=m.searchDoc,exports.setAPI=g.setAPI,exports.startEditor=t.startEditor,exports.testMissingTranslations=i.testMissingTranslations,exports.translateDoc=h.translateDoc;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./build.cjs`),t=require(`./editor.cjs`),n=require(`./extract.cjs`),r=require(`./test/listMissingTranslations.cjs`),i=require(`./test/test.cjs`),a=require(`./fill/fill.cjs`),o=require(`./init.cjs`),s=require(`./initSkills.cjs`),c=require(`./listContentDeclaration.cjs`),l=require(`./liveSync.cjs`),u=require(`./pull.cjs`),d=require(`./push/push.cjs`),f=require(`./pushConfig.cjs`),p=require(`./reviewDoc/reviewDoc.cjs`),m=require(`./searchDoc.cjs`),h=require(`./translateDoc/translateDoc.cjs`),g=require(`./cli.cjs`);exports.PLATFORM_OPTIONS=s.PLATFORM_OPTIONS,exports.build=e.build,exports.dirname=g.dirname,exports.extract=n.extract,exports.fill=a.fill,exports.findProjectRoot=o.findProjectRoot,exports.getDetectedPlatform=s.getDetectedPlatform,exports.init=o.init,exports.initSkills=s.initSkills,exports.listContentDeclaration=c.listContentDeclaration,exports.listContentDeclarationRows=c.listContentDeclarationRows,exports.listMissingTranslations=r.listMissingTranslations,exports.listMissingTranslationsWithConfig=r.listMissingTranslationsWithConfig,exports.liveSync=l.liveSync,exports.pull=u.pull,exports.push=d.push,exports.pushConfig=f.pushConfig,exports.reviewDoc=p.reviewDoc,exports.searchDoc=m.searchDoc,exports.setAPI=g.setAPI,exports.startEditor=t.startEditor,exports.testMissingTranslations=i.testMissingTranslations,exports.translateDoc=h.translateDoc;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./init.cjs`),n=require(`./initSkills.cjs`);let r=require(`node:path`),i=require(`@intlayer/chokidar/cli`),a=require(`@clack/prompts`);a=e.__toESM(a);let o=require(`enquirer`);o=e.__toESM(o);const s=async e=>{let s=t.findProjectRoot(e?(0,r.resolve)(e):process.cwd());a.intro(`Initializing Intlayer MCP Server`);let c=n.getDetectedPlatform(),l;try{l=(await o.default.prompt({type:`autocomplete`,name:`platforms`,message:`Which platform are you using? (Type to search)`,multiple:!1,initial:c?i.PLATFORMS.indexOf(c):void 0,choices:n.PLATFORM_OPTIONS.map(e=>({name:e.value,message:e.label,hint:e.hint}))})).platforms}catch{a.cancel(`Operation cancelled.`);return}if(!l){a.cancel(`Operation cancelled. No platform selected.`);return}let u=await a.select({message:`Which transport method do you want to use?`,options:[{value:`stdio`,label:`Local server (stdio)`,hint:`Recommended. Integrates all features including CLI tools.`},{value:`sse`,label:`Remote server (SSE)`,hint:`Hosted by Intlayer. Documentation only.`}]});if(a.isCancel(u)||!u){a.cancel(`Operation cancelled.`);return}let d=a.spinner();d.start(`Configuring MCP Server...`);try{let e=await(0,i.installMCP)(s,l,u);d.stop(`MCP Server configured successfully`),a.note(e,`Success`)}catch(e){d.stop(`Failed to configure MCP Server`),a.log.error(e instanceof Error?e.message:String(e))}a.outro(`Intlayer MCP Server initialization complete`)};exports.initMCP=s;
|
|
2
|
+
//# sourceMappingURL=initMCP.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initMCP.cjs","names":["findProjectRoot","getDetectedPlatform","PLATFORMS","PLATFORM_OPTIONS","p"],"sources":["../../src/initMCP.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n installMCP,\n type MCPTransport,\n PLATFORMS,\n} from '@intlayer/chokidar/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\nimport { getDetectedPlatform, PLATFORM_OPTIONS } from './initSkills';\n\nexport const initMCP = async (projectRoot?: string) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer MCP Server');\n\n const detectedPlatform = getDetectedPlatform();\n\n let platform: any;\n try {\n const response = await enquirer.prompt<{ platforms: any }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platform are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n platform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n\n if (!platform) {\n p.cancel('Operation cancelled. No platform selected.');\n return;\n }\n\n const transport = (await p.select({\n message: 'Which transport method do you want to use?',\n options: [\n {\n value: 'stdio',\n label: 'Local server (stdio)',\n hint: 'Recommended. Integrates all features including CLI tools.',\n },\n {\n value: 'sse',\n label: 'Remote server (SSE)',\n hint: 'Hosted by Intlayer. Documentation only.',\n },\n ],\n })) as MCPTransport;\n\n if (p.isCancel(transport) || !transport) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n const s = p.spinner();\n s.start('Configuring MCP Server...');\n\n try {\n const result = await installMCP(root, platform, transport);\n\n s.stop('MCP Server configured successfully');\n\n p.note(result, 'Success');\n } catch (error) {\n s.stop('Failed to configure MCP Server');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer MCP Server initialization complete');\n};\n"],"mappings":"gUAWA,MAAa,EAAU,KAAO,IAAyB,CACrD,IAAM,EAAOA,EAAAA,gBACX,GAAA,EAAA,EAAA,SAAsB,EAAY,CAAG,QAAQ,KAAK,CACnD,CAED,EAAE,MAAM,mCAAmC,CAE3C,IAAM,EAAmBC,EAAAA,qBAAqB,CAE1C,EACJ,GAAI,CAeF,GAdiB,MAAM,EAAA,QAAS,OAA2B,CACzD,KAAM,eACN,KAAM,YACN,QAAS,iDACT,SAAU,GACV,QAAS,EACLC,EAAAA,UAAU,QAAQ,EAAiB,CACnC,IAAA,GACJ,QAASC,EAAAA,iBAAiB,IAAK,IAAS,CACtC,KAAM,EAAI,MACV,QAAS,EAAI,MACb,KAAM,EAAI,KACX,EAAE,CACJ,CAAC,EACkB,eACd,CACN,EAAE,OAAO,uBAAuB,CAChC,OAGF,GAAI,CAAC,EAAU,CACb,EAAE,OAAO,6CAA6C,CACtD,OAGF,IAAM,EAAa,MAAMC,EAAE,OAAO,CAChC,QAAS,6CACT,QAAS,CACP,CACE,MAAO,QACP,MAAO,uBACP,KAAM,4DACP,CACD,CACE,MAAO,MACP,MAAO,sBACP,KAAM,0CACP,CACF,CACF,CAAC,CAEF,GAAIA,EAAE,SAAS,EAAU,EAAI,CAAC,EAAW,CACvC,EAAE,OAAO,uBAAuB,CAChC,OAGF,IAAM,EAAIA,EAAE,SAAS,CACrB,EAAE,MAAM,4BAA4B,CAEpC,GAAI,CACF,IAAM,EAAS,MAAA,EAAA,EAAA,YAAiB,EAAM,EAAU,EAAU,CAE1D,EAAE,KAAK,qCAAqC,CAE5C,EAAE,KAAK,EAAQ,UAAU,OAClB,EAAO,CACd,EAAE,KAAK,iCAAiC,CACxC,EAAE,IAAI,MAAM,aAAiB,MAAQ,EAAM,QAAU,OAAO,EAAM,CAAC,CAGrE,EAAE,MAAM,8CAA8C"}
|
package/dist/cjs/initSkills.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./init.cjs`);let n=require(`node:path`),r=require(`@intlayer/chokidar/cli`),i=require(`node:fs`),a=require(`@clack/prompts`);a=e.__toESM(a);let o=require(`enquirer`);o=e.__toESM(o);const s=
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./init.cjs`);let n=require(`node:path`),r=require(`@intlayer/chokidar/cli`),i=require(`node:fs`),a=require(`@clack/prompts`);a=e.__toESM(a);let o=require(`enquirer`);o=e.__toESM(o);const s=r.PLATFORMS.filter(e=>r.PLATFORMS_METADATA[e].check).map(e=>({check:r.PLATFORMS_METADATA[e].check??(()=>!1),platform:e})),c=r.PLATFORMS.map(e=>({value:e,label:r.PLATFORMS_METADATA[e].label,hint:`(${r.PLATFORMS_METADATA[e].dir})`})),l=()=>s.find(({check:e})=>e())?.platform,u=e=>{try{let t=(0,n.join)(e,`package.json`);if(!(0,i.existsSync)(t))return{};let{dependencies:r={},devDependencies:a={}}=JSON.parse((0,i.readFileSync)(t,`utf-8`));return{...r,...a}}catch{return{}}},d=async e=>{let i=t.findProjectRoot(e?(0,n.resolve)(e):process.cwd());a.intro(`Initializing Intlayer skills`);let s=l(),d;try{d=(await o.default.prompt({type:`autocomplete`,name:`platforms`,message:`Which platforms are you using? (Type to search)`,multiple:!1,initial:s?r.PLATFORMS.indexOf(s):void 0,choices:c.map(e=>({name:e.value,message:e.label,hint:e.hint}))})).platforms}catch{a.cancel(`Operation cancelled.`);return}if(!d){a.log.warn(`No platform selected. Nothing to install.`);return}let f=(0,r.getInitialSkills)(u(i)),p=await a.multiselect({message:`Select the documentation skills to provide to your AI:`,initialValues:f,options:r.SKILLS.map(e=>({value:e,label:e,hint:r.SKILLS_METADATA[e]})),required:!1});if(a.isCancel(p)||!p||p.length===0){a.cancel(`Operation cancelled. No skills selected.`);return}let m=a.spinner();m.start(`Installing skills...`);try{let e=await(0,r.installSkills)(i,d,p);m.stop(`Skills installed successfully`),a.note(e,`Success`)}catch(e){m.stop(`Failed to install skills`),a.log.error(e instanceof Error?e.message:String(e))}a.outro(`Intlayer skills initialization complete`)};exports.PLATFORM_OPTIONS=c,exports.getDetectedPlatform=l,exports.initSkills=d;
|
|
2
2
|
//# sourceMappingURL=initSkills.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initSkills.cjs","names":["findProjectRoot","p","SKILLS","SKILLS_METADATA"],"sources":["../../src/initSkills.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n installSkills,\n type Platform,\n SKILLS,\n SKILLS_METADATA,\n} from '@intlayer/chokidar/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\n\n// --- Constants ---\n\nconst PLATFORM_CHECKS: Array<{ check: () => boolean; platform: Platform }> = [\n {\n check: () =>\n process.env.CURSOR === 'true' || process.env.TERM_PROGRAM === 'cursor',\n platform: 'Cursor',\n },\n {\n check: () =>\n process.env.WINDSURF === 'true' ||\n process.env.TERM_PROGRAM === 'windsurf',\n platform: 'Windsurf',\n },\n {\n check: () =>\n process.env.TRAE === 'true' || process.env.TERM_PROGRAM === 'trae',\n platform: 'Trae',\n },\n { check: () => process.env.TRAE_CN === 'true', platform: 'TraeCN' },\n {\n check: () =>\n process.env.VSCODE === 'true' || process.env.TERM_PROGRAM === 'vscode',\n platform: 'VSCode',\n },\n { check: () => process.env.OPENCODE === 'true', platform: 'OpenCode' },\n { check: () => process.env.CLAUDE === 'true', platform: 'Claude' },\n {\n check: () =>\n process.env.GITHUB_ACTIONS === 'true' || !!process.env.GITHUB_WORKSPACE,\n platform: 'GitHub',\n },\n];\n\nconst PLATFORM_OPTIONS: Array<{\n value: Platform;\n label: string;\n hint: string;\n}> = [\n { value: 'Cursor', label: 'Cursor', hint: '(.cursor/skills)' },\n { value: 'Windsurf', label: 'Windsurf', hint: '(.windsurf/skills)' },\n { value: 'Trae', label: 'Trae', hint: '(.trae/skills)' },\n { value: 'TraeCN', label: 'Trae CN', hint: '(.trae/skills)' },\n { value: 'VSCode', label: 'VS Code', hint: '(.github/skills)' },\n { value: 'OpenCode', label: 'OpenCode', hint: '(.opencode/skills)' },\n { value: 'Claude', label: 'Claude Code', hint: '(.claude/skills)' },\n {\n value: 'GitHub',\n label: 'GitHub Copilot Workspace',\n hint: '(.github/skills)',\n },\n { value: 'Antigravity', label: 'Antigravity', hint: '(.agent/skills)' },\n { value: 'Augment', label: 'Augment', hint: '(.augment/skills)' },\n { value: 'OpenClaw', label: 'OpenClaw', hint: '(skills)' },\n { value: 'Cline', label: 'Cline', hint: '(.cline/skills)' },\n { value: 'CodeBuddy', label: 'CodeBuddy', hint: '(.codebuddy/skills)' },\n {\n value: 'CommandCode',\n label: 'Command Code',\n hint: '(.commandcode/skills)',\n },\n { value: 'Continue', label: 'Continue', hint: '(.continue/skills)' },\n { value: 'Crush', label: 'Crush', hint: '(.crush/skills)' },\n { value: 'Droid', label: 'Droid', hint: '(.factory/skills)' },\n { value: 'Goose', label: 'Goose', hint: '(.goose/skills)' },\n { value: 'IFlow', label: 'iFlow CLI', hint: '(.iflow/skills)' },\n { value: 'Junie', label: 'Junie', hint: '(.junie/skills)' },\n { value: 'KiloCode', label: 'Kilo Code', hint: '(.kilocode/skills)' },\n { value: 'Kiro', label: 'Kiro CLI', hint: '(.kiro/skills)' },\n { value: 'Kode', label: 'Kode', hint: '(.kode/skills)' },\n { value: 'MCPJam', label: 'MCPJam', hint: '(.mcpjam/skills)' },\n { value: 'MistralVibe', label: 'Mistral Vibe', hint: '(.vibe/skills)' },\n { value: 'Mux', label: 'Mux', hint: '(.mux/skills)' },\n { value: 'OpenHands', label: 'OpenHands', hint: '(.openhands/skills)' },\n { value: 'Pi', label: 'Pi', hint: '(.pi/skills)' },\n { value: 'Qoder', label: 'Qoder', hint: '(.qoder/skills)' },\n { value: 'Qwen', label: 'Qwen Code', hint: '(.qwen/skills)' },\n { value: 'RooCode', label: 'Roo Code', hint: '(.roo/skills)' },\n { value: 'Zencoder', label: 'Zencoder', hint: '(.zencoder/skills)' },\n { value: 'Neovate', label: 'Neovate', hint: '(.neovate/skills)' },\n { value: 'Pochi', label: 'Pochi', hint: '(.pochi/skills)' },\n { value: 'Other', label: 'Other', hint: '(skills)' },\n];\n\n// --- Utilities ---\n\nexport const getDetectedPlatform = (): Platform | undefined =>\n PLATFORM_CHECKS.find(({ check }) => check())?.platform;\n\nfunction getDependencies(root: string): Record<string, string> {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return {};\n\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n return { ...dependencies, ...devDependencies };\n } catch {\n return {};\n }\n}\n\nfunction getInitialSkills(\n deps: Record<string, string>\n): (keyof typeof SKILLS_METADATA)[] {\n const skills: (keyof typeof SKILLS_METADATA)[] = [\n 'Usage',\n 'Config',\n 'Content',\n 'RemoteContent',\n 'Compiler',\n ];\n\n if (deps.react || deps.next) skills.push('React');\n if (deps.next) skills.push('NextJS');\n if (deps.preact) skills.push('Preact');\n if (deps['solid-js']) skills.push('Solid');\n if (deps.vue || deps.nuxt) skills.push('Vue');\n if (deps.svelte || deps['@sveltejs/kit']) skills.push('Svelte');\n if (deps.astro) skills.push('Astro');\n\n return skills;\n}\n\n// --- Main CLI Action ---\n\nexport const initSkills = async (projectRoot?: string) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer skills');\n\n const detectedPlatform = getDetectedPlatform();\n\n let platforms: Platform[];\n try {\n const response = await enquirer.prompt<{ platforms: Platform[] }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platforms are you using? (Type to search)',\n multiple: true,\n initial: detectedPlatform\n ? PLATFORM_OPTIONS.findIndex((p) => p.value === detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((p) => ({\n name: p.value,\n message: p.label,\n hint: p.hint,\n })),\n });\n platforms = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n\n if (!platforms || platforms.length === 0) {\n p.log.warn('No platform selected. Nothing to install.');\n return;\n }\n\n const dependencies = getDependencies(root);\n const initialValues = getInitialSkills(dependencies);\n\n const selectedSkills = await p.multiselect({\n message: 'Select the documentation skills to provide to your AI:',\n initialValues,\n options: SKILLS.map((skill) => ({\n value: skill,\n label: skill,\n hint: SKILLS_METADATA[skill],\n })),\n required: false,\n });\n\n if (\n p.isCancel(selectedSkills) ||\n !selectedSkills ||\n (selectedSkills as string[]).length === 0\n ) {\n p.cancel('Operation cancelled. No skills selected.');\n return;\n }\n\n const s = p.spinner();\n s.start('Installing skills...');\n\n try {\n const installPromises = platforms.map((platform) =>\n installSkills(\n root,\n platform,\n selectedSkills as (keyof typeof SKILLS_METADATA)[]\n )\n );\n\n const results = await Promise.all(installPromises);\n s.stop('Skills installed successfully');\n\n for (const result of results) {\n p.note(result, 'Success');\n }\n } catch (error) {\n s.stop('Failed to install skills');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer skills initialization complete');\n};\n"],"mappings":"uTAcA,MAAM,EAAuE,CAC3E,CACE,UACE,QAAQ,IAAI,SA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AgB,EAAK,CACU,CAE9C,EAAiB,MAAMC,EAAE,YAAY,CACzC,QAAS,yDACT,gBACA,QAASC,EAAAA,OAAO,IAAK,IAAW,CAC9B,MAAO,EACP,MAAO,EACP,KAAMC,EAAAA,gBAAgB,GACvB,EAAE,CACH,SAAU,GACX,CAAC,CAEF,GACEF,EAAE,SAAS,EAAe,EAC1B,CAAC,GACA,EAA4B,SAAW,EACxC,CACA,EAAE,OAAO,2CAA2C,CACpD,OAGF,IAAM,EAAIA,EAAE,SAAS,CACrB,EAAE,MAAM,uBAAuB,CAE/B,GAAI,CACF,IAAM,EAAkB,EAAU,IAAK,IAAA,EAAA,EAAA,eAEnC,EACA,EACA,EACD,CACF,CAEK,EAAU,MAAM,QAAQ,IAAI,EAAgB,CAClD,EAAE,KAAK,gCAAgC,CAEvC,IAAK,IAAM,KAAU,EACnB,EAAE,KAAK,EAAQ,UAAU,OAEpB,EAAO,CACd,EAAE,KAAK,2BAA2B,CAClC,EAAE,IAAI,MAAM,aAAiB,MAAQ,EAAM,QAAU,OAAO,EAAM,CAAC,CAGrE,EAAE,MAAM,0CAA0C"}
|
|
1
|
+
{"version":3,"file":"initSkills.cjs","names":["PLATFORMS","PLATFORMS_METADATA","findProjectRoot","p","SKILLS","SKILLS_METADATA"],"sources":["../../src/initSkills.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n getInitialSkills,\n installSkills,\n PLATFORMS,\n PLATFORMS_METADATA,\n type Platform,\n SKILLS,\n SKILLS_METADATA,\n} from '@intlayer/chokidar/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\n\nconst PLATFORM_CHECKS: Array<{ check: () => boolean; platform: Platform }> =\n PLATFORMS.filter((platform) => PLATFORMS_METADATA[platform].check).map(\n (platform) => ({\n check: PLATFORMS_METADATA[platform].check ?? (() => false),\n platform,\n })\n );\n\nexport const PLATFORM_OPTIONS: Array<{\n value: Platform;\n label: string;\n hint: string;\n}> = PLATFORMS.map((platform) => ({\n value: platform,\n label: PLATFORMS_METADATA[platform].label,\n hint: `(${PLATFORMS_METADATA[platform].dir})`,\n}));\n\nexport const getDetectedPlatform = (): Platform | undefined =>\n PLATFORM_CHECKS.find(({ check }) => check())?.platform;\n\nconst getDependencies = (root: string): Record<string, string> => {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return {};\n\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n return { ...dependencies, ...devDependencies };\n } catch {\n return {};\n }\n};\n\nexport const initSkills = async (projectRoot?: string) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer skills');\n\n const detectedPlatform = getDetectedPlatform();\n\n let platform: Platform;\n try {\n const response = await enquirer.prompt<{ platforms: Platform }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platforms are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n platform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n\n if (!platform) {\n p.log.warn('No platform selected. Nothing to install.');\n return;\n }\n\n const dependencies = getDependencies(root);\n const initialValues = getInitialSkills(dependencies);\n\n const selectedSkills = await p.multiselect({\n message: 'Select the documentation skills to provide to your AI:',\n initialValues,\n options: SKILLS.map((skill) => ({\n value: skill,\n label: skill,\n hint: SKILLS_METADATA[skill],\n })),\n required: false,\n });\n\n if (\n p.isCancel(selectedSkills) ||\n !selectedSkills ||\n (selectedSkills as string[]).length === 0\n ) {\n p.cancel('Operation cancelled. No skills selected.');\n return;\n }\n\n const s = p.spinner();\n s.start('Installing skills...');\n\n try {\n const result = await installSkills(root, platform, selectedSkills);\n\n s.stop('Skills installed successfully');\n\n p.note(result, 'Success');\n } catch (error) {\n s.stop('Failed to install skills');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer skills initialization complete');\n};\n"],"mappings":"uTAeA,MAAM,EACJA,EAAAA,UAAU,OAAQ,GAAaC,EAAAA,mBAAmB,GAAU,MAAM,CAAC,IAChE,IAAc,CACb,MAAOA,EAAAA,mBAAmB,GAAU,YAAgB,IACpD,WACD,EACF,CAEU,EAIRD,EAAAA,UAAU,IAAK,IAAc,CAChC,MAAO,EACP,MAAOC,EAAAA,mBAAmB,GAAU,MACpC,KAAM,IAAIA,EAAAA,mBAAmB,GAAU,IAAI,GAC5C,EAAE,CAEU,MACX,EAAgB,MAAM,CAAE,WAAY,GAAO,CAAC,EAAE,SAE1C,EAAmB,GAAyC,CAChE,GAAI,CACF,IAAM,GAAA,EAAA,EAAA,MAAuB,EAAM,eAAe,CAClD,GAAI,EAAA,EAAA,EAAA,YAAY,EAAgB,CAAE,MAAO,EAAE,CAE3C,GAAM,CAAE,eAAe,EAAE,CAAE,kBAAkB,EAAE,EAAK,KAAK,OAAA,EAAA,EAAA,cAC1C,EAAiB,QAAQ,CACvC,CACD,MAAO,CAAE,GAAG,EAAc,GAAG,EAAiB,MACxC,CACN,MAAO,EAAE,GAIA,EAAa,KAAO,IAAyB,CACxD,IAAM,EAAOC,EAAAA,gBACX,GAAA,EAAA,EAAA,SAAsB,EAAY,CAAG,QAAQ,KAAK,CACnD,CAED,EAAE,MAAM,+BAA+B,CAEvC,IAAM,EAAmB,GAAqB,CAE1C,EACJ,GAAI,CAeF,GAdiB,MAAM,EAAA,QAAS,OAAgC,CAC9D,KAAM,eACN,KAAM,YACN,QAAS,kDACT,SAAU,GACV,QAAS,EACLF,EAAAA,UAAU,QAAQ,EAAiB,CACnC,IAAA,GACJ,QAAS,EAAiB,IAAK,IAAS,CACtC,KAAM,EAAI,MACV,QAAS,EAAI,MACb,KAAM,EAAI,KACX,EAAE,CACJ,CAAC,EACkB,eACd,CACN,EAAE,OAAO,uBAAuB,CAChC,OAGF,GAAI,CAAC,EAAU,CACb,EAAE,IAAI,KAAK,4CAA4C,CACvD,OAIF,IAAM,GAAA,EAAA,EAAA,kBADe,EAAgB,EAAK,CACU,CAE9C,EAAiB,MAAMG,EAAE,YAAY,CACzC,QAAS,yDACT,gBACA,QAASC,EAAAA,OAAO,IAAK,IAAW,CAC9B,MAAO,EACP,MAAO,EACP,KAAMC,EAAAA,gBAAgB,GACvB,EAAE,CACH,SAAU,GACX,CAAC,CAEF,GACEF,EAAE,SAAS,EAAe,EAC1B,CAAC,GACA,EAA4B,SAAW,EACxC,CACA,EAAE,OAAO,2CAA2C,CACpD,OAGF,IAAM,EAAIA,EAAE,SAAS,CACrB,EAAE,MAAM,uBAAuB,CAE/B,GAAI,CACF,IAAM,EAAS,MAAA,EAAA,EAAA,eAAoB,EAAM,EAAU,EAAe,CAElE,EAAE,KAAK,gCAAgC,CAEvC,EAAE,KAAK,EAAQ,UAAU,OAClB,EAAO,CACd,EAAE,KAAK,2BAA2B,CAClC,EAAE,IAAI,MAAM,aAAiB,MAAQ,EAAM,QAAU,OAAO,EAAM,CAAC,CAGrE,EAAE,MAAM,0CAA0C"}
|
package/dist/cjs/liveSync.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./IntlayerEventListener.cjs`);let n=require(`@intlayer/chokidar/utils`),r=require(`@intlayer/config/node`),i=require(`@intlayer/config/logger`),a=require(`node:http`),o=require(`@intlayer/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./IntlayerEventListener.cjs`);let n=require(`@intlayer/chokidar/utils`),r=require(`@intlayer/config/node`),i=require(`@intlayer/config/logger`),a=require(`node:http`),o=require(`@intlayer/unmerged-dictionaries-entry`),s=require(`@intlayer/chokidar/build`),c=require(`@intlayer/core/plugins`),l=require(`@intlayer/dictionaries-entry`),u=require(`@intlayer/config/package.json`);u=e.__toESM(u);const d=async(e,t)=>{(0,i.getAppLogger)(t)(`Writing dictionary ${e.key}`),await(0,s.buildDictionary)([e],t)},f=async e=>{let s=(0,r.getConfiguration)(e?.configOptions),f=(0,i.getAppLogger)(s),{liveSyncPort:p,liveSyncURL:m}=s.editor,h=null,g=null;if(e?.with&&(h=(0,n.runParallel)(e.with),h.result.catch(()=>{})),s.editor.liveSync&&s.editor.backendURL&&s.editor.clientId&&s.editor.clientSecret){g=new t.IntlayerEventListener(s),g.onConnectionOpen=()=>{f(`Live sync connection established`)},g.onConnectionError=e=>{let t=e;f(`Live sync connection error: ${t.message??`Unknown error`}`,{level:`warn`}),(t.message?.includes(`terminated`)||t.message?.includes(`closed`))&&f(`Server connection was terminated, automatic reconnection will be attempted...`,{level:`info`})},g.onDictionaryAdded=e=>d(e,s),g.onDictionaryChange=e=>d(e,s),g.onDictionaryDeleted=e=>d(e,s);try{await g.initialize()}catch(e){f(`Failed to initialize IntlayerEventListener:`,{level:`error`}),f(`Error: ${e instanceof Error?e.message:String(e)}`,{level:`error`})}}else s.editor.liveSync?(!s.editor.clientId||!s.editor.clientSecret)&&f(`Missing client credentials for hot reload. Please configure clientId and clientSecret`):f(`Hot reload is disabled. Please enable it in the configuration (editor.liveSync).`);let _=(0,a.createServer)(async(e,t)=>{if(e.method===`OPTIONS`){t.writeHead(200,{"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`GET, POST, PUT, DELETE, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type, Authorization`}),t.end();return}if(e.url?.startsWith(`/dictionaries`)){t.writeHead(200,{"Content-Type":`application/json; charset=utf-8`,"Cache-Control":`no-store`,"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`GET, POST, PUT, DELETE, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type, Authorization`});let n=(0,l.getDictionaries)(s);if(e.url.startsWith(`/dictionaries/`)){let[r,i]=decodeURIComponent(e.url).slice(14).split(`/`),a=n[r]??null;if(i){let e=(0,c.getLocalizedContent)(a.content,i,{dictionaryKey:r,keyPath:[]});t.end(JSON.stringify(e));return}t.end(JSON.stringify(a));return}t.end(JSON.stringify(n));return}if(e.url?.startsWith(`/unmerged_dictionaries`)){t.writeHead(200,{"Content-Type":`application/json; charset=utf-8`,"Cache-Control":`no-store`,"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`GET, POST, PUT, DELETE, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type, Authorization`});let n=(0,o.getUnmergedDictionaries)(s);if(e.url.startsWith(`/unmerged_dictionaries/`)){let r=n[decodeURIComponent(e.url.slice(23))]??null;t.end(JSON.stringify(r));return}t.end(JSON.stringify(n));return}if(e.url===`/configuration`){t.writeHead(200,{"Content-Type":`application/json; charset=utf-8`,"Cache-Control":`no-store`,"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`GET, POST, PUT, DELETE, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type, Authorization`}),t.end(JSON.stringify(s));return}if(e.url===`/health`){t.writeHead(200,{"Content-Type":`application/json; charset=utf-8`}),t.end(JSON.stringify({status:`ok`}));return}t.end(`Not found`)}),v=()=>s.editor.liveSync?`\x1B[32m✓ Enabled\x1B[0m`:`\x1B[31m✗ Disabled\x1B[0m`;_.listen(p,()=>{console.log(`
|
|
2
2
|
\x1b[1;90mINTLAYER v${u.default.version}\x1b[0m
|
|
3
3
|
|
|
4
4
|
Live server running at: \x1b[90m${m}\x1b[0m
|
|
5
|
-
- Backend URL: \x1b[90m${
|
|
5
|
+
- Backend URL: \x1b[90m${s.editor.backendURL??`-`}\x1b[0m
|
|
6
6
|
- Live sync: ${v()}
|
|
7
7
|
- Parallel process: ${e?.with?`\x1b[90m${Array.isArray(e.with)?e.with.join(` `):e.with}\x1b[0m`:`-`}
|
|
8
|
-
- Access key: ${
|
|
8
|
+
- Access key: ${s.editor.clientId??`-`}
|
|
9
9
|
`)});let y=()=>{g&&(f(`Closing SSE connection...`),g.cleanup()),h&&h.kill(),_.close(()=>{f(`Live sync server stopped`),process.exit(0)})};process.on(`SIGINT`,y),process.on(`SIGTERM`,y),process.on(`exit`,y)};exports.liveSync=f;
|
|
10
10
|
//# sourceMappingURL=liveSync.cjs.map
|
package/dist/cjs/pull.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./utils/checkAccess.cjs`),t=require(`./push/pullLog.cjs`);let n=require(`@intlayer/api`),r=require(`@intlayer/chokidar/utils`),i=require(`@intlayer/config/node`),a=require(`node:path`),o=require(`@intlayer/config/logger`),s=require(`@intlayer/config/utils`),c=require(`node:fs`),l=require(`@intlayer/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);const e=require(`./utils/checkAccess.cjs`),t=require(`./push/pullLog.cjs`);let n=require(`@intlayer/api`),r=require(`@intlayer/chokidar/utils`),i=require(`@intlayer/config/node`),a=require(`node:path`),o=require(`@intlayer/config/logger`),s=require(`@intlayer/config/utils`),c=require(`node:fs`),l=require(`@intlayer/unmerged-dictionaries-entry`),u=require(`@intlayer/chokidar/build`);const d=async d=>{let f=(0,o.getAppLogger)(d?.configOptions?.override);try{let p=(0,i.getConfiguration)(d?.configOptions);if(!await e.checkCMSAuth(p))return;let m=(0,n.getIntlayerAPIProxy)(void 0,p),h=(0,l.getUnmergedDictionaries)(p),g=await m.dictionary.getDictionariesUpdateTimestamp();if(!g.data)throw Error(`No distant dictionaries found`);let _=g.data;d?.dictionaries&&(_=Object.fromEntries(Object.entries(_).filter(([e])=>d.dictionaries?.includes(e)))),_=Object.fromEntries(Object.entries(_).filter(([e])=>{let t=h[e]?.[0]?.location??p.dictionary?.location??`remote`;return t===`remote`||t===`hybrid`}));let v=(0,a.join)(p.system.mainDir,`remote_dictionaries.cjs`),y=p.build?.require??(0,s.getProjectRequire)(),b=(0,c.existsSync)(v)?y(v):{},x=Object.entries(_),S=x.filter(([e,t])=>{if(!t)return!0;let n=typeof t==`object`?t.updatedAt:t,r=b[e];if(!r)return!0;let i=r?.updatedAt,a=typeof i==`number`?i:i?new Date(i).getTime():void 0;return typeof a==`number`?n>a:!0}).map(([e])=>e),C=x.filter(([e,t])=>{let n=typeof t==`object`?t.updatedAt:t,r=b[e]?.updatedAt,i=typeof r==`number`?r:r?new Date(r).getTime():void 0;return typeof i==`number`&&typeof n==`number`&&i>=n}).map(([e])=>e);if(x.length===0){f(`No dictionaries to fetch`,{level:`error`});return}f(`Fetching dictionaries:`);let w=[...C.map(e=>({dictionaryKey:e,status:`imported`})),...S.map(e=>({dictionaryKey:e,status:`pending`}))],T=new t.PullLogger;T.update(w.map(e=>({dictionaryKey:e.dictionaryKey,status:e.status})));let E=[];await(0,r.parallelize)(w,async e=>{let t=e.status===`imported`||e.status===`up-to-date`;t||(e.status=`fetching`,T.update([{dictionaryKey:e.dictionaryKey,status:`fetching`}]));try{let n;if(t&&(n=b[e.dictionaryKey]),n||=(await m.dictionary.getDictionary(e.dictionaryKey)).data,!n)throw Error(`Dictionary ${e.dictionaryKey} not found on remote`);let r=h[e.dictionaryKey]?.find(e=>e.location===`hybrid`);r&&(n={...n,location:`hybrid`,filePath:r.filePath,localId:r.localId});let{status:i}=await(0,u.writeContentDeclaration)(n,p,d);e.status=i,T.update([{dictionaryKey:e.dictionaryKey,status:i}]),E.push(n)}catch(t){e.status=`error`,e.error=t,e.errorMessage=`Error fetching dictionary ${e.dictionaryKey}: ${t}`,T.update([{dictionaryKey:e.dictionaryKey,status:`error`}])}},5),T.finish();let D=e=>{switch(e){case`fetched`:case`imported`:case`updated`:case`up-to-date`:case`reimported in JSON`:case`new content file`:return`✔`;case`error`:return`✖`;default:return`⏲`}},O=e=>{switch(e){case`fetched`:case`imported`:case`updated`:case`up-to-date`:return o.ANSIColors.GREEN;case`reimported in JSON`:case`new content file`:return o.ANSIColors.YELLOW;case`error`:return o.ANSIColors.RED;default:return o.ANSIColors.BLUE}};for(let e of w){let t=D(e.status),n=O(e.status);f(` - ${e.dictionaryKey} ${o.ANSIColors.GREY}[${n}${t} ${e.status}${o.ANSIColors.GREY}]${o.ANSIColors.RESET}`)}for(let e of w)e.errorMessage&&f(e.errorMessage,{level:`error`})}catch(e){f(e,{level:`error`})}};exports.pull=d;
|
|
2
2
|
//# sourceMappingURL=pull.cjs.map
|
package/dist/cjs/push/push.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../utils/checkAccess.cjs`),n=require(`../pushLog.cjs`);let r=require(`@intlayer/api`),i=require(`@intlayer/chokidar/utils`),a=require(`@intlayer/config/node`),o=require(`node:path`),s=require(`@intlayer/chokidar/cli`),c=require(`@intlayer/config/logger`),l=require(`node:fs/promises`);l=e.__toESM(l);let u=require(`@intlayer/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`../utils/checkAccess.cjs`),n=require(`../pushLog.cjs`);let r=require(`@intlayer/api`),i=require(`@intlayer/chokidar/utils`),a=require(`@intlayer/config/node`),o=require(`node:path`),s=require(`@intlayer/chokidar/cli`),c=require(`@intlayer/config/logger`),l=require(`node:fs/promises`);l=e.__toESM(l);let u=require(`@intlayer/unmerged-dictionaries-entry`),d=require(`@intlayer/chokidar/build`);const f={pushed:{icon:`✔`,color:c.ANSIColors.GREEN},modified:{icon:`✔`,color:c.ANSIColors.GREEN},error:{icon:`✖`,color:c.ANSIColors.RED},default:{icon:`⏲`,color:c.ANSIColors.BLUE}},p=e=>f[e]??f.default,m=async e=>{let l=(0,a.getConfiguration)(e?.configOptions),f=(0,c.getAppLogger)(l);e?.build===!0?await(0,d.prepareIntlayer)(l,{forceRun:!0}):e?.build===void 0&&await(0,d.prepareIntlayer)(l);try{if(!await t.checkCMSAuth(l))return;let a=(0,r.getIntlayerAPIProxy)(void 0,l),m=(0,u.getUnmergedDictionaries)(l),g=Object.values(m).flat(),_=Array.from(new Set(g.map(e=>e.location).filter(e=>e&&![`remote`,`local`,`hybrid`].includes(e)))),v=[];if(_.length>0){let{multiselect:e,confirm:t,isCancel:n}=await import(`@clack/prompts`);if(_.length===1){let e=await t({message:`Do you want to push dictionaries with custom location ${(0,c.colorize)(_[0],c.ANSIColors.BLUE,c.ANSIColors.RESET)}?`,initialValue:!1});if(n(e))return;e&&(v=[_[0]])}else{let t=await e({message:`Select custom locations to push:`,options:_.map(e=>({value:e,label:e})),required:!1});if(n(t))return;v=t}}let y=g.filter(e=>{let t=e.location??l.dictionary?.location??`local`;return t===`remote`||t===`hybrid`||v.includes(t)});if(y.length===0){f(`No dictionaries found to push. Only dictionaries with location ${(0,c.colorize)(`remote`,c.ANSIColors.BLUE,c.ANSIColors.RESET)}, ${(0,c.colorize)(`hybrid`,c.ANSIColors.BLUE,c.ANSIColors.RESET)} or selected custom locations are pushed.`,{level:`warn`}),f(`You can set the location in your dictionary file (e.g. ${(0,c.colorize)(`{ key: 'my-key', location: 'hybrid', ... }`,c.ANSIColors.BLUE,c.ANSIColors.RESET)} or globally in your intlayer.config.ts file (e.g. ${(0,c.colorize)(`{ dictionary: { location: 'hybrid' } }`,c.ANSIColors.BLUE,c.ANSIColors.RESET)}).`,{level:`info`});return}let b=Object.keys(m);if(e?.dictionaries){let t=e.dictionaries.filter(e=>!b.includes(e));t.length>0&&f(`The following dictionaries do not exist: ${t.join(`, `)} and have been ignored.`,{level:`error`}),y=y.filter(t=>e.dictionaries?.includes(t.key))}if(e?.gitOptions){let t=await(0,s.listGitFiles)(e.gitOptions);y=y.filter(e=>t.includes((0,o.join)(l.content.baseDir,e.filePath??``)))}if(y.length===0){f(`No local dictionaries found`,{level:`error`});return}f(`Pushing dictionaries:`);let x=y.map(e=>({dictionary:e,status:`pending`})),S=new n.PushLogger;S.update(x.map(e=>({dictionaryKey:e.dictionary.key,status:`pending`})));let C=[];await(0,i.parallelize)(x,async e=>{e.status=`pushing`,S.update([{dictionaryKey:e.dictionary.key,status:`pushing`}]);try{let t=await a.dictionary.pushDictionaries([e.dictionary]),n=t.data?.updatedDictionaries??[],r=t.data?.newDictionaries??[],i=[...n,...r];for(let e of i){let t=m[e.key]?.find(t=>t.localId===e.localId);t&&await(0,d.writeContentDeclaration)({...t,id:e.id},l)}n.some(t=>t.key===e.dictionary.key)?(e.status=`modified`,C.push(e.dictionary),S.update([{dictionaryKey:e.dictionary.key,status:`modified`}])):r.some(t=>t.key===e.dictionary.key)?(e.status=`pushed`,C.push(e.dictionary),S.update([{dictionaryKey:e.dictionary.key,status:`pushed`}])):e.status=`unknown`}catch(t){e.status=`error`,e.error=t,e.errorMessage=`Error pushing dictionary ${e.dictionary.key}: ${t}`,S.update([{dictionaryKey:e.dictionary.key,status:`error`}])}},5),S.finish();for(let e of x){let{icon:t,color:n}=p(e.status);f(` - ${(0,c.colorizeKey)(e.dictionary.key)} ${c.ANSIColors.GREY}[${n}${t} ${e.status}${c.ANSIColors.GREY}]${c.ANSIColors.RESET}`)}for(let e of x)e.errorMessage&&f(e.errorMessage,{level:`error`});let w=e?.deleteLocaleDictionary,T=e?.keepLocaleDictionary;if(w&&T)throw Error(`Cannot specify both --deleteLocaleDictionary and --keepLocaleDictionary options.`);if(w)await h(C,e);else if(!T){let t=C.filter(e=>e.location===`remote`),n=t.map(e=>e.key);if(t.length>0){let{confirm:r,isCancel:i}=await import(`@clack/prompts`),a=await r({message:`Do you want to delete the local dictionaries that were successfully pushed? ${(0,c.colorize)(`(Dictionaries:`,c.ANSIColors.GREY,c.ANSIColors.RESET)} ${(0,c.colorizeKey)(n)}${(0,c.colorize)(`)`,c.ANSIColors.GREY,c.ANSIColors.RESET)}`,initialValue:!1});if(i(a))return;a&&await h(t,e)}}}catch(e){f(e,{level:`error`})}},h=async(e,t)=>{let n=(0,c.getAppLogger)((0,a.getConfiguration)(t?.configOptions)),r=new Set;for(let t of e){let{filePath:e}=t;if(!e){n(`Dictionary ${(0,c.colorizeKey)(t.key)} does not have a file path`,{level:`error`});continue}r.add(e)}for(let e of r)try{let t=await l.lstat(e);t.isFile()?(await l.unlink(e),n(`Deleted file ${(0,i.formatPath)(e)}`,{})):t.isDirectory()?n(`Path is a directory ${(0,i.formatPath)(e)}, skipping.`,{}):n(`Unknown file type for ${(0,i.formatPath)(e)}, skipping.`,{})}catch(t){n(`Error deleting ${(0,i.formatPath)(e)}: ${t}`,{level:`error`})}};exports.push=m;
|
|
2
2
|
//# sourceMappingURL=push.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./checkConfigConsistency.cjs`);let t=require(`@intlayer/api`),n=require(`@intlayer/config/logger`),r=require(`@intlayer/config/utils`);const i=async(i,a=!0)=>{let o=(0,n.getAppLogger)(i);if(!(i.editor.clientId&&i.editor.clientSecret))return o([`CMS auth not provided. You can either retreive the CMS access key on`,(0,n.colorize)(`https://intlayer.org/dahboard`,n.ANSIColors.GREY),(0,n.colorize)(`(see doc:`,n.ANSIColors.GREY_DARK),(0,n.colorize)(`https://intlayer.org/doc/concept/cms`,n.ANSIColors.GREY),(0,n.colorize)(`)`,n.ANSIColors.GREY_DARK),`.`],{level:`error`}),!1;let s=(0,t.getIntlayerAPIProxy)(void 0,i);try{let t=(await s.oAuth.getOAuth2AccessToken()).data?.project;if(!t)return o(`Project not found`),!0;if(t.configuration&&a)try{let n=t.configuration;if(n.ai&&`apiKeyConfigured`in n.ai){let{apiKeyConfigured:e,...t}=n.ai;n={...n,ai:t}}e.checkConfigConsistency(n,i)}catch
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./checkConfigConsistency.cjs`);let t=require(`@intlayer/api`),n=require(`@intlayer/config/logger`),r=require(`@intlayer/config/utils`);const i=async(i,a=!0)=>{let o=(0,n.getAppLogger)(i);if(!(i.editor.clientId&&i.editor.clientSecret))return o([`CMS auth not provided. You can either retreive the CMS access key on`,(0,n.colorize)(`https://intlayer.org/dahboard`,n.ANSIColors.GREY),(0,n.colorize)(`(see doc:`,n.ANSIColors.GREY_DARK),(0,n.colorize)(`https://intlayer.org/doc/concept/cms`,n.ANSIColors.GREY),(0,n.colorize)(`)`,n.ANSIColors.GREY_DARK),`.`],{level:`error`}),!1;let s=(0,t.getIntlayerAPIProxy)(void 0,i);try{let t=(await s.oAuth.getOAuth2AccessToken()).data?.project;if(!t)return o(`Project not found`),!0;if(t.configuration&&a)try{let n=t.configuration;if(n.ai&&`apiKeyConfigured`in n.ai){let{apiKeyConfigured:e,...t}=n.ai;n={...n,ai:t}}e.checkConfigConsistency(n,i)}catch{o([`Remote configuration is not up to date. The project configuration does not match the local configuration.`,`You can push the configuration by running`,(0,n.colorize)(`npx intlayer configuration push`,n.ANSIColors.CYAN),(0,n.colorize)(`(see doc:`,n.ANSIColors.GREY_DARK),(0,n.colorize)(`https://intlayer.org/doc/concept/cli/push`,n.ANSIColors.GREY),(0,n.colorize)(`)`,n.ANSIColors.GREY_DARK),`.`],{level:`warn`})}}catch(e){return o((0,r.extractErrorMessage)(e),{level:`error`}),!1}return!0},a=async(e,t,r=!0)=>{let a=(0,n.getAppLogger)(e),o=!!(e.editor.clientId&&e.editor.clientSecret),s=e.ai?.provider===`ollama`||t?.provider===`ollama`;return e.ai?.apiKey||t?.apiKey||s?!0:o?await i(e,r):(a([`AI options or API key not provided. You can either retreive the CMS access key on`,(0,n.colorize)(`https://intlayer.org/dahboard`,n.ANSIColors.GREY),(0,n.colorize)(`(see doc:`,n.ANSIColors.GREY_DARK),(0,n.colorize)(`https://intlayer.org/doc/concept/cms`,n.ANSIColors.GREY),(0,n.colorize)(`)`,n.ANSIColors.GREY_DARK),`. Alternatively, you can add your own OpenAI API key in the settings`,(0,n.colorize)(`(see doc:`,n.ANSIColors.GREY_DARK),(0,n.colorize)(`https://intlayer.org/doc/concept/configuration`,n.ANSIColors.GREY),(0,n.colorize)(`)`,n.ANSIColors.GREY_DARK),`.`],{level:`error`}),!1)};exports.checkAIAccess=a,exports.checkCMSAuth=i;
|
|
2
2
|
//# sourceMappingURL=checkAccess.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkAccess.cjs","names":["ANSIColors"],"sources":["../../../src/utils/checkAccess.ts"],"sourcesContent":["import type { AIOptions } from '@intlayer/api';\nimport { getIntlayerAPIProxy } from '@intlayer/api';\nimport { ANSIColors, colorize, getAppLogger } from '@intlayer/config/logger';\nimport { extractErrorMessage } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { checkConfigConsistency } from './checkConfigConsistency';\n\nexport const checkCMSAuth = async (\n configuration: IntlayerConfig,\n shouldCheckConfigConsistency: boolean = true\n): Promise<boolean> => {\n const appLogger = getAppLogger(configuration);\n\n const hasCMSAuth =\n configuration.editor.clientId && configuration.editor.clientSecret;\n if (!hasCMSAuth) {\n appLogger(\n [\n 'CMS auth not provided. You can either retreive the CMS access key on',\n colorize('https://intlayer.org/dahboard', ANSIColors.GREY),\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize('https://intlayer.org/doc/concept/cms', ANSIColors.GREY),\n colorize(')', ANSIColors.GREY_DARK),\n '.',\n ],\n {\n level: 'error',\n }\n );\n\n return false;\n }\n const intlayerAPI = getIntlayerAPIProxy(undefined, configuration);\n\n try {\n const result = await intlayerAPI.oAuth.getOAuth2AccessToken();\n\n const project = result.data?.project;\n\n if (!project) {\n appLogger('Project not found');\n\n return true;\n }\n\n if (project.configuration && shouldCheckConfigConsistency) {\n try {\n let remoteConfigToCheck = project.configuration;\n\n // Remove server-side computed flags (apiKeyConfigured)\n // We use destructuring + spread to avoid the 'delete' operator (performance)\n if (\n remoteConfigToCheck.ai &&\n 'apiKeyConfigured' in remoteConfigToCheck.ai\n ) {\n const { apiKeyConfigured, ...restAi } = remoteConfigToCheck.ai as any;\n\n remoteConfigToCheck = {\n ...remoteConfigToCheck,\n ai: restAi,\n };\n }\n\n // Recursively check if project.configuration (subset) matches configuration (superset)\n checkConfigConsistency(remoteConfigToCheck, configuration);\n } catch
|
|
1
|
+
{"version":3,"file":"checkAccess.cjs","names":["ANSIColors"],"sources":["../../../src/utils/checkAccess.ts"],"sourcesContent":["import type { AIOptions } from '@intlayer/api';\nimport { getIntlayerAPIProxy } from '@intlayer/api';\nimport { ANSIColors, colorize, getAppLogger } from '@intlayer/config/logger';\nimport { extractErrorMessage } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport { checkConfigConsistency } from './checkConfigConsistency';\n\nexport const checkCMSAuth = async (\n configuration: IntlayerConfig,\n shouldCheckConfigConsistency: boolean = true\n): Promise<boolean> => {\n const appLogger = getAppLogger(configuration);\n\n const hasCMSAuth =\n configuration.editor.clientId && configuration.editor.clientSecret;\n if (!hasCMSAuth) {\n appLogger(\n [\n 'CMS auth not provided. You can either retreive the CMS access key on',\n colorize('https://intlayer.org/dahboard', ANSIColors.GREY),\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize('https://intlayer.org/doc/concept/cms', ANSIColors.GREY),\n colorize(')', ANSIColors.GREY_DARK),\n '.',\n ],\n {\n level: 'error',\n }\n );\n\n return false;\n }\n const intlayerAPI = getIntlayerAPIProxy(undefined, configuration);\n\n try {\n const result = await intlayerAPI.oAuth.getOAuth2AccessToken();\n\n const project = result.data?.project;\n\n if (!project) {\n appLogger('Project not found');\n\n return true;\n }\n\n if (project.configuration && shouldCheckConfigConsistency) {\n try {\n let remoteConfigToCheck = project.configuration;\n\n // Remove server-side computed flags (apiKeyConfigured)\n // We use destructuring + spread to avoid the 'delete' operator (performance)\n if (\n remoteConfigToCheck.ai &&\n 'apiKeyConfigured' in remoteConfigToCheck.ai\n ) {\n const { apiKeyConfigured, ...restAi } = remoteConfigToCheck.ai as any;\n\n remoteConfigToCheck = {\n ...remoteConfigToCheck,\n ai: restAi,\n };\n }\n\n // Recursively check if project.configuration (subset) matches configuration (superset)\n checkConfigConsistency(remoteConfigToCheck, configuration);\n } catch {\n appLogger(\n [\n 'Remote configuration is not up to date. The project configuration does not match the local configuration.',\n 'You can push the configuration by running',\n colorize('npx intlayer configuration push', ANSIColors.CYAN),\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize(\n 'https://intlayer.org/doc/concept/cli/push',\n ANSIColors.GREY\n ),\n colorize(')', ANSIColors.GREY_DARK),\n '.',\n ],\n {\n level: 'warn',\n }\n );\n }\n }\n } catch (error) {\n const message = extractErrorMessage(error);\n\n appLogger(message, {\n level: 'error',\n });\n return false;\n }\n\n return true;\n};\n\nexport const checkAIAccess = async (\n configuration: IntlayerConfig,\n aiOptions?: AIOptions,\n shouldCheckConfigConsistency: boolean = true\n): Promise<boolean> => {\n const appLogger = getAppLogger(configuration);\n\n const hasCMSAuth = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n const isOllama =\n configuration.ai?.provider === 'ollama' || aiOptions?.provider === 'ollama';\n const hasHisOwnAIAPIKey = Boolean(\n configuration.ai?.apiKey || aiOptions?.apiKey\n );\n\n if (hasHisOwnAIAPIKey || isOllama) {\n return true;\n }\n\n // User need to provide either his own AI API key or the CMS auth\n if (!hasCMSAuth) {\n appLogger(\n [\n 'AI options or API key not provided. You can either retreive the CMS access key on',\n colorize('https://intlayer.org/dahboard', ANSIColors.GREY),\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize('https://intlayer.org/doc/concept/cms', ANSIColors.GREY),\n colorize(')', ANSIColors.GREY_DARK),\n '. Alternatively, you can add your own OpenAI API key in the settings',\n colorize('(see doc:', ANSIColors.GREY_DARK),\n colorize(\n 'https://intlayer.org/doc/concept/configuration',\n ANSIColors.GREY\n ),\n colorize(')', ANSIColors.GREY_DARK),\n '.',\n ],\n {\n level: 'error',\n }\n );\n\n return false;\n }\n\n // If the user do not have his own AI API key, we need to check the CMS auth\n return await checkCMSAuth(configuration, shouldCheckConfigConsistency);\n};\n"],"mappings":"wQAOA,MAAa,EAAe,MAC1B,EACA,EAAwC,KACnB,CACrB,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAc,CAI7C,GAAI,EADF,EAAc,OAAO,UAAY,EAAc,OAAO,cAgBtD,OAdA,EACE,CACE,sFACS,gCAAiCA,EAAAA,WAAW,KAAK,gBACjD,YAAaA,EAAAA,WAAW,UAAU,gBAClC,uCAAwCA,EAAAA,WAAW,KAAK,gBACxD,IAAKA,EAAAA,WAAW,UAAU,CACnC,IACD,CACD,CACE,MAAO,QACR,CACF,CAEM,GAET,IAAM,GAAA,EAAA,EAAA,qBAAkC,IAAA,GAAW,EAAc,CAEjE,GAAI,CAGF,IAAM,GAFS,MAAM,EAAY,MAAM,sBAAsB,EAEtC,MAAM,QAE7B,GAAI,CAAC,EAGH,OAFA,EAAU,oBAAoB,CAEvB,GAGT,GAAI,EAAQ,eAAiB,EAC3B,GAAI,CACF,IAAI,EAAsB,EAAQ,cAIlC,GACE,EAAoB,IACpB,qBAAsB,EAAoB,GAC1C,CACA,GAAM,CAAE,mBAAkB,GAAG,GAAW,EAAoB,GAE5D,EAAsB,CACpB,GAAG,EACH,GAAI,EACL,CAIH,EAAA,uBAAuB,EAAqB,EAAc,MACpD,CACN,EACE,CACE,4GACA,2DACS,kCAAmCA,EAAAA,WAAW,KAAK,gBACnD,YAAaA,EAAAA,WAAW,UAAU,gBAEzC,4CACAA,EAAAA,WAAW,KACZ,gBACQ,IAAKA,EAAAA,WAAW,UAAU,CACnC,IACD,CACD,CACE,MAAO,OACR,CACF,QAGE,EAAO,CAMd,OAHA,GAAA,EAAA,EAAA,qBAFoC,EAAM,CAEvB,CACjB,MAAO,QACR,CAAC,CACK,GAGT,MAAO,IAGI,EAAgB,MAC3B,EACA,EACA,EAAwC,KACnB,CACrB,IAAM,GAAA,EAAA,EAAA,cAAyB,EAAc,CAEvC,EAAa,GACjB,EAAc,OAAO,UAAY,EAAc,OAAO,cAElD,EACJ,EAAc,IAAI,WAAa,UAAY,GAAW,WAAa,SAoCrE,OAlCE,EAAc,IAAI,QAAU,GAAW,QAGhB,EAChB,GAIJ,EA0BE,MAAM,EAAa,EAAe,EAA6B,EAzBpE,EACE,CACE,mGACS,gCAAiCA,EAAAA,WAAW,KAAK,gBACjD,YAAaA,EAAAA,WAAW,UAAU,gBAClC,uCAAwCA,EAAAA,WAAW,KAAK,gBACxD,IAAKA,EAAAA,WAAW,UAAU,CACnC,sFACS,YAAaA,EAAAA,WAAW,UAAU,gBAEzC,iDACAA,EAAAA,WAAW,KACZ,gBACQ,IAAKA,EAAAA,WAAW,UAAU,CACnC,IACD,CACD,CACE,MAAO,QACR,CACF,CAEM"}
|
package/dist/cjs/watch.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/chokidar/utils`),t=require(`@intlayer/chokidar/watcher`),n=require(`@intlayer/config/node`),r=require(`@intlayer/config/logger`);const i=async i=>{let a=(0,r.getAppLogger)((0,n.getConfiguration)(i?.configOptions)),o;i?.with&&(o=(0,e.runParallel)(i.with),o.result.catch(()=>{process.exit(1)}))
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);let e=require(`@intlayer/chokidar/utils`),t=require(`@intlayer/chokidar/watcher`),n=require(`@intlayer/config/node`),r=require(`@intlayer/config/logger`);const i=async i=>{let a=(0,r.getAppLogger)((0,n.getConfiguration)(i?.configOptions)),o;i?.with&&(o=(0,e.runParallel)(i.with),o.result.catch(()=>{process.exit(1)}));let s=(0,t.watch)({persistent:!0,skipPrepare:i?.skipPrepare??!1}),c=async()=>{process.off(`SIGINT`,c),process.off(`SIGTERM`,c),a(`Stopping Intlayer watcher...`);try{await s.close(),o&&`child`in o&&o.child?.kill(`SIGTERM`)}catch(e){console.error(`Error during shutdown:`,e)}finally{process.exit(0)}};process.on(`SIGINT`,c),process.on(`SIGTERM`,c)};exports.watchContentDeclaration=i;
|
|
2
2
|
//# sourceMappingURL=watch.cjs.map
|