speccrew 0.5.11 → 0.5.12
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/lib/commands/init.js +10 -1
- package/lib/commands/update.js +9 -0
- package/lib/utils.js +26 -0
- package/package.json +1 -1
package/lib/commands/init.js
CHANGED
|
@@ -9,6 +9,9 @@ const {
|
|
|
9
9
|
getSourceRoot,
|
|
10
10
|
getWorkspaceTemplatePath,
|
|
11
11
|
ensureDirectories,
|
|
12
|
+
removeDirRecursive,
|
|
13
|
+
DEPRECATED_SKILLS,
|
|
14
|
+
cleanDeprecatedSkills,
|
|
12
15
|
} = require('../utils');
|
|
13
16
|
const { resolveIDE, transformAgentForIDE, transformSkillForIDE } = require('../ide-adapters');
|
|
14
17
|
|
|
@@ -342,7 +345,13 @@ async function runInit(options = {}) {
|
|
|
342
345
|
|
|
343
346
|
const agentsResult = copyAgents(agentsSourceDir, agentsDestDir, ideConfig);
|
|
344
347
|
const skillsResult = copySkills(skillsSourceDir, skillsDestDir, ideConfig);
|
|
345
|
-
|
|
348
|
+
|
|
349
|
+
// Clean up deprecated skills
|
|
350
|
+
const cleanedCount = cleanDeprecatedSkills(skillsDestDir, DEPRECATED_SKILLS);
|
|
351
|
+
if (cleanedCount > 0 && !silent) {
|
|
352
|
+
log(` Cleaned up ${cleanedCount} deprecated skill(s) from ${ideConfig.name}`);
|
|
353
|
+
}
|
|
354
|
+
|
|
346
355
|
stats.ides.push({
|
|
347
356
|
name: ideConfig.name,
|
|
348
357
|
baseDir: ideConfig.baseDir,
|
package/lib/commands/update.js
CHANGED
|
@@ -8,6 +8,9 @@ const {
|
|
|
8
8
|
getSourceRoot,
|
|
9
9
|
getWorkspaceTemplatePath,
|
|
10
10
|
copyDirRecursive,
|
|
11
|
+
removeDirRecursive,
|
|
12
|
+
DEPRECATED_SKILLS,
|
|
13
|
+
cleanDeprecatedSkills,
|
|
11
14
|
} = require('../utils');
|
|
12
15
|
const { resolveIDE, getIDEConfig, transformAgentForIDE, transformSkillForIDE } = require('../ide-adapters');
|
|
13
16
|
|
|
@@ -451,6 +454,12 @@ function run() {
|
|
|
451
454
|
totalStats.skills.added += skillStats.added;
|
|
452
455
|
totalStats.extra.push(...skillStats.extra);
|
|
453
456
|
totalStats.extraDirs.push(...skillStats.extraDirs);
|
|
457
|
+
|
|
458
|
+
// Clean up deprecated skills
|
|
459
|
+
const cleanedCount = cleanDeprecatedSkills(destSkillsDir, DEPRECATED_SKILLS);
|
|
460
|
+
if (cleanedCount > 0) {
|
|
461
|
+
console.log(` Cleaned up ${cleanedCount} deprecated skill(s) from ${ide.name}`);
|
|
462
|
+
}
|
|
454
463
|
}
|
|
455
464
|
|
|
456
465
|
// 更新 workspace 文件(docs, scripts 等所有子目录)
|
package/lib/utils.js
CHANGED
|
@@ -107,6 +107,30 @@ function removeDirRecursive(dirPath) {
|
|
|
107
107
|
fs.rmdirSync(dirPath);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
// Deprecated skills that should be auto-cleaned on init/update
|
|
111
|
+
const DEPRECATED_SKILLS = [
|
|
112
|
+
'speccrew-dev-desktop', // replaced by speccrew-dev-desktop-electron + speccrew-dev-desktop-tauri
|
|
113
|
+
'speccrew-dev-review', // replaced by speccrew-dev-review-backend/frontend/mobile/desktop
|
|
114
|
+
];
|
|
115
|
+
|
|
116
|
+
function cleanDeprecatedSkills(destDir, deprecatedList) {
|
|
117
|
+
if (!fs.existsSync(destDir)) return 0;
|
|
118
|
+
let cleaned = 0;
|
|
119
|
+
try {
|
|
120
|
+
const entries = fs.readdirSync(destDir, { withFileTypes: true });
|
|
121
|
+
for (const entry of entries) {
|
|
122
|
+
if (entry.isDirectory() && deprecatedList.includes(entry.name)) {
|
|
123
|
+
const fullPath = path.join(destDir, entry.name);
|
|
124
|
+
removeDirRecursive(fullPath);
|
|
125
|
+
cleaned++;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
} catch (error) {
|
|
129
|
+
// Silently ignore cleanup errors to not block main flow
|
|
130
|
+
}
|
|
131
|
+
return cleaned;
|
|
132
|
+
}
|
|
133
|
+
|
|
110
134
|
module.exports = {
|
|
111
135
|
copyDirRecursive,
|
|
112
136
|
isSpeccrewFile,
|
|
@@ -117,4 +141,6 @@ module.exports = {
|
|
|
117
141
|
getWorkspaceTemplatePath,
|
|
118
142
|
ensureDirectories,
|
|
119
143
|
removeDirRecursive,
|
|
144
|
+
DEPRECATED_SKILLS,
|
|
145
|
+
cleanDeprecatedSkills,
|
|
120
146
|
};
|