Commit 6dcf3b5
## The Problem
msgvault already supports remote CLI commands (`stats`, `search`,
`show-message`) against a NAS server. But the TUI—the primary way to
explore your archive—only works locally. If your archive lives on a NAS,
you can't browse it from your laptop.
## What This PR Does
Enables `msgvault tui` to work transparently against a remote server.
When `[remote].url` is configured, the TUI connects to your NAS and
gives you the full browsing experience: aggregate views, drill-down
navigation, search, filtering—everything works identically to local
mode.
```bash
# In config.toml
[remote]
url = "https://nas:8080"
api_key = "your-key"
# Then just run TUI as normal
msgvault tui # Connects to NAS automatically
msgvault tui --local # Force local if needed
```
## Implementation
**Server side:** 6 new API endpoints that expose the `query.Engine`
capabilities needed by the TUI:
- `/api/v1/aggregates` – sender/domain/label/time aggregations
- `/api/v1/aggregates/sub` – drill-down into sub-aggregations
- `/api/v1/messages/filter` – filtered message lists with pagination
- `/api/v1/stats/total` – stats with filter context
- `/api/v1/search/fast` – metadata search (subject, sender, recipient)
- `/api/v1/search/deep` – full-text body search via FTS5
**Client side:** `remote.Engine` implements the full `query.Engine`
interface over HTTP, so the TUI code doesn't change at all—it just gets
a different engine.
**Safety:** Deletion staging and attachment export are disabled in
remote mode. These require local file access and are potentially
destructive, so they're local-only operations.
## Testing
- [x] All handler tests pass (10 new tests for aggregate endpoints)
- [x] Remote engine unit tests pass
- [x] TUI builds with remote support
- [ ] Manual end-to-end testing against NAS
---
Closes #130
---------
Co-authored-by: Wes McKinney <wesmckinn+git@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent bc9e377 commit 6dcf3b5
File tree
22 files changed
+2867
-171
lines changed- cmd/msgvault/cmd
- docs
- internal
- api
- query
- remote
- store
- sync
- tui
22 files changed
+2867
-171
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
66 | 70 | | |
67 | 71 | | |
68 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
| 86 | + | |
86 | 87 | | |
| 88 | + | |
87 | 89 | | |
| 90 | + | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
| 96 | + | |
| 97 | + | |
93 | 98 | | |
94 | 99 | | |
95 | 100 | | |
| |||
125 | 130 | | |
126 | 131 | | |
127 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
128 | 157 | | |
129 | 158 | | |
130 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | | - | |
33 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| 120 | + | |
119 | 121 | | |
120 | 122 | | |
121 | 123 | | |
122 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
123 | 127 | | |
124 | 128 | | |
125 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
126 | 153 | | |
127 | 154 | | |
128 | 155 | | |
| |||
180 | 207 | | |
181 | 208 | | |
182 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
183 | 216 | | |
184 | 217 | | |
185 | 218 | | |
| |||
391 | 424 | | |
392 | 425 | | |
393 | 426 | | |
394 | | - | |
| 427 | + | |
| 428 | + | |
395 | 429 | | |
396 | | - | |
397 | | - | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
398 | 433 | | |
399 | 434 | | |
400 | 435 | | |
| |||
0 commit comments