cc-zh-watcher 0.1.0
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 +21 -0
- package/README.md +405 -0
- package/dist/cli.js +47033 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 storm
|
|
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,405 @@
|
|
|
1
|
+
# cc-zh-watcher
|
|
2
|
+
|
|
3
|
+
> A side-channel Chinese ↔ English bridge for Claude Code.
|
|
4
|
+
> Type Chinese, Claude sees English. Claude replies in English, you see Chinese.
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/cc-zh-watcher)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
让中文母语开发者用 Claude Code 时,**输入和输出都是中文**,但 Claude 内部全程只看英文 —— 节省 token、对齐英文工具生态、提升复杂推理质量。
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 为什么需要它
|
|
14
|
+
|
|
15
|
+
Claude Code 在英文场景表现最好:tokenizer 对英文更紧凑(中文一句话约是英文 2× token)、内部系统 prompt 全是英文、复杂推理在英文上略胜一筹。但你想用中文。
|
|
16
|
+
|
|
17
|
+
cc-zh-watcher 是一个旁路 TUI 翻译工具:
|
|
18
|
+
|
|
19
|
+
- **你输的中文** → 自动翻译成英文 → 通过 `/i` 命令喂给 Claude Code
|
|
20
|
+
- **Claude 的英文回复** → 自动翻译成中文 → 在 watcher 里实时显示
|
|
21
|
+
|
|
22
|
+
不动 Claude Code 的 TUI(菜单导航、文件选择器、权限对话框照常用)。
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
┌── Terminal 1:你的 Claude Code ──┐ ┌── Terminal 2:cc-zh-watcher TUI ────────────┐
|
|
26
|
+
│ │ │ [Claude 回复的中文翻译,append-only 滚动] │
|
|
27
|
+
│ > /i ↵ │ │ [05:43] Claude: 在 storm-bft/...里... │
|
|
28
|
+
│ ↑ 这条命令读 user-input.md │ │ [05:46] Claude: 可以。你需要在... │
|
|
29
|
+
│ │ │ │
|
|
30
|
+
│ Claude 用英文流式回复… │ │ ┌── StatusBar ──────────────────────────┐ │
|
|
31
|
+
│ │ │ │ session 3f59...8985 · ctx: on (123) │ │
|
|
32
|
+
│ [菜单 / 选项 / 权限对话框 │ │ │ api: ✓ 1.2s · 234 tok · session: ... │ │
|
|
33
|
+
│ 都在这个窗口操作] │ │ └────────────────────────────────────────┘ │
|
|
34
|
+
│ │ │ ┌── 中文输入 ─────────────────────────────┐ │
|
|
35
|
+
│ │ │ │ > 再加上对应的 PoP 校验| │ │
|
|
36
|
+
│ │ │ └────────────────────────────────────────┘ │
|
|
37
|
+
└───────────────────────────────────┘ └────────────────────────────────────────────┘
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 安装
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install -g cc-zh-watcher
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
需要 Node.js ≥ 20。无其他依赖。
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 快速开始(5 步)
|
|
53
|
+
|
|
54
|
+
### 1. 配 API key
|
|
55
|
+
|
|
56
|
+
任何 OpenAI 兼容 endpoint 都行(OpenAI、DeepSeek、Together、Groq、本地 vLLM 等):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
cc-zh-watcher configure
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
会提示你输入 `api_key` / `base_url` / `model` / `timeout_seconds`,写到 `~/.config/cc-zh-watcher/config.json`。
|
|
63
|
+
|
|
64
|
+
或者直接编辑那个文件:
|
|
65
|
+
|
|
66
|
+
```jsonc
|
|
67
|
+
{
|
|
68
|
+
"api_key": "sk-...",
|
|
69
|
+
"base_url": "https://api.deepseek.com/v1",
|
|
70
|
+
"model": "deepseek-v4-pro",
|
|
71
|
+
"timeout_seconds": 90
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 2. 在你的项目里安装 `/i` 命令
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
cd <你的项目目录>
|
|
79
|
+
cc-zh-watcher install
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
这会写一个 `.claude/commands/i.md` slash command,让 Claude Code 知道怎么读 watcher 写的中转文件。
|
|
83
|
+
|
|
84
|
+
### 3. 启动 Claude Code
|
|
85
|
+
|
|
86
|
+
照常:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
claude
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 4. 在另一个终端启动 watcher
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
cc-zh-watcher
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
第一次启动会让你选要监听哪个 Claude Code session(一个项目可能有多个 session)。
|
|
99
|
+
|
|
100
|
+
### 5. 开始用中文聊天
|
|
101
|
+
|
|
102
|
+
在 watcher 里输中文 + 回车 → 翻译完成立刻写入 `user-input.md`。
|
|
103
|
+
|
|
104
|
+
切到 Claude Code 终端 → 输 `/i` + 回车 → Claude 收到英文 prompt 开始处理。
|
|
105
|
+
|
|
106
|
+
Claude 用英文流式回复时,watcher 会实时翻译并显示中文。
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## 工作原理
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
[user types Chinese]
|
|
114
|
+
↓
|
|
115
|
+
[watcher 翻译 zh→en]
|
|
116
|
+
↓
|
|
117
|
+
[写入 .claude/cache/user-input.md]
|
|
118
|
+
↓
|
|
119
|
+
[user 切到 Claude Code, 输 /i ↵]
|
|
120
|
+
↓
|
|
121
|
+
[/i slash command 读这个文件作为 prompt]
|
|
122
|
+
↓
|
|
123
|
+
[Claude 处理,英文流式回复,写入 transcript JSONL]
|
|
124
|
+
↓
|
|
125
|
+
[watcher tail JSONL,检测到新 assistant text]
|
|
126
|
+
↓
|
|
127
|
+
[watcher 翻译 en→zh, 显示在输出区]
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
中转介质:
|
|
131
|
+
|
|
132
|
+
- 输入侧:`<project>/.claude/cache/user-input.md`(watcher 写、`/i` 读)
|
|
133
|
+
- 输出侧:`~/.claude/projects/<project-hash>/<session-uuid>.jsonl`(Claude Code 写、watcher tail)
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 设置面板
|
|
138
|
+
|
|
139
|
+
在 watcher 内按 **`Ctrl+E`** 弹出设置面板:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
┌── Settings (↑/↓ select · Enter edit · Esc save & close) ────┐
|
|
143
|
+
│ ▸ api_key: sk-deep***ce91 │
|
|
144
|
+
│ base_url: https://api.deepseek.com/v1 │
|
|
145
|
+
│ model: deepseek-v4-pro │
|
|
146
|
+
│ timeout_seconds: 90 │
|
|
147
|
+
│ │
|
|
148
|
+
│ ── User prompt (empty = use default) ── │
|
|
149
|
+
│ user.zh-to-en: (empty — using default) │
|
|
150
|
+
│ user.zh-to-en-w/ctx: (empty — using default) │
|
|
151
|
+
│ user.en-to-zh: 用您而不是你。错误信息保留英文。 │
|
|
152
|
+
│ │
|
|
153
|
+
│ ── Default prompt (read-only) ── │
|
|
154
|
+
│ default.zh-to-en: You are a professional transla… │
|
|
155
|
+
│ default.zh-to-en-w/ctx: You are a professional transla… │
|
|
156
|
+
│ default.en-to-zh: You are a professional transla… │
|
|
157
|
+
└─────────────────────────────────────────────────────────────┘
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
- **API 字段**(4 个):单行 TextInput,Enter 进入编辑、Enter 提交、Esc 弃改
|
|
161
|
+
- **User prompt**(3 个,每个翻译方向一个):Enter 弹满屏多行编辑器,Ctrl+S 保存、Esc 取消。**留空 = 用默认 prompt**
|
|
162
|
+
- **Default prompt**(3 个,只读):Enter 弹满屏只读查看器,看完整内置 base prompt
|
|
163
|
+
- **Esc** 在导航态 = 保存所有改动 + 关闭面板。改完即热生效,不用重启 watcher
|
|
164
|
+
|
|
165
|
+
字段校验:保存时会检查 `api_key` / `model` 非空、`base_url` 是 `http(s)://` 开头、`timeout_seconds` 是正整数。校验失败显示在面板底部。
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## CLI 命令
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
cc-zh-watcher 启动 TUI(用上次选过的 session)
|
|
173
|
+
cc-zh-watcher --pick 启动 TUI,强制弹 session picker
|
|
174
|
+
cc-zh-watcher --session <uuid|前缀> 启动 TUI,直接指定 session(≥4 字符前缀)
|
|
175
|
+
cc-zh-watcher --config <path> 指定 config 文件
|
|
176
|
+
cc-zh-watcher install 装 /i slash command 到当前项目
|
|
177
|
+
cc-zh-watcher uninstall 移除 /i 命令(可选清缓存:--wipe-cache)
|
|
178
|
+
cc-zh-watcher configure 交互式创建 / 修改 user-global config
|
|
179
|
+
cc-zh-watcher sessions 列出本项目所有 session
|
|
180
|
+
cc-zh-watcher history [opts] 查看 / 搜索翻译历史
|
|
181
|
+
--grep <pat> 子串过滤
|
|
182
|
+
--tail N 最后 N 条(默认 20)
|
|
183
|
+
--direction <dir> zh-to-en | en-to-zh
|
|
184
|
+
--json 机器可读
|
|
185
|
+
cc-zh-watcher prompts show [dir] 打印当前生效的 prompt(dir 省略 = 全部 3 个)
|
|
186
|
+
--base 忽略 user override,只看内置
|
|
187
|
+
cc-zh-watcher --version
|
|
188
|
+
cc-zh-watcher --help
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## TUI 键位
|
|
194
|
+
|
|
195
|
+
### 主界面
|
|
196
|
+
|
|
197
|
+
| 键 | 动作 |
|
|
198
|
+
|---|---|
|
|
199
|
+
| `Enter` | 触发翻译,翻译完立刻写 `user-input.md` |
|
|
200
|
+
| `Ctrl+T` | 切换 context 启用 / 禁用(zh→en 是否带上一次 Claude 英文回复作为消歧上下文)|
|
|
201
|
+
| `Ctrl+E` | 打开设置面板 |
|
|
202
|
+
| `Ctrl+P` | 调出更早一次的中文输入(in-memory,本会话最多 50 条)|
|
|
203
|
+
| `Ctrl+N` | 走回更新一次的输入;走到末尾后清空 |
|
|
204
|
+
| `Ctrl+L` | 清空当前输入 |
|
|
205
|
+
| `Esc` | 清空输入 + 已显示结果 + 错误状态 |
|
|
206
|
+
| `Ctrl+C` | 退出 watcher |
|
|
207
|
+
|
|
208
|
+
### Session picker(首次启动 / `--pick`)
|
|
209
|
+
|
|
210
|
+
| 键 | 动作 |
|
|
211
|
+
|---|---|
|
|
212
|
+
| `↑` / `↓` | 选 session |
|
|
213
|
+
| `Enter` | 确认 |
|
|
214
|
+
| `/` | 模糊搜索 |
|
|
215
|
+
| `Esc` | 取消 |
|
|
216
|
+
|
|
217
|
+
### 设置面板
|
|
218
|
+
|
|
219
|
+
| 键 | 动作 |
|
|
220
|
+
|---|---|
|
|
221
|
+
| `↑` / `↓` | 选字段 |
|
|
222
|
+
| `Enter`(导航态) | 进入编辑(API 字段)/ 弹多行编辑器(user prompt)/ 弹只读查看器(default prompt) |
|
|
223
|
+
| `Enter`(编辑态) | 提交(仅 API 字段;多行编辑器用 Ctrl+S)|
|
|
224
|
+
| `Esc`(编辑态) | 弃改回到导航态 |
|
|
225
|
+
| `Esc`(导航态) | **保存所有改动** + 关闭面板 |
|
|
226
|
+
|
|
227
|
+
### 多行编辑器(user prompt)
|
|
228
|
+
|
|
229
|
+
| 键 | 动作 |
|
|
230
|
+
|---|---|
|
|
231
|
+
| `↑` / `↓` / `←` / `→` | 光标导航 |
|
|
232
|
+
| `Enter` | 在光标处插入换行 |
|
|
233
|
+
| `Tab` | 插入 4 个空格 |
|
|
234
|
+
| `Backspace` | 删字符(行首时合并上一行)|
|
|
235
|
+
| `Delete` | 删字符(行末时合并下一行)|
|
|
236
|
+
| `Ctrl+S` | 提交 |
|
|
237
|
+
| `Esc` | 弃改 |
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Context 模式
|
|
242
|
+
|
|
243
|
+
默认开启。watcher 维护"上一次 Claude 英文回复的最后一段 text",在你下一次输入翻译时作为消歧上下文传给翻译模型。
|
|
244
|
+
|
|
245
|
+
为什么有用:当 Claude 问你"A 还是 B?",你回"选 A",没有 context 翻译会是 `Choose A`(字面),有 context 会是 `Let's go with A` / `I'll go with option A`(更自然)。
|
|
246
|
+
|
|
247
|
+
按 `Ctrl+T` 随时切换。状态栏右侧实时显示:
|
|
248
|
+
|
|
249
|
+
| Badge | 含义 |
|
|
250
|
+
|---|---|
|
|
251
|
+
| `ctx: on (123 chars · Ctrl+T to disable)` | 启用,有 123 字 context 可用 |
|
|
252
|
+
| `ctx: on (waiting for Claude)` | 启用,但 Claude 还没说过话 |
|
|
253
|
+
| `ctx: off (Ctrl+T to enable)` | 禁用 |
|
|
254
|
+
|
|
255
|
+
什么时候关:
|
|
256
|
+
- 切全新话题时(避免被前一轮误导)
|
|
257
|
+
- 翻译"那个"、"再加一条"等本身已经独立成意思的字面命令
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## 自定义翻译 prompt
|
|
262
|
+
|
|
263
|
+
每个翻译方向有一个 user prompt 和一个 default prompt:
|
|
264
|
+
|
|
265
|
+
| 翻译方向 | 用途 |
|
|
266
|
+
|---|---|
|
|
267
|
+
| `zh-to-en` | 用户中文输入 → Claude Code prompt(无上下文)|
|
|
268
|
+
| `zh-to-en-with-context` | 同上,但带上一轮 Claude 英文回复作消歧上下文 |
|
|
269
|
+
| `en-to-zh` | Claude 英文回复 → 显示给用户的中文 |
|
|
270
|
+
|
|
271
|
+
**user prompt 非空时完全替换 default**。设置面板里 `Ctrl+E` → 选 `user.<方向>` → Enter → 多行编辑器输入你的自定义 prompt → Ctrl+S 保存。
|
|
272
|
+
|
|
273
|
+
典型用例:
|
|
274
|
+
|
|
275
|
+
- **域专业术语词典**:`Domain: traditional Chinese medicine. Glossary: 经络=meridians, 气=qi (do not translate).`
|
|
276
|
+
- **风格偏好**:`用您而不是你。错误信息保留英文。React/Vue/CSS 术语不译。`
|
|
277
|
+
|
|
278
|
+
要看默认 prompt 长什么样:在面板里选 `default.<方向>` → Enter,会弹只读查看器看完整 base prompt。
|
|
279
|
+
|
|
280
|
+
或用 CLI:
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
cc-zh-watcher prompts show zh-to-en --base
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## 配置文件
|
|
289
|
+
|
|
290
|
+
存在用户主目录,优先级 env > project-local > user-global > 默认:
|
|
291
|
+
|
|
292
|
+
```
|
|
293
|
+
~/.config/cc-zh-watcher/config.json 用户级(默认)
|
|
294
|
+
<project>/.cc-zh-watcher.json 项目级(可选)
|
|
295
|
+
环境变量:
|
|
296
|
+
CC_ZH_API_KEY 覆盖 api_key
|
|
297
|
+
CC_ZH_BASE_URL 覆盖 base_url
|
|
298
|
+
CC_ZH_MODEL 覆盖 model
|
|
299
|
+
CC_ZH_TIMEOUT 覆盖 timeout_seconds
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
完整 schema:
|
|
303
|
+
|
|
304
|
+
```jsonc
|
|
305
|
+
{
|
|
306
|
+
"api_key": "sk-...", // 必填
|
|
307
|
+
"base_url": "https://api.deepseek.com/v1", // 默认 https://api.openai.com/v1
|
|
308
|
+
"model": "deepseek-v4-pro", // 默认 gpt-4o-mini
|
|
309
|
+
"timeout_seconds": 90, // 默认 30
|
|
310
|
+
|
|
311
|
+
// 可选 — user prompt(非空替换内置 default)
|
|
312
|
+
"prompts": {
|
|
313
|
+
"zh-to-en": "...",
|
|
314
|
+
"zh-to-en-with-context": "...",
|
|
315
|
+
"en-to-zh": "..."
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## API 调用 metrics
|
|
323
|
+
|
|
324
|
+
状态栏第三行实时显示:
|
|
325
|
+
|
|
326
|
+
| 显示 | 含义 |
|
|
327
|
+
|---|---|
|
|
328
|
+
| `api: idle` | 还没发过请求 |
|
|
329
|
+
| `api (zh-to-en): ⏱ 0.8s` | 进行中(黄色,每 200ms 自刷新计时) |
|
|
330
|
+
| `api (zh-to-en): ✓ 1.2s · 234 tok` | 成功(绿色,耗时 + token 消耗)|
|
|
331
|
+
| `api (en-to-zh): ✗ HTTP 401 (0.3s)` | 失败(红色,错误代码 + 耗时)|
|
|
332
|
+
|
|
333
|
+
右侧累计:
|
|
334
|
+
|
|
335
|
+
```
|
|
336
|
+
session: 12 calls · 8.4k tok ← 全部成功
|
|
337
|
+
session: 12 calls · 8.4k tok · 3 err ← 有失败时红色高亮
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
历史可查询:
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
cc-zh-watcher history --tail 5
|
|
344
|
+
cc-zh-watcher history --grep BLS
|
|
345
|
+
cc-zh-watcher history --direction zh-to-en --json
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## FAQ
|
|
351
|
+
|
|
352
|
+
### `Ctrl+E` 没反应?
|
|
353
|
+
|
|
354
|
+
老版本一度用 `Ctrl+,`(VS Code 习惯),但终端不发这个序列。现在是 `Ctrl+E`。如果你装的是 < 0.1.0 老版本,升级一下。
|
|
355
|
+
|
|
356
|
+
### 翻译超时?
|
|
357
|
+
|
|
358
|
+
DeepSeek 长 prompt 偶尔超过 30s 默认超时。改 `timeout_seconds: 90` 或更大。
|
|
359
|
+
|
|
360
|
+
### Session 选错了?
|
|
361
|
+
|
|
362
|
+
`cc-zh-watcher --pick` 重新选。状态会写到 `<project>/.claude/cache/cc-zh-watcher-state.json`,下次直接用。
|
|
363
|
+
|
|
364
|
+
### 想看每次实际发送的英文 prompt?
|
|
365
|
+
|
|
366
|
+
`cc-zh-watcher history --tail 1` 看最近一条;`cc-zh-watcher history --json` 拿机器可读格式。
|
|
367
|
+
|
|
368
|
+
### 翻译质量不行?
|
|
369
|
+
|
|
370
|
+
1. 换更强的 model(如 `gpt-4o` 或 `deepseek-v4-pro`)
|
|
371
|
+
2. 在设置面板加 user prompt 给翻译器更多上下文 / 术语
|
|
372
|
+
3. 调高 `timeout_seconds`,更强的模型可能需要更长时间
|
|
373
|
+
|
|
374
|
+
### Claude Code 找不到 `/i` 命令?
|
|
375
|
+
|
|
376
|
+
确认在你的项目目录下跑过 `cc-zh-watcher install`。检查 `.claude/commands/i.md` 是否存在。
|
|
377
|
+
|
|
378
|
+
### 卸载?
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
# 在每个用过的项目里
|
|
382
|
+
cc-zh-watcher uninstall
|
|
383
|
+
|
|
384
|
+
# 删二进制
|
|
385
|
+
npm uninstall -g cc-zh-watcher
|
|
386
|
+
|
|
387
|
+
# 删 user-global config(按需)
|
|
388
|
+
rm -rf ~/.config/cc-zh-watcher
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
## 限制
|
|
394
|
+
|
|
395
|
+
- **Prompt 不能含字面 `\n`**:单行 TextInput 没法输入换行。要嵌入换行:watcher 关掉,手编 `~/.config/cc-zh-watcher/config.json` 里 `prompts.<dir>` 字段
|
|
396
|
+
- **不重放历史**:watcher 启动时只翻译之后的新 assistant text,已有对话历史不翻译。要回看历史用终端原生 scrollback
|
|
397
|
+
- **单 session 监听**:watcher 一次只盯一个 Claude Code session。多 session 并发要开多个 watcher 实例
|
|
398
|
+
- **翻译延迟**:每次输入需等翻译 API 返回(典型 0.5-3 秒),慢于直接英文输入。trade-off
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
## License
|
|
404
|
+
|
|
405
|
+
MIT — 见 [LICENSE](./LICENSE)
|