@broodnet/cli 0.1.3 → 0.1.4

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.
Files changed (3) hide show
  1. package/README.md +97 -17
  2. package/dist/index.js +11670 -10712
  3. package/package.json +2 -3
package/README.md CHANGED
@@ -36,7 +36,40 @@ Authenticate a mailbox token and save the connection config locally.
36
36
  broodnet login --token=bnt_XXXxxXXX
37
37
  ```
38
38
 
39
- Validates the token against the API, fetches IMAP settings, and writes them to `~/.config/broodnet/config.json`. Run this once per mailbox. Multiple accounts are supported — the first one logged in becomes the active default.
39
+ Validates the token against the API, fetches IMAP settings, and writes them to `~/.config/broodnet/config.json`. Run this once per mailbox. Multiple accounts are supported — the most recently logged-in mailbox becomes active.
40
+
41
+ ---
42
+
43
+ ### `broodnet ls`
44
+
45
+ List all configured mailboxes and mark which one is active.
46
+
47
+ ```sh
48
+ broodnet ls
49
+ ```
50
+
51
+ Use `--json` for machine-readable output.
52
+
53
+ ---
54
+
55
+ ### `broodnet use <email>`
56
+
57
+ Set the active mailbox. This becomes the default mailbox used by all commands when `--mailbox` is not specified.
58
+
59
+ ```sh
60
+ broodnet use agent@example.com
61
+ ```
62
+
63
+ ---
64
+
65
+ ### `broodnet logout [email]`
66
+
67
+ Remove one or more saved mailboxes from local config.
68
+
69
+ ```sh
70
+ broodnet logout agent@example.com
71
+ broodnet logout --all
72
+ ```
40
73
 
41
74
  ---
42
75
 
@@ -97,24 +130,60 @@ Hi there, ...
97
130
 
98
131
  ---
99
132
 
133
+ ### `broodnet mail delete <uid...>`
134
+
135
+ Permanently delete messages by UID.
136
+
137
+ ```sh
138
+ broodnet mail delete 1042
139
+ broodnet mail delete 10 11 12
140
+ ```
141
+
142
+ In interactive mode, the CLI asks for confirmation. In non-interactive mode (agents/CI), pass `--yes`.
143
+
144
+ **Options:**
145
+
146
+ | Flag | Default | Description |
147
+ | ----------- | -------------- | ------------------------------------------------- |
148
+ | `--mailbox` | active account | Address of a specific logged-in mailbox |
149
+ | `--yes` | — | Skip confirmation (required when non-interactive) |
150
+ | `--json` | — | Machine-readable output (see below) |
151
+
152
+ ---
153
+
100
154
  ## `--json` flag
101
155
 
102
156
  Every command accepts `--json`. Output goes to stdout as formatted JSON — no colors, no tables, no banners. Designed for piping into agents or scripts.
103
157
 
158
+ The output is always a stable envelope:
159
+
160
+ ```json
161
+ { "success": true, "message": "optional", "data": {} }
162
+ ```
163
+
164
+ or:
165
+
166
+ ```json
167
+ { "success": false, "error": "something went wrong", "data": null }
168
+ ```
169
+
104
170
  ```sh
105
171
  broodnet mail inbox --json
106
172
  ```
107
173
 
108
174
  ```json
109
- [
110
- {
111
- "uid": 1042,
112
- "from": "alerts@github.com",
113
- "subject": "[action required] review your billing",
114
- "date": "2026-03-10T14:32:00.000Z",
115
- "flags": { "seen": false, "answered": false, "flagged": true, "forwarded": false }
116
- }
117
- ]
175
+ {
176
+ "success": true,
177
+ "data": [
178
+ {
179
+ "uid": "1042",
180
+ "from": "alerts@github.com",
181
+ "subject": "[action required] review your billing",
182
+ "date": "2026-03-10T14:32:00.000Z",
183
+ "flags": { "seen": false, "answered": false, "flagged": true, "forwarded": false }
184
+ }
185
+ ]
186
+ }
118
187
  ```
119
188
 
120
189
  ```sh
@@ -123,12 +192,15 @@ broodnet mail open 1042 --json
123
192
 
124
193
  ```json
125
194
  {
126
- "uid": 1042,
127
- "from": "alerts@github.com",
128
- "to": "agent@yourdomain.broodnet.com",
129
- "subject": "[action required] review your billing",
130
- "date": "2026-03-10T14:32:00.000Z",
131
- "body": "Hi there, ..."
195
+ "success": true,
196
+ "data": {
197
+ "uid": "1042",
198
+ "from": "alerts@github.com",
199
+ "to": "agent@yourdomain.broodnet.com",
200
+ "subject": "[action required] review your billing",
201
+ "date": "2026-03-10T14:32:00.000Z",
202
+ "body": "Hi there, ..."
203
+ }
132
204
  }
133
205
  ```
134
206
 
@@ -138,14 +210,22 @@ broodnet mail open 1042 --json
138
210
  | ------------------ | ---------------------------------------------------------------------------------------- |
139
211
  | `BROODNET_TOKEN` | Mailbox token. Bypasses the config file entirely — useful in CI or containerized agents. |
140
212
  | `BROODNET_MAILBOX` | Select a specific logged-in mailbox by address. |
213
+ | `BROODNET_API_URL` | Override the API base URL (default: https://api.broodnet.com). |
141
214
 
142
215
  When `BROODNET_TOKEN` is set, no login is required — the token is validated at runtime on every command.
143
216
 
217
+ ### Development note
218
+
219
+ In local dev (`npm run dev`), the CLI version shown by help/version is read from `npm_package_version`.
220
+ In production builds (`npm run build`), Vite injects `__CLI_VERSION__` from `package.json`.
221
+
144
222
  ## Multiple accounts
145
223
 
146
- Each `broodnet login` call adds an account to the local config. The first account becomes the active default. Switch between accounts with `--mailbox`:
224
+ Each `broodnet login` call adds an account to the local config. The most recently logged-in mailbox becomes active. Use `broodnet ls` to see what’s configured and `broodnet use` to switch the active mailbox. You can also override per-command with `--mailbox`:
147
225
 
148
226
  ```sh
227
+ broodnet ls
228
+ broodnet use agent-a@yourdomain.broodnet.com
149
229
  broodnet mail inbox --mailbox=agent-a@yourdomain.broodnet.com
150
230
  broodnet mail inbox --mailbox=agent-b@yourdomain.broodnet.com
151
231
  ```