@intlayer/cli 8.1.0 → 8.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/init.cjs +242 -43
- package/dist/cjs/init.cjs.map +1 -1
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/init.mjs +242 -44
- package/dist/esm/init.mjs.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/init.d.ts +4 -1
- package/dist/types/init.d.ts.map +1 -1
- package/package.json +12 -11
package/dist/cjs/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ exports.build = require_build.build;
|
|
|
20
20
|
exports.dirname = require_cli.dirname;
|
|
21
21
|
exports.extract = require_extract.extract;
|
|
22
22
|
exports.fill = require_fill_fill.fill;
|
|
23
|
+
exports.getDetectedPlatform = require_init.getDetectedPlatform;
|
|
23
24
|
exports.init = require_init.init;
|
|
24
25
|
exports.initSkills = require_init.initSkills;
|
|
25
26
|
exports.listContentDeclaration = require_listContentDeclaration.listContentDeclaration;
|
package/dist/cjs/init.cjs
CHANGED
|
@@ -5,6 +5,7 @@ let node_path = require("node:path");
|
|
|
5
5
|
let node_fs = require("node:fs");
|
|
6
6
|
let _clack_prompts = require("@clack/prompts");
|
|
7
7
|
_clack_prompts = require_runtime.__toESM(_clack_prompts);
|
|
8
|
+
let enquirer = require("enquirer");
|
|
8
9
|
|
|
9
10
|
//#region src/init.ts
|
|
10
11
|
const findProjectRoot = (startDir) => {
|
|
@@ -18,54 +19,245 @@ const findProjectRoot = (startDir) => {
|
|
|
18
19
|
const init = async (projectRoot) => {
|
|
19
20
|
await (0, _intlayer_chokidar.initIntlayer)(projectRoot ? findProjectRoot((0, node_path.resolve)(projectRoot)) : findProjectRoot(process.cwd()));
|
|
20
21
|
};
|
|
22
|
+
const PLATFORM_CHECKS = [
|
|
23
|
+
{
|
|
24
|
+
check: () => process.env.CURSOR === "true" || process.env.TERM_PROGRAM === "cursor",
|
|
25
|
+
platform: "Cursor"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
check: () => process.env.WINDSURF === "true" || process.env.TERM_PROGRAM === "windsurf",
|
|
29
|
+
platform: "Windsurf"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
check: () => process.env.TRAE === "true" || process.env.TERM_PROGRAM === "trae",
|
|
33
|
+
platform: "Trae"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
check: () => process.env.TRAE_CN === "true",
|
|
37
|
+
platform: "TraeCN"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
check: () => process.env.VSCODE === "true" || process.env.TERM_PROGRAM === "vscode",
|
|
41
|
+
platform: "VSCode"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
check: () => process.env.OPENCODE === "true",
|
|
45
|
+
platform: "OpenCode"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
check: () => process.env.CLAUDE === "true",
|
|
49
|
+
platform: "Claude"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
check: () => process.env.GITHUB_ACTIONS === "true" || !!process.env.GITHUB_WORKSPACE,
|
|
53
|
+
platform: "GitHub"
|
|
54
|
+
}
|
|
55
|
+
];
|
|
56
|
+
const getDetectedPlatform = () => PLATFORM_CHECKS.find(({ check }) => check())?.platform;
|
|
21
57
|
const initSkills = async (projectRoot) => {
|
|
22
58
|
const root = projectRoot ? findProjectRoot((0, node_path.resolve)(projectRoot)) : findProjectRoot(process.cwd());
|
|
23
59
|
_clack_prompts.intro("Initializing Intlayer skills");
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
const detectedPlatform = getDetectedPlatform();
|
|
61
|
+
const PLATFORM_OPTIONS = [
|
|
62
|
+
{
|
|
63
|
+
value: "Cursor",
|
|
64
|
+
label: "Cursor",
|
|
65
|
+
hint: "(.cursor/skills)"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
value: "Windsurf",
|
|
69
|
+
label: "Windsurf",
|
|
70
|
+
hint: "(.windsurf/skills)"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
value: "Trae",
|
|
74
|
+
label: "Trae",
|
|
75
|
+
hint: "(.trae/skills)"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
value: "TraeCN",
|
|
79
|
+
label: "Trae CN",
|
|
80
|
+
hint: "(.trae/skills)"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
value: "VSCode",
|
|
84
|
+
label: "VS Code",
|
|
85
|
+
hint: "(.github/skills)"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
value: "OpenCode",
|
|
89
|
+
label: "OpenCode",
|
|
90
|
+
hint: "(.opencode/skills)"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
value: "Claude",
|
|
94
|
+
label: "Claude Code",
|
|
95
|
+
hint: "(.claude/skills)"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
value: "GitHub",
|
|
99
|
+
label: "GitHub Copilot Workspace",
|
|
100
|
+
hint: "(.github/skills)"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
value: "Antigravity",
|
|
104
|
+
label: "Antigravity",
|
|
105
|
+
hint: "(.agent/skills)"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
value: "Augment",
|
|
109
|
+
label: "Augment",
|
|
110
|
+
hint: "(.augment/skills)"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
value: "OpenClaw",
|
|
114
|
+
label: "OpenClaw",
|
|
115
|
+
hint: "(skills)"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
value: "Cline",
|
|
119
|
+
label: "Cline",
|
|
120
|
+
hint: "(.cline/skills)"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
value: "CodeBuddy",
|
|
124
|
+
label: "CodeBuddy",
|
|
125
|
+
hint: "(.codebuddy/skills)"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
value: "CommandCode",
|
|
129
|
+
label: "Command Code",
|
|
130
|
+
hint: "(.commandcode/skills)"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
value: "Continue",
|
|
134
|
+
label: "Continue",
|
|
135
|
+
hint: "(.continue/skills)"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
value: "Crush",
|
|
139
|
+
label: "Crush",
|
|
140
|
+
hint: "(.crush/skills)"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
value: "Droid",
|
|
144
|
+
label: "Droid",
|
|
145
|
+
hint: "(.factory/skills)"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
value: "Goose",
|
|
149
|
+
label: "Goose",
|
|
150
|
+
hint: "(.goose/skills)"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
value: "IFlow",
|
|
154
|
+
label: "iFlow CLI",
|
|
155
|
+
hint: "(.iflow/skills)"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
value: "Junie",
|
|
159
|
+
label: "Junie",
|
|
160
|
+
hint: "(.junie/skills)"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
value: "KiloCode",
|
|
164
|
+
label: "Kilo Code",
|
|
165
|
+
hint: "(.kilocode/skills)"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
value: "Kiro",
|
|
169
|
+
label: "Kiro CLI",
|
|
170
|
+
hint: "(.kiro/skills)"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
value: "Kode",
|
|
174
|
+
label: "Kode",
|
|
175
|
+
hint: "(.kode/skills)"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
value: "MCPJam",
|
|
179
|
+
label: "MCPJam",
|
|
180
|
+
hint: "(.mcpjam/skills)"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
value: "MistralVibe",
|
|
184
|
+
label: "Mistral Vibe",
|
|
185
|
+
hint: "(.vibe/skills)"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
value: "Mux",
|
|
189
|
+
label: "Mux",
|
|
190
|
+
hint: "(.mux/skills)"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
value: "OpenHands",
|
|
194
|
+
label: "OpenHands",
|
|
195
|
+
hint: "(.openhands/skills)"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
value: "Pi",
|
|
199
|
+
label: "Pi",
|
|
200
|
+
hint: "(.pi/skills)"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
value: "Qoder",
|
|
204
|
+
label: "Qoder",
|
|
205
|
+
hint: "(.qoder/skills)"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
value: "Qwen",
|
|
209
|
+
label: "Qwen Code",
|
|
210
|
+
hint: "(.qwen/skills)"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
value: "RooCode",
|
|
214
|
+
label: "Roo Code",
|
|
215
|
+
hint: "(.roo/skills)"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
value: "Zencoder",
|
|
219
|
+
label: "Zencoder",
|
|
220
|
+
hint: "(.zencoder/skills)"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
value: "Neovate",
|
|
224
|
+
label: "Neovate",
|
|
225
|
+
hint: "(.neovate/skills)"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
value: "Pochi",
|
|
229
|
+
label: "Pochi",
|
|
230
|
+
hint: "(.pochi/skills)"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
value: "Other",
|
|
234
|
+
label: "Other",
|
|
235
|
+
hint: "(skills)"
|
|
236
|
+
}
|
|
237
|
+
];
|
|
238
|
+
const prompt = new enquirer.AutoComplete({
|
|
239
|
+
name: "platforms",
|
|
240
|
+
message: "Which platforms are you using?",
|
|
241
|
+
limit: 10,
|
|
242
|
+
initial: detectedPlatform ? PLATFORM_OPTIONS.findIndex((p) => p.value === detectedPlatform) : void 0,
|
|
243
|
+
multiple: true,
|
|
244
|
+
choices: PLATFORM_OPTIONS.map((p) => ({
|
|
245
|
+
name: p.value,
|
|
246
|
+
message: p.label,
|
|
247
|
+
hint: p.hint
|
|
248
|
+
}))
|
|
64
249
|
});
|
|
65
|
-
|
|
250
|
+
let platforms;
|
|
251
|
+
try {
|
|
252
|
+
platforms = await prompt.run();
|
|
253
|
+
} catch (error) {
|
|
66
254
|
_clack_prompts.cancel("Operation cancelled");
|
|
67
255
|
return;
|
|
68
256
|
}
|
|
257
|
+
if (platforms.length === 0) {
|
|
258
|
+
_clack_prompts.log.warn("No platform selected. Nothing to install.");
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
69
261
|
let dependencies = {};
|
|
70
262
|
try {
|
|
71
263
|
const packageJsonPath = (0, node_path.join)(root, "package.json");
|
|
@@ -85,6 +277,8 @@ const initSkills = async (projectRoot) => {
|
|
|
85
277
|
];
|
|
86
278
|
if (dependencies.react || dependencies.next) initialValues.push("React");
|
|
87
279
|
if (dependencies.next) initialValues.push("NextJS");
|
|
280
|
+
if (dependencies.preact) initialValues.push("Preact");
|
|
281
|
+
if (dependencies["solid-js"]) initialValues.push("Solid");
|
|
88
282
|
if (dependencies.vue || dependencies.nuxt) initialValues.push("Vue");
|
|
89
283
|
if (dependencies.svelte || dependencies["@sveltejs/kit"]) initialValues.push("Svelte");
|
|
90
284
|
if (dependencies.astro) initialValues.push("Astro");
|
|
@@ -108,9 +302,13 @@ const initSkills = async (projectRoot) => {
|
|
|
108
302
|
const s = _clack_prompts.spinner();
|
|
109
303
|
s.start("Installing skills...");
|
|
110
304
|
try {
|
|
111
|
-
const
|
|
305
|
+
const results = [];
|
|
306
|
+
for (const platform of platforms) {
|
|
307
|
+
const result = await (0, _intlayer_chokidar.installSkills)(root, platform, selectedSkills);
|
|
308
|
+
results.push(result);
|
|
309
|
+
}
|
|
112
310
|
s.stop("Skills installed successfully");
|
|
113
|
-
_clack_prompts.note(result, "Success");
|
|
311
|
+
for (const result of results) _clack_prompts.note(result, "Success");
|
|
114
312
|
} catch (error) {
|
|
115
313
|
s.stop("Failed to install skills");
|
|
116
314
|
_clack_prompts.log.error(String(error));
|
|
@@ -119,6 +317,7 @@ const initSkills = async (projectRoot) => {
|
|
|
119
317
|
};
|
|
120
318
|
|
|
121
319
|
//#endregion
|
|
320
|
+
exports.getDetectedPlatform = getDetectedPlatform;
|
|
122
321
|
exports.init = init;
|
|
123
322
|
exports.initSkills = initSkills;
|
|
124
323
|
//# sourceMappingURL=init.cjs.map
|
package/dist/cjs/init.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.cjs","names":["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';\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\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 platform\n let detectedPlatform: Platform = 'Other';\n\n if (process.env.OPENCODE) {\n detectedPlatform = 'OpenCode';\n } else if (process.env.CLAUDE_CODE) {\n detectedPlatform = 'Claude';\n } else if (existsSync(join(root, 'claude', 'skills'))) {\n detectedPlatform = 'Claude';\n } else if (existsSync(join(root, '.windsurf'))) {\n detectedPlatform = 'Windsurf';\n } else if (existsSync(join(root, '.cursorrules'))) {\n detectedPlatform = 'Cursor';\n } else if (process.env.TERM_PROGRAM === 'vscode') {\n detectedPlatform = 'VSCode';\n }\n\n // Confirm or choose platform\n const platform = (await p.select({\n message: 'Which platform are you using?',\n initialValue: detectedPlatform,\n options: [\n { value: 'Cursor', label: 'Cursor' },\n { value: 'Windsurf', label: 'Windsurf' },\n { value: 'VSCode', label: 'VS Code' },\n { value: 'OpenCode', label: 'OpenCode' },\n { value: 'GitHub', label: 'GitHub Copilot Workspace' },\n { value: 'Claude', label: 'Claude Code' },\n { value: 'Other', label: 'Other' },\n ],\n })) as Platform;\n\n if (p.isCancel(platform)) {\n p.cancel('Operation cancelled');\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.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\n const s = p.spinner();\n s.start('Installing skills...');\n try {\n const result = await installSkills(root, platform, selectedSkills);\n s.stop('Skills installed successfully');\n\n // 6. Show success message\n p.note(result, 'Success');\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":";;;;;;;;;AAWA,MAAM,mBAAmB,aAAqB;CAC5C,IAAI,aAAa;AAEjB,QAAO,sCAAuB,YAAY,KAAK,EAAE;AAC/C,kDAAoB,YAAY,eAAe,CAAC,CAC9C,QAAO;AAET,sCAAqB,YAAY,KAAK;;AAKxC,QAAO;;AAGT,MAAa,OAAO,OAAO,gBAAyB;AAKlD,4CAJa,cACT,uCAAwB,YAAY,CAAC,GACrC,gBAAgB,QAAQ,KAAK,CAAC,CAEV;;AAG1B,MAAa,aAAa,OAAO,gBAAyB;CACxD,MAAM,OAAO,cACT,uCAAwB,YAAY,CAAC,GACrC,gBAAgB,QAAQ,KAAK,CAAC;AAElC,gBAAE,MAAM,+BAA+B;CAGvC,IAAI,mBAA6B;AAEjC,KAAI,QAAQ,IAAI,SACd,oBAAmB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OAAO;GACP,MAAMC,mCAAgB;GACvB,EAAE;EACJ,CAAC;AAEF,KAAIF,eAAE,SAAS,eAAe,EAAE;AAC9B,iBAAE,OAAO,sBAAsB;AAC/B;;AAGF,KAAI,eAAe,WAAW,GAAG;AAC/B,iBAAE,IAAI,KAAK,0CAA0C;AACrD;;CAIF,MAAM,IAAIA,eAAE,SAAS;AACrB,GAAE,MAAM,uBAAuB;AAC/B,KAAI;EACF,MAAM,SAAS,4CAAoB,MAAM,UAAU,eAAe;AAClE,IAAE,KAAK,gCAAgC;AAGvC,iBAAE,KAAK,QAAQ,UAAU;UAClB,OAAO;AACd,IAAE,KAAK,2BAA2B;AAClC,iBAAE,IAAI,MAAM,OAAO,MAAM,CAAC;;AAG5B,gBAAE,MAAM,0CAA0C"}
|
|
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';\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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ACf,eAAc,KAAK,SAAS;AAE9B,KAAI,aAAa,OACf,eAAc,KAAK,SAAS;AAE9B,KAAI,aAAa,YACf,eAAc,KAAK,QAAQ;AAE7B,KAAI,aAAa,OAAO,aAAa,KACnC,eAAc,KAAK,MAAM;AAE3B,KAAI,aAAa,UAAU,aAAa,iBACtC,eAAc,KAAK,SAAS;AAE9B,KAAI,aAAa,MACf,eAAc,KAAK,QAAQ;CAI7B,MAAM,iBAAkB,MAAMC,eAAE,YAAY;EAC1C,SAAS;EACT;EACA,SAASC,0BAAO,KAAK,WAAW;GAC9B,OAAO;GACP,OAAO;GACP,MAAMC,mCAAgB;GACvB,EAAE;EACJ,CAAC;AAEF,KAAIF,eAAE,SAAS,eAAe,EAAE;AAC9B,iBAAE,OAAO,sBAAsB;AAC/B;;AAGF,KAAI,eAAe,WAAW,GAAG;AAC/B,iBAAE,IAAI,KAAK,0CAA0C;AACrD;;CAIF,MAAM,IAAIA,eAAE,SAAS;AACrB,GAAE,MAAM,uBAAuB;AAC/B,KAAI;EACF,MAAM,UAAoB,EAAE;AAC5B,OAAK,MAAM,YAAY,WAAW;GAChC,MAAM,SAAS,4CAAoB,MAAM,UAAU,eAAe;AAClE,WAAQ,KAAK,OAAO;;AAEtB,IAAE,KAAK,gCAAgC;AAGvC,OAAK,MAAM,UAAU,QACnB,gBAAE,KAAK,QAAQ,UAAU;UAEpB,OAAO;AACd,IAAE,KAAK,2BAA2B;AAClC,iBAAE,IAAI,MAAM,OAAO,MAAM,CAAC;;AAG5B,gBAAE,MAAM,0CAA0C"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { extract } from "./extract.mjs";
|
|
|
4
4
|
import { listMissingTranslations, listMissingTranslationsWithConfig } from "./test/listMissingTranslations.mjs";
|
|
5
5
|
import { testMissingTranslations } from "./test/test.mjs";
|
|
6
6
|
import { fill } from "./fill/fill.mjs";
|
|
7
|
-
import { init, initSkills } from "./init.mjs";
|
|
7
|
+
import { getDetectedPlatform, init, initSkills } from "./init.mjs";
|
|
8
8
|
import { listContentDeclaration, listContentDeclarationRows } from "./listContentDeclaration.mjs";
|
|
9
9
|
import { liveSync } from "./liveSync.mjs";
|
|
10
10
|
import { pull } from "./pull.mjs";
|
|
@@ -15,4 +15,4 @@ import { searchDoc } from "./searchDoc.mjs";
|
|
|
15
15
|
import { translateDoc } from "./translateDoc/translateDoc.mjs";
|
|
16
16
|
import { dirname, setAPI } from "./cli.mjs";
|
|
17
17
|
|
|
18
|
-
export { build, dirname, extract, fill, init, initSkills, listContentDeclaration, listContentDeclarationRows, listMissingTranslations, listMissingTranslationsWithConfig, liveSync, pull, push, pushConfig, reviewDoc, searchDoc, setAPI, startEditor, testMissingTranslations, translateDoc };
|
|
18
|
+
export { build, dirname, extract, fill, getDetectedPlatform, init, initSkills, listContentDeclaration, listContentDeclarationRows, listMissingTranslations, listMissingTranslationsWithConfig, liveSync, pull, push, pushConfig, reviewDoc, searchDoc, setAPI, startEditor, testMissingTranslations, translateDoc };
|
package/dist/esm/init.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { SKILLS, SKILLS_METADATA, initIntlayer, installSkills } from "@intlayer/
|
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import * as p from "@clack/prompts";
|
|
5
|
+
import { AutoComplete } from "enquirer";
|
|
5
6
|
|
|
6
7
|
//#region src/init.ts
|
|
7
8
|
const findProjectRoot = (startDir) => {
|
|
@@ -15,54 +16,245 @@ const findProjectRoot = (startDir) => {
|
|
|
15
16
|
const init = async (projectRoot) => {
|
|
16
17
|
await initIntlayer(projectRoot ? findProjectRoot(resolve(projectRoot)) : findProjectRoot(process.cwd()));
|
|
17
18
|
};
|
|
19
|
+
const PLATFORM_CHECKS = [
|
|
20
|
+
{
|
|
21
|
+
check: () => process.env.CURSOR === "true" || process.env.TERM_PROGRAM === "cursor",
|
|
22
|
+
platform: "Cursor"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
check: () => process.env.WINDSURF === "true" || process.env.TERM_PROGRAM === "windsurf",
|
|
26
|
+
platform: "Windsurf"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
check: () => process.env.TRAE === "true" || process.env.TERM_PROGRAM === "trae",
|
|
30
|
+
platform: "Trae"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
check: () => process.env.TRAE_CN === "true",
|
|
34
|
+
platform: "TraeCN"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
check: () => process.env.VSCODE === "true" || process.env.TERM_PROGRAM === "vscode",
|
|
38
|
+
platform: "VSCode"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
check: () => process.env.OPENCODE === "true",
|
|
42
|
+
platform: "OpenCode"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
check: () => process.env.CLAUDE === "true",
|
|
46
|
+
platform: "Claude"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
check: () => process.env.GITHUB_ACTIONS === "true" || !!process.env.GITHUB_WORKSPACE,
|
|
50
|
+
platform: "GitHub"
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
const getDetectedPlatform = () => PLATFORM_CHECKS.find(({ check }) => check())?.platform;
|
|
18
54
|
const initSkills = async (projectRoot) => {
|
|
19
55
|
const root = projectRoot ? findProjectRoot(resolve(projectRoot)) : findProjectRoot(process.cwd());
|
|
20
56
|
p.intro("Initializing Intlayer skills");
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
const detectedPlatform = getDetectedPlatform();
|
|
58
|
+
const PLATFORM_OPTIONS = [
|
|
59
|
+
{
|
|
60
|
+
value: "Cursor",
|
|
61
|
+
label: "Cursor",
|
|
62
|
+
hint: "(.cursor/skills)"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
value: "Windsurf",
|
|
66
|
+
label: "Windsurf",
|
|
67
|
+
hint: "(.windsurf/skills)"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
value: "Trae",
|
|
71
|
+
label: "Trae",
|
|
72
|
+
hint: "(.trae/skills)"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
value: "TraeCN",
|
|
76
|
+
label: "Trae CN",
|
|
77
|
+
hint: "(.trae/skills)"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
value: "VSCode",
|
|
81
|
+
label: "VS Code",
|
|
82
|
+
hint: "(.github/skills)"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
value: "OpenCode",
|
|
86
|
+
label: "OpenCode",
|
|
87
|
+
hint: "(.opencode/skills)"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
value: "Claude",
|
|
91
|
+
label: "Claude Code",
|
|
92
|
+
hint: "(.claude/skills)"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
value: "GitHub",
|
|
96
|
+
label: "GitHub Copilot Workspace",
|
|
97
|
+
hint: "(.github/skills)"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
value: "Antigravity",
|
|
101
|
+
label: "Antigravity",
|
|
102
|
+
hint: "(.agent/skills)"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
value: "Augment",
|
|
106
|
+
label: "Augment",
|
|
107
|
+
hint: "(.augment/skills)"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
value: "OpenClaw",
|
|
111
|
+
label: "OpenClaw",
|
|
112
|
+
hint: "(skills)"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
value: "Cline",
|
|
116
|
+
label: "Cline",
|
|
117
|
+
hint: "(.cline/skills)"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
value: "CodeBuddy",
|
|
121
|
+
label: "CodeBuddy",
|
|
122
|
+
hint: "(.codebuddy/skills)"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
value: "CommandCode",
|
|
126
|
+
label: "Command Code",
|
|
127
|
+
hint: "(.commandcode/skills)"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
value: "Continue",
|
|
131
|
+
label: "Continue",
|
|
132
|
+
hint: "(.continue/skills)"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
value: "Crush",
|
|
136
|
+
label: "Crush",
|
|
137
|
+
hint: "(.crush/skills)"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
value: "Droid",
|
|
141
|
+
label: "Droid",
|
|
142
|
+
hint: "(.factory/skills)"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
value: "Goose",
|
|
146
|
+
label: "Goose",
|
|
147
|
+
hint: "(.goose/skills)"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
value: "IFlow",
|
|
151
|
+
label: "iFlow CLI",
|
|
152
|
+
hint: "(.iflow/skills)"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
value: "Junie",
|
|
156
|
+
label: "Junie",
|
|
157
|
+
hint: "(.junie/skills)"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
value: "KiloCode",
|
|
161
|
+
label: "Kilo Code",
|
|
162
|
+
hint: "(.kilocode/skills)"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
value: "Kiro",
|
|
166
|
+
label: "Kiro CLI",
|
|
167
|
+
hint: "(.kiro/skills)"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
value: "Kode",
|
|
171
|
+
label: "Kode",
|
|
172
|
+
hint: "(.kode/skills)"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
value: "MCPJam",
|
|
176
|
+
label: "MCPJam",
|
|
177
|
+
hint: "(.mcpjam/skills)"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
value: "MistralVibe",
|
|
181
|
+
label: "Mistral Vibe",
|
|
182
|
+
hint: "(.vibe/skills)"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
value: "Mux",
|
|
186
|
+
label: "Mux",
|
|
187
|
+
hint: "(.mux/skills)"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
value: "OpenHands",
|
|
191
|
+
label: "OpenHands",
|
|
192
|
+
hint: "(.openhands/skills)"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
value: "Pi",
|
|
196
|
+
label: "Pi",
|
|
197
|
+
hint: "(.pi/skills)"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
value: "Qoder",
|
|
201
|
+
label: "Qoder",
|
|
202
|
+
hint: "(.qoder/skills)"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
value: "Qwen",
|
|
206
|
+
label: "Qwen Code",
|
|
207
|
+
hint: "(.qwen/skills)"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
value: "RooCode",
|
|
211
|
+
label: "Roo Code",
|
|
212
|
+
hint: "(.roo/skills)"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
value: "Zencoder",
|
|
216
|
+
label: "Zencoder",
|
|
217
|
+
hint: "(.zencoder/skills)"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
value: "Neovate",
|
|
221
|
+
label: "Neovate",
|
|
222
|
+
hint: "(.neovate/skills)"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
value: "Pochi",
|
|
226
|
+
label: "Pochi",
|
|
227
|
+
hint: "(.pochi/skills)"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
value: "Other",
|
|
231
|
+
label: "Other",
|
|
232
|
+
hint: "(skills)"
|
|
233
|
+
}
|
|
234
|
+
];
|
|
235
|
+
const prompt = new AutoComplete({
|
|
236
|
+
name: "platforms",
|
|
237
|
+
message: "Which platforms are you using?",
|
|
238
|
+
limit: 10,
|
|
239
|
+
initial: detectedPlatform ? PLATFORM_OPTIONS.findIndex((p) => p.value === detectedPlatform) : void 0,
|
|
240
|
+
multiple: true,
|
|
241
|
+
choices: PLATFORM_OPTIONS.map((p) => ({
|
|
242
|
+
name: p.value,
|
|
243
|
+
message: p.label,
|
|
244
|
+
hint: p.hint
|
|
245
|
+
}))
|
|
61
246
|
});
|
|
62
|
-
|
|
247
|
+
let platforms;
|
|
248
|
+
try {
|
|
249
|
+
platforms = await prompt.run();
|
|
250
|
+
} catch (error) {
|
|
63
251
|
p.cancel("Operation cancelled");
|
|
64
252
|
return;
|
|
65
253
|
}
|
|
254
|
+
if (platforms.length === 0) {
|
|
255
|
+
p.log.warn("No platform selected. Nothing to install.");
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
66
258
|
let dependencies = {};
|
|
67
259
|
try {
|
|
68
260
|
const packageJsonPath = join(root, "package.json");
|
|
@@ -82,6 +274,8 @@ const initSkills = async (projectRoot) => {
|
|
|
82
274
|
];
|
|
83
275
|
if (dependencies.react || dependencies.next) initialValues.push("React");
|
|
84
276
|
if (dependencies.next) initialValues.push("NextJS");
|
|
277
|
+
if (dependencies.preact) initialValues.push("Preact");
|
|
278
|
+
if (dependencies["solid-js"]) initialValues.push("Solid");
|
|
85
279
|
if (dependencies.vue || dependencies.nuxt) initialValues.push("Vue");
|
|
86
280
|
if (dependencies.svelte || dependencies["@sveltejs/kit"]) initialValues.push("Svelte");
|
|
87
281
|
if (dependencies.astro) initialValues.push("Astro");
|
|
@@ -105,9 +299,13 @@ const initSkills = async (projectRoot) => {
|
|
|
105
299
|
const s = p.spinner();
|
|
106
300
|
s.start("Installing skills...");
|
|
107
301
|
try {
|
|
108
|
-
const
|
|
302
|
+
const results = [];
|
|
303
|
+
for (const platform of platforms) {
|
|
304
|
+
const result = await installSkills(root, platform, selectedSkills);
|
|
305
|
+
results.push(result);
|
|
306
|
+
}
|
|
109
307
|
s.stop("Skills installed successfully");
|
|
110
|
-
p.note(result, "Success");
|
|
308
|
+
for (const result of results) p.note(result, "Success");
|
|
111
309
|
} catch (error) {
|
|
112
310
|
s.stop("Failed to install skills");
|
|
113
311
|
p.log.error(String(error));
|
|
@@ -116,5 +314,5 @@ const initSkills = async (projectRoot) => {
|
|
|
116
314
|
};
|
|
117
315
|
|
|
118
316
|
//#endregion
|
|
119
|
-
export { init, initSkills };
|
|
317
|
+
export { getDetectedPlatform, init, initSkills };
|
|
120
318
|
//# 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';\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\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 platform\n let detectedPlatform: Platform = 'Other';\n\n if (process.env.OPENCODE) {\n detectedPlatform = 'OpenCode';\n } else if (process.env.CLAUDE_CODE) {\n detectedPlatform = 'Claude';\n } else if (existsSync(join(root, 'claude', 'skills'))) {\n detectedPlatform = 'Claude';\n } else if (existsSync(join(root, '.windsurf'))) {\n detectedPlatform = 'Windsurf';\n } else if (existsSync(join(root, '.cursorrules'))) {\n detectedPlatform = 'Cursor';\n } else if (process.env.TERM_PROGRAM === 'vscode') {\n detectedPlatform = 'VSCode';\n }\n\n // Confirm or choose platform\n const platform = (await p.select({\n message: 'Which platform are you using?',\n initialValue: detectedPlatform,\n options: [\n { value: 'Cursor', label: 'Cursor' },\n { value: 'Windsurf', label: 'Windsurf' },\n { value: 'VSCode', label: 'VS Code' },\n { value: 'OpenCode', label: 'OpenCode' },\n { value: 'GitHub', label: 'GitHub Copilot Workspace' },\n { value: 'Claude', label: 'Claude Code' },\n { value: 'Other', label: 'Other' },\n ],\n })) as Platform;\n\n if (p.isCancel(platform)) {\n p.cancel('Operation cancelled');\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.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\n const s = p.spinner();\n s.start('Installing skills...');\n try {\n const result = await installSkills(root, platform, selectedSkills);\n s.stop('Skills installed successfully');\n\n // 6. Show success message\n p.note(result, 'Success');\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":";;;;;;AAWA,MAAM,mBAAmB,aAAqB;CAC5C,IAAI,aAAa;AAEjB,QAAO,eAAe,QAAQ,YAAY,KAAK,EAAE;AAC/C,MAAI,WAAW,KAAK,YAAY,eAAe,CAAC,CAC9C,QAAO;AAET,eAAa,QAAQ,YAAY,KAAK;;AAKxC,QAAO;;AAGT,MAAa,OAAO,OAAO,gBAAyB;AAKlD,OAAM,aAJO,cACT,gBAAgB,QAAQ,YAAY,CAAC,GACrC,gBAAgB,QAAQ,KAAK,CAAC,CAEV;;AAG1B,MAAa,aAAa,OAAO,gBAAyB;CACxD,MAAM,OAAO,cACT,gBAAgB,QAAQ,YAAY,CAAC,GACrC,gBAAgB,QAAQ,KAAK,CAAC;AAElC,GAAE,MAAM,+BAA+B;CAGvC,IAAI,mBAA6B;AAEjC,KAAI,QAAQ,IAAI,SACd,oBAAmB;UACV,QAAQ,IAAI,YACrB,oBAAmB;UACV,WAAW,KAAK,MAAM,UAAU,SAAS,CAAC,CACnD,oBAAmB;UACV,WAAW,KAAK,MAAM,YAAY,CAAC,CAC5C,oBAAmB;UACV,WAAW,KAAK,MAAM,e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AGF,KAAI,eAAe,WAAW,GAAG;AAC/B,IAAE,IAAI,KAAK,0CAA0C;AACrD;;CAIF,MAAM,IAAI,EAAE,SAAS;AACrB,GAAE,MAAM,uBAAuB;AAC/B,KAAI;EACF,MAAM,SAAS,MAAM,cAAc,MAAM,UAAU,eAAe;AAClE,IAAE,KAAK,gCAAgC;AAGvC,IAAE,KAAK,QAAQ,UAAU;UAClB,OAAO;AACd,IAAE,KAAK,2BAA2B;AAClC,IAAE,IAAI,MAAM,OAAO,MAAM,CAAC;;AAG5B,GAAE,MAAM,0CAA0C"}
|
|
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';\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":";;;;;;;AAaA,MAAM,mBAAmB,aAAqB;CAC5C,IAAI,aAAa;AAEjB,QAAO,eAAe,QAAQ,YAAY,KAAK,EAAE;AAC/C,MAAI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AI,aAAa,OAAO,aAAa,KACnC,eAAc,KAAK,MAAM;AAE3B,KAAI,aAAa,UAAU,aAAa,iBACtC,eAAc,KAAK,SAAS;AAE9B,KAAI,aAAa,MACf,eAAc,KAAK,QAAQ;CAI7B,MAAM,iBAAkB,MAAM,EAAE,YAAY;EAC1C,SAAS;EACT;EACA,SAAS,OAAO,KAAK,WAAW;GAC9B,OAAO;GACP,OAAO;GACP,MAAM,gBAAgB;GACvB,EAAE;EACJ,CAAC;AAEF,KAAI,EAAE,SAAS,eAAe,EAAE;AAC9B,IAAE,OAAO,sBAAsB;AAC/B;;AAGF,KAAI,eAAe,WAAW,GAAG;AAC/B,IAAE,IAAI,KAAK,0CAA0C;AACrD;;CAIF,MAAM,IAAI,EAAE,SAAS;AACrB,GAAE,MAAM,uBAAuB;AAC/B,KAAI;EACF,MAAM,UAAoB,EAAE;AAC5B,OAAK,MAAM,YAAY,WAAW;GAChC,MAAM,SAAS,MAAM,cAAc,MAAM,UAAU,eAAe;AAClE,WAAQ,KAAK,OAAO;;AAEtB,IAAE,KAAK,gCAAgC;AAGvC,OAAK,MAAM,UAAU,QACnB,GAAE,KAAK,QAAQ,UAAU;UAEpB,OAAO;AACd,IAAE,KAAK,2BAA2B;AAClC,IAAE,IAAI,MAAM,OAAO,MAAM,CAAC;;AAG5B,GAAE,MAAM,0CAA0C"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ 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 { init, initSkills } from "./init.js";
|
|
6
|
+
import { getDetectedPlatform, init, initSkills } from "./init.js";
|
|
7
7
|
import { listContentDeclaration, listContentDeclarationRows } from "./listContentDeclaration.js";
|
|
8
8
|
import { liveSync } from "./liveSync.js";
|
|
9
9
|
import { pull } from "./pull.js";
|
|
@@ -16,4 +16,4 @@ import { testMissingTranslations } from "./test/test.js";
|
|
|
16
16
|
import "./test/index.js";
|
|
17
17
|
import { translateDoc } from "./translateDoc/translateDoc.js";
|
|
18
18
|
export * from "@intlayer/chokidar";
|
|
19
|
-
export { ConfigurationOptions, FillOptions, build, dirname, extract, fill, init, initSkills, listContentDeclaration, listContentDeclarationRows, listMissingTranslations, listMissingTranslationsWithConfig, liveSync, pull, push, pushConfig, reviewDoc, searchDoc, setAPI, startEditor, testMissingTranslations, translateDoc };
|
|
19
|
+
export { ConfigurationOptions, FillOptions, build, dirname, extract, fill, 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,6 +1,9 @@
|
|
|
1
|
+
import { Platform } from "@intlayer/chokidar";
|
|
2
|
+
|
|
1
3
|
//#region src/init.d.ts
|
|
2
4
|
declare const init: (projectRoot?: string) => Promise<void>;
|
|
5
|
+
declare const getDetectedPlatform: () => Platform | undefined;
|
|
3
6
|
declare const initSkills: (projectRoot?: string) => Promise<void>;
|
|
4
7
|
//#endregion
|
|
5
|
-
export { init, initSkills };
|
|
8
|
+
export { getDetectedPlatform, init, initSkills };
|
|
6
9
|
//# 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":";;;cA4Ba,IAAA,GAAc,WAAA,cAAoB,OAAA;AAAA,cAwClC,mBAAA,QAA0B,QAAA;AAAA,cAG1B,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.1",
|
|
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,16 +68,17 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@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.
|
|
71
|
+
"@intlayer/ai": "8.1.1",
|
|
72
|
+
"@intlayer/api": "8.1.1",
|
|
73
|
+
"@intlayer/chokidar": "8.1.1",
|
|
74
|
+
"@intlayer/config": "8.1.1",
|
|
75
|
+
"@intlayer/core": "8.1.1",
|
|
76
|
+
"@intlayer/dictionaries-entry": "8.1.1",
|
|
77
|
+
"@intlayer/remote-dictionaries-entry": "8.1.1",
|
|
78
|
+
"@intlayer/types": "8.1.1",
|
|
79
|
+
"@intlayer/unmerged-dictionaries-entry": "8.1.1",
|
|
80
80
|
"commander": "14.0.2",
|
|
81
|
+
"enquirer": "^2.4.1",
|
|
81
82
|
"eventsource": "4.1.0",
|
|
82
83
|
"fast-glob": "3.3.3"
|
|
83
84
|
},
|
|
@@ -92,7 +93,7 @@
|
|
|
92
93
|
"vitest": "4.0.18"
|
|
93
94
|
},
|
|
94
95
|
"peerDependencies": {
|
|
95
|
-
"@intlayer/ai": "8.1.
|
|
96
|
+
"@intlayer/ai": "8.1.1"
|
|
96
97
|
},
|
|
97
98
|
"peerDependenciesMeta": {
|
|
98
99
|
"@intlayer/ai": {
|