@yhong91/cpac 0.1.35 → 0.1.36
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 +16 -14
- package/dist/cpac.js +12 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,9 +47,10 @@ cpac restore codex # 撤掉注入;注入期间的用户改
|
|
|
47
47
|
cpac claude # Claude Code 走 CPA
|
|
48
48
|
cpac opencode # opencode 走 CPA(模型选 cpac/<模型名>)
|
|
49
49
|
|
|
50
|
-
# 5. 可选:Agent
|
|
51
|
-
cpac setup codex # Codex 配置向导 → 注入
|
|
52
|
-
cpac setup claude # Claude 模型向导
|
|
50
|
+
# 5. 可选:Agent 配置向导与模型选择(只写配置,不启动)
|
|
51
|
+
cpac setup codex # Codex 配置向导 → 注入
|
|
52
|
+
cpac setup claude # Claude 模型向导
|
|
53
|
+
cpac claude setup # 配置完再启动(agent 下的 setup 才会 launch)
|
|
53
54
|
|
|
54
55
|
# 6. 升级(装上新版本后自动 sync 已接入的 agent)
|
|
55
56
|
cpac upgrade
|
|
@@ -93,11 +94,11 @@ cpac status # 验证:各 target 显示 ready/injected
|
|
|
93
94
|
- 启动:`cpac <codex|claude|kimi|grok|pi|opencode> [args...]`(所有原生参数如 `-c` 等原样透明传递)
|
|
94
95
|
- `setup` / `--setup`:配置 Codex/Claude,然后启动
|
|
95
96
|
- `clear`:还原原生配置
|
|
96
|
-
-
|
|
97
|
+
- 只写配置、不启动:`cpac setup [claude|codex]`;查看当前:`cpac setup`
|
|
97
98
|
|
|
98
99
|
2. **已安装后升级**:npm 发布新版本后,等 publish 成功再执行 `cpac upgrade`。它会按需 `npm install -g`,再对已接入的 Codex / Pi / Kimi / Grok 做 `sync`。不要拆成 `npm install -g @yhong91/cpac` 再手动 `cpac sync`。只刷新配置、不升 CLI 时才用 `cpac sync`。
|
|
99
100
|
|
|
100
|
-
失败处理:任何一步报错时先跑 `cpac status`;密钥未配置回到步骤 2;注入后异常用 `cpac <agent> clear` 或 `cpac restore <
|
|
101
|
+
失败处理:任何一步报错时先跑 `cpac status`;密钥未配置回到步骤 2;注入后异常用 `cpac <agent> clear` 或 `cpac restore <codex|pi|kimi|grok>` 恢复原配置。
|
|
101
102
|
|
|
102
103
|
## 首次引导
|
|
103
104
|
|
|
@@ -113,7 +114,7 @@ Commands:
|
|
|
113
114
|
cpac <agent> [args...] Launch an agent through CPA
|
|
114
115
|
cpac setup Show current Codex/Claude setup
|
|
115
116
|
cpac status Show agent support status
|
|
116
|
-
cpac restore <
|
|
117
|
+
cpac restore <codex|pi|kimi|grok> | --all Detach injected agents
|
|
117
118
|
cpac --help Show command usage
|
|
118
119
|
```
|
|
119
120
|
|
|
@@ -164,10 +165,10 @@ cpac --help
|
|
|
164
165
|
参考 vibetime 的目标式命令,对 `codex`、`pi`、`kimi` 三个持久注入目标统一管理(claude/opencode 是临时接管,用 `cpac claude` / `cpac opencode` 启动,不属于 install 目标):
|
|
165
166
|
|
|
166
167
|
```bash
|
|
167
|
-
cpac detect [--json]
|
|
168
|
-
cpac install [codex|pi|kimi|grok...] [--all] [--dry-run] [--force] [--v2_off] [--v2_models] [--max_context]
|
|
169
|
-
cpac sync [codex|pi|kimi|grok...] [--all] [--dry-run] [--v2_off] [--v2_models] [--max_context]
|
|
170
|
-
cpac restore <
|
|
168
|
+
cpac detect [--json]
|
|
169
|
+
cpac install [codex|pi|kimi|grok...] [--all] [--dry-run] [--force] [--v2_off] [--v2_models] [--max_context]
|
|
170
|
+
cpac sync [codex|pi|kimi|grok...] [--all] [--dry-run] [--v2_off] [--v2_models] [--max_context]
|
|
171
|
+
cpac restore <codex|pi|kimi|grok...> | --all [--dry-run]
|
|
171
172
|
cpac uninstall [--dry-run]
|
|
172
173
|
cpac upgrade [--check]
|
|
173
174
|
cpac -v | --version
|
|
@@ -180,7 +181,6 @@ cpac -v | --version
|
|
|
180
181
|
- `--v2_models` 进入 arrow-key 复选框选择最多 5 个 spawn_agent 模型(勾选顺序即推荐顺序),选择结果存入配置文件的 `spawn_models`,注入时把这些模型排到 `codex-models.json` 最前——Codex 客户端只把 catalog 前 5 个可见模型广告为 spawn 覆盖项。
|
|
181
182
|
- `restore` 必须带 agent 名或 `--all`,卸掉指定(或全部)已注入目标。`--all` 时未安装的目标静默跳过。
|
|
182
183
|
- `uninstall` 先用和 `cpac setup codex` 相同的方向键选择器确认(默认 Cancel),再 `restore --all`,最后 `npm uninstall -g @yhong91/cpac`。不要跟 agent 名;卸载的是 cpac 包本身。非终端取消。`--dry-run` 跳过确认。
|
|
183
|
-
- `--home PATH` 临时把 `HOME` 指向给定目录,便于在隔离环境中试验。
|
|
184
184
|
- `upgrade` 是发布后更新本机的一次性入口:查 npm → 需要时 `npm install -g` → 对**已接入**的 Codex / Pi / Kimi 执行 `sync`。已是最新也会 sync。不要先手动 `npm install -g` 再 `cpac sync`。`--check` 只报告版本,不安装也不 sync。没有已安装目标时跳过 sync,不报错。只刷新配置、不升 CLI 时用 `cpac sync`。
|
|
185
185
|
|
|
186
186
|
### Claude Code
|
|
@@ -197,7 +197,8 @@ cpac claude -- -p "检查当前项目"
|
|
|
197
197
|
#### 配置与清除
|
|
198
198
|
|
|
199
199
|
```bash
|
|
200
|
-
cpac setup claude # 交互式依次配置 Sonnet / Haiku / Opus
|
|
200
|
+
cpac setup claude # 交互式依次配置 Sonnet / Haiku / Opus(不启动)
|
|
201
|
+
cpac claude setup # 同上,完成后启动
|
|
201
202
|
cpac claude clear # 重置所有覆盖,恢复自动选择
|
|
202
203
|
```
|
|
203
204
|
|
|
@@ -226,14 +227,15 @@ cpac codex exec "帮我写一个测试"
|
|
|
226
227
|
#### 配置与清除
|
|
227
228
|
|
|
228
229
|
```bash
|
|
229
|
-
cpac setup codex #
|
|
230
|
+
cpac setup codex # 交互式配置后注入(不启动)
|
|
231
|
+
cpac codex setup # 同上,完成后启动 Codex
|
|
230
232
|
cpac codex clear # 还原 Codex 原生配置并关闭代理
|
|
231
233
|
```
|
|
232
234
|
|
|
233
235
|
#### 注入(`cpac install codex`)
|
|
234
236
|
|
|
235
237
|
```bash
|
|
236
|
-
cpac install codex [--v2_off] [--v2_models] [--max_context]
|
|
238
|
+
cpac install codex [--v2_off] [--v2_models] [--max_context]
|
|
237
239
|
cpac restore codex
|
|
238
240
|
```
|
|
239
241
|
|
package/dist/cpac.js
CHANGED
|
@@ -82,9 +82,9 @@ export async function status(config) {
|
|
|
82
82
|
return 0;
|
|
83
83
|
}
|
|
84
84
|
async function guide(config) {
|
|
85
|
-
console.log(`CPA Companion\n\nCPA: ${config.cpa_url}\nCPA_API_KEY: ${process.env[config.api_key_env]?.trim() ? "configured" : "not configured"}\n\nCommands:\n cpac <agent> [args...] Launch an agent (codex, kimi, grok, pi, claude, opencode) through CPA\n cpac setup Show current Codex/Claude setup; cpac setup <codex|claude> to change\n cpac status Show agent support status (Codex, Claude, Pi, Kimi, Grok)\n cpac restore <
|
|
85
|
+
console.log(`CPA Companion\n\nCPA: ${config.cpa_url}\nCPA_API_KEY: ${process.env[config.api_key_env]?.trim() ? "configured" : "not configured"}\n\nCommands:\n cpac <agent> [args...] Launch an agent (codex, kimi, grok, pi, claude, opencode) through CPA\n cpac setup Show current Codex/Claude setup; cpac setup <codex|claude> to change\n cpac status Show agent support status (Codex, Claude, Pi, Kimi, Grok)\n cpac restore <codex|pi|kimi|grok> | --all Detach injected agents
|
|
86
86
|
cpac detect Show supported targets and install status
|
|
87
|
-
cpac install [
|
|
87
|
+
cpac install [codex|pi|kimi|grok...] Install CPA into detected targets, or named agents
|
|
88
88
|
cpac sync Refresh installed Codex/Pi/Kimi/Grok injections from CPA
|
|
89
89
|
cpac uninstall Detach all agents, then remove the cpac package (confirms first)\n cpac upgrade Update cpac from npm and sync installed agents\n cpac --help Show command usage`);
|
|
90
90
|
if (process.env[config.api_key_env]?.trim())
|
|
@@ -104,25 +104,25 @@ function usage() {
|
|
|
104
104
|
" cpac <codex|kimi|grok|pi|claude|opencode> [args...]",
|
|
105
105
|
" setup|--setup configure Codex/Claude, then launch",
|
|
106
106
|
" clear restore native config",
|
|
107
|
-
" cpac setup
|
|
107
|
+
" cpac setup Show current Codex/Claude setup",
|
|
108
108
|
" claude [--opus [M]] [--sonnet [M]] [--haiku [M]] [--reset]",
|
|
109
109
|
" codex [--v2_off] [--v2_models] [--max_context]",
|
|
110
|
-
" cpac restore <
|
|
111
|
-
" cpac status
|
|
112
|
-
" cpac detect [--json]
|
|
113
|
-
" cpac install [codex|pi|kimi|grok...] [--all] [--dry-run] [--force] [--v2_off] [--v2_models] [--max_context]
|
|
114
|
-
" cpac sync [codex|pi|kimi|grok...] [--all] [--dry-run] [--v2_off] [--v2_models] [--max_context]
|
|
110
|
+
" cpac restore <codex|pi|kimi|grok...> | --all [--dry-run]",
|
|
111
|
+
" cpac status",
|
|
112
|
+
" cpac detect [--json]",
|
|
113
|
+
" cpac install [codex|pi|kimi|grok...] [--all] [--dry-run] [--force] [--v2_off] [--v2_models] [--max_context]",
|
|
114
|
+
" cpac sync [codex|pi|kimi|grok...] [--all] [--dry-run] [--v2_off] [--v2_models] [--max_context]",
|
|
115
115
|
" cpac uninstall [--dry-run]",
|
|
116
116
|
" cpac upgrade [--check]",
|
|
117
117
|
" cpac -v | --version",
|
|
118
118
|
"",
|
|
119
119
|
"launch an agent with `cpac <agent> [args...]` (remaining args forwarded).",
|
|
120
|
-
"`setup
|
|
120
|
+
"`cpac <agent> setup` configures then launches; `cpac setup [claude|codex]` writes settings only.",
|
|
121
121
|
].join("\n");
|
|
122
122
|
}
|
|
123
123
|
function setupUsage() {
|
|
124
124
|
return [
|
|
125
|
-
"Usage: cpac setup
|
|
125
|
+
"Usage: cpac setup Show current Codex/Claude setup",
|
|
126
126
|
" claude [--opus [M]] [--sonnet [M]] [--haiku [M]] [--reset]",
|
|
127
127
|
" codex [--v2_off] [--v2_models] [--max_context]",
|
|
128
128
|
"",
|
|
@@ -132,7 +132,7 @@ function setupUsage() {
|
|
|
132
132
|
" --haiku high-frequency small tasks (ANTHROPIC_DEFAULT_HAIKU_MODEL)",
|
|
133
133
|
"",
|
|
134
134
|
"A slot without a value opens an arrow-key picker; --reset clears overrides.",
|
|
135
|
-
"No flags on a TTY opens the wizard
|
|
135
|
+
"No flags on a TTY opens the wizard. Does not launch; use `cpac claude setup` / `cpac codex setup` to start.",
|
|
136
136
|
].join("\n");
|
|
137
137
|
}
|
|
138
138
|
function printSetup(config, configPath) {
|
|
@@ -419,8 +419,6 @@ function parseArgs(args) {
|
|
|
419
419
|
maxContext,
|
|
420
420
|
reset: false,
|
|
421
421
|
interactive: true,
|
|
422
|
-
launch: true,
|
|
423
|
-
args: [],
|
|
424
422
|
};
|
|
425
423
|
}
|
|
426
424
|
const models = {};
|
|
@@ -462,7 +460,6 @@ function parseArgs(args) {
|
|
|
462
460
|
pick,
|
|
463
461
|
reset,
|
|
464
462
|
interactive,
|
|
465
|
-
launch: interactive && !reset,
|
|
466
463
|
};
|
|
467
464
|
}
|
|
468
465
|
if (args[0] === "claude-models") {
|
|
@@ -574,7 +571,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
574
571
|
});
|
|
575
572
|
if (parsed.command === "uninstall") {
|
|
576
573
|
if (parsed.targets.length || parsed.all) {
|
|
577
|
-
throw new CPACError("uninstall removes the cpac package; detach agents with: cpac restore <
|
|
574
|
+
throw new CPACError("uninstall removes the cpac package; detach agents with: cpac restore <codex|pi|kimi|grok> | --all");
|
|
578
575
|
}
|
|
579
576
|
return await runUninstall(config, { dryRun: parsed.dryRun });
|
|
580
577
|
}
|