@infinitedusky/indusk-mcp 1.7.8 → 1.7.9

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.
@@ -253,6 +253,18 @@ export async function extensionsAdd(projectRoot, name, from) {
253
253
  // ignore parse errors
254
254
  }
255
255
  }
256
+ function getInstalledVersion(projectRoot, pkg) {
257
+ try {
258
+ const pkgJson = join(projectRoot, "node_modules", pkg, "package.json");
259
+ if (existsSync(pkgJson)) {
260
+ return JSON.parse(readFileSync(pkgJson, "utf-8")).version ?? null;
261
+ }
262
+ }
263
+ catch {
264
+ // ignore
265
+ }
266
+ return null;
267
+ }
256
268
  function installNpmPackage(projectRoot, extName, pkg) {
257
269
  const pm = existsSync(join(projectRoot, "pnpm-lock.yaml"))
258
270
  ? "pnpm"
@@ -334,13 +346,50 @@ export async function extensionsUpdate(projectRoot, names) {
334
346
  continue;
335
347
  }
336
348
  const source = ext.manifest._source;
337
- console.info(` ${name}: updating from ${source}...`);
338
- // If source is npm, update the installed package FIRST so we get the latest
339
349
  if (source.startsWith("npm:")) {
340
- installNpmPackage(projectRoot, name, source.slice(4));
350
+ const pkg = source.slice(4);
351
+ // Check what version is currently installed
352
+ const oldVersion = getInstalledVersion(projectRoot, pkg);
353
+ // Install latest
354
+ installNpmPackage(projectRoot, name, pkg);
355
+ // Check new version
356
+ const newVersion = getInstalledVersion(projectRoot, pkg);
357
+ if (oldVersion && newVersion && oldVersion === newVersion) {
358
+ console.info(` ${name}: already on latest (${newVersion})`);
359
+ continue;
360
+ }
361
+ console.info(` ${name}: ${oldVersion ?? "unknown"} → ${newVersion ?? "latest"}`);
362
+ // Read manifest from installed package (no second download)
363
+ const manifestPath = join(projectRoot, "node_modules", pkg, "indusk-extension.json");
364
+ if (existsSync(manifestPath)) {
365
+ const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
366
+ manifest._source = source;
367
+ const extManifestDir = join(extensionsDir(projectRoot), name);
368
+ mkdirSync(extManifestDir, { recursive: true });
369
+ writeFileSync(join(extManifestDir, "manifest.json"), `${JSON.stringify(manifest, null, "\t")}\n`);
370
+ console.info(` ${name}: manifest updated`);
371
+ }
372
+ }
373
+ else {
374
+ console.info(` ${name}: updating from ${source}...`);
375
+ await extensionsAdd(projectRoot, name, source);
376
+ }
377
+ // Run post-update hook if present
378
+ const updatedManifest = ext.manifest;
379
+ if (updatedManifest.hooks?.on_post_update) {
380
+ console.info(` ${name}: running post-update hook...`);
381
+ try {
382
+ execSync(updatedManifest.hooks.on_post_update, {
383
+ cwd: projectRoot,
384
+ timeout: 30000,
385
+ stdio: ["ignore", "pipe", "pipe"],
386
+ });
387
+ console.info(` ${name}: post-update hook completed`);
388
+ }
389
+ catch {
390
+ console.info(` ${name}: post-update hook failed`);
391
+ }
341
392
  }
342
- // Then fetch the latest manifest (from the now-updated package)
343
- await extensionsAdd(projectRoot, name, source);
344
393
  updated++;
345
394
  }
346
395
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infinitedusky/indusk-mcp",
3
- "version": "1.7.8",
3
+ "version": "1.7.9",
4
4
  "description": "InDusk development system — skills, MCP tools, and CLI for structured AI-assisted development",
5
5
  "type": "module",
6
6
  "files": [