devclean-cache 0.0.0-stage → 0.5.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/CHANGELOG.md ADDED
@@ -0,0 +1,26 @@
1
+ # Changelog
2
+
3
+ ## 0.5.0
4
+
5
+ - Config file for ignores and custom caches: `devclean config` shows it, `DEVCLEAN_CONFIG`
6
+ overrides the location. Custom entries are validated and default to medium risk.
7
+
8
+ ## 0.4.0
9
+
10
+ - Seven new cache adapters: NuGet, conda, sbt/Ivy, Deno, Cypress, Electron, Composer (22 total).
11
+ - Tests now verify every adapter exposes absolute paths and that only the local model
12
+ runtimes are classified high risk.
13
+
14
+ ## 0.3.0
15
+
16
+ - `devclean clean -i` interactive picker: select what to delete with space/a/n/arrows.
17
+ - Non-TTY runs never skip the confirmation prompt.
18
+
19
+ ## 0.2.0
20
+
21
+ - `devclean report` writes a self-contained HTML report with a treemap of every cache.
22
+
23
+ ## 0.1.0
24
+
25
+ - First release: scan 15 cache families, clean low/medium risk caches, find project
26
+ artifacts (`node_modules`, `.venv`, `target`).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 shisilang684
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
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,186 @@
1
- # Temporary Holding Version
1
+ # devclean
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ English | [绠€浣撲腑鏂嘳(README.zh-CN.md)
4
+
5
+ [![ci](https://github.com/shisilang684/devclean/actions/workflows/ci.yml/badge.svg)](https://github.com/shisilang684/devclean/actions/workflows/ci.yml)
6
+
7
+ **Your dev machine is hoarding gigabytes. Find them, see them, reclaim them.**
8
+
9
+ `devclean` scans every cache your toolchain quietly accumulated - npm, pnpm, pip, Cargo, Gradle, Playwright browsers, Hugging Face models, local LLM weights - and shows you exactly what is safe to delete. One command, no config, no telemetry.
10
+
11
+ ![devclean scanning and reclaiming 1.4 GB of developer caches](https://raw.githubusercontent.com/shisilang684/devclean/main/docs/demo.png)
12
+
13
+ ```
14
+ $ npx devclean-cache
15
+
16
+ CACHE SIZE SHARE FILES RISK PATH
17
+ pnpm store 998 MB 鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻戔枒鈻戔枒 70% 20.7k low C:\Users\me\AppData\Local\pnpm\store
18
+ Maven repo 327 MB 鈻堚枅鈻堚枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒 23% 7.2k medium C:\Users\me\.m2\repository
19
+ npm cache 55.9 MB 鈻堚枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒 4% 106 low C:\Users\me\AppData\Local\npm-cache\_cacache
20
+ pip cache 44.0 MB 鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒 3% 50 low C:\Users\me\AppData\Local\pip\Cache
21
+
22
+ Total: 1.4 GB across 4 locations, 28.1k files (3.5s)
23
+ Reclaim 1.4 GB with devclean clean
24
+ ```
25
+
26
+ ## Why
27
+
28
+ Every package manager keeps a cache. Every AI tool downloads model weights. Every project grows a `node_modules`. Individually they look harmless; together they quietly eat 20-100 GB of your disk - and no single tool sees all of them.
29
+
30
+ Most cleaners either max out at `node_modules` or treat your downloaded LLM weights like disposable files. `devclean` knows the difference.
31
+
32
+ ## Quick start
33
+
34
+ ```bash
35
+ npx devclean-cache # scan known caches
36
+ npx devclean-cache clean # delete low + medium risk caches (asks first)
37
+ npx devclean-cache clean -i # pick caches interactively
38
+ npx devclean-cache projects . # find node_modules/.venv/target inside your projects
39
+ npx devclean-cache report # write a shareable HTML report
40
+ ```
41
+
42
+ Requires Node.js 20+. Works on Windows, macOS, and Linux. You can also install straight from
43
+ GitHub: `npm i -g github:shisilang684/devclean`.
44
+
45
+ ## What it scans
46
+
47
+ 22 cache families, each with an honest risk label.
48
+
49
+ | Cache | Risk | What it is |
50
+ | --- | --- | --- |
51
+ | npm, pnpm, Yarn, Bun | low | Package tarballs, re-downloaded on demand |
52
+ | pip, uv | low | Python wheels and HTTP cache |
53
+ | Cargo registry, Go build cache | low | Compiled and downloaded build inputs |
54
+ | Gradle, Maven | low / medium | Dependency caches |
55
+ | Playwright, Puppeteer | low | Browser binaries |
56
+ | NuGet, Composer, sbt / Ivy | medium / low | .NET, PHP and Scala dependency caches |
57
+ | conda | medium | Package archives shared with conda environments |
58
+ | Deno, Cypress, Electron | low | Runtime, browser and app binaries |
59
+ | Hugging Face | medium | Model and dataset downloads |
60
+ | Ollama, LM Studio | **high** | Local LLM weights - deleting forces a full re-pull |
61
+
62
+ `clean` skips high-risk caches unless you pass `--all`. Nothing is deleted without showing you the list and the total first.
63
+
64
+ ## How it compares
65
+
66
+ | | `devclean` | `npkill` | GUI disk cleaners | `du` + `rm -rf` |
67
+ | --- | --- | --- | --- | --- |
68
+ | Package caches (npm, pnpm, pip, Cargo, Gradle...) | all 22, one pass | `node_modules` only | generally not cache-aware | only the paths you already know |
69
+ | Local LLM weights (Ollama, LM Studio) | yes, high risk and opt-in | no | often treated as ordinary junk | yes, with no warning |
70
+ | Risk label before anything is deleted | yes | no | partial | no |
71
+ | Project artifacts (`node_modules`, `.venv`, `target`) | yes, inside real projects only | `node_modules` only | no | manual |
72
+ | Shareable report | self-contained HTML treemap | no | no | no |
73
+ | Install | `npx devclean-cache` | `npx npkill` | app install | already there |
74
+
75
+ The gap that matters is the second row: a cleaner that does not know the difference between
76
+ a 60 GB model download and a stale tarball will eventually delete something expensive.
77
+
78
+ ## Custom caches and ignores
79
+
80
+ You can teach devclean about a cache it does not ship with, or hide one you do not care
81
+ about, without waiting for a release:
82
+
83
+ ```bash
84
+ devclean config
85
+ ```
86
+
87
+ That prints the config path (`%APPDATA%\devclean\config.json` on Windows,
88
+ `~/Library/Application Support/devclean/config.json` on macOS,
89
+ `~/.config/devclean/config.json` on Linux) and the current settings. A minimal file:
90
+
91
+ ```json
92
+ {
93
+ "ignore": ["maven"],
94
+ "extra": [
95
+ { "name": "Bazel cache", "path": "~/.cache/bazel", "risk": "medium" }
96
+ ]
97
+ }
98
+ ```
99
+
100
+ Paths must be absolute or start with `~`; `risk` defaults to `medium`. Set
101
+ `DEVCLEAN_CONFIG` to load a different file (handy for a shared CI config).
102
+
103
+ ## Project artifacts
104
+
105
+ ```
106
+ $ npx devclean-cache projects ~/code
107
+
108
+ CACHE SIZE SHARE FILES RISK PATH
109
+ node_modules 2.1 GB 鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枒鈻戔枒 72% 88.4k low ~/code/shop\node_modules
110
+ .venv 612 MB 鈻堚枅鈻堚枅鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒 20% 12.1k low ~/code/api\.venv
111
+ target 240 MB 鈻堚枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒 8% 3.2k low ~/code/cli\target
112
+ ```
113
+
114
+ Only directories inside a real project (one with `package.json`, `pyproject.toml`, `Cargo.toml`, `.git`, ...) are reported, so the Python standard library and installed applications are never touched.
115
+
116
+ ## Shareable reports
117
+
118
+ `devclean report` writes a single self-contained HTML file - no scripts loaded from the network, no data leaves your machine. It is handy for a team wiki, a "why is the CI runner out of disk" ticket, or just showing a colleague where their 80 GB went.
119
+
120
+ ![HTML report with a treemap of developer caches](https://raw.githubusercontent.com/shisilang684/devclean/main/docs/report.png)
121
+
122
+ ## Safety
123
+
124
+ - **Dry by default when you ask for it.** `--dry-run` prints the plan and deletes nothing.
125
+ - **Risk levels.** High-risk items (local LLM weights) are opt-in.
126
+ - **Allow-list.** `devclean` refuses to delete a path that is not a recognized cache or project artifact, even if a bug tried to.
127
+ - **Symlinks are never followed.** A cache cannot redirect the scan (or the delete) somewhere else.
128
+ - **Reports exclude high-risk items** from the reclaimable total, so a shared screenshot never overstates what is safe.
129
+ - **No telemetry, no network calls.** Everything happens locally.
130
+ - **Failures are reported, not hidden.** Locked files on Windows are listed with the error.
131
+ - **Auditable in one sitting.** ~1,500 lines of dependency-free TypeScript; the allow-list lives in `src/adapters.ts`.
132
+
133
+ Security reports: see [SECURITY.md](SECURITY.md).
134
+
135
+ ## Scripting
136
+
137
+ ```bash
138
+ npx devclean-cache --json | jq '.totalBytes'
139
+ npx devclean-cache clean --json --yes # only deletes low + medium risk
140
+ npx devclean-cache projects . --json
141
+ ```
142
+
143
+ Exit codes: `0` success, `1` error.
144
+
145
+ ## Options
146
+
147
+ ```
148
+ --json machine-readable output
149
+ --only <ids> comma separated adapter ids (npm,pip,cargo,...)
150
+ --top <n> show only the n largest entries
151
+ --all include high risk caches when cleaning
152
+ -i, --interactive pick caches to delete in a list
153
+ --yes skip the confirmation prompt
154
+ --dry-run show what would be deleted, delete nothing
155
+ --depth <n> projects: maximum directory depth (default 6)
156
+ --out <file> report: output path (default devclean-report.html)
157
+ --open report: open the file after writing it
158
+ --no-color disable ANSI colors
159
+ ```
160
+
161
+ ## Roadmap
162
+
163
+ - [x] Interactive TUI (select what to delete with arrow keys)
164
+ - [ ] Growth tracking: "your caches grew 4.2 GB this week"
165
+ - [x] Shareable HTML report with a treemap
166
+ - [ ] Docker build cache and WSL disk usage
167
+ - [ ] `devclean watch` with a size budget
168
+
169
+ Ideas are welcome in [Issues](https://github.com/shisilang684/devclean/issues).
170
+
171
+ ## Development
172
+
173
+ ```bash
174
+ git clone https://github.com/shisilang684/devclean
175
+ cd devclean
176
+ npm install
177
+ npm run build
178
+ npm test
179
+ node dist/cli.js
180
+ ```
181
+
182
+ Zero runtime dependencies. TypeScript, Node's built-in test runner.
183
+
184
+ ## License
185
+
186
+ MIT
@@ -0,0 +1,142 @@
1
+ # devclean
2
+
3
+ [English](README.md) | 绠€浣撲腑鏂?
4
+ [![ci](https://github.com/shisilang684/devclean/actions/workflows/ci.yml/badge.svg)](https://github.com/shisilang684/devclean/actions/workflows/ci.yml)
5
+
6
+ **浣犵殑寮€鍙戞満閲屽婊′簡鍑犱釜 GB 鐨勫瀮鍦俱€傛壘鍒板畠浠紝鐪嬫竻瀹冧滑锛屾竻鐞嗗畠浠€?*
7
+
8
+ `devclean` 浼氭壂鎻忎綘鏁存潯宸ュ叿閾炬倓鎮勬敀涓嬬殑缂撳瓨鈥斺€攏pm銆乸npm銆乸ip銆丆argo銆丟radle銆丳laywright 娴忚鍣ㄣ€丠ugging Face 妯″瀷銆佹湰鍦板ぇ妯″瀷鏉冮噸鈥斺€旂劧鍚庡憡璇変綘鍝簺鍙互瀹夊叏鍒犳帀銆備竴鏉″懡浠わ紝闆堕厤缃紝闆堕仴娴嬨€?
9
+ ![devclean 鎵弿骞舵竻鐞?1.4 GB 寮€鍙戠紦瀛榏(https://raw.githubusercontent.com/shisilang684/devclean/main/docs/demo.png)
10
+
11
+ ```
12
+ $ npx devclean-cache
13
+
14
+ CACHE SIZE SHARE FILES RISK PATH
15
+ pnpm store 998 MB 鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻戔枒鈻戔枒 70% 20.7k low 鈥AppData\Local\pnpm\store
16
+ Maven repo 327 MB 鈻堚枅鈻堚枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒 23% 7.2k medium C:\Users\me\.m2\repository
17
+ npm cache 55.9 MB 鈻堚枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒 4% 106 low 鈥npm-cache\_cacache
18
+ pip cache 44.0 MB 鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒 3% 50 low 鈥pip\Cache
19
+
20
+ Total: 1.4 GB across 4 locations, 28.1k files (3.5s)
21
+ Reclaim 1.4 GB with devclean clean
22
+ ```
23
+
24
+ ## 涓轰粈涔?
25
+ 姣忎釜鍖呯鐞嗗櫒閮芥湁缂撳瓨锛屾瘡涓?AI 宸ュ叿閮戒細涓嬭浇妯″瀷鏉冮噸锛屾瘡涓」鐩兘浼氶暱鍑?`node_modules`銆傚崟鐪嬮兘涓嶈捣鐪硷紝鍔犺捣鏉ュ氨鏄?20鈥?00 GB鈥斺€旇€屼笖娌℃湁涓€涓伐鍏疯兘鍚屾椂鐪嬭瀹冧滑銆?
26
+ 澶у鏁版竻鐞嗗伐鍏疯涔堝彧璁?`node_modules`锛岃涔堟妸浣犲ソ涓嶅鏄撲笅涓嬫潵鐨勬ā鍨嬫潈閲嶅綋鏅€氬瀮鍦惧鐞嗐€俙devclean` 鍒嗗緱娓呰繖涓よ€呫€?
27
+ ## 蹇€熷紑濮?
28
+ ```bash
29
+ npx devclean-cache # 鎵弿宸茬煡缂撳瓨
30
+ npx devclean-cache clean # 鍒犻櫎浣?涓闄╃紦瀛橈紙鍏堥棶浣狅級
31
+ npx devclean-cache clean -i # 浜や簰寮忓嬀閫夎鍒犵殑椤?npx devclean-cache projects . # 鎵惧嚭椤圭洰閲岀殑 node_modules/.venv/target
32
+ npx devclean-cache report # 鐢熸垚鍙垎浜殑 HTML 鎶ュ憡
33
+ ```
34
+
35
+ 闇€瑕?Node.js 20+锛學indows / macOS / Linux 閮借兘璺戙€備篃鍙互鐩存帴浠?GitHub 瀹夎锛歚npm i -g github:shisilang684/devclean`銆?
36
+ ## 鎵弿鑼冨洿
37
+
38
+ 22 绫荤紦瀛橈紝姣忎竴绫婚兘鏍囦簡椋庨櫓绛夌骇銆?
39
+ | 缂撳瓨 | 椋庨櫓 | 璇存槑 |
40
+ | --- | --- | --- |
41
+ | npm銆乸npm銆乊arn銆丅un | 浣?| 鍖呭帇缂╁寘锛岀敤鐨勬椂鍊欎細閲嶆柊涓嬭浇 |
42
+ | pip銆乽v | 浣?| Python wheel 鍜?HTTP 缂撳瓨 |
43
+ | Cargo registry銆丟o build cache | 浣?| 缂栬瘧鍜屼笅杞界殑鏋勫缓杈撳叆 |
44
+ | Gradle銆丮aven | 浣?/ 涓?| 渚濊禆缂撳瓨 |
45
+ | Playwright銆丳uppeteer | 浣?| 娴忚鍣ㄤ簩杩涘埗 |
46
+ | NuGet銆丆omposer銆乻bt / Ivy | 涓?/ 浣?| .NET銆丳HP銆丼cala 渚濊禆缂撳瓨 |
47
+ | conda | 涓?| 涓庣幆澧冨叡鐢ㄧ殑鍖呭綊妗?|
48
+ | Deno銆丆ypress銆丒lectron | 浣?| 杩愯鏃躲€佹祻瑙堝櫒鍜屾闈㈢浜岃繘鍒?|
49
+ | Hugging Face | 涓?| 妯″瀷涓庢暟鎹泦涓嬭浇 |
50
+ | Ollama銆丩M Studio | **楂?* | 鏈湴澶фā鍨嬫潈閲嶏紝鍒犳帀灏辫閲嶆柊瀹屾暣涓嬭浇 |
51
+
52
+ `clean` 榛樿璺宠繃楂橀闄╃紦瀛橈紝闄ら潪浣犲姞 `--all`銆備换浣曞垹闄や箣鍓嶉兘浼氬厛鍒楀嚭娓呭崟鍜屾€婚噺銆?
53
+ ## 鍜屽叾浠栧伐鍏风殑鍖哄埆
54
+
55
+ | | `devclean` | `npkill` | 鍥惧舰鍖栨竻鐞嗚蒋浠?| `du` + `rm -rf` |
56
+ | --- | --- | --- | --- | --- |
57
+ | 鍖呯鐞嗗櫒缂撳瓨锛坣pm銆乸npm銆乸ip銆丆argo銆丟radle鈥︼級 | 22 绫讳竴娆℃壂瀹?| 鍙 `node_modules` | 涓€鑸笉璁よ瘑缂撳瓨 | 鍙煡閬撲綘宸茬粡鐭ラ亾鐨勮矾寰?|
58
+ | 鏈湴澶фā鍨嬫潈閲嶏紙Ollama銆丩M Studio锛?| 鏀寔锛屾爣涓洪珮椋庨櫓銆侀粯璁や笉鍔?| 鍚?| 甯稿綋鏅€氬瀮鍦?| 浼氾紝鑰屼笖娌℃湁鎻愰啋 |
59
+ | 鍒犻櫎鍓嶇粰鍑洪闄╃瓑绾?| 鏈?| 鏃?| 閮ㄥ垎 | 鏃?|
60
+ | 椤圭洰浜х墿锛坄node_modules`銆乣.venv`銆乣target`锛?| 鏈夛紝鍙檺鐪熷疄椤圭洰鍐?| 浠?`node_modules` | 鏃?| 鎵嬪姩 |
61
+ | 鍙垎浜姤鍛?| 鑷甫 treemap 鐨?HTML | 鏃?| 鏃?| 鏃?|
62
+ | 瀹夎鏂瑰紡 | `npx devclean-cache` | `npx npkill` | 瑁?App | 绯荤粺鑷甫 |
63
+
64
+ 鐪熸鎷夊紑宸窛鐨勬槸绗簩琛岋細鍒嗕笉娓?60 GB 妯″瀷涓嬭浇鍜岃繃鏈熷帇缂╁寘鐨勫伐鍏凤紝鏃╂櫄浼氬垹鎺夎吹鐨勪笢瑗裤€?
65
+ ## 鑷畾涔夌紦瀛樹笌蹇界暐
66
+
67
+ 浣犲彲浠ユ暀 `devclean` 璁よ瘑涓€涓畠娌″唴缃殑缂撳瓨锛屾垨鑰呮妸浣犱笉鍏冲績鐨勯殣钘忔帀锛屼笉鐢ㄧ瓑鍙戠増锛?
68
+ ```bash
69
+ devclean config
70
+ ```
71
+
72
+ 瀹冧細鎵撳嵃閰嶇疆璺緞锛圵indows 鏄?`%APPDATA%\devclean\config.json`锛宮acOS 鏄?`~/Library/Application Support/devclean/config.json`锛孡inux 鏄?`~/.config/devclean/config.json`锛夊拰褰撳墠璁剧疆銆傛渶灏忓彲鐢ㄦ枃浠讹細
73
+
74
+ ```json
75
+ {
76
+ "ignore": ["maven"],
77
+ "extra": [
78
+ { "name": "Bazel cache", "path": "~/.cache/bazel", "risk": "medium" }
79
+ ]
80
+ }
81
+ ```
82
+
83
+ 璺緞蹇呴』鏄粷瀵硅矾寰勬垨浠?`~` 寮€澶达紱`risk` 涓嶅啓榛樿 `medium`銆傜敤 `DEVCLEAN_CONFIG` 鍙互鎸囧畾鍒殑鏂囦欢锛圕I 閲屽叡鐢ㄤ竴浠介厤缃緢鏂逛究锛夈€?
84
+ ## 椤圭洰浜х墿
85
+
86
+ ```
87
+ $ npx devclean-cache projects ~/code
88
+
89
+ CACHE SIZE SHARE FILES RISK PATH
90
+ node_modules 2.1 GB 鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枒鈻戔枒 72% 88.4k low ~/code/shop\node_modules
91
+ .venv 612 MB 鈻堚枅鈻堚枅鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒 20% 12.1k low ~/code/api\.venv
92
+ target 240 MB 鈻堚枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒 8% 3.2k low ~/code/cli\target
93
+ ```
94
+
95
+ 鍙細鎶ュ憡鐪熷疄椤圭洰锛堝惈 `package.json`銆乣pyproject.toml`銆乣Cargo.toml`銆乣.git` 绛夋爣璁帮級閲岀殑鐩綍锛孭ython 鏍囧噯搴撳拰宸插畨瑁呯殑杞欢姘歌繙涓嶄細琚鍒般€?
96
+ ## 鍙垎浜殑鎶ュ憡
97
+
98
+ `devclean report` 浼氬啓涓€涓嚜鍖呭惈鐨?HTML 鏂囦欢鈥斺€斾笉鍔犺浇浠讳綍缃戠粶鑴氭湰锛屾暟鎹笉绂诲紑浣犵殑鏈哄櫒銆傞€傚悎璐磋繘鍥㈤槦 wiki銆?CI 鏈哄櫒涓轰粈涔堝張婊′簡"鐨勫伐鍗曪紝鎴栬€呯粰鍚屼簨鐪嬬湅浠栫殑 80 GB 鍘诲摢浜嗐€?
99
+ ![甯?treemap 鐨?HTML 鎶ュ憡](https://raw.githubusercontent.com/shisilang684/devclean/main/docs/report.png)
100
+
101
+ ## 瀹夊叏
102
+
103
+ - **闇€瑕侀瑙堟椂灏变笉鍒犱笢瑗裤€?* `--dry-run` 鍙墦鍗拌鍒掋€?- **椋庨櫓鍒嗙骇銆?* 楂橀闄╅」锛堟湰鍦板ぇ妯″瀷鏉冮噸锛夊繀椤绘樉寮忓紑鍚€?- **鐧藉悕鍗曘€?* 涓嶅睘浜庡凡鐭ョ紦瀛樻垨椤圭洰浜х墿鐨勮矾寰勶紝鍗充娇浠g爜鏈?bug 涔熸嫆缁濆垹闄ゃ€?- **浠庝笉璺熼殢绗﹀彿閾炬帴銆?* 缂撳瓨娌℃硶鎶婃壂鎻忔垨鍒犻櫎寮曞埌鍒殑鍦版柟銆?- **鎶ュ憡涓嶈鍏ラ珮椋庨櫓椤?*锛屽垎浜嚭鍘荤殑鎴浘涓嶄細澶稿ぇ"鍙畨鍏ㄥ洖鏀?鐨勯噺銆?- **闆堕仴娴嬨€侀浂缃戠粶璇锋眰銆?* 鍏ㄩ儴鍦ㄦ湰鍦板畬鎴愩€?- **澶辫触浼氬瀹炴姤鍛娿€?* Windows 涓婅鍗犵敤鐨勬枃浠朵細杩炲悓閿欒涓€璧峰垪鍑恒€?- **涓€涓嬪崍灏辫兘瀹″畬銆?* 绾?1,500 琛岄浂渚濊禆 TypeScript锛岀櫧鍚嶅崟浣嶄簬 `src/adapters.ts`銆?
104
+ 瀹夊叏闂璇疯 [SECURITY.md](SECURITY.md)銆?
105
+ ## 鑴氭湰鍖?
106
+ ```bash
107
+ npx devclean-cache --json | jq '.totalBytes'
108
+ npx devclean-cache clean --json --yes # 鍙垹浣?涓闄?npx devclean-cache projects . --json
109
+ ```
110
+
111
+ 閫€鍑虹爜锛歚0` 鎴愬姛锛宍1` 鍑洪敊銆?
112
+ ## 閫夐」
113
+
114
+ ```
115
+ --json 鏈哄櫒鍙杈撳嚭
116
+ --only <ids> 閫楀彿鍒嗛殧鐨勭紦瀛?id锛坣pm,pip,cargo,...锛?--top <n> 鍙樉绀烘渶澶х殑 n 椤?--all 娓呯悊鏃跺寘鍚珮椋庨櫓缂撳瓨
117
+ -i, --interactive 浜や簰寮忓嬀閫夎鍒犻櫎鐨勯」
118
+ --yes 璺宠繃纭
119
+ --dry-run 鍙樉绀哄皢鍒犻櫎浠€涔堬紝涓嶅疄闄呭垹闄?--depth <n> projects锛氭渶澶х洰褰曟繁搴︼紙榛樿 6锛?--out <file> report锛氳緭鍑鸿矾寰勶紙榛樿 devclean-report.html锛?--open report锛氬啓瀹屽悗鎵撳紑鏂囦欢
120
+ --no-color 鍏抽棴 ANSI 棰滆壊
121
+ ```
122
+
123
+ ## 璺嚎鍥?
124
+ - [x] 浜や簰寮?TUI锛堟柟鍚戦敭鍕鹃€夎鍒犵殑椤癸級
125
+ - [ ] 澧為暱杩借釜锛?浣犵殑缂撳瓨杩欏懆娑ㄤ簡 4.2 GB"
126
+ - [x] 鑷甫 treemap 鐨勫彲鍒嗕韩 HTML 鎶ュ憡
127
+ - [ ] Docker 鏋勫缓缂撳瓨涓?WSL 纾佺洏鍗犵敤
128
+ - [ ] `devclean watch` 涓庡閲忛绠?
129
+ 娆㈣繋鍦?[Issues](https://github.com/shisilang684/devclean/issues) 鎻愭兂娉曘€?
130
+ ## 寮€鍙?
131
+ ```bash
132
+ git clone https://github.com/shisilang684/devclean
133
+ cd devclean
134
+ npm install
135
+ npm run build
136
+ npm test
137
+ node dist/cli.js
138
+ ```
139
+
140
+ 闆惰繍琛屾椂渚濊禆锛孴ypeScript + Node 鍐呯疆娴嬭瘯杩愯鍣ㄣ€?
141
+ ## 璁稿彲璇?
142
+ MIT
package/SECURITY.md ADDED
@@ -0,0 +1,33 @@
1
+ # Security policy
2
+
3
+ devclean deletes files. A path bug is a data-loss bug, so security reports get priority.
4
+
5
+ ## Reporting
6
+
7
+ Open a private security advisory on GitHub (Security -> Report a vulnerability), or email
8
+ the maintainer listed in `package.json`. Please do not open a public issue for anything
9
+ that could delete data outside a known cache.
10
+
11
+ You can expect an acknowledgement within 48 hours and a fix or mitigation within 7 days
12
+ for anything that can delete an unintended path.
13
+
14
+ ## Supported versions
15
+
16
+ The latest minor release on npm receives fixes. There are no long-term branches.
17
+
18
+ ## Threat model
19
+
20
+ What devclean defends against:
21
+
22
+ 1. **Deleting outside a cache.** `src/clean.ts` only deletes paths that exactly match a
23
+ configured adapter path or a known project artifact name inside a detected project.
24
+ Unknown paths are refused even if a caller passes them.
25
+ 2. **Symlink redirection.** `dirSize` and `findProjectArtifacts` skip symlinks entirely, so
26
+ a crafted cache directory cannot make the scan walk into `~` or `/`.
27
+ 3. **Silent scope creep.** High-risk adapters are opt-in (`--all`), and the report excludes
28
+ them from the reclaimable total.
29
+ 4. **Network exfiltration.** The CLI makes no network requests and collects no telemetry.
30
+ The HTML report is a single file with inline CSS/JS, no external resources.
31
+
32
+ Out of scope: a user running `--all` against their own model weights, or a compromised
33
+ package manager that already writes wherever it wants.
@@ -0,0 +1,25 @@
1
+ export type Risk = "low" | "medium" | "high";
2
+ export interface Env {
3
+ platform: NodeJS.Platform;
4
+ home: string;
5
+ localAppData: string;
6
+ appData: string;
7
+ vars: NodeJS.ProcessEnv;
8
+ }
9
+ export interface CacheCandidate {
10
+ id: string;
11
+ name: string;
12
+ path: string;
13
+ risk: Risk;
14
+ note: string;
15
+ }
16
+ export interface Adapter {
17
+ id: string;
18
+ name: string;
19
+ risk: Risk;
20
+ note: string;
21
+ paths(env: Env): string[];
22
+ }
23
+ export declare function detectEnv(): Env;
24
+ export declare const ADAPTERS: Adapter[];
25
+ export declare function adapterById(id: string): Adapter | undefined;