@intlayer/cli 8.1.5 → 8.1.7
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/README.md +37 -28
- package/dist/cjs/initSkills.cjs +1 -1
- package/dist/cjs/initSkills.cjs.map +1 -1
- package/dist/esm/initSkills.mjs +1 -1
- package/dist/esm/initSkills.mjs.map +1 -1
- package/dist/types/initSkills.d.ts.map +1 -1
- package/package.json +12 -13
package/README.md
CHANGED
|
@@ -46,25 +46,26 @@ With **per-locale content files**, **TypeScript autocompletion**, **tree-shakabl
|
|
|
46
46
|
|
|
47
47
|
## Keys benefits of Intlayer:
|
|
48
48
|
|
|
49
|
-
| Feature | Description
|
|
50
|
-
| --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
51
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more.
|
|
52
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content)
|
|
53
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **Per-Locale Content Declaration File**<br><br>Speed up your development by declaring your content once, before auto generation.<br><br> - [Per-Locale Content Declaration File](https://intlayer.org/doc/concept/per-locale-file)
|
|
54
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
55
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
56
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
57
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
58
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
59
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
60
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
61
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
62
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
63
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
64
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
65
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
66
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
67
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/
|
|
49
|
+
| Feature | Description |
|
|
50
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
51
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more. |
|
|
52
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content) |
|
|
53
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **Per-Locale Content Declaration File**<br><br>Speed up your development by declaring your content once, before auto generation.<br><br> - [Per-Locale Content Declaration File](https://intlayer.org/doc/concept/per-locale-file) |
|
|
54
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/compiler.jpg?raw=true" alt="Feature" width="700"> | **Compiler**<br><br>The Intlayer Compiler extract automatically the content from the components and generate the dictionary files.<br><br> - [Compiler](https://intlayer.org/doc/compiler) |
|
|
55
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true" alt="Feature" width="700"> | **Type-Safe Environment**<br><br>Leverage TypeScript to ensure your content definitions and code are error-free, while also benefiting from IDE autocompletion.<br><br> - [TypeScript configuration](https://intlayer.org/doc/environment/vite-and-react#configure-typescript) |
|
|
56
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/config_file.png?raw=true" alt="Feature" width="700"> | **Simplified Setup**<br><br>Get up and running quickly with minimal configuration. Adjust settings for internationalization, routing, AI, build, and content handling with ease. <br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
|
|
57
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/content_retrieval.png?raw=true" alt="Feature" width="700"> | **Simplified Content Retrieval**<br><br>No need to call your `t` function for each piece of content. Retrieve all your content directly using a single hook.<br><br> - [React integration](https://intlayer.org/doc/environment/create-react-app) |
|
|
58
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/server_component.png?raw=true" alt="Feature" width="700"> | **Consistent Server Component Implementation**<br><br>Perfectly suited for Next.js server components, use the same implementation for both client and server components, no need to pass your `t` function across each server component. <br><br> - [Server Components](https://intlayer.org/doc/environment/nextjs#step-7-utilize-content-in-your-code) |
|
|
59
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/file_tree.png?raw=true" alt="Feature" width="700"> | **Organized Codebase**<br><br>Keep your codebase more organized: 1 component = 1 dictionary in the same folder. Translations close to their respective components, enhance maintainability and clarity. <br><br> - [How Intlayer works](https://intlayer.org/doc/concept/how-works-intlayer) |
|
|
60
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/url_routing.png?raw=true" alt="Feature" width="700"> | **Enhanced Routing**<br><br>Full support of app routing, adapting seamlessly to complex application structures, for Next.js, React, Vite, Vue.js, etc.<br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
|
|
61
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/markdown.png?raw=true" alt="Feature" width="700"> | **Markdown Support**<br><br>Import and interpret, locale files and remote Markdown for multilingual content like privacy policies, documentation, etc. Interpret and make Markdown metadata accessible in your code.<br><br> - [Content files](https://intlayer.org/doc/concept/content/file) |
|
|
62
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/visual_editor.png?raw=true" alt="Feature" width="700"> | **Free Visual Editor & CMS**<br><br>A free visual editor and CMS are available for content writers, removing the need for a localization platform. Keep your content synchronized using Git, or externalize it totally or partially with the CMS.<br><br> - [Intlayer Editor](https://intlayer.org/doc/concept/editor) <br> - [Intlayer CMS](https://intlayer.org/doc/concept/cms) |
|
|
63
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle.png?raw=true" alt="Feature" width="700"> | **Tree-shakable Content**<br><br>Tree-shakable content, reducing the size of the final bundle. Loads content per component, excluding any unused content from your bundle. Supports lazy loading to enhance app loading efficiency. <br><br> - [App build optimization](https://intlayer.org/doc/concept/how-works-intlayer#app-build-optimization) |
|
|
64
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/static_rendering.png?raw=true" alt="Feature" width="700"> | **Static Rendering**<br><br>Doesn't block Static Rendering. <br><br> - [Next.js integration](https://intlayer.org/doc/environment/nextjs) |
|
|
65
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/AI_translation.png?raw=true" alt="Feature" width="700"> | **AI-Powered Translation**<br><br>Transform your website into 231 languages with just one click using Intlayer's advanced AI-powered translation tools using your own AI provider / API key. <br><br> - [CI/CD integration](https://intlayer.org/doc/concept/ci-cd) <br> - [Intlayer CLI](https://intlayer.org/doc/concept/cli) <br> - [Auto fill](https://intlayer.org/doc/concept/auto-fill) |
|
|
66
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/mcp.png?raw=true" alt="Feature" width="700"> | **MCP Server Integration**<br><br>Provides an MCP (Model Context Protocol) server for IDE automation, enabling seamless content management and i18n workflows directly within your development environment. <br><br> - [MCP Server](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/mcp_server.md) |
|
|
67
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/vscode_extension.png?raw=true" alt="Feature" width="700"> | **VSCode Extension**<br><br>Intlayer provides a VSCode extension to help you manage your content and translations, building your dictionaries, translating your content, and more. <br><br> - [VSCode Extension](https://intlayer.org/doc/vs-code-extension) |
|
|
68
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/interoperability.png?raw=true" alt="Feature" width="700"> | **Interoperability**<br><br>Allow interoperability with react-i18next, next-i18next, next-intl, react-intl, vue-i18n. <br><br> - [Intlayer and react-intl](https://intlayer.org/blog/intlayer-with-react-intl) <br> - [Intlayer and next-intl](https://intlayer.org/blog/intlayer-with-next-intl) <br> - [Intlayer and next-i18next](https://intlayer.org/blog/intlayer-with-next-i18next) <br> - [Intlayer and vue-i18n](https://intlayer.org/blog/intlayer-with-vue-i18n) |
|
|
68
69
|
|
|
69
70
|
---
|
|
70
71
|
|
|
@@ -153,6 +154,8 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
153
154
|
<li><a href="https://intlayer.org/doc/concept/how-works-intlayer" rel=''>How Intlayer Works</a></li>
|
|
154
155
|
<li><a href="https://intlayer.org/doc/concept/configuration" rel=''>Configuration</a></li>
|
|
155
156
|
<li><a href="https://intlayer.org/doc/concept/cli" rel=''>Intlayer CLI</a></li>
|
|
157
|
+
<li><a href="https://intlayer.org/doc/compiler" rel=''>Compiler</a></li>
|
|
158
|
+
|
|
156
159
|
<li><a href="https://intlayer.org/doc/concept/editor" rel=''>Intlayer Editor</a></li>
|
|
157
160
|
<li><a href="https://intlayer.org/doc/concept/cms" rel=''>Intlayer CMS</a></li>
|
|
158
161
|
<li><a href="https://intlayer.org/doc/concept/content" rel=''>Dictionary</a>
|
|
@@ -179,17 +182,15 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
179
182
|
<li><a href="https://intlayer.org/doc/environment/nextjs/15" rel=''>Next.js 15</a></li>
|
|
180
183
|
<li><a href="https://intlayer.org/doc/environment/nextjs/14" rel=''>Next.js 14 (App Router)</a></li>
|
|
181
184
|
<li><a href="https://intlayer.org/doc/environment/nextjs/next-with-Page-Router" rel=''>Next.js Page Router</a></li>
|
|
185
|
+
<li><a href="https://intlayer.org/doc/environment/nextjs/compiler" rel=''>Next.js using Compiler</a></li>
|
|
182
186
|
</ul>
|
|
183
187
|
</li>
|
|
184
188
|
<li><a href="https://intlayer.org/doc/environment/create-react-app" rel=''>React CRA</a></li>
|
|
185
|
-
<li><a href="https://intlayer.org/doc/environment/vite-and-react" rel=''>Vite + React</a>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
</ul>
|
|
190
|
-
</li>
|
|
189
|
+
<li><a href="https://intlayer.org/doc/environment/vite-and-react" rel=''>Vite + React</a></li>
|
|
190
|
+
<li><a href="https://intlayer.org/doc/environment/vite-and-react" rel=''>Vite + React using Compiler</a></li>
|
|
191
|
+
<li><a href="https://intlayer.org/doc/environment/vite-and-react/compiler" rel=''>React-router-v7</a></li>
|
|
192
|
+
<li><a href="https://intlayer.org/doc/environment/vite-and-react/tanstack-start" rel=''>Tanstack start</a></li>
|
|
191
193
|
<li><a href="https://intlayer.org/doc/environment/react-native-and-expo" rel=''>React Native</a></li>
|
|
192
|
-
<li><a href="https://intlayer.org/doc/environment/lynx-and-react" rel=''>Lynx + React</a></li>
|
|
193
194
|
<li><a href="https://intlayer.org/doc/environment/vite-and-svelte" rel=''>Vite + Svelte</a></li>
|
|
194
195
|
<li><a href="https://intlayer.org/doc/environment/sveltekit" rel=''>SvelteKit</a></li>
|
|
195
196
|
<li><a href="https://intlayer.org/doc/environment/vite-and-preact" rel=''>Vite + Preact</a></li>
|
|
@@ -197,8 +198,16 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
197
198
|
<li><a href="https://intlayer.org/doc/environment/vite-and-nuxt" rel=''>Vite + Nuxt</a></li>
|
|
198
199
|
<li><a href="https://intlayer.org/doc/environment/vite-and-solid" rel=''>Vite + Solid</a></li>
|
|
199
200
|
<li><a href="https://intlayer.org/doc/environment/angular" rel=''>Angular</a></li>
|
|
200
|
-
<li
|
|
201
|
-
|
|
201
|
+
<li>
|
|
202
|
+
<a href="https://intlayer.org/doc/environment/express" rel=''>Backend</a>
|
|
203
|
+
<ul>
|
|
204
|
+
<li><a href="https://intlayer.org/doc/environment/express" rel=''>Express</a></li>
|
|
205
|
+
<li><a href="https://intlayer.org/doc/environment/nest" rel=''>NestJS</a></li>
|
|
206
|
+
<li><a href="https://intlayer.org/doc/environment/fastify" rel=''>Fastify</a></li>
|
|
207
|
+
<li><a href="https://intlayer.org/doc/environment/adonisjs" rel=''>AdonisJS</a></li>
|
|
208
|
+
<li><a href="https://intlayer.org/doc/environment/hono" rel=''>Hono</a></li>
|
|
209
|
+
</ul>
|
|
210
|
+
</li>
|
|
202
211
|
</ul>
|
|
203
212
|
</details>
|
|
204
213
|
|
package/dist/cjs/initSkills.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./init.cjs`);let n=require(`node:path`),r=require(`@intlayer/chokidar/cli`),i=require(`node:fs`),a=require(`@clack/prompts`);a=e.__toESM(a);let o=require(`enquirer`);o=e.__toESM(o);const s=[{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;
|
|
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`,`Compiler`];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
2
|
//# sourceMappingURL=initSkills.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initSkills.cjs","names":["findProjectRoot","p","SKILLS","SKILLS_METADATA"],"sources":["../../src/initSkills.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n installSkills,\n type Platform,\n SKILLS,\n SKILLS_METADATA,\n} from '@intlayer/chokidar/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\n\n// --- Constants ---\n\nconst PLATFORM_CHECKS: Array<{ check: () => boolean; platform: Platform }> = [\n {\n check: () =>\n process.env.CURSOR === 'true' || process.env.TERM_PROGRAM === 'cursor',\n platform: 'Cursor',\n },\n {\n check: () =>\n process.env.WINDSURF === 'true' ||\n process.env.TERM_PROGRAM === 'windsurf',\n platform: 'Windsurf',\n },\n {\n check: () =>\n process.env.TRAE === 'true' || process.env.TERM_PROGRAM === 'trae',\n platform: 'Trae',\n },\n { check: () => process.env.TRAE_CN === 'true', platform: 'TraeCN' },\n {\n check: () =>\n process.env.VSCODE === 'true' || process.env.TERM_PROGRAM === 'vscode',\n platform: 'VSCode',\n },\n { check: () => process.env.OPENCODE === 'true', platform: 'OpenCode' },\n { check: () => process.env.CLAUDE === 'true', platform: 'Claude' },\n {\n check: () =>\n process.env.GITHUB_ACTIONS === 'true' || !!process.env.GITHUB_WORKSPACE,\n platform: 'GitHub',\n },\n];\n\nconst PLATFORM_OPTIONS: Array<{\n value: Platform;\n label: string;\n hint: string;\n}> = [\n { value: 'Cursor', label: 'Cursor', hint: '(.cursor/skills)' },\n { value: 'Windsurf', label: 'Windsurf', hint: '(.windsurf/skills)' },\n { value: 'Trae', label: 'Trae', hint: '(.trae/skills)' },\n { value: 'TraeCN', label: 'Trae CN', hint: '(.trae/skills)' },\n { value: 'VSCode', label: 'VS Code', hint: '(.github/skills)' },\n { value: 'OpenCode', label: 'OpenCode', hint: '(.opencode/skills)' },\n { value: 'Claude', label: 'Claude Code', hint: '(.claude/skills)' },\n {\n value: 'GitHub',\n label: 'GitHub Copilot Workspace',\n hint: '(.github/skills)',\n },\n { value: 'Antigravity', label: 'Antigravity', hint: '(.agent/skills)' },\n { value: 'Augment', label: 'Augment', hint: '(.augment/skills)' },\n { value: 'OpenClaw', label: 'OpenClaw', hint: '(skills)' },\n { value: 'Cline', label: 'Cline', hint: '(.cline/skills)' },\n { value: 'CodeBuddy', label: 'CodeBuddy', hint: '(.codebuddy/skills)' },\n {\n value: 'CommandCode',\n label: 'Command Code',\n hint: '(.commandcode/skills)',\n },\n { value: 'Continue', label: 'Continue', hint: '(.continue/skills)' },\n { value: 'Crush', label: 'Crush', hint: '(.crush/skills)' },\n { value: 'Droid', label: 'Droid', hint: '(.factory/skills)' },\n { value: 'Goose', label: 'Goose', hint: '(.goose/skills)' },\n { value: 'IFlow', label: 'iFlow CLI', hint: '(.iflow/skills)' },\n { value: 'Junie', label: 'Junie', hint: '(.junie/skills)' },\n { value: 'KiloCode', label: 'Kilo Code', hint: '(.kilocode/skills)' },\n { value: 'Kiro', label: 'Kiro CLI', hint: '(.kiro/skills)' },\n { value: 'Kode', label: 'Kode', hint: '(.kode/skills)' },\n { value: 'MCPJam', label: 'MCPJam', hint: '(.mcpjam/skills)' },\n { value: 'MistralVibe', label: 'Mistral Vibe', hint: '(.vibe/skills)' },\n { value: 'Mux', label: 'Mux', hint: '(.mux/skills)' },\n { value: 'OpenHands', label: 'OpenHands', hint: '(.openhands/skills)' },\n { value: 'Pi', label: 'Pi', hint: '(.pi/skills)' },\n { value: 'Qoder', label: 'Qoder', hint: '(.qoder/skills)' },\n { value: 'Qwen', label: 'Qwen Code', hint: '(.qwen/skills)' },\n { value: 'RooCode', label: 'Roo Code', hint: '(.roo/skills)' },\n { value: 'Zencoder', label: 'Zencoder', hint: '(.zencoder/skills)' },\n { value: 'Neovate', label: 'Neovate', hint: '(.neovate/skills)' },\n { value: 'Pochi', label: 'Pochi', hint: '(.pochi/skills)' },\n { value: 'Other', label: 'Other', hint: '(skills)' },\n];\n\n// --- Utilities ---\n\nexport const getDetectedPlatform = (): Platform | undefined =>\n PLATFORM_CHECKS.find(({ check }) => check())?.platform;\n\nfunction getDependencies(root: string): Record<string, string> {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return {};\n\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n return { ...dependencies, ...devDependencies };\n } catch {\n return {};\n }\n}\n\nfunction getInitialSkills(\n deps: Record<string, string>\n): (keyof typeof SKILLS_METADATA)[] {\n const skills: (keyof typeof SKILLS_METADATA)[] = [\n 'Usage',\n 'Config',\n 'Content',\n 'RemoteContent',\n ];\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,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,CAEK,EAID,CACH,CAAE,MAAO,SAAU,MAAO,SAAU,KAAM,mBAAoB,CAC9D,CAAE,MAAO,WAAY,MAAO,WAAY,KAAM,qBAAsB,CACpE,CAAE,MAAO,OAAQ,MAAO,OAAQ,KAAM,iBAAkB,CACxD,CAAE,MAAO,SAAU,MAAO,UAAW,KAAM,iBAA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_METADATA"],"sources":["../../src/initSkills.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n installSkills,\n type Platform,\n SKILLS,\n SKILLS_METADATA,\n} from '@intlayer/chokidar/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\n\n// --- Constants ---\n\nconst PLATFORM_CHECKS: Array<{ check: () => boolean; platform: Platform }> = [\n {\n check: () =>\n process.env.CURSOR === 'true' || process.env.TERM_PROGRAM === 'cursor',\n platform: 'Cursor',\n },\n {\n check: () =>\n process.env.WINDSURF === 'true' ||\n process.env.TERM_PROGRAM === 'windsurf',\n platform: 'Windsurf',\n },\n {\n check: () =>\n process.env.TRAE === 'true' || process.env.TERM_PROGRAM === 'trae',\n platform: 'Trae',\n },\n { check: () => process.env.TRAE_CN === 'true', platform: 'TraeCN' },\n {\n check: () =>\n process.env.VSCODE === 'true' || process.env.TERM_PROGRAM === 'vscode',\n platform: 'VSCode',\n },\n { check: () => process.env.OPENCODE === 'true', platform: 'OpenCode' },\n { check: () => process.env.CLAUDE === 'true', platform: 'Claude' },\n {\n check: () =>\n process.env.GITHUB_ACTIONS === 'true' || !!process.env.GITHUB_WORKSPACE,\n platform: 'GitHub',\n },\n];\n\nconst PLATFORM_OPTIONS: Array<{\n value: Platform;\n label: string;\n hint: string;\n}> = [\n { value: 'Cursor', label: 'Cursor', hint: '(.cursor/skills)' },\n { value: 'Windsurf', label: 'Windsurf', hint: '(.windsurf/skills)' },\n { value: 'Trae', label: 'Trae', hint: '(.trae/skills)' },\n { value: 'TraeCN', label: 'Trae CN', hint: '(.trae/skills)' },\n { value: 'VSCode', label: 'VS Code', hint: '(.github/skills)' },\n { value: 'OpenCode', label: 'OpenCode', hint: '(.opencode/skills)' },\n { value: 'Claude', label: 'Claude Code', hint: '(.claude/skills)' },\n {\n value: 'GitHub',\n label: 'GitHub Copilot Workspace',\n hint: '(.github/skills)',\n },\n { value: 'Antigravity', label: 'Antigravity', hint: '(.agent/skills)' },\n { value: 'Augment', label: 'Augment', hint: '(.augment/skills)' },\n { value: 'OpenClaw', label: 'OpenClaw', hint: '(skills)' },\n { value: 'Cline', label: 'Cline', hint: '(.cline/skills)' },\n { value: 'CodeBuddy', label: 'CodeBuddy', hint: '(.codebuddy/skills)' },\n {\n value: 'CommandCode',\n label: 'Command Code',\n hint: '(.commandcode/skills)',\n },\n { value: 'Continue', label: 'Continue', hint: '(.continue/skills)' },\n { value: 'Crush', label: 'Crush', hint: '(.crush/skills)' },\n { value: 'Droid', label: 'Droid', hint: '(.factory/skills)' },\n { value: 'Goose', label: 'Goose', hint: '(.goose/skills)' },\n { value: 'IFlow', label: 'iFlow CLI', hint: '(.iflow/skills)' },\n { value: 'Junie', label: 'Junie', hint: '(.junie/skills)' },\n { value: 'KiloCode', label: 'Kilo Code', hint: '(.kilocode/skills)' },\n { value: 'Kiro', label: 'Kiro CLI', hint: '(.kiro/skills)' },\n { value: 'Kode', label: 'Kode', hint: '(.kode/skills)' },\n { value: 'MCPJam', label: 'MCPJam', hint: '(.mcpjam/skills)' },\n { value: 'MistralVibe', label: 'Mistral Vibe', hint: '(.vibe/skills)' },\n { value: 'Mux', label: 'Mux', hint: '(.mux/skills)' },\n { value: 'OpenHands', label: 'OpenHands', hint: '(.openhands/skills)' },\n { value: 'Pi', label: 'Pi', hint: '(.pi/skills)' },\n { value: 'Qoder', label: 'Qoder', hint: '(.qoder/skills)' },\n { value: 'Qwen', label: 'Qwen Code', hint: '(.qwen/skills)' },\n { value: 'RooCode', label: 'Roo Code', hint: '(.roo/skills)' },\n { value: 'Zencoder', label: 'Zencoder', hint: '(.zencoder/skills)' },\n { value: 'Neovate', label: 'Neovate', hint: '(.neovate/skills)' },\n { value: 'Pochi', label: 'Pochi', hint: '(.pochi/skills)' },\n { value: 'Other', label: 'Other', hint: '(skills)' },\n];\n\n// --- Utilities ---\n\nexport const getDetectedPlatform = (): Platform | undefined =>\n PLATFORM_CHECKS.find(({ check }) => check())?.platform;\n\nfunction getDependencies(root: string): Record<string, string> {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return {};\n\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n return { ...dependencies, ...devDependencies };\n } catch {\n return {};\n }\n}\n\nfunction getInitialSkills(\n deps: Record<string, string>\n): (keyof typeof SKILLS_METADATA)[] {\n const skills: (keyof typeof SKILLS_METADATA)[] = [\n 'Usage',\n 'Config',\n 'Content',\n 'RemoteContent',\n 'Compiler',\n ];\n\n if (deps.react || deps.next) skills.push('React');\n if (deps.next) skills.push('NextJS');\n if (deps.preact) skills.push('Preact');\n if (deps['solid-js']) skills.push('Solid');\n if (deps.vue || deps.nuxt) skills.push('Vue');\n if (deps.svelte || deps['@sveltejs/kit']) skills.push('Svelte');\n if (deps.astro) skills.push('Astro');\n\n return skills;\n}\n\n// --- Main CLI Action ---\n\nexport const initSkills = async (projectRoot?: string) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer skills');\n\n const detectedPlatform = getDetectedPlatform();\n\n let platforms: Platform[];\n try {\n const response = await enquirer.prompt<{ platforms: Platform[] }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platforms are you using? (Type to search)',\n multiple: true,\n initial: detectedPlatform\n ? PLATFORM_OPTIONS.findIndex((p) => p.value === detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((p) => ({\n name: p.value,\n message: p.label,\n hint: p.hint,\n })),\n });\n platforms = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n\n if (!platforms || platforms.length === 0) {\n p.log.warn('No platform selected. Nothing to install.');\n return;\n }\n\n const dependencies = getDependencies(root);\n const initialValues = getInitialSkills(dependencies);\n\n const selectedSkills = await p.multiselect({\n message: 'Select the documentation skills to provide to your AI:',\n initialValues,\n options: SKILLS.map((skill) => ({\n value: skill,\n label: skill,\n hint: SKILLS_METADATA[skill],\n })),\n required: false,\n });\n\n if (\n p.isCancel(selectedSkills) ||\n !selectedSkills ||\n (selectedSkills as string[]).length === 0\n ) {\n p.cancel('Operation cancelled. No skills selected.');\n return;\n }\n\n const s = p.spinner();\n s.start('Installing skills...');\n\n try {\n const installPromises = platforms.map((platform) =>\n installSkills(\n root,\n platform,\n selectedSkills as (keyof typeof SKILLS_METADATA)[]\n )\n );\n\n const results = await Promise.all(installPromises);\n s.stop('Skills installed successfully');\n\n for (const result of results) {\n p.note(result, 'Success');\n }\n } catch (error) {\n s.stop('Failed to install skills');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer skills initialization complete');\n};\n"],"mappings":"uTAcA,MAAM,EAAuE,CAC3E,CACE,UACE,QAAQ,IAAI,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,CAEK,EAID,CACH,CAAE,MAAO,SAAU,MAAO,SAAU,KAAM,mBAAoB,CAC9D,CAAE,MAAO,WAAY,MAAO,WAAY,KAAM,qBAAsB,CACpE,CAAE,MAAO,OAAQ,MAAO,OAAQ,KAAM,iBAAkB,CACxD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.mjs
CHANGED
|
@@ -1,2 +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};
|
|
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`,`Compiler`];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
2
|
//# sourceMappingURL=initSkills.mjs.map
|
|
@@ -1 +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,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,CAEK,EAID,CACH,CAAE,MAAO,SAAU,MAAO,SAAU,KAAM,mBAAoB,CAC9D,CAAE,MAAO,WAAY,MAAO,WAAY,KAAM,qBAAsB,CACpE,CAAE,MAA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G,QAAQ,KAAK,CACnD,CAED,EAAE,MAAM,+BAA+B,CAEvC,IAAM,EAAmB,GAAqB,CAE1C,EACJ,GAAI,CAeF,GAdiB,MAAM,EAAS,OAAkC,CAChE,KAAM,eACN,KAAM,YACN,QAAS,kDACT,SAAU,GACV,QAAS,EACL,EAAiB,UAAW,GAAM,EAAE,QAAU,EAAiB,CAC/D,IAAA,GACJ,QAAS,EAAiB,IAAK,IAAO,CACpC,KAAM,EAAE,MACR,QAAS,EAAE,MACX,KAAM,EAAE,KACT,EAAE,CACJ,CAAC,EACmB,eACf,CACN,EAAE,OAAO,uBAAuB,CAChC,OAGF,GAAI,CAAC,GAAa,EAAU,SAAW,EAAG,CACxC,EAAE,IAAI,KAAK,4CAA4C,CACvD,OAIF,IAAM,EAAgB,EADD,EAAgB,EAAK,CACU,CAE9C,EAAiB,MAAM,EAAE,YAAY,CACzC,QAAS,yDACT,gBACA,QAAS,EAAO,IAAK,IAAW,CAC9B,MAAO,EACP,MAAO,EACP,KAAM,EAAgB,GACvB,EAAE,CACH,SAAU,GACX,CAAC,CAEF,GACE,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"}
|
|
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 'Compiler',\n ];\n\n if (deps.react || deps.next) skills.push('React');\n if (deps.next) skills.push('NextJS');\n if (deps.preact) skills.push('Preact');\n if (deps['solid-js']) skills.push('Solid');\n if (deps.vue || deps.nuxt) skills.push('Vue');\n if (deps.svelte || deps['@sveltejs/kit']) skills.push('Svelte');\n if (deps.astro) skills.push('Astro');\n\n return skills;\n}\n\n// --- Main CLI Action ---\n\nexport const initSkills = async (projectRoot?: string) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer skills');\n\n const detectedPlatform = getDetectedPlatform();\n\n let platforms: Platform[];\n try {\n const response = await enquirer.prompt<{ platforms: Platform[] }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platforms are you using? (Type to search)',\n multiple: true,\n initial: detectedPlatform\n ? PLATFORM_OPTIONS.findIndex((p) => p.value === detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((p) => ({\n name: p.value,\n message: p.label,\n hint: p.hint,\n })),\n });\n platforms = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n\n if (!platforms || platforms.length === 0) {\n p.log.warn('No platform selected. Nothing to install.');\n return;\n }\n\n const dependencies = getDependencies(root);\n const initialValues = getInitialSkills(dependencies);\n\n const selectedSkills = await p.multiselect({\n message: 'Select the documentation skills to provide to your AI:',\n initialValues,\n options: SKILLS.map((skill) => ({\n value: skill,\n label: skill,\n hint: SKILLS_METADATA[skill],\n })),\n required: false,\n });\n\n if (\n p.isCancel(selectedSkills) ||\n !selectedSkills ||\n (selectedSkills as string[]).length === 0\n ) {\n p.cancel('Operation cancelled. No skills selected.');\n return;\n }\n\n const s = p.spinner();\n s.start('Installing skills...');\n\n try {\n const installPromises = platforms.map((platform) =>\n installSkills(\n root,\n platform,\n selectedSkills as (keyof typeof SKILLS_METADATA)[]\n )\n );\n\n const results = await Promise.all(installPromises);\n s.stop('Skills installed successfully');\n\n for (const result of results) {\n p.note(result, 'Success');\n }\n } catch (error) {\n s.stop('Failed to install skills');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer skills initialization complete');\n};\n"],"mappings":"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,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,CAEK,EAID,CACH,CAAE,MAAO,SAAU,MAAO,SAAU,KAAM,mBAAoB,CAC9D,CAAE,MAAO,WAAY,MAAO,WAAY,KAAM,qBAAsB,CACpE,CAAE,MAAO,OAAQ,MAAO,OAAQ,KAAM,iBAAkB,CACxD,CAAE,MAAO,SAAU,MAAO,UAAW,KAAM,iBAAkB,CA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,GAAI,CAeF,GAdiB,MAAM,EAAS,OAAkC,CAChE,KAAM,eACN,KAAM,YACN,QAAS,kDACT,SAAU,GACV,QAAS,EACL,EAAiB,UAAW,GAAM,EAAE,QAAU,EAAiB,CAC/D,IAAA,GACJ,QAAS,EAAiB,IAAK,IAAO,CACpC,KAAM,EAAE,MACR,QAAS,EAAE,MACX,KAAM,EAAE,KACT,EAAE,CACJ,CAAC,EACmB,eACf,CACN,EAAE,OAAO,uBAAuB,CAChC,OAGF,GAAI,CAAC,GAAa,EAAU,SAAW,EAAG,CACxC,EAAE,IAAI,KAAK,4CAA4C,CACvD,OAIF,IAAM,EAAgB,EADD,EAAgB,EAAK,CACU,CAE9C,EAAiB,MAAM,EAAE,YAAY,CACzC,QAAS,yDACT,gBACA,QAAS,EAAO,IAAK,IAAW,CAC9B,MAAO,EACP,MAAO,EACP,KAAM,EAAgB,GACvB,EAAE,CACH,SAAU,GACX,CAAC,CAEF,GACE,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initSkills.d.ts","names":[],"sources":["../../src/initSkills.ts"],"mappings":";;;cAkGa,mBAAA,QAA0B,QAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"initSkills.d.ts","names":[],"sources":["../../src/initSkills.ts"],"mappings":";;;cAkGa,mBAAA,QAA0B,QAAA;AAAA,cAyC1B,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
|
+
"version": "8.1.7",
|
|
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": [
|
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
"./package.json"
|
|
50
50
|
],
|
|
51
51
|
"scripts": {
|
|
52
|
-
"_prepublish": "cp -f ../../../README.md ./README.md",
|
|
53
52
|
"build": "tsdown --config tsdown.config.ts",
|
|
54
53
|
"build:ci": "tsdown --config tsdown.config.ts",
|
|
55
54
|
"clean": "rimraf ./dist .turbo",
|
|
@@ -58,7 +57,7 @@
|
|
|
58
57
|
"format:fix": "biome format --write .",
|
|
59
58
|
"lint": "biome lint .",
|
|
60
59
|
"lint:fix": "biome lint --write .",
|
|
61
|
-
"prepublish": "
|
|
60
|
+
"prepublish": "cp -f ../../../README.md ./README.md",
|
|
62
61
|
"publish": "bun publish || true",
|
|
63
62
|
"publish:canary": "bun publish --access public --tag canary || true",
|
|
64
63
|
"publish:latest": "bun publish --access public --tag latest || true",
|
|
@@ -68,15 +67,15 @@
|
|
|
68
67
|
},
|
|
69
68
|
"dependencies": {
|
|
70
69
|
"@clack/prompts": "0.11.0",
|
|
71
|
-
"@intlayer/ai": "8.1.
|
|
72
|
-
"@intlayer/api": "8.1.
|
|
73
|
-
"@intlayer/chokidar": "8.1.
|
|
74
|
-
"@intlayer/config": "8.1.
|
|
75
|
-
"@intlayer/core": "8.1.
|
|
76
|
-
"@intlayer/dictionaries-entry": "8.1.
|
|
77
|
-
"@intlayer/remote-dictionaries-entry": "8.1.
|
|
78
|
-
"@intlayer/types": "8.1.
|
|
79
|
-
"@intlayer/unmerged-dictionaries-entry": "8.1.
|
|
70
|
+
"@intlayer/ai": "8.1.7",
|
|
71
|
+
"@intlayer/api": "8.1.7",
|
|
72
|
+
"@intlayer/chokidar": "8.1.7",
|
|
73
|
+
"@intlayer/config": "8.1.7",
|
|
74
|
+
"@intlayer/core": "8.1.7",
|
|
75
|
+
"@intlayer/dictionaries-entry": "8.1.7",
|
|
76
|
+
"@intlayer/remote-dictionaries-entry": "8.1.7",
|
|
77
|
+
"@intlayer/types": "8.1.7",
|
|
78
|
+
"@intlayer/unmerged-dictionaries-entry": "8.1.7",
|
|
80
79
|
"commander": "14.0.3",
|
|
81
80
|
"enquirer": "^2.4.1",
|
|
82
81
|
"eventsource": "4.1.0",
|
|
@@ -93,7 +92,7 @@
|
|
|
93
92
|
"vitest": "4.0.18"
|
|
94
93
|
},
|
|
95
94
|
"peerDependencies": {
|
|
96
|
-
"@intlayer/ai": "8.1.
|
|
95
|
+
"@intlayer/ai": "8.1.7"
|
|
97
96
|
},
|
|
98
97
|
"peerDependenciesMeta": {
|
|
99
98
|
"@intlayer/ai": {
|