@lifeaitools/rdc-skills 0.24.9 → 0.24.10

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rdc",
3
- "version": "0.24.9",
3
+ "version": "0.24.10",
4
4
  "description": "RDC typed-agent dispatch skill suite for Claude Code — plan, build, review, overnight unattended builds with work-item tracking and TDD enforcement.",
5
5
  "author": {
6
6
  "name": "LIFEAI",
package/git-sha.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "sha": "f5ae61c0f6b40783d69bb93f6c75a46ceeff6acc"
2
+ "sha": "059f644001fd458a08a98fbe92deec0d50db135b"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifeaitools/rdc-skills",
3
- "version": "0.24.9",
3
+ "version": "0.24.10",
4
4
  "description": "RDC typed-agent dispatch skill suite for Claude Code - plan, build, review, overnight builds",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -88,6 +88,9 @@ const projectRoot = projectRootArg || codexRoot || detectedLifeaiRoot;
88
88
 
89
89
  const PLUGIN_KEY = 'rdc-skills@rdc-skills';
90
90
  const MARKETPLACE = 'rdc-skills';
91
+ const NPM_PACKAGE = '@lifeaitools/rdc-skills';
92
+ const MCP_NAME = 'rdc-skills-mcp';
93
+ const MCP_PORT = '3110';
91
94
 
92
95
  // ── Logging ───────────────────────────────────────────────────────────────────
93
96
  const ok = msg => console.log(` \x1b[32m✓\x1b[0m ${msg}`);
@@ -95,6 +98,10 @@ const info = msg => console.log(` \x1b[36m→\x1b[0m ${msg}`);
95
98
  const warn = msg => console.log(` \x1b[33m⚠\x1b[0m ${msg}`);
96
99
  const fail = msg => console.log(` \x1b[31m✗\x1b[0m ${msg}`);
97
100
 
101
+ function run(cmd, options = {}) {
102
+ return execSync(cmd, { encoding: 'utf8', stdio: 'pipe', ...options }).trim();
103
+ }
104
+
98
105
  // ── Filesystem helpers ────────────────────────────────────────────────────────
99
106
  function copyDir(src, dst, ext) {
100
107
  if (!fs.existsSync(src)) { warn(`Source not found: ${src}`); return 0; }
@@ -248,6 +255,76 @@ function buildPluginCache(cacheDir, version, gitSha) {
248
255
  }
249
256
  }
250
257
 
258
+ function getPm2Process(name) {
259
+ try {
260
+ const list = JSON.parse(run('pm2 jlist'));
261
+ return Array.isArray(list) ? list.find((p) => p.name === name) || null : null;
262
+ } catch {
263
+ return null;
264
+ }
265
+ }
266
+
267
+ function isGlobalNpmRdcSkillsPath(scriptPath) {
268
+ if (!scriptPath) return false;
269
+ const normalized = scriptPath.replace(/\\/g, '/').toLowerCase();
270
+ return normalized.includes('/node_modules/@lifeaitools/rdc-skills/');
271
+ }
272
+
273
+ function packageRootFromMcpScript(scriptPath) {
274
+ return scriptPath ? path.resolve(path.dirname(scriptPath), '..') : null;
275
+ }
276
+
277
+ function readInstalledPackageVersion(scriptPath) {
278
+ const packageRoot = packageRootFromMcpScript(scriptPath);
279
+ if (!packageRoot) return null;
280
+ return readJson(path.join(packageRoot, 'package.json'), {}).version || null;
281
+ }
282
+
283
+ function syncGlobalMcpInstall(version) {
284
+ const proc = getPm2Process(MCP_NAME);
285
+ if (!proc) {
286
+ info('[2.9] MCP pkg — PM2 process not registered yet; start handled below');
287
+ return;
288
+ }
289
+
290
+ const scriptPath = proc.pm2_env?.pm_exec_path || proc.pm_exec_path || '';
291
+ if (!isGlobalNpmRdcSkillsPath(scriptPath)) {
292
+ info(`[2.9] MCP pkg — PM2 uses source checkout, not global npm (${scriptPath || 'unknown path'})`);
293
+ return;
294
+ }
295
+
296
+ const installedVersion = readInstalledPackageVersion(scriptPath);
297
+ if (installedVersion === version) {
298
+ ok(`[2.9] MCP pkg — global ${NPM_PACKAGE}@${version} already installed`);
299
+ return;
300
+ }
301
+
302
+ let stopped = false;
303
+ let installed = false;
304
+ try {
305
+ info(`[2.9] MCP pkg — updating global ${NPM_PACKAGE} ${installedVersion || '?'} → ${version}`);
306
+ run(`pm2 stop ${MCP_NAME}`);
307
+ stopped = true;
308
+ run(`npm install -g ${NPM_PACKAGE}@${version}`);
309
+ installed = true;
310
+ ok(`[2.9] MCP pkg — installed global ${NPM_PACKAGE}@${version}`);
311
+ } catch (e) {
312
+ warn(`[2.9] MCP pkg — global install failed (${String(e.message || e).split('\n')[0]})`);
313
+ if (String(e.message || '').includes('EBUSY')) {
314
+ info(' PM2 was stopped first; if EBUSY persists, another Node/npm process still holds the package directory.');
315
+ }
316
+ } finally {
317
+ if (stopped) {
318
+ try {
319
+ run(`pm2 restart ${MCP_NAME} --update-env`, { env: { ...process.env, PORT: MCP_PORT } });
320
+ ok(`[2.9] MCP pkg — pm2 restarted ${MCP_NAME}${installed ? '' : ' (previous install restored)'}`);
321
+ } catch (e) {
322
+ warn(`[2.9] MCP pkg — pm2 restart failed (${String(e.message || e).split('\n')[0]})`);
323
+ }
324
+ }
325
+ }
326
+ }
327
+
251
328
  // ── User-skills cleanup ───────────────────────────────────────────────────────
252
329
  // Older installer versions wrote skill files directly to ~/.claude/skills/user/.
253
330
  // Claude Code loads that directory AND the plugin cache, so any rdc skills left
@@ -753,8 +830,6 @@ function buildHooksConfig(hooksDir, profile = 'core') {
753
830
  // under PM2 as `rdc-skills-mcp` on PORT=3110, and prints the claude.ai connector
754
831
  // line. Every failure here WARNs — it must never abort the installer.
755
832
  function registerMcpServer() {
756
- const MCP_NAME = 'rdc-skills-mcp';
757
- const MCP_PORT = '3110';
758
833
  const binPath = path.join(repoRoot, 'bin', 'rdc-skills-mcp.mjs');
759
834
  const connector = 'https://rdc-skills.regendevcorp.com/mcp';
760
835
 
@@ -907,12 +982,6 @@ async function main() {
907
982
  info(` created settings.json`);
908
983
  }
909
984
 
910
- // Read version + git SHA once
911
- const pkg = readJson(path.join(repoRoot, 'package.json'));
912
- const version = pkg.version || '0.7.0';
913
- let gitSha = '';
914
- try { gitSha = execSync('git rev-parse HEAD', { cwd: repoRoot, encoding: 'utf8', stdio: 'pipe' }).trim(); } catch {}
915
-
916
985
  // 0. Pull latest
917
986
  try {
918
987
  const before = execSync('git rev-parse HEAD', { cwd: repoRoot, encoding: 'utf8', stdio: 'pipe' }).trim();
@@ -923,6 +992,13 @@ async function main() {
923
992
  warn('[0/6] git pull failed — installing from local copy');
924
993
  }
925
994
 
995
+ // Read version + git SHA after pull so plugin caches and the MCP install do
996
+ // not stamp the pre-update checkout.
997
+ const pkg = readJson(path.join(repoRoot, 'package.json'));
998
+ const version = pkg.version || '0.7.0';
999
+ let gitSha = '';
1000
+ try { gitSha = execSync('git rev-parse HEAD', { cwd: repoRoot, encoding: 'utf8', stdio: 'pipe' }).trim(); } catch {}
1001
+
926
1002
  // 0.5a. User-skills cleanup — remove any rdc: skills from ~/.claude/skills/user/
927
1003
  // (older installer versions wrote there; plugin cache is the only authoritative source)
928
1004
  {
@@ -1000,6 +1076,11 @@ async function main() {
1000
1076
  info('[2.6] MCP — rdc-skills endpoint already registered (claude + codex)');
1001
1077
  }
1002
1078
 
1079
+ // If the live MCP is served from the global npm package, update that exact
1080
+ // install before restarting PM2. Windows otherwise holds the package tree open
1081
+ // and `npm install -g` can fail with EBUSY.
1082
+ syncGlobalMcpInstall(version);
1083
+
1003
1084
  // 2.7. Symlinks in regen-root/.claude/skills/ (FS MCP + claude.ai access)
1004
1085
  if (codexRoot) {
1005
1086
  const skillsLinkDir = path.join(codexRoot, '.claude', 'skills');