encoding-converter-ai 0.1.1 → 0.2.1

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 CHANGED
@@ -31,17 +31,43 @@ npx encoding-converter-ai
31
31
 
32
32
  ```json
33
33
  {
34
- "sourceEncoding": "GB18030",
35
- "confidenceThreshold": 0.6,
34
+ "confidenceThreshold": 0.8,
36
35
  "defaultEncoding": "GB18030"
37
36
  }
38
37
  ```
39
38
 
40
39
  | 字段 | 默认值 | 说明 |
41
40
  |------|--------|------|
42
- | `sourceEncoding` | `GB18030` | 项目源文件编码 |
43
41
  | `confidenceThreshold` | `0.8` | chardet 置信度阈值 |
44
- | `defaultEncoding` | | 置信度不足时的回落编码,建议设置以避免误判漏转 |
42
+ | `defaultEncoding` | `GB18030` | 检测置信度不足时的回落编码,以及新文件的默认编码 |
43
+
44
+ ## 目录级编码规则
45
+
46
+ 支持为不同目录配置不同的编码规则:
47
+
48
+ ```json
49
+ {
50
+ "confidenceThreshold": 0.8,
51
+ "defaultEncoding": "GB18030",
52
+ "directoryRules": {
53
+ "openspec/**": { "defaultEncoding": "UTF-8" },
54
+ "docs/**/*.md": { "defaultEncoding": "UTF-8" },
55
+ "legacy/**": { "defaultEncoding": "GBK" }
56
+ }
57
+ }
58
+ ```
59
+
60
+ ### 匹配规则
61
+
62
+ - 使用 glob 模式匹配文件路径
63
+ - 多规则匹配时,选择最具体的规则
64
+ - 规则中的字段覆盖项目级配置
65
+
66
+ | 模式 | 说明 |
67
+ |------|------|
68
+ | `openspec/**` | 匹配 openspec 目录下所有文件 |
69
+ | `docs/**/*.md` | 匹配 docs 目录下所有 .md 文件 |
70
+ | `legacy/**` | 匹配 legacy 目录下所有文件 |
45
71
 
46
72
  ## 恢复与卸载
47
73