UNPKG

rigjs

Version:

A multi-repos dev tool based on yarn and git.Rigjs is intended to be the simplest way to develop,share and deliver codes between different developers or different projects.

36 lines (30 loc) 1.39 kB
#!/usr/bin/env node // Keep Claude plugin skill copies in sync with canonical root skill files. // Runs from `prepublishOnly` so the tarball always ships matching copies. // // We keep two real files (instead of a symlink) because npm pack does not // preserve symlinks in the tarball, and the official Claude Code plugin // loader expects a real file at <plugin>/.claude/skills/<name>/SKILL.md. import { readFileSync, writeFileSync, mkdirSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; import path from 'node:path'; const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); const skills = [ ['RIG_WIKI_SKILL.md', '.claude/skills/rig-wiki/SKILL.md'], ['RIG_PACKAGE_SKILL.md', '.claude/skills/rig-package/SKILL.md'], ['RIG_CICD_SKILL.md', '.claude/skills/rig-cicd/SKILL.md'], ]; for (const [srcRel, destRel] of skills) { const src = path.join(repoRoot, srcRel); const dest = path.join(repoRoot, destRel); const srcContent = readFileSync(src, 'utf8'); mkdirSync(path.dirname(dest), { recursive: true }); let destContent = ''; try { destContent = readFileSync(dest, 'utf8'); } catch { /* missing is fine */ } if (srcContent === destContent) { console.log(`sync-skill: ${destRel} already in sync`); } else { writeFileSync(dest, srcContent, 'utf8'); console.log(`sync-skill: wrote ${destRel} (<- ${srcRel})`); } }