dev-playbooks 1.0.18 → 1.0.19
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 +30 -1
- 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
|
-
|
|
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,因为格式不同)
|
|
@@ -911,6 +937,9 @@ async function updateCommand(projectDir) {
|
|
|
911
937
|
if (result.count > 0) {
|
|
912
938
|
console.log(chalk.green('✓') + ` ${result.tool} ${result.type}: updated ${result.count}/${result.total}`);
|
|
913
939
|
}
|
|
940
|
+
if (result.removed && result.removed > 0) {
|
|
941
|
+
console.log(chalk.green('✓') + ` ${result.tool} ${result.type}: removed ${result.removed} obsolete skills`);
|
|
942
|
+
}
|
|
914
943
|
}
|
|
915
944
|
|
|
916
945
|
// Update Rules (project directory)
|