beepctl 0.1.2 → 0.1.3
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 +135 -32
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +35 -2
- package/dist/lib/config.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,8 @@ pnpm link --global
|
|
|
34
34
|
2. Go to **Settings → Developers**
|
|
35
35
|
3. Enable **Beeper Desktop API**
|
|
36
36
|
4. Click **"+"** next to "Approved connections" to create a token
|
|
37
|
-
5.
|
|
37
|
+
5. *(Optional)* Enable **"Allow sensitive actions"** on the token to send messages
|
|
38
|
+
6. Configure the CLI:
|
|
38
39
|
|
|
39
40
|
```bash
|
|
40
41
|
beepctl auth set <your-token>
|
|
@@ -44,54 +45,74 @@ export BEEPER_TOKEN=<your-token>
|
|
|
44
45
|
|
|
45
46
|
## Configuration
|
|
46
47
|
|
|
47
|
-
Config stored at `~/.config/
|
|
48
|
+
Config stored at `~/.config/beepctl/config.json` with token, base URL, and aliases.
|
|
48
49
|
|
|
49
50
|
**Precedence:** Environment variables (`BEEPER_TOKEN`, `BEEPER_URL`) override config file.
|
|
50
51
|
|
|
51
52
|
## Usage
|
|
52
53
|
|
|
54
|
+
### Auth Management
|
|
55
|
+
|
|
53
56
|
```bash
|
|
54
|
-
# Auth management
|
|
55
57
|
beepctl auth show # Check auth status
|
|
56
58
|
beepctl auth set <token> # Set API token
|
|
57
59
|
beepctl auth clear # Clear stored token
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Accounts
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
beepctl accounts # List all connected accounts
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Chats
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# List chats
|
|
72
|
+
beepctl chats list # List inbox (non-archived)
|
|
73
|
+
beepctl chats list --limit 50 # Limit results
|
|
74
|
+
beepctl chats list --search "John" # Filter by name
|
|
75
|
+
beepctl chats list --inbox archive # Archived chats only
|
|
76
|
+
beepctl chats list --inbox low-priority # Low-priority chats
|
|
77
|
+
beepctl chats list --inbox all # All chats (including archived)
|
|
78
|
+
beepctl chats list --type group # Filter by type (single/group/any)
|
|
79
|
+
beepctl chats list --unread-only # Unread chats only
|
|
80
|
+
beepctl chats list --activity-after "1d ago" # Recent activity filter
|
|
81
|
+
|
|
82
|
+
# Chat details
|
|
83
|
+
beepctl chats show <chat-id> # Detailed info with participants
|
|
84
|
+
|
|
85
|
+
# Create chat
|
|
86
|
+
beepctl chats create <account-id> <user-ids...> # Create new single/group chat
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Inbox filters:** `primary` (default), `archive`, `low-priority`, `all`
|
|
90
|
+
|
|
91
|
+
### Messages
|
|
58
92
|
|
|
59
|
-
|
|
60
|
-
beepctl accounts
|
|
93
|
+
Browse messages in a specific chat:
|
|
61
94
|
|
|
62
|
-
|
|
63
|
-
beepctl
|
|
64
|
-
beepctl
|
|
65
|
-
beepctl
|
|
95
|
+
```bash
|
|
96
|
+
beepctl messages <chat-id> # List recent messages
|
|
97
|
+
beepctl messages <chat-id> --limit 20 # Limit results
|
|
98
|
+
beepctl messages <chat-id> --after "1d ago" # Messages after a time
|
|
99
|
+
beepctl messages <chat-id> --before "1h ago" # Messages before a time
|
|
100
|
+
beepctl messages work # Use alias
|
|
101
|
+
```
|
|
66
102
|
|
|
67
|
-
|
|
103
|
+
### Search
|
|
104
|
+
|
|
105
|
+
Search messages across all chats:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
68
108
|
beepctl search "meeting tomorrow"
|
|
69
109
|
beepctl search "deadline" --limit 10
|
|
70
110
|
beepctl search "deadline" --chat work --sender me --after "1d ago"
|
|
71
111
|
beepctl search "photo" --media image video
|
|
72
112
|
beepctl search "discussion" --chat-type group --before "yesterday"
|
|
73
|
-
|
|
74
|
-
# Send messages
|
|
75
|
-
beepctl send <chat-id> "Hello!"
|
|
76
|
-
beepctl send myself "Quick note" # Send to yourself
|
|
77
|
-
beepctl send <chat-id> "Thanks!" --reply-to <message-id> # Reply to message
|
|
78
|
-
|
|
79
|
-
# Archive/unarchive chats
|
|
80
|
-
beepctl archive <chat-id> # Archive a chat
|
|
81
|
-
beepctl archive <chat-id> --unarchive # Unarchive a chat
|
|
82
|
-
beepctl archive work # Use alias to archive
|
|
83
|
-
|
|
84
|
-
# Alias management (shortcuts for chat IDs)
|
|
85
|
-
beepctl alias list # List all aliases
|
|
86
|
-
beepctl alias add work <chat-id> # Create alias
|
|
87
|
-
beepctl alias show work # Show alias value
|
|
88
|
-
beepctl alias remove work # Remove alias
|
|
89
|
-
beepctl send work "Using alias!" # Use alias in commands
|
|
90
113
|
```
|
|
91
114
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
Filter search results with multiple options:
|
|
115
|
+
#### Search Filters
|
|
95
116
|
|
|
96
117
|
```bash
|
|
97
118
|
# Filter by chat (supports aliases, space or comma-separated)
|
|
@@ -129,6 +150,83 @@ beepctl search "important" --exclude-muted
|
|
|
129
150
|
|
|
130
151
|
**Media types:** `any`, `video`, `image`, `link`, `file`
|
|
131
152
|
|
|
153
|
+
### Send Messages
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
beepctl send <chat-id> "Hello!" # Send message
|
|
157
|
+
beepctl send myself "Quick note" # Send to yourself
|
|
158
|
+
beepctl send <chat-id> "Thanks!" --reply-to <msg-id> # Reply to message
|
|
159
|
+
beepctl send <chat-id> "msg" --quiet # No confirmation output
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Focus (Bring to Foreground)
|
|
163
|
+
|
|
164
|
+
Bring Beeper Desktop to foreground and optionally open a chat:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
beepctl focus # Bring Beeper to foreground
|
|
168
|
+
beepctl focus <chat-id> # Open a specific chat
|
|
169
|
+
beepctl focus work # Use alias
|
|
170
|
+
beepctl focus <chat-id> -m <msg-id> # Jump to specific message
|
|
171
|
+
beepctl focus <chat-id> -d "draft text" # Pre-fill draft text
|
|
172
|
+
beepctl focus <chat-id> -a /path/to/file # Pre-fill draft attachment
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Tip:** Use focus with `-a` to send media (images, files) since `send` only supports text:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
beepctl focus <chat-id> -a /path/to/image.png -d "Check this out!"
|
|
179
|
+
# Then press Enter in Beeper to send
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Archive
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
beepctl archive <chat-id> # Archive a chat
|
|
186
|
+
beepctl archive <chat-id> --unarchive # Unarchive a chat
|
|
187
|
+
beepctl archive work # Use alias
|
|
188
|
+
beepctl archive <chat-id> --quiet # No confirmation message
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Aliases
|
|
192
|
+
|
|
193
|
+
Create shortcuts for frequently used chat IDs:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
beepctl alias list # List all aliases
|
|
197
|
+
beepctl alias add work <chat-id> # Create alias
|
|
198
|
+
beepctl alias show work # Show alias value
|
|
199
|
+
beepctl alias remove work # Remove alias
|
|
200
|
+
beepctl send work "Using alias!" # Use alias in any command
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Contacts
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
beepctl contacts search <account-id> <query> # Search contacts on an account
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Download Attachments
|
|
210
|
+
|
|
211
|
+
Download message attachments (mxc:// URLs):
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
beepctl download <mxc-url> # Download to current directory
|
|
215
|
+
beepctl download <mxc-url> -o /path # Save to specific path
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Reminders
|
|
219
|
+
|
|
220
|
+
Set reminders to follow up on chats:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
beepctl reminders set <chat-id> 30m # Remind in 30 minutes
|
|
224
|
+
beepctl reminders set <chat-id> 1h # Remind in 1 hour
|
|
225
|
+
beepctl reminders set <chat-id> 2d # Remind in 2 days
|
|
226
|
+
beepctl reminders set <chat-id> tomorrow # Remind tomorrow
|
|
227
|
+
beepctl reminders clear <chat-id> # Clear reminder
|
|
228
|
+
```
|
|
229
|
+
|
|
132
230
|
## Development
|
|
133
231
|
|
|
134
232
|
```bash
|
|
@@ -162,11 +260,16 @@ src/
|
|
|
162
260
|
│ ├── alias.ts # Alias management
|
|
163
261
|
│ ├── archive.ts # Archive/unarchive chats
|
|
164
262
|
│ ├── chats.ts # Browse chats
|
|
263
|
+
│ ├── contacts.ts # Search contacts
|
|
264
|
+
│ ├── download.ts # Download attachments
|
|
265
|
+
│ ├── focus.ts # Bring Beeper to foreground
|
|
266
|
+
│ ├── messages.ts # List messages in a chat
|
|
267
|
+
│ ├── reminders.ts # Chat reminders
|
|
165
268
|
│ ├── search.ts # Search messages/chats
|
|
166
269
|
│ └── send.ts # Send messages
|
|
167
270
|
└── lib/ # Core logic
|
|
168
271
|
├── client.ts # Beeper API client wrapper
|
|
169
|
-
├── config.ts # Config file management (~/.config/
|
|
272
|
+
├── config.ts # Config file management (~/.config/beepctl/)
|
|
170
273
|
├── aliases.ts # Alias resolution utilities
|
|
171
274
|
└── dates.ts # Relative date parsing
|
|
172
275
|
```
|
|
@@ -185,7 +288,7 @@ src/
|
|
|
185
288
|
|
|
186
289
|
Inspired by [beeper-cli](https://github.com/krausefx/beeper-cli) by [@krausefx](https://github.com/krausefx).
|
|
187
290
|
|
|
188
|
-
The author uses
|
|
291
|
+
The author uses beepctl alongside [clawdbot](https://github.com/blqke/clawdbot).
|
|
189
292
|
|
|
190
293
|
## License
|
|
191
294
|
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAyCD,wBAAgB,SAAS,IAAI,YAAY,CAqBxC;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAMrD;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
|
package/dist/lib/config.js
CHANGED
|
@@ -1,14 +1,47 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
const CONFIG_DIR = join(homedir(), ".config", "
|
|
4
|
+
const CONFIG_DIR = join(homedir(), ".config", "beepctl");
|
|
5
5
|
const CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
6
|
+
// Legacy config path (before rename to beepctl)
|
|
7
|
+
const LEGACY_CONFIG_DIR = join(homedir(), ".config", "beepcli");
|
|
8
|
+
const LEGACY_CONFIG_FILE = join(LEGACY_CONFIG_DIR, "config.json");
|
|
9
|
+
let migrationDone = false;
|
|
10
|
+
/**
|
|
11
|
+
* Migrate config from legacy ~/.config/beepcli/ to ~/.config/beepctl/
|
|
12
|
+
* Runs once per process, copies config and removes legacy directory.
|
|
13
|
+
*/
|
|
14
|
+
function migrateIfNeeded() {
|
|
15
|
+
if (migrationDone)
|
|
16
|
+
return;
|
|
17
|
+
migrationDone = true;
|
|
18
|
+
// Skip if new config already exists or legacy doesn't exist
|
|
19
|
+
if (existsSync(CONFIG_FILE) || !existsSync(LEGACY_CONFIG_FILE))
|
|
20
|
+
return;
|
|
21
|
+
try {
|
|
22
|
+
const legacyContent = readFileSync(LEGACY_CONFIG_FILE, "utf-8");
|
|
23
|
+
const config = JSON.parse(legacyContent);
|
|
24
|
+
// Create new config directory and save
|
|
25
|
+
if (!existsSync(CONFIG_DIR)) {
|
|
26
|
+
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
29
|
+
// Remove legacy directory
|
|
30
|
+
rmSync(LEGACY_CONFIG_DIR, { recursive: true });
|
|
31
|
+
console.error("Migrated config from ~/.config/beepcli/ to ~/.config/beepctl/");
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// Silent fail - user can manually migrate if needed
|
|
35
|
+
}
|
|
36
|
+
}
|
|
6
37
|
export function getConfig() {
|
|
7
38
|
const envToken = process.env.BEEPER_TOKEN;
|
|
8
39
|
const envUrl = process.env.BEEPER_URL;
|
|
9
40
|
if (envToken || envUrl) {
|
|
10
41
|
return { token: envToken, baseUrl: envUrl };
|
|
11
42
|
}
|
|
43
|
+
// Migrate legacy config if needed
|
|
44
|
+
migrateIfNeeded();
|
|
12
45
|
if (existsSync(CONFIG_FILE)) {
|
|
13
46
|
try {
|
|
14
47
|
const content = readFileSync(CONFIG_FILE, "utf-8");
|
package/dist/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,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