pumpkinai-config 1.0.2 → 1.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.
- package/claude-setup.js +29 -2
- package/codex-setup.js +29 -2
- package/package.json +1 -1
package/claude-setup.js
CHANGED
|
@@ -88,7 +88,13 @@ function installClaude() {
|
|
|
88
88
|
if (osType === 'windows') {
|
|
89
89
|
command = 'npm install -g @anthropic-ai/claude-code --registry https://registry.npmmirror.com';
|
|
90
90
|
} else {
|
|
91
|
-
|
|
91
|
+
// 检查是否已经是 root 用户(通过 sudo 运行或直接 root)
|
|
92
|
+
const isRoot = process.getuid && process.getuid() === 0;
|
|
93
|
+
if (isRoot) {
|
|
94
|
+
command = 'npm install -g @anthropic-ai/claude-code --registry https://registry.npmmirror.com';
|
|
95
|
+
} else {
|
|
96
|
+
command = 'sudo npm install -g @anthropic-ai/claude-code --registry https://registry.npmmirror.com';
|
|
97
|
+
}
|
|
92
98
|
}
|
|
93
99
|
|
|
94
100
|
log(`[执行] ${command}`, 'yellow');
|
|
@@ -99,7 +105,28 @@ function installClaude() {
|
|
|
99
105
|
return true;
|
|
100
106
|
} catch (error) {
|
|
101
107
|
log('[错误] @anthropic-ai/claude-code 安装失败', 'red');
|
|
102
|
-
log(
|
|
108
|
+
log('\n[错误详情]', 'red');
|
|
109
|
+
|
|
110
|
+
// 显示错误信息
|
|
111
|
+
if (error.message) {
|
|
112
|
+
log(`错误信息: ${error.message}`, 'red');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// 显示退出码
|
|
116
|
+
if (error.status !== undefined) {
|
|
117
|
+
log(`退出码: ${error.status}`, 'red');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// 显示错误输出
|
|
121
|
+
if (error.stderr) {
|
|
122
|
+
log(`错误输出:\n${error.stderr.toString()}`, 'red');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// 显示标准输出(可能包含有用信息)
|
|
126
|
+
if (error.stdout) {
|
|
127
|
+
log(`标准输出:\n${error.stdout.toString()}`, 'yellow');
|
|
128
|
+
}
|
|
129
|
+
|
|
103
130
|
log('\n[提示] 你可以手动安装:', 'yellow');
|
|
104
131
|
log(` ${command}`, 'yellow');
|
|
105
132
|
log(' 然后重新运行此工具', 'yellow');
|
package/codex-setup.js
CHANGED
|
@@ -100,7 +100,13 @@ function installCodex() {
|
|
|
100
100
|
if (osType === 'windows') {
|
|
101
101
|
command = 'npm install -g @openai/codex --registry https://registry.npmmirror.com';
|
|
102
102
|
} else {
|
|
103
|
-
|
|
103
|
+
// 检查是否已经是 root 用户(通过 sudo 运行或直接 root)
|
|
104
|
+
const isRoot = process.getuid && process.getuid() === 0;
|
|
105
|
+
if (isRoot) {
|
|
106
|
+
command = 'npm install -g @openai/codex --registry https://registry.npmmirror.com';
|
|
107
|
+
} else {
|
|
108
|
+
command = 'sudo npm install -g @openai/codex --registry https://registry.npmmirror.com';
|
|
109
|
+
}
|
|
104
110
|
}
|
|
105
111
|
|
|
106
112
|
log(`[执行] ${command}`, 'yellow');
|
|
@@ -111,7 +117,28 @@ function installCodex() {
|
|
|
111
117
|
return true;
|
|
112
118
|
} catch (error) {
|
|
113
119
|
log('[错误] @openai/codex 安装失败', 'red');
|
|
114
|
-
log(
|
|
120
|
+
log('\n[错误详情]', 'red');
|
|
121
|
+
|
|
122
|
+
// 显示错误信息
|
|
123
|
+
if (error.message) {
|
|
124
|
+
log(`错误信息: ${error.message}`, 'red');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// 显示退出码
|
|
128
|
+
if (error.status !== undefined) {
|
|
129
|
+
log(`退出码: ${error.status}`, 'red');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// 显示错误输出
|
|
133
|
+
if (error.stderr) {
|
|
134
|
+
log(`错误输出:\n${error.stderr.toString()}`, 'red');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// 显示标准输出(可能包含有用信息)
|
|
138
|
+
if (error.stdout) {
|
|
139
|
+
log(`标准输出:\n${error.stdout.toString()}`, 'yellow');
|
|
140
|
+
}
|
|
141
|
+
|
|
115
142
|
log('\n[提示] 你可以手动安装:', 'yellow');
|
|
116
143
|
log(` ${command}`, 'yellow');
|
|
117
144
|
log(' 然后重新运行此工具', 'yellow');
|