@pedroab0/skills 1.1.0 → 1.2.0

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/cli.js CHANGED
@@ -506,12 +506,32 @@ function checkFigmaToken(options = {}) {
506
506
  // Skill Installation Logic
507
507
  // -----------------------------------------------------------------------------
508
508
 
509
+ const EXCLUDED_SKILL_DIRS = new Set(['demo', 'demos', '.specs', 'node_modules', '.git']);
510
+
511
+ function shouldCopySkillEntry(rootSkillPath) {
512
+ return (srcPath) => {
513
+ const rel = path.relative(rootSkillPath, srcPath);
514
+ if (!rel) return true;
515
+ const parts = rel.split(/[\\/]/);
516
+ const base = parts[parts.length - 1];
517
+ if (base === '.DS_Store' || base === 'Thumbs.db' || /^test_.*\.js$/i.test(base)) {
518
+ return false;
519
+ }
520
+ for (let i = 0; i < parts.length; i++) {
521
+ if (EXCLUDED_SKILL_DIRS.has(parts[i])) return false;
522
+ if (parts[i] === 'figma-plugin' && parts[i + 1] === 'assets') return false;
523
+ }
524
+ return true;
525
+ };
526
+ }
527
+
509
528
  function installSkill(skill, destDir, useSymlink = false, isCursor = false) {
510
529
  if (!fs.existsSync(destDir)) {
511
530
  fs.mkdirSync(destDir, { recursive: true });
512
531
  }
513
532
 
514
533
  const targetPath = path.join(destDir, skill.name);
534
+ const copyFilter = shouldCopySkillEntry(skill.path);
515
535
 
516
536
  if (isCursor) {
517
537
  const cursorSkillsDir = path.join(path.dirname(destDir), 'skills', skill.name);
@@ -520,7 +540,7 @@ function installSkill(skill, destDir, useSymlink = false, isCursor = false) {
520
540
  if (fs.existsSync(cursorSkillsDir)) {
521
541
  fs.rmSync(cursorSkillsDir, { recursive: true, force: true });
522
542
  }
523
- fs.cpSync(skill.path, cursorSkillsDir, { recursive: true });
543
+ fs.cpSync(skill.path, cursorSkillsDir, { recursive: true, filter: copyFilter });
524
544
 
525
545
  const rawSkillMd = fs.readFileSync(path.join(skill.path, 'SKILL.md'), 'utf8');
526
546
  const skillBody = rawSkillMd.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n*/, '');
@@ -545,11 +565,11 @@ ${skillBody}`;
545
565
  fs.symlinkSync(skill.path, targetPath, symlinkType);
546
566
  return { targetPath, isSymlink: true };
547
567
  } catch (e) {
548
- fs.cpSync(skill.path, targetPath, { recursive: true });
568
+ fs.cpSync(skill.path, targetPath, { recursive: true, filter: copyFilter });
549
569
  return { targetPath, isSymlink: false };
550
570
  }
551
571
  } else {
552
- fs.cpSync(skill.path, targetPath, { recursive: true });
572
+ fs.cpSync(skill.path, targetPath, { recursive: true, filter: copyFilter });
553
573
  const scriptsDir = path.join(targetPath, 'scripts');
554
574
  if (fs.existsSync(scriptsDir)) {
555
575
  try {