inboxd 1.0.13 → 1.2.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/.claude/skills/inbox-assistant/SKILL.md +89 -78
- package/CLAUDE.md +47 -32
- package/README.md +32 -32
- package/package.json +3 -3
- package/scripts/postinstall.js +5 -5
- package/src/archive-log.js +104 -0
- package/src/cli.js +496 -41
- package/src/deletion-log.js +101 -0
- package/src/gmail-auth.js +1 -1
- package/src/gmail-monitor.js +29 -0
- package/src/sent-log.js +35 -0
- package/tests/archive-log.test.js +196 -0
- package/tests/cleanup-suggest.test.js +239 -0
- package/tests/filter.test.js +1 -1
- package/tests/install-service.test.js +210 -0
- package/tests/interactive-confirm.test.js +175 -0
- package/tests/json-output.test.js +189 -0
- package/tests/older-than.test.js +1 -1
- package/tests/setup.test.js +1 -1
- package/tests/stats.test.js +218 -0
- package/tests/unarchive.test.js +228 -0
|
@@ -113,7 +113,7 @@ When a user has a heavy inbox (>20 unread emails), use this optimized workflow:
|
|
|
113
113
|
### 1. Quick Assessment
|
|
114
114
|
|
|
115
115
|
```bash
|
|
116
|
-
|
|
116
|
+
inboxd summary --json
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
Identify which account(s) have the bulk of unread emails.
|
|
@@ -123,7 +123,7 @@ Identify which account(s) have the bulk of unread emails.
|
|
|
123
123
|
For heavy inboxes, **always start with grouped analysis**:
|
|
124
124
|
|
|
125
125
|
```bash
|
|
126
|
-
|
|
126
|
+
inboxd analyze --count 100 --account <name> --group-by sender
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
This reveals:
|
|
@@ -163,7 +163,7 @@ Delete all LinkedIn job alerts and old newsletters?
|
|
|
163
163
|
For cleanup of old emails, use server-side filtering:
|
|
164
164
|
|
|
165
165
|
```bash
|
|
166
|
-
|
|
166
|
+
inboxd analyze --older-than 30d --group-by sender
|
|
167
167
|
```
|
|
168
168
|
|
|
169
169
|
Old emails (>30 days) are usually safe to batch delete:
|
|
@@ -198,15 +198,15 @@ Unread count?
|
|
|
198
198
|
|
|
199
199
|
| Task | Command |
|
|
200
200
|
|------|---------|
|
|
201
|
-
| Check status | `
|
|
202
|
-
| Full triage | `
|
|
203
|
-
| Analyze by sender | `
|
|
204
|
-
| Find old emails | `
|
|
205
|
-
| Extract links from email | `
|
|
206
|
-
| Delete by ID | `
|
|
207
|
-
| Delete by sender | `
|
|
208
|
-
| Delete by subject | `
|
|
209
|
-
| Undo deletion | `
|
|
201
|
+
| Check status | `inboxd summary --json` |
|
|
202
|
+
| Full triage | `inboxd analyze --count 50` → classify → present |
|
|
203
|
+
| Analyze by sender | `inboxd analyze --count 50 --group-by sender` |
|
|
204
|
+
| Find old emails | `inboxd analyze --older-than 30d` |
|
|
205
|
+
| Extract links from email | `inboxd read --id <id> --links` |
|
|
206
|
+
| Delete by ID | `inboxd delete --ids "id1,id2" --confirm` |
|
|
207
|
+
| Delete by sender | `inboxd delete --sender "linkedin" --dry-run` → confirm → delete |
|
|
208
|
+
| Delete by subject | `inboxd delete --match "weekly digest" --dry-run` |
|
|
209
|
+
| Undo deletion | `inboxd restore --last N` |
|
|
210
210
|
|
|
211
211
|
## Package Information
|
|
212
212
|
|
|
@@ -214,7 +214,7 @@ Unread count?
|
|
|
214
214
|
|---|---|
|
|
215
215
|
| **Package** | `inboxd` |
|
|
216
216
|
| **Install** | `npm install -g inboxd` |
|
|
217
|
-
| **Setup** | `
|
|
217
|
+
| **Setup** | `inboxd setup` (interactive wizard) |
|
|
218
218
|
| **Documentation** | https://github.com/dparedesi/inboxd |
|
|
219
219
|
| **npm** | https://www.npmjs.com/package/inboxd |
|
|
220
220
|
|
|
@@ -224,10 +224,10 @@ Before any inbox operation, always verify the setup:
|
|
|
224
224
|
|
|
225
225
|
```bash
|
|
226
226
|
# 1. Check if inboxd is installed
|
|
227
|
-
|
|
227
|
+
inboxd --version
|
|
228
228
|
|
|
229
229
|
# 2. Check if accounts are configured
|
|
230
|
-
|
|
230
|
+
inboxd accounts
|
|
231
231
|
```
|
|
232
232
|
|
|
233
233
|
## Account Management
|
|
@@ -235,24 +235,24 @@ inbox accounts
|
|
|
235
235
|
### Adding New Accounts
|
|
236
236
|
If the user wants to add an account (e.g. "add my work email"):
|
|
237
237
|
```bash
|
|
238
|
-
|
|
239
|
-
# Example:
|
|
238
|
+
inboxd auth -a <name>
|
|
239
|
+
# Example: inboxd auth -a work
|
|
240
240
|
```
|
|
241
241
|
|
|
242
242
|
### Listing Accounts
|
|
243
243
|
```bash
|
|
244
|
-
|
|
244
|
+
inboxd accounts
|
|
245
245
|
```
|
|
246
246
|
|
|
247
247
|
### Removing Accounts
|
|
248
248
|
```bash
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
inboxd logout -a <name> # Remove specific account
|
|
250
|
+
inboxd logout --all # Remove all accounts
|
|
251
251
|
```
|
|
252
252
|
|
|
253
253
|
### Re-authenticating (Token Expired)
|
|
254
254
|
```bash
|
|
255
|
-
rm ~/.config/inboxd/token-<account>.json &&
|
|
255
|
+
rm ~/.config/inboxd/token-<account>.json && inboxd auth -a <account>
|
|
256
256
|
```
|
|
257
257
|
|
|
258
258
|
### If Not Installed
|
|
@@ -264,7 +264,7 @@ rm ~/.config/inboxd/token-<account>.json && inbox auth -a <account>
|
|
|
264
264
|
inboxd is not installed. To install:
|
|
265
265
|
|
|
266
266
|
1. Run: npm install -g inboxd
|
|
267
|
-
2. Run:
|
|
267
|
+
2. Run: inboxd setup
|
|
268
268
|
3. Follow the wizard to configure your Gmail account
|
|
269
269
|
|
|
270
270
|
The setup requires creating OAuth credentials in Google Cloud Console.
|
|
@@ -272,7 +272,7 @@ The setup requires creating OAuth credentials in Google Cloud Console.
|
|
|
272
272
|
|
|
273
273
|
### If No Accounts Configured
|
|
274
274
|
```
|
|
275
|
-
No Gmail accounts configured. Run:
|
|
275
|
+
No Gmail accounts configured. Run: inboxd setup
|
|
276
276
|
|
|
277
277
|
This will guide you through:
|
|
278
278
|
1. Creating OAuth credentials in Google Cloud Console
|
|
@@ -281,22 +281,22 @@ This will guide you through:
|
|
|
281
281
|
|
|
282
282
|
### Optional: Automatic Background Monitoring
|
|
283
283
|
|
|
284
|
-
Users can enable automatic inbox checking with
|
|
284
|
+
Users can enable automatic inbox checking with notifications:
|
|
285
285
|
|
|
286
286
|
```bash
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
inboxd install-service # Check every 5 minutes
|
|
288
|
+
inboxd install-service --interval 10 # Check every 10 minutes
|
|
289
|
+
inboxd install-service --uninstall # Remove service
|
|
289
290
|
```
|
|
290
291
|
|
|
291
292
|
This installs and starts a background service that:
|
|
292
293
|
- Checks for new emails automatically
|
|
293
|
-
- Sends
|
|
294
|
+
- Sends desktop notifications when new emails arrive
|
|
294
295
|
- Starts on login
|
|
295
296
|
|
|
296
|
-
To stop: `launchctl unload ~/Library/LaunchAgents/com.
|
|
297
|
+
**macOS:** Uses launchd. To stop: `launchctl unload ~/Library/LaunchAgents/com.danielparedes.inboxd.plist`
|
|
297
298
|
|
|
298
|
-
|
|
299
|
-
> This is macOS-only. Linux users can set up a cron job instead.
|
|
299
|
+
**Linux:** Uses systemd. To stop: `systemctl --user stop inboxd.timer`
|
|
300
300
|
|
|
301
301
|
## Command Reference
|
|
302
302
|
|
|
@@ -304,34 +304,43 @@ To stop: `launchctl unload ~/Library/LaunchAgents/com.yourname.inboxd.plist`
|
|
|
304
304
|
|
|
305
305
|
| Command | Description | Output |
|
|
306
306
|
|---------|-------------|--------|
|
|
307
|
-
| `
|
|
308
|
-
| `
|
|
309
|
-
| `
|
|
310
|
-
| `
|
|
311
|
-
| `
|
|
312
|
-
| `
|
|
313
|
-
| `
|
|
314
|
-
| `
|
|
315
|
-
| `
|
|
316
|
-
| `
|
|
317
|
-
| `
|
|
307
|
+
| `inboxd summary --json` | Quick inbox overview | `{accounts: [{name, email, unreadCount}], totalUnread}` |
|
|
308
|
+
| `inboxd analyze --count 50` | Get email data for analysis | JSON array of email objects |
|
|
309
|
+
| `inboxd analyze --count 50 --all` | Include read emails | JSON array (read + unread) |
|
|
310
|
+
| `inboxd analyze --since 7d` | Only emails from last 7 days | JSON array (filtered by date) |
|
|
311
|
+
| `inboxd analyze --older-than 30d` | Only emails older than 30 days | JSON array (server-side filtered) |
|
|
312
|
+
| `inboxd analyze --group-by sender` | Group emails by sender domain | `{groups: [{sender, count, emails}], totalCount}` |
|
|
313
|
+
| `inboxd read --id <id>` | Read full email content | Email headers + body |
|
|
314
|
+
| `inboxd read --id <id> --links` | Extract links from email | List of URLs with optional link text |
|
|
315
|
+
| `inboxd read --id <id> --links --json` | Extract links as JSON | `{id, subject, from, linkCount, links}` |
|
|
316
|
+
| `inboxd search -q "query"` | Search using Gmail query syntax | JSON array of matching emails |
|
|
317
|
+
| `inboxd accounts` | List configured accounts | Account names and emails |
|
|
318
318
|
|
|
319
319
|
### Actions
|
|
320
320
|
|
|
321
321
|
| Command | Description |
|
|
322
322
|
|---------|-------------|
|
|
323
|
-
| `
|
|
324
|
-
| `
|
|
325
|
-
| `
|
|
326
|
-
| `
|
|
327
|
-
| `
|
|
328
|
-
| `
|
|
329
|
-
| `
|
|
330
|
-
| `
|
|
331
|
-
| `
|
|
332
|
-
| `
|
|
333
|
-
| `
|
|
334
|
-
| `
|
|
323
|
+
| `inboxd delete --ids "id1,id2,id3" --confirm` | Move emails to trash by ID |
|
|
324
|
+
| `inboxd delete --sender "pattern" --dry-run` | Preview deletion by sender filter |
|
|
325
|
+
| `inboxd delete --match "pattern" --dry-run` | Preview deletion by subject filter |
|
|
326
|
+
| `inboxd delete --sender "X" --match "Y" --confirm` | Delete by combined filters (AND) |
|
|
327
|
+
| `inboxd delete --sender "X" --limit 100 --confirm` | Override 50-email safety limit |
|
|
328
|
+
| `inboxd delete --sender "ab" --force --confirm` | Override short-pattern warning |
|
|
329
|
+
| `inboxd restore --last N` | Restore last N deleted emails |
|
|
330
|
+
| `inboxd restore --ids "id1,id2"` | Restore specific emails |
|
|
331
|
+
| `inboxd mark-read --ids "id1,id2"` | Mark emails as read (remove UNREAD label) |
|
|
332
|
+
| `inboxd mark-unread --ids "id1,id2"` | Mark emails as unread (add UNREAD label) |
|
|
333
|
+
| `inboxd archive --ids "id1,id2" --confirm` | Archive emails (remove from inbox, keep in All Mail) |
|
|
334
|
+
| `inboxd unarchive --last N` | Undo last N archived emails |
|
|
335
|
+
| `inboxd unarchive --ids "id1,id2"` | Unarchive specific emails |
|
|
336
|
+
| `inboxd stats` | Show email activity dashboard (deletions, sent counts) |
|
|
337
|
+
| `inboxd stats --days 7 --json` | Get stats as JSON for custom period |
|
|
338
|
+
| `inboxd cleanup-suggest` | Get smart cleanup suggestions based on deletion patterns |
|
|
339
|
+
| `inboxd deletion-log` | View recent deletions |
|
|
340
|
+
| `inboxd deletion-log --json` | Get deletion log as JSON |
|
|
341
|
+
| `inboxd accounts --json` | List accounts as JSON |
|
|
342
|
+
| `inboxd delete --dry-run --json` | Preview deletion as structured JSON |
|
|
343
|
+
| `inboxd restore --json` | Get restore results as JSON |
|
|
335
344
|
|
|
336
345
|
### Smart Filtering Options
|
|
337
346
|
|
|
@@ -396,7 +405,7 @@ You have 5 emails from LinkedIn. Delete them all?
|
|
|
396
405
|
|
|
397
406
|
### 1. Check Inbox Status
|
|
398
407
|
```bash
|
|
399
|
-
|
|
408
|
+
inboxd summary --json
|
|
400
409
|
```
|
|
401
410
|
Report the total unread count and per-account breakdown.
|
|
402
411
|
|
|
@@ -434,7 +443,7 @@ Want me to triage that first?
|
|
|
434
443
|
|
|
435
444
|
### 3. Fetch Emails for Analysis
|
|
436
445
|
```bash
|
|
437
|
-
|
|
446
|
+
inboxd analyze --count 50 --account <name>
|
|
438
447
|
```
|
|
439
448
|
Parse the JSON output and classify each email.
|
|
440
449
|
|
|
@@ -536,7 +545,7 @@ Confirm deletion? (y/n)
|
|
|
536
545
|
|
|
537
546
|
Only after explicit user confirmation:
|
|
538
547
|
```bash
|
|
539
|
-
|
|
548
|
+
inboxd delete --ids "id1,id2,id3,..." --account <name> --confirm
|
|
540
549
|
```
|
|
541
550
|
|
|
542
551
|
### 8. Confirm & Remind About Undo
|
|
@@ -545,7 +554,7 @@ After deletion:
|
|
|
545
554
|
```
|
|
546
555
|
Deleted 8 emails.
|
|
547
556
|
|
|
548
|
-
To undo: `
|
|
557
|
+
To undo: `inboxd restore --last 8`
|
|
549
558
|
```
|
|
550
559
|
|
|
551
560
|
---
|
|
@@ -589,12 +598,14 @@ When user has job-related emails (LinkedIn, Indeed, recruiters) and wants to eva
|
|
|
589
598
|
| "Delete all from [sender]" | Bulk sender cleanup | `--sender "X" --dry-run` → confirm → `--ids` |
|
|
590
599
|
| "Delete [sender]'s emails" | Bulk sender cleanup | Two-step pattern with `--sender` filter |
|
|
591
600
|
| "Delete the security emails" | Subject-based cleanup | `--match "security" --dry-run` → confirm → `--ids` |
|
|
592
|
-
| "What senders have the most emails?" | Inbox analysis | `
|
|
593
|
-
| "
|
|
594
|
-
| "
|
|
601
|
+
| "What senders have the most emails?" | Inbox analysis | `inboxd analyze --group-by sender` |
|
|
602
|
+
| "Show my email stats" | Activity summary | `inboxd stats` |
|
|
603
|
+
| "What should I clean up?" | Pattern analysis | `inboxd cleanup-suggest` |
|
|
604
|
+
| "What links are in this email?" | Extract URLs | `inboxd read --id <id> --links` |
|
|
605
|
+
| "Find my old emails" / "Clean up old stuff" | Stale email review | `inboxd analyze --older-than 30d` |
|
|
595
606
|
| "I keep getting these" | Recurring annoyance | Suggest unsubscribe/filter, then delete batch |
|
|
596
607
|
| "Check [specific account]" | Single-account focus | Skip other accounts entirely |
|
|
597
|
-
| "Undo" / "Restore" | Recover deleted emails | `
|
|
608
|
+
| "Undo" / "Restore" | Recover deleted emails | `inboxd restore --last N` |
|
|
598
609
|
| "What are these companies?" | Research job/opportunity emails | Fetch websites, assess legitimacy |
|
|
599
610
|
| "Research these job opportunities" | Job alert evaluation | Job Research workflow (see below) |
|
|
600
611
|
|
|
@@ -609,11 +620,11 @@ When user has job-related emails (LinkedIn, Indeed, recruiters) and wants to eva
|
|
|
609
620
|
1. **NEVER auto-delete** - Always confirm before deletion, but adapt confirmation style to batch size
|
|
610
621
|
2. **NEVER delete Action Required emails** - Surface them, let user decide
|
|
611
622
|
3. **NEVER delete without --confirm flag** - Command will hang otherwise
|
|
612
|
-
4. **Always remind about undo** - After every deletion, mention `
|
|
623
|
+
4. **Always remind about undo** - After every deletion, mention `inboxd restore --last N`
|
|
613
624
|
|
|
614
625
|
### State Change Safety
|
|
615
626
|
5. **Confirm before mark-read** - Marking as read can hide important emails. Confirm batch operations (3+ emails)
|
|
616
|
-
6. **Remind about mark-unread undo** - After mark-read, mention: "To undo: `
|
|
627
|
+
6. **Remind about mark-unread undo** - After mark-read, mention: "To undo: `inboxd mark-unread --ids \"id1,id2\"`"
|
|
617
628
|
7. **Confirm before archive** - Archiving removes emails from inbox view. Always use `--confirm` flag
|
|
618
629
|
8. **Never batch mark-read silently** - Show what will be marked read before executing
|
|
619
630
|
|
|
@@ -625,9 +636,9 @@ When user has job-related emails (LinkedIn, Indeed, recruiters) and wants to eva
|
|
|
625
636
|
### Undo Commands Reference
|
|
626
637
|
| Action | Undo Command |
|
|
627
638
|
|--------|--------------|
|
|
628
|
-
| Deleted emails | `
|
|
629
|
-
| Marked as read | `
|
|
630
|
-
| Archived |
|
|
639
|
+
| Deleted emails | `inboxd restore --last N` |
|
|
640
|
+
| Marked as read | `inboxd mark-unread --ids "id1,id2,..."` |
|
|
641
|
+
| Archived | `inboxd unarchive --last N` |
|
|
631
642
|
|
|
632
643
|
---
|
|
633
644
|
|
|
@@ -636,13 +647,13 @@ When user has job-related emails (LinkedIn, Indeed, recruiters) and wants to eva
|
|
|
636
647
|
> [!IMPORTANT]
|
|
637
648
|
> **ALWAYS use this pattern for filter-based deletions.** Filters are for DISCOVERY. IDs are for EXECUTION.
|
|
638
649
|
|
|
639
|
-
This pattern prevents accidental mass deletion. When user says "delete LinkedIn emails", never run `
|
|
650
|
+
This pattern prevents accidental mass deletion. When user says "delete LinkedIn emails", never run `inboxd delete --sender "linkedin" --confirm` directly—it could delete hundreds of emails.
|
|
640
651
|
|
|
641
652
|
### The Pattern
|
|
642
653
|
|
|
643
654
|
1. **Discover** - Find what matches the filter
|
|
644
655
|
```bash
|
|
645
|
-
|
|
656
|
+
inboxd delete --sender "linkedin" --dry-run
|
|
646
657
|
```
|
|
647
658
|
Output shows emails that would be deleted, plus IDs for programmatic use.
|
|
648
659
|
|
|
@@ -659,7 +670,7 @@ This pattern prevents accidental mass deletion. When user says "delete LinkedIn
|
|
|
659
670
|
|
|
660
671
|
3. **Execute** - Delete with explicit IDs (from dry-run output)
|
|
661
672
|
```bash
|
|
662
|
-
|
|
673
|
+
inboxd delete --ids "id1,id2,id3,id4,id5" --confirm
|
|
663
674
|
```
|
|
664
675
|
|
|
665
676
|
### When to Use Each Approach
|
|
@@ -683,20 +694,20 @@ This pattern prevents accidental mass deletion. When user says "delete LinkedIn
|
|
|
683
694
|
|
|
684
695
|
❌ **Bad agent behavior:**
|
|
685
696
|
```bash
|
|
686
|
-
|
|
697
|
+
inboxd delete --sender "linkedin" --confirm # Deletes ALL LinkedIn emails!
|
|
687
698
|
```
|
|
688
699
|
|
|
689
700
|
✅ **Good agent behavior:**
|
|
690
701
|
```bash
|
|
691
702
|
# Step 1: Find LinkedIn emails
|
|
692
|
-
|
|
703
|
+
inboxd analyze --count 20
|
|
693
704
|
# Sees: 3 LinkedIn emails - job alert, connection request, message
|
|
694
705
|
|
|
695
706
|
# Step 2: Identify the specific one by subject
|
|
696
707
|
# (job alert has subject containing "jobs for you")
|
|
697
708
|
|
|
698
709
|
# Step 3: Delete precisely
|
|
699
|
-
|
|
710
|
+
inboxd delete --ids "18e9abc" --confirm # Just the job alert
|
|
700
711
|
```
|
|
701
712
|
|
|
702
713
|
### Ambiguity Handling
|
|
@@ -740,7 +751,7 @@ I've classified your emails. Here's the breakdown:
|
|
|
740
751
|
- 8 LinkedIn alerts (deleted)
|
|
741
752
|
- 27 remaining
|
|
742
753
|
|
|
743
|
-
Done! To undo deletions:
|
|
754
|
+
Done! To undo deletions: inboxd restore --last 8
|
|
744
755
|
```
|
|
745
756
|
|
|
746
757
|
**Good (plan-first approach):**
|
|
@@ -808,7 +819,7 @@ If the user encounters a bug, friction point, or suggests a feature:
|
|
|
808
819
|
| Listing 50 emails individually | Overwhelming, wastes time | Summarize by category for large batches |
|
|
809
820
|
| Suggesting deletion of "Re:" emails | Often important replies | Classify as Action Required |
|
|
810
821
|
| Batching >20 emails without summary | Hard to verify what's being deleted | Show category breakdown |
|
|
811
|
-
| Skipping pre-flight check | Tool may not be installed | Always run `
|
|
822
|
+
| Skipping pre-flight check | Tool may not be installed | Always run `inboxd --version` first |
|
|
812
823
|
| Forgetting `--account` flag | Ambiguity errors with multi-account | Always specify account |
|
|
813
824
|
| Being passive after actions | User has to drive every step | Proactively suggest next step |
|
|
814
825
|
| Executing mark-read on batch without confirmation | User loses unread status on important emails | Confirm 3+ emails, always mention undo |
|
|
@@ -834,10 +845,10 @@ If the user encounters a bug, friction point, or suggests a feature:
|
|
|
834
845
|
|
|
835
846
|
| Problem | Solution |
|
|
836
847
|
|---------|----------|
|
|
837
|
-
| `command not found:
|
|
838
|
-
| "No accounts configured" | Run: `
|
|
839
|
-
| Token expired / auth errors | Delete token and re-auth: `rm ~/.config/inboxd/token-<account>.json &&
|
|
840
|
-
| Permission errors on delete | Re-authenticate: `
|
|
848
|
+
| `command not found: inboxd` | Run: `npm install -g inboxd` |
|
|
849
|
+
| "No accounts configured" | Run: `inboxd setup` |
|
|
850
|
+
| Token expired / auth errors | Delete token and re-auth: `rm ~/.config/inboxd/token-<account>.json && inboxd auth -a <account>` |
|
|
851
|
+
| Permission errors on delete | Re-authenticate: `inboxd logout -a <account> && inboxd auth -a <account>` |
|
|
841
852
|
|
|
842
853
|
---
|
|
843
854
|
|
package/CLAUDE.md
CHANGED
|
@@ -7,11 +7,11 @@ CLI tool for Gmail monitoring with multi-account support and macOS notifications
|
|
|
7
7
|
```bash
|
|
8
8
|
npm test # Run tests
|
|
9
9
|
npm run test:watch # Watch mode
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
inboxd setup # First-time setup wizard
|
|
11
|
+
inboxd auth -a <name> # Add account
|
|
12
|
+
inboxd summary # Check all inboxes
|
|
13
|
+
inboxd check -q # Background check
|
|
14
|
+
inboxd install-service # Install background service (macOS/Linux)
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Architecture
|
|
@@ -20,9 +20,10 @@ inbox install-service # Install launchd service (macOS only)
|
|
|
20
20
|
src/
|
|
21
21
|
├── cli.js # Entry point, command definitions (commander)
|
|
22
22
|
├── gmail-auth.js # OAuth2 flow, token storage, multi-account management
|
|
23
|
-
├── gmail-monitor.js # Gmail API: fetch, count, trash, restore
|
|
23
|
+
├── gmail-monitor.js # Gmail API: fetch, count, trash, restore, archive
|
|
24
24
|
├── state.js # Tracks seen emails per account
|
|
25
25
|
├── deletion-log.js # Logs deleted emails for restore capability
|
|
26
|
+
├── archive-log.js # Logs archived emails for unarchive capability
|
|
26
27
|
├── sent-log.js # Logs sent emails for audit trail
|
|
27
28
|
├── notifier.js # macOS notifications (node-notifier)
|
|
28
29
|
└── skill-installer.js # Copies skill to ~/.claude/skills/
|
|
@@ -54,6 +55,7 @@ All user data lives in `~/.config/inboxd/`:
|
|
|
54
55
|
| `token-<name>.json` | OAuth refresh/access tokens |
|
|
55
56
|
| `state-<name>.json` | `{ seenEmailIds, lastCheck, lastNotifiedAt }` |
|
|
56
57
|
| `deletion-log.json` | Audit log for deleted emails |
|
|
58
|
+
| `archive-log.json` | Audit log for archived emails |
|
|
57
59
|
| `sent-log.json` | Audit log for sent emails |
|
|
58
60
|
|
|
59
61
|
## Code Patterns
|
|
@@ -66,11 +68,14 @@ All user data lives in `~/.config/inboxd/`:
|
|
|
66
68
|
|
|
67
69
|
## Key Behaviors
|
|
68
70
|
|
|
69
|
-
- `
|
|
70
|
-
- `
|
|
71
|
-
- `
|
|
72
|
-
- `
|
|
73
|
-
- `
|
|
71
|
+
- `inboxd setup` guides first-time users through credentials and auth
|
|
72
|
+
- `inboxd check` marks emails as seen after notifying
|
|
73
|
+
- `inboxd delete` logs to `deletion-log.json` before trashing
|
|
74
|
+
- `inboxd restore` moves from Trash to Inbox, removes log entry
|
|
75
|
+
- `inboxd archive` logs to `archive-log.json` before archiving
|
|
76
|
+
- `inboxd unarchive` moves archived emails back to Inbox, removes log entry
|
|
77
|
+
- `inboxd send/reply` prompts for interactive confirmation (or use `--confirm` to skip)
|
|
78
|
+
- `install-service` creates and enables launchd (macOS) or systemd (Linux) service
|
|
74
79
|
|
|
75
80
|
## OAuth Notes
|
|
76
81
|
|
|
@@ -116,11 +121,11 @@ Traditional CLIs are for humans. Agent-ready CLIs add:
|
|
|
116
121
|
The skill can be installed globally for all Claude Code sessions:
|
|
117
122
|
|
|
118
123
|
```bash
|
|
119
|
-
|
|
120
|
-
|
|
124
|
+
inboxd install-skill # Install to ~/.claude/skills/
|
|
125
|
+
inboxd install-skill --uninstall # Remove
|
|
121
126
|
```
|
|
122
127
|
|
|
123
|
-
The `
|
|
128
|
+
The `inboxd setup` wizard also offers to install the skill automatically.
|
|
124
129
|
|
|
125
130
|
### Skill Location & Update Detection
|
|
126
131
|
|
|
@@ -131,7 +136,7 @@ The `inbox setup` wizard also offers to install the skill automatically.
|
|
|
131
136
|
|
|
132
137
|
The skill uses content-hash detection (no version field). Updates are detected automatically:
|
|
133
138
|
- On `npm install`: Auto-updates if skill already installed
|
|
134
|
-
- Manual: Run `
|
|
139
|
+
- Manual: Run `inboxd install-skill` to update
|
|
135
140
|
|
|
136
141
|
Safety features:
|
|
137
142
|
- `source: inboxd` marker identifies ownership (won't overwrite user's own skills)
|
|
@@ -154,22 +159,31 @@ scripts/postinstall.js # npm postinstall hint about install-skill
|
|
|
154
159
|
### Key Commands for AI Use
|
|
155
160
|
| Command | Purpose |
|
|
156
161
|
|---------|---------|
|
|
157
|
-
| `
|
|
158
|
-
| `
|
|
159
|
-
| `
|
|
160
|
-
| `
|
|
161
|
-
| `
|
|
162
|
-
| `
|
|
163
|
-
| `
|
|
164
|
-
| `
|
|
165
|
-
| `
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
170
|
-
| `
|
|
171
|
-
| `
|
|
172
|
-
| `
|
|
162
|
+
| `inboxd summary --json` | Quick status check (unread counts) |
|
|
163
|
+
| `inboxd analyze --count 50` | Get email data as JSON for classification |
|
|
164
|
+
| `inboxd analyze --group-by sender` | Group emails by sender domain |
|
|
165
|
+
| `inboxd analyze --older-than 30d` | Find emails older than 30 days (server-side filtering) |
|
|
166
|
+
| `inboxd delete --ids "id1,id2" --confirm` | Delete specific emails by ID |
|
|
167
|
+
| `inboxd delete --sender "pattern" --dry-run` | Preview deletion by sender filter |
|
|
168
|
+
| `inboxd delete --match "pattern" --dry-run` | Preview deletion by subject filter |
|
|
169
|
+
| `inboxd restore --last N` | Undo last N deletions |
|
|
170
|
+
| `inboxd read --id <id>` | Read full email content |
|
|
171
|
+
| `inboxd read --id <id> --links` | Extract links from email |
|
|
172
|
+
| `inboxd search -q <query>` | Search using Gmail query syntax |
|
|
173
|
+
| `inboxd send -t <to> -s <subj> -b <body> --confirm` | Send email (requires --confirm) |
|
|
174
|
+
| `inboxd reply --id <id> -b <body> --confirm` | Reply to email (requires --confirm) |
|
|
175
|
+
| `inboxd mark-read --ids "id1,id2"` | Mark emails as read |
|
|
176
|
+
| `inboxd mark-unread --ids "id1,id2"` | Mark emails as unread (undo mark-read) |
|
|
177
|
+
| `inboxd archive --ids "id1,id2" --confirm` | Archive emails (remove from inbox) |
|
|
178
|
+
| `inboxd unarchive --last N` | Undo last N archives |
|
|
179
|
+
| `inboxd stats` | Show email activity dashboard (deletions, sent) |
|
|
180
|
+
| `inboxd stats --json` | Get stats as JSON |
|
|
181
|
+
| `inboxd cleanup-suggest` | Get smart cleanup suggestions based on patterns |
|
|
182
|
+
| `inboxd accounts --json` | List accounts as JSON |
|
|
183
|
+
| `inboxd deletion-log --json` | Get deletion log as JSON |
|
|
184
|
+
| `inboxd delete --dry-run --json` | Preview deletion as JSON |
|
|
185
|
+
| `inboxd install-skill` | Install/update the Claude Code skill |
|
|
186
|
+
| `inboxd install-service --uninstall` | Remove background service |
|
|
173
187
|
|
|
174
188
|
### Smart Filtering Options
|
|
175
189
|
| Option | Description |
|
|
@@ -182,8 +196,9 @@ scripts/postinstall.js # npm postinstall hint about install-skill
|
|
|
182
196
|
|
|
183
197
|
### Send/Reply Safety
|
|
184
198
|
The `send` and `reply` commands have built-in safety features:
|
|
199
|
+
- **Interactive confirmation**: Prompts "Send this email? (y/N)" when no flags provided
|
|
185
200
|
- **`--dry-run`**: Preview the email without sending
|
|
186
|
-
- **`--confirm`**:
|
|
201
|
+
- **`--confirm`**: Skip the interactive prompt (for automation/scripts)
|
|
187
202
|
- **Audit logging**: All sent emails are logged to `~/.config/inboxd/sent-log.json`
|
|
188
203
|
- **Account resolution**: Prompts for account selection when multiple accounts exist
|
|
189
204
|
|