dev-playbooks-cn 1.0.18 → 1.0.20

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/devbooks.js CHANGED
@@ -16,6 +16,7 @@
16
16
  * --dry-run 模拟运行,不实际修改文件
17
17
  * --keep-old 迁移后保留原目录
18
18
  * --help 显示帮助信息
19
+ * --version 显示版本号
19
20
  */
20
21
 
21
22
  import fs from 'fs';
@@ -246,6 +247,23 @@ function copyDirSync(src, dest) {
246
247
  return count;
247
248
  }
248
249
 
250
+ function pruneRemovedSkills(skillsDestDir, allowedSkillNames) {
251
+ if (!fs.existsSync(skillsDestDir)) return 0;
252
+ let removedCount = 0;
253
+ const entries = fs.readdirSync(skillsDestDir, { withFileTypes: true });
254
+
255
+ for (const entry of entries) {
256
+ if (!entry.isDirectory()) continue;
257
+ if (!entry.name.startsWith('devbooks-')) continue;
258
+ if (allowedSkillNames.has(entry.name)) continue;
259
+
260
+ fs.rmSync(path.join(skillsDestDir, entry.name), { recursive: true, force: true });
261
+ removedCount++;
262
+ }
263
+
264
+ return removedCount;
265
+ }
266
+
249
267
  function getSkillsSupportLabel(level) {
250
268
  switch (level) {
251
269
  case SKILLS_SUPPORT.FULL:
@@ -276,6 +294,21 @@ function getSkillsSupportDescription(level) {
276
294
  }
277
295
  }
278
296
 
297
+ function getCliVersion() {
298
+ const packagePath = path.join(__dirname, '..', 'package.json');
299
+ try {
300
+ const raw = fs.readFileSync(packagePath, 'utf-8');
301
+ const pkg = JSON.parse(raw);
302
+ return pkg.version || 'unknown';
303
+ } catch {
304
+ return 'unknown';
305
+ }
306
+ }
307
+
308
+ function showVersion() {
309
+ console.log(`${CLI_COMMAND} v${getCliVersion()}`);
310
+ }
311
+
279
312
  // ============================================================================
280
313
  // Skills 支持说明
281
314
  // ============================================================================
@@ -375,6 +408,7 @@ function installSkills(toolIds, update = false) {
375
408
  .filter(name => fs.statSync(path.join(skillsSrcDir, name)).isDirectory());
376
409
 
377
410
  if (skillDirs.length === 0) continue;
411
+ const skillNames = new Set(skillDirs);
378
412
 
379
413
  fs.mkdirSync(skillsDestDir, { recursive: true });
380
414
 
@@ -404,7 +438,15 @@ function installSkills(toolIds, update = false) {
404
438
  installedCount++;
405
439
  }
406
440
 
407
- results.push({ tool: tool.name, type: 'skills', count: installedCount, total: skillDirs.length });
441
+ const removedCount = update ? pruneRemovedSkills(skillsDestDir, skillNames) : 0;
442
+
443
+ results.push({
444
+ tool: tool.name,
445
+ type: 'skills',
446
+ count: installedCount,
447
+ total: skillDirs.length,
448
+ removed: removedCount
449
+ });
408
450
  }
409
451
 
410
452
  // Qoder: 创建 agents 目录结构(但不复制 Skills,因为格式不同)
@@ -899,6 +941,9 @@ async function updateCommand(projectDir) {
899
941
  if (result.count > 0) {
900
942
  console.log(chalk.green('✓') + ` ${result.tool} ${result.type}: 更新了 ${result.count}/${result.total} 个`);
901
943
  }
944
+ if (result.removed && result.removed > 0) {
945
+ console.log(chalk.green('✓') + ` ${result.tool} ${result.type}: 清理了 ${result.removed} 个已删除的技能`);
946
+ }
902
947
  }
903
948
 
904
949
  // 更新 Rules(项目目录)
@@ -1025,6 +1070,7 @@ function showHelp() {
1025
1070
  console.log(' --keep-old 迁移后保留原目录');
1026
1071
  console.log(' --force 强制重新执行所有步骤');
1027
1072
  console.log(' -h, --help 显示此帮助信息');
1073
+ console.log(' -v, --version 显示版本号');
1028
1074
  console.log();
1029
1075
  console.log(chalk.cyan('支持的 AI 工具:'));
1030
1076
 
@@ -1088,6 +1134,9 @@ async function main() {
1088
1134
  if (arg === '-h' || arg === '--help') {
1089
1135
  showHelp();
1090
1136
  process.exit(0);
1137
+ } else if (arg === '-v' || arg === '--version') {
1138
+ showVersion();
1139
+ process.exit(0);
1091
1140
  } else if (arg === '--tools') {
1092
1141
  options.tools = args[++i];
1093
1142
  } else if (arg === '--from') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dev-playbooks-cn",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "AI-driven spec-based development workflow",
5
5
  "keywords": [
6
6
  "devbooks",
@@ -1,3 +1,13 @@
1
+ ---
2
+ name: devbooks-test-reviewer
3
+ description: devbooks-test-reviewer:以 Test Reviewer 角色评审 tests/ 测试质量(覆盖、边界、可读性、可维护性),只输出评审意见,不修改代码。用户说“测试评审/评审测试质量/覆盖率/边界条件”等时使用。
4
+ tools:
5
+ - Glob
6
+ - Grep
7
+ - Read
8
+ - Bash
9
+ ---
10
+
1
11
  # DevBooks:测试评审(Test Reviewer)
2
12
 
3
13
  ## 前置:配置发现(协议无关)