@btcemail/cli 0.1.1 → 0.4.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 +186 -41
- package/dist/index.js +1519 -390
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Command-line interface for btc.email - spam-free email powered by Bitcoin Lightning.
|
|
4
4
|
|
|
5
|
+
Current version: 0.4.0 (December 28, 2025)
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
@@ -14,10 +16,18 @@ Or with bun:
|
|
|
14
16
|
bun install -g @btcemail/cli
|
|
15
17
|
```
|
|
16
18
|
|
|
17
|
-
##
|
|
19
|
+
## Quick Start
|
|
18
20
|
|
|
19
21
|
```bash
|
|
20
|
-
|
|
22
|
+
# Log in (opens browser for authentication)
|
|
23
|
+
btcemail login
|
|
24
|
+
|
|
25
|
+
# List your inbox (numbered for quick access)
|
|
26
|
+
btcemail list
|
|
27
|
+
|
|
28
|
+
# Read email by number or ID
|
|
29
|
+
btcemail read 3 # Read email #3 from last list
|
|
30
|
+
btcemail read abc123 # Read by email ID
|
|
21
31
|
```
|
|
22
32
|
|
|
23
33
|
## Commands
|
|
@@ -39,24 +49,27 @@ btcemail logout
|
|
|
39
49
|
|
|
40
50
|
```bash
|
|
41
51
|
# List emails (default: inbox, 20 emails)
|
|
42
|
-
btcemail list
|
|
52
|
+
btcemail list # or: btcemail ls
|
|
43
53
|
|
|
44
54
|
# List with options
|
|
45
|
-
btcemail list --folder sent --limit 50
|
|
55
|
+
btcemail list --folder sent --limit 50 --page 2
|
|
56
|
+
|
|
57
|
+
# Read email by number (from last list)
|
|
58
|
+
btcemail read 3 # or: btcemail r 3
|
|
46
59
|
|
|
47
|
-
#
|
|
48
|
-
btcemail
|
|
60
|
+
# Read by email ID
|
|
61
|
+
btcemail read abc123def
|
|
49
62
|
|
|
50
|
-
#
|
|
51
|
-
btcemail
|
|
63
|
+
# Search emails
|
|
64
|
+
btcemail search "invoice" # or: btcemail s "invoice"
|
|
52
65
|
|
|
53
|
-
#
|
|
54
|
-
btcemail
|
|
66
|
+
# Send an email (with Lightning payment)
|
|
67
|
+
btcemail send --to recipient@example.com --subject "Hello" --body "Message"
|
|
55
68
|
|
|
56
|
-
# Send
|
|
57
|
-
btcemail send --to recipient@example.com --subject "Hello" --body "Message
|
|
69
|
+
# Send with auto-wait for payment
|
|
70
|
+
btcemail send --to recipient@example.com --subject "Hello" --body "Message" --wait
|
|
58
71
|
|
|
59
|
-
# Send with payment
|
|
72
|
+
# Send with pre-paid payment hash
|
|
60
73
|
btcemail send --to recipient@example.com --subject "Hello" --body "Message" --payment-hash <preimage>
|
|
61
74
|
```
|
|
62
75
|
|
|
@@ -66,7 +79,10 @@ Emails from unknown senders require payment before delivery.
|
|
|
66
79
|
|
|
67
80
|
```bash
|
|
68
81
|
# List pending emails awaiting payment
|
|
69
|
-
btcemail inbound pending
|
|
82
|
+
btcemail inbound pending # or: btcemail inbound p
|
|
83
|
+
|
|
84
|
+
# List delivered emails (paid by senders)
|
|
85
|
+
btcemail inbound delivered # or: btcemail inbound d
|
|
70
86
|
|
|
71
87
|
# View pending email details and payment info
|
|
72
88
|
btcemail inbound view <email-id>
|
|
@@ -79,18 +95,102 @@ btcemail inbound pay <email-id> --payment-hash <preimage>
|
|
|
79
95
|
|
|
80
96
|
```bash
|
|
81
97
|
# Show credit balance
|
|
82
|
-
btcemail credits balance
|
|
98
|
+
btcemail credits balance # or: btcemail credits bal
|
|
99
|
+
|
|
100
|
+
# Show transaction history
|
|
101
|
+
btcemail credits history
|
|
102
|
+
|
|
103
|
+
# Purchase credits with Lightning
|
|
104
|
+
btcemail credits purchase # Shows options
|
|
105
|
+
btcemail credits purchase --option 1 --wait
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Settings
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Show current settings
|
|
112
|
+
btcemail settings # or: btcemail settings show
|
|
113
|
+
|
|
114
|
+
# Set email price in sats
|
|
115
|
+
btcemail settings pricing 100
|
|
116
|
+
|
|
117
|
+
# Toggle payment requirement
|
|
118
|
+
btcemail settings require-payment on
|
|
119
|
+
btcemail settings require-payment off
|
|
120
|
+
|
|
121
|
+
# Toggle auto-whitelist after payment
|
|
122
|
+
btcemail settings auto-whitelist on
|
|
123
|
+
btcemail settings auto-whitelist off
|
|
124
|
+
|
|
125
|
+
# Set custom auto-reply message
|
|
126
|
+
btcemail settings auto-reply "Thanks for your email!"
|
|
127
|
+
btcemail settings auto-reply --clear # Reset to default
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Whitelist
|
|
131
|
+
|
|
132
|
+
Manage senders who can email you for free.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# List whitelist entries
|
|
136
|
+
btcemail whitelist # or: btcemail wl
|
|
137
|
+
|
|
138
|
+
# Add email or domain
|
|
139
|
+
btcemail whitelist add friend@example.com
|
|
140
|
+
btcemail whitelist add @company.com --note "Work contacts"
|
|
141
|
+
|
|
142
|
+
# Remove entry by ID
|
|
143
|
+
btcemail whitelist remove <entry-id>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Blocklist
|
|
147
|
+
|
|
148
|
+
Manage blocked senders (silently rejected).
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# List blocklist entries
|
|
152
|
+
btcemail blocklist # or: btcemail bl
|
|
153
|
+
|
|
154
|
+
# Add email or domain
|
|
155
|
+
btcemail blocklist add spammer@example.com
|
|
156
|
+
btcemail blocklist add @spam.com --reason "Known spam domain"
|
|
157
|
+
|
|
158
|
+
# Remove entry by ID
|
|
159
|
+
btcemail blocklist remove <entry-id>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Network
|
|
163
|
+
|
|
164
|
+
Switch between testnet and mainnet Lightning networks.
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Show current network mode
|
|
168
|
+
btcemail network
|
|
169
|
+
|
|
170
|
+
# Switch to testnet (fake Bitcoin)
|
|
171
|
+
btcemail network testnet
|
|
172
|
+
|
|
173
|
+
# Switch to mainnet (real Bitcoin)
|
|
174
|
+
btcemail network mainnet
|
|
83
175
|
```
|
|
84
176
|
|
|
85
|
-
|
|
177
|
+
### Stats
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Show dashboard statistics
|
|
181
|
+
btcemail stats
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Options Reference
|
|
86
185
|
|
|
87
186
|
### list
|
|
88
187
|
|
|
89
|
-
| Option | Description | Default |
|
|
90
|
-
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
| `--
|
|
188
|
+
| Option | Alias | Description | Default |
|
|
189
|
+
|--------|-------|-------------|---------|
|
|
190
|
+
| `--folder <folder>` | `-f` | Folder (inbox, sent, drafts) | inbox |
|
|
191
|
+
| `--limit <number>` | `-l` | Number of emails to show | 20 |
|
|
192
|
+
| `--page <number>` | `-p` | Page number for pagination | 1 |
|
|
193
|
+
| `--json` | | Output as JSON | false |
|
|
94
194
|
|
|
95
195
|
### read
|
|
96
196
|
|
|
@@ -98,34 +198,76 @@ btcemail credits balance
|
|
|
98
198
|
|--------|-------------|---------|
|
|
99
199
|
| `--json` | Output as JSON | false |
|
|
100
200
|
|
|
201
|
+
Email ID can be a number (from last list) or an actual email ID.
|
|
202
|
+
|
|
203
|
+
### search
|
|
204
|
+
|
|
205
|
+
| Option | Alias | Description | Default |
|
|
206
|
+
|--------|-------|-------------|---------|
|
|
207
|
+
| `--limit <number>` | `-l` | Number of results | 20 |
|
|
208
|
+
| `--json` | | Output as JSON | false |
|
|
209
|
+
|
|
101
210
|
### send
|
|
102
211
|
|
|
103
|
-
| Option | Description | Default |
|
|
104
|
-
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
| `--payment-hash <hash>` | Payment preimage for L402 | optional |
|
|
212
|
+
| Option | Alias | Description | Default |
|
|
213
|
+
|--------|-------|-------------|---------|
|
|
214
|
+
| `--to <emails>` | `-t` | Recipient email(s), comma-separated | required |
|
|
215
|
+
| `--subject <text>` | `-s` | Email subject | required |
|
|
216
|
+
| `--body <text>` | `-b` | Email body | required |
|
|
217
|
+
| `--from <email>` | `-f` | From email (@btc.email address) | auto-detected |
|
|
218
|
+
| `--payment-hash <hash>` | | Payment preimage for L402 | optional |
|
|
219
|
+
| `--wait` | `-w` | Wait for payment confirmation | false |
|
|
110
220
|
|
|
111
|
-
###
|
|
221
|
+
### credits purchase
|
|
112
222
|
|
|
113
|
-
| Option | Description | Default |
|
|
114
|
-
|
|
115
|
-
|
|
|
116
|
-
| `--
|
|
223
|
+
| Option | Alias | Description | Default |
|
|
224
|
+
|--------|-------|-------------|---------|
|
|
225
|
+
| `--option <index>` | `-o` | Purchase option index (0-3) | shows options |
|
|
226
|
+
| `--wait` | `-w` | Wait for payment confirmation | false |
|
|
227
|
+
| `--json` | | Output as JSON | false |
|
|
117
228
|
|
|
118
|
-
|
|
229
|
+
## Features
|
|
119
230
|
|
|
120
|
-
|
|
121
|
-
|--------|-------------|---------|
|
|
122
|
-
| `--json` | Output as JSON | false |
|
|
231
|
+
### Number-Based Email Access
|
|
123
232
|
|
|
124
|
-
|
|
233
|
+
After running `btcemail list` or `btcemail search`, emails are cached locally. You can then read them by number:
|
|
125
234
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
235
|
+
```bash
|
|
236
|
+
btcemail list # Shows numbered list
|
|
237
|
+
btcemail read 1 # Read first email
|
|
238
|
+
btcemail read 5 # Read fifth email
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Cache expires after 30 minutes.
|
|
242
|
+
|
|
243
|
+
### Pagination
|
|
244
|
+
|
|
245
|
+
Navigate through large email lists with pagination:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
btcemail list --page 1 # First page
|
|
249
|
+
btcemail list --page 2 --limit 50 # Second page, 50 per page
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Payment Waiting
|
|
253
|
+
|
|
254
|
+
Automatically wait for Lightning payments to complete:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
btcemail send --to bob@example.com --subject "Hello" --body "Hi" --wait
|
|
258
|
+
btcemail credits purchase --option 0 --wait
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
The CLI will display a QR code and wait up to 5 minutes for payment confirmation.
|
|
262
|
+
|
|
263
|
+
### JSON Output
|
|
264
|
+
|
|
265
|
+
All list commands support JSON output for scripting:
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
btcemail list --json | jq '.emails[0].subject'
|
|
269
|
+
btcemail credits balance --json | jq '.balanceSats'
|
|
270
|
+
```
|
|
129
271
|
|
|
130
272
|
## Authentication Flow
|
|
131
273
|
|
|
@@ -158,6 +300,9 @@ bun run start
|
|
|
158
300
|
|
|
159
301
|
# Watch mode
|
|
160
302
|
bun run dev
|
|
303
|
+
|
|
304
|
+
# Type check
|
|
305
|
+
bun run typecheck
|
|
161
306
|
```
|
|
162
307
|
|
|
163
308
|
## Requirements
|