impeccable 2.1.5 → 2.1.7

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.7",
4
4
  "author": "Paul Bakaus",
5
5
  "description": "Design skills, commands, and anti-pattern detection for AI coding agents",
6
6
  "keywords": [
@@ -516,7 +516,7 @@ function checkColors(opts) {
516
516
  // Tailwind class checks
517
517
  if (classList) {
518
518
  const classStr = typeof classList === 'string' ? classList : Array.from(classList).join(' ');
519
- if (/\bbg-black\b/.test(classStr)) {
519
+ if (/\bbg-black\b(?!\/)/.test(classStr)) {
520
520
  findings.push({ id: 'pure-black-white', snippet: 'bg-black' });
521
521
  }
522
522
 
@@ -822,9 +822,11 @@ function resolveBackground(el, win) {
822
822
  while (current && current.nodeType === 1) {
823
823
  const style = IS_BROWSER ? getComputedStyle(current) : win.getComputedStyle(current);
824
824
 
825
- // If this element has a gradient background, it's opaque but we can't determine the color
825
+ // If this element has a background-image (gradient or url), it's visually
826
+ // opaque but we can't determine the effective color — bail out so callers
827
+ // don't get a false solid-color answer.
826
828
  const bgImage = style.backgroundImage || '';
827
- if (bgImage && bgImage !== 'none' && /gradient/i.test(bgImage)) {
829
+ if (bgImage && bgImage !== 'none' && (/gradient/i.test(bgImage) || /url\s*\(/i.test(bgImage))) {
828
830
  return null;
829
831
  }
830
832
 
@@ -834,8 +836,8 @@ function resolveBackground(el, win) {
834
836
  const rawStyle = current.getAttribute?.('style') || '';
835
837
  const bgMatch = rawStyle.match(/background(?:-color)?\s*:\s*([^;]+)/i);
836
838
  const inlineBg = bgMatch ? bgMatch[1].trim() : '';
837
- // Check for gradient in inline style too
838
- if (/gradient/i.test(inlineBg)) return null;
839
+ // Check for gradient or url() image in inline style too
840
+ if (/gradient/i.test(inlineBg) || /url\s*\(/i.test(inlineBg)) return null;
839
841
  bg = parseRgb(inlineBg);
840
842
  if (!bg && inlineBg) {
841
843
  const hexMatch = inlineBg.match(/#([0-9a-f]{6}|[0-9a-f]{3})\b/i);
@@ -511,7 +511,7 @@ function checkColors(opts) {
511
511
  // Tailwind class checks
512
512
  if (classList) {
513
513
  const classStr = typeof classList === 'string' ? classList : Array.from(classList).join(' ');
514
- if (/\bbg-black\b/.test(classStr)) {
514
+ if (/\bbg-black\b(?!\/)/.test(classStr)) {
515
515
  findings.push({ id: 'pure-black-white', snippet: 'bg-black' });
516
516
  }
517
517
 
@@ -817,9 +817,11 @@ function resolveBackground(el, win) {
817
817
  while (current && current.nodeType === 1) {
818
818
  const style = IS_BROWSER ? getComputedStyle(current) : win.getComputedStyle(current);
819
819
 
820
- // If this element has a gradient background, it's opaque but we can't determine the color
820
+ // If this element has a background-image (gradient or url), it's visually
821
+ // opaque but we can't determine the effective color — bail out so callers
822
+ // don't get a false solid-color answer.
821
823
  const bgImage = style.backgroundImage || '';
822
- if (bgImage && bgImage !== 'none' && /gradient/i.test(bgImage)) {
824
+ if (bgImage && bgImage !== 'none' && (/gradient/i.test(bgImage) || /url\s*\(/i.test(bgImage))) {
823
825
  return null;
824
826
  }
825
827
 
@@ -829,8 +831,8 @@ function resolveBackground(el, win) {
829
831
  const rawStyle = current.getAttribute?.('style') || '';
830
832
  const bgMatch = rawStyle.match(/background(?:-color)?\s*:\s*([^;]+)/i);
831
833
  const inlineBg = bgMatch ? bgMatch[1].trim() : '';
832
- // Check for gradient in inline style too
833
- if (/gradient/i.test(inlineBg)) return null;
834
+ // Check for gradient or url() image in inline style too
835
+ if (/gradient/i.test(inlineBg) || /url\s*\(/i.test(inlineBg)) return null;
834
836
  bg = parseRgb(inlineBg);
835
837
  if (!bg && inlineBg) {
836
838
  const hexMatch = inlineBg.match(/#([0-9a-f]{6}|[0-9a-f]{3})\b/i);