@oficiallyakshay/trash-panda 0.0.0-placeholder.0 → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 trash-panda contributors
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,109 @@
1
1
  # trash-panda
2
2
 
3
- Name reserved. The first real release follows.
3
+ **Keeps cleaning up after your coding agent, so you can keep working longer.**
4
+
5
+ ![An embroidered file-folder patch with a raccoon that looks over the folder's front edge and the wordmark trash-panda](assets/banner.png)
6
+
7
+ A coding agent leaves things behind: repo copies it finished with, scratch folders, dependency
8
+ folders, test folders and browser copies. They fill the disk until a long session has to stop.
9
+ trash-panda keeps clearing them up in the background, so you can keep working longer. Claude
10
+ should do this by default; until it does, this tool does.
11
+
12
+ It removes something only when it can prove it is finished. It starts in preview, so it reports
13
+ first and deletes nothing until you tell it to.
14
+
15
+ ## What it clears
16
+
17
+ - **Finished worktrees.** Claude's repo copies under a repository's `.claude/worktrees/`, once
18
+ their work is safe elsewhere, and git's records of worktrees whose folder is already gone.
19
+ - **Rebuildable folders.** `node_modules` and Swift `.build` inside a linked worktree, when git
20
+ ignores them and the package file and lockfile are committed and unchanged.
21
+ - **Ended sessions' scratch.** A session's scratch folder once its repo copy is gone and nothing
22
+ uses it, and only after its session is archived or its history is gone.
23
+ - **Test folders and package caches**, only inside the folders you list (`testDirs` and
24
+ `moduleCacheDirs`). Nothing is listed by default.
25
+ - **Chrome's temporary copies**, which Chrome leaves in the macOS temporary folder.
26
+ - **Unused `uv` downloads**, with uv's own cache prune, never forced.
27
+ - **Old Playwright browser builds** that no installed Playwright needs.
28
+ - **Old entries of the macOS user temp folder**, only those whose names start with a prefix you list
29
+ (`tempPrefixes`), a small batch at a time with a pause between. Nothing is listed by default.
30
+
31
+ ## How it stays safe
32
+
33
+ - **Proof, not age.** No rule waits for something to get old. An item goes only when a check
34
+ proves it is finished, and something made a minute ago can go once it is proven. The one
35
+ exception is the temp entries you list: there, age (7 days by default) is one more guard, because
36
+ a name cannot prove that an entry is finished.
37
+ - **When in doubt, it keeps.** It keeps anything in use, unfinished, locked or unclear: a folder a
38
+ process works in or has a file open in, uncommitted or unpushed work, an open pull request, a
39
+ locked worktree. A check that fails, or a record it cannot read, keeps every item it could name.
40
+ - **It checks again just before each delete**, GitHub included. Any change keeps the item.
41
+ - **What it never deletes:** a branch, a main checkout, Docker data, a backup, a live browser
42
+ profile, a model, an archive, app data or session history. A worktree goes only through git's
43
+ own worktree removal: never forced, never unlocked, and its branch stays.
44
+
45
+ ## Preview first
46
+
47
+ A new setup is in preview: every start, automatic or by hand, only reports what it would remove.
48
+ Nothing is deleted until you set `"preview": false` in `~/.trash-panda/settings.json`. trash-panda
49
+ never turns preview off itself, and a settings file it cannot read, or a bad value in it, turns
50
+ preview back on and is named in the summary.
51
+
52
+ ## How it runs
53
+
54
+ - **Three triggers**, each with its own switch: low disk, a schedule (once an hour by default) and
55
+ the start of a Claude session. With one off, the others still work. Only one cleanup runs at a
56
+ time.
57
+ - **Two marks.** Free space under the low mark (20% by default) starts a cleanup. Under the
58
+ critical mark (10% by default) after a cleanup, the summary says so, and an optional critical
59
+ script of yours runs once for each fall, with a time limit.
60
+ - **Safe Claude settings.** Setup lets new Claude worktrees share a repository's `node_modules`,
61
+ only where every safety check passes, and never changes a value you set.
62
+ - **A screen.** `trash-panda watch` shows free space against both marks, the cleanup in progress,
63
+ the space freed, the next run, each trigger's switch and the history. It only reads.
64
+ - **Records.** `trash-panda stats` says how often space fell under each mark and what each run
65
+ recovered; `trash-panda diagnose` names what went wrong. The records stay on your machine.
66
+ - **Updates.** A notice names a newer version; `trash-panda update` installs it and puts the old
67
+ one back if any step fails. Automatic updates are off until you turn them on.
68
+ - **Anonymous metrics, off by default.** `trash-panda config metrics on` shares run sizes and free
69
+ space, never a path or a name. [docs/telemetry.md](docs/telemetry.md) lists every field.
70
+ - **A Mac menu bar app, optional.** It shows free space, each run with the space it got back, and every
71
+ setting; it changes them only through `trash-panda config`. Quit it or run `trash-panda app off` and the
72
+ engine keeps running. [mac/README.md](mac/README.md) says how to build it.
73
+ - **Another tool in charge.** A tool can write `~/.trash-panda/in-charge.json`; while it is fresh,
74
+ the automatic triggers wait and that tool starts cleanups itself.
75
+
76
+ Each mark, the schedule, every switch and the critical script can be changed in
77
+ `~/.trash-panda/settings.json`, and each mark, the schedule and every switch with
78
+ `trash-panda config <key> <value>`. [docs/reference.md](docs/reference.md) lists every setting, file,
79
+ command and exit code.
80
+
81
+ ## Install
82
+
83
+ Needs macOS and Node 22 or later. It is macOS only: it uses launchd, the macOS temporary folder
84
+ and the Claude desktop app's records.
85
+
86
+ 1. Install the `@oficiallyakshay/trash-panda` package globally with npm. The command it adds is
87
+ `trash-panda`.
88
+ 2. Run its setup command, which adds one launchd job and one session-start hook and starts in
89
+ preview.
90
+ 3. See what a cleanup would remove: run trash-panda with no command. This deletes nothing, whatever
91
+ the settings say.
92
+ 4. When the report looks right, turn preview off in the settings file. The triggers then clean on
93
+ their own, and you can also start a cleanup by hand.
94
+
95
+ [docs/reference.md](docs/reference.md) lists the exact commands and settings.
96
+
97
+ ## Claude Code's own cleanup, and what this adds
98
+
99
+ Claude Code cleans up some of its own files. Once they are older than its `cleanupPeriodDays`
100
+ setting, it deletes transcripts, tool results, plans, shell snapshots and similar files under
101
+ `~/.claude/`, and the worktrees it made for subagents and background sessions when they hold no
102
+ work. When a `--worktree` session ends with nothing in its worktree, it removes the worktree or
103
+ asks first.
104
+
105
+ Its sweep leaves a worktree that holds commits, even after a merged pull request carries them,
106
+ and it does not clear the `node_modules` and `.build` inside a kept worktree, git's records of
107
+ deleted worktrees, test folders, package caches, Chrome's copies, `uv` downloads or old
108
+ Playwright builds. trash-panda clears those, by proof, on low disk, a schedule and session start.
109
+ In my view, an agent that makes these files should clear them by default.
@@ -0,0 +1,220 @@
1
+ # trash-panda reference
2
+
3
+ Everything another tool needs to start, watch or take charge of trash-panda.
4
+ The npm package is `@oficiallyakshay/trash-panda`; the command it installs is `trash-panda`.
5
+
6
+ The command's own file in the package is `scripts/claude-leftovers-cleanup.mjs`
7
+ (the `trash-panda` bin). Run it as `node <package>/scripts/claude-leftovers-cleanup.mjs <command>`
8
+ when the bin is not on `PATH`.
9
+
10
+ ## Commands
11
+
12
+ | Command | What it does | Exit codes |
13
+ |---|---|---|
14
+ | `trash-panda [--only <class>] [--limit <n>]` | Reports what a cleanup would remove, each item with its size and the reason it can go. Removes nothing. | 0; 2 for a bad `--limit` |
15
+ | `trash-panda run [--only <class>] [--by <tool>] [--limit <n>]` | Starts one cleanup in its own process session and returns at once. Without `--by` the start is by `hand`. A hand run or a run by a tool always starts, unless the lock is held. `--limit` caps the test folders removed in this run. | 0 started; 3 one is already running; 4 an automatic start waits for the tool in charge; 2 a bad `--limit`; any other: it could not start (1 for a bad option) |
16
+ | `trash-panda tick` | Checks low disk and the schedule and starts at most one cleanup. The launchd job runs it. | 0 |
17
+ | `trash-panda session-start` | The session-start hook: prints the last run's lines and, when its switch is on, starts a cleanup in the background. Never delays a session. | 0 |
18
+ | `trash-panda setup` | Adds one launchd job and one session-start hook. Starts in preview. | 0 done; 1 refused or failed |
19
+ | `trash-panda remove` | Removes the job and the hook, and puts back only what setup changed. | 0 done; 1 failed |
20
+ | `trash-panda update` | Installs the newest version from npm, as [Updates](#updates) says. | 0 done or already the newest; 1 failed (the old version stays) or this copy cannot update; 3 a cleanup or another update is running |
21
+ | `trash-panda config metrics [on\|off]` | Turns the [anonymous metrics](telemetry.md) on or off in `settings.json`, every other key kept. With neither, says which, and shows the install id. | 0 done; 1 the file cannot be read or saved, or a bad option |
22
+ | `trash-panda config <key> [value]` | Shows or sets one setting that is a switch or a number, by its name below (`preview`, `lowMarkPct`, `triggers.schedule.everySec`, `autoUpdate` and the like), every other key kept. A switch takes `on` or `off`, a number digits. Prints the setting and the value the engine now uses. The Mac app's settings use it. | 0 done; 1 a bad value, a value that crosses the marks, a list setting, an unknown key, or a file that cannot be read or saved (the file is left alone) |
23
+ | `trash-panda app on\|off` | Adds or removes only the Mac app's login item, as [the launchd job and the hook](#the-launchd-job-and-the-hook) says. The engine's job, hook and settings stay. | 0 done (`off` with no item is done); 1 `on` with the app not installed, or a bad option |
24
+ | `trash-panda --version` | Prints the version. | 0 |
25
+ | `trash-panda watch [--demo <state>]` | A live screen of free space with both marks, the cleanup in progress, the space freed, the next run, who starts cleanups, each trigger's switch and the history (arrow keys scroll it, `q` ends it). It reads `live.json`, `history.jsonl`, `settings.json` and `in-charge.json` every two seconds and writes nothing; a `live.json` older than three ticks is shown as old. `--demo` shows made-up data: `idle`, `running`, `critical`, `in-charge`, `preview` or `empty`. With no terminal it prints one plain frame. | 0; 1 for a bad option |
26
+ | `trash-panda stats [--since <n>h\|<n>d\|<n>w] [--json]` | What the records add up to, over the last 7 days without `--since`: falls under each mark and the time under it, runs per trigger, runs that freed nothing, the space recovered per kind and per run, and the top reasons items were kept (counted on each run). Reads only. `--json` prints `format` 1 with `since`, `until`, `falls`, `runs`, `freedBytes`, `kinds`, `kept` and `recoveries`. | 0; 1 for a bad option |
27
+ | `trash-panda diagnose [--json]` | The last errors, the checks of the last run that got no answer, the job, the hook, settings problems and the end of the tick log. Reads only. | 0; 1 for a bad option |
28
+
29
+ `--apply` is the old spelling of `run`, and `--session-start` the old spelling of `session-start`.
30
+
31
+ ### Classes for `--only`
32
+
33
+ | Class | What it cleans |
34
+ |---|---|
35
+ | `chrome` | Copies of Chrome left in the macOS temporary folder |
36
+ | `worktrees` | Finished Claude repo copies, and git records of worktrees whose folder is gone |
37
+ | `scratch` | Claude scratch folders of copies that are gone |
38
+ | `rebuildables` | `node_modules` and Swift `.build` folders in linked worktrees that can be rebuilt |
39
+ | `tests` | Test folders in the folders `testDirs` lists |
40
+ | `caches` | Unused shared package caches in the folders `moduleCacheDirs` lists |
41
+ | `uv` | The uv cache, pruned |
42
+ | `playwright` | Playwright browser builds that no installed Playwright needs |
43
+ | `temp` | Old entries of the macOS user temp folder whose names start with one of `tempPrefixes` |
44
+
45
+ A folder that holds a mounted disk or share is not removed. Repo copies are not checked for this:
46
+ `git worktree remove` deletes them.
47
+
48
+ A scratch folder stays when a git copy inside it has a local change, an ignored file outside the
49
+ caches, or a commit on any ref (stash included) that no remote outside the scratch folders holds.
50
+
51
+ A run with `--only` never moves the schedule.
52
+
53
+ ### `--by`
54
+
55
+ The name of the tool that starts the run: letters, digits, dot, dash and underscore, at most 64.
56
+ `lowDisk`, `schedule` and `sessionStart` are the automatic triggers' own names: a start under one of them
57
+ waits while another tool is in charge.
58
+
59
+ ## Files
60
+
61
+ All files are in `~/.trash-panda/`.
62
+
63
+ | File | Written by | What it holds |
64
+ |---|---|---|
65
+ | `settings.json` | the person (setup writes `{"preview": true}` only when there is none; `config` saves the value the person gives, and setup's one question saves the `metrics` answer) | the settings below |
66
+ | `live.json` | trash-panda, replaced in one atomic step on each run and each tick | the state now |
67
+ | `history.jsonl` | trash-panda, one line per finished run | the same keys as `last` in `live.json`, then [the run's details](#historyjsonl-and-eventsjsonl) |
68
+ | `events.jsonl` | trash-panda, one line each time free space goes under a mark or comes back | [each crossing](#historyjsonl-and-eventsjsonl) |
69
+ | `errors.jsonl` | trash-panda, one line each time a tick, a start or a cleanup failed | `at`, `command`, `message` |
70
+ | `tick.log` | launchd | what Node itself printed when a tick could not run; empty when all is well |
71
+ | `state.json` | trash-panda, for itself | the last finished run's lines and lists: `removed` (in preview, what would go) holds `path`, `reason` and `bytes` (null when not measured) for each item, `kept` at least `path` and `reason`, `skipped` the `rule` and `reason` of each rule left out |
72
+ | `in-charge.json` | another tool only; trash-panda never writes it | the signal that a tool is in charge |
73
+ | `setup.json` | `setup` and `remove` only | the saved command and the values setup changed |
74
+ | `lock/owner.json` | the running cleanup | its process id and start time |
75
+ | `update.json` | trash-panda, after each update check and each update | `checkedAt`, `current`, `latest`, `lastResult` (`ok`, `failed` or `none`), `lastAt`, `lastFrom`, `lastTo`, `lastError`, and `autoAt` (the last automatic attempt) |
76
+ | `metrics-id`, `metrics-daily` | trash-panda, only while metrics are on | the random install id, and the time of the last daily report |
77
+ | `update/lock/owner.json` | the running update | its process id and start time |
78
+
79
+ ### `settings.json`
80
+
81
+ Every key has a default. An unknown key or a bad value is refused by name, its default is used,
82
+ and preview turns on. Nothing is deleted because of a bad file.
83
+
84
+ | Key | Default | Meaning |
85
+ |---|---|---|
86
+ | `preview` | `true` | Every start only reports. trash-panda never sets it to `false` by itself. It cannot tell you from another program that runs as you, such as a Claude session, which can set it with `config` or by writing the file. |
87
+ | `lowMarkPct` | `20` | Free space below this percent is low. |
88
+ | `criticalMarkPct` | `10` | Free space below this percent is critical. Always under `lowMarkPct`. |
89
+ | `triggers.lowDisk.on` | `true` | Start when free space is below the low mark. |
90
+ | `triggers.schedule.on` | `true` | Start on a schedule. |
91
+ | `triggers.schedule.everySec` | `3600` | Seconds between scheduled starts (60 to 604800). |
92
+ | `triggers.sessionStart.on` | `true` | Start when a Claude session starts. |
93
+ | `tickSec` | `300` | Seconds between ticks of the launchd job (60 to 86400). |
94
+ | `onCritical` | `null` | A command list, first a full path, to run when space is still critical after a cleanup. |
95
+ | `onCriticalTimeoutSec` | `60` | The script is stopped after this many seconds (1 to 3600). |
96
+ | `repoRoots` | `[]` | Full paths of folders whose repositories are searched for worktrees. |
97
+ | `testDirs` | `[]` | Folders whose `<pid>-*` children are test folders. |
98
+ | `moduleCacheDirs` | `[]` | Folders whose hash-named children are shared package caches. |
99
+ | `tempPrefixes` | `[]` | Starts of the names in the macOS user temp folder that may go when old. Never empty, never with a slash. |
100
+ | `tempMinAgeDays` | `7` | An entry goes only when the birth and last change of it, and of everything inside it, are older (1 to 3650). |
101
+ | `tempBatchSize` | `2000` | Entries in one batch (1 to 100000). |
102
+ | `tempBatchPauseSec` | `30` | Seconds between two batches (1 to 3600). |
103
+ | `tempMaxBatches` | `20` | Batches in one run; the next run goes on (1 to 1000). |
104
+ | `tempStopFseventsdMb` | `300` | Before each batch, a pass stops when fseventsd, the macOS file-event service, uses more MB than this, or when that cannot be read (1 to 100000). |
105
+ | `autoUpdate` | `false` | Update by itself, at most once a day. Only the person turns it on. |
106
+ | `metrics` | `false` | Share anonymous metrics, as [telemetry.md](telemetry.md) lists. Only the person turns it on. |
107
+
108
+ Temp entries run last in a cleanup. An entry stays while a process has a file open in it or it holds a
109
+ `<pid>-*` child of a running process; open files are read once just before each batch, and a failed read stops
110
+ the pass. A link is removed as a link. The summary gives, for each prefix, how many went of how many match by
111
+ name, with the entries in the folder at the start and the end and fseventsd's memory before each batch; no size
112
+ and no line for each entry. A preview shows what one run would take. A pass holds the run lock, pauses included.
113
+
114
+ Low disk: after a run that leaves space low, the next low-disk start waits until free space falls
115
+ one more point (`lowDiskWaitPct` in `live.json`), or rises above the low mark and falls again.
116
+
117
+ Critical: after a cleanup that leaves space under the critical mark, the summary and `live.json` say so.
118
+ `onCritical` runs once for each fall below the mark, as the user, also in preview, with
119
+ `TRASH_PANDA_FREE_GB` and `TRASH_PANDA_FREE_PCT` set. A new fall counts only after space rose above the mark.
120
+
121
+ ### `history.jsonl` and `events.jsonl`
122
+
123
+ Every record stays on this machine. `history.jsonl`, `events.jsonl` and `errors.jsonl` are each capped:
124
+ at 1 MB the file becomes `<name>.1`, which replaces the older one, and a new file starts. Read both.
125
+ A line from an older version has fewer keys and still counts.
126
+
127
+ A `history.jsonl` line has the keys of `last` in `live.json`, then:
128
+
129
+ | Key | Meaning |
130
+ |---|---|
131
+ | `session` | only on a `sessionStart` line: the session's title when the person set one, else its folder's name, or null. It is in no other file. |
132
+ | `freeBefore`, `freeAfter` | free bytes before and after the run, or null |
133
+ | `kinds` | per kind (`worktrees`, `records`, `rebuildables`, `caches`, `scratch`, `tests`, `chrome`, `uv`, `playwright`, `temp`): `items` removed (in preview, what would go) and `freedBytes` (0 in preview, and always 0 for `temp`, whose sizes are not read), listed by size |
134
+ | `kept` | the ten most common reasons items were kept, each `reason` and `count`, without paths or numbers |
135
+ | `errors` | how many removals failed |
136
+
137
+ An `events.jsonl` line has `at`, `mark` (`low` or `critical`), `to` (`under` or `back`), `markPct`, `freeBytes`,
138
+ `freePct` and, on `back`, `underSec`. Each tick and each run looks, so a fall counts even when no run starts.
139
+
140
+ ### `in-charge.json`
141
+
142
+ Replace it in one atomic step (write a temporary file in the same folder, then rename it):
143
+
144
+ ```json
145
+ {"format": 1, "tool": "example-tool", "pid": 4242, "at": "2026-12-01T09:00:00.000Z", "ttlSec": 300}
146
+ ```
147
+
148
+ `ttlSec` is a whole number from 10 to 3600. While `at` is newer than `ttlSec` seconds and process `pid`
149
+ runs, the automatic triggers wait. A stale signal is read again after 15 seconds before a trigger starts,
150
+ so a wake from sleep is not a stop. trash-panda never writes this file and never changes a switch because of it.
151
+ The tool in charge starts cleanups itself with `live.json`'s `command` and `run --by <tool>`.
152
+
153
+ ### `live.json`
154
+
155
+ See `examples/live.json` in the package. Keys:
156
+
157
+ | Key | Meaning |
158
+ |---|---|
159
+ | `format` | `1` |
160
+ | `at` | when this file was written |
161
+ | `preview` | whether starts only report |
162
+ | `state` | `idle` or `running` |
163
+ | `disk` | `freeBytes`, `totalBytes`, `freePct` (null when unknown) |
164
+ | `marks` | `lowPct`, `criticalPct` |
165
+ | `triggers` | `lowDisk`, `schedule`, `sessionStart`: each switch |
166
+ | `everySec` | the schedule's seconds |
167
+ | `run` | the running cleanup (`by`, `only`, `startedAt`, `item`, `freedBytes`), or null |
168
+ | `last` | the last finished run (`by`, `only`, `startedAt`, `finishedAt`, `preview`, `removed`, `freedBytes`, `critical`), or null |
169
+ | `lastFullStartAt` | the start of the last run without `--only` |
170
+ | `nextRunAt` | the next scheduled start, or null when the schedule is off |
171
+ | `lowDiskWaitPct` | null when low disk does not wait; else it starts again only below this percent |
172
+ | `inCharge` | the tool in charge, or null |
173
+ | `command` | the Node path and the command file that `setup` saved, or null when not set up |
174
+
175
+ `by` is a trigger name, `hand`, or the tool that started the run. A time that is not known is null.
176
+ Every copy that writes `live.json` keeps the saved `command`, never its own path, so only one version cleans.
177
+
178
+ ## The launchd job and the hook
179
+
180
+ `setup` writes `~/Library/LaunchAgents/io.github.trash-panda.tick.plist`: `StartInterval` is `tickSec`,
181
+ there is no `KeepAlive`, `PATH` is set, and it runs one Node by its full path. The job and the
182
+ session-start hook end quietly when that Node or the command file is gone. `setup` and `remove` never
183
+ replace another hook or a setting the person has, and doing either twice changes nothing more.
184
+
185
+ `app on` writes the Mac app's login item, `~/Library/LaunchAgents/io.github.trash-panda.app.plist`, which
186
+ opens `Trash Panda.app` (from `/Applications` or `~/Applications`) at login. `app off` removes that file
187
+ only. Neither touches the job, the hook or a setting, so the engine runs the same with the app off.
188
+
189
+ `setup` also sets `worktree.symlinkDirectories` to `["node_modules"]` in a repository's
190
+ `.claude/settings.local.json`, only when the repository has a committed `package.json` and lockfile, a root
191
+ `node_modules` folder, no process or job that uses its main checkout, and a committed `.gitignore` line
192
+ `node_modules` or `/node_modules`. A value the person set is never changed.
193
+
194
+ ## Updates
195
+
196
+ After a command a person runs in a terminal, a bordered notice names the new version and
197
+ `trash-panda update` when npm has a newer one. The check runs in the background at most once a day
198
+ and no command waits for it. There is no notice and no check when the output is not a terminal, with
199
+ `--json`, after `tick`, `session-start` or `update`, or when `NO_UPDATE_NOTIFIER` or `CI` is set. A
200
+ failed check prints nothing. A failed update shows in the next notice.
201
+
202
+ ![The update notice after a command](update-notice.svg)
203
+
204
+ ![The update notice after a failed update](update-notice-failed.svg)
205
+
206
+ `trash-panda update` reads the newest version and stops when it is the one installed. It installs the
207
+ new version beside the old one and, before it takes the run lock, checks the new copy's version, how it
208
+ reads `settings.json`, and one report-only run, which removes nothing. A new version that would read a
209
+ setting differently is refused. If a cleanup is running, nothing changes. Under the run lock it swaps the
210
+ two copies and, when `setup` was run, runs the new version's `setup` with the saved Node, which brings the
211
+ job, the hook and the safe Claude settings up to date. If any step fails, the old copy, job and hook come
212
+ back and the failure is reported. If the old copy cannot be moved back, it is not deleted, and the message
213
+ names the folder that holds it. An update never writes `settings.json`.
214
+
215
+ With `autoUpdate` on, the launchd job starts the same update in its own process at most once a day,
216
+ also after a failure, and never while a cleanup runs. A copy inside another package's `node_modules`
217
+ never checks or updates; that package does. A copy npm did not install prints how to update it by hand.
218
+
219
+ The notice check, the version read and the install reach one host: the npm registry,
220
+ `registry.npmjs.org` (or the registry your npm config names).
@@ -0,0 +1,7 @@
1
+ {
2
+ "format": 1,
3
+ "tool": "example-tool",
4
+ "pid": 4242,
5
+ "at": "2026-12-01T09:00:00.000Z",
6
+ "ttlSec": 300
7
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "format": 1,
3
+ "at": "2026-12-01T09:05:00.000Z",
4
+ "preview": true,
5
+ "state": "running",
6
+ "disk": { "freeBytes": 85899345920, "totalBytes": 494384795648, "freePct": 17.4 },
7
+ "marks": { "lowPct": 20, "criticalPct": 10 },
8
+ "triggers": { "lowDisk": true, "schedule": true, "sessionStart": true },
9
+ "everySec": 3600,
10
+ "run": { "by": "lowDisk", "only": null, "startedAt": "2026-12-01T09:04:58.000Z", "item": null, "freedBytes": 0 },
11
+ "last": { "by": "schedule", "only": null, "startedAt": "2026-12-01T08:00:01.000Z", "finishedAt": "2026-12-01T08:00:41.000Z", "preview": true, "removed": 3, "freedBytes": 0, "critical": false },
12
+ "lastFullStartAt": "2026-12-01T09:04:58.000Z",
13
+ "nextRunAt": "2026-12-01T10:04:58.000Z",
14
+ "lowDiskWaitPct": null,
15
+ "inCharge": null,
16
+ "command": ["/usr/local/bin/node", "/usr/local/lib/node_modules/@oficiallyakshay/trash-panda/scripts/claude-leftovers-cleanup.mjs"]
17
+ }
package/package.json CHANGED
@@ -1,13 +1,40 @@
1
1
  {
2
2
  "name": "@oficiallyakshay/trash-panda",
3
- "version": "0.0.0-placeholder.0",
4
- "description": "Name reserved. The real package is published from github.com/oficiallyAkshay/trash-panda.",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "Keeps cleaning up after your coding agent so you can go longer, removing only what it can prove is safe; a new setup starts in preview and only reports.",
5
6
  "license": "MIT",
6
7
  "repository": {
7
8
  "type": "git",
8
9
  "url": "git+https://github.com/oficiallyAkshay/trash-panda.git"
9
10
  },
11
+ "bugs": {
12
+ "url": "https://github.com/oficiallyAkshay/trash-panda/issues"
13
+ },
14
+ "homepage": "https://github.com/oficiallyAkshay/trash-panda#readme",
15
+ "bin": {
16
+ "trash-panda": "scripts/claude-leftovers-cleanup.mjs"
17
+ },
10
18
  "files": [
11
- "README.md"
12
- ]
13
- }
19
+ "scripts",
20
+ "src",
21
+ "docs/reference.md",
22
+ "examples",
23
+ "LICENSE"
24
+ ],
25
+ "engines": {
26
+ "node": ">=22"
27
+ },
28
+ "scripts": {
29
+ "test": "node --test"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "provenance": true
34
+ },
35
+ "dependencies": {
36
+ "ink": "8.0.0",
37
+ "react": "19.3.1",
38
+ "update-notifier": "7.3.1"
39
+ }
40
+ }