@aiyiran/myclaw 1.1.106 → 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.
- package/package.json +1 -1
- package/patches/patch.js +16 -8
package/package.json
CHANGED
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) {
|
|
@@ -83,12 +88,15 @@ function findControlUiDir() {
|
|
|
83
88
|
candidates.push(path.join(process.cwd(), 'dist', 'control-ui'));
|
|
84
89
|
|
|
85
90
|
// 找到第一个有 index.html 的
|
|
91
|
+
console.log('[myclaw-patch] 🔍 开始探测 control-ui 路径,候选列表:');
|
|
86
92
|
for (const dir of candidates) {
|
|
87
93
|
try {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
} catch {
|
|
94
|
+
const exists = fs.existsSync(path.join(dir, 'index.html'));
|
|
95
|
+
console.log('[myclaw-patch] ' + (exists ? '✅' : '✗ ') + ' ' + dir);
|
|
96
|
+
if (exists) return dir;
|
|
97
|
+
} catch (e) {
|
|
98
|
+
console.log('[myclaw-patch] ✗ ' + dir + ' (错误: ' + e.message + ')');
|
|
99
|
+
}
|
|
92
100
|
}
|
|
93
101
|
|
|
94
102
|
return null;
|