@intlayer/cli 8.1.3-canary.0 → 8.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cli.cjs +1 -1
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/init.cjs +1 -1
- package/dist/cjs/init.cjs.map +1 -1
- package/dist/cjs/initSkills.cjs +2 -0
- package/dist/cjs/initSkills.cjs.map +1 -0
- package/dist/esm/cli.mjs +1 -1
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/init.mjs +1 -1
- package/dist/esm/init.mjs.map +1 -1
- package/dist/esm/initSkills.mjs +2 -0
- package/dist/esm/initSkills.mjs.map +1 -0
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/init.d.ts +2 -5
- package/dist/types/init.d.ts.map +1 -1
- package/dist/types/initSkills.d.ts +8 -0
- package/dist/types/initSkills.d.ts.map +1 -0
- package/package.json +11 -11
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(`./listContentDeclaration.cjs`),u=require(`./listProjects.cjs`),ee=require(`./liveSync.cjs`),d=require(`./pull.cjs`),f=require(`./push/push.cjs`),te=require(`./pushConfig.cjs`),ne=require(`./reviewDoc/reviewDoc.cjs`),re=require(`./searchDoc.cjs`),ie=require(`./translateDoc/translateDoc.cjs`),p=require(`./utils/getParentPackageJSON.cjs`),m=require(`./watch.cjs`);let h=require(`@intlayer/config/node`),g=require(`node:path`),_=require(`@intlayer/config/logger`),v=require(`node:url`),y=require(`commander`);const b=typeof require(`url`).pathToFileURL(__filename).href==`string`?(0,g.dirname)((0,v.fileURLToPath)(require(`url`).pathToFileURL(__filename).href)):__dirname,x=p.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]),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,h.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=>{let t=T(e,M);if(!Object.values(t).some(Boolean))return;let{gitDiff:n,gitDiffBase:r,gitDiffCurrent:i,uncommitted:a,unpushed:o,untracked:s}=e;return D({mode:[n&&`gitDiff`,a&&`uncommitted`,o&&`unpushed`,s&&`untracked`].filter(Boolean),baseRef:r,currentRef:i,absolute:!0})},P=[`baseDir`,`env`,`envFile`,`verbose`,`prefix`],F=e=>{let t=(0,h.getConfiguration)(e),n=T(e,P);if(!Object.values(n).some(Boolean))return;let{baseDir:r,env:i,envFile:a,verbose:o,prefix:s,noCache:c}=e,l=!!e.with;return typeof s==`string`?(0,_.setPrefix)(s):l&&(0,_.setPrefix)(t.log.prefix),D({baseDir:r,env:i,envFile:a,override:{log:{verbose:o??!0}},cache:!c})},I=()=>{(0,_.setPrefix)(``);let p=new y.Command;p.version(x.version).description(`Intlayer CLI`),p.command(`version`).description(`Print the Intlayer CLI version`).action(()=>{console.log(x.version??`unknown`)});let h=p.command(`login`).description(`Login to Intlayer`).option(`--cms-url [cmsUrl]`,`CMS URL`);O(h),h.action(e=>{let t=F(e)??{override:{log:{prefix:``,verbose:!0}}};return n.login({cmsUrl:e.cmsUrl,configOptions:t})}),p.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=>c.initSkills(e.projectRoot));let g=p.command(`dictionary`).alias(`dictionaries`).alias(`dic`).description(`Dictionaries operations`),v={description:`Build the dictionaries`,options:[[`-w, --watch`,`Watch for changes`],[`--skip-prepare`,`Skip the prepare step`],[`--with [with...]`,`Start command in parallel with the build`]]},b=g.command(`build`).description(v.description);E(b,v.options),O(b),b.action(t=>{e.build({...t,configOptions:F(t)})});let S=p.command(`build`).description(v.description);E(S,v.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=g.command(`watch`).description(v.description);E(w,C.options),O(w),w.action(e=>{m.watchContentDeclaration({...e,configOptions:F(e)})});let T=p.command(`watch`).description(v.description);E(T,C.options),O(T),T.action(e=>{m.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=g.command(`pull`).description(D.description);E(M,D.options),O(M),M.action(e=>{let t=[...e.dictionaries??[],...e.dictionary??[]];d.pull({...e,dictionaries:t.length>0?t:void 0,configOptions:{...e.configOptions,baseDir:e.baseDir}})});let P=p.command(`pull`).description(D.description);E(P,D.options),O(P),P.action(e=>{let t=[...e.dictionaries??[],...e.dictionary??[]];d.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=g.command(`push`).description(I.description);E(L,I.options),O(L),A(L),L.action(e=>{let t=[...e.dictionaries||[],...e.dictionary||[]];return f.push({...e,dictionaries:t.length>0?t:void 0,gitOptions:N(e),configOptions:F(e)})});let R=p.command(`push`).description(I.description);E(R,I.options),O(R),A(R),R.action(e=>{let t=[...e.dictionaries||[],...e.dictionary||[]];return f.push({...e,dictionaries:t.length>0?t:void 0,gitOptions:N(e),configOptions:F(e)})});let z=p.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)})}),p.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=>{u.listProjectsCommand({baseDir:e.baseDir,gitRoot:e.gitRoot,json:e.json})}),p.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=>{u.listProjectsCommand({baseDir:e.baseDir,gitRoot:e.gitRoot,json:e.json,absolute:e.absolute})});let H=p.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=>{l.listContentDeclaration({json:e.json,absolute:e.absolute})}),p.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=>{l.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=p.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=p.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=p.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 ae=[[`--with [with...]`,`Start command in parallel with the live sync`]],Z=p.command(`live`).description(`Live sync - Watch for changes made on the CMS and update the application content accordingly`);E(Z,ae),O(Z),Z.action(e=>ee.liveSync(e));let Q=p.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 $=p.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($),p.parse(process.argv),p.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)}),p};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`),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]),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=>{let t=T(e,M);if(!Object.values(t).some(Boolean))return;let{gitDiff:n,gitDiffBase:r,gitDiffCurrent:i,uncommitted:a,unpushed:o,untracked:s}=e;return D({mode:[n&&`gitDiff`,a&&`uncommitted`,o&&`unpushed`,s&&`untracked`].filter(Boolean),baseRef:r,currentRef:i,absolute:!0})},P=[`baseDir`,`env`,`envFile`,`verbose`,`prefix`],F=e=>{let t=(0,g.getConfiguration)(e),n=T(e,P);if(!Object.values(n).some(Boolean))return;let{baseDir:r,env:i,envFile:a,verbose:o,prefix:s,noCache:c}=e,l=!!e.with;return typeof s==`string`?(0,v.setPrefix)(s):l&&(0,v.setPrefix)(t.log.prefix),D({baseDir:r,env:i,envFile:a,override:{log:{verbose:o??!0}},cache:!c})},I=()=>{(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:``,verbose:!0}}};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`]]},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;
|
|
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 { 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, initSkills } from './init';\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]);\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 = !Object.values(filteredOptions).some(Boolean);\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} & LogOptions;\n\nconst configurationOptionKeys: (keyof ConfigurationOptions)[] = [\n 'baseDir',\n 'env',\n 'envFile',\n 'verbose',\n 'prefix',\n];\n\nconst extractConfigOptions = (\n options: ConfigurationOptions\n): GetConfigurationOptions | undefined => {\n const configuration = getConfiguration(options);\n const filteredOptions = extractKeysFromOptions(\n options,\n configurationOptionKeys\n );\n\n const isOptionEmpty = !Object.values(filteredOptions).some(Boolean);\n\n if (isOptionEmpty) {\n return undefined;\n }\n\n const { baseDir, env, envFile, verbose, prefix, noCache } = options;\n\n const addPrefix: boolean = Boolean((options as any).with); // Hack to add the prefix when the command is run in parallel\n\n if (typeof prefix === 'string') {\n setPrefix(prefix);\n } else if (addPrefix) {\n setPrefix(configuration.log.prefix);\n }\n\n const log = {\n verbose: verbose ?? true,\n };\n\n const override = {\n log,\n };\n\n return removeUndefined({\n baseDir,\n env,\n envFile,\n override,\n cache: !noCache,\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 setPrefix('');\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 verbose: true,\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 ],\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":"y2BAsCA,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,GAA6B,CAKtD,GAAgB,EAAkB,KACtC,EAAQ,SAAS,CAAC,EAAM,KAAiB,CACvC,EAAQ,OAAO,EAAM,EAAY,EACjC,CACK,G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AU9C,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","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 { 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]);\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 = !Object.values(filteredOptions).some(Boolean);\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} & LogOptions;\n\nconst configurationOptionKeys: (keyof ConfigurationOptions)[] = [\n 'baseDir',\n 'env',\n 'envFile',\n 'verbose',\n 'prefix',\n];\n\nconst extractConfigOptions = (\n options: ConfigurationOptions\n): GetConfigurationOptions | undefined => {\n const configuration = getConfiguration(options);\n const filteredOptions = extractKeysFromOptions(\n options,\n configurationOptionKeys\n );\n\n const isOptionEmpty = !Object.values(filteredOptions).some(Boolean);\n\n if (isOptionEmpty) {\n return undefined;\n }\n\n const { baseDir, env, envFile, verbose, prefix, noCache } = options;\n\n const addPrefix: boolean = Boolean((options as any).with); // Hack to add the prefix when the command is run in parallel\n\n if (typeof prefix === 'string') {\n setPrefix(prefix);\n } else if (addPrefix) {\n setPrefix(configuration.log.prefix);\n }\n\n const log = {\n verbose: verbose ?? true,\n };\n\n const override = {\n log,\n };\n\n return removeUndefined({\n baseDir,\n env,\n envFile,\n override,\n cache: !noCache,\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 setPrefix('');\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 verbose: true,\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 ],\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":"w4BAuCA,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,uBAAw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AQ,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/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(`./
|
|
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;
|
package/dist/cjs/init.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./_virtual/_rolldown/runtime.cjs`);let e=require(`node:path`),t=require(`@intlayer/chokidar/cli`),n=require(`node:fs`);const r=t=>{let r=t;for(;r!==(0,e.resolve)(r,`..`);){if((0,n.existsSync)((0,e.join)(r,`package.json`)))return r;r=(0,e.resolve)(r,`..`)}return t},i=async n=>{await(0,t.initIntlayer)(r(n?(0,e.resolve)(n):process.cwd()))};exports.findProjectRoot=r,exports.init=i;
|
|
2
2
|
//# sourceMappingURL=init.cjs.map
|
package/dist/cjs/init.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.cjs","names":["AutoComplete","p","SKILLS","SKILLS_METADATA"],"sources":["../../src/init.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n initIntlayer,\n installSkills,\n type Platform,\n SKILLS,\n SKILLS_METADATA,\n} from '@intlayer/chokidar/cli';\n// @ts-ignore\nimport { AutoComplete } from 'enquirer';\n\nconst findProjectRoot = (startDir: string) => {\n let currentDir = startDir;\n\n while (currentDir !== resolve(currentDir, '..')) {\n if (existsSync(join(currentDir, 'package.json'))) {\n return currentDir;\n }\n currentDir = resolve(currentDir, '..');\n }\n\n // If no package.json is found, return the start directory.\n // The initIntlayer function will handle the missing package.json error.\n return startDir;\n};\n\nexport const init = async (projectRoot?: string) => {\n const root = projectRoot\n ? findProjectRoot(resolve(projectRoot))\n : findProjectRoot(process.cwd());\n\n await initIntlayer(root);\n};\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\nexport const getDetectedPlatform = (): Platform | undefined =>\n PLATFORM_CHECKS.find(({ check }) => check())?.platform;\n\nexport const initSkills = async (projectRoot?: string) => {\n const root = projectRoot\n ? findProjectRoot(resolve(projectRoot))\n : findProjectRoot(process.cwd());\n\n p.intro('Initializing Intlayer skills');\n\n // Detect if running in a specific platform\n const detectedPlatform = getDetectedPlatform();\n\n const PLATFORM_OPTIONS = [\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 ] as { value: Platform; label: string; hint: string }[];\n\n // Confirm or choose platforms\n const prompt = new AutoComplete({\n name: 'platforms',\n message: 'Which platforms are you using?',\n limit: 10,\n initial: detectedPlatform\n ? PLATFORM_OPTIONS.findIndex((p) => p.value === detectedPlatform)\n : undefined,\n multiple: true,\n choices: PLATFORM_OPTIONS.map((p) => ({\n name: p.value,\n message: p.label,\n hint: p.hint,\n })),\n });\n\n let platforms: Platform[];\n try {\n platforms = (await prompt.run()) as Platform[];\n } catch (error) {\n p.cancel('Operation cancelled');\n return;\n }\n\n if (platforms.length === 0) {\n p.log.warn('No platform selected. Nothing to install.');\n return;\n }\n\n // Detect framework skills\n let dependencies: Record<string, string> = {};\n try {\n const packageJsonPath = join(root, 'package.json');\n if (existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n dependencies = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n }\n } catch {\n // Ignore errors reading package.json\n }\n\n const initialValues: (keyof typeof SKILLS_METADATA)[] = [\n 'Usage',\n 'Config',\n 'Content',\n 'RemoteContent',\n ];\n\n if (dependencies.react || dependencies.next) {\n initialValues.push('React');\n }\n if (dependencies.next) {\n initialValues.push('NextJS');\n }\n if (dependencies.preact) {\n initialValues.push('Preact');\n }\n if (dependencies['solid-js']) {\n initialValues.push('Solid');\n }\n if (dependencies.vue || dependencies.nuxt) {\n initialValues.push('Vue');\n }\n if (dependencies.svelte || dependencies['@sveltejs/kit']) {\n initialValues.push('Svelte');\n }\n if (dependencies.astro) {\n initialValues.push('Astro');\n }\n\n // Show list of available skills and allow selecting multiple\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 })) as (keyof typeof SKILLS_METADATA)[];\n\n if (p.isCancel(selectedSkills)) {\n p.cancel('Operation cancelled');\n return;\n }\n\n if (selectedSkills.length === 0) {\n p.log.warn('No skills selected. Nothing to install.');\n return;\n }\n\n // Call installSkills for each platform\n const s = p.spinner();\n s.start('Installing skills...');\n try {\n const results: string[] = [];\n for (const platform of platforms) {\n const result = await installSkills(root, platform, selectedSkills);\n results.push(result);\n }\n s.stop('Skills installed successfully');\n\n // Show success messages\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(String(error));\n }\n\n p.outro('Intlayer skills initialization complete');\n};\n"],"mappings":"gRAaA,MAAM,EAAmB,GAAqB,CAC5C,IAAI,EAAa,EAEjB,KAAO,KAAA,EAAA,EAAA,SAAuB,EAAY,KAAK,EAAE,CAC/C,IAAA,EAAA,EAAA,aAAA,EAAA,EAAA,MAAoB,EAAY,eAAe,CAAC,CAC9C,OAAO,EAET,GAAA,EAAA,EAAA,SAAqB,EAAY,KAAK,CAKxC,OAAO,GAGI,EAAO,KAAO,IAAyB,CAKlD,MAAA,EAAA,EAAA,cAHI,EADS,GACT,EAAA,EAAA,SAAwB,EAAY,CACpB,QAAQ,KAAK,CAAC,CAEV,EAGpB,EAAuE,CAC3E,CACE,UACE,QAAQ,IAAI,SAAW,QAAU,QAAQ,IAAI,eAAiB,SAChE,SAAU,SACX,CACD,CACE,UACE,QAAQ,IAAI,WAAa,QACzB,QAAQ,IAAI,eAAiB,WAC/B,SAAU,WACX,CACD,CACE,UACE,QAAQ,IAAI,OAAS,QAAU,QAAQ,IAAI,eAAiB,OAC9D,SAAU,OACX,CACD,CAAE,UAAa,QAAQ,IAAI,UAAY,OAAQ,SAAU,SAAU,CACnE,CACE,UACE,QAAQ,IAAI,SAAW,QAAU,QAAQ,IAAI,eAAiB,SAChE,SAAU,SACX,CACD,CAAE,UAAa,QAAQ,IAAI,WAAa,OAAQ,SAAU,WAAY,CACtE,CAAE,UAAa,QAAQ,IAAI,SAAW,OAAQ,SAAU,SAAU,CAClE,CACE,UACE,QAAQ,IAAI,iBAAmB,QAAU,CAAC,CAAC,QAAQ,IAAI,iBACzD,SAAU,SACX,CACF,CAEY,MACX,EAAgB,MAAM,CAAE,WAAY,GAAO,CAAC,EAAE,SAEnC,EAAa,KAAO,IAAyB,CACxD,IAAM,EACF,EADS,GACT,EAAA,EAAA,SAAwB,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\nimport { join, resolve } from 'node:path';\nimport { initIntlayer } from '@intlayer/chokidar/cli';\n\nexport const findProjectRoot = (startDir: string) => {\n let currentDir = startDir;\n\n while (currentDir !== resolve(currentDir, '..')) {\n if (existsSync(join(currentDir, 'package.json'))) {\n return currentDir;\n }\n currentDir = resolve(currentDir, '..');\n }\n\n // If no package.json is found, return the start directory.\n // The initIntlayer function will handle the missing package.json error.\n return startDir;\n};\n\nexport const init = async (projectRoot?: string) => {\n const root = projectRoot\n ? findProjectRoot(resolve(projectRoot))\n : findProjectRoot(process.cwd());\n\n await initIntlayer(root);\n};\n"],"mappings":"mMAIA,MAAa,EAAmB,GAAqB,CACnD,IAAI,EAAa,EAEjB,KAAO,KAAA,EAAA,EAAA,SAAuB,EAAY,KAAK,EAAE,CAC/C,IAAA,EAAA,EAAA,aAAA,EAAA,EAAA,MAAoB,EAAY,eAAe,CAAC,CAC9C,OAAO,EAET,GAAA,EAAA,EAAA,SAAqB,EAAY,KAAK,CAKxC,OAAO,GAGI,EAAO,KAAO,IAAyB,CAKlD,MAAA,EAAA,EAAA,cAHI,EADS,GACT,EAAA,EAAA,SAAwB,EAAY,CACpB,QAAQ,KAAK,CAAC,CAEV"}
|
|
@@ -0,0 +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=[{check:()=>process.env.CURSOR===`true`||process.env.TERM_PROGRAM===`cursor`,platform:`Cursor`},{check:()=>process.env.WINDSURF===`true`||process.env.TERM_PROGRAM===`windsurf`,platform:`Windsurf`},{check:()=>process.env.TRAE===`true`||process.env.TERM_PROGRAM===`trae`,platform:`Trae`},{check:()=>process.env.TRAE_CN===`true`,platform:`TraeCN`},{check:()=>process.env.VSCODE===`true`||process.env.TERM_PROGRAM===`vscode`,platform:`VSCode`},{check:()=>process.env.OPENCODE===`true`,platform:`OpenCode`},{check:()=>process.env.CLAUDE===`true`,platform:`Claude`},{check:()=>process.env.GITHUB_ACTIONS===`true`||!!process.env.GITHUB_WORKSPACE,platform:`GitHub`}],c=[{value:`Cursor`,label:`Cursor`,hint:`(.cursor/skills)`},{value:`Windsurf`,label:`Windsurf`,hint:`(.windsurf/skills)`},{value:`Trae`,label:`Trae`,hint:`(.trae/skills)`},{value:`TraeCN`,label:`Trae CN`,hint:`(.trae/skills)`},{value:`VSCode`,label:`VS Code`,hint:`(.github/skills)`},{value:`OpenCode`,label:`OpenCode`,hint:`(.opencode/skills)`},{value:`Claude`,label:`Claude Code`,hint:`(.claude/skills)`},{value:`GitHub`,label:`GitHub Copilot Workspace`,hint:`(.github/skills)`},{value:`Antigravity`,label:`Antigravity`,hint:`(.agent/skills)`},{value:`Augment`,label:`Augment`,hint:`(.augment/skills)`},{value:`OpenClaw`,label:`OpenClaw`,hint:`(skills)`},{value:`Cline`,label:`Cline`,hint:`(.cline/skills)`},{value:`CodeBuddy`,label:`CodeBuddy`,hint:`(.codebuddy/skills)`},{value:`CommandCode`,label:`Command Code`,hint:`(.commandcode/skills)`},{value:`Continue`,label:`Continue`,hint:`(.continue/skills)`},{value:`Crush`,label:`Crush`,hint:`(.crush/skills)`},{value:`Droid`,label:`Droid`,hint:`(.factory/skills)`},{value:`Goose`,label:`Goose`,hint:`(.goose/skills)`},{value:`IFlow`,label:`iFlow CLI`,hint:`(.iflow/skills)`},{value:`Junie`,label:`Junie`,hint:`(.junie/skills)`},{value:`KiloCode`,label:`Kilo Code`,hint:`(.kilocode/skills)`},{value:`Kiro`,label:`Kiro CLI`,hint:`(.kiro/skills)`},{value:`Kode`,label:`Kode`,hint:`(.kode/skills)`},{value:`MCPJam`,label:`MCPJam`,hint:`(.mcpjam/skills)`},{value:`MistralVibe`,label:`Mistral Vibe`,hint:`(.vibe/skills)`},{value:`Mux`,label:`Mux`,hint:`(.mux/skills)`},{value:`OpenHands`,label:`OpenHands`,hint:`(.openhands/skills)`},{value:`Pi`,label:`Pi`,hint:`(.pi/skills)`},{value:`Qoder`,label:`Qoder`,hint:`(.qoder/skills)`},{value:`Qwen`,label:`Qwen Code`,hint:`(.qwen/skills)`},{value:`RooCode`,label:`Roo Code`,hint:`(.roo/skills)`},{value:`Zencoder`,label:`Zencoder`,hint:`(.zencoder/skills)`},{value:`Neovate`,label:`Neovate`,hint:`(.neovate/skills)`},{value:`Pochi`,label:`Pochi`,hint:`(.pochi/skills)`},{value:`Other`,label:`Other`,hint:`(skills)`}],l=()=>s.find(({check:e})=>e())?.platform;function 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{}}}function d(e){let t=[`Usage`,`Config`,`Content`,`RemoteContent`];return(e.react||e.next)&&t.push(`React`),e.next&&t.push(`NextJS`),e.preact&&t.push(`Preact`),e[`solid-js`]&&t.push(`Solid`),(e.vue||e.nuxt)&&t.push(`Vue`),(e.svelte||e[`@sveltejs/kit`])&&t.push(`Svelte`),e.astro&&t.push(`Astro`),t}const f=async e=>{let i=t.findProjectRoot(e?(0,n.resolve)(e):process.cwd());a.intro(`Initializing Intlayer skills`);let s=l(),f;try{f=(await o.default.prompt({type:`autocomplete`,name:`platforms`,message:`Which platforms are you using? (Type to search)`,multiple:!0,initial:s?c.findIndex(e=>e.value===s):void 0,choices:c.map(e=>({name:e.value,message:e.label,hint:e.hint}))})).platforms}catch{a.cancel(`Operation cancelled.`);return}if(!f||f.length===0){a.log.warn(`No platform selected. Nothing to install.`);return}let p=d(u(i)),m=await a.multiselect({message:`Select the documentation skills to provide to your AI:`,initialValues:p,options:r.SKILLS.map(e=>({value:e,label:e,hint:r.SKILLS_METADATA[e]})),required:!1});if(a.isCancel(m)||!m||m.length===0){a.cancel(`Operation cancelled. No skills selected.`);return}let h=a.spinner();h.start(`Installing skills...`);try{let e=f.map(e=>(0,r.installSkills)(i,e,m)),t=await Promise.all(e);h.stop(`Skills installed successfully`);for(let e of t)a.note(e,`Success`)}catch(e){h.stop(`Failed to install skills`),a.log.error(e instanceof Error?e.message:String(e))}a.outro(`Intlayer skills initialization complete`)};exports.getDetectedPlatform=l,exports.initSkills=f;
|
|
2
|
+
//# sourceMappingURL=initSkills.cjs.map
|
|
@@ -0,0 +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 ];\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,SAAW,QAAU,QAAQ,IAAI,eAAiB,SAChE,SAAU,SACX,CACD,CACE,UACE,QAAQ,IAAI,WAAa,QACzB,QAAQ,IAAI,eAAiB,WAC/B,SAAU,WACX,CACD,CACE,UACE,QAAQ,IAAI,OAAS,QAAU,QAAQ,IAAI,eAAiB,OAC9D,SAAU,OACX,CACD,CAAE,UAAa,QAAQ,IAAI,UAAY,OAAQ,SAAU,SAAU,CACnE,CACE,UACE,QAAQ,IAAI,SAAW,QAAU,QAAQ,IAAI,eAAiB,SAChE,SAAU,SACX,CACD,CAAE,UAAa,QAAQ,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AAM,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"}
|
package/dist/esm/cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{build as e}from"./build.mjs";import{runCI as t}from"./ci.mjs";import{login as n}from"./auth/login.mjs";import{getConfig as r}from"./config.mjs";import{startEditor as i}from"./editor.mjs";import{extract as a}from"./extract.mjs";import{testMissingTranslations as o}from"./test/test.mjs";import{fill as s}from"./fill/fill.mjs";import{init as c,initSkills as l}from"./init.mjs";import{listContentDeclaration as u}from"./listContentDeclaration.mjs";import{listProjectsCommand as d}from"./listProjects.mjs";import{liveSync as ee}from"./liveSync.mjs";import{pull as f}from"./pull.mjs";import{push as p}from"./push/push.mjs";import{pushConfig as te}from"./pushConfig.mjs";import{reviewDoc as ne}from"./reviewDoc/reviewDoc.mjs";import{searchDoc as re}from"./searchDoc.mjs";import{translateDoc as ie}from"./translateDoc/translateDoc.mjs";import{getParentPackageJSON as m}from"./utils/getParentPackageJSON.mjs";import{watchContentDeclaration as h}from"./watch.mjs";import{getConfiguration as g}from"@intlayer/config/node";import{dirname as _}from"node:path";import{setPrefix as v}from"@intlayer/config/logger";import{fileURLToPath as y}from"node:url";import{Command as ae}from"commander";const b=typeof import.meta.url==`string`?_(y(import.meta.url)):__dirname,x=m(b),S=[[`--env-file [envFile]`,`Environment file`],[`-e, --env [env]`,`Environment`],[`--base-dir [baseDir]`,`Base directory`],[`--no-cache [noCache]`,`No cache`],...[[`--verbose`,`Verbose (default to true using CLI)`],[`--prefix [prefix]`,`Prefix`]]],C=[[`--provider [provider]`,`Provider`],[`--temperature [temperature]`,`Temperature`],[`--model [model]`,`Model`],[`--api-key [apiKey]`,`Provider API key`],[`--custom-prompt [prompt]`,`Custom prompt`],[`--application-context [applicationContext]`,`Application context`],[`--data-serialization [dataSerialization]`,`Data serialization`]],w=[[`--git-diff [gitDiff]`,`Git diff mode - Check git diff between two refs`],[`--git-diff-base [gitDiffBase]`,`Git diff base ref`],[`--git-diff-current [gitDiffCurrent]`,`Git diff current ref`],[`--uncommitted [uncommitted]`,`Uncommitted`],[`--unpushed [unpushed]`,`Unpushed`],[`--untracked [untracked]`,`Untracked`]],T=(e,t)=>t.filter(t=>e[t]),E=(e,t)=>(t.forEach(([t,n])=>{e.option(t,n)}),e),D=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!==void 0)),O=e=>E(e,S),k=e=>E(e,C),A=e=>E(e,w),j=e=>{let{apiKey:t,provider:n,model:r,temperature:i,applicationContext:a,customPrompt:o,dataSerialization:s}=e,c=g(),{ai:l}=c;return D({...l,apiKey:t??c.ai?.apiKey,provider:n??c.ai?.provider,model:r??c.ai?.model,temperature:i??c.ai?.temperature,applicationContext:a??c.ai?.applicationContext,customPrompt:o??c.ai?.customPrompt,dataSerialization:s??c.ai?.dataSerialization})},M=[`gitDiff`,`gitDiffBase`,`gitDiffCurrent`,`uncommitted`,`unpushed`,`untracked`],N=e=>{let t=T(e,M);if(!Object.values(t).some(Boolean))return;let{gitDiff:n,gitDiffBase:r,gitDiffCurrent:i,uncommitted:a,unpushed:o,untracked:s}=e;return D({mode:[n&&`gitDiff`,a&&`uncommitted`,o&&`unpushed`,s&&`untracked`].filter(Boolean),baseRef:r,currentRef:i,absolute:!0})},P=[`baseDir`,`env`,`envFile`,`verbose`,`prefix`],F=e=>{let t=g(e),n=T(e,P);if(!Object.values(n).some(Boolean))return;let{baseDir:r,env:i,envFile:a,verbose:o,prefix:s,noCache:c}=e,l=!!e.with;return typeof s==`string`?v(s):l&&v(t.log.prefix),D({baseDir:r,env:i,envFile:a,override:{log:{verbose:o??!0}},cache:!c})},I=()=>{v(``);let m=new ae;m.version(x.version).description(`Intlayer CLI`),m.command(`version`).description(`Print the Intlayer CLI version`).action(()=>{console.log(x.version??`unknown`)});let g=m.command(`login`).description(`Login to Intlayer`).option(`--cms-url [cmsUrl]`,`CMS URL`);O(g),g.action(e=>{let t=F(e)??{override:{log:{prefix:``,verbose:!0}}};return n({cmsUrl:e.cmsUrl,configOptions:t})}),m.command(`init`).description(`Initialize Intlayer in the project`).option(`--project-root [projectRoot]`,`Project root directory`).action(e=>c(e.projectRoot)).command(`skills`).description(`Initialize Intlayer skills in the project`).option(`--project-root [projectRoot]`,`Project root directory`).action(e=>l(e.projectRoot));let _=m.command(`dictionary`).alias(`dictionaries`).alias(`dic`).description(`Dictionaries operations`),y={description:`Build the dictionaries`,options:[[`-w, --watch`,`Watch for changes`],[`--skip-prepare`,`Skip the prepare step`],[`--with [with...]`,`Start command in parallel with the build`]]},b=_.command(`build`).description(y.description);E(b,y.options),O(b),b.action(t=>{e({...t,configOptions:F(t)})});let S=m.command(`build`).description(y.description);E(S,y.options),O(S),S.action(t=>{e({...t,configOptions:F(t)})});let C={description:`Watch the dictionaries changes`,options:[[`--with [with...]`,`Start command in parallel with the build`]]},w=_.command(`watch`).description(y.description);E(w,C.options),O(w),w.action(e=>{h({...e,configOptions:F(e)})});let T=m.command(`watch`).description(y.description);E(T,C.options),O(T),T.action(e=>{h({...e,configOptions:F(e)})});let D={description:`Pull dictionaries from the server`,options:[[`-d, --dictionaries [ids...]`,`List of dictionary IDs to pull`],[`--dictionary [ids...]`,`List of dictionary IDs to pull (alias for --dictionaries)`],[`--new-dictionaries-path [path]`,`Path to save the new dictionaries`],[`--newDictionariesPath [path]`,`[alias] Path to save the new dictionaries`]]},M=_.command(`pull`).description(D.description);E(M,D.options),O(M),M.action(e=>{let t=[...e.dictionaries??[],...e.dictionary??[]];f({...e,dictionaries:t.length>0?t:void 0,configOptions:{...e.configOptions,baseDir:e.baseDir}})});let P=m.command(`pull`).description(D.description);E(P,D.options),O(P),P.action(e=>{let t=[...e.dictionaries??[],...e.dictionary??[]];f({...e,dictionaries:t.length>0?t:void 0,configOptions:F(e)})});let I={description:`Push all dictionaries. Create or update the pushed dictionaries`,options:[[`-d, --dictionaries [ids...]`,`List of dictionary IDs to push`],[`--dictionary [ids...]`,`List of dictionary IDs to push (alias for --dictionaries)`],[`-r, --delete-locale-dictionary`,`Delete the local dictionaries after pushing`],[`-k, --keep-locale-dictionary`,`Keep the local dictionaries after pushing`],[`--deleteLocaleDictionary`,`[alias] Delete the local dictionaries after pushing`],[`--keepLocaleDictionary`,`[alias] Keep the local dictionaries after pushing`],[`--build [build]`,`Build the dictionaries before pushing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build`]]},L=_.command(`push`).description(I.description);E(L,I.options),O(L),A(L),L.action(e=>{let t=[...e.dictionaries||[],...e.dictionary||[]];return p({...e,dictionaries:t.length>0?t:void 0,gitOptions:N(e),configOptions:F(e)})});let R=m.command(`push`).description(I.description);E(R,I.options),O(R),A(R),R.action(e=>{let t=[...e.dictionaries||[],...e.dictionary||[]];return p({...e,dictionaries:t.length>0?t:void 0,gitOptions:N(e),configOptions:F(e)})});let z=m.command(`configuration`).alias(`config`).alias(`conf`).description(`Configuration operations`),B=z.command(`get`).description(`Get the configuration`);O(B),B.action(e=>{r({...e,configOptions:F(e)})});let V=z.command(`push`).description(`Push the configuration`);O(V),V.action(e=>{te({...e,configOptions:F(e)})}),m.command(`projects`).alias(`project`).description(`List Intlayer projects`).command(`list`).description(`List all Intlayer projects in the directory`).option(`--base-dir [baseDir]`,`Base directory to search from`).option(`--git-root`,`Search from the git root directory instead of the base directory`).option(`--json`,`Output the results as JSON`).action(e=>{d({baseDir:e.baseDir,gitRoot:e.gitRoot,json:e.json})}),m.command(`projects-list`).alias(`pl`).description(`List all Intlayer projects in the directory`).option(`--base-dir [baseDir]`,`Base directory to search from`).option(`--git-root`,`Search from the git root directory instead of the base directory`).option(`--absolute`,`Output the results as absolute paths`).option(`--json`,`Output the results as JSON`).action(e=>{d({baseDir:e.baseDir,gitRoot:e.gitRoot,json:e.json,absolute:e.absolute})});let H=m.command(`content`).description(`Content declaration operations`);H.command(`list`).description(`List the content declaration files`).option(`--json`,`Output the results as JSON`).option(`--absolute`,`Output the results as absolute paths`).action(e=>{u({json:e.json,absolute:e.absolute})}),m.command(`list`).description(`List the content declaration files`).option(`--json`,`Output the results as JSON`).option(`--absolute`,`Output the results as absolute paths`).action(e=>{u({json:e.json,absolute:e.absolute})});let U=H.command(`test`).description(`Test if there are missing translations`).option(`--build [build]`,`Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build`);O(U),U.action(e=>{o({...e,configOptions:F(e)})});let W=m.command(`test`).description(`Test if there are missing translations`).option(`--build [build]`,`Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build`);O(W),W.action(e=>{o({...e,configOptions:F(e)})});let G=m.command(`fill`).description(`Fill the dictionaries`).option(`-f, --file [files...]`,`List of Dictionary files to fill`).option(`--source-locale [sourceLocale]`,`Source locale to translate from`).option(`--output-locales [outputLocales...]`,`Target locales to translate to`).option(`--mode [mode]`,`Fill mode: complete, review. Complete will fill all missing content, review will fill missing content and review existing keys`,`complete`).option(`-k, --keys [keys...]`,`Filter dictionaries based on keys`).option(`--key [keys...]`,`Filter dictionaries based on keys (alias for --keys)`).option(`--excluded-keys [excludedKeys...]`,`Filter out dictionaries based on keys`).option(`--excluded-key [excludedKeys...]`,`Filter out dictionaries based on keys (alias for --excluded-keys)`).option(`--path-filter [pathFilters...]`,`Filter dictionaries based on glob pattern`).option(`--build [build]`,`Build the dictionaries before filling to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build`).option(`--skip-metadata`,`Skip filling missing metadata (description, title, tags) for dictionaries`);O(G),k(G),A(G),G.action(e=>{let t=[...e.keys??[],...e.key??[]],n=[...e.excludedKeys??[],...e.excludedKey??[]],r=[...e.dictionaries??[],...e.dictionary??[]];return s({...e,keys:t.length>0?t:void 0,excludedKeys:n.length>0?n:void 0,dictionaries:r.length>0?r:void 0,aiOptions:j(e),gitOptions:N(e),configOptions:F(e)})});let K=[[`--doc-pattern [docPattern...]`,`Documentation pattern`],[`--excluded-glob-pattern [excludedGlobPattern...]`,`Excluded glob pattern`],[`--nb-simultaneous-file-processed [nbSimultaneousFileProcessed]`,`Number of simultaneous file processed`],[`--locales [locales...]`,`Locales`],[`--base-locale [baseLocale]`,`Base locale`],[`--custom-instructions [customInstructions]`,`Custom instructions added to the prompt. Usefull to apply specific rules regarding formatting, urls translation, etc.`],[`--skip-if-modified-before [skipIfModifiedBefore]`,'Skip the file if it has been modified before the given time. Can be an absolute time as "2025-12-05" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.'],[`--skip-if-modified-after [skipIfModifiedAfter]`,'Skip the file if it has been modified within the given time. Can be an absolute time as "2025-12-05" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.'],[`--skip-if-exists`,`Skip the file if it already exists`]],q=m.command(`doc`).description(`Documentation operations`),J=q.command(`translate`).description(`Translate the documentation`);O(J),k(J),A(J),E(J,K),J.action(e=>ie({docPattern:e.docPattern,excludedGlobPattern:e.excludedGlobPattern,locales:e.locales,baseLocale:e.baseLocale,aiOptions:j(e),gitOptions:N(e),nbSimultaneousFileProcessed:e.nbSimultaneousFileProcessed,configOptions:F(e),customInstructions:e.customInstructions,skipIfModifiedBefore:e.skipIfModifiedBefore,skipIfModifiedAfter:e.skipIfModifiedAfter,skipIfExists:e.skipIfExists}));let Y=q.command(`review`).description(`Review the documentation`);O(Y),k(Y),A(Y),E(Y,K),Y.action(e=>ne({docPattern:e.docPattern,excludedGlobPattern:e.excludedGlobPattern,locales:e.locales,baseLocale:e.baseLocale,aiOptions:j(e),gitOptions:N(e),nbSimultaneousFileProcessed:e.nbSimultaneousFileProcessed,configOptions:F(e),customInstructions:e.customInstructions,skipIfModifiedBefore:e.skipIfModifiedBefore,skipIfModifiedAfter:e.skipIfModifiedAfter,skipIfExists:e.skipIfExists}));let X=q.command(`search`).description(`Search the documentation`).argument(`<query>`,`Search query`).option(`--limit [limit]`,`Limit the number of results`,`10`);O(X),X.action((e,t)=>re({query:e,limit:t.limit?parseInt(t.limit,10):10,configOptions:F(t)}));let oe=[[`--with [with...]`,`Start command in parallel with the live sync`]],Z=m.command(`live`).description(`Live sync - Watch for changes made on the CMS and update the application content accordingly`);E(Z,oe),O(Z),Z.action(e=>ee(e));let Q=m.command(`editor`).description(`Visual editor operations`).command(`start`).description(`Start the Intlayer visual editor`);O(Q),Q.action(e=>{i({env:e.env,envFile:e.envFile})});let $=m.command(`extract`).alias(`ext`).description(`Extract strings from components to be placed in a .content file close to the component`);return $.option(`-f, --file [files...]`,`List of files to extract`).option(`-o, --output-content-declarations [outputContentDeclarations]`,`Path to output content declaration files`).option(`--code-only`,`Only extract the component code`,!1).option(`--declaration-only`,`Only generate content declaration`,!1).action(e=>{a({files:e.file,outputContentDeclarations:e.outputContentDeclarations,configOptions:F(e),codeOnly:e.codeOnly,declarationOnly:e.declarationOnly})}),O($),m.parse(process.argv),m.command(`ci`).description(`Run Intlayer commands with auto-injected credentials from INTLAYER_PROJECT_CREDENTIALS. Detects current project or iterates over all projects.`).argument(`<command...>`,`The intlayer command to execute (e.g., "fill", "push")`).allowUnknownOption().action(e=>{t(e)}),m};export{b as dirname,I as setAPI};
|
|
1
|
+
import{build as e}from"./build.mjs";import{runCI as t}from"./ci.mjs";import{login as n}from"./auth/login.mjs";import{getConfig as r}from"./config.mjs";import{startEditor as i}from"./editor.mjs";import{extract as a}from"./extract.mjs";import{testMissingTranslations as o}from"./test/test.mjs";import{fill as s}from"./fill/fill.mjs";import{init as c}from"./init.mjs";import{initSkills as l}from"./initSkills.mjs";import{listContentDeclaration as u}from"./listContentDeclaration.mjs";import{listProjectsCommand as d}from"./listProjects.mjs";import{liveSync as ee}from"./liveSync.mjs";import{pull as f}from"./pull.mjs";import{push as p}from"./push/push.mjs";import{pushConfig as te}from"./pushConfig.mjs";import{reviewDoc as ne}from"./reviewDoc/reviewDoc.mjs";import{searchDoc as re}from"./searchDoc.mjs";import{translateDoc as ie}from"./translateDoc/translateDoc.mjs";import{getParentPackageJSON as m}from"./utils/getParentPackageJSON.mjs";import{watchContentDeclaration as h}from"./watch.mjs";import{getConfiguration as g}from"@intlayer/config/node";import{dirname as _}from"node:path";import{setPrefix as v}from"@intlayer/config/logger";import{fileURLToPath as y}from"node:url";import{Command as ae}from"commander";const b=typeof import.meta.url==`string`?_(y(import.meta.url)):__dirname,x=m(b),S=[[`--env-file [envFile]`,`Environment file`],[`-e, --env [env]`,`Environment`],[`--base-dir [baseDir]`,`Base directory`],[`--no-cache [noCache]`,`No cache`],...[[`--verbose`,`Verbose (default to true using CLI)`],[`--prefix [prefix]`,`Prefix`]]],C=[[`--provider [provider]`,`Provider`],[`--temperature [temperature]`,`Temperature`],[`--model [model]`,`Model`],[`--api-key [apiKey]`,`Provider API key`],[`--custom-prompt [prompt]`,`Custom prompt`],[`--application-context [applicationContext]`,`Application context`],[`--data-serialization [dataSerialization]`,`Data serialization`]],w=[[`--git-diff [gitDiff]`,`Git diff mode - Check git diff between two refs`],[`--git-diff-base [gitDiffBase]`,`Git diff base ref`],[`--git-diff-current [gitDiffCurrent]`,`Git diff current ref`],[`--uncommitted [uncommitted]`,`Uncommitted`],[`--unpushed [unpushed]`,`Unpushed`],[`--untracked [untracked]`,`Untracked`]],T=(e,t)=>t.filter(t=>e[t]),E=(e,t)=>(t.forEach(([t,n])=>{e.option(t,n)}),e),D=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>t!==void 0)),O=e=>E(e,S),k=e=>E(e,C),A=e=>E(e,w),j=e=>{let{apiKey:t,provider:n,model:r,temperature:i,applicationContext:a,customPrompt:o,dataSerialization:s}=e,c=g(),{ai:l}=c;return D({...l,apiKey:t??c.ai?.apiKey,provider:n??c.ai?.provider,model:r??c.ai?.model,temperature:i??c.ai?.temperature,applicationContext:a??c.ai?.applicationContext,customPrompt:o??c.ai?.customPrompt,dataSerialization:s??c.ai?.dataSerialization})},M=[`gitDiff`,`gitDiffBase`,`gitDiffCurrent`,`uncommitted`,`unpushed`,`untracked`],N=e=>{let t=T(e,M);if(!Object.values(t).some(Boolean))return;let{gitDiff:n,gitDiffBase:r,gitDiffCurrent:i,uncommitted:a,unpushed:o,untracked:s}=e;return D({mode:[n&&`gitDiff`,a&&`uncommitted`,o&&`unpushed`,s&&`untracked`].filter(Boolean),baseRef:r,currentRef:i,absolute:!0})},P=[`baseDir`,`env`,`envFile`,`verbose`,`prefix`],F=e=>{let t=g(e),n=T(e,P);if(!Object.values(n).some(Boolean))return;let{baseDir:r,env:i,envFile:a,verbose:o,prefix:s,noCache:c}=e,l=!!e.with;return typeof s==`string`?v(s):l&&v(t.log.prefix),D({baseDir:r,env:i,envFile:a,override:{log:{verbose:o??!0}},cache:!c})},I=()=>{v(``);let m=new ae;m.version(x.version).description(`Intlayer CLI`),m.command(`version`).description(`Print the Intlayer CLI version`).action(()=>{console.log(x.version??`unknown`)});let g=m.command(`login`).description(`Login to Intlayer`).option(`--cms-url [cmsUrl]`,`CMS URL`);O(g),g.action(e=>{let t=F(e)??{override:{log:{prefix:``,verbose:!0}}};return n({cmsUrl:e.cmsUrl,configOptions:t})}),m.command(`init`).description(`Initialize Intlayer in the project`).option(`--project-root [projectRoot]`,`Project root directory`).action(e=>c(e.projectRoot)).command(`skills`).description(`Initialize Intlayer skills in the project`).option(`--project-root [projectRoot]`,`Project root directory`).action(e=>l(e.projectRoot));let _=m.command(`dictionary`).alias(`dictionaries`).alias(`dic`).description(`Dictionaries operations`),y={description:`Build the dictionaries`,options:[[`-w, --watch`,`Watch for changes`],[`--skip-prepare`,`Skip the prepare step`],[`--with [with...]`,`Start command in parallel with the build`]]},b=_.command(`build`).description(y.description);E(b,y.options),O(b),b.action(t=>{e({...t,configOptions:F(t)})});let S=m.command(`build`).description(y.description);E(S,y.options),O(S),S.action(t=>{e({...t,configOptions:F(t)})});let C={description:`Watch the dictionaries changes`,options:[[`--with [with...]`,`Start command in parallel with the build`]]},w=_.command(`watch`).description(y.description);E(w,C.options),O(w),w.action(e=>{h({...e,configOptions:F(e)})});let T=m.command(`watch`).description(y.description);E(T,C.options),O(T),T.action(e=>{h({...e,configOptions:F(e)})});let D={description:`Pull dictionaries from the server`,options:[[`-d, --dictionaries [ids...]`,`List of dictionary IDs to pull`],[`--dictionary [ids...]`,`List of dictionary IDs to pull (alias for --dictionaries)`],[`--new-dictionaries-path [path]`,`Path to save the new dictionaries`],[`--newDictionariesPath [path]`,`[alias] Path to save the new dictionaries`]]},M=_.command(`pull`).description(D.description);E(M,D.options),O(M),M.action(e=>{let t=[...e.dictionaries??[],...e.dictionary??[]];f({...e,dictionaries:t.length>0?t:void 0,configOptions:{...e.configOptions,baseDir:e.baseDir}})});let P=m.command(`pull`).description(D.description);E(P,D.options),O(P),P.action(e=>{let t=[...e.dictionaries??[],...e.dictionary??[]];f({...e,dictionaries:t.length>0?t:void 0,configOptions:F(e)})});let I={description:`Push all dictionaries. Create or update the pushed dictionaries`,options:[[`-d, --dictionaries [ids...]`,`List of dictionary IDs to push`],[`--dictionary [ids...]`,`List of dictionary IDs to push (alias for --dictionaries)`],[`-r, --delete-locale-dictionary`,`Delete the local dictionaries after pushing`],[`-k, --keep-locale-dictionary`,`Keep the local dictionaries after pushing`],[`--deleteLocaleDictionary`,`[alias] Delete the local dictionaries after pushing`],[`--keepLocaleDictionary`,`[alias] Keep the local dictionaries after pushing`],[`--build [build]`,`Build the dictionaries before pushing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build`]]},L=_.command(`push`).description(I.description);E(L,I.options),O(L),A(L),L.action(e=>{let t=[...e.dictionaries||[],...e.dictionary||[]];return p({...e,dictionaries:t.length>0?t:void 0,gitOptions:N(e),configOptions:F(e)})});let R=m.command(`push`).description(I.description);E(R,I.options),O(R),A(R),R.action(e=>{let t=[...e.dictionaries||[],...e.dictionary||[]];return p({...e,dictionaries:t.length>0?t:void 0,gitOptions:N(e),configOptions:F(e)})});let z=m.command(`configuration`).alias(`config`).alias(`conf`).description(`Configuration operations`),B=z.command(`get`).description(`Get the configuration`);O(B),B.action(e=>{r({...e,configOptions:F(e)})});let V=z.command(`push`).description(`Push the configuration`);O(V),V.action(e=>{te({...e,configOptions:F(e)})}),m.command(`projects`).alias(`project`).description(`List Intlayer projects`).command(`list`).description(`List all Intlayer projects in the directory`).option(`--base-dir [baseDir]`,`Base directory to search from`).option(`--git-root`,`Search from the git root directory instead of the base directory`).option(`--json`,`Output the results as JSON`).action(e=>{d({baseDir:e.baseDir,gitRoot:e.gitRoot,json:e.json})}),m.command(`projects-list`).alias(`pl`).description(`List all Intlayer projects in the directory`).option(`--base-dir [baseDir]`,`Base directory to search from`).option(`--git-root`,`Search from the git root directory instead of the base directory`).option(`--absolute`,`Output the results as absolute paths`).option(`--json`,`Output the results as JSON`).action(e=>{d({baseDir:e.baseDir,gitRoot:e.gitRoot,json:e.json,absolute:e.absolute})});let H=m.command(`content`).description(`Content declaration operations`);H.command(`list`).description(`List the content declaration files`).option(`--json`,`Output the results as JSON`).option(`--absolute`,`Output the results as absolute paths`).action(e=>{u({json:e.json,absolute:e.absolute})}),m.command(`list`).description(`List the content declaration files`).option(`--json`,`Output the results as JSON`).option(`--absolute`,`Output the results as absolute paths`).action(e=>{u({json:e.json,absolute:e.absolute})});let U=H.command(`test`).description(`Test if there are missing translations`).option(`--build [build]`,`Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build`);O(U),U.action(e=>{o({...e,configOptions:F(e)})});let W=m.command(`test`).description(`Test if there are missing translations`).option(`--build [build]`,`Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build`);O(W),W.action(e=>{o({...e,configOptions:F(e)})});let G=m.command(`fill`).description(`Fill the dictionaries`).option(`-f, --file [files...]`,`List of Dictionary files to fill`).option(`--source-locale [sourceLocale]`,`Source locale to translate from`).option(`--output-locales [outputLocales...]`,`Target locales to translate to`).option(`--mode [mode]`,`Fill mode: complete, review. Complete will fill all missing content, review will fill missing content and review existing keys`,`complete`).option(`-k, --keys [keys...]`,`Filter dictionaries based on keys`).option(`--key [keys...]`,`Filter dictionaries based on keys (alias for --keys)`).option(`--excluded-keys [excludedKeys...]`,`Filter out dictionaries based on keys`).option(`--excluded-key [excludedKeys...]`,`Filter out dictionaries based on keys (alias for --excluded-keys)`).option(`--path-filter [pathFilters...]`,`Filter dictionaries based on glob pattern`).option(`--build [build]`,`Build the dictionaries before filling to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build`).option(`--skip-metadata`,`Skip filling missing metadata (description, title, tags) for dictionaries`);O(G),k(G),A(G),G.action(e=>{let t=[...e.keys??[],...e.key??[]],n=[...e.excludedKeys??[],...e.excludedKey??[]],r=[...e.dictionaries??[],...e.dictionary??[]];return s({...e,keys:t.length>0?t:void 0,excludedKeys:n.length>0?n:void 0,dictionaries:r.length>0?r:void 0,aiOptions:j(e),gitOptions:N(e),configOptions:F(e)})});let K=[[`--doc-pattern [docPattern...]`,`Documentation pattern`],[`--excluded-glob-pattern [excludedGlobPattern...]`,`Excluded glob pattern`],[`--nb-simultaneous-file-processed [nbSimultaneousFileProcessed]`,`Number of simultaneous file processed`],[`--locales [locales...]`,`Locales`],[`--base-locale [baseLocale]`,`Base locale`],[`--custom-instructions [customInstructions]`,`Custom instructions added to the prompt. Usefull to apply specific rules regarding formatting, urls translation, etc.`],[`--skip-if-modified-before [skipIfModifiedBefore]`,'Skip the file if it has been modified before the given time. Can be an absolute time as "2025-12-05" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.'],[`--skip-if-modified-after [skipIfModifiedAfter]`,'Skip the file if it has been modified within the given time. Can be an absolute time as "2025-12-05" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.'],[`--skip-if-exists`,`Skip the file if it already exists`]],q=m.command(`doc`).description(`Documentation operations`),J=q.command(`translate`).description(`Translate the documentation`);O(J),k(J),A(J),E(J,K),J.action(e=>ie({docPattern:e.docPattern,excludedGlobPattern:e.excludedGlobPattern,locales:e.locales,baseLocale:e.baseLocale,aiOptions:j(e),gitOptions:N(e),nbSimultaneousFileProcessed:e.nbSimultaneousFileProcessed,configOptions:F(e),customInstructions:e.customInstructions,skipIfModifiedBefore:e.skipIfModifiedBefore,skipIfModifiedAfter:e.skipIfModifiedAfter,skipIfExists:e.skipIfExists}));let Y=q.command(`review`).description(`Review the documentation`);O(Y),k(Y),A(Y),E(Y,K),Y.action(e=>ne({docPattern:e.docPattern,excludedGlobPattern:e.excludedGlobPattern,locales:e.locales,baseLocale:e.baseLocale,aiOptions:j(e),gitOptions:N(e),nbSimultaneousFileProcessed:e.nbSimultaneousFileProcessed,configOptions:F(e),customInstructions:e.customInstructions,skipIfModifiedBefore:e.skipIfModifiedBefore,skipIfModifiedAfter:e.skipIfModifiedAfter,skipIfExists:e.skipIfExists}));let X=q.command(`search`).description(`Search the documentation`).argument(`<query>`,`Search query`).option(`--limit [limit]`,`Limit the number of results`,`10`);O(X),X.action((e,t)=>re({query:e,limit:t.limit?parseInt(t.limit,10):10,configOptions:F(t)}));let oe=[[`--with [with...]`,`Start command in parallel with the live sync`]],Z=m.command(`live`).description(`Live sync - Watch for changes made on the CMS and update the application content accordingly`);E(Z,oe),O(Z),Z.action(e=>ee(e));let Q=m.command(`editor`).description(`Visual editor operations`).command(`start`).description(`Start the Intlayer visual editor`);O(Q),Q.action(e=>{i({env:e.env,envFile:e.envFile})});let $=m.command(`extract`).alias(`ext`).description(`Extract strings from components to be placed in a .content file close to the component`);return $.option(`-f, --file [files...]`,`List of files to extract`).option(`-o, --output-content-declarations [outputContentDeclarations]`,`Path to output content declaration files`).option(`--code-only`,`Only extract the component code`,!1).option(`--declaration-only`,`Only generate content declaration`,!1).action(e=>{a({files:e.file,outputContentDeclarations:e.outputContentDeclarations,configOptions:F(e),codeOnly:e.codeOnly,declarationOnly:e.declarationOnly})}),O($),m.parse(process.argv),m.command(`ci`).description(`Run Intlayer commands with auto-injected credentials from INTLAYER_PROJECT_CREDENTIALS. Detects current project or iterates over all projects.`).argument(`<command...>`,`The intlayer command to execute (e.g., "fill", "push")`).allowUnknownOption().action(e=>{t(e)}),m};export{b as dirname,I as setAPI};
|
|
2
2
|
//# sourceMappingURL=cli.mjs.map
|
package/dist/esm/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","names":["pathDirname"],"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 { 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, initSkills } from './init';\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]);\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 = !Object.values(filteredOptions).some(Boolean);\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} & LogOptions;\n\nconst configurationOptionKeys: (keyof ConfigurationOptions)[] = [\n 'baseDir',\n 'env',\n 'envFile',\n 'verbose',\n 'prefix',\n];\n\nconst extractConfigOptions = (\n options: ConfigurationOptions\n): GetConfigurationOptions | undefined => {\n const configuration = getConfiguration(options);\n const filteredOptions = extractKeysFromOptions(\n options,\n configurationOptionKeys\n );\n\n const isOptionEmpty = !Object.values(filteredOptions).some(Boolean);\n\n if (isOptionEmpty) {\n return undefined;\n }\n\n const { baseDir, env, envFile, verbose, prefix, noCache } = options;\n\n const addPrefix: boolean = Boolean((options as any).with); // Hack to add the prefix when the command is run in parallel\n\n if (typeof prefix === 'string') {\n setPrefix(prefix);\n } else if (addPrefix) {\n setPrefix(configuration.log.prefix);\n }\n\n const log = {\n verbose: verbose ?? true,\n };\n\n const override = {\n log,\n };\n\n return removeUndefined({\n baseDir,\n env,\n envFile,\n override,\n cache: !noCache,\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 setPrefix('');\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 verbose: true,\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 ],\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":"gqCAsCA,MAAa,EAFM,OAAO,OAAO,KAAK,KAAQ,SAG1CA,EAAY,EAAc,OAAO,KAAK,IAAI,CAAC,CAC3C,UAEE,EAAc,EAAqB,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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Aa,EAAS,GAAY,CAClC,EAAmB,EAAQ,CAE3B,EAAQ,OAAQ,GAAY,GAAS,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,EAAY,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,EAAQ,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,EAAM,EAAK,EACX,CAEG"}
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":["pathDirname"],"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 { 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]);\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 = !Object.values(filteredOptions).some(Boolean);\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} & LogOptions;\n\nconst configurationOptionKeys: (keyof ConfigurationOptions)[] = [\n 'baseDir',\n 'env',\n 'envFile',\n 'verbose',\n 'prefix',\n];\n\nconst extractConfigOptions = (\n options: ConfigurationOptions\n): GetConfigurationOptions | undefined => {\n const configuration = getConfiguration(options);\n const filteredOptions = extractKeysFromOptions(\n options,\n configurationOptionKeys\n );\n\n const isOptionEmpty = !Object.values(filteredOptions).some(Boolean);\n\n if (isOptionEmpty) {\n return undefined;\n }\n\n const { baseDir, env, envFile, verbose, prefix, noCache } = options;\n\n const addPrefix: boolean = Boolean((options as any).with); // Hack to add the prefix when the command is run in parallel\n\n if (typeof prefix === 'string') {\n setPrefix(prefix);\n } else if (addPrefix) {\n setPrefix(configuration.log.prefix);\n }\n\n const log = {\n verbose: verbose ?? true,\n };\n\n const override = {\n log,\n };\n\n return removeUndefined({\n baseDir,\n env,\n envFile,\n override,\n cache: !noCache,\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 setPrefix('');\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 verbose: true,\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 ],\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":"8rCAuCA,MAAa,EAFM,OAAO,OAAO,KAAK,KAAQ,SAG1CA,EAAY,EAAc,OAAO,KAAK,IAAI,CAAC,CAC3C,UAEE,EAAc,EAAqB,EAAQ,CAO3C,EAAuB,CAC3B,CAAC,uBAAwB,mBAAmB,CAC5C,CAAC,kBAAmB,cAAc,CAClC,CAAC,uBAAwB,iBAAiB,CAC1C,CAAC,uBAAwB,WAAW,CACpC,GAViB,CACjB,CAAC,YAAa,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as n}from"./extract.mjs";import{listMissingTranslations as r,listMissingTranslationsWithConfig as i}from"./test/listMissingTranslations.mjs";import{testMissingTranslations as a}from"./test/test.mjs";import{fill as o}from"./fill/fill.mjs";import{
|
|
1
|
+
import{build as e}from"./build.mjs";import{startEditor as t}from"./editor.mjs";import{extract as n}from"./extract.mjs";import{listMissingTranslations as r,listMissingTranslationsWithConfig as i}from"./test/listMissingTranslations.mjs";import{testMissingTranslations as a}from"./test/test.mjs";import{fill as o}from"./fill/fill.mjs";import{findProjectRoot as s,init as c}from"./init.mjs";import{getDetectedPlatform as l,initSkills as u}from"./initSkills.mjs";import{listContentDeclaration as d,listContentDeclarationRows as f}from"./listContentDeclaration.mjs";import{liveSync as p}from"./liveSync.mjs";import{pull as m}from"./pull.mjs";import{push as h}from"./push/push.mjs";import{pushConfig as g}from"./pushConfig.mjs";import{reviewDoc as _}from"./reviewDoc/reviewDoc.mjs";import{searchDoc as v}from"./searchDoc.mjs";import{translateDoc as y}from"./translateDoc/translateDoc.mjs";import{dirname as b,setAPI as x}from"./cli.mjs";export{e as build,b as dirname,n as extract,o as fill,s as findProjectRoot,l as getDetectedPlatform,c as init,u as initSkills,d as listContentDeclaration,f as listContentDeclarationRows,r as listMissingTranslations,i as listMissingTranslationsWithConfig,p as liveSync,m as pull,h as push,g as pushConfig,_ as reviewDoc,v as searchDoc,x as setAPI,t as startEditor,a as testMissingTranslations,y as translateDoc};
|
package/dist/esm/init.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{join as e,resolve as t}from"node:path";import{
|
|
1
|
+
import{join as e,resolve as t}from"node:path";import{initIntlayer as n}from"@intlayer/chokidar/cli";import{existsSync as r}from"node:fs";const i=n=>{let i=n;for(;i!==t(i,`..`);){if(r(e(i,`package.json`)))return i;i=t(i,`..`)}return n},a=async e=>{await n(i(e?t(e):process.cwd()))};export{i as findProjectRoot,a as init};
|
|
2
2
|
//# sourceMappingURL=init.mjs.map
|
package/dist/esm/init.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.mjs","names":[],"sources":["../../src/init.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n initIntlayer,\n installSkills,\n type Platform,\n SKILLS,\n SKILLS_METADATA,\n} from '@intlayer/chokidar/cli';\n// @ts-ignore\nimport { AutoComplete } from 'enquirer';\n\nconst findProjectRoot = (startDir: string) => {\n let currentDir = startDir;\n\n while (currentDir !== resolve(currentDir, '..')) {\n if (existsSync(join(currentDir, 'package.json'))) {\n return currentDir;\n }\n currentDir = resolve(currentDir, '..');\n }\n\n // If no package.json is found, return the start directory.\n // The initIntlayer function will handle the missing package.json error.\n return startDir;\n};\n\nexport const init = async (projectRoot?: string) => {\n const root = projectRoot\n ? findProjectRoot(resolve(projectRoot))\n : findProjectRoot(process.cwd());\n\n await initIntlayer(root);\n};\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\nexport const getDetectedPlatform = (): Platform | undefined =>\n PLATFORM_CHECKS.find(({ check }) => check())?.platform;\n\nexport const initSkills = async (projectRoot?: string) => {\n const root = projectRoot\n ? findProjectRoot(resolve(projectRoot))\n : findProjectRoot(process.cwd());\n\n p.intro('Initializing Intlayer skills');\n\n // Detect if running in a specific platform\n const detectedPlatform = getDetectedPlatform();\n\n const PLATFORM_OPTIONS = [\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 ] as { value: Platform; label: string; hint: string }[];\n\n // Confirm or choose platforms\n const prompt = new AutoComplete({\n name: 'platforms',\n message: 'Which platforms are you using?',\n limit: 10,\n initial: detectedPlatform\n ? PLATFORM_OPTIONS.findIndex((p) => p.value === detectedPlatform)\n : undefined,\n multiple: true,\n choices: PLATFORM_OPTIONS.map((p) => ({\n name: p.value,\n message: p.label,\n hint: p.hint,\n })),\n });\n\n let platforms: Platform[];\n try {\n platforms = (await prompt.run()) as Platform[];\n } catch (error) {\n p.cancel('Operation cancelled');\n return;\n }\n\n if (platforms.length === 0) {\n p.log.warn('No platform selected. Nothing to install.');\n return;\n }\n\n // Detect framework skills\n let dependencies: Record<string, string> = {};\n try {\n const packageJsonPath = join(root, 'package.json');\n if (existsSync(packageJsonPath)) {\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));\n dependencies = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n }\n } catch {\n // Ignore errors reading package.json\n }\n\n const initialValues: (keyof typeof SKILLS_METADATA)[] = [\n 'Usage',\n 'Config',\n 'Content',\n 'RemoteContent',\n ];\n\n if (dependencies.react || dependencies.next) {\n initialValues.push('React');\n }\n if (dependencies.next) {\n initialValues.push('NextJS');\n }\n if (dependencies.preact) {\n initialValues.push('Preact');\n }\n if (dependencies['solid-js']) {\n initialValues.push('Solid');\n }\n if (dependencies.vue || dependencies.nuxt) {\n initialValues.push('Vue');\n }\n if (dependencies.svelte || dependencies['@sveltejs/kit']) {\n initialValues.push('Svelte');\n }\n if (dependencies.astro) {\n initialValues.push('Astro');\n }\n\n // Show list of available skills and allow selecting multiple\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 })) as (keyof typeof SKILLS_METADATA)[];\n\n if (p.isCancel(selectedSkills)) {\n p.cancel('Operation cancelled');\n return;\n }\n\n if (selectedSkills.length === 0) {\n p.log.warn('No skills selected. Nothing to install.');\n return;\n }\n\n // Call installSkills for each platform\n const s = p.spinner();\n s.start('Installing skills...');\n try {\n const results: string[] = [];\n for (const platform of platforms) {\n const result = await installSkills(root, platform, selectedSkills);\n results.push(result);\n }\n s.stop('Skills installed successfully');\n\n // Show success messages\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(String(error));\n }\n\n p.outro('Intlayer skills initialization complete');\n};\n"],"mappings":"wRAaA,MAAM,EAAmB,GAAqB,CAC5C,IAAI,EAAa,EAEjB,KAAO,IAAe,EAAQ,EAAY,KAAK,EAAE,CAC/C,GAAI,EAAW,EAAK,EAAY,eAAe,CAAC,CAC9C,OAAO,EAET,EAAa,EAAQ,EAAY,KAAK,CAKxC,OAAO,GAGI,EAAO,KAAO,IAAyB,CAKlD,MAAM,EAHF,EADS,EACO,EAAQ,EAAY,CACpB,QAAQ,KAAK,CAAC,CAEV,EAGpB,EAAuE,CAC3E,CACE,UACE,QAAQ,IAAI,SAAW,QAAU,QAAQ,IAAI,eAAiB,SAChE,SAAU,SACX,CACD,CACE,UACE,QAAQ,IAAI,WAAa,QACzB,QAAQ,IAAI,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AIF,IAAM,EAAI,EAAE,SAAS,CACrB,EAAE,MAAM,uBAAuB,CAC/B,GAAI,CACF,IAAM,EAAoB,EAAE,CAC5B,IAAK,IAAM,KAAY,EAAW,CAChC,IAAM,EAAS,MAAM,EAAc,EAAM,EAAU,EAAe,CAClE,EAAQ,KAAK,EAAO,CAEtB,EAAE,KAAK,gCAAgC,CAGvC,IAAK,IAAM,KAAU,EACnB,EAAE,KAAK,EAAQ,UAAU,OAEpB,EAAO,CACd,EAAE,KAAK,2BAA2B,CAClC,EAAE,IAAI,MAAM,OAAO,EAAM,CAAC,CAG5B,EAAE,MAAM,0CAA0C"}
|
|
1
|
+
{"version":3,"file":"init.mjs","names":[],"sources":["../../src/init.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport { initIntlayer } from '@intlayer/chokidar/cli';\n\nexport const findProjectRoot = (startDir: string) => {\n let currentDir = startDir;\n\n while (currentDir !== resolve(currentDir, '..')) {\n if (existsSync(join(currentDir, 'package.json'))) {\n return currentDir;\n }\n currentDir = resolve(currentDir, '..');\n }\n\n // If no package.json is found, return the start directory.\n // The initIntlayer function will handle the missing package.json error.\n return startDir;\n};\n\nexport const init = async (projectRoot?: string) => {\n const root = projectRoot\n ? findProjectRoot(resolve(projectRoot))\n : findProjectRoot(process.cwd());\n\n await initIntlayer(root);\n};\n"],"mappings":"yIAIA,MAAa,EAAmB,GAAqB,CACnD,IAAI,EAAa,EAEjB,KAAO,IAAe,EAAQ,EAAY,KAAK,EAAE,CAC/C,GAAI,EAAW,EAAK,EAAY,eAAe,CAAC,CAC9C,OAAO,EAET,EAAa,EAAQ,EAAY,KAAK,CAKxC,OAAO,GAGI,EAAO,KAAO,IAAyB,CAKlD,MAAM,EAHF,EADS,EACO,EAAQ,EAAY,CACpB,QAAQ,KAAK,CAAC,CAEV"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{findProjectRoot as e}from"./init.mjs";import{join as t,resolve as n}from"node:path";import{SKILLS as r,SKILLS_METADATA as i,installSkills as a}from"@intlayer/chokidar/cli";import{existsSync as o,readFileSync as s}from"node:fs";import*as c from"@clack/prompts";import l from"enquirer";const u=[{check:()=>process.env.CURSOR===`true`||process.env.TERM_PROGRAM===`cursor`,platform:`Cursor`},{check:()=>process.env.WINDSURF===`true`||process.env.TERM_PROGRAM===`windsurf`,platform:`Windsurf`},{check:()=>process.env.TRAE===`true`||process.env.TERM_PROGRAM===`trae`,platform:`Trae`},{check:()=>process.env.TRAE_CN===`true`,platform:`TraeCN`},{check:()=>process.env.VSCODE===`true`||process.env.TERM_PROGRAM===`vscode`,platform:`VSCode`},{check:()=>process.env.OPENCODE===`true`,platform:`OpenCode`},{check:()=>process.env.CLAUDE===`true`,platform:`Claude`},{check:()=>process.env.GITHUB_ACTIONS===`true`||!!process.env.GITHUB_WORKSPACE,platform:`GitHub`}],d=[{value:`Cursor`,label:`Cursor`,hint:`(.cursor/skills)`},{value:`Windsurf`,label:`Windsurf`,hint:`(.windsurf/skills)`},{value:`Trae`,label:`Trae`,hint:`(.trae/skills)`},{value:`TraeCN`,label:`Trae CN`,hint:`(.trae/skills)`},{value:`VSCode`,label:`VS Code`,hint:`(.github/skills)`},{value:`OpenCode`,label:`OpenCode`,hint:`(.opencode/skills)`},{value:`Claude`,label:`Claude Code`,hint:`(.claude/skills)`},{value:`GitHub`,label:`GitHub Copilot Workspace`,hint:`(.github/skills)`},{value:`Antigravity`,label:`Antigravity`,hint:`(.agent/skills)`},{value:`Augment`,label:`Augment`,hint:`(.augment/skills)`},{value:`OpenClaw`,label:`OpenClaw`,hint:`(skills)`},{value:`Cline`,label:`Cline`,hint:`(.cline/skills)`},{value:`CodeBuddy`,label:`CodeBuddy`,hint:`(.codebuddy/skills)`},{value:`CommandCode`,label:`Command Code`,hint:`(.commandcode/skills)`},{value:`Continue`,label:`Continue`,hint:`(.continue/skills)`},{value:`Crush`,label:`Crush`,hint:`(.crush/skills)`},{value:`Droid`,label:`Droid`,hint:`(.factory/skills)`},{value:`Goose`,label:`Goose`,hint:`(.goose/skills)`},{value:`IFlow`,label:`iFlow CLI`,hint:`(.iflow/skills)`},{value:`Junie`,label:`Junie`,hint:`(.junie/skills)`},{value:`KiloCode`,label:`Kilo Code`,hint:`(.kilocode/skills)`},{value:`Kiro`,label:`Kiro CLI`,hint:`(.kiro/skills)`},{value:`Kode`,label:`Kode`,hint:`(.kode/skills)`},{value:`MCPJam`,label:`MCPJam`,hint:`(.mcpjam/skills)`},{value:`MistralVibe`,label:`Mistral Vibe`,hint:`(.vibe/skills)`},{value:`Mux`,label:`Mux`,hint:`(.mux/skills)`},{value:`OpenHands`,label:`OpenHands`,hint:`(.openhands/skills)`},{value:`Pi`,label:`Pi`,hint:`(.pi/skills)`},{value:`Qoder`,label:`Qoder`,hint:`(.qoder/skills)`},{value:`Qwen`,label:`Qwen Code`,hint:`(.qwen/skills)`},{value:`RooCode`,label:`Roo Code`,hint:`(.roo/skills)`},{value:`Zencoder`,label:`Zencoder`,hint:`(.zencoder/skills)`},{value:`Neovate`,label:`Neovate`,hint:`(.neovate/skills)`},{value:`Pochi`,label:`Pochi`,hint:`(.pochi/skills)`},{value:`Other`,label:`Other`,hint:`(skills)`}],f=()=>u.find(({check:e})=>e())?.platform;function p(e){try{let n=t(e,`package.json`);if(!o(n))return{};let{dependencies:r={},devDependencies:i={}}=JSON.parse(s(n,`utf-8`));return{...r,...i}}catch{return{}}}function m(e){let t=[`Usage`,`Config`,`Content`,`RemoteContent`];return(e.react||e.next)&&t.push(`React`),e.next&&t.push(`NextJS`),e.preact&&t.push(`Preact`),e[`solid-js`]&&t.push(`Solid`),(e.vue||e.nuxt)&&t.push(`Vue`),(e.svelte||e[`@sveltejs/kit`])&&t.push(`Svelte`),e.astro&&t.push(`Astro`),t}const h=async t=>{let o=e(t?n(t):process.cwd());c.intro(`Initializing Intlayer skills`);let s=f(),u;try{u=(await l.prompt({type:`autocomplete`,name:`platforms`,message:`Which platforms are you using? (Type to search)`,multiple:!0,initial:s?d.findIndex(e=>e.value===s):void 0,choices:d.map(e=>({name:e.value,message:e.label,hint:e.hint}))})).platforms}catch{c.cancel(`Operation cancelled.`);return}if(!u||u.length===0){c.log.warn(`No platform selected. Nothing to install.`);return}let h=m(p(o)),g=await c.multiselect({message:`Select the documentation skills to provide to your AI:`,initialValues:h,options:r.map(e=>({value:e,label:e,hint:i[e]})),required:!1});if(c.isCancel(g)||!g||g.length===0){c.cancel(`Operation cancelled. No skills selected.`);return}let _=c.spinner();_.start(`Installing skills...`);try{let e=u.map(e=>a(o,e,g)),t=await Promise.all(e);_.stop(`Skills installed successfully`);for(let e of t)c.note(e,`Success`)}catch(e){_.stop(`Failed to install skills`),c.log.error(e instanceof Error?e.message:String(e))}c.outro(`Intlayer skills initialization complete`)};export{f as getDetectedPlatform,h as initSkills};
|
|
2
|
+
//# sourceMappingURL=initSkills.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initSkills.mjs","names":[],"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 ];\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":"mSAcA,MAAM,EAAuE,CAC3E,CACE,UACE,QAAQ,IAAI,SAAW,QAAU,QAAQ,IAAI,eAAiB,SAChE,SAAU,SACX,CACD,CACE,UACE,QAAQ,IAAI,WAAa,QACzB,QAAQ,IAAI,eAAiB,WAC/B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EAAE,SAAS,EAAe,EAC1B,CAAC,GACA,EAA4B,SAAW,EACxC,CACA,EAAE,OAAO,2CAA2C,CACpD,OAGF,IAAM,EAAI,EAAE,SAAS,CACrB,EAAE,MAAM,uBAAuB,CAE/B,GAAI,CACF,IAAM,EAAkB,EAAU,IAAK,GACrC,EACE,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"}
|
package/dist/types/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","names":[],"sources":["../../src/cli.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","names":[],"sources":["../../src/cli.ts"],"mappings":";;;cAuCa,OAAA;AAAA,KA2IR,UAAA;EACH,MAAA;EACA,OAAA;AAAA;AAAA,KAGU,oBAAA;EACV,OAAA;EACA,GAAA;EACA,OAAA;EACA,OAAA;AAAA,IACE,UAAA;;AALJ;;;;;;;cAiEa,MAAA,QAAa,OAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { ConfigurationOptions, dirname, setAPI } from "./cli.js";
|
|
|
3
3
|
import { startEditor } from "./editor.js";
|
|
4
4
|
import { extract } from "./extract.js";
|
|
5
5
|
import { FillOptions, fill } from "./fill/fill.js";
|
|
6
|
-
import {
|
|
6
|
+
import { findProjectRoot, init } from "./init.js";
|
|
7
|
+
import { getDetectedPlatform, initSkills } from "./initSkills.js";
|
|
7
8
|
import { listContentDeclaration, listContentDeclarationRows } from "./listContentDeclaration.js";
|
|
8
9
|
import { liveSync } from "./liveSync.js";
|
|
9
10
|
import { pull } from "./pull.js";
|
|
@@ -19,4 +20,4 @@ export * from "@intlayer/chokidar/cli";
|
|
|
19
20
|
export * from "@intlayer/chokidar/utils";
|
|
20
21
|
export * from "@intlayer/chokidar/build";
|
|
21
22
|
export * from "@intlayer/chokidar/watcher";
|
|
22
|
-
export { ConfigurationOptions, FillOptions, build, dirname, extract, fill, getDetectedPlatform, init, initSkills, listContentDeclaration, listContentDeclarationRows, listMissingTranslations, listMissingTranslationsWithConfig, liveSync, pull, push, pushConfig, reviewDoc, searchDoc, setAPI, startEditor, testMissingTranslations, translateDoc };
|
|
23
|
+
export { ConfigurationOptions, FillOptions, build, dirname, extract, fill, findProjectRoot, getDetectedPlatform, init, initSkills, listContentDeclaration, listContentDeclarationRows, listMissingTranslations, listMissingTranslationsWithConfig, liveSync, pull, push, pushConfig, reviewDoc, searchDoc, setAPI, startEditor, testMissingTranslations, translateDoc };
|
package/dist/types/init.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { Platform } from "@intlayer/chokidar/cli";
|
|
2
|
-
|
|
3
1
|
//#region src/init.d.ts
|
|
2
|
+
declare const findProjectRoot: (startDir: string) => string;
|
|
4
3
|
declare const init: (projectRoot?: string) => Promise<void>;
|
|
5
|
-
declare const getDetectedPlatform: () => Platform | undefined;
|
|
6
|
-
declare const initSkills: (projectRoot?: string) => Promise<void>;
|
|
7
4
|
//#endregion
|
|
8
|
-
export {
|
|
5
|
+
export { findProjectRoot, init };
|
|
9
6
|
//# sourceMappingURL=init.d.ts.map
|
package/dist/types/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","names":[],"sources":["../../src/init.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","names":[],"sources":["../../src/init.ts"],"mappings":";cAIa,eAAA,GAAmB,QAAA;AAAA,cAenB,IAAA,GAAc,WAAA,cAAoB,OAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Platform } from "@intlayer/chokidar/cli";
|
|
2
|
+
|
|
3
|
+
//#region src/initSkills.d.ts
|
|
4
|
+
declare const getDetectedPlatform: () => Platform | undefined;
|
|
5
|
+
declare const initSkills: (projectRoot?: string) => Promise<void>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { getDetectedPlatform, initSkills };
|
|
8
|
+
//# sourceMappingURL=initSkills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initSkills.d.ts","names":[],"sources":["../../src/initSkills.ts"],"mappings":";;;cAkGa,mBAAA,QAA0B,QAAA;AAAA,cAwC1B,UAAA,GAAoB,WAAA,cAAoB,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/cli",
|
|
3
|
-
"version": "8.1.3
|
|
3
|
+
"version": "8.1.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Provides uniform command-line interface scripts for Intlayer, used in packages like intlayer-cli and intlayer.",
|
|
6
6
|
"keywords": [
|
|
@@ -68,15 +68,15 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@clack/prompts": "0.11.0",
|
|
71
|
-
"@intlayer/ai": "8.1.3
|
|
72
|
-
"@intlayer/api": "8.1.3
|
|
73
|
-
"@intlayer/chokidar": "8.1.3
|
|
74
|
-
"@intlayer/config": "8.1.3
|
|
75
|
-
"@intlayer/core": "8.1.3
|
|
76
|
-
"@intlayer/dictionaries-entry": "8.1.3
|
|
77
|
-
"@intlayer/remote-dictionaries-entry": "8.1.3
|
|
78
|
-
"@intlayer/types": "8.1.3
|
|
79
|
-
"@intlayer/unmerged-dictionaries-entry": "8.1.3
|
|
71
|
+
"@intlayer/ai": "8.1.3",
|
|
72
|
+
"@intlayer/api": "8.1.3",
|
|
73
|
+
"@intlayer/chokidar": "8.1.3",
|
|
74
|
+
"@intlayer/config": "8.1.3",
|
|
75
|
+
"@intlayer/core": "8.1.3",
|
|
76
|
+
"@intlayer/dictionaries-entry": "8.1.3",
|
|
77
|
+
"@intlayer/remote-dictionaries-entry": "8.1.3",
|
|
78
|
+
"@intlayer/types": "8.1.3",
|
|
79
|
+
"@intlayer/unmerged-dictionaries-entry": "8.1.3",
|
|
80
80
|
"commander": "14.0.3",
|
|
81
81
|
"enquirer": "^2.4.1",
|
|
82
82
|
"eventsource": "4.1.0",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"vitest": "4.0.18"
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
|
-
"@intlayer/ai": "8.1.3
|
|
96
|
+
"@intlayer/ai": "8.1.3"
|
|
97
97
|
},
|
|
98
98
|
"peerDependenciesMeta": {
|
|
99
99
|
"@intlayer/ai": {
|