@tkpdx01/ccc 1.2.5 → 1.2.7

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/index.js CHANGED
@@ -14,9 +14,9 @@ import {
14
14
  showCommand,
15
15
  importCommand,
16
16
  newCommand,
17
- syncCommand,
18
17
  editCommand,
19
18
  deleteCommand,
19
+ syncCommand,
20
20
  helpCommand
21
21
  } from './src/commands/index.js';
22
22
 
@@ -26,7 +26,7 @@ const program = new Command();
26
26
  program
27
27
  .name('ccc')
28
28
  .description('Claude Code Settings Launcher - 管理多个 Claude Code 配置文件')
29
- .version('0.2.0');
29
+ .version('1.2.7');
30
30
 
31
31
  // 注册所有命令
32
32
  listCommand(program);
@@ -34,9 +34,9 @@ useCommand(program);
34
34
  showCommand(program);
35
35
  importCommand(program);
36
36
  newCommand(program);
37
- syncCommand(program);
38
37
  editCommand(program);
39
38
  deleteCommand(program);
39
+ syncCommand(program);
40
40
  helpCommand(program);
41
41
 
42
42
  // ccc <profile> 或 ccc (无参数)
@@ -49,7 +49,7 @@ program
49
49
 
50
50
  if (profile) {
51
51
  // 检查是否是子命令
52
- if (['list', 'ls', 'use', 'show', 'import', 'if', 'new', 'sync', 'edit', 'delete', 'rm', 'help'].includes(profile)) {
52
+ if (['list', 'ls', 'use', 'show', 'import', 'if', 'new', 'edit', 'delete', 'rm', 'sync', 'help'].includes(profile)) {
53
53
  return; // 让子命令处理
54
54
  }
55
55
 
package/nul ADDED
@@ -0,0 +1 @@
1
+ ��Ϣ: ���ṩ��ģʽ�޷��ҵ��ļ���
package/package.json CHANGED
@@ -1,39 +1,39 @@
1
- {
2
- "name": "@tkpdx01/ccc",
3
- "version": "1.2.5",
4
- "description": "Claude Code Settings Launcher - Manage multiple Claude Code profiles",
5
- "main": "index.js",
6
- "bin": {
7
- "ccc": "./index.js"
8
- },
9
- "type": "module",
10
- "scripts": {
11
- "test": "node index.js --help",
12
- "postinstall": "node postinstall.js"
13
- },
14
- "keywords": [
15
- "claude",
16
- "claude-code",
17
- "cli",
18
- "settings",
19
- "launcher",
20
- "profile",
21
- "anthropic"
22
- ],
23
- "author": "tkpdx01",
24
- "license": "MIT",
25
- "repository": {
26
- "type": "git",
27
- "url": "git+https://github.com/tkpdx01/claude-code-launcher.git"
28
- },
29
- "bugs": {
30
- "url": "https://github.com/tkpdx01/claude-code-launcher/issues"
31
- },
32
- "homepage": "https://github.com/tkpdx01/claude-code-launcher#readme",
33
- "dependencies": {
34
- "chalk": "^5.3.0",
35
- "cli-table3": "^0.6.5",
36
- "commander": "^12.0.0",
37
- "inquirer": "^9.2.0"
38
- }
39
- }
1
+ {
2
+ "name": "@tkpdx01/ccc",
3
+ "version": "1.2.7",
4
+ "description": "Claude Code Settings Launcher - Manage multiple Claude Code profiles",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "ccc": "./index.js"
8
+ },
9
+ "type": "module",
10
+ "scripts": {
11
+ "test": "node index.js --help",
12
+ "postinstall": "node postinstall.js"
13
+ },
14
+ "keywords": [
15
+ "claude",
16
+ "claude-code",
17
+ "cli",
18
+ "settings",
19
+ "launcher",
20
+ "profile",
21
+ "anthropic"
22
+ ],
23
+ "author": "tkpdx01",
24
+ "license": "MIT",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/tkpdx01/claude-code-launcher.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/tkpdx01/claude-code-launcher/issues"
31
+ },
32
+ "homepage": "https://github.com/tkpdx01/claude-code-launcher#readme",
33
+ "dependencies": {
34
+ "chalk": "^5.3.0",
35
+ "cli-table3": "^0.6.5",
36
+ "commander": "^12.0.0",
37
+ "inquirer": "^9.2.0"
38
+ }
39
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "ANTHROPIC_AUTH_TOKEN": "sk-HiE7EhUSFxHAPREEa87obE709H5VkraXdFoh5GqnUlBHGxmk",
3
+ "ANTHROPIC_BASE_URL": "https://wzw.pp.ua/"
4
+ }
@@ -1,66 +1,66 @@
1
- import chalk from 'chalk';
2
- import inquirer from 'inquirer';
3
- import {
4
- getProfiles,
5
- getDefaultProfile,
6
- profileExists,
7
- deleteProfile,
8
- clearDefaultProfile
9
- } from '../profiles.js';
10
-
11
- export function deleteCommand(program) {
12
- program
13
- .command('delete [profile]')
14
- .alias('rm')
15
- .description('删除 profile')
16
- .action(async (profile) => {
17
- const profiles = getProfiles();
18
-
19
- if (profiles.length === 0) {
20
- console.log(chalk.yellow('没有可用的 profiles'));
21
- process.exit(0);
22
- }
23
-
24
- // 如果没有指定 profile,交互选择
25
- if (!profile) {
26
- const { selectedProfile } = await inquirer.prompt([
27
- {
28
- type: 'list',
29
- name: 'selectedProfile',
30
- message: '选择要删除的配置:',
31
- choices: profiles
32
- }
33
- ]);
34
- profile = selectedProfile;
35
- }
36
-
37
- if (!profileExists(profile)) {
38
- console.log(chalk.red(`Profile "${profile}" 不存在`));
39
- process.exit(1);
40
- }
41
-
42
- const { confirm } = await inquirer.prompt([
43
- {
44
- type: 'confirm',
45
- name: 'confirm',
46
- message: `确定要删除 "${profile}" 吗?`,
47
- default: false
48
- }
49
- ]);
50
-
51
- if (!confirm) {
52
- console.log(chalk.yellow('已取消'));
53
- process.exit(0);
54
- }
55
-
56
- deleteProfile(profile);
57
-
58
- // 如果删除的是默认 profile,清除默认设置
59
- if (getDefaultProfile() === profile) {
60
- clearDefaultProfile();
61
- }
62
-
63
- console.log(chalk.green(`✓ Profile "${profile}" 已删除`));
64
- });
65
- }
66
-
1
+ import chalk from 'chalk';
2
+ import inquirer from 'inquirer';
3
+ import {
4
+ getProfiles,
5
+ getDefaultProfile,
6
+ profileExists,
7
+ deleteProfile,
8
+ clearDefaultProfile
9
+ } from '../profiles.js';
10
+
11
+ export function deleteCommand(program) {
12
+ program
13
+ .command('delete [profile]')
14
+ .alias('rm')
15
+ .description('删除 profile')
16
+ .action(async (profile) => {
17
+ const profiles = getProfiles();
18
+
19
+ if (profiles.length === 0) {
20
+ console.log(chalk.yellow('没有可用的 profiles'));
21
+ process.exit(0);
22
+ }
23
+
24
+ // 如果没有指定 profile,交互选择
25
+ if (!profile) {
26
+ const { selectedProfile } = await inquirer.prompt([
27
+ {
28
+ type: 'list',
29
+ name: 'selectedProfile',
30
+ message: '选择要删除的配置:',
31
+ choices: profiles
32
+ }
33
+ ]);
34
+ profile = selectedProfile;
35
+ }
36
+
37
+ if (!profileExists(profile)) {
38
+ console.log(chalk.red(`Profile "${profile}" 不存在`));
39
+ process.exit(1);
40
+ }
41
+
42
+ const { confirm } = await inquirer.prompt([
43
+ {
44
+ type: 'confirm',
45
+ name: 'confirm',
46
+ message: `确定要删除 "${profile}" 吗?`,
47
+ default: false
48
+ }
49
+ ]);
50
+
51
+ if (!confirm) {
52
+ console.log(chalk.yellow('已取消'));
53
+ process.exit(0);
54
+ }
55
+
56
+ deleteProfile(profile);
57
+
58
+ // 如果删除的是默认 profile,清除默认设置
59
+ if (getDefaultProfile() === profile) {
60
+ clearDefaultProfile();
61
+ }
62
+
63
+ console.log(chalk.green(`✓ Profile "${profile}" 已删除`));
64
+ });
65
+ }
66
+
@@ -1,106 +1,120 @@
1
- import fs from 'fs';
2
- import chalk from 'chalk';
3
- import inquirer from 'inquirer';
4
- import {
5
- getProfiles,
6
- getDefaultProfile,
7
- profileExists,
8
- getProfilePath,
9
- readProfile,
10
- saveProfile,
11
- setDefaultProfile,
12
- deleteProfile,
13
- resolveProfile
14
- } from '../profiles.js';
15
-
16
- export function editCommand(program) {
17
- program
18
- .command('edit [profile]')
19
- .description('编辑 profile 配置')
20
- .action(async (profile) => {
21
- const profiles = getProfiles();
22
-
23
- if (profiles.length === 0) {
24
- console.log(chalk.yellow('没有可用的 profiles'));
25
- console.log(chalk.gray('使用 "ccc import" 导入配置'));
26
- process.exit(0);
27
- }
28
-
29
- // 如果没有指定 profile,交互选择
30
- if (!profile) {
31
- const { selectedProfile } = await inquirer.prompt([
32
- {
33
- type: 'list',
34
- name: 'selectedProfile',
35
- message: '选择要编辑的配置:',
36
- choices: profiles
37
- }
38
- ]);
39
- profile = selectedProfile;
40
- } else {
41
- // 支持序号或名称
42
- const resolved = resolveProfile(profile);
43
- if (!resolved) {
44
- console.log(chalk.red(`Profile "${profile}" 不存在`));
45
- process.exit(1);
46
- }
47
- profile = resolved;
48
- }
49
-
50
- const currentSettings = readProfile(profile);
51
-
52
- console.log(chalk.cyan(`\n当前配置 (${profile}):`));
53
- console.log(chalk.gray(` API URL: ${currentSettings.apiUrl || '未设置'}`));
54
- console.log(chalk.gray(` API Key: ${currentSettings.apiKey ? currentSettings.apiKey.substring(0, 10) + '...' : '未设置'}`));
55
- console.log();
56
-
57
- const { apiUrl, apiKey, newName } = await inquirer.prompt([
58
- {
59
- type: 'input',
60
- name: 'apiUrl',
61
- message: 'API URL:',
62
- default: currentSettings.apiUrl || ''
63
- },
64
- {
65
- type: 'input',
66
- name: 'apiKey',
67
- message: 'API Key:',
68
- default: currentSettings.apiKey || ''
69
- },
70
- {
71
- type: 'input',
72
- name: 'newName',
73
- message: 'Profile 名称:',
74
- default: profile
75
- }
76
- ]);
77
-
78
- const newSettings = {
79
- ...currentSettings,
80
- apiUrl,
81
- apiKey
82
- };
83
-
84
- // 如果重命名
85
- if (newName && newName !== profile) {
86
- const newPath = getProfilePath(newName);
87
- if (fs.existsSync(newPath)) {
88
- console.log(chalk.red(`Profile "${newName}" 已存在`));
89
- process.exit(1);
90
- }
91
- saveProfile(newName, newSettings);
92
- deleteProfile(profile);
93
-
94
- // 更新默认 profile
95
- if (getDefaultProfile() === profile) {
96
- setDefaultProfile(newName);
97
- }
98
-
99
- console.log(chalk.green(`\n✓ Profile 已重命名为 "${newName}" 并保存`));
100
- } else {
101
- saveProfile(profile, newSettings);
102
- console.log(chalk.green(`\n✓ Profile "${profile}" 已更新`));
103
- }
104
- });
105
- }
106
-
1
+ import fs from 'fs';
2
+ import chalk from 'chalk';
3
+ import inquirer from 'inquirer';
4
+ import {
5
+ getProfiles,
6
+ getDefaultProfile,
7
+ profileExists,
8
+ getProfilePath,
9
+ readProfile,
10
+ saveProfile,
11
+ setDefaultProfile,
12
+ deleteProfile,
13
+ resolveProfile,
14
+ getProfileCredentials,
15
+ getClaudeSettingsTemplate
16
+ } from '../profiles.js';
17
+
18
+ export function editCommand(program) {
19
+ program
20
+ .command('edit [profile]')
21
+ .description('编辑 profile 配置')
22
+ .action(async (profile) => {
23
+ const profiles = getProfiles();
24
+
25
+ if (profiles.length === 0) {
26
+ console.log(chalk.yellow('没有可用的 profiles'));
27
+ console.log(chalk.gray('使用 "ccc import" 导入配置'));
28
+ process.exit(0);
29
+ }
30
+
31
+ // 如果没有指定 profile,交互选择
32
+ if (!profile) {
33
+ const { selectedProfile } = await inquirer.prompt([
34
+ {
35
+ type: 'list',
36
+ name: 'selectedProfile',
37
+ message: '选择要编辑的配置:',
38
+ choices: profiles
39
+ }
40
+ ]);
41
+ profile = selectedProfile;
42
+ } else {
43
+ // 支持序号或名称
44
+ const resolved = resolveProfile(profile);
45
+ if (!resolved) {
46
+ console.log(chalk.red(`Profile "${profile}" 不存在`));
47
+ process.exit(1);
48
+ }
49
+ profile = resolved;
50
+ }
51
+
52
+ // 使用新的 getProfileCredentials 函数获取凭证(支持新旧格式)
53
+ const { apiKey: currentApiKey, apiUrl: currentApiUrl } = getProfileCredentials(profile);
54
+
55
+ console.log(chalk.cyan(`\n当前配置 (${profile}):`));
56
+ console.log(chalk.gray(` ANTHROPIC_BASE_URL: ${currentApiUrl || '未设置'}`));
57
+ console.log(chalk.gray(` ANTHROPIC_AUTH_TOKEN: ${currentApiKey ? currentApiKey.substring(0, 10) + '...' : '未设置'}`));
58
+ console.log();
59
+
60
+ const { apiUrl, apiKey, newName } = await inquirer.prompt([
61
+ {
62
+ type: 'input',
63
+ name: 'apiUrl',
64
+ message: 'ANTHROPIC_BASE_URL:',
65
+ default: currentApiUrl || ''
66
+ },
67
+ {
68
+ type: 'input',
69
+ name: 'apiKey',
70
+ message: 'ANTHROPIC_AUTH_TOKEN:',
71
+ default: currentApiKey || ''
72
+ },
73
+ {
74
+ type: 'input',
75
+ name: 'newName',
76
+ message: 'Profile 名称:',
77
+ default: profile
78
+ }
79
+ ]);
80
+
81
+ // 读取当前 profile 或使用主配置模板
82
+ let currentProfile = readProfile(profile);
83
+ if (!currentProfile || !currentProfile.env) {
84
+ // 如果是旧格式或空配置,基于主配置模板创建
85
+ const template = getClaudeSettingsTemplate() || {};
86
+ currentProfile = { ...template };
87
+ }
88
+
89
+ // 确保 env 对象存在
90
+ if (!currentProfile.env) {
91
+ currentProfile.env = {};
92
+ }
93
+
94
+ // 更新 env 中的 API 凭证
95
+ currentProfile.env.ANTHROPIC_AUTH_TOKEN = apiKey;
96
+ currentProfile.env.ANTHROPIC_BASE_URL = apiUrl;
97
+
98
+ // 如果重命名
99
+ if (newName && newName !== profile) {
100
+ const newPath = getProfilePath(newName);
101
+ if (fs.existsSync(newPath)) {
102
+ console.log(chalk.red(`Profile "${newName}" 已存在`));
103
+ process.exit(1);
104
+ }
105
+ saveProfile(newName, currentProfile);
106
+ deleteProfile(profile);
107
+
108
+ // 更新默认 profile
109
+ if (getDefaultProfile() === profile) {
110
+ setDefaultProfile(newName);
111
+ }
112
+
113
+ console.log(chalk.green(`\n✓ Profile 已重命名为 "${newName}" 并保存`));
114
+ } else {
115
+ saveProfile(profile, currentProfile);
116
+ console.log(chalk.green(`\n✓ Profile "${profile}" 已更新`));
117
+ }
118
+ });
119
+ }
120
+
@@ -1,52 +1,50 @@
1
- import chalk from 'chalk';
2
-
3
- export function showHelp() {
4
- console.log(chalk.cyan.bold('\n CCC - Claude Code Settings Launcher\n'));
5
- console.log(chalk.white(' 管理多个 Claude Code 配置文件,快速切换不同的 API 设置\n'));
6
-
7
- console.log(chalk.yellow(' 启动命令:'));
8
- console.log(chalk.gray(' ccc ') + '使用默认配置启动,无默认则交互选择');
9
- console.log(chalk.gray(' ccc <profile> ') + '使用指定配置启动(支持名称或序号)');
10
- console.log(chalk.gray(' ccc <序号> ') + '使用序号启动(如 ccc 1)');
11
- console.log(chalk.gray(' ccc -d, --ddd ') + '启动时添加 --dangerously-skip-permissions');
12
- console.log();
13
-
14
- console.log(chalk.yellow(' 管理命令:'));
15
- console.log(chalk.gray(' ccc list, ls ') + '列出所有配置(带序号,按 a-z 排序)');
16
- console.log(chalk.gray(' ccc show [profile] ') + '显示完整配置');
17
- console.log(chalk.gray(' ccc use <profile> ') + '设置默认配置');
18
- console.log(chalk.gray(' ccc new [name] ') + '基于模板创建新配置');
19
- console.log(chalk.gray(' ccc import <file> ') + '从文件导入(自动识别格式)');
20
- console.log(chalk.gray(' ccc sync [profile] ') + '同步模板设置(保留 API 配置)');
21
- console.log(chalk.gray(' ccc sync -a, --all ') + '同步所有配置');
22
- console.log(chalk.gray(' ccc edit [profile] ') + '编辑配置');
23
- console.log(chalk.gray(' ccc delete, rm [name] ') + '删除配置');
24
- console.log(chalk.gray(' ccc help ') + '显示此帮助信息');
25
- console.log();
26
-
27
- console.log(chalk.yellow(' 配置存储:'));
28
- console.log(chalk.gray(' ~/.ccc/profiles/ ') + '配置文件目录');
29
- console.log(chalk.gray(' ~/.claude/settings.json') + '模板来源(用于 ccc new)');
30
- console.log();
31
-
32
- console.log(chalk.yellow(' 支持的导入格式:'));
33
- console.log(chalk.gray(' CC-Switch SQL ') + '自动识别 INSERT INTO providers 语句');
34
- console.log(chalk.gray(' All API Hub JSON ') + '自动识别 accounts.accounts 结构');
35
- console.log();
36
-
37
- console.log(chalk.yellow(' 示例:'));
38
- console.log(chalk.gray(' ccc ls ') + '查看配置列表和序号');
39
- console.log(chalk.gray(' ccc 3 ') + '启动第 3 个配置');
40
- console.log(chalk.gray(' ccc 3 -d ') + '启动第 3 个配置 + 跳过权限');
41
- console.log(chalk.gray(' ccc kfc ') + '使用名称启动');
42
- console.log(chalk.gray(' ccc import export.sql ') + '从文件导入配置');
43
- console.log();
44
- }
45
-
46
- export function helpCommand(program) {
47
- program
48
- .command('help')
49
- .description('显示帮助信息')
50
- .action(showHelp);
51
- }
52
-
1
+ import chalk from 'chalk';
2
+
3
+ export function showHelp() {
4
+ console.log(chalk.cyan.bold('\n CCC - Claude Code Settings Launcher\n'));
5
+ console.log(chalk.white(' 管理多个 Claude Code 配置文件,快速切换不同的 API 设置\n'));
6
+
7
+ console.log(chalk.yellow(' 启动命令:'));
8
+ console.log(chalk.gray(' ccc ') + '使用默认配置启动,无默认则交互选择');
9
+ console.log(chalk.gray(' ccc <profile> ') + '使用指定配置启动(支持名称或序号)');
10
+ console.log(chalk.gray(' ccc <序号> ') + '使用序号启动(如 ccc 1)');
11
+ console.log(chalk.gray(' ccc -d, --ddd ') + '启动时添加 --dangerously-skip-permissions');
12
+ console.log();
13
+
14
+ console.log(chalk.yellow(' 管理命令:'));
15
+ console.log(chalk.gray(' ccc list, ls ') + '列出所有配置(带序号,按 a-z 排序)');
16
+ console.log(chalk.gray(' ccc show [profile] ') + '显示完整配置');
17
+ console.log(chalk.gray(' ccc use <profile> ') + '设置默认配置');
18
+ console.log(chalk.gray(' ccc new [name] ') + '创建新的影子配置');
19
+ console.log(chalk.gray(' ccc import <file> ') + '从文件导入(自动识别格式)');
20
+ console.log(chalk.gray(' ccc edit [profile] ') + '编辑配置');
21
+ console.log(chalk.gray(' ccc delete, rm [name] ') + '删除配置');
22
+ console.log(chalk.gray(' ccc help ') + '显示此帮助信息');
23
+ console.log();
24
+
25
+ console.log(chalk.yellow(' 配置存储:'));
26
+ console.log(chalk.gray(' ~/.ccc/profiles/ ') + '影子配置文件目录');
27
+ console.log(chalk.gray(' 影子配置只存储 ') + 'ANTHROPIC_AUTH_TOKEN 和 ANTHROPIC_BASE_URL');
28
+ console.log();
29
+
30
+ console.log(chalk.yellow(' 支持的导入格式:'));
31
+ console.log(chalk.gray(' CC-Switch SQL ') + '自动识别 INSERT INTO providers 语句');
32
+ console.log(chalk.gray(' All API Hub JSON ') + '自动识别 accounts.accounts 结构');
33
+ console.log();
34
+
35
+ console.log(chalk.yellow(' 示例:'));
36
+ console.log(chalk.gray(' ccc ls ') + '查看配置列表和序号');
37
+ console.log(chalk.gray(' ccc 3 ') + '启动第 3 个配置');
38
+ console.log(chalk.gray(' ccc 3 -d ') + '启动第 3 个配置 + 跳过权限');
39
+ console.log(chalk.gray(' ccc kfc ') + '使用名称启动');
40
+ console.log(chalk.gray(' ccc import export.sql ') + '从文件导入配置');
41
+ console.log();
42
+ }
43
+
44
+ export function helpCommand(program) {
45
+ program
46
+ .command('help')
47
+ .description('显示帮助信息')
48
+ .action(showHelp);
49
+ }
50
+