pennyrouter 0.3.36 → 0.3.37

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/launch.js +17 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pennyrouter",
3
- "version": "0.3.36",
3
+ "version": "0.3.37",
4
4
  "description": "Install and manage PennyRouter local coding-agent integrations.",
5
5
  "homepage": "https://pennyrouter.com",
6
6
  "bugs": {
package/src/launch.js CHANGED
@@ -274,6 +274,22 @@ async function copyRuntime() {
274
274
  await cp(join(source, "package.json"), join(destination, "package.json"), { force: true });
275
275
  }
276
276
 
277
+ // npx and local installs hoist dependencies above the package, so walk up like Node's resolver.
278
+ async function findInstalledPackage(name) {
279
+ let dir = packageRoot();
280
+ for (;;) {
281
+ const candidate = join(dir, "node_modules", name);
282
+ try {
283
+ if ((await stat(candidate)).isDirectory()) return candidate;
284
+ } catch (error) {
285
+ if (error.code !== "ENOENT") throw error;
286
+ }
287
+ const parent = dirname(dir);
288
+ if (parent === dir) throw new Error(`Could not find installed dependency ${name} from ${packageRoot()}`);
289
+ dir = parent;
290
+ }
291
+ }
292
+
277
293
  /** Install the bundled, repository-independent Penny Compare tools. */
278
294
  export async function installPennyCompare() {
279
295
  if (!(process.platform === "darwin" || process.platform === "linux" || process.platform === "win32")) {
@@ -303,7 +319,7 @@ export async function installPennyCompare() {
303
319
  for (const name of ["@xterm/addon-fit", "@xterm/xterm", "node-pty", "ws"]) {
304
320
  const target = join(modules, name);
305
321
  await mkdir(dirname(target), { recursive: true });
306
- await cp(join(packageRoot(), "node_modules", name), target, { recursive: true });
322
+ await cp(await findInstalledPackage(name), target, { recursive: true });
307
323
  }
308
324
  const link = join(pennyBinDir(), "penny-compare.cmd");
309
325
  const marker = "@REM PennyRouter-managed compare launcher";