aihezu 2.0.0 → 2.1.0
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/commands/install.js +19 -2
- package/package.json +2 -2
- package/services/gemini.js +11 -8
package/commands/install.js
CHANGED
|
@@ -56,7 +56,23 @@ async function installCommand(service, args = []) {
|
|
|
56
56
|
const apiUrlInput = await askQuestion(rl, '请输入 API 地址 (直接回车使用默认地址): ');
|
|
57
57
|
let apiUrl = apiUrlInput || defaultUrl;
|
|
58
58
|
|
|
59
|
+
// Determine service-specific suffix
|
|
60
|
+
let suffix = '';
|
|
61
|
+
if (service.name === 'claude') {
|
|
62
|
+
suffix = '/api';
|
|
63
|
+
} else if (service.name === 'codex') {
|
|
64
|
+
suffix = '/openai';
|
|
65
|
+
} else if (service.name === 'gemini') {
|
|
66
|
+
suffix = '/gemini';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Append suffix if apiUrl does not already end with it
|
|
70
|
+
if (suffix && !apiUrl.endsWith(suffix)) {
|
|
71
|
+
apiUrl = apiUrl.replace(/\/+$/, '') + suffix; // Remove any trailing slash and add suffix
|
|
72
|
+
}
|
|
73
|
+
|
|
59
74
|
// Basic URL validation/normalization
|
|
75
|
+
// This part should handle http/https prefixing.
|
|
60
76
|
if (!/^https?:\/\//i.test(apiUrl)) {
|
|
61
77
|
apiUrl = 'https://' + apiUrl;
|
|
62
78
|
}
|
|
@@ -113,8 +129,9 @@ async function installCommand(service, args = []) {
|
|
|
113
129
|
console.log('API Key: ' + apiKey.substring(0, 5) + '...');
|
|
114
130
|
|
|
115
131
|
console.log('');
|
|
116
|
-
const confirm = await askQuestion(rl, '是否继续? (
|
|
117
|
-
|
|
132
|
+
const confirm = await askQuestion(rl, '是否继续? (Y/n, 默认回车确认): ');
|
|
133
|
+
// If user enters 'n' or 'no', cancel. Otherwise, proceed (including empty string for default Y).
|
|
134
|
+
if (confirm.toLowerCase() === 'n' || confirm.toLowerCase() === 'no') {
|
|
118
135
|
console.log('已取消。');
|
|
119
136
|
process.exit(0);
|
|
120
137
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aihezu",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "AI 开发环境配置工具 - 支持 Claude Code, Codex, Google Gemini 的本地化配置、代理设置与缓存清理",
|
|
5
5
|
"main": "bin/aihezu.js",
|
|
6
6
|
"bin": {
|
|
@@ -35,4 +35,4 @@
|
|
|
35
35
|
"url": "https://github.com/aihezu/npm-ccclear/issues"
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/aihezu/npm-ccclear#readme"
|
|
38
|
-
}
|
|
38
|
+
}
|
package/services/gemini.js
CHANGED
|
@@ -38,13 +38,16 @@ module.exports = {
|
|
|
38
38
|
|
|
39
39
|
fs.writeFileSync(envFilePath, envContent, 'utf8');
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
// We only store extra options here if any.
|
|
43
|
-
const settings = {
|
|
44
|
-
...options
|
|
45
|
-
};
|
|
46
|
-
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), 'utf8');
|
|
41
|
+
const configFiles = [envFilePath];
|
|
47
42
|
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
// 2. Conditionally write settings.json only if options are provided
|
|
44
|
+
if (Object.keys(options).length > 0) {
|
|
45
|
+
const settings = {
|
|
46
|
+
...options
|
|
47
|
+
};
|
|
48
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), 'utf8');
|
|
49
|
+
configFiles.push(settingsPath);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return configFiles; }
|
|
50
53
|
};
|