tidyf 1.0.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) 2025 yafyx
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 ADDED
@@ -0,0 +1,299 @@
1
+ # tidyf
2
+
3
+ AI-powered file organizer CLI using [opencode.ai](https://opencode.ai)
4
+
5
+ ```
6
+ ┌ tidyf
7
+
8
+ ◆ Scanning ~/Downloads...
9
+ │ Found 12 files
10
+
11
+ ◇ Analyzing files with AI...
12
+
13
+ ◆ Organization proposal:
14
+ │ 📄 report-2024.pdf → Documents/Work
15
+ │ 🖼️ screenshot.png → Images/Screenshots
16
+ │ 📦 project.zip → Archives
17
+
18
+ ◆ What would you like to do?
19
+ │ ● Apply all
20
+ │ ○ Select individually
21
+ │ ○ Cancel
22
+
23
+ ```
24
+
25
+ ## Features
26
+
27
+ - **AI-powered organization** - Uses AI to intelligently categorize files based on name, type, and content
28
+ - **Smart categories** - Documents, Images, Videos, Audio, Archives, Code, Applications, and more
29
+ - **Watch mode** - Monitor folders and auto-organize new files
30
+ - **Interactive CLI** - Beautiful terminal UI with confirmation prompts
31
+ - **Customizable rules** - Edit `~/.tidy/rules.md` to customize organization rules
32
+ - **Conflict handling** - Smart handling of duplicate files
33
+ - **Multiple aliases** - Use `tidyf` or `td`
34
+
35
+ ## Installation
36
+
37
+ ### Prerequisites
38
+
39
+ - Node.js >= 18.0.0
40
+ - [OpenCode](https://opencode.ai) installed and authenticated
41
+
42
+ #### Install OpenCode
43
+
44
+ ```bash
45
+ # npm
46
+ npm install -g opencode
47
+
48
+ # or brew
49
+ brew install sst/tap/opencode
50
+ ```
51
+
52
+ Then authenticate:
53
+
54
+ ```bash
55
+ opencode auth
56
+ ```
57
+
58
+ ### Install tidyf
59
+
60
+ ```bash
61
+ # bun (recommended)
62
+ bun install -g tidyf
63
+
64
+ # npm
65
+ npm install -g tidyf
66
+
67
+ # pnpm
68
+ pnpm install -g tidyf
69
+
70
+ # yarn
71
+ yarn global add tidyf
72
+ ```
73
+
74
+ ## Usage
75
+
76
+ ### Organize Files
77
+
78
+ ```bash
79
+ # Organize Downloads folder (default)
80
+ tidyf
81
+
82
+ # Organize specific folder
83
+ tidyf ~/Desktop
84
+
85
+ # Dry run (preview only)
86
+ tidyf -d
87
+
88
+ # Skip confirmation prompts
89
+ tidyf -y
90
+
91
+ # Recursive scan
92
+ tidyf -r
93
+
94
+ # Specify target directory
95
+ tidyf --target ~/Sorted
96
+ ```
97
+
98
+ ### Watch Mode
99
+
100
+ ```bash
101
+ # Watch configured folders
102
+ tidyf watch
103
+
104
+ # Watch specific folder
105
+ tidyf watch ~/Downloads
106
+
107
+ # Auto-apply without confirmation
108
+ tidyf watch --auto
109
+
110
+ # Queue files for batch review
111
+ tidyf watch --queue
112
+
113
+ # Custom delay before processing (ms)
114
+ tidyf watch --delay 5000
115
+ ```
116
+
117
+ ### Configure
118
+
119
+ ```bash
120
+ # Interactive configuration
121
+ tidyf config
122
+ ```
123
+
124
+ ## Configuration
125
+
126
+ On first run, tidyf creates `~/.tidy/` directory with configuration files:
127
+
128
+ ### `~/.tidy/settings.json` - Settings
129
+
130
+ ```json
131
+ {
132
+ "organizer": { "provider": "opencode", "model": "claude-sonnet-4-5" },
133
+ "defaultSource": "~/Downloads",
134
+ "defaultTarget": "~/Documents/Organized",
135
+ "watchEnabled": false,
136
+ "folders": [
137
+ { "sources": ["~/Downloads"], "target": "~/Documents/Organized", "watch": false }
138
+ ],
139
+ "ignore": [".DS_Store", "*.tmp", "*.partial", "*.crdownload"]
140
+ }
141
+ ```
142
+
143
+ ### `~/.tidy/rules.md` - Organization Rules
144
+
145
+ Controls how AI categorizes files. Default includes:
146
+
147
+ - **Documents** - PDFs, Word docs, text files, spreadsheets
148
+ - **Images** - Photos, screenshots, graphics, icons
149
+ - **Videos** - MP4, MOV, AVI, MKV, WEBM
150
+ - **Audio** - MP3, WAV, FLAC, AAC
151
+ - **Archives** - ZIP, RAR, 7Z, TAR
152
+ - **Code** - Source files, project archives
153
+ - **Applications** - DMG, PKG, EXE, installers
154
+
155
+ Edit this file to customize AI behavior for your workflow.
156
+
157
+ ## Commands
158
+
159
+ | Command | Description |
160
+ |---------|-------------|
161
+ | `tidyf [path]` | Organize files in path (default: ~/Downloads) |
162
+ | `tidyf watch [paths...]` | Watch folders for new files |
163
+ | `tidyf config` | Configure models and settings |
164
+
165
+ ## Options
166
+
167
+ ### Organize Options
168
+
169
+ | Option | Description |
170
+ |--------|-------------|
171
+ | `-d, --dry-run` | Preview changes without moving files |
172
+ | `-y, --yes` | Skip confirmation prompts |
173
+ | `-r, --recursive` | Scan subdirectories |
174
+ | `-s, --source <path>` | Source directory to organize |
175
+ | `-t, --target <path>` | Specify target directory |
176
+ | `-m, --model <id>` | Override AI model |
177
+ | `-V, --version` | Show version number |
178
+ | `-h, --help` | Show help |
179
+
180
+ ### Watch Options
181
+
182
+ | Option | Description |
183
+ |--------|-------------|
184
+ | `--auto` | Auto-apply without confirmation |
185
+ | `--queue` | Queue files for batch review |
186
+ | `--delay <ms>` | Debounce delay (default: 3000) |
187
+
188
+ ## How It Works
189
+
190
+ 1. **Scans directory** - Reads file metadata (name, type, size, modified date)
191
+ 2. **Analyzes with AI** - Sends file info to AI with your configured rules
192
+ 3. **Proposes organization** - Shows categorization with confidence levels
193
+ 4. **Confirms with you** - Presents interactive UI for approval
194
+ 5. **Moves files** - Organizes files into target directory structure
195
+
196
+ ## Examples
197
+
198
+ ### Basic Organization
199
+
200
+ ```bash
201
+ $ tidyf ~/Downloads
202
+ ┌ tidyf
203
+
204
+ ◆ Scanning ~/Downloads...
205
+ │ Found 5 files
206
+
207
+ ◇ Analyzing files with AI...
208
+
209
+ ◆ Organization proposal:
210
+ │ 📄 invoice-2024.pdf → Documents/Receipts
211
+ │ 🖼️ vacation-photo.jpg → Images/Photos
212
+ │ 📦 backup.zip → Archives
213
+ │ 🎵 podcast.mp3 → Audio/Podcasts
214
+ │ 💻 installer.dmg → Applications/Installers
215
+
216
+ ◆ Apply these changes?
217
+ │ ● Yes
218
+
219
+ ```
220
+
221
+ ### Watch Mode
222
+
223
+ ```bash
224
+ $ tidyf watch ~/Downloads --auto
225
+ ┌ tidyf watch
226
+
227
+ ◇ Watching directories:
228
+ │ ~/Downloads
229
+
230
+ ◇ Target: ~/Documents/Organized
231
+
232
+ ⚠ Auto mode: Files will be moved without confirmation
233
+
234
+ ◇ Watcher ready
235
+ │ Press Ctrl+C to stop watching
236
+
237
+ │ + 2 new file(s) detected
238
+ │ 📄 document.pdf → Documents
239
+ │ 🖼️ screenshot.png → Images/Screenshots
240
+
241
+ ◇ Moved 2 files
242
+ ```
243
+
244
+ ## Troubleshooting
245
+
246
+ ### "OpenCode CLI is not installed"
247
+
248
+ Install OpenCode first:
249
+
250
+ ```bash
251
+ npm install -g opencode
252
+ # or
253
+ brew install sst/tap/opencode
254
+ ```
255
+
256
+ ### "Not authenticated with OpenCode"
257
+
258
+ Run authentication:
259
+
260
+ ```bash
261
+ opencode auth
262
+ ```
263
+
264
+ ### "Permission denied"
265
+
266
+ Make sure you have write access to both source and target directories.
267
+
268
+ ### Files not being detected
269
+
270
+ Check if the file matches an ignore pattern in `~/.tidy/settings.json`.
271
+
272
+ ## Development
273
+
274
+ ```bash
275
+ # Clone the repo
276
+ git clone https://github.com/yafyx/tidy.git
277
+ cd tidy
278
+
279
+ # Install dependencies
280
+ bun install
281
+
282
+ # Run in development mode
283
+ bun run dev
284
+
285
+ # Build for production
286
+ bun run build
287
+
288
+ # Type check
289
+ bun run typecheck
290
+ ```
291
+
292
+ ## License
293
+
294
+ MIT
295
+
296
+ ## Links
297
+
298
+ - [OpenCode](https://opencode.ai) - AI coding assistant
299
+ - [OpenCode Docs](https://opencode.ai/docs) - Documentation