ticketpro-auto-setup 1.1.8 → 1.1.9

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.
@@ -51,7 +51,7 @@ export function configureClaudeCode(state) {
51
51
  settings.env = {
52
52
  ...(settings.env ?? {}),
53
53
  ANTHROPIC_BASE_URL: state.claudeBaseUrl,
54
- ANTHROPIC_API_KEY: state.apiKey,
54
+ ANTHROPIC_API_KEY: state.claudeApiKey || state.apiKey,
55
55
  CLAUDE_AUTOCOMPACT_PCT_OVERRIDE: '78',
56
56
  };
57
57
  fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), 'utf-8');
@@ -48,7 +48,7 @@ env_key = "OPENAI_API_KEY"
48
48
  fs.writeFileSync(configPath, toml, 'utf-8');
49
49
  log.success(`Codex config written to ${configPath}`);
50
50
  // 设置环境变量
51
- setOpenAIApiKey(state.apiKey);
51
+ setOpenAIApiKey(state.codexApiKey || state.apiKey);
52
52
  return { name: 'Codex CLI Config', success: true };
53
53
  }
54
54
  catch (err) {
@@ -22,17 +22,34 @@ export async function apiConfigPage(state) {
22
22
  state.toolChoice = toolChoice;
23
23
  state.installClaude = toolChoice === 'both' || toolChoice === 'claude-only';
24
24
  state.installCodex = toolChoice === 'both' || toolChoice === 'codex-only';
25
- // 2. 输入 API Key
25
+ // 2. 输入 API Key(Claude 和 Codex 分离)
26
26
  console.log();
27
- const apiKey = await password({
28
- message: '输入中转站 API Key:',
29
- mask: '*',
30
- });
31
- if (!apiKey || apiKey.trim().length === 0) {
32
- log.error('API Key 不能为空!');
33
- process.exit(1);
27
+ // Claude Key
28
+ if (state.installClaude) {
29
+ const claudeApiKey = await password({
30
+ message: '输入 Claude Code API Key(ANTHROPIC_API_KEY):',
31
+ mask: '*',
32
+ });
33
+ if (!claudeApiKey || claudeApiKey.trim().length === 0) {
34
+ log.error('Claude Code API Key 不能为空!');
35
+ process.exit(1);
36
+ }
37
+ state.claudeApiKey = claudeApiKey.trim();
38
+ }
39
+ // Codex Key
40
+ if (state.installCodex) {
41
+ const codexApiKey = await password({
42
+ message: '输入 Codex CLI API Key(OPENAI_API_KEY):',
43
+ mask: '*',
44
+ });
45
+ if (!codexApiKey || codexApiKey.trim().length === 0) {
46
+ log.error('Codex CLI API Key 不能为空!');
47
+ process.exit(1);
48
+ }
49
+ state.codexApiKey = codexApiKey.trim();
34
50
  }
35
- state.apiKey = apiKey.trim();
51
+ // 兼容旧逻辑:保留 state.apiKey,但优先使用分离字段
52
+ state.apiKey = state.claudeApiKey || state.codexApiKey || '';
36
53
  // 3. 显示中转站配置
37
54
  console.log();
38
55
  log.info('中转站配置(自动填写):');
@@ -23,8 +23,15 @@ export interface GrokConfig {
23
23
  export interface SetupState {
24
24
  /** 选择的工具 */
25
25
  toolChoice: ToolChoice;
26
- /** 中转站 API Key */
26
+ /**
27
+ * 兼容旧版本的单密钥字段(deprecated)
28
+ * 新版本请使用 claudeApiKey / codexApiKey
29
+ */
27
30
  apiKey: string;
31
+ /** Claude Code API Key (ANTHROPIC_API_KEY) */
32
+ claudeApiKey: string;
33
+ /** Codex CLI API Key (OPENAI_API_KEY) */
34
+ codexApiKey: string;
28
35
  /** Claude Code 基础 URL */
29
36
  claudeBaseUrl: string;
30
37
  /** Codex 基础 URL */
@@ -6,6 +6,8 @@ export function createDefaultState() {
6
6
  return {
7
7
  toolChoice: 'both',
8
8
  apiKey: '',
9
+ claudeApiKey: '',
10
+ codexApiKey: '',
9
11
  claudeBaseUrl: 'https://api.ticketpro.cc',
10
12
  codexBaseUrl: 'https://api.ticketpro.cc/v1',
11
13
  installClaude: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ticketpro-auto-setup",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "TicketPro Auto Setup Wizard — 一键配置 Claude Code CLI / Codex CLI",
5
5
  "type": "module",
6
6
  "bin": {