flowsquire 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/README.md ADDED
@@ -0,0 +1,258 @@
1
+ # FlowSquire
2
+
3
+ A local-first automation platform for organizing files on your computer. No cloud, no AI, no subscriptions — just simple WHEN → DO workflows.
4
+
5
+ ## Features
6
+
7
+ - **File Watching**: Automatically organize files as they appear
8
+ - **Smart PDF Workflow**: Sort PDFs by keywords (invoice, bank, notes, etc.) with automatic compression
9
+ - **Downloads Organizer**: Sort images, videos, music, archives, documents, installers, and code files
10
+ - **Screenshot Organizer**: Organize screenshots by app, website domain, and date (macOS)
11
+ - **Priority-Based Rules**: Higher priority rules execute first
12
+ - **Dry-Run Mode**: Preview actions before executing
13
+ - **PDF Compression**: Automatically compress large PDFs (>8MB)
14
+ - **Interactive Setup**: Guided wizard for first-time configuration
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install -g flowsquire-agent
20
+ ```
21
+
22
+ ### Prerequisites
23
+
24
+ **Ghostscript** (required for PDF compression):
25
+
26
+ ```bash
27
+ # macOS
28
+ brew install ghostscript
29
+
30
+ # Ubuntu/Debian
31
+ sudo apt-get install ghostscript
32
+
33
+ # Windows
34
+ # Download from https://www.ghostscript.com/download/gsdnld.html
35
+ ```
36
+
37
+ > Note: Without Ghostscript, PDF compression will fail, but all other features work normally.
38
+
39
+ ## Quick Start
40
+
41
+ ```bash
42
+ # Run interactive setup wizard
43
+ flowsquire init
44
+
45
+ # Start the file watcher
46
+ flowsquire start
47
+
48
+ # Or with dry-run (preview only)
49
+ flowsquire start --dry-run
50
+ ```
51
+
52
+ ### Interactive Setup
53
+
54
+ During `flowsquire init`, you'll be asked:
55
+
56
+ 1. **Watch folder** — Where to watch for new files (default: ~/Downloads)
57
+ 2. **Documents folder** — Where to organize documents (default: ~/Documents)
58
+ 3. **Screenshots folder** — Where screenshots are saved (default: ~/Downloads/Screenshots)
59
+ 4. **Downloads organizer mode**:
60
+ - `nested` — Organize inside Downloads subfolders (Images/, Videos/, etc.)
61
+ - `system` — Move to system folders (Pictures/, Movies/, Music/, etc.)
62
+ 5. **Screenshot organizer mode**:
63
+ - `metadata` — Organize by App/Domain (macOS only)
64
+ - `by-app` — Organize by App name only
65
+ - `by-date` — Organize by date (works on all platforms)
66
+
67
+ ## Templates
68
+
69
+ ### PDF Workflow (5 rules)
70
+
71
+ Automatically organizes PDFs based on filename and size:
72
+
73
+ | Priority | Rule | Condition | Nested Mode Destination | System Mode Destination |
74
+ |----------|------|-----------|------------------------|------------------------|
75
+ | 500 | Large PDF Compression | > 8MB | `~/Downloads/PDFs/Compressed/` | `~/Documents/PDFs/Compressed/` |
76
+ | 400 | Invoice Organizer | name contains "invoice" | `~/Downloads/PDFs/Invoices/` | `~/Documents/PDFs/Invoices/` |
77
+ | 300 | Bank Statement | name contains "bank" | `~/Downloads/PDFs/Finance/` | `~/Documents/PDFs/Finance/` |
78
+ | 200 | Study Notes | name contains "notes" | `~/Downloads/PDFs/Study/` | `~/Documents/PDFs/Study/` |
79
+ | 100 | Default | any PDF | `~/Downloads/PDFs/Unsorted/` | `~/Documents/PDFs/Unsorted/` |
80
+
81
+ **Features:**
82
+ - Cross-platform Ghostscript support (macOS/Linux: `gs`, Windows: `gswin64c`)
83
+ - Quality levels: screen (low), ebook (medium), printer (high)
84
+ - Date pattern support: `{filename}_{YYYY}-{MM}-{DD}`
85
+
86
+ ### Downloads Organizer (7 rules)
87
+
88
+ Sorts non-PDF files by type:
89
+
90
+ | Type | Extensions | Nested Mode Destination | System Mode Destination |
91
+ |------|------------|------------------------|------------------------|
92
+ | Images | jpg, jpeg, png, gif, webp, svg | `~/Downloads/Images/` | `~/Pictures/Downloads/` |
93
+ | Videos | mp4, mov, avi, mkv | `~/Downloads/Videos/` | `~/Movies/` |
94
+ | Music | mp3, wav, flac, aac | `~/Downloads/Music/` | `~/Music/` |
95
+ | Archives | zip, rar, 7z, tar, gz | `~/Downloads/Archives/` | `~/Documents/Archives/` |
96
+ | Documents | doc, docx, txt, rtf, xls, xlsx, ppt, pptx | `~/Downloads/Documents/` | `~/Documents/Documents/` |
97
+ | Installers | dmg, pkg, exe, msi | `~/Downloads/Installers/` | `~/Documents/Installers/` |
98
+ | Code | js, ts, jsx, tsx, py, rb, go, rs, java, cpp, c, h | `~/Downloads/Code/` | `~/Documents/Code/` |
99
+
100
+ ### Screenshot Organizer
101
+
102
+ Organizes screenshots based on your chosen mode:
103
+
104
+ **Metadata Mode** (macOS only, requires Accessibility permissions):
105
+ - Organizes by: `AppName/Domain/{filename}_{date}_{time}.png`
106
+ - Example: `Google Chrome/aistudio.google.com/SCR-2026-02-01_16-41.png`
107
+ - Captures: foreground app, browser URL, window title
108
+
109
+ **By App Mode**:
110
+ - Organizes by: `AppName/{filename}.png`
111
+ - Example: `Google Chrome/SCR-20260201-ornd.png`
112
+
113
+ **By Date Mode** (works on all platforms):
114
+ - Organizes by: `Year/Month/{filename}.png`
115
+ - Example: `2026/February/SCR-20260201-ornd.png`
116
+
117
+ > **Note:** On non-macOS platforms, metadata mode falls back to by-date automatically.
118
+
119
+ ## CLI Commands
120
+
121
+ ```bash
122
+ flowsquire init # Interactive setup wizard
123
+ flowsquire start # Start file watcher
124
+ flowsquire start --dry-run # Preview mode (no actual changes)
125
+ flowsquire rules # List all rules
126
+ flowsquire config # Show all configured paths and settings
127
+ flowsquire config --<key> <value> # Set a config value
128
+ flowsquire config --<key> # Get a config value
129
+ ```
130
+
131
+ ### Config Options
132
+
133
+ **Path Settings:**
134
+ - `--downloads <path>` — Watch folder for new files
135
+ - `--documents <path>` — Documents organization folder
136
+ - `--screenshots <path>` — Screenshots folder
137
+ - `--pictures <path>` — Pictures folder
138
+ - `--videos <path>` — Videos/Movies folder
139
+ - `--music <path>` — Music folder
140
+
141
+ **Mode Settings:**
142
+ - `--downloads-mode <nested|system>` — Downloads organizer mode
143
+ - `--screenshot-mode <metadata|by-app|by-date>` — Screenshot organizer mode
144
+
145
+ **Examples:**
146
+ ```bash
147
+ flowsquire config --downloads ~/Downloads
148
+ flowsquire config --downloads-mode system
149
+ flowsquire config --screenshot-mode by-date
150
+ ```
151
+
152
+ > **Note:** After changing modes, delete rules and re-run `flowsquire init` to regenerate rules.
153
+
154
+ ## Rule Structure
155
+
156
+ Rules are stored in `.flowsquire/rules.json`:
157
+
158
+ ```json
159
+ {
160
+ "id": "...",
161
+ "name": "My Rule",
162
+ "enabled": true,
163
+ "priority": 100,
164
+ "tags": ["pdf", "invoice"],
165
+ "trigger": {
166
+ "type": "file_created",
167
+ "config": { "folder": "/Users/me/Downloads" }
168
+ },
169
+ "conditions": [
170
+ { "type": "extension", "operator": "equals", "value": "pdf" },
171
+ { "type": "name_contains", "operator": "equals", "value": "invoice" }
172
+ ],
173
+ "actions": [
174
+ {
175
+ "type": "move",
176
+ "config": {
177
+ "destination": "/Users/me/Documents/Invoices",
178
+ "pattern": "{filename}_{YYYY}-{MM}-{DD}",
179
+ "createDirs": true
180
+ }
181
+ }
182
+ ]
183
+ }
184
+ ```
185
+
186
+ ## Condition Types
187
+
188
+ - `extension` — File extension (e.g., "pdf", "jpg")
189
+ - `name_contains` — Filename contains text (case-insensitive)
190
+ - `name_starts_with` — Filename starts with text
191
+ - `name_ends_with` — Filename ends with text
192
+ - `size_greater_than_mb` — File size in MB
193
+
194
+ ## Action Types
195
+
196
+ - `move` — Move file to destination
197
+ - `copy` — Copy file to destination
198
+ - `rename` — Rename file
199
+ - `compress` — Compress PDF (requires Ghostscript)
200
+
201
+ ## Pattern Placeholders
202
+
203
+ **Date/Time:**
204
+ - `{filename}` — Original filename without extension
205
+ - `{YYYY}` — Year (2026)
206
+ - `{MM}` — Month number (01-12)
207
+ - `{Month}` — Month name (January, February, etc.)
208
+ - `{DD}` — Day (01-31)
209
+ - `{HH}` — Hour (00-23)
210
+ - `{mm}` — Minute (00-59)
211
+ - `{ss}` — Second (00-59)
212
+
213
+ **Screenshot Metadata** (macOS only):
214
+ - `{app}` — Foreground application name (e.g., "Google Chrome")
215
+ - `{domain}` — Website domain (e.g., "github.com")
216
+
217
+ ## Development
218
+
219
+ ```bash
220
+ # Clone repo
221
+ git clone <repo-url>
222
+ cd flowsquire
223
+
224
+ # Install dependencies
225
+ npm install
226
+
227
+ # Build
228
+ npm run build
229
+
230
+ # Run in dev mode
231
+ npm run dev
232
+
233
+ # Test
234
+ npm test
235
+ ```
236
+
237
+ ## Architecture
238
+
239
+ ```
240
+ ┌─────────────┐ ┌──────────────┐ ┌─────────────┐
241
+ │ CLI │────▶│ File Watcher│────▶│ Rule Engine│
242
+ │ (cli.ts) │ │ (chokidar) │ │ │
243
+ └─────────────┘ └──────────────┘ └──────┬──────┘
244
+
245
+ ┌──────────────┐ │
246
+ │ Actions │◀───────┘
247
+ │ (move/copy/ │
248
+ │ compress) │
249
+ └──────────────┘
250
+ ```
251
+
252
+ ## License
253
+
254
+ MIT
255
+
256
+ ## Philosophy
257
+
258
+ Your computer should work for you. Not the other way around.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}