@babylonjs-toolkit/agent 1.1.44 → 1.1.48
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 +46 -1
- package/bin/bt-agent.js +19 -0
- package/lib/diskinfo/cli.js +104 -0
- package/lib/diskinfo/locations.js +213 -0
- package/lib/diskinfo/report.js +271 -0
- package/lib/diskinfo/scan.js +193 -0
- package/lib/kill/cli.js +227 -0
- package/lib/kill/ports.js +254 -0
- package/package.json +1 -1
- package/skills/bt-convert/SKILL.md +7 -3
- package/skills/bt-design/SKILL.md +2 -0
- package/skills/bt-execute/SKILL.md +3 -3
- package/skills/bt-gauntlet/SKILL.md +2 -1
- package/skills/bt-gauntlet/references/critic-rubrics.md +1 -0
- package/skills/bt-plan/SKILL.md +6 -5
- package/skills/bt-prototype/SKILL.md +2 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Babylon Toolkit Desktop Agent (1.1.
|
|
1
|
+
# Babylon Toolkit Desktop Agent (1.1.48)
|
|
2
2
|
|
|
3
3
|
The desktop agent owns the entire pipeline end to end — frontend and UI design, gameplay code, shaders, generated art and audio, 3D models in headless Blender, whole game levels and prefabs in a terminal-driven Unity Editor, the interactive glTF export, the web build, the dev server, and visual QA by screenshotting both Unity and the running browser.
|
|
4
4
|
|
|
@@ -32,6 +32,8 @@ up the skills, instructions and configuration.
|
|
|
32
32
|
| `bt-agent doctor` | Verify the install; prints `INSTALL OK` or lists what is missing |
|
|
33
33
|
| `bt-agent targets` | Show every target and the paths it writes to |
|
|
34
34
|
| `bt-agent bridge` | Connect this computer to the App Builder so it can drive Unity and Blender |
|
|
35
|
+
| `bt-agent diskinfo` | Show where your disk space is going — read-only, macOS, Windows and Linux |
|
|
36
|
+
| `bt-agent kill` | Free a port or range of ports, stop processes by id, or list listening ports — macOS, Windows and Linux |
|
|
35
37
|
|
|
36
38
|
| Option | Effect |
|
|
37
39
|
|--------|--------|
|
|
@@ -44,6 +46,49 @@ up the skills, instructions and configuration.
|
|
|
44
46
|
| `--dry-run` | Print what would happen and change nothing |
|
|
45
47
|
| `--json` | Machine-readable output |
|
|
46
48
|
|
|
49
|
+
### Disk usage report
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
bt-agent diskinfo # print the report and save Desktop/disk-report-YYYY-MM-DD-HHMM.txt
|
|
53
|
+
bt-agent diskinfo --no-save # print only
|
|
54
|
+
bt-agent diskinfo --out report.txt
|
|
55
|
+
bt-agent diskinfo --json # machine-readable
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
One read-only pass over your home folder and the main system folders (`/Applications`, `/Library`,
|
|
59
|
+
`/usr/local` … on macOS; `Program Files`, `ProgramData` on Windows). It reports the volumes, the
|
|
60
|
+
largest folders, known space hogs (Unity editors and caches, Xcode DerivedData and simulators,
|
|
61
|
+
npm / Yarn / pnpm / pip / NuGet caches, Docker and WSL disks, VS Code's C++ cache, Steam, backups,
|
|
62
|
+
Trash / Recycle Bin), every `node_modules`, the Unity `Library/` and Unreal `Intermediate/` folders
|
|
63
|
+
that rebuild themselves, the largest files, and suggested cleanup commands. Nothing is deleted or run.
|
|
64
|
+
|
|
65
|
+
### Freeing ports
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
bt-agent kill --port 4444 # stop whatever is listening on port 4444
|
|
69
|
+
bt-agent kill --port 4444 8888 # several ports (or 4444,8888)
|
|
70
|
+
bt-agent kill --port 8000-8010 # an inclusive range
|
|
71
|
+
bt-agent kill --pid 51234 # stop a process by id (or 51234,51240)
|
|
72
|
+
bt-agent kill --list # every listening port with its process id and name
|
|
73
|
+
bt-agent kill --list 3000-3999 # just these ports; stops nothing
|
|
74
|
+
bt-agent kill --list --pid 51234 # the ports that process listens on
|
|
75
|
+
bt-agent kill --port 4444 --force # skip the polite request and force-kill at once
|
|
76
|
+
bt-agent kill --pid 51234 --force # the same for a process id (-9 works too)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Exactly one of `--port`, `--pid` or `--list` says what the values are, so a bare
|
|
80
|
+
number is never guessed to be a port or a process id.
|
|
81
|
+
|
|
82
|
+
Use it when a dev server is still holding its port and you need to restart it. With
|
|
83
|
+
`--port`, only processes *listening* on a port are matched, so a browser tab connected to your dev
|
|
84
|
+
server is left alone. On macOS and Linux each process gets SIGTERM, then SIGKILL if
|
|
85
|
+
it is still running after 3 seconds. On Windows the process and its children are
|
|
86
|
+
force-killed with `taskkill /T /F`. Afterwards the ports are checked again, and any
|
|
87
|
+
process a watcher (nodemon, pm2 …) has already restarted is reported. Ports are found
|
|
88
|
+
with `lsof` on macOS, `ss` (or `lsof`) on Linux, and `netstat` on Windows. A process
|
|
89
|
+
owned by another user needs `sudo`. bt-agent will not stop itself, the system init
|
|
90
|
+
process, or the Windows System process.
|
|
91
|
+
|
|
47
92
|
### Updating
|
|
48
93
|
|
|
49
94
|
```bash
|
package/bin/bt-agent.js
CHANGED
|
@@ -25,6 +25,8 @@ Commands
|
|
|
25
25
|
doctor Verify the install; prints INSTALL OK or INSTALL FAILED
|
|
26
26
|
targets List the available targets and their paths
|
|
27
27
|
bridge Connect this computer to the App Builder (Unity/Blender); see bt-agent bridge --help
|
|
28
|
+
diskinfo Show where your disk space is going (read-only); see bt-agent diskinfo --help
|
|
29
|
+
kill Free ports / stop processes, or list listening ports; see bt-agent kill --help
|
|
28
30
|
|
|
29
31
|
Options
|
|
30
32
|
--project Install into the current directory instead of $HOME
|
|
@@ -45,6 +47,9 @@ Examples
|
|
|
45
47
|
bt-agent install --project
|
|
46
48
|
bt-agent doctor
|
|
47
49
|
bt-agent update
|
|
50
|
+
bt-agent diskinfo
|
|
51
|
+
bt-agent kill --port 4444
|
|
52
|
+
bt-agent kill --list
|
|
48
53
|
bt-agent bridge --install-service --pair <code from the Unity Bridge dialog>
|
|
49
54
|
`;
|
|
50
55
|
|
|
@@ -257,6 +262,20 @@ function main() {
|
|
|
257
262
|
return;
|
|
258
263
|
}
|
|
259
264
|
|
|
265
|
+
if (process.argv[2] === 'diskinfo') {
|
|
266
|
+
require('../lib/diskinfo/cli')
|
|
267
|
+
.runDiskInfoCli(process.argv.slice(3))
|
|
268
|
+
.then((code) => process.exit(code), (error) => { console.error(error.message); process.exit(1); });
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (process.argv[2] === 'kill') {
|
|
273
|
+
require('../lib/kill/cli')
|
|
274
|
+
.runKillCli(process.argv.slice(3))
|
|
275
|
+
.then((code) => process.exit(code), (error) => { console.error(error.message); process.exit(1); });
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
260
279
|
let opts;
|
|
261
280
|
try {
|
|
262
281
|
opts = parseArgs(process.argv.slice(2));
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
const { buildReport, formatReport, human } = require('./report');
|
|
8
|
+
const { prettyPath } = require('../paths');
|
|
9
|
+
|
|
10
|
+
const USAGE = `
|
|
11
|
+
bt-agent diskinfo — show where your disk space is going (macOS, Windows, Linux)
|
|
12
|
+
|
|
13
|
+
Read-only: it walks your home folder and the main system folders once, then prints
|
|
14
|
+
the biggest folders, known space hogs (Unity, Xcode, package caches, Docker ...),
|
|
15
|
+
node_modules and Unity/Unreal folders that rebuild themselves, the largest files,
|
|
16
|
+
and suggested cleanup commands. Nothing is deleted or run.
|
|
17
|
+
|
|
18
|
+
Usage
|
|
19
|
+
bt-agent diskinfo [options]
|
|
20
|
+
|
|
21
|
+
Options
|
|
22
|
+
--out <file> Save the report here (default: Desktop/disk-report-YYYY-MM-DD-HHMM.txt)
|
|
23
|
+
--no-save Print only; do not save a copy
|
|
24
|
+
--json Machine-readable output on stdout (saved only with --out)
|
|
25
|
+
-h, --help Show this help
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
function parseDiskInfoArgs(argv) {
|
|
29
|
+
const opts = { json: false, save: true, out: null, help: false };
|
|
30
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
31
|
+
const arg = argv[i];
|
|
32
|
+
if (arg === '-h' || arg === '--help') opts.help = true;
|
|
33
|
+
else if (arg === '--json') opts.json = true;
|
|
34
|
+
else if (arg === '--no-save') opts.save = false;
|
|
35
|
+
else if (arg === '--out') {
|
|
36
|
+
opts.out = argv[++i];
|
|
37
|
+
if (!opts.out) throw new Error('--out needs a file path');
|
|
38
|
+
} else if (arg.startsWith('--out=')) opts.out = arg.slice('--out='.length);
|
|
39
|
+
else throw new Error(`Unknown option: ${arg}`);
|
|
40
|
+
}
|
|
41
|
+
return opts;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function defaultReportPath(date = new Date()) {
|
|
45
|
+
const desktop = path.join(os.homedir(), 'Desktop');
|
|
46
|
+
const dir = fs.existsSync(desktop) ? desktop : os.homedir();
|
|
47
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
48
|
+
const stamp = `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}-${pad(date.getHours())}${pad(date.getMinutes())}`;
|
|
49
|
+
return path.join(dir, `disk-report-${stamp}.txt`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** One updating status line on stderr, only when a person is watching. */
|
|
53
|
+
function progressLine(enabled) {
|
|
54
|
+
if (!enabled) return { stage() {}, progress() {}, done() {} };
|
|
55
|
+
const width = () => Math.max(40, (process.stderr.columns || 100) - 1);
|
|
56
|
+
let current = '';
|
|
57
|
+
const draw = (text) => process.stderr.write(`\r${text.slice(0, width()).padEnd(width())}`);
|
|
58
|
+
return {
|
|
59
|
+
stage(msg) {
|
|
60
|
+
current = msg;
|
|
61
|
+
draw(` scanning ${msg} ...`);
|
|
62
|
+
},
|
|
63
|
+
progress(p) {
|
|
64
|
+
draw(` scanning ${current} — ${p.files.toLocaleString()} files, ${human(p.bytes)} — ${prettyPath(p.dir)}`);
|
|
65
|
+
},
|
|
66
|
+
done() {
|
|
67
|
+
process.stderr.write(`\r${' '.repeat(width())}\r`);
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Entry point for `bt-agent diskinfo`. Resolves to the process exit code. */
|
|
73
|
+
async function runDiskInfoCli(argv) {
|
|
74
|
+
let opts;
|
|
75
|
+
try {
|
|
76
|
+
opts = parseDiskInfoArgs(argv);
|
|
77
|
+
} catch (err) {
|
|
78
|
+
console.error(`${err.message}\n\nRun \`bt-agent diskinfo --help\` for usage.`);
|
|
79
|
+
return 2;
|
|
80
|
+
}
|
|
81
|
+
if (opts.help) {
|
|
82
|
+
console.log(USAGE);
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const ui = progressLine(!opts.json && process.stderr.isTTY);
|
|
87
|
+
if (!opts.json) console.error('Scanning disk usage — this can take a few minutes on a full disk.');
|
|
88
|
+
|
|
89
|
+
const report = await buildReport({ onStage: ui.stage, onProgress: ui.progress });
|
|
90
|
+
ui.done();
|
|
91
|
+
|
|
92
|
+
const text = opts.json ? JSON.stringify(report, null, 2) : formatReport(report);
|
|
93
|
+
console.log(text);
|
|
94
|
+
|
|
95
|
+
const out = opts.out || (opts.save && !opts.json ? defaultReportPath() : null);
|
|
96
|
+
if (out) {
|
|
97
|
+
fs.mkdirSync(path.dirname(path.resolve(out)), { recursive: true });
|
|
98
|
+
fs.writeFileSync(out, text + '\n');
|
|
99
|
+
if (!opts.json) console.error(`Report saved to ${prettyPath(path.resolve(out))}`);
|
|
100
|
+
}
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
module.exports = { runDiskInfoCli, parseDiskInfoArgs, defaultReportPath };
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Where disk space usually goes, per platform.
|
|
8
|
+
*
|
|
9
|
+
* Everything is a plain table so the report stays a lookup over one walk, and so
|
|
10
|
+
* the paths can be checked in tests for every platform from any platform.
|
|
11
|
+
* `ctx` = { platform, home, env } — injected, never read from the process here.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
function dirs(ctx) {
|
|
15
|
+
const { home, env } = ctx;
|
|
16
|
+
const p = ctx.platform === 'win32' ? path.win32 : path.posix;
|
|
17
|
+
const join = (...a) => p.join(...a);
|
|
18
|
+
const localAppData = env.LOCALAPPDATA || join(home, 'AppData', 'Local');
|
|
19
|
+
const appData = env.APPDATA || join(home, 'AppData', 'Roaming');
|
|
20
|
+
const systemDrive = (env.SystemDrive || 'C:') + '\\';
|
|
21
|
+
const programFiles = env.ProgramFiles || join(systemDrive, 'Program Files');
|
|
22
|
+
const programFilesX86 = env['ProgramFiles(x86)'] || join(systemDrive, 'Program Files (x86)');
|
|
23
|
+
const programData = env.ProgramData || join(systemDrive, 'ProgramData');
|
|
24
|
+
const lib = join(home, 'Library');
|
|
25
|
+
return { join, localAppData, appData, systemDrive, programFiles, programFilesX86, programData, lib };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Folders outside the home folder worth walking. */
|
|
29
|
+
function systemRoots(ctx) {
|
|
30
|
+
const d = dirs(ctx);
|
|
31
|
+
switch (ctx.platform) {
|
|
32
|
+
case 'darwin':
|
|
33
|
+
return ['/Applications', '/Library', '/private/var', '/opt/homebrew', '/usr/local', '/Users/Shared'];
|
|
34
|
+
case 'win32':
|
|
35
|
+
return [d.programFiles, d.programFilesX86, d.programData];
|
|
36
|
+
default:
|
|
37
|
+
return ['/usr', '/var', '/opt', '/snap'];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Big home sub-folders to break down further (top N children each). */
|
|
42
|
+
function breakdowns(ctx) {
|
|
43
|
+
const d = dirs(ctx);
|
|
44
|
+
switch (ctx.platform) {
|
|
45
|
+
case 'darwin':
|
|
46
|
+
return [
|
|
47
|
+
d.lib,
|
|
48
|
+
d.join(d.lib, 'Application Support'),
|
|
49
|
+
d.join(d.lib, 'Caches'),
|
|
50
|
+
d.join(d.lib, 'Containers'),
|
|
51
|
+
d.join(d.lib, 'Group Containers'),
|
|
52
|
+
];
|
|
53
|
+
case 'win32':
|
|
54
|
+
return [d.localAppData, d.appData, d.join(ctx.home, 'AppData', 'LocalLow'), d.join(d.localAppData, 'Packages')];
|
|
55
|
+
default:
|
|
56
|
+
return [d.join(ctx.home, '.cache'), d.join(ctx.home, '.local', 'share')];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Expand a trailing `*` (one level) into the folders that exist. */
|
|
61
|
+
function glob(pattern) {
|
|
62
|
+
if (!pattern.endsWith('*')) return [pattern];
|
|
63
|
+
const dir = path.dirname(pattern);
|
|
64
|
+
const prefix = path.basename(pattern).slice(0, -1);
|
|
65
|
+
try {
|
|
66
|
+
return fs
|
|
67
|
+
.readdirSync(dir, { withFileTypes: true })
|
|
68
|
+
.filter((e) => e.isDirectory() && e.name.startsWith(prefix))
|
|
69
|
+
.map((e) => path.join(dir, e.name));
|
|
70
|
+
} catch {
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Known space hogs: { id, group, label, paths[], each? }.
|
|
77
|
+
* `each: true` lists every match separately (one row per Unity editor version).
|
|
78
|
+
*/
|
|
79
|
+
function hogs(ctx) {
|
|
80
|
+
const d = dirs(ctx);
|
|
81
|
+
const h = (...a) => d.join(ctx.home, ...a);
|
|
82
|
+
const L = (...a) => d.join(d.lib, ...a);
|
|
83
|
+
const local = (...a) => d.join(d.localAppData, ...a);
|
|
84
|
+
const roam = (...a) => d.join(d.appData, ...a);
|
|
85
|
+
|
|
86
|
+
if (ctx.platform === 'win32') {
|
|
87
|
+
return [
|
|
88
|
+
{ id: 'unity-editors', group: 'Unity', label: 'Unity Editor', paths: [d.join(d.programFiles, 'Unity', 'Hub', 'Editor', '*')], each: true },
|
|
89
|
+
{ id: 'unity-assetstore', group: 'Unity', label: 'Unity Asset Store downloads', paths: [roam('Unity', 'Asset Store-5.x')] },
|
|
90
|
+
{ id: 'unity-cache', group: 'Unity', label: 'Unity package & GI caches', paths: [local('Unity', 'cache'), h('AppData', 'LocalLow', 'Unity', 'Caches')] },
|
|
91
|
+
{ id: 'unity-hub', group: 'Unity', label: 'Unity Hub data', paths: [roam('UnityHub')] },
|
|
92
|
+
{ id: 'android', group: 'Android', label: 'Android SDK & emulators', paths: [local('Android', 'Sdk'), h('.android')] },
|
|
93
|
+
{ id: 'gradle', group: 'Android', label: 'Gradle (~/.gradle)', paths: [h('.gradle')] },
|
|
94
|
+
{ id: 'docker', group: 'Docker / VMs', label: 'Docker Desktop disk', paths: [local('Docker')] },
|
|
95
|
+
{ id: 'wsl', group: 'Docker / VMs', label: 'WSL Linux distros', paths: [local('Packages', 'CanonicalGroupLimited*')] },
|
|
96
|
+
{ id: 'npm', group: 'Package caches', label: 'npm cache', paths: [local('npm-cache')] },
|
|
97
|
+
{ id: 'yarn', group: 'Package caches', label: 'Yarn cache', paths: [local('Yarn', 'Cache'), h('.yarn', 'berry', 'cache')] },
|
|
98
|
+
{ id: 'pnpm', group: 'Package caches', label: 'pnpm store', paths: [local('pnpm')] },
|
|
99
|
+
{ id: 'pip', group: 'Package caches', label: 'pip cache', paths: [local('pip', 'Cache')] },
|
|
100
|
+
{ id: 'nuget', group: 'Package caches', label: 'NuGet (~/.nuget)', paths: [h('.nuget')] },
|
|
101
|
+
{ id: 'nvm', group: 'Package caches', label: 'nvm Node versions', paths: [roam('nvm')] },
|
|
102
|
+
{ id: 'cargo', group: 'Package caches', label: 'Rust (~/.cargo, ~/.rustup)', paths: [h('.cargo'), h('.rustup')] },
|
|
103
|
+
{ id: 'dotcache', group: 'Package caches', label: '~/.cache', paths: [h('.cache')] },
|
|
104
|
+
{ id: 'ollama', group: 'Package caches', label: 'Ollama models', paths: [h('.ollama')] },
|
|
105
|
+
{ id: 'cpptools', group: 'Editors', label: 'VS Code C++ IntelliSense cache', paths: [local('Microsoft', 'vscode-cpptools')] },
|
|
106
|
+
{ id: 'vscode', group: 'Editors', label: 'VS Code data', paths: [roam('Code')] },
|
|
107
|
+
{ id: 'chrome', group: 'Apps & media', label: 'Chrome profiles', paths: [local('Google', 'Chrome'), local('Google', 'Chrome Beta')] },
|
|
108
|
+
{ id: 'steam', group: 'Apps & media', label: 'Steam games', paths: [d.join(d.programFilesX86, 'Steam', 'steamapps')] },
|
|
109
|
+
{ id: 'epic', group: 'Apps & media', label: 'Epic Games', paths: [d.join(d.programFiles, 'Epic Games')] },
|
|
110
|
+
{ id: 'ios-backups', group: 'Apps & media', label: 'iPhone/iPad backups', paths: [roam('Apple Computer', 'MobileSync', 'Backup'), h('Apple', 'MobileSync', 'Backup')] },
|
|
111
|
+
{ id: 'onedrive', group: 'Apps & media', label: 'OneDrive (local copies)', paths: [h('OneDrive')] },
|
|
112
|
+
{ id: 'icloud', group: 'Apps & media', label: 'iCloud Drive (local copies)', paths: [h('iCloudDrive')] },
|
|
113
|
+
{ id: 'temp', group: 'Leftovers', label: 'Temp files', paths: [local('Temp')] },
|
|
114
|
+
{ id: 'trash', group: 'Leftovers', label: 'Recycle Bin', paths: [d.join(d.systemDrive, '$Recycle.Bin')] },
|
|
115
|
+
{ id: 'downloads', group: 'Leftovers', label: 'Downloads', paths: [h('Downloads')] },
|
|
116
|
+
{ id: 'swap', group: 'Leftovers', label: 'Page file / hibernation file', paths: ['pagefile.sys', 'hiberfil.sys', 'swapfile.sys'].map((f) => d.join(d.systemDrive, f)) },
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (ctx.platform === 'darwin') {
|
|
121
|
+
return [
|
|
122
|
+
{ id: 'unity-editors', group: 'Unity', label: 'Unity Editor', paths: ['/Applications/Unity/Hub/Editor/*'], each: true },
|
|
123
|
+
{ id: 'unity-assetstore', group: 'Unity', label: 'Unity Asset Store downloads', paths: [L('Unity', 'Asset Store-5.x')] },
|
|
124
|
+
{ id: 'unity-cache', group: 'Unity', label: 'Unity package & GI caches', paths: [L('Unity', 'cache'), L('Caches', 'com.unity3d.UnityEditor'), L('Caches', 'Unity')] },
|
|
125
|
+
{ id: 'unity-hub', group: 'Unity', label: 'Unity Hub data', paths: [L('Application Support', 'UnityHub')] },
|
|
126
|
+
{ id: 'xcode-deriveddata', group: 'Xcode', label: 'Xcode DerivedData', paths: [L('Developer', 'Xcode', 'DerivedData')] },
|
|
127
|
+
{ id: 'xcode-archives', group: 'Xcode', label: 'Xcode Archives', paths: [L('Developer', 'Xcode', 'Archives')] },
|
|
128
|
+
{ id: 'xcode-devicesupport', group: 'Xcode', label: 'Xcode device support files', paths: [L('Developer', 'Xcode', 'iOS DeviceSupport'), L('Developer', 'Xcode', 'watchOS DeviceSupport'), L('Developer', 'Xcode', 'tvOS DeviceSupport')] },
|
|
129
|
+
{ id: 'simulators', group: 'Xcode', label: 'Simulator devices & runtimes', paths: [L('Developer', 'CoreSimulator'), '/Library/Developer/CoreSimulator'] },
|
|
130
|
+
{ id: 'android', group: 'Android', label: 'Android SDK & emulators', paths: [L('Android', 'sdk'), h('.android')] },
|
|
131
|
+
{ id: 'gradle', group: 'Android', label: 'Gradle (~/.gradle)', paths: [h('.gradle')] },
|
|
132
|
+
{ id: 'docker', group: 'Docker / VMs', label: 'Docker Desktop disk', paths: [L('Containers', 'com.docker.docker')] },
|
|
133
|
+
{ id: 'vms', group: 'Docker / VMs', label: 'Parallels / UTM VMs', paths: [h('Parallels'), L('Containers', 'com.utmapp.UTM')] },
|
|
134
|
+
{ id: 'npm', group: 'Package caches', label: 'npm cache', paths: [h('.npm')] },
|
|
135
|
+
{ id: 'yarn', group: 'Package caches', label: 'Yarn cache', paths: [L('Caches', 'Yarn'), h('.yarn', 'berry', 'cache')] },
|
|
136
|
+
{ id: 'pnpm', group: 'Package caches', label: 'pnpm store', paths: [L('pnpm'), h('.pnpm-store')] },
|
|
137
|
+
{ id: 'pip', group: 'Package caches', label: 'pip cache', paths: [L('Caches', 'pip')] },
|
|
138
|
+
{ id: 'homebrew', group: 'Package caches', label: 'Homebrew download cache', paths: [L('Caches', 'Homebrew')] },
|
|
139
|
+
{ id: 'nuget', group: 'Package caches', label: 'NuGet (~/.nuget)', paths: [h('.nuget')] },
|
|
140
|
+
{ id: 'nvm', group: 'Package caches', label: 'nvm Node versions', paths: [h('.nvm')] },
|
|
141
|
+
{ id: 'cargo', group: 'Package caches', label: 'Rust (~/.cargo, ~/.rustup)', paths: [h('.cargo'), h('.rustup')] },
|
|
142
|
+
{ id: 'dotcache', group: 'Package caches', label: '~/.cache', paths: [h('.cache')] },
|
|
143
|
+
{ id: 'ollama', group: 'Package caches', label: 'Ollama models', paths: [h('.ollama')] },
|
|
144
|
+
{ id: 'cpptools', group: 'Editors', label: 'VS Code C++ IntelliSense cache', paths: [L('Caches', 'vscode-cpptools')] },
|
|
145
|
+
{ id: 'vscode', group: 'Editors', label: 'VS Code data', paths: [L('Application Support', 'Code')] },
|
|
146
|
+
{ id: 'chrome', group: 'Apps & media', label: 'Chrome profiles', paths: [L('Application Support', 'Google')] },
|
|
147
|
+
{ id: 'steam', group: 'Apps & media', label: 'Steam games', paths: [L('Application Support', 'Steam')] },
|
|
148
|
+
{ id: 'epic', group: 'Apps & media', label: 'Epic Games', paths: [L('Application Support', 'Epic'), '/Users/Shared/Epic Games'] },
|
|
149
|
+
{ id: 'ios-backups', group: 'Apps & media', label: 'iPhone/iPad backups', paths: [L('Application Support', 'MobileSync', 'Backup')] },
|
|
150
|
+
{ id: 'mail', group: 'Apps & media', label: 'Mail', paths: [L('Mail')] },
|
|
151
|
+
{ id: 'messages', group: 'Apps & media', label: 'Messages attachments', paths: [L('Messages')] },
|
|
152
|
+
{ id: 'photos', group: 'Apps & media', label: 'Photos libraries', paths: [h('Pictures', '*')].flatMap(glob).filter((p) => p.endsWith('.photoslibrary')) },
|
|
153
|
+
{ id: 'icloud', group: 'Apps & media', label: 'iCloud Drive (local copies)', paths: [L('Mobile Documents')] },
|
|
154
|
+
{ id: 'trash', group: 'Leftovers', label: 'Trash', paths: [h('.Trash')] },
|
|
155
|
+
{ id: 'downloads', group: 'Leftovers', label: 'Downloads', paths: [h('Downloads')] },
|
|
156
|
+
{ id: 'swap', group: 'Leftovers', label: 'Swap / sleep image', paths: ['/private/var/vm'] },
|
|
157
|
+
];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return [
|
|
161
|
+
{ id: 'unity-editors', group: 'Unity', label: 'Unity Editor', paths: [h('Unity', 'Hub', 'Editor', '*')], each: true },
|
|
162
|
+
{ id: 'unity-cache', group: 'Unity', label: 'Unity caches', paths: [h('.cache', 'unity3d'), h('.local', 'share', 'unity3d')] },
|
|
163
|
+
{ id: 'docker', group: 'Docker / VMs', label: 'Docker', paths: ['/var/lib/docker'] },
|
|
164
|
+
{ id: 'npm', group: 'Package caches', label: 'npm cache', paths: [h('.npm')] },
|
|
165
|
+
{ id: 'yarn', group: 'Package caches', label: 'Yarn cache', paths: [h('.cache', 'yarn'), h('.yarn', 'berry', 'cache')] },
|
|
166
|
+
{ id: 'pnpm', group: 'Package caches', label: 'pnpm store', paths: [h('.local', 'share', 'pnpm')] },
|
|
167
|
+
{ id: 'nvm', group: 'Package caches', label: 'nvm Node versions', paths: [h('.nvm')] },
|
|
168
|
+
{ id: 'dotcache', group: 'Package caches', label: '~/.cache', paths: [h('.cache')] },
|
|
169
|
+
{ id: 'gradle', group: 'Android', label: 'Gradle (~/.gradle)', paths: [h('.gradle')] },
|
|
170
|
+
{ id: 'trash', group: 'Leftovers', label: 'Trash', paths: [h('.local', 'share', 'Trash')] },
|
|
171
|
+
{ id: 'downloads', group: 'Leftovers', label: 'Downloads', paths: [h('Downloads')] },
|
|
172
|
+
];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const GB = 1024 ** 3;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Cleanup suggestions, shown only when the matching hog is at least `min` bytes.
|
|
179
|
+
* Text only — diskinfo never runs any of them.
|
|
180
|
+
*/
|
|
181
|
+
function suggestions(ctx) {
|
|
182
|
+
const win = ctx.platform === 'win32';
|
|
183
|
+
const mac = ctx.platform === 'darwin';
|
|
184
|
+
return [
|
|
185
|
+
{ id: 'xcode-deriveddata', min: GB, text: 'Xcode DerivedData is a build cache: rm -rf ~/Library/Developer/Xcode/DerivedData/*' },
|
|
186
|
+
{ id: 'xcode-devicesupport', min: GB, text: 'Old device support folders in ~/Library/Developer/Xcode/*DeviceSupport are safe to delete.' },
|
|
187
|
+
{ id: 'simulators', min: GB, text: 'xcrun simctl delete unavailable — and remove old runtimes in Xcode > Settings > Components.' },
|
|
188
|
+
{ id: 'unity-projects', min: GB, text: "Unity project Library/ folders rebuild when the project opens; delete them for projects you're not working on." },
|
|
189
|
+
{ id: 'unreal-projects', min: GB, text: 'Unreal Intermediate/, DerivedDataCache/ and Binaries/ rebuild; delete them for idle projects.' },
|
|
190
|
+
{ id: 'unity-editors', min: GB, text: 'Remove Unity Editor versions you no longer use in Unity Hub > Installs.' },
|
|
191
|
+
{ id: 'unity-assetstore', min: GB, text: 'Unity Asset Store downloads (.unitypackage) can be re-downloaded from My Assets.' },
|
|
192
|
+
{ id: 'cpptools', min: GB, text: 'Delete the VS Code C++ IntelliSense cache, and cap it with "C_Cpp.intelliSenseCacheSize": 5 in VS Code settings.' },
|
|
193
|
+
{ id: 'npm', min: GB, text: 'npm cache clean --force' },
|
|
194
|
+
{ id: 'yarn', min: GB, text: 'yarn cache clean' },
|
|
195
|
+
{ id: 'pnpm', min: GB, text: 'pnpm store prune' },
|
|
196
|
+
{ id: 'pip', min: GB, text: 'pip cache purge' },
|
|
197
|
+
{ id: 'nuget', min: GB, text: 'dotnet nuget locals all --clear' },
|
|
198
|
+
{ id: 'homebrew', min: GB / 2, text: 'brew cleanup --prune=all' },
|
|
199
|
+
{ id: 'gradle', min: GB, text: 'Delete ~/.gradle/caches (Gradle downloads what it needs again).' },
|
|
200
|
+
{ id: 'docker', min: GB, text: 'docker system prune -a — removes unused images, containers and build cache.' },
|
|
201
|
+
{ id: 'wsl', min: GB, text: 'Remove WSL distros you no longer use: wsl --list, then wsl --unregister <name>.' },
|
|
202
|
+
{ id: 'node-modules', min: GB, text: 'node_modules in old projects can be deleted; npm install brings them back.' },
|
|
203
|
+
{ id: 'ios-backups', min: GB, text: win ? 'Old device backups: iTunes / Apple Devices > Preferences > Devices.' : 'Old device backups: Finder > your iPhone > Manage Backups.' },
|
|
204
|
+
{ id: 'steam', min: GB, text: "Uninstall Steam games you don't play from the Steam library." },
|
|
205
|
+
{ id: 'temp', min: GB, text: 'Clear temp files: Settings > System > Storage > Temporary files.' },
|
|
206
|
+
{ id: 'trash', min: GB / 10, text: win ? 'Empty the Recycle Bin.' : 'Empty the Trash.' },
|
|
207
|
+
{ id: 'downloads', min: GB, text: 'Review Downloads, sorted by size.' },
|
|
208
|
+
{ id: 'snapshots', min: 1, text: 'Local Time Machine snapshots hold space no folder shows: tmutil listlocalsnapshots /, then sudo tmutil deletelocalsnapshots <date>.' },
|
|
209
|
+
{ id: 'always', min: 0, text: mac ? 'System Settings > General > Storage has its own recommendations.' : win ? 'Settings > System > Storage > Cleanup recommendations, and Disk Cleanup > Clean up system files.' : 'Your distro package cache (apt clean / dnf clean all) and journalctl --vacuum-size=200M.' },
|
|
210
|
+
];
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
module.exports = { systemRoots, breakdowns, hogs, suggestions, glob };
|