@lifeaitools/rdc-skills 0.9.6 → 0.9.8

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lifeaitools/rdc-skills",
3
- "version": "0.9.6",
4
- "description": "RDC typed-agent dispatch skill suite for Claude Code plan, build, review, overnight builds",
3
+ "version": "0.9.8",
4
+ "description": "RDC typed-agent dispatch skill suite for Claude Code \u00e2\u20ac\u201d plan, build, review, overnight builds",
5
5
  "keywords": [
6
6
  "claude-code",
7
7
  "claude-code-plugin",
@@ -120,6 +120,62 @@ function buildPluginCache(cacheDir, version, gitSha) {
120
120
  }
121
121
  }
122
122
 
123
+ // ── User-skills cleanup ───────────────────────────────────────────────────────
124
+ // Older installer versions wrote skill files directly to ~/.claude/skills/user/.
125
+ // Claude Code loads that directory AND the plugin cache, so any rdc skills left
126
+ // there produce duplicate registrations and break the resolver.
127
+ // This function nukes any entry whose frontmatter name starts with "rdc:".
128
+ function cleanUserSkills(userSkillsDir) {
129
+ if (!fs.existsSync(userSkillsDir)) return 0;
130
+ let removed = 0;
131
+ for (const entry of fs.readdirSync(userSkillsDir, { withFileTypes: true })) {
132
+ const candidate = path.join(userSkillsDir, entry.name);
133
+ let skillFile = null;
134
+ if (entry.isDirectory()) {
135
+ // New format: <name>/SKILL.md or <name>/skill.md
136
+ for (const sf of ['SKILL.md', 'skill.md']) {
137
+ const p = path.join(candidate, sf);
138
+ if (fs.existsSync(p)) { skillFile = p; break; }
139
+ }
140
+ } else if (entry.isFile() && entry.name.endsWith('.md') && entry.name !== 'skill.md' && entry.name !== 'SKILL.md' && entry.name !== 'README.md') {
141
+ // Old format: rdc-deploy.md flat file
142
+ skillFile = candidate;
143
+ }
144
+ if (!skillFile) continue;
145
+ const fm = readFrontmatter(skillFile);
146
+ if (fm.name && fm.name.startsWith('rdc:')) {
147
+ try {
148
+ if (entry.isDirectory()) fs.rmSync(candidate, { recursive: true, force: true });
149
+ else fs.unlinkSync(candidate);
150
+ removed++;
151
+ } catch {}
152
+ }
153
+ }
154
+ return removed;
155
+ }
156
+
157
+ // ── Stale hook cleanup ────────────────────────────────────────────────────────
158
+ // Remove ONLY explicitly orphaned hook files — hooks that were previously shipped
159
+ // by rdc-skills and have since been removed from the project.
160
+ // NEVER use "not in source = remove" logic: most hooks in ~/.claude/hooks/ are
161
+ // not managed by rdc-skills (they come from other plugins or were written directly).
162
+ function cleanStaleHooks(hooksDstDir) {
163
+ if (!fs.existsSync(hooksDstDir)) return 0;
164
+ // Explicit orphan list — add entries here when a hook is intentionally removed.
165
+ // Format: filename that should be deleted if it still exists.
166
+ const ORPHANED_HOOKS = [
167
+ 'verify-rdc-skills.js', // removed in v0.9.7 — was checking for old flat-file format
168
+ ];
169
+ let removed = 0;
170
+ for (const f of ORPHANED_HOOKS) {
171
+ const p = path.join(hooksDstDir, f);
172
+ if (fs.existsSync(p)) {
173
+ try { fs.unlinkSync(p); removed++; } catch {}
174
+ }
175
+ }
176
+ return removed;
177
+ }
178
+
123
179
  // ── Cache flush helper ────────────────────────────────────────────────────────
124
180
  function flushOldCaches(cacheBase, keepVersion) {
125
181
  if (!fs.existsSync(cacheBase)) return 0;
@@ -480,6 +536,20 @@ async function main() {
480
536
  warn('[0/6] git pull failed — installing from local copy');
481
537
  }
482
538
 
539
+ // 0.5a. User-skills cleanup — remove any rdc: skills from ~/.claude/skills/user/
540
+ // (older installer versions wrote there; plugin cache is the only authoritative source)
541
+ {
542
+ const userSkillsDir = path.join(claudeHome, 'skills', 'user');
543
+ const purged = cleanUserSkills(userSkillsDir);
544
+ if (purged > 0) ok(`[0.5a] Skills cleanup — removed ${purged} stale rdc: skill(s) from skills/user/`);
545
+ }
546
+
547
+ // 0.5b. Stale hook cleanup — remove hooks we no longer ship
548
+ {
549
+ const staleRemoved = cleanStaleHooks(hooksDst);
550
+ if (staleRemoved > 0) ok(`[0.5b] Hook cleanup — removed ${staleRemoved} orphaned hook file(s)`);
551
+ }
552
+
483
553
  // 0.5. Legacy cleanup — remove old commands/rdc/ (pre-plugin-system format)
484
554
  const legacyCommandsDir = path.join(claudeHome, 'commands', 'rdc');
485
555
  if (fs.existsSync(legacyCommandsDir)) {