@lifeaitools/clauth 2.0.2 → 2.0.3

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.
@@ -500,6 +500,23 @@ export function registerPlugin(manifestPath, actor = "localhost") {
500
500
  ok: false, state: "manifest_unreadable", error: error instanceof Error ? error.message : String(error),
501
501
  }, actor);
502
502
  }
503
+ // ${PACKAGE_ROOT} — "wherever this manifest actually landed" — resolved HERE
504
+ // and baked into the stored copy, which is the only point at which the true
505
+ // origin is still known. registerPlugin copies the manifest into the managed
506
+ // root, so by the time discoverPlugins() re-reads it, sourcePath is the
507
+ // managed directory and the package's real install location is gone. An npm
508
+ // package installs at node_modules/@scope/name/, a path nothing can hardcode.
509
+ //
510
+ // Without this a shipped manifest had to name an absolute path: rdc-skills
511
+ // carried cwd "C:/Dev/rdc-skills" with core+enable_default, so `npm i -g` on
512
+ // any other machine auto-enabled a CORE plugin pointing at a directory that
513
+ // does not exist there. The token, not the package, was the defect — the
514
+ // correct value was simply inexpressible.
515
+ const packageRoot = path.dirname(path.resolve(manifestPath)).replaceAll("\\", "/");
516
+ raw = raw
517
+ .replaceAll("${PACKAGE_ROOT}", packageRoot)
518
+ .replaceAll("$PACKAGE_ROOT", packageRoot)
519
+ .replace(/%PACKAGE_ROOT%/gi, packageRoot);
503
520
  let manifest;
504
521
  try {
505
522
  manifest = validatePluginManifest(JSON.parse(raw), manifestPath);