impeccable 2.1.3 → 2.1.5

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.
@@ -60,26 +60,18 @@ async function showHelp() {
60
60
 
61
61
  // ─── version helpers ─────────────────────────────────────────────────────────
62
62
 
63
- function getLocalVersion() {
64
- try {
65
- const pkg = JSON.parse(readFileSync(join(__dirname, '..', '..', 'package.json'), 'utf-8'));
66
- return pkg.version;
67
- } catch {
68
- return null;
63
+ /**
64
+ * Read the skills version from the impeccable SKILL.md frontmatter.
65
+ */
66
+ function getSkillsVersion(root) {
67
+ for (const d of PROVIDER_DIRS) {
68
+ const skillMd = join(root, d, 'skills', 'impeccable', 'SKILL.md');
69
+ if (!existsSync(skillMd)) continue;
70
+ const content = readFileSync(skillMd, 'utf-8');
71
+ const match = content.match(/^version:\s*(.+)$/m);
72
+ if (match) return match[1].trim().replace(/^["']|["']$/g, '');
69
73
  }
70
- }
71
-
72
- function fetchRemoteVersion() {
73
- return new Promise((resolve) => {
74
- get('https://registry.npmjs.org/impeccable/latest', (res) => {
75
- if (res.statusCode !== 200) { resolve(null); res.resume(); return; }
76
- let data = '';
77
- res.on('data', (chunk) => { data += chunk; });
78
- res.on('end', () => {
79
- try { resolve(JSON.parse(data).version); } catch { resolve(null); }
80
- });
81
- }).on('error', () => resolve(null));
82
- });
74
+ return null;
83
75
  }
84
76
 
85
77
  /**
@@ -112,30 +104,43 @@ async function downloadAndExtractBundle() {
112
104
  return tmpDir;
113
105
  }
114
106
 
107
+ /**
108
+ * Normalize a SKILL.md's content for comparison by stripping
109
+ * provider-specific paths. Different install methods (npx skills add
110
+ * vs our bundle) resolve {{scripts_path}} to different provider dirs
111
+ * (e.g. .agents vs .claude), so we strip those differences.
112
+ */
113
+ function normalizeForHash(content) {
114
+ return content
115
+ .replace(/\.(claude|cursor|agents|gemini|codex|kiro|opencode|pi|trae|trae-cn|rovodev)\/skills\//g, '.PROVIDER/skills/')
116
+ .replace(/^version:\s*.+$/m, 'version: NORMALIZED');
117
+ }
118
+
115
119
  /**
116
120
  * Compare local skills against a downloaded bundle.
117
121
  * Only checks skills that exist in the bundle (ignores user's custom
118
- * skills that aren't part of impeccable).
122
+ * skills that aren't part of impeccable). Uses a single provider from
123
+ * the bundle as canonical and normalizes provider-specific paths.
119
124
  * Returns true if every bundle skill matches the local copy.
120
125
  */
121
126
  function isUpToDate(root, providers, bundleDir) {
122
- for (const provider of providers) {
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
- }
127
+ // Use the first installed provider for comparison
128
+ const provider = providers[0];
129
+ const bundleSkillsDir = join(bundleDir, provider, 'skills');
130
+ const localSkillsDir = join(root, provider, 'skills');
131
+ if (!existsSync(bundleSkillsDir)) return false;
132
+
133
+ for (const name of readdirSync(bundleSkillsDir)) {
134
+ const bundleMd = join(bundleSkillsDir, name, 'SKILL.md');
135
+ const localMd = join(localSkillsDir, name, 'SKILL.md');
136
+ if (!existsSync(bundleMd)) continue;
137
+
138
+ // Missing locally = needs update
139
+ if (!existsSync(localMd)) return false;
140
+
141
+ const bundleHash = createHash('sha256').update(normalizeForHash(readFileSync(bundleMd, 'utf-8'))).digest('hex');
142
+ const localHash = createHash('sha256').update(normalizeForHash(readFileSync(localMd, 'utf-8'))).digest('hex');
143
+ if (bundleHash !== localHash) return false;
139
144
  }
140
145
  return true;
141
146
  }
@@ -153,7 +158,6 @@ async function check() {
153
158
  }
154
159
 
155
160
  const providers = findInstalledProviders(root);
156
- const version = getLocalVersion();
157
161
 
158
162
  console.log('Checking for updates...\n');
159
163
  try {
@@ -162,9 +166,10 @@ async function check() {
162
166
  rmSync(bundleDir, { recursive: true, force: true });
163
167
 
164
168
  if (upToDate) {
165
- console.log(`Skills are up to date${version ? ` (v${version})` : ''}.`);
169
+ const v = getSkillsVersion(root);
170
+ console.log(`Skills are up to date${v ? ` (v${v})` : ''}.`);
166
171
  } else {
167
- console.log(`Updates available${version ? ` (currently v${version})` : ''}.`);
172
+ console.log('Updates available.');
168
173
  console.log('Run `npx impeccable skills update` to update.');
169
174
  }
170
175
  } catch (e) {
@@ -523,8 +528,8 @@ async function update(flags = []) {
523
528
  // Compare local vs remote -- skip if already up to date
524
529
  if (!yes && isUpToDate(root, providers, tmpDir)) {
525
530
  rmSync(tmpDir, { recursive: true, force: true });
526
- const version = getLocalVersion();
527
- console.log(`Skills are up to date${version ? ` (v${version})` : ''}. Nothing to do.`);
531
+ const v = getSkillsVersion(root);
532
+ console.log(`Skills are up to date${v ? ` (v${v})` : ''}. Nothing to do.`);
528
533
  process.exit(0);
529
534
  }
530
535
 
@@ -576,8 +581,8 @@ async function update(flags = []) {
576
581
  // Not available -- skip
577
582
  }
578
583
 
579
- const version = await fetchRemoteVersion();
580
- console.log(`Updated ${updated} skills across ${providers.length} provider(s)${version ? ` to v${version}` : ''}.`);
584
+ const v = getSkillsVersion(root);
585
+ console.log(`Updated ${updated} skills across ${providers.length} provider(s)${v ? ` to v${v}` : ''}.`);
581
586
  console.log('Done!\n');
582
587
  } catch (e) {
583
588
  console.error(`Update failed: ${e.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impeccable",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "author": "Paul Bakaus",
5
5
  "description": "Design skills, commands, and anti-pattern detection for AI coding agents",
6
6
  "keywords": [