@agile-team/wl-skills-ui 1.6.4 → 1.6.5
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/bin/wl-ui.js +75 -9
- package/package.json +1 -1
package/bin/wl-ui.js
CHANGED
|
@@ -55,6 +55,7 @@ const EDITOR_TARGETS = {
|
|
|
55
55
|
"agents-generic": { dir: ".", ext: ".md", singleFile: "AGENTS.md" },
|
|
56
56
|
qoder: { dir: ".qoder/rules", ext: ".md" },
|
|
57
57
|
};
|
|
58
|
+
const EDITOR_IDS = Object.keys(EDITOR_TARGETS);
|
|
58
59
|
|
|
59
60
|
// ── 参数解析 ─────────────────────────────────────────────────────────────────
|
|
60
61
|
const rawArgs = process.argv.slice(2);
|
|
@@ -124,9 +125,10 @@ if (subcommand === "init" || subcommand === "update") {
|
|
|
124
125
|
const skillsOnly = values["skills-only"];
|
|
125
126
|
const mode = values.mode === "skin" ? "skin" : "native";
|
|
126
127
|
|
|
128
|
+
const manifest = readManifest(projectRoot);
|
|
127
129
|
if (
|
|
128
130
|
subcommand === "update" &&
|
|
129
|
-
|
|
131
|
+
manifest?.version === PKG.version &&
|
|
130
132
|
!values.force
|
|
131
133
|
) {
|
|
132
134
|
console.log(
|
|
@@ -144,11 +146,21 @@ if (subcommand === "init" || subcommand === "update") {
|
|
|
144
146
|
console.log(`[wl-ui ${subcommand}] DRY-RUN 模式:不实际写入文件\n`);
|
|
145
147
|
|
|
146
148
|
// 1. 检测编辑器
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
+
const editors = resolveEditorsForInstall({
|
|
150
|
+
projectRoot,
|
|
151
|
+
subcommand,
|
|
152
|
+
requestedEditor: values.editor,
|
|
153
|
+
manifest,
|
|
154
|
+
});
|
|
155
|
+
console.log(`[wl-ui ${subcommand}] 目标编辑器:${editors.join(", ")}\n`);
|
|
149
156
|
|
|
150
157
|
// 2. 安装 skills(按 mode 过滤)
|
|
151
|
-
const installedFiles =
|
|
158
|
+
const installedFiles = [];
|
|
159
|
+
for (const editor of editors) {
|
|
160
|
+
installedFiles.push(
|
|
161
|
+
...installSkills({ projectRoot, editor, mode, dryRun }),
|
|
162
|
+
);
|
|
163
|
+
}
|
|
152
164
|
installedFiles.push(...installSupportFiles({ projectRoot, dryRun }));
|
|
153
165
|
|
|
154
166
|
// 3. 安装接入配置(非 --skills-only 时)
|
|
@@ -159,7 +171,8 @@ if (subcommand === "init" || subcommand === "update") {
|
|
|
159
171
|
if (!dryRun) {
|
|
160
172
|
writeManifest(projectRoot, {
|
|
161
173
|
version: PKG.version,
|
|
162
|
-
editor,
|
|
174
|
+
editor: editors.join(","),
|
|
175
|
+
editors,
|
|
163
176
|
mode,
|
|
164
177
|
installedAt: new Date().toISOString(),
|
|
165
178
|
files: Object.fromEntries(
|
|
@@ -169,7 +182,7 @@ if (subcommand === "init" || subcommand === "update") {
|
|
|
169
182
|
}
|
|
170
183
|
|
|
171
184
|
console.log(`\n✅ wl-ui ${subcommand} 完成!\n`);
|
|
172
|
-
printInstallSummary({ projectRoot, mode, editor });
|
|
185
|
+
printInstallSummary({ projectRoot, mode, editor: editors.join(", ") });
|
|
173
186
|
console.log("下一步:");
|
|
174
187
|
if (mode === "skin") {
|
|
175
188
|
console.log(" npx wl-ui scan --target src --mode skin # 仅化妆层审计");
|
|
@@ -252,6 +265,58 @@ function detectEditor(projectRoot) {
|
|
|
252
265
|
return "github-copilot";
|
|
253
266
|
}
|
|
254
267
|
|
|
268
|
+
function detectInstalledEditors(projectRoot) {
|
|
269
|
+
return EDITOR_IDS.filter((editor) => {
|
|
270
|
+
const target = EDITOR_TARGETS[editor];
|
|
271
|
+
if (target.singleFile)
|
|
272
|
+
return existsSync(join(projectRoot, target.singleFile));
|
|
273
|
+
return existsSync(join(projectRoot, target.dir));
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function normalizeManifestEditors(manifest) {
|
|
278
|
+
if (Array.isArray(manifest?.editors)) return manifest.editors;
|
|
279
|
+
if (typeof manifest?.editor === "string") {
|
|
280
|
+
return manifest.editor
|
|
281
|
+
.split(",")
|
|
282
|
+
.map((editor) => editor.trim())
|
|
283
|
+
.filter(Boolean);
|
|
284
|
+
}
|
|
285
|
+
return [];
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function uniqueValidEditors(editors) {
|
|
289
|
+
return [...new Set(editors)].filter((editor) => EDITOR_TARGETS[editor]);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function resolveEditorsForInstall({
|
|
293
|
+
projectRoot,
|
|
294
|
+
subcommand,
|
|
295
|
+
requestedEditor,
|
|
296
|
+
manifest,
|
|
297
|
+
}) {
|
|
298
|
+
if (requestedEditor) {
|
|
299
|
+
if (requestedEditor === "all") return EDITOR_IDS;
|
|
300
|
+
const editors = uniqueValidEditors(
|
|
301
|
+
requestedEditor.split(",").map((editor) => editor.trim()),
|
|
302
|
+
);
|
|
303
|
+
if (editors.length > 0) return editors;
|
|
304
|
+
console.error(`[wl-ui ${subcommand}] 不支持的编辑器:${requestedEditor}`);
|
|
305
|
+
console.error(`支持:${EDITOR_IDS.join(" | ")} | all`);
|
|
306
|
+
process.exit(1);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
if (subcommand === "update") {
|
|
310
|
+
const editors = uniqueValidEditors([
|
|
311
|
+
...normalizeManifestEditors(manifest),
|
|
312
|
+
...detectInstalledEditors(projectRoot),
|
|
313
|
+
]);
|
|
314
|
+
if (editors.length > 0) return editors;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return [detectEditor(projectRoot)];
|
|
318
|
+
}
|
|
319
|
+
|
|
255
320
|
/** 读取 skills/ 目录下所有 SKILL.md 文件 */
|
|
256
321
|
function collectSkills(skillsDir) {
|
|
257
322
|
const skills = [];
|
|
@@ -738,8 +803,8 @@ wl-ui — @agile-team/wl-skills-ui 统一 CLI v${PKG.version}
|
|
|
738
803
|
wl-ui init [--project <path>] [--editor <editor>] [--mode native|skin]
|
|
739
804
|
[--dry-run] [--skills-only]
|
|
740
805
|
把 skills/ 写入目标项目的 AI 编辑器规则目录
|
|
741
|
-
wl-ui update [--project <path>] [--force] [--dry-run]
|
|
742
|
-
|
|
806
|
+
wl-ui update [--project <path>] [--editor <editor|all>] [--force] [--dry-run]
|
|
807
|
+
更新已安装编辑器 rules / MCP / 触发提示
|
|
743
808
|
wl-ui diff [--project <path>]
|
|
744
809
|
对比已安装文件与 manifest
|
|
745
810
|
wl-ui clean [--project <path>] [--dry-run]
|
|
@@ -765,7 +830,7 @@ wl-ui — @agile-team/wl-skills-ui 统一 CLI v${PKG.version}
|
|
|
765
830
|
|
|
766
831
|
参数:
|
|
767
832
|
--project 项目根目录(默认 .)
|
|
768
|
-
--editor 指定编辑器:github-copilot | cursor | windsurf | kiro | trae | claude-code | cline | agents-generic | qoder
|
|
833
|
+
--editor 指定编辑器:github-copilot | cursor | windsurf | kiro | trae | claude-code | cline | agents-generic | qoder | all
|
|
769
834
|
--mode init: native(默认,完整接入) | skin(化妆,老项目)
|
|
770
835
|
scan: skin(只看L0/L1/L2) | native(全量)
|
|
771
836
|
--layer scan 过滤:L0/L1/L2/L3/L4(逗号分隔)
|
|
@@ -779,6 +844,7 @@ wl-ui — @agile-team/wl-skills-ui 统一 CLI v${PKG.version}
|
|
|
779
844
|
示例:
|
|
780
845
|
npx wl-ui init
|
|
781
846
|
npx wl-ui update --force
|
|
847
|
+
npx wl-ui update --editor all --force
|
|
782
848
|
npx wl-ui doctor
|
|
783
849
|
npx wl-ui prompts
|
|
784
850
|
npx wl-ui init --mode skin --project /path/to/legacy-project
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agile-team/wl-skills-ui",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.5",
|
|
4
4
|
"description": "企业级 UI 风格对齐框架 — Vue + Element Plus 项目通用化妆/原生双模式(tokens / element / vendors / layouts / runtime / scanner / fixer / skills)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./es/index.js",
|