sakitamanler-ccl-launcher 0.9.8

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 sakitamanler
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # sakitamanler Claude Code Launcher
2
+
3
+ Claude Code 模型启动器 - 让您轻松切换使用不同的 AI 模型作为 Claude Code 的后端。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm install -g sakitamanler-ccl-launcher
9
+ ```
10
+
11
+ 安装完成后,你将获得 `ccl` 命令。
12
+
13
+ ## 使用
14
+
15
+ ```bash
16
+ # 交互式选择 provider
17
+ ccl
18
+
19
+ # 指定 provider 直接运行
20
+ ccl --provider=GLM-4.7
21
+
22
+ # 单次请求并保存输出
23
+ ccl --provider=MiniMax-M2.1 --prompt="写一个Python冒泡排序" --output=bubble_sort.py
24
+ ```
25
+
26
+ ## 支持的模型
27
+
28
+ - **GLM-4.7** (智谱) - 默认
29
+ - **MiniMax-M2.1**
30
+ - **DeepSeek-3.2**
31
+ - **Kimi-K2**
32
+
33
+ ## 卸载
34
+
35
+ ```bash
36
+ npm uninstall -g sakitamanler-ccl-launcher sakitamanler-ccl-win32
37
+ ```
38
+
39
+ ## 系统要求
40
+
41
+ - Node.js
42
+ - Claude Code (`npm install -g @anthropic-ai/claude-code`)
package/bin/ccl ADDED
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('child_process');
4
+ const process = require('process');
5
+
6
+ // 根据平台和架构确定要执行的命令
7
+ function getTargetCommand() {
8
+ const platform = process.platform;
9
+ const arch = process.arch;
10
+
11
+ switch (`${platform}-${arch}`) {
12
+ case 'darwin-arm64':
13
+ return 'ccl-darwin-arm64';
14
+ case 'darwin-x64':
15
+ return 'ccl-darwin-x64';
16
+ case 'linux-x64':
17
+ return 'ccl-linux-x64';
18
+ case 'win32-x64':
19
+ return 'ccl-win32-x64';
20
+ default:
21
+ throw new Error(`Unsupported platform: ${platform}-${arch}`);
22
+ }
23
+ }
24
+
25
+ // 错误处理函数
26
+ function handleError(error, command = '') {
27
+ if (error.code === 'ENOENT') {
28
+ console.error(`Command '${command}' not found. Please run 'npm install -g sakitamanler-ccl-launcher' to install the required components.`);
29
+ } else {
30
+ console.error('Error executing command:', error.message);
31
+ }
32
+
33
+ // Windows 下的特殊错误处理
34
+ if (process.platform === 'win32') {
35
+ if (error.code === 'EPERM') {
36
+ console.error('Permission denied. Try running as administrator.');
37
+ }
38
+ } else {
39
+ if (error.code === 'EACCES') {
40
+ console.error('Permission denied. Try using sudo.');
41
+ }
42
+ }
43
+
44
+ process.exit(1);
45
+ }
46
+
47
+ // 执行目标命令
48
+ function executeTargetCommand() {
49
+ try {
50
+ const command = getTargetCommand();
51
+ const args = process.argv.slice(2);
52
+
53
+ let child;
54
+ // Windows 平台特殊处理
55
+ if (process.platform === 'win32') {
56
+ // 把命令和参数组装成一个字符串(否则会有 DEP0190 报警)
57
+ const fullCommand = [
58
+ command,
59
+ ...args.map(a => `"${a.replace(/"/g, '\\"')}"`)
60
+ ].join(' ');
61
+
62
+ child = spawn(fullCommand, {
63
+ stdio: 'inherit',
64
+ shell: true
65
+ });
66
+ } else {
67
+ child = spawn(command, args, {
68
+ stdio: 'inherit',
69
+ shell: false
70
+ });
71
+ }
72
+
73
+ // 统一信号处理
74
+ process.on('SIGINT', () => {
75
+ if (process.platform === 'win32') {
76
+ child.kill(); // Windows 下直接 kill
77
+ } else {
78
+ child.kill('SIGINT'); // Unix-like 系统发送 SIGINT
79
+ }
80
+ });
81
+
82
+ child.on('close', (code) => {
83
+ process.exit(code);
84
+ });
85
+
86
+ child.on('error', (error) => {
87
+ handleError(error, command);
88
+ });
89
+ } catch (error) {
90
+ handleError(error);
91
+ }
92
+ }
93
+
94
+ executeTargetCommand();
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "sakitamanler-ccl-launcher",
3
+ "version": "0.9.8",
4
+ "description": "sakitamanler Claude Code Launcher CLI 安装器",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "ccl": "./bin/ccl"
8
+ },
9
+ "scripts": {
10
+ "postinstall": "node scripts/postinstall.js",
11
+ "test": "node --test"
12
+ },
13
+ "preferGlobal": true,
14
+ "os": [
15
+ "darwin",
16
+ "linux",
17
+ "win32"
18
+ ],
19
+ "cpu": [
20
+ "x64",
21
+ "arm64"
22
+ ],
23
+ "keywords": [
24
+ "cli",
25
+ "claude-code-launcher",
26
+ "sakitamanler"
27
+ ],
28
+ "author": "sakitamanler",
29
+ "license": "MIT",
30
+ "dependencies": {
31
+ "sakitamanler-ccl-win32": "^0.9.8",
32
+ "sakitamanler-ccl-darwin-arm64": "^0.9.8",
33
+ "sakitamanler-ccl-darwin-x64": "^0.9.8",
34
+ "sakitamanler-ccl-linux-x64": "^0.9.8"
35
+ }
36
+ }
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require('child_process');
4
+ const process = require('process');
5
+
6
+ console.log('正在安装 sakitamanler Claude Code Launcher...');
7
+
8
+ // 根据平台安装对应的架构子包
9
+ const platform = process.platform;
10
+ const arch = process.arch;
11
+
12
+ let packageName = '';
13
+
14
+ switch (`${platform}-${arch}`) {
15
+ case 'darwin-arm64':
16
+ packageName = 'sakitamanler-ccl-darwin-arm64';
17
+ break;
18
+ case 'darwin-x64':
19
+ packageName = 'sakitamanler-ccl-darwin-x64';
20
+ break;
21
+ case 'linux-x64':
22
+ packageName = 'sakitamanler-ccl-linux-x64';
23
+ break;
24
+ case 'win32-x64':
25
+ packageName = 'sakitamanler-ccl-win32';
26
+ break;
27
+ default:
28
+ console.error(`不支持的平台: ${platform}-${arch}`);
29
+ process.exit(1);
30
+ }
31
+
32
+ try {
33
+ console.log(`正在安装 ${packageName}...`);
34
+ execSync(`npm install -g ${packageName}`, {
35
+ stdio: 'inherit'
36
+ });
37
+ console.log('安装完成!');
38
+ console.log('');
39
+ console.log('使用方法:');
40
+ console.log(' ccl # 交互式选择 provider');
41
+ console.log(' ccl --provider=GLM-4.7 # 指定 provider 运行');
42
+ } catch (error) {
43
+ console.error('安装失败:', error.message);
44
+ process.exit(1);
45
+ }