airail 0.1.4 → 0.1.5

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/dist/cli/config.js +21 -0
  2. package/package.json +1 -1
@@ -205,6 +205,27 @@ async function useConfig(name) {
205
205
  }
206
206
  fs.writeFileSync(path.join(globalClaudeDir, 'settings.json'), content);
207
207
  console.log((0, colors_1.ok)(`已应用配置 "${chosen}" → ~/.claude/settings.json`));
208
+ // 检查并处理 config.json
209
+ const configPath = path.join(globalClaudeDir, 'config.json');
210
+ let configData = { primaryApiKey: 'any' };
211
+ if (fs.existsSync(configPath)) {
212
+ try {
213
+ configData = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
214
+ if (!configData.primaryApiKey) {
215
+ configData.primaryApiKey = 'any';
216
+ fs.writeFileSync(configPath, JSON.stringify(configData, null, 2));
217
+ console.log((0, colors_1.ok)('已在 config.json 中添加 primaryApiKey'));
218
+ }
219
+ }
220
+ catch (e) {
221
+ console.log((0, colors_1.warn)(`读取 config.json 失败: ${e.message},将重新创建`));
222
+ fs.writeFileSync(configPath, JSON.stringify(configData, null, 2));
223
+ }
224
+ }
225
+ else {
226
+ fs.writeFileSync(configPath, JSON.stringify(configData, null, 2));
227
+ console.log((0, colors_1.ok)('已创建 config.json 并添加 primaryApiKey'));
228
+ }
208
229
  }
209
230
  // ─── 入口 ─────────────────────────────────────────────────────────────────────
210
231
  async function cmdConfig(sub, ...args) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "airail",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "AI coding assistant framework - enforce coding standards via Claude hooks & skills",
5
5
  "bin": {
6
6
  "airail": "./bin/airail.js"