mdk-skills 2.1.9 → 2.1.11
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/package.json +1 -1
- package/scripts/cli.js +14 -0
- package/scripts/core.js +7 -1
package/package.json
CHANGED
package/scripts/cli.js
CHANGED
|
@@ -113,6 +113,13 @@ function installSelectedSkills(selectedNames) {
|
|
|
113
113
|
console.log(" 📝 CLAUDE.md 已创建\n");
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
// 复制 profiles.json 到项目
|
|
117
|
+
const profilesSource = path.join(skillsSource, ".claude", "profiles.json");
|
|
118
|
+
const profilesDest = path.join(claudeDest, "profiles.json");
|
|
119
|
+
if (fs.existsSync(profilesSource) && !fs.existsSync(profilesDest)) {
|
|
120
|
+
fs.copyFileSync(profilesSource, profilesDest);
|
|
121
|
+
}
|
|
122
|
+
|
|
116
123
|
return installedCount;
|
|
117
124
|
}
|
|
118
125
|
|
|
@@ -191,6 +198,13 @@ function applyProfile(profile) {
|
|
|
191
198
|
console.log(" 📝 CLAUDE.md 已创建\n");
|
|
192
199
|
}
|
|
193
200
|
|
|
201
|
+
// 复制 profiles.json 到项目(方便在项目里修改后 sync 推回)
|
|
202
|
+
const profilesSource = path.join(skillsSource, ".claude", "profiles.json");
|
|
203
|
+
const profilesDest = path.join(claudeDest, "profiles.json");
|
|
204
|
+
if (fs.existsSync(profilesSource)) {
|
|
205
|
+
fs.copyFileSync(profilesSource, profilesDest);
|
|
206
|
+
}
|
|
207
|
+
|
|
194
208
|
// 输出结果
|
|
195
209
|
const enabledCount = selected.length;
|
|
196
210
|
const disabledCount = pkgSkills.length - enabledCount;
|
package/scripts/core.js
CHANGED
|
@@ -46,7 +46,13 @@ function backupDir(dir) {
|
|
|
46
46
|
|
|
47
47
|
for (const item of fs.readdirSync(dir)) {
|
|
48
48
|
if (item === "backups") continue;
|
|
49
|
-
|
|
49
|
+
const srcPath = path.join(dir, item);
|
|
50
|
+
const destPath = path.join(bakPath, item);
|
|
51
|
+
if (fs.statSync(srcPath).isDirectory()) {
|
|
52
|
+
copyDirSync(srcPath, destPath);
|
|
53
|
+
} else {
|
|
54
|
+
fs.copyFileSync(srcPath, destPath);
|
|
55
|
+
}
|
|
50
56
|
}
|
|
51
57
|
|
|
52
58
|
// 清理旧备份,只保留最近 3 份
|