Tubatools.AiJunkCleanup
1.15.2
dotnet add package Tubatools.AiJunkCleanup --version 1.15.2
NuGet\Install-Package Tubatools.AiJunkCleanup -Version 1.15.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tubatools.AiJunkCleanup" Version="1.15.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tubatools.AiJunkCleanup" Version="1.15.2" />
<PackageReference Include="Tubatools.AiJunkCleanup" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Tubatools.AiJunkCleanup --version 1.15.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Tubatools.AiJunkCleanup, 1.15.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Tubatools.AiJunkCleanup@1.15.2
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Tubatools.AiJunkCleanup&version=1.15.2
#tool nuget:?package=Tubatools.AiJunkCleanup&version=1.15.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AI 垃圾清理(Tubatools.AiJunkCleanup)
给图吧工具箱的 AI 助手增加一个「垃圾清理」模式。AI 只负责只读扫描并给出清单;插件负责解析清单、展示风险和删除原因,最终由你逐项勾选确认。不修改工具箱本体代码。
使用
- 在「插件」页安装
Tubatools.AiJunkCleanup并启用。插件不注册内置工具卡片,只增加 AI 模式。 - 打开「AI 助手」,在输入区下方的模式下拉框选择「垃圾清理」。插件第一次加载时会弹出图文教程(仿真界面 + 扫描/高亮动画),之后可以点模式旁的
?随时重看。 - 模式旁边会出现「扫描深度」下拉框,可选:
- 快速:优先常见缓存/临时位置,快速给出少量高置信度项目;
- 标准(默认):扩大浏览范围,顺着占用大的目录继续找;
- 深度:大范围只读浏览指定盘符/目录,专门找意外的大文件、旧安装包和长期不用的缓存。
- 输入清理目标,例如「清理 C 盘」「看看微信缓存」「浏览器缓存太大了」,然后按下发送。
- 插件会先弹出扫描动画,用宿主 NTFS/MFT 只读扫描系统盘根目录下三层;扫描完成后把占用摘要直接附在消息末尾交给 AI。AI 不需要自己调用扫描,只针对占用大的目录做定向只读检查,最后输出
tuba-junk-plan清单。同一次扫描还会导出工作区scan-index.json(更深层目录 + 大文件 + 修改时间),AI 需要深层数据时直接查索引,不用二次扫盘;三层摘要的完整数据在shallow-scan.json。 - 插件自动解析清单并弹出选择列表:
- 低风险默认勾选,中/高风险默认不勾选;
- 每一项的删除原因、风险说明、建议默认折叠,展开后可见完整路径;
- 不存在的路径不会加入清单;成功删除的项目会从清单中移除,弹窗保持打开,可以继续分批勾选删除剩下的项目。
- 删除由插件直接完成,不进入回收站;目录优先使用原生递归删除,遇到只读/占用才回退到逐文件处理;选中项目后即可执行;
- 删除过程中在弹窗里显示近似进度、约释放大小和当前文件/目录;可以随时停止;
- 遇到文件被占用或无法删除时直接跳过,不弹占用提示;本批结果会列出跳过的项目和原因,清单行也会标记为「已跳过」,可以之后重试。
- 删除结果会写入插件数据目录的
cleanup-audit.jsonl,方便事后核对。
模式旁的「上次清单」按钮可以重新打开最近一次清单;插件页只显示安装信息,不占用工具箱的工具入口。
安全边界
- AI 在提示词和技能中被明确禁止执行任何删除、移动、重命名、格式化、系统清理命令;它只输出清单。
- 按下发送时,插件用宿主 NTFS/MFT 只读扫描系统盘根目录下三层,把摘要附在消息末尾;同时导出
shallow-scan.json(三层)和scan-index.json(更深目录、大文件、修改时间)。慢速 PowerShell 脚本只在扫描失败或非系统盘时回退,不做全盘逐文件枚举。 - 在垃圾清理模式下,插件还会监测 AI 的工具调用:发现
Remove-Item/del/rmdir/cleanmgr/Clear-RecycleBin/ 写入类命令,或write/edit文件操作时,立即取消本轮运行并弹窗说明,不等待模型自行停止。普通对话模式不会启用这条拦截。 - 插件在展示前和真正删除前各做一次路径安全检查:磁盘根目录、Windows/Program Files/ProgramData、用户目录根、个人文件夹根、AppData 根、系统卷目录、链接/挂载点、工具箱自身目录等一律拒绝。
- 风险只会被安全规则提高,不会被降低:位于个人文件夹、ProgramData、磁盘根一级项目等会自动升级风险等级。
- 删除使用插件自己的直接删除引擎:目录优先原生
Directory.Delete(recursive),失败时回退到逐文件(清理只读位、跳过链接),不调用回收站或IFileOperation;选中项目后执行;进度和释放大小按清单测量值估算。文件被占用或无法删除时直接跳过,最后在结果中列出跳过项,不弹占用提示。 - 插件声明
fullTrust仅用于把模式项注入 AI 助手页面、读取当前会话消息和保存模式偏好,不修改工具箱程序文件。
构建
dotnet pack plugins/Tubatools.AiJunkCleanup/Tubatools.AiJunkCleanup.csproj -c Release -o artifacts/plugins
产物为 artifacts/plugins/Tubatools.AiJunkCleanup.<version>.nupkg。发布到 NuGet(带 Tubatools 标签)后,可在工具箱「插件」页搜索 Tubatools.AiJunkCleanup 安装;开发时按《插件开发文档》的 AI 工作区 artifacts/ 自动加载流程验证。
测试
dotnet test plugins/Tubatools.AiJunkCleanup.Tests/Tubatools.AiJunkCleanup.Tests.csproj -c Debug --filter "FullyQualifiedName~AiJunkCleanup"
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.