impeccable 2.1.2 → 2.1.4
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 +31 -5
- package/package.json +1 -1
package/bin/commands/skills.mjs
CHANGED
|
@@ -112,15 +112,41 @@ async function downloadAndExtractBundle() {
|
|
|
112
112
|
return tmpDir;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Normalize a SKILL.md's content for comparison by stripping
|
|
117
|
+
* provider-specific paths. Different install methods (npx skills add
|
|
118
|
+
* vs our bundle) resolve {{scripts_path}} to different provider dirs
|
|
119
|
+
* (e.g. .agents vs .claude), so we strip those differences.
|
|
120
|
+
*/
|
|
121
|
+
function normalizeForHash(content) {
|
|
122
|
+
return content.replace(/\.(claude|cursor|agents|gemini|codex|kiro|opencode|pi|trae|trae-cn|rovodev)\/skills\//g, '.PROVIDER/skills/');
|
|
123
|
+
}
|
|
124
|
+
|
|
115
125
|
/**
|
|
116
126
|
* Compare local skills against a downloaded bundle.
|
|
117
|
-
*
|
|
127
|
+
* Only checks skills that exist in the bundle (ignores user's custom
|
|
128
|
+
* skills that aren't part of impeccable). Uses a single provider from
|
|
129
|
+
* the bundle as canonical and normalizes provider-specific paths.
|
|
130
|
+
* Returns true if every bundle skill matches the local copy.
|
|
118
131
|
*/
|
|
119
132
|
function isUpToDate(root, providers, bundleDir) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
133
|
+
// Use the first installed provider for comparison
|
|
134
|
+
const provider = providers[0];
|
|
135
|
+
const bundleSkillsDir = join(bundleDir, provider, 'skills');
|
|
136
|
+
const localSkillsDir = join(root, provider, 'skills');
|
|
137
|
+
if (!existsSync(bundleSkillsDir)) return false;
|
|
138
|
+
|
|
139
|
+
for (const name of readdirSync(bundleSkillsDir)) {
|
|
140
|
+
const bundleMd = join(bundleSkillsDir, name, 'SKILL.md');
|
|
141
|
+
const localMd = join(localSkillsDir, name, 'SKILL.md');
|
|
142
|
+
if (!existsSync(bundleMd)) continue;
|
|
143
|
+
|
|
144
|
+
// Missing locally = needs update
|
|
145
|
+
if (!existsSync(localMd)) return false;
|
|
146
|
+
|
|
147
|
+
const bundleHash = createHash('sha256').update(normalizeForHash(readFileSync(bundleMd, 'utf-8'))).digest('hex');
|
|
148
|
+
const localHash = createHash('sha256').update(normalizeForHash(readFileSync(localMd, 'utf-8'))).digest('hex');
|
|
149
|
+
if (bundleHash !== localHash) return false;
|
|
124
150
|
}
|
|
125
151
|
return true;
|
|
126
152
|
}
|