@kyoji2/raindrop-cli 0.1.1
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 +225 -0
- package/dist/index.js +20438 -0
- package/package.json +63 -0
- package/src/api/client.ts +509 -0
- package/src/api/index.ts +2 -0
- package/src/api/schemas.ts +125 -0
- package/src/api/types.ts +74 -0
- package/src/commands/auth.ts +58 -0
- package/src/commands/batch.ts +50 -0
- package/src/commands/collections.ts +257 -0
- package/src/commands/index.ts +27 -0
- package/src/commands/overview.ts +95 -0
- package/src/commands/raindrops.ts +157 -0
- package/src/commands/tags.ts +40 -0
- package/src/index.ts +454 -0
- package/src/utils/config.ts +114 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/output.ts +37 -0
- package/src/utils/spinner.ts +35 -0
- package/src/utils/tempfile.ts +6 -0
package/README.md
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# raindrop-cli
|
|
2
|
+
|
|
3
|
+
AI-native CLI for Raindrop.io. Built with TypeScript and Bun.
|
|
4
|
+
|
|
5
|
+
Designed for AI agents and automation scripts. **TOON** format for maximum token efficiency, with optional JSON output for standard integrations.
|
|
6
|
+
|
|
7
|
+
## Key Features
|
|
8
|
+
|
|
9
|
+
- **AI-Native:** Outputs TOON format by default to save on context tokens
|
|
10
|
+
- **Situation Reports:** High-level `context` command for a quick "state of the world" overview
|
|
11
|
+
- **Hierarchy Support:** Create, move, and manage nested collections
|
|
12
|
+
- **Batch Operations:** Bulk update or delete bookmarks efficiently
|
|
13
|
+
- **Dry Run Mode:** Safe account management with `--dry-run` flag
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Clone and install
|
|
19
|
+
git clone <repo>
|
|
20
|
+
cd raindrop-cli
|
|
21
|
+
bun install
|
|
22
|
+
|
|
23
|
+
# Run directly
|
|
24
|
+
bun run src/index.ts --help
|
|
25
|
+
|
|
26
|
+
# Or link globally
|
|
27
|
+
bun link
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
1. **Get your API Token**
|
|
33
|
+
|
|
34
|
+
Get a test token from https://app.raindrop.io/settings/integrations
|
|
35
|
+
|
|
36
|
+
2. **Login** (Verifies token before saving)
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
bun run src/index.ts login
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
3. **Account Overview** (The agent "situation report")
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
bun run src/index.ts context
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Usage Examples
|
|
49
|
+
|
|
50
|
+
### Authentication
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Login with your API token
|
|
54
|
+
raindrop login
|
|
55
|
+
|
|
56
|
+
# Check current user
|
|
57
|
+
raindrop whoami
|
|
58
|
+
|
|
59
|
+
# Logout
|
|
60
|
+
raindrop logout
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Overview Commands
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Get high-level account context
|
|
67
|
+
raindrop context
|
|
68
|
+
|
|
69
|
+
# List all collections and tags
|
|
70
|
+
raindrop structure
|
|
71
|
+
|
|
72
|
+
# Get API schema (for AI context)
|
|
73
|
+
raindrop schema
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Bookmark Management
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Search bookmarks (TOON format - default)
|
|
80
|
+
raindrop search "python"
|
|
81
|
+
|
|
82
|
+
# Search with pretty table output
|
|
83
|
+
raindrop search "python" --pretty
|
|
84
|
+
|
|
85
|
+
# Search in JSON format
|
|
86
|
+
raindrop search "python" --format json
|
|
87
|
+
|
|
88
|
+
# Get bookmark details
|
|
89
|
+
raindrop get 123456
|
|
90
|
+
|
|
91
|
+
# Add a new bookmark
|
|
92
|
+
raindrop add "https://example.com" --title "Example" --tags "work,reference"
|
|
93
|
+
|
|
94
|
+
# Update a bookmark with JSON patch
|
|
95
|
+
raindrop patch 123456 '{"title": "New Title", "tags": ["updated"]}'
|
|
96
|
+
|
|
97
|
+
# Delete a bookmark
|
|
98
|
+
raindrop delete 123456
|
|
99
|
+
|
|
100
|
+
# Get tag suggestions for a bookmark
|
|
101
|
+
raindrop suggest 123456
|
|
102
|
+
|
|
103
|
+
# Check Wayback Machine for a URL
|
|
104
|
+
raindrop wayback "https://example.com"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Collection Management
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Create a collection
|
|
111
|
+
raindrop collection create "Research"
|
|
112
|
+
|
|
113
|
+
# Create a public collection with parent
|
|
114
|
+
raindrop collection create "AI Papers" --parent 123 --public
|
|
115
|
+
|
|
116
|
+
# Get collection details
|
|
117
|
+
raindrop collection get 123
|
|
118
|
+
|
|
119
|
+
# Update a collection
|
|
120
|
+
raindrop collection update 123 '{"title": "New Name"}'
|
|
121
|
+
|
|
122
|
+
# Delete a collection
|
|
123
|
+
raindrop collection delete 123
|
|
124
|
+
|
|
125
|
+
# Delete multiple collections
|
|
126
|
+
raindrop collection delete-multiple 123,456,789
|
|
127
|
+
|
|
128
|
+
# Reorder collections
|
|
129
|
+
raindrop collection reorder title
|
|
130
|
+
raindrop collection reorder -count
|
|
131
|
+
|
|
132
|
+
# Expand/collapse all collections
|
|
133
|
+
raindrop collection expand-all true
|
|
134
|
+
|
|
135
|
+
# Merge collections
|
|
136
|
+
raindrop collection merge 123,456 789
|
|
137
|
+
|
|
138
|
+
# Remove empty collections
|
|
139
|
+
raindrop collection clean
|
|
140
|
+
|
|
141
|
+
# Empty trash
|
|
142
|
+
raindrop collection empty-trash
|
|
143
|
+
|
|
144
|
+
# Set collection cover from URL
|
|
145
|
+
raindrop collection cover 123 "https://example.com/image.png"
|
|
146
|
+
|
|
147
|
+
# Set collection icon by search
|
|
148
|
+
raindrop collection set-icon 123 "robot"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Tag Management
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Delete tags globally
|
|
155
|
+
raindrop tag delete "old-tag" "useless-tag"
|
|
156
|
+
|
|
157
|
+
# Delete tags from specific collection
|
|
158
|
+
raindrop tag delete "old-tag" --collection 123
|
|
159
|
+
|
|
160
|
+
# Rename a tag
|
|
161
|
+
raindrop tag rename "work" "career"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Batch Operations
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Update multiple bookmarks
|
|
168
|
+
raindrop batch update --ids 1,2,3 '{"tags": ["archived"]}'
|
|
169
|
+
|
|
170
|
+
# Move multiple bookmarks to a collection
|
|
171
|
+
raindrop batch update --ids 1,2,3 '{"collection": {"$id": 123}}'
|
|
172
|
+
|
|
173
|
+
# Delete multiple bookmarks
|
|
174
|
+
raindrop batch delete --ids 1,2,3
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Global Options
|
|
178
|
+
|
|
179
|
+
| Option | Description |
|
|
180
|
+
|--------|-------------|
|
|
181
|
+
| `--dry-run` | Log actions instead of making real API requests |
|
|
182
|
+
| `--format, -f` | Output format: `toon` (default) or `json` |
|
|
183
|
+
| `--help, -h` | Show help |
|
|
184
|
+
| `--version, -v` | Show version |
|
|
185
|
+
|
|
186
|
+
## Environment Variables
|
|
187
|
+
|
|
188
|
+
| Variable | Description |
|
|
189
|
+
|----------|-------------|
|
|
190
|
+
| `RAINDROP_TOKEN` | API token (alternative to login command) |
|
|
191
|
+
|
|
192
|
+
## Output Formats
|
|
193
|
+
|
|
194
|
+
### TOON (Default)
|
|
195
|
+
|
|
196
|
+
Token-optimized format for AI agents. Tabular data with minimal overhead.
|
|
197
|
+
|
|
198
|
+
### JSON
|
|
199
|
+
|
|
200
|
+
Standard JSON output for programmatic use:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
raindrop search "python" --format json
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Configuration
|
|
207
|
+
|
|
208
|
+
Config is stored in `~/.config/raindrop-cli/config.json`
|
|
209
|
+
|
|
210
|
+
## Development
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# Run with watch mode
|
|
214
|
+
bun run dev
|
|
215
|
+
|
|
216
|
+
# Type check
|
|
217
|
+
bun run typecheck
|
|
218
|
+
|
|
219
|
+
# Build
|
|
220
|
+
bun run build
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
MIT
|