@aiyiran/myclaw 1.1.107 → 1.1.108

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/patches/patch.js +9 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.1.107",
3
+ "version": "1.1.108",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
package/patches/patch.js CHANGED
@@ -52,13 +52,18 @@ function findControlUiDir() {
52
52
  }
53
53
  } catch {}
54
54
 
55
- // 加上 pnpm global root
55
+ // 加上 pnpm global root(优先用 PNPM_HOME,回退到常见默认路径)
56
+ const os = require('os');
57
+ const pnpmHome = process.env.PNPM_HOME || path.join(os.homedir(), '.local', 'share', 'pnpm');
58
+ // pnpm 内部版本号通常为 4~8,枚举兜底,不依赖 pnpm 命令是否在 PATH
59
+ for (let v = 4; v <= 9; v++) {
60
+ globalPaths.push(path.join(pnpmHome, 'global', String(v), 'node_modules'));
61
+ }
62
+ // 也尝试通过命令动态获取(如果 pnpm 在 PATH 里)
56
63
  try {
57
64
  const { execSync } = require('child_process');
58
65
  const pnpmRoot = execSync('pnpm root -g 2>/dev/null', { encoding: 'utf8' }).trim();
59
- if (pnpmRoot) {
60
- globalPaths.push(pnpmRoot);
61
- }
66
+ if (pnpmRoot) globalPaths.push(pnpmRoot);
62
67
  } catch {}
63
68
 
64
69
  for (const globalPath of globalPaths) {