@mison/wecom-cleaner 1.0.0 → 1.2.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 CHANGED
@@ -23,6 +23,7 @@
23
23
  - [功能总览](#功能总览)
24
24
  - [能力边界](#能力边界)
25
25
  - [安装与运行](#安装与运行)
26
+ - [Agent Skills 安装](#agent-skills-安装)
26
27
  - [常用参数](#常用参数)
27
28
  - [数据与审计文件](#数据与审计文件)
28
29
  - [开发与质量门禁](#开发与质量门禁)
@@ -63,8 +64,8 @@
63
64
  2. 文件存储目录识别
64
65
 
65
66
  - 支持默认路径、手动配置路径、自动探测路径。
66
- - 自动探测采用结构匹配(如 `*/WXWork Files/Caches`),不依赖目录名。
67
- - 自动探测结果默认不预选,需用户确认后纳入处理。
67
+ - 自动探测采用“结构 + 缓存特征”联合识别(如 `*/WXWork Files/Caches` + 企业微信缓存类别/月目录信号),不依赖目录名且降低误判。
68
+ - 自动探测结果默认预选,执行前可手动取消;同时保留确认提示,避免误纳入无关目录。
68
69
 
69
70
  3. 删除与恢复链路
70
71
 
@@ -86,9 +87,9 @@
86
87
 
87
88
  6. 可观测性与并发安全
88
89
 
89
- - `doctor` 模式可输出人类可读报告,或通过 `--json` 输出结构化结果。
90
+ - `doctor` 模式可输出人类可读报告,或通过 `--output json` 输出结构化结果。
90
91
  - `doctor` 模式为只读体检:不会自动创建状态目录/回收区,也不会触发 Zig 自动修复下载。
91
- - 多实例并发默认加锁,检测到陈旧锁可交互清理或通过 `--force` 自动清理。
92
+ - 多实例并发默认加锁;检测到陈旧锁会优先自动恢复,异常场景可用 `--force` 兜底清理。
92
93
 
93
94
  ## 能力边界
94
95
 
@@ -128,32 +129,189 @@ npm run e2e:smoke
128
129
  - 覆盖开始菜单与关键分支:年月清理、会话分析、全量治理、回收区治理、恢复、系统自检、设置。
129
130
  - 可用 `npm run e2e:smoke -- --keep` 保留日志与测试目录。
130
131
 
132
+ ## Agent Skills 安装
133
+
134
+ 内置技能:`wecom-cleaner-agent`(用于 Codex/Agent 无交互调用)。
135
+
136
+ 推荐方式(npmjs,最稳定):
137
+
138
+ ```bash
139
+ npx --yes --package=@mison/wecom-cleaner wecom-cleaner-skill install
140
+ ```
141
+
142
+ 常用参数:
143
+
144
+ - `--target <dir>`:自定义安装目录(默认 `$CODEX_HOME/skills` 或 `~/.codex/skills`)
145
+ - `--force`:覆盖已存在技能目录
146
+ - `--dry-run`:仅预演,不落盘
147
+
148
+ 示例:
149
+
150
+ ```bash
151
+ npx --yes --package=@mison/wecom-cleaner wecom-cleaner-skill install --force
152
+ npx --yes --package=@mison/wecom-cleaner wecom-cleaner-skill install --target ~/.codex/skills
153
+ ```
154
+
155
+ GitHub 备选方式(无 npm 包依赖):
156
+
157
+ ```bash
158
+ curl -fsSL https://raw.githubusercontent.com/MisonL/wecom-cleaner/main/scripts/install-skill.sh | bash
159
+ ```
160
+
161
+ 若需安装指定版本标签(例如 `v1.1.0`):
162
+
163
+ ```bash
164
+ curl -fsSL https://raw.githubusercontent.com/MisonL/wecom-cleaner/main/scripts/install-skill.sh | bash -s -- --ref v1.1.0
165
+ ```
166
+
167
+ Agent 侧统一任务入口脚本(位于 `skills/wecom-cleaner-agent/scripts/`):
168
+
169
+ - `cleanup_monthly_report.sh`:年月清理任务卡片(预演/执行/复核)
170
+ - `analysis_report.sh`:会话分析(只读)任务卡片
171
+ - `space_governance_report.sh`:全量空间治理任务卡片
172
+ - `restore_batch_report.sh`:批次恢复任务卡片
173
+ - `recycle_maintain_report.sh`:回收区治理任务卡片
174
+ - `doctor_report.sh`:系统自检任务卡片
175
+
131
176
  ## 常用参数
132
177
 
178
+ 运行方式:
179
+
180
+ - 不带参数:进入交互菜单(TUI)。
181
+ - 带参数:进入无交互执行(默认输出 JSON,适合 AI Agent)。
182
+ - 带参数但需交互:可追加 `--interactive` 强制进入交互流程(支持配合 `--mode` 直达功能)。
183
+ - 完整契约文档:[`docs/NON_INTERACTIVE_SPEC.md`](./docs/NON_INTERACTIVE_SPEC.md)。
184
+
185
+ ### 无交互动作参数(互斥,必须且只能一个)
186
+
187
+ - `--cleanup-monthly`
188
+ - `--analysis-only`
189
+ - `--space-governance`
190
+ - `--restore-batch <batchId>`
191
+ - `--recycle-maintain`
192
+ - `--doctor`
193
+
194
+ ### 无交互安全规则
195
+
196
+ - 破坏性动作(清理/治理/恢复/回收区治理)默认 `dry-run`。
197
+ - 显式真实执行需带 `--yes`。
198
+ - 若传 `--dry-run false` 但未传 `--yes`,将直接退出(退出码 `3`)。
199
+
200
+ ### 常用无交互示例
201
+
133
202
  ```bash
134
- wecom-cleaner --root ~/Library/Containers/com.tencent.WeWorkMac/Data/Documents/Profiles
135
- wecom-cleaner --state-root ~/.wecom-cleaner-state
136
- wecom-cleaner --external-storage-root /Volumes/Data/MyWeComStorage
137
- wecom-cleaner --external-storage-auto-detect false
138
- wecom-cleaner --dry-run-default true
139
- wecom-cleaner --mode cleanup_monthly
140
- wecom-cleaner --mode space_governance
141
- wecom-cleaner --mode recycle_maintain
142
- wecom-cleaner --mode doctor
143
- wecom-cleaner --theme auto
144
- wecom-cleaner --json
145
- wecom-cleaner --force
203
+ # 年月清理(默认 dry-run)
204
+ wecom-cleaner --cleanup-monthly \
205
+ --accounts current \
206
+ --cutoff-month 2024-02 \
207
+ --categories files,images
208
+
209
+ # 年月清理(真实执行)
210
+ wecom-cleaner --cleanup-monthly \
211
+ --accounts all \
212
+ --months 2023-01,2023-02 \
213
+ --categories files \
214
+ --dry-run false \
215
+ --yes
216
+
217
+ # 全量空间治理(仅建议项,真实执行)
218
+ wecom-cleaner --space-governance \
219
+ --suggested-only true \
220
+ --tiers safe,caution \
221
+ --dry-run false \
222
+ --yes
223
+
224
+ # 回收区治理(按策略执行)
225
+ wecom-cleaner --recycle-maintain --dry-run false --yes
226
+
227
+ # 批次恢复(冲突策略:重命名)
228
+ wecom-cleaner --restore-batch 20260226-105009-ffa098 --conflict rename
229
+
230
+ # 系统自检(默认 JSON 输出)
231
+ wecom-cleaner --doctor
146
232
  ```
147
233
 
148
- ### `--mode` 可选值
234
+ ### 输出与兼容参数
235
+
236
+ - `--output json|text`:无交互输出格式,默认 `json`。
237
+ - `--json`:兼容别名,等价于 `--output json`。
238
+ - `--mode`:兼容参数,建议迁移到动作参数(如 `--cleanup-monthly`)。
239
+ - `--save-config`:将本次全局配置参数写回 `config.json`。
240
+ - `--help` / `-h`:输出命令帮助并退出。
241
+ - `--version` / `-v`:输出版本号并退出。
242
+
243
+ ### 各动作关键统计字段(JSON)
244
+
245
+ #### `cleanup-monthly`
246
+
247
+ - `summary.matchedTargets`:命中目标数
248
+ - `summary.matchedBytes`:命中目标总字节
249
+ - `summary.hasWork` / `summary.noTarget`:是否存在可执行目标
250
+ - `summary.successCount` / `skippedCount` / `failedCount`
251
+ - `summary.reclaimedBytes`:预计或实际释放字节
252
+ - `summary.batchId`:真实执行批次号(dry-run 为预演批次)
253
+ - `summary.matchedMonthStart` / `matchedMonthEnd`:本次命中的月份区间
254
+ - `summary.rootPathCount`:涉及的清理根目录数量
255
+ - `summary.accountCount` / `monthCount` / `categoryCount` / `externalRootCount`
256
+ - `summary.cutoffMonth`:截止月份(当使用 `--cutoff-month` 时)
257
+
258
+ `cleanup-monthly` 还会在 `data.report` 中返回可展示明细:
259
+
260
+ - `data.report.matched.categoryStats`:按类别统计(条目数、体积)
261
+ - `data.report.matched.monthStats`:按月份统计(条目数、体积)
262
+ - `data.report.matched.rootStats`:按根目录统计(条目数、体积)
263
+ - `data.report.matched.topPaths`:按体积 Top 路径样例
264
+ - `data.report.executed.byCategory/byMonth/byRoot`:真实执行落地统计(成功/跳过/失败 + 体积)
265
+
266
+ #### `analysis-only`
149
267
 
150
- - `cleanup_monthly`
151
- - `analysis_only`
152
- - `space_governance`
153
- - `recycle_maintain`
154
- - `restore`
155
- - `doctor`
156
- - `settings`
268
+ - `summary.targetCount` / `totalBytes`:命中目录数与总体积
269
+ - `summary.accountCount` / `matchedAccountCount` / `categoryCount` / `monthBucketCount`:维度汇总(范围账号数 vs 实际命中账号数)
270
+ - `data.accountsSummary` / `categoriesSummary` / `monthsSummary`:分布统计
271
+ - `data.report.matched`:统一的类别/月份/根目录/路径样例统计结构
272
+
273
+ #### `space-governance`
274
+
275
+ - `summary.matchedTargets` / `matchedBytes`
276
+ - `summary.successCount` / `skippedCount` / `failedCount` / `reclaimedBytes`
277
+ - `summary.tierCount` / `targetTypeCount` / `rootPathCount`
278
+ - `data.report.matched.byTier/byTargetType/byAccount/byRoot/topPaths`
279
+ - `data.report.executed.byCategory/byMonth/byRoot/topPaths`(真实执行时)
280
+
281
+ #### `restore-batch`
282
+
283
+ - `summary.batchId` / `entryCount` / `matchedBytes`
284
+ - `summary.successCount` / `skippedCount` / `failedCount` / `restoredBytes`
285
+ - `summary.scopeCount` / `categoryCount` / `rootPathCount`
286
+ - `data.report.matched.byScope/byCategory/byMonth/byRoot/topEntries`
287
+ - `data.report.executed.byScope/byCategory/byMonth/byRoot/topEntries`(真实执行时)
288
+
289
+ #### `recycle-maintain`
290
+
291
+ - `summary.candidateCount` / `selectedByAge` / `selectedBySize`
292
+ - `summary.deletedBatches` / `deletedBytes` / `failedBatches`
293
+ - `summary.remainingBatches` / `remainingBytes`
294
+ - `data.report.before` / `after` / `thresholdBytes` / `overThreshold`
295
+ - `data.report.selectedCandidates` / `operations`
296
+
297
+ #### `doctor`
298
+
299
+ - `summary.overall` / `pass` / `warn` / `fail`
300
+ - `data.checks`:逐项体检结论(pass/warn/fail)
301
+ - `data.metrics`:账号数、回收区占用、外部存储等关键指标
302
+ - `data.runtime`:运行时环境信息
303
+
304
+ ### 全局参数
305
+
306
+ - `--root <path>`:Profile 根目录
307
+ - `--state-root <path>`:状态目录
308
+ - `--external-storage-root <path[,path...]>`:手动文件存储目录(配置层)
309
+ - `--external-storage-auto-detect <true|false>`:外部存储自动探测总开关
310
+ - `--external-roots <path[,path...]>`:本次动作临时覆盖的文件存储目录
311
+ - `--external-roots-source <preset|configured|auto|all>`:按来源筛选探测目录(默认 `all`,优先减少漏扫;可按需收窄)
312
+ - `--theme <auto|light|dark>`:Logo 主题
313
+ - `--interactive`:即使携带参数也进入交互流程(可配合 `--mode`)
314
+ - `--force`:锁异常场景下强制清理并继续(兜底参数,通常无需)
157
315
 
158
316
  ### `--theme` 可选值
159
317
 
@@ -233,10 +391,10 @@ npm run e2e:smoke -- --keep
233
391
  npm run pack:tgz:dry-run
234
392
  ```
235
393
 
236
- 当前基线(`v1.0.0`):
394
+ 当前基线(主分支):
237
395
 
238
- - 单元测试:`47/47` 通过。
239
- - 覆盖率:`statements 85.65%`,`branches 70.99%`,`functions 91.39%`,`lines 85.65%`。
396
+ - 单元测试:`78/78` 通过。
397
+ - 覆盖率:`statements 88.28%`,`branches 74.44%`,`functions 94.89%`,`lines 88.28%`。
240
398
  - 全菜单 smoke:通过(含恢复冲突分支与 doctor JSON 分支)。
241
399
 
242
400
  ## 发布与打包
@@ -251,6 +409,8 @@ npm run pack:tgz:dry-run
251
409
  - `native/bin/darwin-x64/wecom-cleaner-core`
252
410
  - `native/bin/darwin-arm64/wecom-cleaner-core`
253
411
 
412
+ 说明:`native/bin/` 为构建产物目录,不纳入 Git 版本管理。
413
+
254
414
  本地交付包(无作用域前缀)建议:
255
415
 
256
416
  ```bash
@@ -268,17 +428,21 @@ npm run test:coverage:check
268
428
  npm run format:check
269
429
  npm run e2e:smoke
270
430
  npm run pack:tgz
431
+ npm run pack:release-assets
271
432
 
272
433
  # 2) 推送主分支与标签
273
434
  git push origin main
274
- git tag v1.0.0
275
- git push origin v1.0.0
276
-
277
- # 3) 发布 GitHub Release(附 tgz 包)
278
- gh release create v1.0.0 \
279
- --title "v1.0.0" \
280
- --notes-file docs/releases/v1.0.0.md \
281
- wecom-cleaner-1.0.0.tgz
435
+ git tag v1.2.0
436
+ git push origin v1.2.0
437
+
438
+ # 3) 发布 GitHub Release(附 npm 包 + 双架构核心附件)
439
+ gh release create v1.2.0 \
440
+ --title "v1.2.0" \
441
+ --notes-file docs/releases/v1.2.0.md \
442
+ wecom-cleaner-1.2.0.tgz \
443
+ dist/release/wecom-cleaner-core-v1.2.0-darwin-x64 \
444
+ dist/release/wecom-cleaner-core-v1.2.0-darwin-arm64 \
445
+ dist/release/wecom-cleaner-core-v1.2.0-SHA256SUMS.txt
282
446
 
283
447
  # 4) 发布 npm
284
448
  npm publish --access public
@@ -122,7 +122,7 @@
122
122
  - 使用 `c8` 输出覆盖率报告。
123
123
  - 门禁阈值:`lines/statements >= 75%`,`functions >= 80%`,`branches >= 60%`。
124
124
  - 命令:`npm run test:coverage` / `npm run test:coverage:check`。
125
- - `v1.0.0` 基线:`statements 85.65%`,`branches 70.99%`,`functions 91.39%`,`lines 85.65%`。
125
+ - `v1.1.0` 基线:`statements 86.57%`,`branches 73.96%`,`functions 93.25%`,`lines 86.57%`。
126
126
 
127
127
  4. 端到端回归
128
128
 
@@ -138,21 +138,21 @@ npm run e2e:smoke -- --keep
138
138
  npm run pack:tgz:dry-run
139
139
  ```
140
140
 
141
- ## 7. 发布执行(首个正式版)
141
+ ## 7. 发布执行(当前版本)
142
142
 
143
143
  1. 版本与产物
144
144
 
145
- - `package.json` / `package-lock.json`:`1.0.0`
146
- - `native/manifest.json`:版本与 `baseUrl` 对齐 `v1.0.0`
145
+ - `package.json` / `package-lock.json`:`1.1.0`
146
+ - `native/manifest.json`:版本与 `baseUrl` 对齐 `v1.1.0`
147
147
  - 默认打包双架构核心:`darwin-x64` + `darwin-arm64`
148
148
 
149
149
  2. GitHub Release
150
150
 
151
151
  ```bash
152
152
  git push origin main
153
- git tag v1.0.0
154
- git push origin v1.0.0
155
- gh release create v1.0.0 --title "v1.0.0" --notes-file docs/releases/v1.0.0.md wecom-cleaner-1.0.0.tgz
153
+ git tag v1.1.0
154
+ git push origin v1.1.0
155
+ gh release create v1.1.0 --title "v1.1.0" --notes-file docs/releases/v1.1.0.md wecom-cleaner-1.1.0.tgz
156
156
  ```
157
157
 
158
158
  3. npm 发布
@@ -0,0 +1,239 @@
1
+ # 无交互参数规范(AI Agent)
2
+
3
+ 本文档定义 `wecom-cleaner` 的无交互 CLI 契约,供 AI Agent/脚本稳定调用。
4
+
5
+ ## 1. 运行入口
6
+
7
+ - `wecom-cleaner`(不带参数):进入交互模式(TUI)。
8
+ - `wecom-cleaner ...args`(带参数):进入无交互模式。
9
+ - `wecom-cleaner ...args --interactive`:即使带参数也强制进入交互模式(常用于本地调试/脚本回放)。
10
+ - `wecom-cleaner --help` / `wecom-cleaner -h`:输出命令帮助并退出(`0`)。
11
+ - `wecom-cleaner --version` / `wecom-cleaner -v`:输出版本号并退出(`0`)。
12
+
13
+ ## 2. 动作选择(必填且互斥)
14
+
15
+ 无交互模式必须且只能提供一个动作参数:
16
+
17
+ - `--cleanup-monthly`
18
+ - `--analysis-only`
19
+ - `--space-governance`
20
+ - `--restore-batch <batchId>`
21
+ - `--recycle-maintain`
22
+ - `--doctor`
23
+
24
+ 若缺少动作或动作冲突,退出码为 `2`。
25
+
26
+ ## 3. 安全确认与 dry-run
27
+
28
+ 破坏性动作:`cleanup-monthly`、`space-governance`、`restore-batch`、`recycle-maintain`。
29
+
30
+ 规则:
31
+
32
+ - 默认 `dry-run`(不执行真实删除/恢复)。
33
+ - 真实执行需显式传 `--yes`。
34
+ - 若传 `--dry-run false` 且未传 `--yes`,退出码为 `3`。
35
+
36
+ ## 4. 输出协议
37
+
38
+ 无交互默认输出 JSON,可通过 `--output text` 切换文本任务卡片(中文结论 + 范围 + 统计 + 风险提示)。
39
+
40
+ - `--output json|text`(默认 `json`)
41
+ - `--json` 为兼容别名(等价 `--output json`)
42
+
43
+ JSON 顶层字段:
44
+
45
+ - `ok`:布尔
46
+ - `action`:动作名
47
+ - `dryRun`:布尔或 `null`
48
+ - `summary`:动作摘要
49
+ - `warnings`:字符串数组
50
+ - `errors`:错误数组(`code`、`message`、可选路径字段)
51
+ - `data`:动作明细数据
52
+ - `meta`:元信息(版本、耗时、引擎、时间戳等)
53
+
54
+ `cleanup_monthly` 常见 `summary` 字段:
55
+
56
+ - `batchId`
57
+ - `hasWork`
58
+ - `noTarget`
59
+ - `matchedTargets`
60
+ - `matchedBytes`
61
+ - `successCount`
62
+ - `skippedCount`
63
+ - `failedCount`
64
+ - `reclaimedBytes`
65
+ - `accountCount`
66
+ - `monthCount`
67
+ - `categoryCount`
68
+ - `externalRootCount`
69
+ - `cutoffMonth`
70
+ - `matchedMonthStart`
71
+ - `matchedMonthEnd`
72
+ - `rootPathCount`
73
+
74
+ `cleanup_monthly` 的 `data.report`:
75
+
76
+ - `matched`:
77
+ - `totalTargets` / `totalBytes`
78
+ - `monthRange` / `matchedMonths`
79
+ - `categoryStats` / `monthStats` / `accountStats` / `rootStats`
80
+ - `topPaths`(按体积排序)
81
+ - `executed`:
82
+ - `byStatus`
83
+ - `byCategory` / `byMonth` / `byRoot`
84
+ - `topPaths`(按体积排序)
85
+
86
+ `analysis_only` 常见 `summary` 字段:
87
+
88
+ - `targetCount`
89
+ - `totalBytes`
90
+ - `accountCount`
91
+ - `matchedAccountCount`
92
+ - `categoryCount`
93
+ - `monthBucketCount`
94
+
95
+ `analysis_only` 的 `data.report`:
96
+
97
+ - `matched`:
98
+ - `totalTargets` / `totalBytes`
99
+ - `monthRange` / `matchedMonths`
100
+ - `categoryStats` / `monthStats` / `accountStats` / `rootStats`
101
+ - `topPaths`
102
+
103
+ `space_governance` 常见 `summary` 字段:
104
+
105
+ - `matchedTargets` / `matchedBytes`
106
+ - `successCount` / `skippedCount` / `failedCount` / `reclaimedBytes`
107
+ - `tierCount` / `targetTypeCount` / `rootPathCount`
108
+ - `allowRecentActive`
109
+
110
+ `space_governance` 的 `data.report`:
111
+
112
+ - `matched`:
113
+ - `totalTargets` / `totalBytes`
114
+ - `byTier` / `byTargetType` / `byAccount` / `byRoot`
115
+ - `topPaths`
116
+ - `executed`:
117
+ - `byStatus`
118
+ - `byCategory` / `byMonth` / `byRoot`
119
+ - `topPaths`
120
+
121
+ `restore` 常见 `summary` 字段:
122
+
123
+ - `batchId`
124
+ - `successCount` / `skippedCount` / `failedCount`
125
+ - `restoredBytes`
126
+ - `conflictStrategy`
127
+ - `entryCount` / `matchedBytes`
128
+ - `scopeCount` / `categoryCount` / `rootPathCount`
129
+
130
+ `restore` 的 `data.report`:
131
+
132
+ - `matched`:
133
+ - `totalEntries` / `totalBytes`
134
+ - `byScope` / `byCategory` / `byMonth` / `byRoot`
135
+ - `topEntries`
136
+ - `executed`:
137
+ - `byStatus`
138
+ - `byScope` / `byCategory` / `byMonth` / `byRoot`
139
+ - `topEntries`
140
+
141
+ `recycle_maintain` 常见 `summary` 字段:
142
+
143
+ - `status`
144
+ - `candidateCount`
145
+ - `selectedByAge` / `selectedBySize`
146
+ - `deletedBatches` / `deletedBytes` / `failedBatches`
147
+ - `remainingBatches` / `remainingBytes`
148
+
149
+ `recycle_maintain` 的 `data.report`:
150
+
151
+ - `before` / `after`
152
+ - `thresholdBytes` / `overThreshold`
153
+ - `selectedCandidates`
154
+ - `operations`
155
+
156
+ `doctor` 常见 `summary` 字段:
157
+
158
+ - `overall`
159
+ - `pass` / `warn` / `fail`
160
+
161
+ `doctor` 的 `data`:
162
+
163
+ - `checks`:体检项列表(pass/warn/fail)
164
+ - `metrics`:关键计数与容量
165
+ - `runtime`:平台与运行时信息
166
+
167
+ ## 5. 退出码
168
+
169
+ - `0`:执行成功(含 dry-run 成功)
170
+ - `1`:执行失败(业务失败/运行失败)
171
+ - `2`:参数错误或动作契约错误
172
+ - `3`:缺少真实执行确认(`--yes`)
173
+
174
+ ## 6. 全局参数
175
+
176
+ - `--root <path>`:Profile 根目录
177
+ - `--state-root <path>`:状态目录
178
+ - `--external-storage-root <path[,path...]>`:配置层手动文件存储目录
179
+ - `--external-storage-auto-detect <true|false>`:自动探测开关
180
+ - `--external-roots <path[,path...]>`:动作层临时覆盖文件存储目录
181
+ - `--external-roots-source <preset|configured|auto|all>`:按来源筛选探测目录(默认 `all`)
182
+ - `--theme <auto|light|dark>`
183
+ - `--interactive`:强制交互模式(与无交互动作参数互斥使用时,优先按交互模式执行)
184
+ - `--force`:锁异常场景下强制清理并继续(兜底参数)
185
+ - `--save-config`:把本次全局参数落盘到 `config.json`
186
+
187
+ ## 7. 动作参数
188
+
189
+ ### 7.1 `--cleanup-monthly`
190
+
191
+ - `--accounts <all|current|id1,id2...>`
192
+ - `--months <YYYY-MM,...>` 或 `--cutoff-month <YYYY-MM>`(二选一)
193
+ - `--categories <all|key1,key2...>`
194
+ - `--include-non-month-dirs <true|false>`
195
+ - `--dry-run <true|false>`
196
+
197
+ ### 7.2 `--analysis-only`
198
+
199
+ - `--accounts <all|current|id1,id2...>`
200
+ - `--categories <all|key1,key2...>`
201
+
202
+ 说明:
203
+
204
+ - `analysis-only` 默认按 `external-roots-source=all` 读取外部目录来源(只读动作,避免漏扫)。
205
+
206
+ ### 7.3 `--space-governance`
207
+
208
+ - `--accounts <all|current|id1,id2...>`
209
+ - `--targets <targetId1,targetId2...>`
210
+ - `--tiers <safe|caution|protected>`
211
+ - `--suggested-only <true|false>`
212
+ - `--allow-recent-active <true|false>`
213
+ - `--dry-run <true|false>`
214
+
215
+ 说明:
216
+
217
+ - `cleanup-monthly` / `space-governance` 默认 `external-roots-source=all`,优先减少漏扫。
218
+ - 若需更保守范围,可显式设置 `--external-roots-source preset`(仅默认+手动配置来源)。
219
+
220
+ ### 7.4 `--restore-batch <batchId>`
221
+
222
+ - `--conflict <skip|overwrite|rename>`(默认 `skip`)
223
+ - `--dry-run <true|false>`
224
+
225
+ ### 7.5 `--recycle-maintain`
226
+
227
+ - `--retention-enabled <true|false>`
228
+ - `--retention-max-age-days <int>`
229
+ - `--retention-min-keep-batches <int>`
230
+ - `--retention-size-threshold-gb <int>`
231
+ - `--dry-run <true|false>`
232
+
233
+ ### 7.6 `--doctor`
234
+
235
+ - 无动作专属参数;只读执行,返回健康报告。
236
+
237
+ ## 8. 兼容参数
238
+
239
+ - `--mode`:兼容旧调用,会映射到动作参数并附带 warning,建议迁移。
@@ -0,0 +1,36 @@
1
+ # wecom-cleaner v1.1.0
2
+
3
+ 本版本重点是:Agent 可安装技能能力正式内置、无交互调用链路更稳定、发布与验证流程完整收口。
4
+
5
+ ## 新增能力
6
+
7
+ - 内置 Agent 技能:`skills/wecom-cleaner-agent`
8
+ - 包含 `SKILL.md`、`agents/openai.yaml`、`references/commands.md`
9
+ - 新增技能安装命令:`wecom-cleaner-skill install`
10
+ - 支持 `--target`、`--force`、`--dry-run`
11
+ - 新增 GitHub 一键安装脚本:`scripts/install-skill.sh`
12
+
13
+ ## 关键改进
14
+
15
+ - 无交互协议正式化并文档化:`docs/NON_INTERACTIVE_SPEC.md`
16
+ - 启动行为统一:无参数进交互、带参数走无交互
17
+ - 无交互默认 JSON 输出,兼容 `--json`,并提示 `--mode` 迁移
18
+ - Zig 核心版本统一到 `1.1.0`,manifest 与下载基地址同步到 `v1.1.0`
19
+
20
+ ## 修复与安全
21
+
22
+ - 修复恢复 `dry-run + overwrite` 分支潜在实删问题
23
+ - 修复回收区治理异常批次路径可能越界的问题
24
+ - `scripts/install-skill.sh` 兼容 `--target` 指向不存在父目录
25
+ - 强化路径白名单 + `realpath` 边界防护与审计落盘
26
+
27
+ ## 质量与验证
28
+
29
+ - 单元测试:`68/68` 通过
30
+ - 覆盖率:`statements 86.57%`,`branches 73.96%`,`functions 93.25%`,`lines 86.57%`
31
+ - 全菜单 smoke:通过(含恢复冲突分支、doctor JSON、设置菜单)
32
+
33
+ ## 兼容性
34
+
35
+ - 当前正式支持:macOS(x64 / arm64)
36
+ - Windows 兼容仍在后续版本规划中
@@ -0,0 +1,33 @@
1
+ # v1.2.0 发布说明
2
+
3
+ 发布日期:2026-02-26
4
+
5
+ ## 亮点
6
+
7
+ - 无交互 `--output text` 升级为中文任务卡片:
8
+ - 任务结论
9
+ - 处理范围(账号/月份/类别/路径)
10
+ - 结果统计(命中、释放、成功/跳过/失败、批次)
11
+ - 分类与月份分布
12
+ - 风险与运行状态
13
+ - `wecom-cleaner-agent` 升级为“脚本优先”执行模式,新增 6 个报告脚本,面向 Agent 输出更可读。
14
+ - 发布流程支持 GitHub Release 独立双架构核心附件(macOS x64 / arm64)。
15
+
16
+ ## 重要变更
17
+
18
+ - 非交互 `cleanup-monthly` / `space-governance` 默认外部目录来源改为 `all`(减少漏扫)。
19
+ - 交互模式外部目录默认预选自动探测路径,执行前可取消。
20
+ - `native/bin/` 改为构建产物目录,不再纳入 Git 版本管理。
21
+
22
+ ## 修复
23
+
24
+ - 修复 Zig 核心对目录体积的误统计问题(此前可能导致容量明显偏小)。
25
+ - 增强清理/恢复/回收区治理结果的分布统计能力,便于用户复核。
26
+
27
+ ## 资产
28
+
29
+ - npm 包:`wecom-cleaner-1.2.0.tgz`
30
+ - GitHub Release 附件:
31
+ - `wecom-cleaner-core-v1.2.0-darwin-x64`
32
+ - `wecom-cleaner-core-v1.2.0-darwin-arm64`
33
+ - `wecom-cleaner-core-v1.2.0-SHA256SUMS.txt`
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "version": "1.0.0",
4
- "baseUrl": "https://raw.githubusercontent.com/MisonL/wecom-cleaner/v1.0.0/native/bin",
3
+ "version": "1.2.0",
5
4
  "targets": {
6
5
  "darwin-x64": {
7
6
  "binaryName": "wecom-cleaner-core",
8
- "sha256": "14cfa26895101e7b71824e6bb9282f08a38f9dad72d4df2934094eb2ceefbad0"
7
+ "sha256": "c703a8bdb6df39df776c6a3ab28b3553916d487cf7c38612989566b4ecea34c9",
8
+ "url": "https://github.com/MisonL/wecom-cleaner/releases/download/v1.2.0/wecom-cleaner-core-v1.2.0-darwin-x64"
9
9
  },
10
10
  "darwin-arm64": {
11
11
  "binaryName": "wecom-cleaner-core",
12
- "sha256": "fc33ce3fb44309170da8c2867d11eae552e2e9d3c95b8f0e5a8e8392bb630744"
12
+ "sha256": "8d0a15efcb70a266e15c752212f15570c006a931681249d6cd41a1c438941f72",
13
+ "url": "https://github.com/MisonL/wecom-cleaner/releases/download/v1.2.0/wecom-cleaner-core-v1.2.0-darwin-arm64"
13
14
  }
14
15
  }
15
16
  }