@kkmila/cpc 1.0.1 → 1.0.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.
- package/README.md +36 -0
- package/package.json +6 -2
- package/registry.yaml +6 -0
- package/src/commands/provider.mjs +561 -91
- package/src/lib/agents.mjs +94 -1
- package/src/lib/baseline-models.mjs +338 -0
- package/src/lib/codex-toml.mjs +175 -0
- package/src/lib/env.mjs +115 -0
package/README.md
CHANGED
|
@@ -36,6 +36,7 @@ cpc install
|
|
|
36
36
|
| `cpc export [name]` | 导出提供商配置 |
|
|
37
37
|
| `cpc import <file>` | 导入提供商配置 |
|
|
38
38
|
| `cpc list-installed` | 列出已安装的提供商 |
|
|
39
|
+
| `cpc doctor` | 检查配置和运行状态 |
|
|
39
40
|
|
|
40
41
|
## 使用示例
|
|
41
42
|
|
|
@@ -57,6 +58,29 @@ cpc add
|
|
|
57
58
|
cpc install openai --agent pi
|
|
58
59
|
```
|
|
59
60
|
|
|
61
|
+
### 安装到 Codex Agent(全局默认 provider)
|
|
62
|
+
|
|
63
|
+
Codex 一次只能使用一个模型(写入 `~/.codex/config.toml` 顶层的 `model` + `model_provider`)。
|
|
64
|
+
`cpc install` 会把 API key 跨平台落地到一个环境变量,并在 `[model_providers.<name>]` 段用 `env_key` 引用它,
|
|
65
|
+
装完直接 `codex` 即走该 provider,无需 `--profile`。
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# 非交互:直接指定单模型 + wire_api
|
|
69
|
+
cpc install tele_home --agent codex --model qwen3.6-plus --wire-api responses
|
|
70
|
+
|
|
71
|
+
# 交互:多模型时会弹单选让你挑一个作为默认
|
|
72
|
+
# 并询问 wire_api(responses = Codex Responses 原生协议;chat_completions = 标准 OpenAI 兼容)
|
|
73
|
+
cpc install tele_home --agent codex
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
可选 `--reasoning-effort minimal|low|medium|high` 一并写入 `model_reasoning_effort`。
|
|
77
|
+
|
|
78
|
+
行为说明:
|
|
79
|
+
- 原始 `config.toml` 会先备份为 `config.toml.cpc.bak`。
|
|
80
|
+
- 只 upsert 顶层 `model_provider` / `model`(及可选 `model_reasoning_effort`)和 `[model_providers.<name>]` 段内字段,
|
|
81
|
+
不会误伤 `model_personality` 等同前缀 key,也不会破坏 `[features]` / `[mcp_servers.*]` / `[desktop]` 等段。
|
|
82
|
+
- `cpc list-installed --agent codex` 可查看当前 provider、model、wire_api、env_key。
|
|
83
|
+
|
|
60
84
|
### 测试连接
|
|
61
85
|
|
|
62
86
|
```bash
|
|
@@ -73,6 +97,18 @@ cpc test openai
|
|
|
73
97
|
- omp
|
|
74
98
|
- mimo-code
|
|
75
99
|
- cursor
|
|
100
|
+
- opencode
|
|
101
|
+
|
|
102
|
+
### Codex 的特殊性
|
|
103
|
+
|
|
104
|
+
- 一次只能用一个模型:`cpc install --agent codex` 会把选中的模型设为全局默认,
|
|
105
|
+
多模型时强制让用户挑一个;不像 pi/openclaw 能一次装多个。
|
|
106
|
+
- provider 的 API key 通过 **环境变量** 引用(`env_key`),cpc 跨平台落地:
|
|
107
|
+
- Linux / macOS:按 `$SHELL` 写入 `~/.zshrc` 或 `~/.bashrc`(幂等,已存在则替换值)
|
|
108
|
+
- Windows:用 `setx` 写入用户环境变量
|
|
109
|
+
- 环境变量名规范为 `CPC_<NAME>_API_KEY`(大写、非字母数字转 `_`)
|
|
110
|
+
- 装完新开终端自动加载;当前终端需 `source ~/.bashrc`(或对应 rc 文件)。
|
|
111
|
+
`cpc install` 输出会明确提示该路径。
|
|
76
112
|
|
|
77
113
|
## 配置文件
|
|
78
114
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kkmila/cpc",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Custom Provider CLI for managing model providers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": "./src/commands/provider.mjs"
|
|
12
12
|
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public",
|
|
15
|
+
"registry": "https://registry.npmjs.org/"
|
|
16
|
+
},
|
|
13
17
|
"files": [
|
|
14
18
|
"bin",
|
|
15
19
|
"src",
|
|
@@ -18,7 +22,7 @@
|
|
|
18
22
|
],
|
|
19
23
|
"scripts": {
|
|
20
24
|
"dev": "node bin/cpc.mjs",
|
|
21
|
-
"test": "node --test src/**/*.test.mjs"
|
|
25
|
+
"test": "node --test 'src/**/*.test.mjs'"
|
|
22
26
|
},
|
|
23
27
|
"keywords": [
|
|
24
28
|
"cli",
|
package/registry.yaml
CHANGED
|
@@ -20,6 +20,7 @@ agents:
|
|
|
20
20
|
codex:
|
|
21
21
|
name: Codex
|
|
22
22
|
home: ~/.codex
|
|
23
|
+
home_env: CODEX_HOME
|
|
23
24
|
description: "OpenAI Codex agent"
|
|
24
25
|
|
|
25
26
|
openclaw:
|
|
@@ -41,3 +42,8 @@ agents:
|
|
|
41
42
|
name: Cursor
|
|
42
43
|
home: .
|
|
43
44
|
description: "Cursor editor (project-level config)"
|
|
45
|
+
|
|
46
|
+
opencode:
|
|
47
|
+
name: OpenCode
|
|
48
|
+
home: ~/.config/opencode
|
|
49
|
+
description: "OpenCode AI coding assistant"
|