bsky-cli 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,616 @@
1
+ # Bluesky CLI
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+ [![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)](https://github.com/agileguy/bluesky-cli)
5
+
6
+ A powerful command-line interface for the Bluesky social network, built on the AT Protocol. Post, interact, and manage your Bluesky presence directly from your terminal.
7
+
8
+ ## Features
9
+
10
+ - 🔐 **Authentication** - Secure login with app passwords, persistent session management
11
+ - 📝 **Posting** - Create posts with images, replies, and quotes
12
+ - 📰 **Timeline** - View your home feed, notifications, and user posts
13
+ - 👥 **Social** - Follow/unfollow users, search, view profiles and follower lists
14
+ - 💬 **Direct Messages** - Send and receive DMs in conversations
15
+ - 🎨 **Rich Output** - Colored, formatted output with JSON support
16
+ - ⚡ **Fast** - Built with Bun for blazing-fast performance
17
+
18
+ ## Installation
19
+
20
+ ### Using Bun (Recommended)
21
+
22
+ ```bash
23
+ bun install -g bsky-cli
24
+ ```
25
+
26
+ ### Using npm
27
+
28
+ ```bash
29
+ npm install -g bsky-cli
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ ```bash
35
+ # Login to your Bluesky account
36
+ bsky login
37
+
38
+ # Post a message
39
+ bsky post "Hello from the command line!"
40
+
41
+ # View your home timeline
42
+ bsky timeline
43
+
44
+ # Follow someone
45
+ bsky follow @user.bsky.social
46
+
47
+ # Send a direct message
48
+ bsky dm send @user.bsky.social "Hey there!"
49
+
50
+ # View your DM conversations
51
+ bsky dm list
52
+
53
+ # Read a conversation
54
+ bsky dm read @user.bsky.social
55
+ ```
56
+
57
+ ## Command Reference
58
+
59
+ ### Authentication Commands
60
+
61
+ #### `bsky login`
62
+ Authenticate with your Bluesky account using an app password.
63
+
64
+ ```bash
65
+ bsky login
66
+ # Interactive prompts for handle and app password
67
+ ```
68
+
69
+ **Options:**
70
+ - `--json` - Output response as JSON
71
+
72
+ **Notes:**
73
+ - Creates an app password at: https://bsky.app/settings/app-passwords
74
+ - Session is stored securely in `~/.config/bluesky-cli/session.json`
75
+
76
+ #### `bsky logout`
77
+ Clear your authentication session.
78
+
79
+ ```bash
80
+ bsky logout
81
+ ```
82
+
83
+ **Options:**
84
+ - `--json` - Output response as JSON
85
+
86
+ #### `bsky whoami`
87
+ Display information about the currently authenticated user.
88
+
89
+ ```bash
90
+ bsky whoami
91
+ ```
92
+
93
+ **Options:**
94
+ - `--json` - Output response as JSON
95
+
96
+ ### Posting Commands
97
+
98
+ #### `bsky post`
99
+ Create a new post on Bluesky.
100
+
101
+ ```bash
102
+ # Post text
103
+ bsky post "Your message here"
104
+
105
+ # Post from stdin
106
+ echo "Your message" | bsky post
107
+
108
+ # Post with image
109
+ bsky post "Check this out!" --image ./photo.jpg
110
+
111
+ # Post with multiple images and alt text
112
+ bsky post "Gallery" --image img1.jpg --image img2.jpg --alt "First" --alt "Second"
113
+
114
+ # Reply to a post
115
+ bsky post "Great point!" --reply-to at://did:plc:.../app.bsky.feed.post/...
116
+
117
+ # Quote a post
118
+ bsky post "Interesting take" --quote at://did:plc:.../app.bsky.feed.post/...
119
+ ```
120
+
121
+ **Arguments:**
122
+ - `[text]` - Post text (or read from stdin if not provided)
123
+
124
+ **Options:**
125
+ - `-i, --image <path>` - Attach image (can be used up to 4 times)
126
+ - `-a, --alt <text>` - Alt text for images (in order, one per image)
127
+ - `-r, --reply-to <uri>` - AT URI of post to reply to
128
+ - `-q, --quote <uri>` - AT URI of post to quote
129
+ - `--json` - Output response as JSON
130
+
131
+ **Limits:**
132
+ - Max post length: 300 characters
133
+ - Max images: 4 per post
134
+ - Max image size: 1MB
135
+ - Supported formats: JPEG, PNG, WebP, GIF
136
+
137
+ #### `bsky delete`
138
+ Delete a post by its AT URI.
139
+
140
+ ```bash
141
+ bsky delete at://did:plc:.../app.bsky.feed.post/...
142
+ ```
143
+
144
+ **Arguments:**
145
+ - `<uri>` - AT URI of the post to delete
146
+
147
+ **Options:**
148
+ - `--json` - Output response as JSON
149
+
150
+ ### Timeline Commands
151
+
152
+ #### `bsky timeline`
153
+ View your home timeline feed.
154
+
155
+ ```bash
156
+ # View latest posts
157
+ bsky timeline
158
+
159
+ # View more posts
160
+ bsky timeline --limit 50
161
+
162
+ # JSON output
163
+ bsky timeline --json
164
+ ```
165
+
166
+ **Options:**
167
+ - `-l, --limit <number>` - Number of posts to fetch (default: 20)
168
+ - `--json` - Output response as JSON
169
+
170
+ #### `bsky posts`
171
+ View posts from a specific user.
172
+
173
+ ```bash
174
+ # View your own posts
175
+ bsky posts
176
+
177
+ # View another user's posts
178
+ bsky posts @user.bsky.social
179
+
180
+ # View more posts
181
+ bsky posts @user.bsky.social --limit 50
182
+ ```
183
+
184
+ **Arguments:**
185
+ - `[handle]` - User handle (defaults to authenticated user)
186
+
187
+ **Options:**
188
+ - `-l, --limit <number>` - Number of posts to fetch (default: 20)
189
+ - `--json` - Output response as JSON
190
+
191
+ #### `bsky notifications`
192
+ View your notifications.
193
+
194
+ ```bash
195
+ # View latest notifications
196
+ bsky notifications
197
+
198
+ # View more notifications
199
+ bsky notifications --limit 50
200
+
201
+ # JSON output
202
+ bsky notifications --json
203
+ ```
204
+
205
+ **Options:**
206
+ - `-l, --limit <number>` - Number of notifications to fetch (default: 20)
207
+ - `--json` - Output response as JSON
208
+
209
+ **Notification Types:**
210
+ - Likes on your posts
211
+ - Reposts of your posts
212
+ - Replies to your posts
213
+ - Mentions of your handle
214
+ - Follows from other users
215
+ - Quotes of your posts
216
+
217
+ ### Social Commands
218
+
219
+ #### `bsky follow`
220
+ Follow a user.
221
+
222
+ ```bash
223
+ bsky follow @user.bsky.social
224
+ ```
225
+
226
+ **Arguments:**
227
+ - `<handle>` - User handle to follow
228
+
229
+ **Options:**
230
+ - `--json` - Output response as JSON
231
+
232
+ #### `bsky unfollow`
233
+ Unfollow a user.
234
+
235
+ ```bash
236
+ bsky unfollow @user.bsky.social
237
+ ```
238
+
239
+ **Arguments:**
240
+ - `<handle>` - User handle to unfollow
241
+
242
+ **Options:**
243
+ - `--json` - Output response as JSON
244
+
245
+ #### `bsky followers`
246
+ View followers of a user.
247
+
248
+ ```bash
249
+ # View your own followers
250
+ bsky followers
251
+
252
+ # View another user's followers
253
+ bsky followers @user.bsky.social
254
+
255
+ # View more followers
256
+ bsky followers @user.bsky.social --limit 100
257
+ ```
258
+
259
+ **Arguments:**
260
+ - `[handle]` - User handle (defaults to authenticated user)
261
+
262
+ **Options:**
263
+ - `-l, --limit <number>` - Number of followers to fetch (default: 50)
264
+ - `--json` - Output response as JSON
265
+
266
+ #### `bsky following`
267
+ View users that a user is following.
268
+
269
+ ```bash
270
+ # View who you're following
271
+ bsky following
272
+
273
+ # View who another user is following
274
+ bsky following @user.bsky.social
275
+
276
+ # View more
277
+ bsky following @user.bsky.social --limit 100
278
+ ```
279
+
280
+ **Arguments:**
281
+ - `[handle]` - User handle (defaults to authenticated user)
282
+
283
+ **Options:**
284
+ - `-l, --limit <number>` - Number of users to fetch (default: 50)
285
+ - `--json` - Output response as JSON
286
+
287
+ #### `bsky profile`
288
+ View detailed profile information for a user.
289
+
290
+ ```bash
291
+ # View your own profile
292
+ bsky profile
293
+
294
+ # View another user's profile
295
+ bsky profile @user.bsky.social
296
+ ```
297
+
298
+ **Arguments:**
299
+ - `[handle]` - User handle (defaults to authenticated user)
300
+
301
+ **Options:**
302
+ - `--json` - Output response as JSON
303
+
304
+ **Profile Information:**
305
+ - Display name
306
+ - Handle
307
+ - Description/bio
308
+ - Avatar and banner images
309
+ - Follower/following counts
310
+ - Post count
311
+ - Labels and moderation status
312
+
313
+ #### `bsky search`
314
+ Search for users by handle or display name.
315
+
316
+ ```bash
317
+ # Search for users
318
+ bsky search "Alice"
319
+
320
+ # Get more results
321
+ bsky search "Alice" --limit 50
322
+
323
+ # JSON output
324
+ bsky search "Alice" --json
325
+ ```
326
+
327
+ **Arguments:**
328
+ - `<query>` - Search query
329
+
330
+ **Options:**
331
+ - `-l, --limit <number>` - Number of results to fetch (default: 20)
332
+ - `--json` - Output response as JSON
333
+
334
+ ### Direct Message Commands
335
+
336
+ #### `bsky dm list`
337
+ List your direct message conversations.
338
+
339
+ ```bash
340
+ # View conversations
341
+ bsky dm list
342
+
343
+ # View more conversations
344
+ bsky dm list --limit 50
345
+
346
+ # JSON output
347
+ bsky dm list --json
348
+ ```
349
+
350
+ **Options:**
351
+ - `-l, --limit <number>` - Number of conversations to fetch (default: 20)
352
+ - `--json` - Output response as JSON
353
+
354
+ **Output:**
355
+ - Conversation participants
356
+ - Last message preview
357
+ - Timestamp of last message
358
+ - Unread count
359
+
360
+ #### `bsky dm send`
361
+ Send a direct message to a user.
362
+
363
+ ```bash
364
+ # Send a message
365
+ bsky dm send @user.bsky.social "Hello there!"
366
+
367
+ # Send from stdin
368
+ echo "Hello there!" | bsky dm send @user.bsky.social
369
+ ```
370
+
371
+ **Arguments:**
372
+ - `<handle>` - User handle to message
373
+ - `[message]` - Message text (or read from stdin)
374
+
375
+ **Options:**
376
+ - `--json` - Output response as JSON
377
+
378
+ #### `bsky dm read`
379
+ Read messages in a conversation with a user.
380
+
381
+ ```bash
382
+ # Read messages
383
+ bsky dm read @user.bsky.social
384
+
385
+ # Read more messages
386
+ bsky dm read @user.bsky.social --limit 100
387
+
388
+ # JSON output
389
+ bsky dm read @user.bsky.social --json
390
+ ```
391
+
392
+ **Arguments:**
393
+ - `<handle>` - User handle of conversation
394
+
395
+ **Options:**
396
+ - `-l, --limit <number>` - Number of messages to fetch (default: 50)
397
+ - `--json` - Output response as JSON
398
+
399
+ **Output:**
400
+ - Messages in chronological order
401
+ - Sender identification
402
+ - Timestamps
403
+ - Message content
404
+
405
+ ## Configuration
406
+
407
+ The CLI stores configuration and session data in:
408
+
409
+ - **macOS/Linux**: `~/.config/bluesky-cli/`
410
+ - **Windows**: `%APPDATA%/bluesky-cli/`
411
+
412
+ ### Files
413
+
414
+ - `config.json` - Configuration settings
415
+ - `session.json` - Authentication session (keep secure!)
416
+
417
+ ### Configuration Options
418
+
419
+ The `config.json` file supports:
420
+
421
+ ```json
422
+ {
423
+ "apiEndpoint": "https://bsky.social",
424
+ "colorOutput": true
425
+ }
426
+ ```
427
+
428
+ - `apiEndpoint` - Bluesky API endpoint (default: `https://bsky.social`)
429
+ - `colorOutput` - Enable colored terminal output (default: `true`)
430
+
431
+ ### Disable Colors
432
+
433
+ ```bash
434
+ bsky --no-color timeline
435
+ ```
436
+
437
+ ## Common Workflows
438
+
439
+ ### Daily Timeline Check
440
+
441
+ ```bash
442
+ # Check timeline and notifications
443
+ bsky timeline --limit 30
444
+ bsky notifications
445
+ ```
446
+
447
+ ### Post with Media
448
+
449
+ ```bash
450
+ # Post photo with description
451
+ bsky post "Beautiful sunset!" \
452
+ --image sunset.jpg \
453
+ --alt "Orange and pink sky over the ocean"
454
+ ```
455
+
456
+ ### Engage in Conversation
457
+
458
+ ```bash
459
+ # View a user's posts to find what to reply to
460
+ bsky posts @user.bsky.social
461
+
462
+ # Reply to a specific post
463
+ bsky post "Great insight!" --reply-to at://did:plc:.../app.bsky.feed.post/...
464
+ ```
465
+
466
+ ### Manage DMs
467
+
468
+ ```bash
469
+ # Check for new conversations
470
+ bsky dm list
471
+
472
+ # Read and respond
473
+ bsky dm read @user.bsky.social
474
+ bsky dm send @user.bsky.social "Thanks for reaching out!"
475
+ ```
476
+
477
+ ### Search and Follow
478
+
479
+ ```bash
480
+ # Find users interested in a topic
481
+ bsky search "TypeScript"
482
+
483
+ # Follow interesting accounts
484
+ bsky follow @dev.bsky.social
485
+ bsky follow @typescript.bsky.social
486
+ ```
487
+
488
+ ## Scripting and Automation
489
+
490
+ ### Post from Script
491
+
492
+ ```bash
493
+ #!/bin/bash
494
+ # daily-post.sh
495
+ DATE=$(date +"%Y-%m-%d")
496
+ bsky post "Daily update for $DATE: All systems operational! ✅"
497
+ ```
498
+
499
+ ### Monitor Notifications
500
+
501
+ ```bash
502
+ #!/bin/bash
503
+ # check-notifications.sh
504
+ COUNT=$(bsky notifications --json | jq '. | length')
505
+ if [ $COUNT -gt 0 ]; then
506
+ echo "You have $COUNT new notifications!"
507
+ bsky notifications
508
+ fi
509
+ ```
510
+
511
+ ### Batch Follow from List
512
+
513
+ ```bash
514
+ #!/bin/bash
515
+ # follow-list.sh
516
+ while read handle; do
517
+ echo "Following $handle..."
518
+ bsky follow "$handle"
519
+ sleep 1 # Be nice to the API
520
+ done < users.txt
521
+ ```
522
+
523
+ ## Contributing
524
+
525
+ Contributions are welcome! This project is built with TypeScript and Bun.
526
+
527
+ ### Development Setup
528
+
529
+ ```bash
530
+ # Clone the repository
531
+ git clone https://github.com/agileguy/bluesky-cli.git
532
+ cd bluesky-cli
533
+
534
+ # Install dependencies
535
+ bun install
536
+
537
+ # Run in development mode
538
+ bun run dev
539
+
540
+ # Run tests
541
+ bun test
542
+
543
+ # Build for production
544
+ bun run build
545
+
546
+ # Run linter
547
+ bun run lint
548
+
549
+ # Format code
550
+ bun run format
551
+ ```
552
+
553
+ ### Project Structure
554
+
555
+ ```
556
+ bluesky-cli/
557
+ ├── src/
558
+ │ ├── commands/ # Command implementations
559
+ │ ├── lib/ # Core libraries (auth, config, output)
560
+ │ └── index.ts # Main entry point
561
+ ├── dist/ # Built output
562
+ └── package.json
563
+ ```
564
+
565
+ ### Guidelines
566
+
567
+ - Follow the existing code style
568
+ - Add tests for new features
569
+ - Update documentation for new commands
570
+ - Use TypeScript strict mode
571
+ - Keep dependencies minimal
572
+
573
+ ## Troubleshooting
574
+
575
+ ### "Not logged in" Error
576
+
577
+ Run `bsky login` and authenticate with your app password.
578
+
579
+ ### "Invalid AT URI" Error
580
+
581
+ Ensure you're using the complete AT URI format:
582
+ `at://did:plc:abc123.../app.bsky.feed.post/xyz789...`
583
+
584
+ You can get post URIs from:
585
+ - The `--json` output of commands
586
+ - The Bluesky web interface (share menu)
587
+
588
+ ### Image Upload Fails
589
+
590
+ Check that:
591
+ - Image is under 1MB in size
592
+ - Image format is JPEG, PNG, WebP, or GIF
593
+ - File path is correct and accessible
594
+
595
+ ### Rate Limiting
596
+
597
+ If you encounter rate limits, wait a few minutes before retrying. The Bluesky API has rate limits to prevent abuse.
598
+
599
+ ## License
600
+
601
+ MIT License - see [LICENSE](LICENSE) file for details.
602
+
603
+ ## Related Projects
604
+
605
+ - [@atproto/api](https://github.com/bluesky-social/atproto) - Official AT Protocol TypeScript library
606
+ - [Bluesky](https://bsky.app) - Official Bluesky web client
607
+ - [AT Protocol](https://atproto.com) - AT Protocol documentation
608
+
609
+ ## Support
610
+
611
+ - GitHub Issues: [Report bugs or request features](https://github.com/agileguy/bluesky-cli/issues)
612
+ - AT Protocol Community: [atproto.com/community](https://atproto.com/community)
613
+
614
+ ---
615
+
616
+ Built with ❤️ using [Bun](https://bun.sh) and the [AT Protocol](https://atproto.com)