dsh-sweeper 1.5.10 → 1.5.11

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
@@ -273,6 +273,7 @@ node test/browser/check.mjs # 需要本机有 Chrome/Edge,或 CHROME=<p
273
273
 
274
274
  ## 边界与自保
275
275
 
276
+ - **工具的遍历上限会说出来**:模型自己找文件时走到 400 个条目上限会收到一句「只看了前 400 个」,不会把「没扫完」当成「没有」。
276
277
  - **看不到的路径会被点名**:权限不足或文件被占用的路径不能判断,会写成「另有 N 个路径读不到」,不会悄悄少列。
277
278
  - **没列出来的对话会说明**:每轮最多分析 24 段,超出的段数会写成「另有 N 段没有列出」,而不是装作全都看过。
278
279
  - **读不下去的日志会被点名**:会话日志读到一半失败时会计入「N 段日志读不出来」,而不是悄悄从计划里消失。
package/lib/fs-tools.js CHANGED
@@ -143,13 +143,15 @@ export function makeFsTools(opts) {
143
143
  }
144
144
  const found = []
145
145
  let walked = 0
146
+ let capped = false
146
147
  const walk = (dir, level) => {
147
- if (level > depth || walked > MAX_WALK) return
148
+ if (level > depth) return
149
+ if (walked > MAX_WALK) { capped = true; return }
148
150
  let names
149
151
  try { names = fs.readdirSync(dir) } catch { return }
150
152
  for (const name of names) {
151
153
  walked += 1
152
- if (walked > MAX_WALK) return
154
+ if (walked > MAX_WALK) { capped = true; return }
153
155
  const full = path.join(dir, name)
154
156
  let st
155
157
  try { st = fs.lstatSync(full) } catch { continue }
@@ -168,9 +170,17 @@ export function makeFsTools(opts) {
168
170
  walk(ok.real, 1)
169
171
  found.sort((a, b) => b.size - a.size)
170
172
  const shown = found.slice(0, limit)
171
- if (shown.length === 0) return ok.real + '\nno file matched'
173
+ // A cap that is not announced reads as "this is the whole tree". Say it out loud:
174
+ // a model that believes it has seen everything will stop looking.
175
+ const cappedNote = capped
176
+ ? '\n… walked only the first ' + MAX_WALK + ' entries (cap); narrow the path or lower depth to see the rest'
177
+ : ''
178
+ if (shown.length === 0) {
179
+ return ok.real + '\n' + (capped ? 'capped before any match' : 'no file matched') + cappedNote
180
+ }
172
181
  return ok.real + '\n' + shown.map((row) => human(row.size).padStart(9) + ' ' + day(row.mtime) + ' ' + row.full).join('\n')
173
182
  + (found.length > shown.length ? '\n… ' + (found.length - shown.length) + ' more matches not shown' : '')
183
+ + cappedNote
174
184
  },
175
185
  }
176
186
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-sweeper",
3
- "version": "1.5.10",
3
+ "version": "1.5.11",
4
4
  "type": "module",
5
5
  "description": "清理对话留下的临时文件与垃圾,释放磁盘空间;只报告,清理进回收站可恢复 (cleanup junk files conversations leave on disk, free up space)",
6
6
  "keywords": [