pumpkinai-config 1.5.2 → 1.5.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.
Files changed (2) hide show
  1. package/claude-ide.js +32 -9
  2. package/package.json +1 -1
package/claude-ide.js CHANGED
@@ -65,6 +65,12 @@ function getSettingsPaths() {
65
65
  }
66
66
  }
67
67
 
68
+ // 检查 IDE 是否安装(检查配置目录是否存在)
69
+ function checkIDEInstalled(settingsPath) {
70
+ const dir = path.dirname(settingsPath);
71
+ return fs.existsSync(dir);
72
+ }
73
+
68
74
  // 读取 JSON 文件(带注释处理)
69
75
  function readJsonFile(filePath) {
70
76
  try {
@@ -202,9 +208,23 @@ async function main() {
202
208
  // 获取配置文件路径
203
209
  const paths = getSettingsPaths();
204
210
 
205
- log('[信息] 检测到的配置文件路径:', 'cyan');
206
- log(` VSCode: ${paths.vscode}`, 'reset');
207
- log(` Cursor: ${paths.cursor}`, 'reset');
211
+ // 检查哪些 IDE 已安装
212
+ const vscodeInstalled = checkIDEInstalled(paths.vscode);
213
+ const cursorInstalled = checkIDEInstalled(paths.cursor);
214
+
215
+ if (!vscodeInstalled && !cursorInstalled) {
216
+ log('[错误] 未检测到 VSCode 或 Cursor 安装', 'red');
217
+ log(' 请先安装 VSCode 或 Cursor', 'yellow');
218
+ process.exit(1);
219
+ }
220
+
221
+ log('[信息] 检测到的 IDE:', 'cyan');
222
+ if (vscodeInstalled) {
223
+ log(` VSCode: ${paths.vscode}`, 'green');
224
+ }
225
+ if (cursorInstalled) {
226
+ log(` Cursor: ${paths.cursor}`, 'green');
227
+ }
208
228
 
209
229
  // 显示粘贴提示
210
230
  if (process.platform === 'win32') {
@@ -222,14 +242,17 @@ async function main() {
222
242
 
223
243
  const configuredIDEs = [];
224
244
 
225
- // 配置 VSCode
226
- if (configureIDESettings(paths.vscode, 'VSCode', apiKey)) {
227
- configuredIDEs.push('VSCode');
245
+ // 只配置已安装的 IDE
246
+ if (vscodeInstalled) {
247
+ if (configureIDESettings(paths.vscode, 'VSCode', apiKey)) {
248
+ configuredIDEs.push('VSCode');
249
+ }
228
250
  }
229
251
 
230
- // 配置 Cursor
231
- if (configureIDESettings(paths.cursor, 'Cursor', apiKey)) {
232
- configuredIDEs.push('Cursor');
252
+ if (cursorInstalled) {
253
+ if (configureIDESettings(paths.cursor, 'Cursor', apiKey)) {
254
+ configuredIDEs.push('Cursor');
255
+ }
233
256
  }
234
257
 
235
258
  if (configuredIDEs.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumpkinai-config",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "PumpkinAI 一键安装配置工具 - 支持 Codex 和 Claude Code",
5
5
  "main": "codex-setup.js",
6
6
  "bin": {