impeccable 2.1.5 → 2.1.6

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.
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  import { execSync } from 'node:child_process';
11
- import { existsSync, readFileSync, readdirSync, statSync, lstatSync, symlinkSync, readlinkSync, unlinkSync, mkdirSync, writeFileSync, rmSync, renameSync, createWriteStream } from 'node:fs';
11
+ import { existsSync, readFileSync, readdirSync, statSync, lstatSync, symlinkSync, readlinkSync, unlinkSync, mkdirSync, writeFileSync, rmSync, renameSync, createWriteStream, realpathSync } from 'node:fs';
12
12
  import { join, resolve, dirname } from 'node:path';
13
13
  import { createInterface } from 'node:readline';
14
14
  import { fileURLToPath } from 'node:url';
@@ -116,31 +116,52 @@ function normalizeForHash(content) {
116
116
  .replace(/^version:\s*.+$/m, 'version: NORMALIZED');
117
117
  }
118
118
 
119
+ /**
120
+ * Deduplicate providers by resolved path. When .claude/skills is a
121
+ * symlink to ../.agents/skills, both resolve to the same directory.
122
+ * Returns an array of { provider, localSkillsDir } with one entry
123
+ * per unique real path. The first provider that maps to a real path
124
+ * wins (so the bundle uses that provider's build).
125
+ */
126
+ function deduplicateProviders(root, providers) {
127
+ const seen = new Map(); // realPath -> { provider, localSkillsDir }
128
+ for (const provider of providers) {
129
+ const skillsDir = join(root, provider, 'skills');
130
+ if (!existsSync(skillsDir)) continue;
131
+ const real = realpathSync(skillsDir);
132
+ if (!seen.has(real)) {
133
+ seen.set(real, { provider, localSkillsDir: skillsDir });
134
+ }
135
+ }
136
+ return [...seen.values()];
137
+ }
138
+
119
139
  /**
120
140
  * Compare local skills against a downloaded bundle.
121
141
  * Only checks skills that exist in the bundle (ignores user's custom
122
- * skills that aren't part of impeccable). Uses a single provider from
123
- * the bundle as canonical and normalizes provider-specific paths.
142
+ * skills that aren't part of impeccable). Deduplicates providers that
143
+ * share the same real path (symlinks). Normalizes provider-specific
144
+ * paths and version fields before comparing.
124
145
  * Returns true if every bundle skill matches the local copy.
125
146
  */
126
147
  function isUpToDate(root, providers, bundleDir) {
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;
148
+ const unique = deduplicateProviders(root, providers);
149
+ if (unique.length === 0) return false;
150
+
151
+ for (const { provider, localSkillsDir } of unique) {
152
+ const bundleSkillsDir = join(bundleDir, provider, 'skills');
153
+ if (!existsSync(bundleSkillsDir)) continue;
154
+
155
+ for (const name of readdirSync(bundleSkillsDir)) {
156
+ const bundleMd = join(bundleSkillsDir, name, 'SKILL.md');
157
+ const localMd = join(localSkillsDir, name, 'SKILL.md');
158
+ if (!existsSync(bundleMd)) continue;
159
+ if (!existsSync(localMd)) return false;
160
+
161
+ const bundleHash = createHash('sha256').update(normalizeForHash(readFileSync(bundleMd, 'utf-8'))).digest('hex');
162
+ const localHash = createHash('sha256').update(normalizeForHash(readFileSync(localMd, 'utf-8'))).digest('hex');
163
+ if (bundleHash !== localHash) return false;
164
+ }
144
165
  }
145
166
  return true;
146
167
  }
@@ -526,7 +547,7 @@ async function update(flags = []) {
526
547
  }
527
548
 
528
549
  // Compare local vs remote -- skip if already up to date
529
- if (!yes && isUpToDate(root, providers, tmpDir)) {
550
+ if (isUpToDate(root, providers, tmpDir)) {
530
551
  rmSync(tmpDir, { recursive: true, force: true });
531
552
  const v = getSkillsVersion(root);
532
553
  console.log(`Skills are up to date${v ? ` (v${v})` : ''}. Nothing to do.`);
@@ -546,18 +567,20 @@ async function update(flags = []) {
546
567
 
547
568
  try {
548
569
 
549
- // Copy from the already-downloaded bundle to each provider folder
570
+ // Copy from the bundle to each unique provider folder.
571
+ // Deduplicate so symlinked dirs (e.g. .claude/skills -> .agents/skills)
572
+ // are only written once with the correct provider's content.
573
+ const unique = deduplicateProviders(root, providers);
550
574
  let updated = 0;
551
- for (const provider of providers) {
575
+ for (const { provider, localSkillsDir } of unique) {
552
576
  const srcDir = join(tmpDir, provider, 'skills');
553
- const destDir = join(root, provider, 'skills');
554
577
  if (!existsSync(srcDir)) continue;
555
578
 
556
579
  const skills = readdirSync(srcDir, { withFileTypes: true });
557
580
  for (const skill of skills) {
558
581
  if (!skill.isDirectory()) continue;
559
582
  const src = join(srcDir, skill.name);
560
- const dest = join(destDir, skill.name);
583
+ const dest = join(localSkillsDir, skill.name);
561
584
  if (existsSync(dest)) rmSync(dest, { recursive: true });
562
585
  copyDirSync(src, dest);
563
586
  updated++;
@@ -582,7 +605,7 @@ async function update(flags = []) {
582
605
  }
583
606
 
584
607
  const v = getSkillsVersion(root);
585
- console.log(`Updated ${updated} skills across ${providers.length} provider(s)${v ? ` to v${v}` : ''}.`);
608
+ console.log(`Updated ${updated} skill(s)${v ? ` to v${v}` : ''}.`);
586
609
  console.log('Done!\n');
587
610
  } catch (e) {
588
611
  console.error(`Update failed: ${e.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impeccable",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "author": "Paul Bakaus",
5
5
  "description": "Design skills, commands, and anti-pattern detection for AI coding agents",
6
6
  "keywords": [