cc-env-checker 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/README.md ADDED
@@ -0,0 +1,413 @@
1
+ # cc-env-checker
2
+
3
+ [中文](#中文) | [English](#english)
4
+
5
+ `cc-env-checker` is a CLI for checking Claude Code environment risk and health. It is intended as a reference analysis tool, not a 100% authoritative detector.
6
+
7
+ `cc-env-checker` 是一个用于检查 Claude Code 环境风险与健康状态的 CLI。它的定位是参考分析工具,不应被当成百分百准确的判定器。
8
+
9
+ ## 中文
10
+
11
+ ### 这是什么
12
+
13
+ `cc-env-checker` 用于帮助你快速判断当前机器上的 Claude Code 运行环境是否存在明显风险或异常,例如:
14
+
15
+ - Node.js / npm 运行环境是否满足要求
16
+ - `claude` 命令是否可用
17
+ - Claude 本地配置和数据目录是否存在
18
+ - 网络连通性、DNS、代理配置是否异常
19
+ - 是否存在可观察到的本地痕迹、指纹信号和静态安装特征
20
+
21
+ 它不会替你修复问题,但会把风险按 `low`、`medium`、`high`、`unknown` 分级,并输出推荐动作。
22
+
23
+ ### 功能概览
24
+
25
+ - 环境健康检查:Node.js、npm、PATH、代理、DNS、外网探测
26
+ - 安装状态检查:`claude --version`、`claude --help`
27
+ - 配置检查:`~/.claude.json`、`~/.claude`、`NO_PROXY`
28
+ - 本地痕迹检查:telemetry、projects、credentials 文件存在性
29
+ - 指纹信号检查:CI、SSH、tmux、screen、TTY、IDE、git remote 类型、运行时清单
30
+ - 静态安装分析:从本地 Claude 安装文本中提取 endpoint / header / event 分组信号
31
+ - 聚合报告:整体风险、重点发现、建议动作、`evidenceSummary`、`coverageMatrix`
32
+
33
+ ### 环境要求
34
+
35
+ - Node.js `>=20`
36
+ - npm
37
+
38
+ 说明:
39
+
40
+ - 这个工具本身通过 Node.js 运行,见 [package.json](./package.json) 中的 `engines.node`
41
+ - 不要求你必须已经安装 Claude Code,但如果没有安装,相关检查会返回 `fail`、`warn` 或 `skip`
42
+
43
+ ### 安装
44
+
45
+ 全局安装:
46
+
47
+ ```bash
48
+ npm install -g cc-env-checker
49
+ ```
50
+
51
+ 在仓库内本地运行:
52
+
53
+ ```bash
54
+ npm install
55
+ node ./src/cli.js doctor
56
+ ```
57
+
58
+ ### 卸载
59
+
60
+ 当前没有单独的 CLI 卸载命令,使用 npm 的标准卸载方式:
61
+
62
+ ```bash
63
+ npm uninstall -g cc-env-checker
64
+ ```
65
+
66
+ ### 命令
67
+
68
+ 当前实际暴露的命令如下:
69
+
70
+ ```bash
71
+ cc-env-checker doctor
72
+ cc-env-checker network
73
+ cc-env-checker runtime
74
+ cc-env-checker install
75
+ cc-env-checker config
76
+ cc-env-checker report
77
+ ```
78
+
79
+ 说明:
80
+
81
+ - `doctor` 会运行全部检查模块
82
+ - `report` 会输出完整 JSON 报告
83
+ - `artifacts`、`fingerprint`、`static-install` 当前会包含在 `doctor` / `report` 的聚合结果里,但不是独立子命令
84
+
85
+ ### 常用示例
86
+
87
+ ```bash
88
+ cc-env-checker doctor
89
+ cc-env-checker doctor --lang zh-CN
90
+ cc-env-checker doctor --lang en --verbose
91
+ cc-env-checker network --json
92
+ cc-env-checker report
93
+ ```
94
+
95
+ ### 输出语言如何实现
96
+
97
+ CLI 输出已经内建双语能力,目前支持:
98
+
99
+ - `zh-CN`
100
+ - `en`
101
+
102
+ 实现方式:
103
+
104
+ - 默认根据系统语言解析输出语言
105
+ - 可以通过 `--lang zh-CN` 或 `--lang en` 强制指定
106
+ - 所有文案由 `src/i18n.js` 中的字典统一管理
107
+
108
+ 例如:
109
+
110
+ ```bash
111
+ cc-env-checker doctor --lang zh-CN
112
+ cc-env-checker doctor --lang en
113
+ ```
114
+
115
+ ### 检测内容
116
+
117
+ `doctor` / `report` 会聚合以下模块:
118
+
119
+ - `network`
120
+ - 外网连通性
121
+ - 出口 IP 概况
122
+ - 外部 IP 风险信号
123
+ - `api.anthropic.com` / `console.anthropic.com` DNS 解析
124
+ - 代理环境变量一致性
125
+ - `runtime`
126
+ - Node.js 版本
127
+ - npm 可用性
128
+ - PATH 重复项
129
+ - `install`
130
+ - `claude --version`
131
+ - `claude --help`
132
+ - `config`
133
+ - `~/.claude.json`
134
+ - `~/.claude`
135
+ - `NO_PROXY`
136
+ - `artifacts`
137
+ - 身份配置摘要
138
+ - telemetry 缓存目录
139
+ - projects 历史目录
140
+ - credentials 文件存在性
141
+ - `fingerprint`
142
+ - CI / SSH / tmux / screen / TTY / IDE 信号
143
+ - 运行时清单:`bun`、`deno`、`npm`、`pnpm`、`yarn`
144
+ - git remote 的粗粒度类型
145
+ - `static-install`
146
+ - 本地安装文本中的 endpoint 分组
147
+ - header 分组
148
+ - event 名称分组
149
+
150
+ ### 输出格式
151
+
152
+ 输出默认包含:
153
+
154
+ - 整体风险
155
+ - 生成时间
156
+ - 模块统计
157
+ - 重点发现
158
+ - 覆盖矩阵
159
+ - 依据摘要
160
+ - 每个模块下的检查结果
161
+ - 建议动作
162
+
163
+ JSON 输出可通过以下方式获得:
164
+
165
+ ```bash
166
+ cc-env-checker doctor --json
167
+ cc-env-checker network --json
168
+ cc-env-checker report
169
+ ```
170
+
171
+ 其中 `doctor --json` 和 `report` 会包含:
172
+
173
+ - `articleModel`
174
+ - `evidenceSummary`
175
+ - `coverageMatrix`
176
+
177
+ ### 参数
178
+
179
+ ```bash
180
+ --lang 指定输出语言,例如 zh-CN 或 en
181
+ --verbose 显示详细依据和观测值
182
+ --json 输出机器可读 JSON
183
+ --no-remote 关闭真实联网探测
184
+ --timeout 设置联网探测超时时间(毫秒)
185
+ ```
186
+
187
+ ### 风险等级
188
+
189
+ - `low`:未发现明显问题,或仅有轻微关注项
190
+ - `medium`:已确认存在可能影响稳定性或一致性的问题
191
+ - `high`:已确认存在关键路径问题,建议优先处理
192
+ - `unknown`:当前证据不足,无法判断
193
+
194
+ 整体风险使用“最高风险项优先”的聚合规则。
195
+
196
+ ### 隐私说明
197
+
198
+ 默认情况下,部分网络检查会访问第三方服务,用于获取公网 IP、网络元数据和外部 IP 风险信号。
199
+
200
+ - 如不希望执行真实联网探测,请使用 `--no-remote`
201
+ - 敏感本地细节默认不会在普通输出中展开,通常需要 `--verbose` 才会显示更多观测信息
202
+ - 本工具会尽量对身份、邮箱、路径等敏感值做掩码或摘要化处理,但输出结果仍应按诊断信息谨慎对待
203
+
204
+ ### 发布前检查
205
+
206
+ ```bash
207
+ npm test
208
+ npm run pack:check
209
+ ```
210
+
211
+ ---
212
+
213
+ ## English
214
+
215
+ ### What It Does
216
+
217
+ `cc-env-checker` helps you quickly assess whether a machine is ready to run Claude Code safely and predictably. It looks for obvious risks and missing prerequisites such as:
218
+
219
+ - incompatible Node.js or missing npm
220
+ - missing or broken `claude` command
221
+ - missing Claude config or data directories
222
+ - network, DNS, and proxy issues
223
+ - observable local artifacts, fingerprint signals, and static install indicators
224
+
225
+ It does not fix issues automatically. It classifies findings as `low`, `medium`, `high`, or `unknown` and returns recommended actions.
226
+
227
+ ### Feature Summary
228
+
229
+ - Environment health checks: Node.js, npm, PATH, proxy, DNS, remote probes
230
+ - Install checks: `claude --version`, `claude --help`
231
+ - Config checks: `~/.claude.json`, `~/.claude`, `NO_PROXY`
232
+ - Local artifact checks: telemetry, projects, credentials-file presence
233
+ - Fingerprint checks: CI, SSH, tmux, screen, TTY, IDE, git remote type, runtime inventory
234
+ - Static install analysis: endpoint / header / event groups extracted from the local Claude install text
235
+ - Aggregated reporting: overall risk, top findings, recommended actions, `evidenceSummary`, and `coverageMatrix`
236
+
237
+ ### Requirements
238
+
239
+ - Node.js `>=20`
240
+ - npm
241
+
242
+ Notes:
243
+
244
+ - The CLI itself runs on Node.js. See `engines.node` in [package.json](./package.json)
245
+ - Claude Code is not a hard prerequisite for running this tool, but Claude-related checks will return `fail`, `warn`, or `skip` if Claude is not installed
246
+
247
+ ### Install
248
+
249
+ Install globally:
250
+
251
+ ```bash
252
+ npm install -g cc-env-checker
253
+ ```
254
+
255
+ Run locally inside the repo:
256
+
257
+ ```bash
258
+ npm install
259
+ node ./src/cli.js doctor
260
+ ```
261
+
262
+ ### Uninstall
263
+
264
+ There is no dedicated uninstall subcommand. Use standard npm uninstall:
265
+
266
+ ```bash
267
+ npm uninstall -g cc-env-checker
268
+ ```
269
+
270
+ ### Commands
271
+
272
+ These are the currently exposed CLI commands:
273
+
274
+ ```bash
275
+ cc-env-checker doctor
276
+ cc-env-checker network
277
+ cc-env-checker runtime
278
+ cc-env-checker install
279
+ cc-env-checker config
280
+ cc-env-checker report
281
+ ```
282
+
283
+ Notes:
284
+
285
+ - `doctor` runs all check modules
286
+ - `report` prints the full JSON report
287
+ - `artifacts`, `fingerprint`, and `static-install` are currently included in aggregated `doctor` / `report` output, but are not registered as standalone subcommands
288
+
289
+ ### Examples
290
+
291
+ ```bash
292
+ cc-env-checker doctor
293
+ cc-env-checker doctor --lang zh-CN
294
+ cc-env-checker doctor --lang en --verbose
295
+ cc-env-checker network --json
296
+ cc-env-checker report
297
+ ```
298
+
299
+ ### How Multilingual Output Works
300
+
301
+ The CLI already supports two output locales:
302
+
303
+ - `zh-CN`
304
+ - `en`
305
+
306
+ Implementation details:
307
+
308
+ - output language defaults to system locale detection
309
+ - you can override it with `--lang zh-CN` or `--lang en`
310
+ - all user-facing strings are managed in `src/i18n.js`
311
+
312
+ Examples:
313
+
314
+ ```bash
315
+ cc-env-checker doctor --lang zh-CN
316
+ cc-env-checker doctor --lang en
317
+ ```
318
+
319
+ ### What It Checks
320
+
321
+ `doctor` / `report` aggregate the following modules:
322
+
323
+ - `network`
324
+ - internet connectivity
325
+ - egress IP profile
326
+ - external IP risk signal
327
+ - DNS resolution for `api.anthropic.com` / `console.anthropic.com`
328
+ - proxy environment consistency
329
+ - `runtime`
330
+ - Node.js version
331
+ - npm availability
332
+ - duplicate PATH entries
333
+ - `install`
334
+ - `claude --version`
335
+ - `claude --help`
336
+ - `config`
337
+ - `~/.claude.json`
338
+ - `~/.claude`
339
+ - `NO_PROXY`
340
+ - `artifacts`
341
+ - identity config summary
342
+ - telemetry cache directory
343
+ - projects history directory
344
+ - credentials-file presence
345
+ - `fingerprint`
346
+ - CI / SSH / tmux / screen / TTY / IDE signals
347
+ - runtime inventory: `bun`, `deno`, `npm`, `pnpm`, `yarn`
348
+ - coarse git remote transport type
349
+ - `static-install`
350
+ - endpoint groups in local install text
351
+ - header groups
352
+ - event-name groups
353
+
354
+ ### Output
355
+
356
+ output includes:
357
+
358
+ - overall risk
359
+ - generated time
360
+ - module statistics
361
+ - top findings
362
+ - coverage matrix
363
+ - evidence summary
364
+ - per-module check results
365
+ - recommended actions
366
+
367
+ You can get JSON output with:
368
+
369
+ ```bash
370
+ cc-env-checker doctor --json
371
+ cc-env-checker network --json
372
+ cc-env-checker report
373
+ ```
374
+
375
+ `doctor --json` and `report` include:
376
+
377
+ - `articleModel`
378
+ - `evidenceSummary`
379
+ - `coverageMatrix`
380
+
381
+ ### Options
382
+
383
+ ```bash
384
+ --lang override output language, e.g. zh-CN or en
385
+ --verbose show detailed evidence and observations
386
+ --json print machine-readable JSON
387
+ --no-remote disable live remote probes
388
+ --timeout set remote probe timeout in milliseconds
389
+ ```
390
+
391
+ ### Risk Levels
392
+
393
+ - `low`: no obvious issue, or only minor concerns
394
+ - `medium`: a confirmed issue that may affect stability or consistency
395
+ - `high`: a confirmed issue on a critical path that should be addressed first
396
+ - `unknown`: not enough evidence to decide
397
+
398
+ Overall risk follows a highest-finding-wins rule.
399
+
400
+ ### Privacy Notes
401
+
402
+ By default, some network checks contact third-party services to inspect public IP metadata and external IP risk hints.
403
+
404
+ - use `--no-remote` to disable live remote probes
405
+ - sensitive local details are generally hidden from normal output and are more likely to appear only with `--verbose`
406
+ - the tool tries to mask or summarize sensitive values such as identity fields, email, and paths, but diagnostic output should still be handled carefully
407
+
408
+ ### Release Checks
409
+
410
+ ```bash
411
+ npm test
412
+ npm run pack:check
413
+ ```
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "cc-env-checker",
3
+ "version": "0.1.0",
4
+ "description": "Claude Code environment risk checker CLI",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "claude-code",
8
+ "cli",
9
+ "diagnostics",
10
+ "environment",
11
+ "network",
12
+ "npm-package"
13
+ ],
14
+ "type": "module",
15
+ "bin": {
16
+ "cc-env-checker": "src/cli.js"
17
+ },
18
+ "files": [
19
+ "src",
20
+ "README.md",
21
+ "package.json"
22
+ ],
23
+ "scripts": {
24
+ "test": "node --test",
25
+ "start": "node ./src/cli.js",
26
+ "doctor": "node ./src/cli.js doctor",
27
+ "pack:check": "npm pack --dry-run"
28
+ },
29
+ "engines": {
30
+ "node": ">=20"
31
+ },
32
+ "dependencies": {
33
+ "cac": "^6.7.14"
34
+ }
35
+ }