@agile-team/wl-skills-kit 1.2.1 → 2.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/CHANGELOG.md +137 -0
- package/README.md +180 -357
- package/bin/wl-skills.js +206 -44
- package/files/.github/copilot-instructions.md +104 -43
- package/files/.github/guides/README.md +13 -0
- package/files/.github/guides/architecture.md +555 -0
- package/files/.github/guides/usage.md +166 -0
- package/files/.github/reports/README.md +65 -0
- package/files/.github/reports/SYS_DICT_INFO.md +19 -0
- package/files/.github/reports/SYS_PERMISSION_INFO.md +20 -0
- package/files/.github/reports//347/273/204/344/273/266/346/217/220/345/217/226/345/273/272/350/256/256.md +33 -0
- package/files/.github/reports//350/247/204/350/214/203/345/256/241/346/237/245/346/212/245/345/221/212.md +44 -0
- package/files/.github/skills/_compat/README.md +108 -0
- package/files/.github/skills/_compat/editors.json +61 -0
- package/files/.github/skills/_compat/headers/agents.txt +8 -0
- package/files/.github/skills/_compat/headers/claude-code.txt +7 -0
- package/files/.github/skills/_compat/headers/cline.txt +7 -0
- package/files/.github/skills/_compat/headers/cursor-mdc.txt +16 -0
- package/files/.github/skills/_compat/headers/cursor-rules.txt +7 -0
- package/files/.github/skills/_compat/headers/github-copilot.txt +1 -0
- package/files/.github/skills/_compat/headers/kiro.txt +10 -0
- package/files/.github/skills/_compat/headers/trae.txt +11 -0
- package/files/.github/skills/_compat/headers/windsurf.txt +7 -0
- package/files/.github/skills/_registry.md +81 -0
- package/files/.github/skills/{api-contract → core/api-contract}/SKILL.md +126 -29
- package/files/.github/skills/core/api-contract/USAGE.md +110 -0
- package/files/.github/skills/core/convention-audit/SKILL.md +189 -0
- package/files/.github/skills/core/convention-audit/USAGE.md +99 -0
- package/files/.github/skills/{page-codegen → core/page-codegen}/SKILL.md +64 -21
- package/files/.github/skills/core/page-codegen/USAGE.md +102 -0
- package/files/.github/skills/core/page-codegen/templates/_index.md +46 -0
- package/files/.github/skills/core/page-codegen/templates/domains/_CONTRIBUTING.md +107 -0
- package/files/.github/skills/{page-codegen → core/page-codegen/templates/domains/produce}/TPL-OPERATION-STATION.md +442 -442
- package/files/.github/skills/core/page-codegen/templates/domains/sale/README.md +26 -0
- package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-DETAIL-TABS.md +94 -39
- package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-DRIVEN.md +124 -124
- package/files/.github/skills/core/prototype-scan/USAGE.md +95 -0
- package/files/.github/skills/core/template-extract/SKILL.md +139 -0
- package/files/.github/skills/core/template-extract/USAGE.md +93 -0
- package/files/.github/skills/domain/README.md +51 -0
- package/files/.github/skills/ops/code-fix/SKILL.draft.md +108 -0
- package/files/.github/skills/sync/dict-sync/SKILL.draft.md +100 -0
- package/files/.github/skills/{menu-sync → sync/menu-sync}/SKILL.md +258 -258
- package/files/.github/skills/sync/menu-sync/USAGE.md +104 -0
- package/files/.github/skills/{menu-sync → sync/menu-sync}/env/guide.md +83 -83
- package/files/.github/skills/sync/permission-sync/SKILL.draft.md +91 -0
- package/files/.github/standards/01-toolchain.md +57 -0
- package/files/.github/standards/02-code-structure.md +111 -0
- package/files/.github/standards/03-comments.md +53 -0
- package/files/.github/standards/04-coding-basics.md +33 -0
- package/files/.github/standards/05-logging.md +38 -0
- package/files/.github/standards/06-security.md +44 -0
- package/files/.github/standards/07-config.md +52 -0
- package/files/.github/standards/08-git.md +60 -0
- package/files/.github/standards/09-typescript.md +71 -0
- package/files/.github/standards/10-pinia.md +57 -0
- package/files/.github/standards/11-form-validation.md +81 -0
- package/files/.github/standards/12-base-table.md +116 -0
- package/files/.github/standards/13-platform-components.md +123 -0
- package/files/.github/standards/index.md +89 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/data.ts +196 -196
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.scss +150 -150
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.vue +79 -79
- package/files/docs/jh-date-range.md +257 -257
- package/files/docs/jh-date.md +222 -222
- package/files/docs/jh-dept-picker.md +190 -190
- package/files/docs/jh-drag-row.md +590 -590
- package/files/docs/jh-file-upload.md +216 -216
- package/files/docs/jh-picker.md +218 -218
- package/files/docs/jh-select.md +148 -148
- package/files/docs/jh-text.md +248 -248
- package/files/docs/jh-user-picker.md +197 -197
- package/package.json +6 -2
- package/files/.github/docs/menu-sync-design.md +0 -264
- package/files/.github/docs/use-skill.md +0 -382
- package/files/.github/docs/wl-skills-kit.md +0 -266
- package/files/.github/skills/convention-extract/SKILL.md +0 -236
- /package/files/.github/{docs → reports}/SYS_MENU_INFO.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-CHANGE-HISTORY.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-FORM-ROUTE.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-LIST.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-MASTER-DETAIL.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-RECORD-FORM.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-TREE-LIST.md +0 -0
- /package/files/.github/skills/{prototype-scan → core/prototype-scan}/SKILL.md +0 -0
- /package/files/.github/skills/{menu-sync → sync/menu-sync}/env/env.local.json +0 -0
package/bin/wl-skills.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* wl-skills-kit CLI v2.
|
|
4
|
+
* wl-skills-kit CLI v2.1
|
|
5
5
|
*
|
|
6
6
|
* 命令:
|
|
7
7
|
* init 全量安装(默认,向后兼容)
|
|
@@ -23,6 +23,7 @@ const PKG = require("../package.json");
|
|
|
23
23
|
const args = process.argv.slice(2);
|
|
24
24
|
const dryRun = args.includes("--dry-run");
|
|
25
25
|
const showHelp = args.includes("--help") || args.includes("-h");
|
|
26
|
+
const keepReports = args.includes("--keep-reports");
|
|
26
27
|
const command = args.find((a) => !a.startsWith("-")) || "init";
|
|
27
28
|
|
|
28
29
|
if (showHelp) {
|
|
@@ -38,14 +39,19 @@ if (showHelp) {
|
|
|
38
39
|
clean 构建清理(移除开发期 AI 文件,保留 src/components + src/types)
|
|
39
40
|
|
|
40
41
|
选项:
|
|
41
|
-
--dry-run
|
|
42
|
-
--
|
|
42
|
+
--dry-run 预览模式,不实际写入/删除任何文件
|
|
43
|
+
--keep-reports clean 命令保留 .github/reports/(默认一起删除)
|
|
44
|
+
--help 显示帮助
|
|
43
45
|
|
|
44
46
|
示例:
|
|
45
|
-
npx @agile-team/wl-skills-kit
|
|
46
|
-
npx @agile-team/wl-skills-kit update
|
|
47
|
-
npx @agile-team/wl-skills-kit clean
|
|
48
|
-
npx @agile-team/wl-skills-kit clean --
|
|
47
|
+
npx @agile-team/wl-skills-kit 安装全量文件
|
|
48
|
+
npx @agile-team/wl-skills-kit update 仅更新有变化的文件
|
|
49
|
+
npx @agile-team/wl-skills-kit clean 清理开发期文件
|
|
50
|
+
npx @agile-team/wl-skills-kit clean --keep-reports 保留 reports/中的菜单/字典数据
|
|
51
|
+
npx @agile-team/wl-skills-kit clean --dry-run 预览将要清理哪些文件
|
|
52
|
+
|
|
53
|
+
保护路径(init / update 不覆盖已存在的):
|
|
54
|
+
.github/reports/ AI 生成报告(团队累积数据,存在则跳过)
|
|
49
55
|
|
|
50
56
|
清理保护路径(clean 不删除):
|
|
51
57
|
src/components/ 通用组件(被业务页面 import,构建必需)
|
|
@@ -119,16 +125,23 @@ function removeFileAndEmptyParents(filePath) {
|
|
|
119
125
|
if (fs.readdirSync(dir).length === 0) {
|
|
120
126
|
fs.rmdirSync(dir);
|
|
121
127
|
dir = path.dirname(dir);
|
|
122
|
-
} else {
|
|
123
|
-
|
|
128
|
+
} else {
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
} catch (e) {
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
124
134
|
}
|
|
125
135
|
}
|
|
126
136
|
|
|
127
137
|
/** 读取 manifest */
|
|
128
138
|
function readManifest() {
|
|
129
139
|
if (fs.existsSync(MANIFEST_PATH)) {
|
|
130
|
-
try {
|
|
131
|
-
|
|
140
|
+
try {
|
|
141
|
+
return JSON.parse(fs.readFileSync(MANIFEST_PATH, "utf8"));
|
|
142
|
+
} catch (e) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
132
145
|
}
|
|
133
146
|
return null;
|
|
134
147
|
}
|
|
@@ -144,30 +157,90 @@ function isProtected(relPath) {
|
|
|
144
157
|
return PROTECTED_PREFIXES.some((p) => relPath.startsWith(p));
|
|
145
158
|
}
|
|
146
159
|
|
|
147
|
-
//
|
|
160
|
+
// reports/ 中的 AI 生成报告:init/update 遇到已存在不覆盖(团队累积数据)
|
|
161
|
+
function isReportFile(relPath) {
|
|
162
|
+
return relPath.startsWith(".github/reports/") && relPath.endsWith(".md");
|
|
163
|
+
}
|
|
148
164
|
|
|
149
|
-
|
|
165
|
+
// ─── 旧版遗留路径(v1.x/v2.0 → v2.1 迁移清理)───────────────────────────
|
|
166
|
+
// update 时自动检测并移除,避免旧结构与新结构并存产生歧义。
|
|
167
|
+
const LEGACY_PATHS = [
|
|
168
|
+
// Skill 目录重组:flat → core/sync/ops 分级(v2.1)
|
|
169
|
+
".github/skills/prototype-scan/SKILL.md",
|
|
170
|
+
".github/skills/api-contract/SKILL.md",
|
|
171
|
+
".github/skills/page-codegen/SKILL.md",
|
|
172
|
+
".github/skills/page-codegen/TPL-LIST.md",
|
|
173
|
+
".github/skills/page-codegen/TPL-MASTER-DETAIL.md",
|
|
174
|
+
".github/skills/page-codegen/TPL-TREE-LIST.md",
|
|
175
|
+
".github/skills/page-codegen/TPL-DETAIL-TABS.md",
|
|
176
|
+
".github/skills/page-codegen/TPL-FORM-ROUTE.md",
|
|
177
|
+
".github/skills/page-codegen/TPL-CHANGE-HISTORY.md",
|
|
178
|
+
".github/skills/page-codegen/TPL-RECORD-FORM.md",
|
|
179
|
+
".github/skills/page-codegen/TPL-DRIVEN.md",
|
|
180
|
+
".github/skills/page-codegen/TPL-OPERATION-STATION.md",
|
|
181
|
+
".github/skills/menu-sync/SKILL.md",
|
|
182
|
+
".github/skills/menu-sync/env/env.local.json",
|
|
183
|
+
".github/skills/menu-sync/env/guide.md",
|
|
184
|
+
".github/skills/convention-extract/SKILL.md", // 已更名为 convention-audit
|
|
185
|
+
// docs/ 废弃文件:内容已迁移至 guides/ 或 reports/(v2.0)
|
|
186
|
+
".github/docs/menu-sync-design.md",
|
|
187
|
+
".github/docs/use-skill.md",
|
|
188
|
+
".github/docs/wl-skills-kit.md",
|
|
189
|
+
".github/docs/SYS_MENU_INFO.md", // 已迁移至 reports/
|
|
190
|
+
// _compat/ 旧说明文件(v2.0 → v2.1 重构为可执行配置层)
|
|
191
|
+
".github/skills/_compat/ai-model-matrix.md",
|
|
192
|
+
".github/skills/_compat/editor-setup.md",
|
|
193
|
+
];
|
|
194
|
+
|
|
195
|
+
// ─── 编辑器配置生成(从 _compat/editors.json 读取,特化 frontmatter 注入)─────
|
|
196
|
+
|
|
197
|
+
const AUTO_HEADER_NOTE =
|
|
150
198
|
"<!-- 由 @agile-team/wl-skills-kit 自动生成。源文件:.github/copilot-instructions.md -->\n" +
|
|
151
|
-
"<!-- 请勿手动编辑本文件,更新时重新执行:npx @agile-team/wl-skills-kit@latest -->\n\n";
|
|
152
|
-
|
|
153
|
-
const CURSOR_MDC_HEADER =
|
|
154
|
-
"---\n" +
|
|
155
|
-
'description: "项目编码规范(由 wl-skills-kit 自动生成)"\n' +
|
|
156
|
-
"alwaysApply: true\n" +
|
|
157
|
-
"---\n\n" +
|
|
158
|
-
AUTO_HEADER;
|
|
199
|
+
"<!-- 请勿手动编辑本文件,更新时重新执行:npx @agile-team/wl-skills-kit@latest update -->\n\n";
|
|
159
200
|
|
|
160
201
|
function getEditorConfigs(raw) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
202
|
+
const editorsJsonPath = path.join(
|
|
203
|
+
FILES_DIR,
|
|
204
|
+
".github",
|
|
205
|
+
"skills",
|
|
206
|
+
"_compat",
|
|
207
|
+
"editors.json",
|
|
208
|
+
);
|
|
209
|
+
const headersDir = path.join(
|
|
210
|
+
FILES_DIR,
|
|
211
|
+
".github",
|
|
212
|
+
"skills",
|
|
213
|
+
"_compat",
|
|
214
|
+
"headers",
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
if (!fs.existsSync(editorsJsonPath)) {
|
|
218
|
+
console.warn(" ⚠ _compat/editors.json 不存在,跳过多 AI 编辑器配置生成");
|
|
219
|
+
return [];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
let registry;
|
|
223
|
+
try {
|
|
224
|
+
registry = JSON.parse(fs.readFileSync(editorsJsonPath, "utf8"));
|
|
225
|
+
} catch (e) {
|
|
226
|
+
console.warn(" ⚠ _compat/editors.json 解析失败:" + e.message);
|
|
227
|
+
return [];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const configs = [];
|
|
231
|
+
for (const editor of registry.editors || []) {
|
|
232
|
+
if (editor.enabled === false) continue;
|
|
233
|
+
// GitHub Copilot 直接使用 .github/copilot-instructions.md,不重复生成
|
|
234
|
+
if (editor.outputPath === ".github/copilot-instructions.md") continue;
|
|
235
|
+
|
|
236
|
+
const headerPath = path.join(headersDir, editor.headerFile);
|
|
237
|
+
let header = "";
|
|
238
|
+
if (fs.existsSync(headerPath)) {
|
|
239
|
+
header = fs.readFileSync(headerPath, "utf8");
|
|
240
|
+
}
|
|
241
|
+
configs.push([editor.outputPath, header + AUTO_HEADER_NOTE + raw]);
|
|
242
|
+
}
|
|
243
|
+
return configs;
|
|
171
244
|
}
|
|
172
245
|
|
|
173
246
|
// ─── 命令: init / update ────────────────────────────────────────────────
|
|
@@ -187,9 +260,12 @@ function runInstall(incremental) {
|
|
|
187
260
|
|
|
188
261
|
const oldManifest = readManifest();
|
|
189
262
|
const newManifest = { version: PKG.version, files: {} };
|
|
190
|
-
let created = 0,
|
|
263
|
+
let created = 0,
|
|
264
|
+
updated = 0,
|
|
265
|
+
unchanged = 0,
|
|
266
|
+
preserved = 0;
|
|
191
267
|
|
|
192
|
-
// ── Step 1: 复制 files/ 静态文件
|
|
268
|
+
// ── Step 1: 复制 files/ 静态文件 ───────────────────
|
|
193
269
|
|
|
194
270
|
const files = walkDir(FILES_DIR, FILES_DIR);
|
|
195
271
|
if (dryRun) console.log(" [Step 1] files/ 静态文件:\n");
|
|
@@ -200,9 +276,19 @@ function runInstall(incremental) {
|
|
|
200
276
|
const srcHash = fileMd5(src);
|
|
201
277
|
newManifest.files[relPath] = srcHash;
|
|
202
278
|
|
|
279
|
+
// reports/ 下的报告文件:已存在则跳过(保护团队累积数据)
|
|
280
|
+
if (isReportFile(relPath) && fs.existsSync(dest)) {
|
|
281
|
+
preserved++;
|
|
282
|
+
if (dryRun) console.log(" 保留 " + relPath + " (reports/ 已存在)");
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
|
|
203
286
|
// update 模式: 跳过内容相同的文件
|
|
204
287
|
if (incremental && fs.existsSync(dest)) {
|
|
205
|
-
if (srcHash === fileMd5(dest)) {
|
|
288
|
+
if (srcHash === fileMd5(dest)) {
|
|
289
|
+
unchanged++;
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
206
292
|
}
|
|
207
293
|
|
|
208
294
|
if (dryRun) {
|
|
@@ -216,13 +302,19 @@ function runInstall(incremental) {
|
|
|
216
302
|
|
|
217
303
|
// ── Step 2: 动态生成编辑器配置文件 ────────────────────────────────
|
|
218
304
|
|
|
219
|
-
const INSTRUCTIONS_SRC = path.join(
|
|
305
|
+
const INSTRUCTIONS_SRC = path.join(
|
|
306
|
+
FILES_DIR,
|
|
307
|
+
".github",
|
|
308
|
+
"copilot-instructions.md",
|
|
309
|
+
);
|
|
220
310
|
if (fs.existsSync(INSTRUCTIONS_SRC)) {
|
|
221
311
|
const raw = fs.readFileSync(INSTRUCTIONS_SRC, "utf8");
|
|
222
312
|
const editorConfigs = getEditorConfigs(raw);
|
|
223
313
|
|
|
224
314
|
if (dryRun) {
|
|
225
|
-
console.log(
|
|
315
|
+
console.log(
|
|
316
|
+
"\n [Step 2] 编辑器配置文件(从 copilot-instructions.md 生成):\n",
|
|
317
|
+
);
|
|
226
318
|
}
|
|
227
319
|
|
|
228
320
|
for (const [ecPath, ecContent] of editorConfigs) {
|
|
@@ -231,12 +323,17 @@ function runInstall(incremental) {
|
|
|
231
323
|
newManifest.files[ecPath] = ecHash;
|
|
232
324
|
|
|
233
325
|
if (incremental && fs.existsSync(ecDest)) {
|
|
234
|
-
if (ecHash === fileMd5(ecDest)) {
|
|
326
|
+
if (ecHash === fileMd5(ecDest)) {
|
|
327
|
+
unchanged++;
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
235
330
|
}
|
|
236
331
|
|
|
237
332
|
if (dryRun) {
|
|
238
333
|
const ecExists = fs.existsSync(ecDest);
|
|
239
|
-
console.log(
|
|
334
|
+
console.log(
|
|
335
|
+
" " + (ecExists ? "覆盖" : "新增") + " [编辑器] " + ecPath,
|
|
336
|
+
);
|
|
240
337
|
ecExists ? updated++ : created++;
|
|
241
338
|
} else {
|
|
242
339
|
writeFile(ecDest, ecContent) === "created" ? created++ : updated++;
|
|
@@ -244,7 +341,33 @@ function runInstall(incremental) {
|
|
|
244
341
|
}
|
|
245
342
|
}
|
|
246
343
|
|
|
247
|
-
// ── Step 3:
|
|
344
|
+
// ── Step 3: 迁移清理(仅 update,清理旧版遗留文件)──────────────────
|
|
345
|
+
|
|
346
|
+
if (incremental) {
|
|
347
|
+
let migrated = 0;
|
|
348
|
+
if (dryRun) console.log("\n [Step 3] 旧版遗留文件检查(迁移清理):\n");
|
|
349
|
+
for (const legacyRel of LEGACY_PATHS) {
|
|
350
|
+
const legacyFull = path.join(TARGET_DIR, legacyRel);
|
|
351
|
+
if (fs.existsSync(legacyFull)) {
|
|
352
|
+
if (dryRun) {
|
|
353
|
+
console.log(" 迁移清理 " + legacyRel + " (旧版遗留,将被移除)");
|
|
354
|
+
} else {
|
|
355
|
+
removeFileAndEmptyParents(legacyFull);
|
|
356
|
+
}
|
|
357
|
+
migrated++;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (!dryRun && migrated > 0) {
|
|
361
|
+
console.log(
|
|
362
|
+
" 迁移: " + migrated + " 个旧版文件已移除(路径已变更,见 CHANGELOG.md)",
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
if (dryRun && migrated === 0) {
|
|
366
|
+
console.log(" (无旧版遗留文件)");
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// ── Step 4: 写 manifest ────────────────────────────────────────────
|
|
248
371
|
|
|
249
372
|
if (!dryRun) writeManifest(newManifest);
|
|
250
373
|
|
|
@@ -254,7 +377,17 @@ function runInstall(incremental) {
|
|
|
254
377
|
if (dryRun) {
|
|
255
378
|
console.log("");
|
|
256
379
|
if (incremental) {
|
|
257
|
-
console.log(
|
|
380
|
+
console.log(
|
|
381
|
+
" 共 " +
|
|
382
|
+
total +
|
|
383
|
+
" 个文件(新增 " +
|
|
384
|
+
created +
|
|
385
|
+
",变更 " +
|
|
386
|
+
updated +
|
|
387
|
+
",未变 " +
|
|
388
|
+
unchanged +
|
|
389
|
+
")(未实际写入)",
|
|
390
|
+
);
|
|
258
391
|
} else {
|
|
259
392
|
console.log(" 共 " + total + " 个文件(未实际写入)");
|
|
260
393
|
}
|
|
@@ -264,12 +397,20 @@ function runInstall(incremental) {
|
|
|
264
397
|
console.log(" 新增: " + created + " 个文件");
|
|
265
398
|
console.log(" 更新: " + updated + " 个文件");
|
|
266
399
|
console.log(" 未变: " + unchanged + " 个文件");
|
|
400
|
+
if (preserved > 0)
|
|
401
|
+
console.log(
|
|
402
|
+
" 保留: " + preserved + " 个 reports/ 文件(团队累积数据不覆盖)",
|
|
403
|
+
);
|
|
267
404
|
if (oldManifest && oldManifest.version !== PKG.version) {
|
|
268
405
|
console.log(" 版本: " + oldManifest.version + " → " + PKG.version);
|
|
269
406
|
}
|
|
270
407
|
} else {
|
|
271
408
|
console.log(" 新增: " + created + " 个文件");
|
|
272
409
|
console.log(" 覆盖: " + updated + " 个文件");
|
|
410
|
+
if (preserved > 0)
|
|
411
|
+
console.log(
|
|
412
|
+
" 保留: " + preserved + " 个 reports/ 文件(团队累积数据不覆盖)",
|
|
413
|
+
);
|
|
273
414
|
console.log(" 总计: " + (created + updated) + " 个文件");
|
|
274
415
|
}
|
|
275
416
|
}
|
|
@@ -294,8 +435,16 @@ function runClean() {
|
|
|
294
435
|
}
|
|
295
436
|
|
|
296
437
|
const allFiles = Object.keys(manifest.files);
|
|
297
|
-
const toRemove = allFiles.filter((f) =>
|
|
298
|
-
|
|
438
|
+
const toRemove = allFiles.filter((f) => {
|
|
439
|
+
if (isProtected(f)) return false;
|
|
440
|
+
if (keepReports && f.startsWith(".github/reports/")) return false;
|
|
441
|
+
return true;
|
|
442
|
+
});
|
|
443
|
+
const toKeep = allFiles.filter((f) => {
|
|
444
|
+
if (isProtected(f)) return true;
|
|
445
|
+
if (keepReports && f.startsWith(".github/reports/")) return true;
|
|
446
|
+
return false;
|
|
447
|
+
});
|
|
299
448
|
|
|
300
449
|
if (dryRun) {
|
|
301
450
|
console.log(" 将要删除(" + toRemove.length + " 个文件):\n");
|
|
@@ -308,7 +457,8 @@ function runClean() {
|
|
|
308
457
|
console.log(" 保留 " + f);
|
|
309
458
|
}
|
|
310
459
|
} else {
|
|
311
|
-
let removed = 0,
|
|
460
|
+
let removed = 0,
|
|
461
|
+
skipped = 0;
|
|
312
462
|
for (const f of toRemove) {
|
|
313
463
|
const fullPath = path.join(TARGET_DIR, f);
|
|
314
464
|
if (fs.existsSync(fullPath)) {
|
|
@@ -324,7 +474,19 @@ function runClean() {
|
|
|
324
474
|
console.log(" ✔ 清理完成!");
|
|
325
475
|
console.log(" 删除: " + removed + " 个文件");
|
|
326
476
|
if (skipped > 0) console.log(" 跳过: " + skipped + " 个(已不存在)");
|
|
327
|
-
|
|
477
|
+
if (keepReports) {
|
|
478
|
+
console.log(
|
|
479
|
+
" 保留: " +
|
|
480
|
+
toKeep.length +
|
|
481
|
+
" 个文件(src/components/ + src/types/ + .github/reports/)",
|
|
482
|
+
);
|
|
483
|
+
} else {
|
|
484
|
+
console.log(
|
|
485
|
+
" 保留: " +
|
|
486
|
+
toKeep.length +
|
|
487
|
+
" 个文件(src/components/ + src/types/)",
|
|
488
|
+
);
|
|
489
|
+
}
|
|
328
490
|
}
|
|
329
491
|
console.log("");
|
|
330
492
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
- 样式:Windi CSS + SCSS
|
|
12
12
|
- 状态:Pinia
|
|
13
13
|
- 页面注册:`vite/plugins/shared/pages.ts` 通过 `gProd()` / `gSale()` 声明
|
|
14
|
-
- 菜单路由配置:后端菜单表是唯一数据源。pages.ts 注册组件后,需在系统管理后台 → 菜单管理 → 新增菜单。批量新增页面时可用后端 batchImport 接口,详见 `.github/
|
|
14
|
+
- 菜单路由配置:后端菜单表是唯一数据源。pages.ts 注册组件后,需在系统管理后台 → 菜单管理 → 新增菜单。批量新增页面时可用后端 batchImport 接口,详见 `.github/skills/sync/menu-sync/SKILL.md`
|
|
15
15
|
|
|
16
16
|
## 页面标准结构(4 文件)
|
|
17
17
|
|
|
@@ -198,64 +198,125 @@ onMounted(() => select());
|
|
|
198
198
|
- ❌ 手写查询表单/工具栏/分页(用 BaseQuery/BaseToolbar/jh-pagination)
|
|
199
199
|
- ❌ 每个页面重复写弹窗组件(优先用 `c_modal` 等局部公共组件)
|
|
200
200
|
|
|
201
|
-
## AI Skills 自动调度(强制执行 — 所有 AI 编辑器/模型通用)
|
|
202
201
|
|
|
203
|
-
|
|
204
|
-
**执行以下任何任务前,必须先用工具读取(read_file)对应的 SKILL.md,读取完成前禁止生成任何代码或输出。**
|
|
202
|
+
---
|
|
205
203
|
|
|
206
|
-
|
|
204
|
+
## 规范门控(standards/index.md 懒加载)
|
|
207
205
|
|
|
208
|
-
|
|
209
|
-
|---|---|---|
|
|
210
|
-
| 扫描原型、解析原型、页面清单、原型分析、详设文档、口述需求、建个页面、写个页面 | `.github/skills/prototype-scan/SKILL.md` | prototype-scan |
|
|
211
|
-
| 接口约定、api.md、字段定义、前后端对齐、接口设计 | `.github/skills/api-contract/SKILL.md` | api-contract |
|
|
212
|
-
| 生成页面、创建页面、代码生成、vue页面、按原型生成、口述生成页面、帮我生成 | `.github/skills/page-codegen/SKILL.md`(主文件会指示继续读取对应的 `TPL-*.md` 模板) | page-codegen |
|
|
213
|
-
| 创建菜单、注册菜单、同步菜单、补菜单 | `.github/skills/menu-sync/SKILL.md` | menu-sync |
|
|
214
|
-
| 规范审计、代码审计、规范检查、对齐规范、规范偏差 | `.github/skills/convention-extract/SKILL.md` | convention-audit |
|
|
206
|
+
> ⚠️ 本节为**强制约定**,所有 AI 编辑器/模型都必须遵守。
|
|
215
207
|
|
|
216
|
-
|
|
208
|
+
完整 13 条编码规范拆分在 `.github/standards/01 ~ 13.md`,由 `standards/index.md` 提供任务类型 → 规范子集映射,**按需加载,不全量读取**。
|
|
217
209
|
|
|
218
|
-
|
|
210
|
+
| 任务类型 | 必读规范 |
|
|
211
|
+
| --------------------- | ------------------------------------------------- |
|
|
212
|
+
| A. 生成新页面 | 01, 02, 03, 04, 05, 06, 07, 09, 10, 11, 12, 13 |
|
|
213
|
+
| B. 修改/重构现有代码 | 02, 04, 05, 06, 09, 10, 12, 13 |
|
|
214
|
+
| C. 规范审计 | 全部 01 ~ 13 |
|
|
215
|
+
| D. 模板提取 | 02, 03, 09, 12, 13 |
|
|
216
|
+
| E. 数据同步(菜单等) | 04, 05, 07 |
|
|
217
|
+
| F. Git/分支/提交 | 08 |
|
|
218
|
+
|
|
219
|
+
**执行任何代码生成或改动前**:
|
|
220
|
+
1. 先 `read_file` 加载 `standards/index.md` 确认任务类型
|
|
221
|
+
2. 按映射读取对应 `standards/0X-*.md`
|
|
222
|
+
3. 在 Pre-flight 声明中列出已加载文件
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## AI Skills 自动调度
|
|
227
|
+
|
|
228
|
+
完整触发词与 Skill 路径见 `skills/_registry.md`(**单一数据源**,不在此处重复)。
|
|
229
|
+
|
|
230
|
+
| Skill 名 | 状态 | 一句话说明 |
|
|
231
|
+
| -------------------- | -------- | --------------------------------------- |
|
|
232
|
+
| prototype-scan | ✅ 启用 | 原型/详设 → page-spec JSON |
|
|
233
|
+
| api-contract | ✅ 启用 | 生成 api.md 接口约定 |
|
|
234
|
+
| page-codegen | ✅ 启用 | 4 文件 + 模板调度 + 菜单追加 |
|
|
235
|
+
| menu-sync | ✅ 启用 | reports/SYS_MENU_INFO → 后端菜单接口 |
|
|
236
|
+
| convention-audit | ✅ 启用 | 13 条规范扫描 + 偏差报告 + 提取建议 |
|
|
237
|
+
| template-extract | ✅ 启用 | 现有页面 → 领域模板沉淀 |
|
|
238
|
+
| dict-sync | ⏳ PLANNED | 字典数据同步 |
|
|
239
|
+
| permission-sync | ⏳ PLANNED | 权限数据同步 |
|
|
240
|
+
| code-fix | ⏳ PLANNED | 自动整改 🟢🟡 等级偏差 |
|
|
241
|
+
|
|
242
|
+
**执行规则**:
|
|
243
|
+
|
|
244
|
+
1. 用户消息匹配 `_registry.md` 触发词 → 用 `read_file` 加载对应 SKILL.md
|
|
245
|
+
2. SKILL.md 中标注的"必读 standards"按 standards/index.md 映射加载
|
|
246
|
+
3. 在 SKILL.md 指示下输出 **Pre-flight 声明**(强制)
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Pre-flight 声明(强制约定式输出)
|
|
251
|
+
|
|
252
|
+
每次 Skill 触发时,**必须先输出**以下结构的 Pre-flight 声明,再开始执行:
|
|
219
253
|
|
|
220
254
|
```
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
255
|
+
🚀 已触发技能 {skill-name}/SKILL.md → {一句话用途}
|
|
256
|
+
✅ 已读取 standards/index.md → 规范门控
|
|
257
|
+
✅ 已读取 standards/{相关条目} → {一句话说明}
|
|
258
|
+
✅ 已读取 {其他必要文档} → {说明}
|
|
259
|
+
✅ 工具链检测:{各项 ✓ / ✗}
|
|
260
|
+
✅ {其他前置检查项,如 cid 生成等}
|
|
225
261
|
```
|
|
226
262
|
|
|
227
|
-
|
|
263
|
+
**工具链检测失败必须暂停**:
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
❌ 工具链检测失败:未找到 {缺失文件}
|
|
267
|
+
→ 请执行:npx @robot-admin/git-standards init
|
|
268
|
+
→ 或联系 CHENY(工号 409322)解决
|
|
269
|
+
→ ⛔ 任务已暂停,修复后重新触发
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## 报告类文件(reports/)
|
|
275
|
+
|
|
276
|
+
AI 生成的所有报告类文件统一写入 `.github/reports/`,**全部追加不覆盖**。
|
|
277
|
+
|
|
278
|
+
| 文件 | 写入方 | 读取方 |
|
|
279
|
+
| --------------------------------- | ------------------ | --------------------- |
|
|
280
|
+
| `reports/SYS_MENU_INFO.md` | page-codegen | menu-sync |
|
|
281
|
+
| `reports/SYS_DICT_INFO.md` [PLANNED] | dict-collect | dict-sync |
|
|
282
|
+
| `reports/SYS_PERMISSION_INFO.md` [PLANNED] | permission-collect | permission-sync |
|
|
283
|
+
| `reports/规范审查报告.md` | convention-audit | 人工 → code-fix |
|
|
284
|
+
| `reports/组件提取建议.md` | convention-audit | 人工 → template-extract |
|
|
285
|
+
|
|
286
|
+
详见 `reports/README.md`。
|
|
287
|
+
|
|
288
|
+
---
|
|
228
289
|
|
|
229
|
-
|
|
230
|
-
上一步的输出(如 page-spec)直接作为下一步的输入,无需用户中间干预。
|
|
290
|
+
## 组件文档按需查阅
|
|
231
291
|
|
|
232
|
-
|
|
233
|
-
> 菜单通过 `组件路径` 字段与 pages.ts 注册的文件路径关联,无论自动(menu-sync API)还是手动(系统管理后台)创建菜单,效果等价。
|
|
292
|
+
生成代码时如需了解组件用法,按需读取以下文档(不要全量加载):
|
|
234
293
|
|
|
235
|
-
|
|
294
|
+
| 主题 | 文档路径 |
|
|
295
|
+
| ----------------------------------- | ----------------------------------------------------- |
|
|
296
|
+
| BaseQuery / BaseTable / BaseToolbar | `src/components/remote/{BaseXxx}/README.md` |
|
|
297
|
+
| jh-* 平台组件 | `docs/jh-{name}.md` |
|
|
298
|
+
| c_formModal / c_listModal 等 | `src/components/local/{c_xxx}/README.md` |
|
|
299
|
+
| AbstractPageQueryHook 最佳实践 | `docs/page-query-hook-best-practices.md` |
|
|
300
|
+
| HTTP 请求工具 | `docs/request.md` |
|
|
236
301
|
|
|
237
|
-
|
|
302
|
+
> 详细对照表与"何时必读哪个文档"见 `standards/13-platform-components.md`。
|
|
238
303
|
|
|
239
|
-
|
|
304
|
+
---
|
|
240
305
|
|
|
241
|
-
|
|
306
|
+
## 领域样例参考
|
|
242
307
|
|
|
243
|
-
|
|
244
|
-
|------|---------|
|
|
245
|
-
| BaseQuery / BaseTable / BaseToolbar | `src/components/remote/BaseQuery/README.md` 等 |
|
|
246
|
-
| jh-select / jh-date / jh-pagination 等 | `docs/jh-select.md` / `docs/jh-date.md` 等 |
|
|
247
|
-
| c_formModal / c_formSections / c_listModal | `src/components/local/c_formModal/README.md` 等 |
|
|
248
|
-
| AbstractPageQueryHook 最佳实践 | `docs/page-query-hook-best-practices.md` |
|
|
249
|
-
| HTTP 请求工具 | `docs/request.md` |
|
|
308
|
+
首次生成某类页面时,可读取 `demo/` 下对应样例:
|
|
250
309
|
|
|
251
|
-
|
|
310
|
+
| 模板类型 | 样例路径 |
|
|
311
|
+
| --------------------- | ------------------------------------------------------- |
|
|
312
|
+
| LIST | `demo/produce/aiflow/mmwr-customer-archive/` |
|
|
313
|
+
| FORM_ROUTE | `demo/produce/aiflow/mmwr-customer-apply-add-form/` |
|
|
314
|
+
| CHANGE_HISTORY | `demo/produce/aiflow/mmwr-customer-apply-change-history/` |
|
|
315
|
+
| DETAIL_TABS | `demo/produce/aiflow/mmwr-customer-detail/` |
|
|
316
|
+
| MASTER_DETAIL | `demo/sale/demo/metallurgical-spec/` |
|
|
252
317
|
|
|
253
|
-
|
|
318
|
+
---
|
|
254
319
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
| FORM_ROUTE(复杂表单) | `demo/produce/aiflow/mmwr-customer-apply-add-form/` |
|
|
259
|
-
| CHANGE_HISTORY(变更历史) | `demo/produce/aiflow/mmwr-customer-apply-change-history/` |
|
|
260
|
-
| DETAIL_TABS(详情Tab) | `demo/produce/aiflow/mmwr-customer-detail/` |
|
|
261
|
-
| MASTER_DETAIL(上下分栏) | `demo/sale/demo/metallurgical-spec/` |
|
|
320
|
+
> 📚 完整指南:`.github/guides/usage.md`
|
|
321
|
+
> 🏗️ 架构设计:`.github/guides/architecture.md`
|
|
322
|
+
> 🔧 维护者文档:`kit-internal/`(仓库内,不安装到业务项目)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Guides 指南目录
|
|
2
|
+
|
|
3
|
+
本目录下文档由 `wl-skills-kit` 安装到业务项目的 `.github/guides/`,作为团队成员人工维护的指南类文档。
|
|
4
|
+
|
|
5
|
+
| 文件 | 内容 |
|
|
6
|
+
| ----------------- | ---------------------------------------------- |
|
|
7
|
+
| `usage.md` | 全套 Skill 使用说明(团队成员上手必读) |
|
|
8
|
+
| `architecture.md` | 整体架构设计与决策记录(含菜单同步等设计内容) |
|
|
9
|
+
|
|
10
|
+
> 与 `kit-internal/`(仅 wl-skills-kit 仓库可见的维护文档)严格区分:
|
|
11
|
+
>
|
|
12
|
+
> - `guides/` → 业务项目使用方阅读
|
|
13
|
+
> - `kit-internal/` → wl-skills-kit 仓库维护者阅读,**不安装到业务项目**
|