dev-playbooks-cn 1.0.19 → 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.
Files changed (2) hide show
  1. package/bin/devbooks.js +30 -1
  2. package/package.json +1 -1
package/bin/devbooks.js CHANGED
@@ -247,6 +247,23 @@ function copyDirSync(src, dest) {
247
247
  return count;
248
248
  }
249
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
+
250
267
  function getSkillsSupportLabel(level) {
251
268
  switch (level) {
252
269
  case SKILLS_SUPPORT.FULL:
@@ -391,6 +408,7 @@ function installSkills(toolIds, update = false) {
391
408
  .filter(name => fs.statSync(path.join(skillsSrcDir, name)).isDirectory());
392
409
 
393
410
  if (skillDirs.length === 0) continue;
411
+ const skillNames = new Set(skillDirs);
394
412
 
395
413
  fs.mkdirSync(skillsDestDir, { recursive: true });
396
414
 
@@ -420,7 +438,15 @@ function installSkills(toolIds, update = false) {
420
438
  installedCount++;
421
439
  }
422
440
 
423
- 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
+ });
424
450
  }
425
451
 
426
452
  // Qoder: 创建 agents 目录结构(但不复制 Skills,因为格式不同)
@@ -915,6 +941,9 @@ async function updateCommand(projectDir) {
915
941
  if (result.count > 0) {
916
942
  console.log(chalk.green('✓') + ` ${result.tool} ${result.type}: 更新了 ${result.count}/${result.total} 个`);
917
943
  }
944
+ if (result.removed && result.removed > 0) {
945
+ console.log(chalk.green('✓') + ` ${result.tool} ${result.type}: 清理了 ${result.removed} 个已删除的技能`);
946
+ }
918
947
  }
919
948
 
920
949
  // 更新 Rules(项目目录)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dev-playbooks-cn",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "AI-driven spec-based development workflow",
5
5
  "keywords": [
6
6
  "devbooks",