pumpkinai-config 1.0.19 → 1.0.20

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-api.js CHANGED
@@ -159,6 +159,26 @@ function setupEnvironmentVariables(apiKey) {
159
159
  }
160
160
  } catch (error) {}
161
161
 
162
+ // 创建 .claude 目录和 config.json
163
+ const claudeDir = path.join(homeDir, '.claude');
164
+ const configPath = path.join(claudeDir, 'config.json');
165
+ try {
166
+ if (!fs.existsSync(claudeDir)) {
167
+ fs.mkdirSync(claudeDir, { recursive: true });
168
+ }
169
+ const config = { primaryApiKey: "1" };
170
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf8');
171
+
172
+ // 如果是通过 sudo 运行的,修改文件所有者
173
+ if (process.platform !== 'win32' && process.env.SUDO_USER) {
174
+ const actualUser = process.env.SUDO_USER;
175
+ const group = process.platform === 'darwin' ? 'staff' : actualUser;
176
+ try {
177
+ execSync(`chown -R ${actualUser}:${group} ${claudeDir}`);
178
+ } catch (error) {}
179
+ }
180
+ } catch (error) {}
181
+
162
182
  // 需要设置的环境变量
163
183
  const envVars = {
164
184
  ANTHROPIC_AUTH_TOKEN: apiKey,
package/claude-setup.js CHANGED
@@ -159,6 +159,26 @@ function setupEnvironmentVariables(apiKey) {
159
159
  }
160
160
  } catch (error) {}
161
161
 
162
+ // 创建 .claude 目录和 config.json
163
+ const claudeDir = path.join(homeDir, '.claude');
164
+ const configPath = path.join(claudeDir, 'config.json');
165
+ try {
166
+ if (!fs.existsSync(claudeDir)) {
167
+ fs.mkdirSync(claudeDir, { recursive: true });
168
+ }
169
+ const config = { primaryApiKey: "1" };
170
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf8');
171
+
172
+ // 如果是通过 sudo 运行的,修改文件所有者
173
+ if (process.platform !== 'win32' && process.env.SUDO_USER) {
174
+ const actualUser = process.env.SUDO_USER;
175
+ const group = process.platform === 'darwin' ? 'staff' : actualUser;
176
+ try {
177
+ execSync(`chown -R ${actualUser}:${group} ${claudeDir}`);
178
+ } catch (error) {}
179
+ }
180
+ } catch (error) {}
181
+
162
182
  // 需要设置的环境变量
163
183
  const envVars = {
164
184
  ANTHROPIC_AUTH_TOKEN: apiKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumpkinai-config",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "PumpkinAI 一键安装配置工具 - 支持 Codex 和 Claude Code",
5
5
  "main": "codex-setup.js",
6
6
  "bin": {