@yottameta/yotta-humanize 0.1.1 → 0.1.3
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/CHANGELOG.md +19 -3
- package/LICENSE +20 -20
- package/README.md +63 -41
- package/README.zh-CN.md +63 -41
- package/SKILL.md +1 -1
- package/bin/install.js +162 -162
- package/install.sh +131 -131
- package/package.json +1 -1
- package/references/faq.md +34 -0
- package/scripts/yotta_humanize.py +9 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
+
## v0.1.3 (2026-09-01)
|
|
2
|
+
|
|
3
|
+
评测反馈优化(文档 + 错误提示,功能不变)。
|
|
4
|
+
|
|
5
|
+
- 错误提示友好化:`-f` 文件不存在 / 不是 UTF-8 编码 / 无读取权限时,给出中文修复建议(不再抛英文堆栈);运行时兜底错误附「修复建议」。
|
|
6
|
+
- 新增 `references/faq.md`:10 条常见问题 / 避坑(传文本方式、编码、长文分段、结果不符合预期、rewrite vs suggest、CI gate、退出码、改动核对、检测原理、边界)。
|
|
7
|
+
- README 中英:新增「效果展示(改写前后)」「错误处理」「常见问题 FAQ 速查」。
|
|
8
|
+
- SKILL.md:新增「常见问题 FAQ(速查)」小节,指向 references/faq.md。
|
|
9
|
+
- 版本四件对齐 0.1.3(package.json / SKILL.md / CHANGELOG / 引擎 VERSION)。
|
|
10
|
+
|
|
1
11
|
# 更新日志
|
|
2
12
|
|
|
13
|
+
## v0.1.2 (2026-08-29)
|
|
14
|
+
|
|
15
|
+
- 安装方式统一为四方式(对齐发布规范 §3.3.1):方式一 `npx -y @yottameta/yotta-humanize --agent <name>` / `--dir <dir>`(推荐,走 npm 源);方式二 `git clone https://github.com/YottaMeta/yotta-humanize.git`;方式三 GitHub Download ZIP;方式四 `bash install.sh --agent/--dir/--list`。移除 `npx skills` 与 `-g` 推荐;中英双 README 安装节同步。
|
|
16
|
+
- 版本对齐:package.json / SKILL.md / CHANGELOG / 引擎 VERSION / 测试断言 / README 锚点 = 0.1.2。
|
|
17
|
+
- 无功能变更(仅文档与版本同步)。
|
|
18
|
+
|
|
3
19
|
## v0.1.1 (2026-08-28)
|
|
4
20
|
|
|
5
|
-
中英双语 README
|
|
21
|
+
中英双语 README 对齐(确定「英文门面 + 中文全档」):
|
|
6
22
|
|
|
7
23
|
- **README.md 改为英文**:作为 GitHub / npm / ClawHub 首页的英文门面(翻译 + 精简,覆盖定位 / 核心价值 / 命令 / 快速使用 / 安装 / 使用示例 / 边界 / 开发校验全流程)。
|
|
8
24
|
- **新增 README.zh-CN.md**:原中文完整主文档整体平移,顶部加语言切换链接。
|
|
@@ -12,7 +28,7 @@
|
|
|
12
28
|
|
|
13
29
|
## v0.1.0 (2026-08-26)
|
|
14
30
|
|
|
15
|
-
YottaMeta 自有实现首版(去 AI 味方向参考开源社区 humanizer / ai-humanizer
|
|
31
|
+
YottaMeta 自有实现首版(去 AI 味方向参考开源社区 humanizer / ai-humanizer 类技能思路,已完全重写为中文语料实现,零依赖、完全自研):
|
|
16
32
|
|
|
17
33
|
- **检测器引擎**(scripts/yotta_humanize.py + humanize_rules.py,Python 3.8+ 标准库):24 类中文 AI 腔规则(内容 / 语言 / 句式 / 沟通 / 废话五组)+ 词表 + 句式正则 + 统计突发性(句长均匀度 CV / 突发性 / 双字词汇多样性 TTR / 逗号密度)。
|
|
18
34
|
- **确定性改写**:词表替换(赋能→支持、抓手→切入点、闭环→流程…)、套话 / 聊天残渣 / 奉承 / 免责删除、破折号 / 感叹号限流;输出修复清单与前后评分。
|
|
@@ -20,4 +36,4 @@ YottaMeta 自有实现首版(去 AI 味方向参考开源社区 humanizer / ai
|
|
|
20
36
|
- **退出码**:与元安 / 元审 / 元盾家族一致(0 = 成功;1 = --gate 达到阈值;4 = 用法错误)。
|
|
21
37
|
- **测试**:scripts/test_yotta_humanize.py 155 项全绿(24 类规则命中 / 干净文本低分 / 统计量 / 确定性改写 / CLI 子命令 / 退出码 / JSON / GBK 控制台)。
|
|
22
38
|
- **文档**:SKILL.md / README.md / references(patterns / scoring / rewriting)/ assets/banner.png。
|
|
23
|
-
- 版权:YottaMeta 纯自有 MIT + NOTICE 品牌声明;README
|
|
39
|
+
- 版权:YottaMeta 纯自有 MIT + NOTICE 品牌声明;README 一行来源致谢。
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 YottaMeta
|
|
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
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 YottaMeta
|
|
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
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ It is not tied to any single platform: an agent-agnostic toolkit that works in a
|
|
|
42
42
|
| **Chinese-first** | Wordlists and patterns for Chinese AI-flavor (jargon / clichés / parallelism / chat residue) curated from scratch, not translated English rules |
|
|
43
43
|
| **Detect + rewrite in one** | score / analyze / report / suggest / rewrite — one command from detection to rewriting |
|
|
44
44
|
| **Reviewable** | Rewrites output a fix list and before/after scores so humans can verify item by item |
|
|
45
|
-
| **Ecosystem distribution** | GitHub + npm + ClawHub synced; install
|
|
45
|
+
| **Ecosystem distribution** | GitHub + npm + ClawHub synced; four install methods (npx / git clone / Download ZIP / install.sh) |
|
|
46
46
|
|
|
47
47
|
## Commands
|
|
48
48
|
|
|
@@ -86,51 +86,39 @@ Exit codes (same semantics as the YuanAn / YuanShen / Yuandun family): **0** = s
|
|
|
86
86
|
|
|
87
87
|
## Install
|
|
88
88
|
|
|
89
|
-
Pick any
|
|
89
|
+
Pick any of the four methods below; the order is the recommended priority. Skill files always come from **npm** (GitHub can be slow without a proxy; npm supports mirrors).
|
|
90
90
|
|
|
91
|
-
### Method 1: npm
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
npx -y @yottameta/yotta-humanize --
|
|
91
|
+
### Method 1: npm one-liner (recommended)
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
# Optional China mirror: npm config set registry https://registry.npmmirror.com
|
|
95
|
+
npx -y @yottameta/yotta-humanize --agent <agent-name> # install to the agent's default user-level skills dir
|
|
96
|
+
npx -y @yottameta/yotta-humanize --dir <your-skills-dir> # point to the skills dir itself (e.g. ~/.codex/skills)
|
|
96
97
|
```
|
|
97
|
-
> Not in the preset list? Use --dir to point at the agent's skills directory, or manual copy (method 3). --list shows each agent's default directory. You can also npm pack @yottameta/yotta-humanize and unpack it to install via method 2 / 3.
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
- `--agent <name>` installs to that agent's default user-level directory; `--list` shows each agent's default directory.
|
|
100
|
+
- `--dir <path>` installs to the given directory; for agents not in the preset list, point `--dir` at their skills directory.
|
|
101
|
+
- If the mirror has not synced the new package (404): add `--registry=https://registry.npmjs.org/` (a proxy may be needed in China), or wait for the mirror cache.
|
|
102
|
+
|
|
103
|
+
### Method 2: git clone (developers / git available)
|
|
104
|
+
|
|
105
|
+
```text
|
|
106
|
+
git clone https://github.com/YottaMeta/yotta-humanize.git <your-skills-dir>/yotta-humanize
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Method 3: GitHub Download ZIP (manual / no git)
|
|
110
|
+
|
|
111
|
+
On the GitHub repository `YottaMeta/yotta-humanize`, click **Code → Download ZIP**, unzip it and put the `yotta-humanize` folder into the agent's skills directory.
|
|
112
|
+
|
|
113
|
+
### Method 4: install.sh (multi-agent one-liner script)
|
|
114
|
+
|
|
115
|
+
```text
|
|
116
|
+
bash install.sh --agent <name> # install to the agent's default user-level directory
|
|
117
|
+
bash install.sh --dir <path> # install to the given directory
|
|
118
|
+
bash install.sh --list # list agents -> default directories
|
|
106
119
|
```
|
|
107
|
-
> Covers 17 agent families including Trae / Qwen / Comate / CodeBuddy / Kimi. Windows users: works with Git Bash; otherwise use method 3.
|
|
108
|
-
|
|
109
|
-
### Method 3: manual copy
|
|
110
|
-
Copy the whole yotta-humanize folder into the target agent's skills directory. Common locations (user level; Windows uses %USERPROFILE%, Linux/macOS uses ~):
|
|
111
|
-
|
|
112
|
-
| Agent | User-level directory | Project-level directory |
|
|
113
|
-
|---|---|---|
|
|
114
|
-
| Codex | %USERPROFILE%\.codex\skills\yotta-humanize\ | .codex\skills\ |
|
|
115
|
-
| Claude Code | %USERPROFILE%\.claude\skills\yotta-humanize\ | .claude\skills\ |
|
|
116
|
-
| Cursor | %USERPROFILE%\.cursor\skills\yotta-humanize\ | .cursor\skills\ |
|
|
117
|
-
| Windsurf | %USERPROFILE%\.codeium\windsurf\skills\yotta-humanize\ | .windsurf\skills\ |
|
|
118
|
-
| opencode | %USERPROFILE%\.config\opencode\skills\yotta-humanize\ | .opencode\skills\ |
|
|
119
|
-
| Gemini | %USERPROFILE%\.gemini\skills\yotta-humanize\ | .gemini\skills\ |
|
|
120
|
-
| Goose | %USERPROFILE%\.config\goose\skills\yotta-humanize\ | .goose\skills\ |
|
|
121
|
-
| Amp | %USERPROFILE%\.config\agents\skills\yotta-humanize\ | .agents\skills\ |
|
|
122
|
-
| Kiro | %USERPROFILE%\.kiro\skills\yotta-humanize\ | .kiro\skills\ |
|
|
123
|
-
| WorkBuddy | %USERPROFILE%\.workbuddy\skills\yotta-humanize\ | .workbuddy\skills\ |
|
|
124
|
-
| Trae Code CLI | %USERPROFILE%\.traecli\skills\yotta-humanize\ | .traecli\skills\ |
|
|
125
|
-
| Trae IDE (CN) | %USERPROFILE%\.trae-cn\skills\yotta-humanize\ | .trae\skills\ |
|
|
126
|
-
| Qwen Code | %USERPROFILE%\.qwen\skills\yotta-humanize\ | .qwen\skills\ |
|
|
127
|
-
| Comate | %USERPROFILE%\.comate\skills\yotta-humanize\ | .comate\skills\ |
|
|
128
|
-
| CodeBuddy | %USERPROFILE%\.codebuddy\skills\yotta-humanize\ | .codebuddy\skills\ |
|
|
129
|
-
| Kimi | %USERPROFILE%\.kimi\skills\yotta-humanize\ | .kimi\skills\ |
|
|
130
|
-
| Generic AGENTS.md | %USERPROFILE%\.agents\skills\yotta-humanize\ | .agents\skills\ |
|
|
131
|
-
|
|
132
|
-
> If Codex's CODEX_HOME is set, it overrides the default; the same applies to opencode's XDG_CONFIG_HOME. .agents\skills is not a universal directory — only OpenCode / Cursor / Cline / Amp / Kimi / Gemini CLI / GitHub Copilot etc. read it; **Claude Code and Codex do not read it by default**. When unsure, use --dir or let the agent install it.
|
|
133
120
|
|
|
121
|
+
> Method 1 uses the npm registry (npmmirror / npmjs) and does not depend on GitHub; Methods 2/3 use GitHub and may fail without a proxy in China.
|
|
134
122
|
## Usage examples (AI agent)
|
|
135
123
|
|
|
136
124
|
1. Hook this repo's SKILL.md into any AI agent's skill/rule system (see install above).
|
|
@@ -153,6 +141,40 @@ Copy the whole yotta-humanize folder into the target agent's skills directory. C
|
|
|
153
141
|
- **Rewrites are suggestions** — unambiguous transforms apply directly; judgment-heavy rewrites are listed as suggestions for the human to confirm.
|
|
154
142
|
- **No model dependency** — deterministic rules only; results are reproducible and explainable.
|
|
155
143
|
|
|
144
|
+
## Before / after
|
|
145
|
+
|
|
146
|
+
**Input** (typical AI-flavored Chinese):
|
|
147
|
+
|
|
148
|
+
```text
|
|
149
|
+
赋能业务增长,打造闭环生态,提升用户体验,实现价值最大化。
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Output** (deterministic `rewrite`, illustrative):
|
|
153
|
+
|
|
154
|
+
```text
|
|
155
|
+
帮业务更快增长,把流程走通,让用户用得顺手,做出实实在在的价值。
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Score before 68/100 → after 23/100; `rewrite` also prints a fix list (what changed and how many times).
|
|
159
|
+
|
|
160
|
+
## Errors
|
|
161
|
+
|
|
162
|
+
- Exit codes: **0** success; **1** `--gate` hit (CI block); **4** input error (missing file, no input).
|
|
163
|
+
- Missing file / non-UTF-8 encoding / permission errors show a **Chinese fix suggestion** instead of a raw English stack trace.
|
|
164
|
+
- FAQ and pitfalls: [references/faq.md](references/faq.md).
|
|
165
|
+
|
|
166
|
+
## FAQ (quick reference)
|
|
167
|
+
|
|
168
|
+
| Question | Answer (see references/faq.md) |
|
|
169
|
+
|---|---|
|
|
170
|
+
| How to pass text? | `-f file` / `--stdin` / positional text |
|
|
171
|
+
| File not UTF-8? | Re-save as UTF-8 and retry |
|
|
172
|
+
| Long text? | Process in segments; nested cases may need human review |
|
|
173
|
+
| Small change after rewrite? | Low AI flavor; run analyze to see hits, suggest for polish |
|
|
174
|
+
| rewrite vs suggest? | rewrite applies mechanically; suggest gives manual-polish advice |
|
|
175
|
+
| CI gate? | `--gate --threshold 40`, exit 1 on hit |
|
|
176
|
+
| Will it corrupt my text? | Deterministic replacements + fix list + before/after score |
|
|
177
|
+
|
|
156
178
|
## Development & validation
|
|
157
179
|
|
|
158
180
|
- Tests: python scripts/test_yotta_humanize.py (155 tests; Windows: python)
|
package/README.zh-CN.md
CHANGED
|
@@ -43,7 +43,7 @@ AI 生成的中文文本有一眼可辨的「AI 腔」:空泛升华(标志
|
|
|
43
43
|
| **中文优先** | 针对中文 AI 腔(黑话 / 套话 / 排比 / 聊天残渣)自研词表与句式,非英文规则直译 |
|
|
44
44
|
| **检测 + 改写一体** | score / analyze / report / suggest / rewrite 全流程,一条命令从检测到改写 |
|
|
45
45
|
| **可复核** | 改写输出修复清单与前后评分,人工可逐条核对 |
|
|
46
|
-
| **生态分发** | GitHub + npm + ClawHub 三源同步发布;npx / install.sh
|
|
46
|
+
| **生态分发** | GitHub + npm + ClawHub 三源同步发布;npx / git clone / Download ZIP / install.sh 四种安装方式 |
|
|
47
47
|
|
|
48
48
|
## 功能体系
|
|
49
49
|
|
|
@@ -87,51 +87,39 @@ python3 scripts/yotta_humanize.py score -f article.md --gate --threshold 45
|
|
|
87
87
|
|
|
88
88
|
## 安装
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
以下四种方式任选,顺序即推荐优先级;技能文件一律从 **npm** 获取(GitHub 无代理较慢,npm 支持镜像)。
|
|
91
91
|
|
|
92
|
-
### 方式一:npm
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
npx -y @yottameta/yotta-humanize --
|
|
92
|
+
### 方式一:npm 一行装(推荐)
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
# 可选国内加速:npm config set registry https://registry.npmmirror.com
|
|
96
|
+
npx -y @yottameta/yotta-humanize --agent <智能体名称> # 装到指定智能体默认用户级技能目录
|
|
97
|
+
npx -y @yottameta/yotta-humanize --dir <智能体的技能目录> # 指到技能目录本身(如 ~/.codex/skills)
|
|
97
98
|
```
|
|
98
|
-
> 智能体不在预置列表里?用 --dir 指定它的 skills 目录,或手动复制(方式三)。--list 可查看各智能体对应的默认目录。想手动拿文件也可 npm pack @yottameta/yotta-humanize 解包后按方式二/三安装。
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
- `--agent <name>` 自动装到该智能体默认用户级目录;`--list` 可查看各智能体默认目录。
|
|
101
|
+
- `--dir <路径>` 装到指定的技能目录;未收录的智能体用 `--dir` 指到它的技能目录。
|
|
102
|
+
- npmmirror 未同步新包(404):加 `--registry=https://registry.npmjs.org/`(国内需代理),或稍等镜像缓存。
|
|
103
|
+
|
|
104
|
+
### 方式二:git clone(开发者 / 有 git 环境)
|
|
105
|
+
|
|
106
|
+
```text
|
|
107
|
+
git clone https://github.com/YottaMeta/yotta-humanize.git <智能体的技能目录>/yotta-humanize
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 方式三:GitHub 下载压缩包(手动 / 无 git 环境)
|
|
111
|
+
|
|
112
|
+
在 GitHub 仓库 `YottaMeta/yotta-humanize` 点 **Code → Download ZIP**,解压后把 `yotta-humanize` 文件夹放进智能体技能目录。
|
|
113
|
+
|
|
114
|
+
### 方式四:install.sh(多智能体一键脚本)
|
|
115
|
+
|
|
116
|
+
```text
|
|
117
|
+
bash install.sh --agent <name> # 装到指定智能体默认用户级目录
|
|
118
|
+
bash install.sh --dir <path> # 装到指定目录
|
|
119
|
+
bash install.sh --list # 列出智能体 -> 默认目录
|
|
107
120
|
```
|
|
108
|
-
> 覆盖 17 类智能体,含国内 Trae / Qwen / Comate / CodeBuddy / Kimi。Windows 用户:装有 Git Bash 即可用;否则用方式三手动复制。
|
|
109
|
-
|
|
110
|
-
### 方式三:手动复制
|
|
111
|
-
把整个 yotta-humanize 文件夹复制到目标智能体的 skills 目录。常见位置(用户级;Windows 用 %USERPROFILE%,Linux/macOS 用 ~):
|
|
112
|
-
|
|
113
|
-
| 智能体 | 用户级目录 | 项目级目录 |
|
|
114
|
-
|---|---|---|
|
|
115
|
-
| Codex | %USERPROFILE%\.codex\skills\yotta-humanize\ | .codex\skills\ |
|
|
116
|
-
| Claude Code | %USERPROFILE%\.claude\skills\yotta-humanize\ | .claude\skills\ |
|
|
117
|
-
| Cursor | %USERPROFILE%\.cursor\skills\yotta-humanize\ | .cursor\skills\ |
|
|
118
|
-
| Windsurf | %USERPROFILE%\.codeium\windsurf\skills\yotta-humanize\ | .windsurf\skills\ |
|
|
119
|
-
| opencode | %USERPROFILE%\.config\opencode\skills\yotta-humanize\ | .opencode\skills\ |
|
|
120
|
-
| Gemini | %USERPROFILE%\.gemini\skills\yotta-humanize\ | .gemini\skills\ |
|
|
121
|
-
| Goose | %USERPROFILE%\.config\goose\skills\yotta-humanize\ | .goose\skills\ |
|
|
122
|
-
| Amp | %USERPROFILE%\.config\agents\skills\yotta-humanize\ | .agents\skills\ |
|
|
123
|
-
| Kiro | %USERPROFILE%\.kiro\skills\yotta-humanize\ | .kiro\skills\ |
|
|
124
|
-
| WorkBuddy | %USERPROFILE%\.workbuddy\skills\yotta-humanize\ | .workbuddy\skills\ |
|
|
125
|
-
| Trae Code CLI | %USERPROFILE%\.traecli\skills\yotta-humanize\ | .traecli\skills\ |
|
|
126
|
-
| Trae IDE(国内) | %USERPROFILE%\.trae-cn\skills\yotta-humanize\ | .trae\skills\ |
|
|
127
|
-
| Qwen Code | %USERPROFILE%\.qwen\skills\yotta-humanize\ | .qwen\skills\ |
|
|
128
|
-
| Comate | %USERPROFILE%\.comate\skills\yotta-humanize\ | .comate\skills\ |
|
|
129
|
-
| CodeBuddy | %USERPROFILE%\.codebuddy\skills\yotta-humanize\ | .codebuddy\skills\ |
|
|
130
|
-
| Kimi | %USERPROFILE%\.kimi\skills\yotta-humanize\ | .kimi\skills\ |
|
|
131
|
-
| 通用 AGENTS.md | %USERPROFILE%\.agents\skills\yotta-humanize\ | .agents\skills\ |
|
|
132
|
-
|
|
133
|
-
> Codex 默认目录若设置了环境变量 CODEX_HOME,以该变量为准;opencode 若设置 XDG_CONFIG_HOME 同理。.agents\skills 并非通用目录,仅 OpenCode / Cursor / Cline / Amp / Kimi / Gemini CLI / GitHub Copilot 等会读取,Claude Code 与 Codex 默认不读。不确定时用 --dir 指定,或让该智能体自行安装。
|
|
134
121
|
|
|
122
|
+
> 方式一走 npm 源(npmmirror / npmjs),不依赖 GitHub;方式二 / 三走 GitHub,国内无代理可能失败。
|
|
135
123
|
## 使用示例(AI 智能体)
|
|
136
124
|
|
|
137
125
|
1. 将本仓库的 SKILL.md 接入任意 AI 智能体的技能/规则系统(见上方安装)。
|
|
@@ -148,6 +136,40 @@ bash install.sh --dir /path/to/skills
|
|
|
148
136
|
4. 需要判断的部分(排比拆句、模糊归因补来源、绝对化软化)按 suggest 的建议手工润色。
|
|
149
137
|
5. 改写完再 score 一次,确认评分下降、原意未破坏。
|
|
150
138
|
|
|
139
|
+
## 效果展示(改写前后)
|
|
140
|
+
|
|
141
|
+
**输入**(典型 AI 腔):
|
|
142
|
+
|
|
143
|
+
```text
|
|
144
|
+
赋能业务增长,打造闭环生态,提升用户体验,实现价值最大化。
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**输出**(`rewrite` 确定性改写,示意):
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
帮业务更快增长,把流程走通,让用户用得顺手,做出实实在在的价值。
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
改写前评分 68/100 → 改写后 23/100(AI 腔明显下降);`rewrite` 会同时输出修复清单(改了什么、改了几处)。
|
|
154
|
+
|
|
155
|
+
## 错误处理
|
|
156
|
+
|
|
157
|
+
- 退出码:**0** = 成功;**1** = `--gate` 命中(CI 拦截);**4** = 输入错误(文件不存在、无输入等)。
|
|
158
|
+
- 文件不存在 / 不是 UTF-8 编码 / 无读取权限时,会给出**中文修复建议**,不再抛一堆英文堆栈。
|
|
159
|
+
- 常见问题与避坑详见 [references/faq.md](references/faq.md)。
|
|
160
|
+
|
|
161
|
+
## 常见问题 FAQ(速查)
|
|
162
|
+
|
|
163
|
+
| 问题 | 答案(详见 references/faq.md) |
|
|
164
|
+
|---|---|
|
|
165
|
+
| 怎么传文本? | `-f 文件` / `--stdin` / 直接传文本参数 |
|
|
166
|
+
| 文件不是 UTF-8? | 另存为 UTF-8 再试(记事本 → 另存为 → UTF-8) |
|
|
167
|
+
| 长文怎么处理? | 分段处理;复杂嵌套可能需人工复核 |
|
|
168
|
+
| 改写后变化不大? | 原文 AI 味低;用 analyze 看命中规则,suggest 取润色建议 |
|
|
169
|
+
| rewrite vs suggest? | rewrite 机械改写全文;suggest 给人工润色建议 |
|
|
170
|
+
| CI 拦截? | `--gate --threshold 40`,命中退出码 1 |
|
|
171
|
+
| 会不会改坏原文? | 只做确定性替换 + 修复清单 + before/after 评分,可核对 |
|
|
172
|
+
|
|
151
173
|
## 开发与校验
|
|
152
174
|
|
|
153
175
|
- 测试:python scripts/test_yotta_humanize.py(155 项)
|
package/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: yotta-humanize
|
|
3
|
-
version: 0.1.
|
|
3
|
+
version: 0.1.3
|
|
4
4
|
description: 元真 —— 去 AI 味的中文写作编辑技能:检测器引擎(24 类规则 + 词表 + 统计突发性)识别并改写 AI 腔文本,让中文写作更自然、更像人写的。触发:编辑 / 润色文本、去 AI 味、让文章 / 文案 / 回复更像人写、发现文本充斥着 AI 常用词与句式(赋能 / 闭环 / 值得注意的是 / 综上所述 / 希望对你有所帮助 等)、给 AI 生成的中文稿件做检测与改写。边界:只处理文本,不生成新内容;不改写事实 / 数据 / 专有名词;不破坏作者原意;改写为确定性规则,不依赖模型。
|
|
5
5
|
license: MIT
|
|
6
6
|
---
|
package/bin/install.js
CHANGED
|
@@ -1,163 +1,163 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* yotta-humanize 跨平台安装器(YottaSkills)
|
|
4
|
-
* 用法:
|
|
5
|
-
* npx -y @yottameta/yotta-humanize --agent <name> # 按智能体默认用户级目录安装(推荐)
|
|
6
|
-
* npx -y @yottameta/yotta-humanize --dir PATH # 装到指定目录(用户改了目录的智能体)
|
|
7
|
-
* npx -y @yottameta/yotta-humanize -g # 安装到全部已知智能体用户级目录
|
|
8
|
-
* npx -y @yottameta/yotta-humanize # 安装到检测到的项目级目录
|
|
9
|
-
* npx -y @yottameta/yotta-humanize --list # 列出智能体 -> 默认目录
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
const fs = require('fs');
|
|
13
|
-
const path = require('path');
|
|
14
|
-
const os = require('os');
|
|
15
|
-
|
|
16
|
-
const SKILL_NAME = 'yotta-humanize';
|
|
17
|
-
const PKG_ROOT = path.join(__dirname, '..');
|
|
18
|
-
|
|
19
|
-
// 智能体 -> 用户级默认技能目录(dirs 按优先级排列;--agent 装到第一个)
|
|
20
|
-
// 依据官方文档:.agents/skills 并非通用目录,被 OpenCode / Cursor / Cline / Amp /
|
|
21
|
-
// Kimi / Gemini CLI / GitHub Copilot 等读取;Claude Code 与 Codex 默认不读 .agents。
|
|
22
|
-
const AGENT_DIRS = {
|
|
23
|
-
claude: { label: 'Claude Code', dirs: ['.claude/skills'] },
|
|
24
|
-
cursor: { label: 'Cursor', dirs: ['.cursor/skills', '.agents/skills'] },
|
|
25
|
-
codex: { label: 'Codex', dirs: ['.codex/skills'] }, // 特判:$CODEX_HOME/skills
|
|
26
|
-
gemini: { label: 'Gemini CLI', dirs: ['.gemini/skills', '.agents/skills'] },
|
|
27
|
-
goose: { label: 'Goose', dirs: ['.config/goose/skills', '.agents/skills'] },
|
|
28
|
-
amp: { label: 'Amp', dirs: ['.config/agents/skills', '.agents/skills'] },
|
|
29
|
-
opencode: { label: 'OpenCode', dirs: ['.config/opencode/skills'] }, // 特判:$XDG_CONFIG_HOME
|
|
30
|
-
windsurf: { label: 'Windsurf', dirs: ['.codeium/windsurf/skills'] },
|
|
31
|
-
workbuddy: { label: 'WorkBuddy', dirs: ['.workbuddy/skills'] },
|
|
32
|
-
kiro: { label: 'Kiro', dirs: ['.kiro/skills'] },
|
|
33
|
-
trae: { label: 'Trae Code CLI', dirs: ['.traecli/skills'] },
|
|
34
|
-
'trae-cn': { label: 'Trae IDE(国内)', dirs: ['.trae-cn/skills'] },
|
|
35
|
-
qwen: { label: 'Qwen Code', dirs: ['.qwen/skills'] },
|
|
36
|
-
comate: { label: 'Comate 文心快码', dirs: ['.comate/skills'] },
|
|
37
|
-
codebuddy: { label: 'CodeBuddy Code', dirs: ['.codebuddy/skills'] },
|
|
38
|
-
kimi: { label: 'Kimi Code CLI', dirs: ['.kimi/skills'] },
|
|
39
|
-
agents: { label: '通用 AGENTS.md', dirs: ['.agents/skills'] },
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// Codex 用户级目录特判:优先 $CODEX_HOME/skills,否则 ~/.codex/skills
|
|
43
|
-
function codexUserDir() {
|
|
44
|
-
const base = process.env.CODEX_HOME || path.join(os.homedir(), '.codex');
|
|
45
|
-
return path.join(base, 'skills');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// OpenCode 用户级目录特判:优先 $XDG_CONFIG_HOME/opencode/skills,否则 ~/.config/opencode/skills
|
|
49
|
-
function opencodeUserDir() {
|
|
50
|
-
const base = process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config');
|
|
51
|
-
return path.join(base, 'opencode', 'skills');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function resolveUserDir(rel) {
|
|
55
|
-
if (rel === '.codex/skills') return codexUserDir();
|
|
56
|
-
if (rel === '.config/opencode/skills') return opencodeUserDir();
|
|
57
|
-
return path.join(os.homedir(), rel);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function installTo(dest) {
|
|
61
|
-
const target = path.join(dest, SKILL_NAME);
|
|
62
|
-
fs.mkdirSync(target, { recursive: true });
|
|
63
|
-
copyDir(PKG_ROOT, target, new Set(['package.json', 'bin', 'node_modules', '.git']));
|
|
64
|
-
console.log('installed -> ' + target);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function copyDir(src, dst, skip) {
|
|
68
|
-
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
69
|
-
if (skip.has(entry.name)) continue;
|
|
70
|
-
const s = path.join(src, entry.name);
|
|
71
|
-
const d = path.join(dst, entry.name);
|
|
72
|
-
if (entry.isDirectory()) {
|
|
73
|
-
fs.mkdirSync(d, { recursive: true });
|
|
74
|
-
copyDir(s, d, skip);
|
|
75
|
-
} else if (entry.isFile()) {
|
|
76
|
-
fs.copyFileSync(s, d);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function displayDir(rel) {
|
|
82
|
-
if (process.platform === 'win32') return '%USERPROFILE%\\' + rel.replace(/\//g, '\\');
|
|
83
|
-
return '~/' + rel;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function main() {
|
|
87
|
-
const args = process.argv.slice(2);
|
|
88
|
-
const isGlobal = args.includes('-g') || args.includes('--global');
|
|
89
|
-
const list = args.includes('--list') || args.includes('-l');
|
|
90
|
-
let explicitDir = null;
|
|
91
|
-
const di = args.indexOf('--dir');
|
|
92
|
-
if (di !== -1 && args[di + 1]) explicitDir = args[di + 1];
|
|
93
|
-
let agent = null;
|
|
94
|
-
const ai = args.indexOf('--agent');
|
|
95
|
-
if (ai !== -1 && args[ai + 1]) agent = String(args[ai + 1]).toLowerCase();
|
|
96
|
-
|
|
97
|
-
if (list) {
|
|
98
|
-
console.log('智能体 -> 默认技能目录(--agent <name> 装到第一个,用户级):');
|
|
99
|
-
for (const [key, v] of Object.entries(AGENT_DIRS)) {
|
|
100
|
-
const resolved = v.dirs.map(displayDir);
|
|
101
|
-
console.log(' ' + key.padEnd(10) + v.label.padEnd(18) + resolved.join('、'));
|
|
102
|
-
}
|
|
103
|
-
console.log('\n说明:Windows 用 %USERPROFILE%,Linux/macOS 用 ~;仅收录有官方默认目录的智能体。');
|
|
104
|
-
console.log('改了目录的请用 --dir <路径>,不要依赖默认位置;若设置了 CODEX_HOME / XDG_CONFIG_HOME,安装自动以该变量为准。');
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (explicitDir) { installTo(explicitDir); return; }
|
|
109
|
-
|
|
110
|
-
if (agent) {
|
|
111
|
-
const info = AGENT_DIRS[agent];
|
|
112
|
-
if (!info) {
|
|
113
|
-
console.log('未收录智能体: ' + agent + '。请用 --dir <路径> 指定技能目录。');
|
|
114
|
-
console.log('可用: ' + Object.keys(AGENT_DIRS).join(', '));
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
installTo(resolveUserDir(info.dirs[0]));
|
|
118
|
-
console.log('完成。');
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (isGlobal) {
|
|
123
|
-
const seen = new Set();
|
|
124
|
-
for (const v of Object.values(AGENT_DIRS)) {
|
|
125
|
-
for (const d of v.dirs) {
|
|
126
|
-
if (seen.has(d)) continue;
|
|
127
|
-
seen.add(d);
|
|
128
|
-
installTo(resolveUserDir(d));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
console.log('完成。');
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const PROJECT_DIRS = [
|
|
136
|
-
'.claude/skills',
|
|
137
|
-
'.cursor/skills',
|
|
138
|
-
'.codex/skills',
|
|
139
|
-
'.config/goose/skills',
|
|
140
|
-
'.config/agents/skills',
|
|
141
|
-
'.opencode/skills',
|
|
142
|
-
'.codeium/windsurf/skills',
|
|
143
|
-
'.workbuddy/skills',
|
|
144
|
-
'.kiro/skills',
|
|
145
|
-
'.traecli/skills',
|
|
146
|
-
'.gemini/skills',
|
|
147
|
-
'.trae-cn/skills',
|
|
148
|
-
'.qwen/skills',
|
|
149
|
-
'.comate/skills',
|
|
150
|
-
'.codebuddy/skills',
|
|
151
|
-
'.kimi/skills',
|
|
152
|
-
'.agents/skills',
|
|
153
|
-
];
|
|
154
|
-
let installedAny = false;
|
|
155
|
-
for (const d of PROJECT_DIRS) {
|
|
156
|
-
if (fs.existsSync(d)) { installTo(d); installedAny = true; }
|
|
157
|
-
}
|
|
158
|
-
if (!installedAny) {
|
|
159
|
-
console.log('未检测到项目级智能体目录。可手动复制,或用 --agent <name> / -g 装到用户级。');
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* yotta-humanize 跨平台安装器(YottaSkills)
|
|
4
|
+
* 用法:
|
|
5
|
+
* npx -y @yottameta/yotta-humanize --agent <name> # 按智能体默认用户级目录安装(推荐)
|
|
6
|
+
* npx -y @yottameta/yotta-humanize --dir PATH # 装到指定目录(用户改了目录的智能体)
|
|
7
|
+
* npx -y @yottameta/yotta-humanize -g # 安装到全部已知智能体用户级目录
|
|
8
|
+
* npx -y @yottameta/yotta-humanize # 安装到检测到的项目级目录
|
|
9
|
+
* npx -y @yottameta/yotta-humanize --list # 列出智能体 -> 默认目录
|
|
10
|
+
*/
|
|
11
|
+
'use strict';
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const os = require('os');
|
|
15
|
+
|
|
16
|
+
const SKILL_NAME = 'yotta-humanize';
|
|
17
|
+
const PKG_ROOT = path.join(__dirname, '..');
|
|
18
|
+
|
|
19
|
+
// 智能体 -> 用户级默认技能目录(dirs 按优先级排列;--agent 装到第一个)
|
|
20
|
+
// 依据官方文档:.agents/skills 并非通用目录,被 OpenCode / Cursor / Cline / Amp /
|
|
21
|
+
// Kimi / Gemini CLI / GitHub Copilot 等读取;Claude Code 与 Codex 默认不读 .agents。
|
|
22
|
+
const AGENT_DIRS = {
|
|
23
|
+
claude: { label: 'Claude Code', dirs: ['.claude/skills'] },
|
|
24
|
+
cursor: { label: 'Cursor', dirs: ['.cursor/skills', '.agents/skills'] },
|
|
25
|
+
codex: { label: 'Codex', dirs: ['.codex/skills'] }, // 特判:$CODEX_HOME/skills
|
|
26
|
+
gemini: { label: 'Gemini CLI', dirs: ['.gemini/skills', '.agents/skills'] },
|
|
27
|
+
goose: { label: 'Goose', dirs: ['.config/goose/skills', '.agents/skills'] },
|
|
28
|
+
amp: { label: 'Amp', dirs: ['.config/agents/skills', '.agents/skills'] },
|
|
29
|
+
opencode: { label: 'OpenCode', dirs: ['.config/opencode/skills'] }, // 特判:$XDG_CONFIG_HOME
|
|
30
|
+
windsurf: { label: 'Windsurf', dirs: ['.codeium/windsurf/skills'] },
|
|
31
|
+
workbuddy: { label: 'WorkBuddy', dirs: ['.workbuddy/skills'] },
|
|
32
|
+
kiro: { label: 'Kiro', dirs: ['.kiro/skills'] },
|
|
33
|
+
trae: { label: 'Trae Code CLI', dirs: ['.traecli/skills'] },
|
|
34
|
+
'trae-cn': { label: 'Trae IDE(国内)', dirs: ['.trae-cn/skills'] },
|
|
35
|
+
qwen: { label: 'Qwen Code', dirs: ['.qwen/skills'] },
|
|
36
|
+
comate: { label: 'Comate 文心快码', dirs: ['.comate/skills'] },
|
|
37
|
+
codebuddy: { label: 'CodeBuddy Code', dirs: ['.codebuddy/skills'] },
|
|
38
|
+
kimi: { label: 'Kimi Code CLI', dirs: ['.kimi/skills'] },
|
|
39
|
+
agents: { label: '通用 AGENTS.md', dirs: ['.agents/skills'] },
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Codex 用户级目录特判:优先 $CODEX_HOME/skills,否则 ~/.codex/skills
|
|
43
|
+
function codexUserDir() {
|
|
44
|
+
const base = process.env.CODEX_HOME || path.join(os.homedir(), '.codex');
|
|
45
|
+
return path.join(base, 'skills');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// OpenCode 用户级目录特判:优先 $XDG_CONFIG_HOME/opencode/skills,否则 ~/.config/opencode/skills
|
|
49
|
+
function opencodeUserDir() {
|
|
50
|
+
const base = process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config');
|
|
51
|
+
return path.join(base, 'opencode', 'skills');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function resolveUserDir(rel) {
|
|
55
|
+
if (rel === '.codex/skills') return codexUserDir();
|
|
56
|
+
if (rel === '.config/opencode/skills') return opencodeUserDir();
|
|
57
|
+
return path.join(os.homedir(), rel);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function installTo(dest) {
|
|
61
|
+
const target = path.join(dest, SKILL_NAME);
|
|
62
|
+
fs.mkdirSync(target, { recursive: true });
|
|
63
|
+
copyDir(PKG_ROOT, target, new Set(['package.json', 'bin', 'node_modules', '.git']));
|
|
64
|
+
console.log('installed -> ' + target);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function copyDir(src, dst, skip) {
|
|
68
|
+
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
69
|
+
if (skip.has(entry.name)) continue;
|
|
70
|
+
const s = path.join(src, entry.name);
|
|
71
|
+
const d = path.join(dst, entry.name);
|
|
72
|
+
if (entry.isDirectory()) {
|
|
73
|
+
fs.mkdirSync(d, { recursive: true });
|
|
74
|
+
copyDir(s, d, skip);
|
|
75
|
+
} else if (entry.isFile()) {
|
|
76
|
+
fs.copyFileSync(s, d);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function displayDir(rel) {
|
|
82
|
+
if (process.platform === 'win32') return '%USERPROFILE%\\' + rel.replace(/\//g, '\\');
|
|
83
|
+
return '~/' + rel;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function main() {
|
|
87
|
+
const args = process.argv.slice(2);
|
|
88
|
+
const isGlobal = args.includes('-g') || args.includes('--global');
|
|
89
|
+
const list = args.includes('--list') || args.includes('-l');
|
|
90
|
+
let explicitDir = null;
|
|
91
|
+
const di = args.indexOf('--dir');
|
|
92
|
+
if (di !== -1 && args[di + 1]) explicitDir = args[di + 1];
|
|
93
|
+
let agent = null;
|
|
94
|
+
const ai = args.indexOf('--agent');
|
|
95
|
+
if (ai !== -1 && args[ai + 1]) agent = String(args[ai + 1]).toLowerCase();
|
|
96
|
+
|
|
97
|
+
if (list) {
|
|
98
|
+
console.log('智能体 -> 默认技能目录(--agent <name> 装到第一个,用户级):');
|
|
99
|
+
for (const [key, v] of Object.entries(AGENT_DIRS)) {
|
|
100
|
+
const resolved = v.dirs.map(displayDir);
|
|
101
|
+
console.log(' ' + key.padEnd(10) + v.label.padEnd(18) + resolved.join('、'));
|
|
102
|
+
}
|
|
103
|
+
console.log('\n说明:Windows 用 %USERPROFILE%,Linux/macOS 用 ~;仅收录有官方默认目录的智能体。');
|
|
104
|
+
console.log('改了目录的请用 --dir <路径>,不要依赖默认位置;若设置了 CODEX_HOME / XDG_CONFIG_HOME,安装自动以该变量为准。');
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (explicitDir) { installTo(explicitDir); return; }
|
|
109
|
+
|
|
110
|
+
if (agent) {
|
|
111
|
+
const info = AGENT_DIRS[agent];
|
|
112
|
+
if (!info) {
|
|
113
|
+
console.log('未收录智能体: ' + agent + '。请用 --dir <路径> 指定技能目录。');
|
|
114
|
+
console.log('可用: ' + Object.keys(AGENT_DIRS).join(', '));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
installTo(resolveUserDir(info.dirs[0]));
|
|
118
|
+
console.log('完成。');
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (isGlobal) {
|
|
123
|
+
const seen = new Set();
|
|
124
|
+
for (const v of Object.values(AGENT_DIRS)) {
|
|
125
|
+
for (const d of v.dirs) {
|
|
126
|
+
if (seen.has(d)) continue;
|
|
127
|
+
seen.add(d);
|
|
128
|
+
installTo(resolveUserDir(d));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
console.log('完成。');
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const PROJECT_DIRS = [
|
|
136
|
+
'.claude/skills',
|
|
137
|
+
'.cursor/skills',
|
|
138
|
+
'.codex/skills',
|
|
139
|
+
'.config/goose/skills',
|
|
140
|
+
'.config/agents/skills',
|
|
141
|
+
'.opencode/skills',
|
|
142
|
+
'.codeium/windsurf/skills',
|
|
143
|
+
'.workbuddy/skills',
|
|
144
|
+
'.kiro/skills',
|
|
145
|
+
'.traecli/skills',
|
|
146
|
+
'.gemini/skills',
|
|
147
|
+
'.trae-cn/skills',
|
|
148
|
+
'.qwen/skills',
|
|
149
|
+
'.comate/skills',
|
|
150
|
+
'.codebuddy/skills',
|
|
151
|
+
'.kimi/skills',
|
|
152
|
+
'.agents/skills',
|
|
153
|
+
];
|
|
154
|
+
let installedAny = false;
|
|
155
|
+
for (const d of PROJECT_DIRS) {
|
|
156
|
+
if (fs.existsSync(d)) { installTo(d); installedAny = true; }
|
|
157
|
+
}
|
|
158
|
+
if (!installedAny) {
|
|
159
|
+
console.log('未检测到项目级智能体目录。可手动复制,或用 --agent <name> / -g 装到用户级。');
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
163
|
main();
|
package/install.sh
CHANGED
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# yotta-humanize 多智能体安装脚本(YottaSkills 模板)
|
|
3
|
-
# 用法:
|
|
4
|
-
# bash install.sh --agent <name> # 按智能体默认用户级目录安装
|
|
5
|
-
# bash install.sh --dir <path> # 装到指定目录(用户改过目录的智能体)
|
|
6
|
-
# bash install.sh -g # 装到全部已知智能体用户级目录
|
|
7
|
-
# bash install.sh # 检测并安装到已存在的项目级目录
|
|
8
|
-
# bash install.sh --list # 列出智能体 -> 默认目录
|
|
9
|
-
set -euo pipefail
|
|
10
|
-
|
|
11
|
-
SKILL_NAME="yotta-humanize"
|
|
12
|
-
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
13
|
-
case "$(uname -s)" in
|
|
14
|
-
MINGW*|MSYS*)
|
|
15
|
-
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -W)"
|
|
16
|
-
;;
|
|
17
|
-
esac
|
|
18
|
-
|
|
19
|
-
# 智能体 -> 用户级默认目录(--agent 装到第一个)
|
|
20
|
-
# .agents/skills 并非通用目录:OpenCode / Cursor / Cline / Amp / Kimi / Gemini CLI / GitHub Copilot 读取。
|
|
21
|
-
# 判断当前环境:Windows Git Bash 用 %USERPROFILE%,Unix 用 ~
|
|
22
|
-
_IS_WINDOWS=0
|
|
23
|
-
case "$(uname -s)" in
|
|
24
|
-
MINGW*|MSYS*|CYGWIN*) _IS_WINDOWS=1 ;;
|
|
25
|
-
esac
|
|
26
|
-
dirs_for() {
|
|
27
|
-
case "$1" in
|
|
28
|
-
claude) echo ".claude/skills" ;;
|
|
29
|
-
cursor) echo ".cursor/skills .agents/skills" ;;
|
|
30
|
-
codex) echo "__CODEX__" ;;
|
|
31
|
-
gemini) echo ".gemini/skills .agents/skills" ;;
|
|
32
|
-
goose) echo ".config/goose/skills .agents/skills" ;;
|
|
33
|
-
amp) echo ".config/agents/skills .agents/skills" ;;
|
|
34
|
-
opencode) echo "__OPENCODE__" ;;
|
|
35
|
-
windsurf) echo ".codeium/windsurf/skills" ;;
|
|
36
|
-
workbuddy) echo ".workbuddy/skills" ;;
|
|
37
|
-
kiro) echo ".kiro/skills" ;;
|
|
38
|
-
trae) echo ".traecli/skills" ;;
|
|
39
|
-
trae-cn) echo ".trae-cn/skills" ;;
|
|
40
|
-
qwen) echo ".qwen/skills" ;;
|
|
41
|
-
comate) echo ".comate/skills" ;;
|
|
42
|
-
codebuddy) echo ".codebuddy/skills" ;;
|
|
43
|
-
kimi) echo ".kimi/skills" ;;
|
|
44
|
-
agents) echo ".agents/skills" ;;
|
|
45
|
-
*) return 1 ;;
|
|
46
|
-
esac
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
codex_dir() {
|
|
50
|
-
if [ -n "${CODEX_HOME:-}" ]; then printf '%s' "$CODEX_HOME/skills"; else printf '%s' "$HOME/.codex/skills"; fi
|
|
51
|
-
}
|
|
52
|
-
opencode_dir() {
|
|
53
|
-
if [ -n "${XDG_CONFIG_HOME:-}" ]; then printf '%s' "$XDG_CONFIG_HOME/opencode/skills"; else printf '%s' "$HOME/.config/opencode/skills"; fi
|
|
54
|
-
}
|
|
55
|
-
resolve_user() {
|
|
56
|
-
case "$1" in
|
|
57
|
-
__CODEX__) codex_dir ;;
|
|
58
|
-
__OPENCODE__) opencode_dir ;;
|
|
59
|
-
*) printf '%s' "$HOME/$1" ;;
|
|
60
|
-
esac
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
install_to() {
|
|
64
|
-
mkdir -p "$1/$SKILL_NAME"
|
|
65
|
-
cp -r "$SOURCE_DIR/." "$1/$SKILL_NAME/"
|
|
66
|
-
rm -rf "$1/$SKILL_NAME/.git"
|
|
67
|
-
echo "installed -> $1/$SKILL_NAME"
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
list() {
|
|
71
|
-
echo "智能体 -> 默认技能目录(--agent <name> 装到第一个,用户级):"
|
|
72
|
-
for a in claude cursor codex gemini goose amp opencode windsurf workbuddy kiro trae trae-cn qwen comate codebuddy kimi agents; do
|
|
73
|
-
local dirs first
|
|
74
|
-
dirs="$(dirs_for "$a")"
|
|
75
|
-
first="${dirs%% *}"
|
|
76
|
-
case "$first" in
|
|
77
|
-
__CODEX__) first=".codex/skills" ;;
|
|
78
|
-
__OPENCODE__) first=".config/opencode/skills" ;;
|
|
79
|
-
esac
|
|
80
|
-
if [ "$_IS_WINDOWS" = "1" ]; then
|
|
81
|
-
first="%USERPROFILE%\\${first//\//\\}"
|
|
82
|
-
else
|
|
83
|
-
first="~/$first"
|
|
84
|
-
fi
|
|
85
|
-
printf ' %-10s %s\n' "$a" "$first"
|
|
86
|
-
done
|
|
87
|
-
echo '说明:Windows 用 %USERPROFILE%,Linux/macOS 用 ~;仅收录有官方默认目录的智能体。'
|
|
88
|
-
echo '改了目录的请用 --dir <路径>,不要依赖默认位置;若设置了 CODEX_HOME / XDG_CONFIG_HOME,安装自动以该变量为准。'
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
main() {
|
|
92
|
-
local agent="" dir="" global=0 show_list=0
|
|
93
|
-
while [ $# -gt 0 ]; do
|
|
94
|
-
case "$1" in
|
|
95
|
-
--agent) shift; agent="${1:-}" ;;
|
|
96
|
-
--dir) shift; dir="${1:-}" ;;
|
|
97
|
-
-g|--global) global=1 ;;
|
|
98
|
-
--list|-l) show_list=1 ;;
|
|
99
|
-
*) echo "未知参数: $1" >&2; exit 2 ;;
|
|
100
|
-
esac
|
|
101
|
-
shift
|
|
102
|
-
done
|
|
103
|
-
|
|
104
|
-
if [ "$show_list" = "1" ]; then list; return; fi
|
|
105
|
-
if [ -n "$dir" ]; then install_to "$dir"; echo "完成。"; return; fi
|
|
106
|
-
if [ -n "$agent" ]; then
|
|
107
|
-
local dirs first
|
|
108
|
-
if ! dirs="$(dirs_for "$agent")"; then
|
|
109
|
-
echo "未收录智能体: $agent。请用 --dir <路径> 指定技能目录。" >&2; exit 2
|
|
110
|
-
fi
|
|
111
|
-
first="${dirs%% *}"
|
|
112
|
-
install_to "$(resolve_user "$first")"; echo "完成。"; return
|
|
113
|
-
fi
|
|
114
|
-
if [ "$global" = "1" ]; then
|
|
115
|
-
echo "安装到全部已知智能体用户级目录..."
|
|
116
|
-
local dirs rel
|
|
117
|
-
for a in claude cursor codex gemini goose amp opencode windsurf workbuddy kiro trae trae-cn qwen comate codebuddy kimi agents; do
|
|
118
|
-
dirs="$(dirs_for "$a")"
|
|
119
|
-
for rel in $dirs; do install_to "$(resolve_user "$rel")"; done
|
|
120
|
-
done
|
|
121
|
-
echo "完成。"; return
|
|
122
|
-
fi
|
|
123
|
-
local installed=0 d
|
|
124
|
-
for d in .claude/skills .cursor/skills .codex/skills .config/goose/skills .config/agents/skills .opencode/skills .codeium/windsurf/skills .workbuddy/skills .kiro/skills .traecli/skills .gemini/skills .trae-cn/skills .qwen/skills .comate/skills .codebuddy/skills .kimi/skills .agents/skills; do
|
|
125
|
-
if [ -d "$d" ]; then install_to "$d"; installed=1; fi
|
|
126
|
-
done
|
|
127
|
-
if [ "$installed" = "0" ]; then
|
|
128
|
-
echo "未检测到项目级智能体目录。可用 --agent <name> / -g 装到用户级,或 --dir 指定。"
|
|
129
|
-
fi
|
|
130
|
-
}
|
|
131
|
-
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# yotta-humanize 多智能体安装脚本(YottaSkills 模板)
|
|
3
|
+
# 用法:
|
|
4
|
+
# bash install.sh --agent <name> # 按智能体默认用户级目录安装
|
|
5
|
+
# bash install.sh --dir <path> # 装到指定目录(用户改过目录的智能体)
|
|
6
|
+
# bash install.sh -g # 装到全部已知智能体用户级目录
|
|
7
|
+
# bash install.sh # 检测并安装到已存在的项目级目录
|
|
8
|
+
# bash install.sh --list # 列出智能体 -> 默认目录
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
|
|
11
|
+
SKILL_NAME="yotta-humanize"
|
|
12
|
+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
13
|
+
case "$(uname -s)" in
|
|
14
|
+
MINGW*|MSYS*)
|
|
15
|
+
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -W)"
|
|
16
|
+
;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
# 智能体 -> 用户级默认目录(--agent 装到第一个)
|
|
20
|
+
# .agents/skills 并非通用目录:OpenCode / Cursor / Cline / Amp / Kimi / Gemini CLI / GitHub Copilot 读取。
|
|
21
|
+
# 判断当前环境:Windows Git Bash 用 %USERPROFILE%,Unix 用 ~
|
|
22
|
+
_IS_WINDOWS=0
|
|
23
|
+
case "$(uname -s)" in
|
|
24
|
+
MINGW*|MSYS*|CYGWIN*) _IS_WINDOWS=1 ;;
|
|
25
|
+
esac
|
|
26
|
+
dirs_for() {
|
|
27
|
+
case "$1" in
|
|
28
|
+
claude) echo ".claude/skills" ;;
|
|
29
|
+
cursor) echo ".cursor/skills .agents/skills" ;;
|
|
30
|
+
codex) echo "__CODEX__" ;;
|
|
31
|
+
gemini) echo ".gemini/skills .agents/skills" ;;
|
|
32
|
+
goose) echo ".config/goose/skills .agents/skills" ;;
|
|
33
|
+
amp) echo ".config/agents/skills .agents/skills" ;;
|
|
34
|
+
opencode) echo "__OPENCODE__" ;;
|
|
35
|
+
windsurf) echo ".codeium/windsurf/skills" ;;
|
|
36
|
+
workbuddy) echo ".workbuddy/skills" ;;
|
|
37
|
+
kiro) echo ".kiro/skills" ;;
|
|
38
|
+
trae) echo ".traecli/skills" ;;
|
|
39
|
+
trae-cn) echo ".trae-cn/skills" ;;
|
|
40
|
+
qwen) echo ".qwen/skills" ;;
|
|
41
|
+
comate) echo ".comate/skills" ;;
|
|
42
|
+
codebuddy) echo ".codebuddy/skills" ;;
|
|
43
|
+
kimi) echo ".kimi/skills" ;;
|
|
44
|
+
agents) echo ".agents/skills" ;;
|
|
45
|
+
*) return 1 ;;
|
|
46
|
+
esac
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
codex_dir() {
|
|
50
|
+
if [ -n "${CODEX_HOME:-}" ]; then printf '%s' "$CODEX_HOME/skills"; else printf '%s' "$HOME/.codex/skills"; fi
|
|
51
|
+
}
|
|
52
|
+
opencode_dir() {
|
|
53
|
+
if [ -n "${XDG_CONFIG_HOME:-}" ]; then printf '%s' "$XDG_CONFIG_HOME/opencode/skills"; else printf '%s' "$HOME/.config/opencode/skills"; fi
|
|
54
|
+
}
|
|
55
|
+
resolve_user() {
|
|
56
|
+
case "$1" in
|
|
57
|
+
__CODEX__) codex_dir ;;
|
|
58
|
+
__OPENCODE__) opencode_dir ;;
|
|
59
|
+
*) printf '%s' "$HOME/$1" ;;
|
|
60
|
+
esac
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
install_to() {
|
|
64
|
+
mkdir -p "$1/$SKILL_NAME"
|
|
65
|
+
cp -r "$SOURCE_DIR/." "$1/$SKILL_NAME/"
|
|
66
|
+
rm -rf "$1/$SKILL_NAME/.git"
|
|
67
|
+
echo "installed -> $1/$SKILL_NAME"
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
list() {
|
|
71
|
+
echo "智能体 -> 默认技能目录(--agent <name> 装到第一个,用户级):"
|
|
72
|
+
for a in claude cursor codex gemini goose amp opencode windsurf workbuddy kiro trae trae-cn qwen comate codebuddy kimi agents; do
|
|
73
|
+
local dirs first
|
|
74
|
+
dirs="$(dirs_for "$a")"
|
|
75
|
+
first="${dirs%% *}"
|
|
76
|
+
case "$first" in
|
|
77
|
+
__CODEX__) first=".codex/skills" ;;
|
|
78
|
+
__OPENCODE__) first=".config/opencode/skills" ;;
|
|
79
|
+
esac
|
|
80
|
+
if [ "$_IS_WINDOWS" = "1" ]; then
|
|
81
|
+
first="%USERPROFILE%\\${first//\//\\}"
|
|
82
|
+
else
|
|
83
|
+
first="~/$first"
|
|
84
|
+
fi
|
|
85
|
+
printf ' %-10s %s\n' "$a" "$first"
|
|
86
|
+
done
|
|
87
|
+
echo '说明:Windows 用 %USERPROFILE%,Linux/macOS 用 ~;仅收录有官方默认目录的智能体。'
|
|
88
|
+
echo '改了目录的请用 --dir <路径>,不要依赖默认位置;若设置了 CODEX_HOME / XDG_CONFIG_HOME,安装自动以该变量为准。'
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
main() {
|
|
92
|
+
local agent="" dir="" global=0 show_list=0
|
|
93
|
+
while [ $# -gt 0 ]; do
|
|
94
|
+
case "$1" in
|
|
95
|
+
--agent) shift; agent="${1:-}" ;;
|
|
96
|
+
--dir) shift; dir="${1:-}" ;;
|
|
97
|
+
-g|--global) global=1 ;;
|
|
98
|
+
--list|-l) show_list=1 ;;
|
|
99
|
+
*) echo "未知参数: $1" >&2; exit 2 ;;
|
|
100
|
+
esac
|
|
101
|
+
shift
|
|
102
|
+
done
|
|
103
|
+
|
|
104
|
+
if [ "$show_list" = "1" ]; then list; return; fi
|
|
105
|
+
if [ -n "$dir" ]; then install_to "$dir"; echo "完成。"; return; fi
|
|
106
|
+
if [ -n "$agent" ]; then
|
|
107
|
+
local dirs first
|
|
108
|
+
if ! dirs="$(dirs_for "$agent")"; then
|
|
109
|
+
echo "未收录智能体: $agent。请用 --dir <路径> 指定技能目录。" >&2; exit 2
|
|
110
|
+
fi
|
|
111
|
+
first="${dirs%% *}"
|
|
112
|
+
install_to "$(resolve_user "$first")"; echo "完成。"; return
|
|
113
|
+
fi
|
|
114
|
+
if [ "$global" = "1" ]; then
|
|
115
|
+
echo "安装到全部已知智能体用户级目录..."
|
|
116
|
+
local dirs rel
|
|
117
|
+
for a in claude cursor codex gemini goose amp opencode windsurf workbuddy kiro trae trae-cn qwen comate codebuddy kimi agents; do
|
|
118
|
+
dirs="$(dirs_for "$a")"
|
|
119
|
+
for rel in $dirs; do install_to "$(resolve_user "$rel")"; done
|
|
120
|
+
done
|
|
121
|
+
echo "完成。"; return
|
|
122
|
+
fi
|
|
123
|
+
local installed=0 d
|
|
124
|
+
for d in .claude/skills .cursor/skills .codex/skills .config/goose/skills .config/agents/skills .opencode/skills .codeium/windsurf/skills .workbuddy/skills .kiro/skills .traecli/skills .gemini/skills .trae-cn/skills .qwen/skills .comate/skills .codebuddy/skills .kimi/skills .agents/skills; do
|
|
125
|
+
if [ -d "$d" ]; then install_to "$d"; installed=1; fi
|
|
126
|
+
done
|
|
127
|
+
if [ "$installed" = "0" ]; then
|
|
128
|
+
echo "未检测到项目级智能体目录。可用 --agent <name> / -g 装到用户级,或 --dir 指定。"
|
|
129
|
+
fi
|
|
130
|
+
}
|
|
131
|
+
|
|
132
132
|
main "$@"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yottameta/yotta-humanize",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Yuanzhen (元真) — AI-flavor remover for Chinese writing: a detector engine (24 rule classes + wordlists + statistical burstiness) that identifies and rewrites AI-typical Chinese text to make it read more naturally. Triggers when editing/polishing text, removing AI flavor, or making copy read more human. Boundaries: text-only, deterministic rewrites, no model dependency.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# 元真 FAQ / 避坑指南
|
|
2
|
+
|
|
3
|
+
> 常见问题速查:文本传不进去、结果不像预期、文件报错时先看这里。
|
|
4
|
+
|
|
5
|
+
## 1. 怎么把文本传进去?
|
|
6
|
+
三种方式任选:`-f 文件.txt`(读 UTF-8 文件)、`--stdin`(管道输入)、直接传文本参数(`yotta-humanize score "这段文字"`)。注意顺序:`score / analyze / report / suggest / rewrite` 子命令 + 输入方式。
|
|
7
|
+
|
|
8
|
+
## 2. 报「不是 UTF-8 编码」?
|
|
9
|
+
把文件另存为 UTF-8 编码再试(记事本 → 另存为 → 编码选 UTF-8)。Windows 的 GBK/ANSI 文件需先转码。
|
|
10
|
+
|
|
11
|
+
## 3. 文件太大 / 长文处理?
|
|
12
|
+
建议分段处理:每段单独 `rewrite` 或 `suggest`,再拼接。复杂长文中的嵌套问题可能需要人工复核,元真只做确定性规则改写,不保证处理所有嵌套句式。
|
|
13
|
+
|
|
14
|
+
## 4. 改写后变化不大?
|
|
15
|
+
说明原文 AI 味本身不高(`score` 低)。先跑 `score` 看评分,再 `analyze` 看命中的规则;确需润色时用 `suggest` 获取人工润色建议,或 `rewrite` 做机械改写。
|
|
16
|
+
|
|
17
|
+
## 5. rewrite 和 suggest 有什么区别?
|
|
18
|
+
`rewrite`:确定性机械改写(命中规则就替换/删除),输出改写后全文 + 修复清单 + 前后评分。
|
|
19
|
+
`suggest`:按优先级给改写建议(不直接改原文),适合人工精修。
|
|
20
|
+
|
|
21
|
+
## 6. CI 拦截怎么用?
|
|
22
|
+
`yotta-humanize rewrite --gate --threshold 40`:改写后评分仍 >= 阈值时退出码 1,可在 CI 里拦截 AI 腔内容。`--gate` 需搭配 `score` 或 `rewrite`。
|
|
23
|
+
|
|
24
|
+
## 7. 退出码 0 / 1 / 4 什么意思?
|
|
25
|
+
0 = 成功;1 = `--gate` 命中(评分 >= 阈值,用于 CI 拦截);4 = 输入错误(文件不存在、无输入等)。
|
|
26
|
+
|
|
27
|
+
## 8. 会不会改坏原文?
|
|
28
|
+
`rewrite` 只做确定性替换/删除(规则命中才动),输出带修复清单(改了什么、改了几处)和 before/after 评分,可逐条核对。不改写事实、数据、专有名词。
|
|
29
|
+
|
|
30
|
+
## 9. 检测原理是什么?
|
|
31
|
+
24 类规则 + 词表(赋能、闭环、值得注意的是、综上所述、希望对你有所帮助 等 AI 常用词与句式)+ 统计突发性,全部确定性规则,不依赖任何模型,结果可复现。
|
|
32
|
+
|
|
33
|
+
## 10. 边界
|
|
34
|
+
只处理文本,不生成新内容;不改写事实 / 数据 / 专有名词;不破坏作者原意。AI 腔极重或嵌套复杂的文本,建议配合人工润色。
|
|
@@ -47,7 +47,7 @@ _HERE = Path(__file__).resolve().parent
|
|
|
47
47
|
sys.path.insert(0, str(_HERE))
|
|
48
48
|
import humanize_rules as HR # noqa: E402
|
|
49
49
|
|
|
50
|
-
VERSION = "0.1.
|
|
50
|
+
VERSION = "0.1.3"
|
|
51
51
|
TOOL_NAME = "yotta-humanize"
|
|
52
52
|
TOOL_CN = "元真"
|
|
53
53
|
DEFAULT_THRESHOLD = 45
|
|
@@ -515,8 +515,13 @@ def _read_text(args):
|
|
|
515
515
|
if getattr(args, "file", None):
|
|
516
516
|
p = Path(args.file)
|
|
517
517
|
if not p.exists():
|
|
518
|
-
raise SystemExit("文件不存在:%s" % p)
|
|
519
|
-
|
|
518
|
+
raise SystemExit("文件不存在:%s\n修复建议:请检查文件路径是否正确、文件名是否拼错。" % p)
|
|
519
|
+
try:
|
|
520
|
+
return p.read_text(encoding="utf-8")
|
|
521
|
+
except UnicodeDecodeError:
|
|
522
|
+
raise SystemExit("无法读取文件:%s 不是 UTF-8 编码\n修复建议:请把文件另存为 UTF-8 编码后重试(记事本 → 另存为 → 编码选 UTF-8)。" % p)
|
|
523
|
+
except OSError as e:
|
|
524
|
+
raise SystemExit("无法读取文件:%s(%s)\n修复建议:请检查文件是否存在、是否有读取权限。" % (p, e))
|
|
520
525
|
if getattr(args, "stdin", False):
|
|
521
526
|
return _read_stdin()
|
|
522
527
|
if getattr(args, "text", None):
|
|
@@ -621,7 +626,7 @@ def main(argv=None):
|
|
|
621
626
|
print(res["text"])
|
|
622
627
|
return 0
|
|
623
628
|
except Exception as e: # noqa: BLE001
|
|
624
|
-
print("错误:%s" % e, file=sys.stderr)
|
|
629
|
+
print("错误:%s\n修复建议:请检查输入是否为 UTF-8 编码、文件是否存在;若仍报错,请把上面的错误信息反馈给开发者。" % e, file=sys.stderr)
|
|
625
630
|
return 4
|
|
626
631
|
return 4
|
|
627
632
|
|