dsh-sweeper 1.5.15 → 1.5.16

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
@@ -278,6 +278,7 @@ node test/browser/check.mjs # 需要本机有 Chrome/Edge,或 CHROME=<p
278
278
  ## 边界与自保
279
279
 
280
280
  - **工具的遍历上限会说出来**:模型自己找文件时走到 400 个条目上限会收到一句「只看了前 400 个」,不会把「没扫完」当成「没有」。
281
+ - **缓存与构建目录也点名**:`node_modules`、`.pnpm-store`、`.gradle`、`.m2`、`.cargo`、`.turbo`、`.next`、`dist` 等 21 个目录不遍历,跳过了多少个会写在结果末尾(「N 个缓存或构建目录没有搜」),免得模型以为整棵树都看过了。
281
282
  - **不敢跟的链接、读不到的条目会被数出来**:`list_dir` / `find_files` 遇到符号链接(可能指向工作目录之外)和权限不足的条目时不再静默跳过,而是写「N 个链接未跟随」「N 个条目读不出来」;整目录读不进去时单独写「N 个目录读不出来」,不会把目录说成文件。
282
283
  - **有日志读不出来,就不给「无脑删」**:一份会话日志打不开时,它可能用过任何文件;这一轮所有原本能一键清理的条目都会降到「需要你判断」,并在理由里写明原因。
283
284
  - **看不到的路径会被点名**:权限不足或文件被占用的路径不能判断,会写成「另有 N 个路径读不到」,不会悄悄少列。
package/lib/fs-tools.js CHANGED
@@ -9,7 +9,15 @@ import fs from 'node:fs'
9
9
  import path from 'node:path'
10
10
  import { WIN, normKey, isInside, baseOf } from './paths.js'
11
11
 
12
- const SKIP = new Set(['node_modules', '.git', '.venv', 'venv', '__pycache__', '.next', 'dist', 'build', 'target'])
12
+ // Directories that are not worth walking: package-manager caches, build output,
13
+ // and tool state. A conversation did not produce them, and they are large enough
14
+ // to eat the whole walk budget.
15
+ const SKIP = new Set([
16
+ 'node_modules', '.git', '.venv', 'venv', '__pycache__',
17
+ '.next', 'dist', 'build', 'target', 'coverage', 'obj',
18
+ '.pnpm-store', '.yarn', '.gradle', '.m2', '.cargo',
19
+ '.turbo', '.parcel-cache', '.nuxt', '.cache', '.idea', '.vs',
20
+ ])
13
21
  const MAX_ENTRIES = 60
14
22
  const MAX_WALK = 400
15
23
 
@@ -159,6 +167,7 @@ export function makeFsTools(opts) {
159
167
  let links = 0
160
168
  let unreadable = 0
161
169
  let unreadableDirs = 0
170
+ let skippedDirs = 0
162
171
  const walk = (dir, level) => {
163
172
  if (level > depth) return
164
173
  if (walked > MAX_WALK) { capped = true; return }
@@ -172,7 +181,7 @@ export function makeFsTools(opts) {
172
181
  try { st = lstatOf(full) } catch { unreadable += 1; continue }
173
182
  if (st.isSymbolicLink()) { links += 1; continue }
174
183
  if (st.isDirectory()) {
175
- if (SKIP.has(name.toLowerCase())) continue
184
+ if (SKIP.has(name.toLowerCase())) { skippedDirs += 1; continue }
176
185
  walk(full, level + 1)
177
186
  continue
178
187
  }
@@ -193,6 +202,7 @@ export function makeFsTools(opts) {
193
202
  const skippedNote = [
194
203
  links ? '… ' + links + ' symbolic link' + (links === 1 ? '' : 's') + ' not followed' : '',
195
204
  unreadableDirs ? '… ' + unreadableDirs + ' director' + (unreadableDirs === 1 ? 'y' : 'ies') + ' could not be read' : '',
205
+ skippedDirs ? '… ' + skippedDirs + ' cache or build director' + (skippedDirs === 1 ? 'y was' : 'ies were') + ' not searched' : '',
196
206
  unreadable ? '… ' + unreadable + ' entr' + (unreadable === 1 ? 'y' : 'ies') + ' could not be read' : '',
197
207
  ].filter(Boolean).join('\n')
198
208
  const extra = cappedNote + (skippedNote ? '\n' + skippedNote : '')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-sweeper",
3
- "version": "1.5.15",
3
+ "version": "1.5.16",
4
4
  "type": "module",
5
5
  "description": "清理对话留下的临时文件与垃圾,释放磁盘空间;只报告,清理进回收站可恢复 (cleanup junk files conversations leave on disk, free up space)",
6
6
  "keywords": [