bookmark 0.1.1

Import, search, and open bookmarks from all browsers
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# Bookmark Manager

A cross-platform Rust CLI tool to import, search, and open bookmarks from all browsers.

## Features

- 🌐 **Multi-Browser Support**: Chrome, Firefox, Safari, Edge, and more
- 🔍 **Instant Search**: Search across all your bookmarks by title or URL
- 🚀 **Quick Open**: Open bookmarks directly in your default browser
- 📊 **Export Support**: Export bookmarks, history, and passwords to structured formats
- 💾 **Multiple Formats**: YAML (primary), JSON and CSV support planned
- 🛡️ **Security-Focused**: Secure handling of sensitive data
- 🚀 **Cross-Platform**: Windows, macOS, and Linux support
-**High Performance**: Efficient handling of large browser databases

## Quick Start

### Installation

```bash
cargo build --release
```

### Basic Usage

```bash
# Search for bookmarks
cargo run -- search --query "github"

# Open a bookmark (first match)
cargo run -- open --query "github" --first

# Open a bookmark (interactive selection)
cargo run -- open --query "github"

# List available browsers
cargo run -- list

# Export bookmarks to YAML
cargo run -- scan --data-type bookmarks --output ./exports
```

## Commands

### `search` - Search across all bookmarks

```bash
# Basic search (searches both title and URL)
cargo run -- search --query "github"

# Search in title only
cargo run -- search --query "github" --title-only

# Search in URL only
cargo run -- search --query "github" --url-only

# Limit results
cargo run -- search --query "github" --limit 10
```

### `open` - Open bookmarks in default browser

```bash
# Open first matching bookmark
cargo run -- open --query "github" --first

# Interactive selection from multiple matches
cargo run -- open --query "github"
```

### `list` - List available browsers and profiles

```bash
# List all browsers
cargo run -- list

# List profiles for specific browser
cargo run -- list --browser chrome
```

### `scan` - Automatically detect and export all browsers

```bash
# Export bookmarks from all detected browsers
cargo run -- scan --data-type bookmarks --output ./exports

# Export history from all detected browsers
cargo run -- scan --data-type history --output ./exports

# Export all data types
cargo run -- scan --data-type all --output ./exports
```

### `dedupe` - Remove duplicate bookmarks

```bash
# Deduplicate bookmarks with merge metadata strategy
cargo run -- dedupe --input ./bookmarks.yaml --output ./deduped.yaml

# Use different merge strategies
cargo run -- dedupe --input ./bookmarks.yaml --output ./deduped.yaml --strategy recent
cargo run -- dedupe --input ./bookmarks.yaml --output ./deduped.yaml --strategy first

# Preview changes without applying them
cargo run -- dedupe --input ./bookmarks.yaml --output ./deduped.yaml --preview

# Create backup of original file
cargo run -- dedupe --input ./bookmarks.yaml --output ./deduped.yaml --backup
```

### `organize` - Organize bookmarks into folders

```bash
# Organize bookmarks using custom rules (default)
cargo run -- organize --input ./bookmarks.yaml --output ./organized.yaml

# Organize by domain only
cargo run -- organize --input ./bookmarks.yaml --output ./organized.yaml --strategy domain

# Organize by category only
cargo run -- organize --input ./bookmarks.yaml --output ./organized.yaml --strategy category

# Organize by date
cargo run -- organize --input ./bookmarks.yaml --output ./organized.yaml --strategy date

# Preserve existing folder structure
cargo run -- organize --input ./bookmarks.yaml --output ./organized.yaml --preserve-existing

# Preview changes without applying them
cargo run -- organize --input ./bookmarks.yaml --output ./organized.yaml --preview
```

### `process` - Complete deduplication and organization

```bash
# Full processing with default settings
cargo run -- process --input ./bookmarks.yaml --output ./processed.yaml

# Custom merge and organization strategies
cargo run -- process --input ./bookmarks.yaml --output ./processed.yaml --merge_strategy recent --organization_strategy domain

# Generate detailed report
cargo run -- process --input ./bookmarks.yaml --output ./processed.yaml --report ./report.md

# Preview changes before applying
cargo run -- process --input ./bookmarks.yaml --output ./processed.yaml --preview

# Use configuration file settings
cargo run -- process --input ./bookmarks.yaml --output ./processed.yaml --config ./my-config.yaml
```

### `config` - Manage configuration

```bash
# Show current configuration
cargo run -- config --show

# Create sample configuration file
cargo run -- config --create-sample ./sample-config.yaml

# Add custom organization rule
cargo run -- config --add-rule '{"name":"Custom Rule","pattern":"example\\.com","folder":"Examples","priority":5}'

# Remove custom organization rule
cargo run -- config --remove-rule "Custom Rule"

# List all custom rules
cargo run -- config --list-rules

# Validate configuration
cargo run -- config --validate

# Use custom config file
cargo run -- config --show --config-file ./my-config.yaml
```

### `export` - Export from specific browser or all browsers

```bash
# Export from all browsers
cargo run -- export --browser all --data-type bookmarks --output ./exports

# Export from specific browser
cargo run -- export --browser chrome --data-type bookmarks --output chrome.yaml

# Export to stdout
cargo run -- export --browser firefox --data-type history
```

## Options

- `--browser`: Browser to export from (chrome, firefox, safari, edge, all)
- `--data-type`: Type of data to export (bookmarks, history, passwords, all)
- `--output`: Output directory or file path (defaults to current directory)
- `--profile-dir`: Custom browser data directory

## Supported Browsers

| Browser | Bookmarks | History | Passwords | Status               |
| ------- | --------- | ------- | --------- | -------------------- |
| Chrome  ||| 🔄        | Basic support        |
| Firefox ||| 🔄        | Basic support        |
| Safari  ||| 🔄        | Manual copy required |
| Edge    ||| 🔄        | Basic support        |
| Brave   | 🔄        | 🔄      | 🔄        | Planned              |
| Vivaldi | 🔄        | 🔄      | 🔄        | Planned              |
| Opera   | 🔄        | 🔄      | 🔄        | Planned              |

_✅ Implemented | 🔄 In Progress | 📋 Planned_

## Safari Manual Export

On macOS, Safari bookmarks are protected. To export Safari bookmarks:

1. Open Finder
2. Press Shift+Command+G
3. Enter: `~/Library/Safari/`
4. Copy `Bookmarks.plist` to your Desktop or Downloads
5. Run: `cargo run -- export --browser safari --profile-dir ~/Desktop/Bookmarks.plist --data-type bookmarks --output safari-bookmarks.yaml`

## Firefox Database Lock

If Firefox is running, close it first or copy the database manually:

```bash
# Copy Firefox database and export from copy
cp ~/Library/Application\ Support/Firefox/Profiles/*/places.sqlite ~/Desktop/places.sqlite
cargo run -- export --browser firefox --profile-dir ~/Desktop/places.sqlite --data-type bookmarks --output firefox-bookmarks.yaml
```

## Output Format

The tool exports data in structured YAML format:

```yaml
- browser: chrome
  profile: Default
  export_date: 2026-02-01T08:04:05.082245Z
  bookmarks:
    - id: "4316"
      title: CRM Analytics | Salesforce
      url: https://ibmsc.lightning.force.com/analytics/dashboard/0FK3h000000dENLGA2
      folder: bookmark_bar/ibm
      date_added: 2026-01-28T01:16:01Z
      children: null
  history:
    urls:
      - url: https://example.com
        title: Example Page
        visit_count: 42
        last_visit: 2026-01-30T15:30:00Z
  passwords: null
```

## Performance

- **Memory Usage**: < 512MB for typical browser databases
- **Export Speed**: Complete browser export in < 30 seconds
- **Database Size**: Handles databases up to 1GB efficiently
- **Concurrent Exports**: Multiple browsers processed in parallel (planned)

## Security

- 🔒 **Read-Only Access**: Never modifies original browser data
- 🛡️ **Secure Handling**: No plaintext passwords in logs or temporary files
- 🔑 **Platform Integration**: Uses OS keychain APIs for password decryption
- 🚫 **No Telemetry**: All data processing is local and private

## Requirements

- Rust 1.70+
- Operating Systems:
  - macOS 10.15+
  - Windows 10+
  - Linux (Ubuntu 20.04+, Fedora 36+, Debian 11+)

## Examples

### Search and Open Bookmarks

```bash
# Search for GitHub repositories
cargo run -- search --query "github"

# Open GitHub homepage directly
cargo run -- open --query "github.com" --first

# Search for documentation bookmarks
cargo run -- search --query "docs" --title-only --limit 15
```

### Export all data from all browsers

```bash
cargo run -- scan --data-type all --output ./browser-exports
```

### Export specific data types

```bash
# Bookmarks only
cargo run -- scan --data-type bookmarks --output ./bookmarks

# History only
cargo run -- scan --data-type history --output ./history
```

### Export from custom profile directory

```bash
cargo run -- export --browser chrome --profile-dir "/custom/path/profile" --data-type bookmarks
```

## Development

### Build

```bash
cargo build --release
```

### Test

```bash
cargo test
```

### Run with debug logging

```bash
RUST_LOG=debug cargo run -- scan
```

## Documentation

- [📋 TODO List]TODO.md - Development roadmap and tasks
- [📖 Technical Specification]SPEC.md - Detailed technical requirements
- [🏗️ Architecture]ARCHITECTURE.md - System design and implementation

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests
5. Submit a pull request

## License

This project is licensed under the MIT License.

## Troubleshooting

### Common Issues

1. **"database is locked"**: Close the target browser before exporting
2. **"Operation not permitted"**: Grant appropriate permissions (Safari on macOS)
3. **"No browsers found"**: Check if browsers are installed in standard locations

### Getting Help

- Check the [TODO.md]TODO.md for known issues
- Review the [ARCHITECTURE.md]ARCHITECTURE.md for technical details
- Open an issue for bugs or feature requests

## Bookmark Deduplication & Organization

### Deduplication Features

The bookmark manager now includes advanced deduplication capabilities:

- **URL Normalization**: Automatically normalizes URLs by ignoring protocols, www subdomains, query parameters, and fragments
- **Smart Merging**: Multiple merge strategies to handle duplicate bookmarks:
  - `first`: Keep the first occurrence
  - `last`: Keep the last occurrence  
  - `recent`: Keep the most recently added bookmark
  - `frequent`: Keep the bookmark with the most common title
  - `merge`: Combine metadata from all duplicates (default)
- **Similarity Detection**: Finds potential duplicates using URL pattern analysis

### Organization Features

Intelligent bookmark organization with multiple strategies:

- **Custom Rules**: Predefined rules for common categories (Social, Development, Shopping, News, etc.)
- **Domain-based**: Organizes bookmarks by website domain
- **Category-based**: Uses content analysis to categorize bookmarks
- **Date-based**: Groups bookmarks by creation date
- **Preserve Existing**: Option to maintain existing folder structure while adding new organization

### Advanced Processing

The `process` command combines both deduplication and organization:

```bash
# Complete workflow: export → dedupe → organize
cargo run -- scan --data-type bookmarks --output ./raw.yaml
cargo run -- process --input ./raw.yaml --output ./clean.yaml --report ./report.md
```

## Roadmap

### v0.2.0 - Enhanced Search & UI ✅ COMPLETED

- ✅ Fuzzy search functionality
- ✅ Bookmark tags and categories
- 🔄 Interactive TUI interface (in progress)
- 🔄 Keyboard shortcuts (in progress)

### v0.3.0 - Advanced Features ✅ COMPLETED

- 🔄 Password export from all browsers (in progress)
- 🔄 Brave and Vivaldi browser support (planned)
- 🔄 JSON and CSV export formats (planned)
- ✅ Bookmark deduplication
- 🔄 Web-based interface (planned)

### v1.0.0 - Production Release

- Full browser ecosystem support
- Comprehensive testing suite
- Production-ready stability
- Complete documentation