@rayhanadev/katto 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 +22 -0
- package/README.md +186 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +518 -0
- package/dist/index.mjs.map +1 -0
- package/dist/sdk-JYaqBNlb.mjs +422 -0
- package/dist/sdk-JYaqBNlb.mjs.map +1 -0
- package/dist/sdk.d.mts +71 -0
- package/dist/sdk.d.mts.map +1 -0
- package/dist/sdk.mjs +2 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 Rayhan Noufal Arayilakath
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# katto
|
|
2
|
+
|
|
3
|
+
Fast interactive cleanup for generated dependency and build folders.
|
|
4
|
+
|
|
5
|
+
`katto` is a Bun-powered terminal UI for finding large disposable folders like `node_modules` and deleting them safely. It is inspired by `npkill`, but focuses on a fast pruned scanner, Bun-native filesystem APIs, and an OpenTUI interface.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Finds target folders such as `node_modules` without descending into them.
|
|
10
|
+
- Skips symlink traversal to avoid loops in unusual package trees.
|
|
11
|
+
- Sorts by size by default.
|
|
12
|
+
- Locks selection until scan and metadata are complete.
|
|
13
|
+
- Deletes with guarded target-name checks.
|
|
14
|
+
- Supports JSON output for scripts and automation.
|
|
15
|
+
- Built with Bun and OpenTUI.
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
18
|
+
|
|
19
|
+
- Bun 1.3 or newer
|
|
20
|
+
- macOS, Linux, or another platform with Bun and Node-compatible filesystem APIs
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
bun install -g katto
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
For local development:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
cd katto
|
|
32
|
+
bun install
|
|
33
|
+
bun run dev
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
katto
|
|
40
|
+
katto -d ~/Projects
|
|
41
|
+
katto -t node_modules,.next,dist
|
|
42
|
+
katto --json --no-size
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## TUI Controls
|
|
46
|
+
|
|
47
|
+
| Key | Action |
|
|
48
|
+
| ----------- | --------------------- |
|
|
49
|
+
| `j`, `down` | Move down |
|
|
50
|
+
| `k`, `up` | Move up |
|
|
51
|
+
| `d` | Delete selected entry |
|
|
52
|
+
| `D` | Delete all entries |
|
|
53
|
+
| `s` | Cycle sort mode |
|
|
54
|
+
| `r` | Rescan |
|
|
55
|
+
| `q`, `esc` | Quit |
|
|
56
|
+
|
|
57
|
+
Selection and deletion are disabled until scanning and metadata collection finish.
|
|
58
|
+
|
|
59
|
+
## CLI Options
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
Usage
|
|
63
|
+
katto [directory] [options]
|
|
64
|
+
|
|
65
|
+
Options
|
|
66
|
+
-d, --directory Root directory to scan. Defaults to cwd.
|
|
67
|
+
-f, --full Scan from your home directory.
|
|
68
|
+
-t, --targets Comma-separated folder names. Default: node_modules.
|
|
69
|
+
-E, --exclude Comma-separated names or paths to prune.
|
|
70
|
+
-x, --exclude-sensitive Skip common sensitive/cache roots.
|
|
71
|
+
-D, --delete-all Delete every match after scanning.
|
|
72
|
+
-y, --yes Skip delete-all confirmation.
|
|
73
|
+
--dry-run Simulate deletion.
|
|
74
|
+
--json Print final JSON instead of the TUI.
|
|
75
|
+
--json-stream Print one JSON object per found folder.
|
|
76
|
+
--no-size Skip size calculation for maximum scan speed.
|
|
77
|
+
--no-stats Alias for --no-size.
|
|
78
|
+
-s, --sort Sort by found, size, path, or age. Default: size.
|
|
79
|
+
--size-strategy Size calculation: auto, native, js, or none.
|
|
80
|
+
--size-unit Display unit: auto, mb, gb, or bytes.
|
|
81
|
+
-v, --version Show version.
|
|
82
|
+
-h, --help Show help.
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## JSON Output
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
katto --json -d ~/Projects
|
|
89
|
+
katto --json-stream --no-size -d ~/Projects
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`--json` prints one final object with `stats` and `results`. `--json-stream` prints one JSON object per result as entries are found.
|
|
93
|
+
|
|
94
|
+
## Size Strategy
|
|
95
|
+
|
|
96
|
+
`--size-strategy auto` is the default. It uses native `du` sizing when available and falls back to the portable JS walker on systems without `du`.
|
|
97
|
+
|
|
98
|
+
- `native` is fastest on macOS/Linux.
|
|
99
|
+
- `js` avoids native commands and uses Bun filesystem APIs.
|
|
100
|
+
- `none` skips size calculation, equivalent to `--no-size`.
|
|
101
|
+
|
|
102
|
+
## SDK
|
|
103
|
+
|
|
104
|
+
`katto` also exposes a Bun-compatible SDK. Importing the package does not start the CLI.
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import { Katto } from "katto";
|
|
108
|
+
|
|
109
|
+
const katto = new Katto({
|
|
110
|
+
root: "~/Projects",
|
|
111
|
+
targets: ["node_modules", ".next", "dist"],
|
|
112
|
+
sizeStrategy: "auto",
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const entries = await katto.scan();
|
|
116
|
+
const largest = katto.sort(entries, "size");
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Delete APIs are available too:
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
import { Katto } from "katto";
|
|
123
|
+
|
|
124
|
+
const katto = new Katto({ dryRun: true });
|
|
125
|
+
const entries = await katto.scan();
|
|
126
|
+
|
|
127
|
+
for (const entry of entries) {
|
|
128
|
+
await katto.deleteEntry(entry);
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
For progress updates, use the explicit progress API:
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
for await (const { phase, entry, stats } of katto.scanWithProgress()) {
|
|
136
|
+
if (phase === "found") console.log(`found ${entry.path}`);
|
|
137
|
+
console.log(`${stats.found} matches`);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const entries = katto.entries;
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Exports:
|
|
144
|
+
|
|
145
|
+
- `Katto`
|
|
146
|
+
- `Entry`, `Options`, `KattoOptions`, `ScanProgress`, `Stats`, `SortMode`, `SizeStrategy`, `SizeUnit` types
|
|
147
|
+
|
|
148
|
+
## Safety Notes
|
|
149
|
+
|
|
150
|
+
`katto` only deletes folders whose basename matches one of the configured targets. By default that target is `node_modules`.
|
|
151
|
+
|
|
152
|
+
Use `--dry-run` to preview delete flows:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
katto -D --dry-run
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Development
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
bun install
|
|
162
|
+
bun run dev
|
|
163
|
+
bun run build
|
|
164
|
+
bun run check
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Useful scripts:
|
|
168
|
+
|
|
169
|
+
- `bun run dev` runs the TypeScript entry directly.
|
|
170
|
+
- `bun run build` bundles the CLI into `dist/`.
|
|
171
|
+
- `bun run check` runs typecheck and lint.
|
|
172
|
+
- `bun run format` formats the project.
|
|
173
|
+
|
|
174
|
+
## Release
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
bun run check
|
|
178
|
+
bun run build
|
|
179
|
+
npm pack --dry-run
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Publishing should run `prepack`, which rebuilds `dist/` before the package is packed.
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
MIT
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|