pumpkinai-config 1.5.3 → 1.5.4
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-ide.js +30 -0
- package/package.json +1 -1
package/claude-ide.js
CHANGED
|
@@ -107,6 +107,32 @@ function writeJsonFile(filePath, data) {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
// 创建 ~/.claude/config.json
|
|
111
|
+
function createClaudeConfig() {
|
|
112
|
+
const homeDir = os.homedir();
|
|
113
|
+
const claudeDir = path.join(homeDir, '.claude');
|
|
114
|
+
const configPath = path.join(claudeDir, 'config.json');
|
|
115
|
+
|
|
116
|
+
log('\n[配置] 创建 Claude 配置文件...', 'cyan');
|
|
117
|
+
|
|
118
|
+
try {
|
|
119
|
+
// 确保 .claude 目录存在
|
|
120
|
+
if (!fs.existsSync(claudeDir)) {
|
|
121
|
+
fs.mkdirSync(claudeDir, { recursive: true });
|
|
122
|
+
log(`[创建] 目录: ${claudeDir}`, 'green');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// 创建 config.json
|
|
126
|
+
const config = { primaryApiKey: "1" };
|
|
127
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 4), 'utf8');
|
|
128
|
+
log(`[成功] 配置文件: ${configPath}`, 'green');
|
|
129
|
+
return true;
|
|
130
|
+
} catch (error) {
|
|
131
|
+
log(`[错误] 创建配置文件失败: ${error.message}`, 'red');
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
110
136
|
// 配置 IDE 的 settings.json
|
|
111
137
|
function configureIDESettings(settingsPath, ideName, apiKey) {
|
|
112
138
|
log(`\n[配置] 正在配置 ${ideName}...`, 'cyan');
|
|
@@ -183,6 +209,7 @@ function showCompletionInfo(configuredIDEs) {
|
|
|
183
209
|
log(' * ANTHROPIC_BASE_URL = https://code.ppchat.vip', 'reset');
|
|
184
210
|
log(' * ANTHROPIC_AUTH_TOKEN = sk-xxx...', 'reset');
|
|
185
211
|
log(' * CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS = 1', 'reset');
|
|
212
|
+
log(` * ~/.claude/config.json (primaryApiKey)`, 'reset');
|
|
186
213
|
|
|
187
214
|
log('\n[下一步]', 'cyan');
|
|
188
215
|
log(' 请重启 VSCode / Cursor 使配置生效', 'yellow');
|
|
@@ -255,6 +282,9 @@ async function main() {
|
|
|
255
282
|
}
|
|
256
283
|
}
|
|
257
284
|
|
|
285
|
+
// 创建 ~/.claude/config.json
|
|
286
|
+
createClaudeConfig();
|
|
287
|
+
|
|
258
288
|
if (configuredIDEs.length === 0) {
|
|
259
289
|
log('\n[错误] 没有成功配置任何 IDE', 'red');
|
|
260
290
|
process.exit(1);
|