impeccable 2.1.2 → 2.1.3
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/commands/skills.mjs +19 -4
- package/package.json +1 -1
package/bin/commands/skills.mjs
CHANGED
|
@@ -114,13 +114,28 @@ async function downloadAndExtractBundle() {
|
|
|
114
114
|
|
|
115
115
|
/**
|
|
116
116
|
* Compare local skills against a downloaded bundle.
|
|
117
|
-
*
|
|
117
|
+
* Only checks skills that exist in the bundle (ignores user's custom
|
|
118
|
+
* skills that aren't part of impeccable).
|
|
119
|
+
* Returns true if every bundle skill matches the local copy.
|
|
118
120
|
*/
|
|
119
121
|
function isUpToDate(root, providers, bundleDir) {
|
|
120
122
|
for (const provider of providers) {
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
123
|
+
const bundleSkillsDir = join(bundleDir, provider, 'skills');
|
|
124
|
+
const localSkillsDir = join(root, provider, 'skills');
|
|
125
|
+
if (!existsSync(bundleSkillsDir)) continue;
|
|
126
|
+
|
|
127
|
+
for (const name of readdirSync(bundleSkillsDir)) {
|
|
128
|
+
const bundleMd = join(bundleSkillsDir, name, 'SKILL.md');
|
|
129
|
+
const localMd = join(localSkillsDir, name, 'SKILL.md');
|
|
130
|
+
if (!existsSync(bundleMd)) continue;
|
|
131
|
+
|
|
132
|
+
// Missing locally = needs update
|
|
133
|
+
if (!existsSync(localMd)) return false;
|
|
134
|
+
|
|
135
|
+
const bundleHash = createHash('sha256').update(readFileSync(bundleMd)).digest('hex');
|
|
136
|
+
const localHash = createHash('sha256').update(readFileSync(localMd)).digest('hex');
|
|
137
|
+
if (bundleHash !== localHash) return false;
|
|
138
|
+
}
|
|
124
139
|
}
|
|
125
140
|
return true;
|
|
126
141
|
}
|