@broodnet/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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +177 -0
  3. package/dist/index.js +44450 -0
  4. package/package.json +41 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Broodnet
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,177 @@
1
+ ```
2
+ @@@@@@@ @@@@@@@ @@@@@@ @@@@@@ @@@@@@@ @@@ @@@ @@@@@@@@ @@@@@@@
3
+ @@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@ @@@ @@@@@@@@ @@@@@@@
4
+ @@! @@@ @@! @@@ @@! @@@ @@! @@@ @@! @@@ @@!@!@@@ @@! @@!
5
+ !@ @!@ !@! @!@ !@! @!@ !@! @!@ !@! @!@ !@!!@!@! !@! !@!
6
+ @!@!@!@ @!@!!@! @!@ !@! @!@ !@! @!@ !@! @!@ !!@! @!!!:! @!!
7
+ !!!@!!!! !!@!@! !@! !!! !@! !!! !@! !!! !@! !!! !!!!!: !!!
8
+ !!: !!! !!: :!! !!: !!! !!: !!! !!: !!! !!: !!! !!: !!:
9
+ :!: !:! :!: !:! :!: !:! :!: !:! :!: !:! :!: !:! :!: :!:
10
+ :: :::: :: ::: ::::: :: ::::: :: :::: :: :: :: :: :::: ::
11
+ :: : :: : : : : : : : : : :: : : :: : : :: :: :
12
+ ```
13
+
14
+ **Email infrastructure for AI agents.** Read and manage your Broodnet mailboxes from the terminal or from agent code.
15
+
16
+ ## Installation
17
+
18
+ ```sh
19
+ npm install -g @broodnet/cli
20
+ ```
21
+
22
+ Requires Node.js 22+.
23
+
24
+ ## Getting started
25
+
26
+ You need a Broodnet account and at least one mailbox. Sign up at [broodnet.com](https://broodnet.com).
27
+
28
+ Once you have a mailbox, grab its token from the dashboard and authenticate:
29
+
30
+ ```sh
31
+ broodnet login --token=bnt_XXXxxXXX
32
+ ```
33
+
34
+ Credentials are saved to `~/.config/broodnet/config.json`. You only need to do this once per mailbox.
35
+
36
+ ## Modules
37
+
38
+ ### `mail`
39
+
40
+ Read email from your Broodnet mailboxes over IMAP. Requires a **mailbox token** — issued per mailbox from the Broodnet dashboard when you create a mailbox.
41
+
42
+ ## Commands
43
+
44
+ ### `broodnet login`
45
+
46
+ Authenticate a mailbox token and save the connection config locally.
47
+
48
+ ```sh
49
+ broodnet login --token=bnt_XXXxxXXX
50
+ ```
51
+
52
+ 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.
53
+
54
+ ---
55
+
56
+ ### `broodnet mail inbox`
57
+
58
+ List the latest messages in your inbox.
59
+
60
+ ```sh
61
+ broodnet mail inbox
62
+ ```
63
+
64
+ ```
65
+ UID FLAGS FROM SUBJECT DATE
66
+ -------- ------ -------------------- ---------------------------------------- --------------------
67
+ 1042 ●★ alerts@github.com [action required] review your billing 2 hours ago
68
+ 1041 ○ noreply@linear.app BRD-42 was closed yesterday
69
+ 1040 ○↩ ops@broodnet.com your mailbox is ready Mar 8
70
+ ```
71
+
72
+ **Flags:** `●` unread · `○` read · `↩` replied · `★` flagged · `⤴` forwarded
73
+
74
+ **Options:**
75
+
76
+ | Flag | Default | Description |
77
+ | ----------- | -------------- | --------------------------------------- |
78
+ | `--limit` | `20` | Number of messages to fetch |
79
+ | `--mailbox` | active account | Address of a specific logged-in mailbox |
80
+ | `--json` | — | Machine-readable output (see below) |
81
+
82
+ ---
83
+
84
+ ### `broodnet mail open <uid>`
85
+
86
+ Fetch and display a message by its UID. Marks it as read.
87
+
88
+ ```sh
89
+ broodnet mail open 1042
90
+ ```
91
+
92
+ ```
93
+ ────────────────────────────────────────────────────────────
94
+ From: alerts@github.com
95
+ To: agent@yourdomain.broodnet.com
96
+ Subject: [action required] review your billing
97
+ Date: Mar 10, 2026 14:32
98
+ ────────────────────────────────────────────────────────────
99
+
100
+ Hi there, ...
101
+ ```
102
+
103
+ **Options:**
104
+
105
+ | Flag | Default | Description |
106
+ | ----------- | -------------- | --------------------------------------------- |
107
+ | `--mailbox` | active account | Address of a specific logged-in mailbox |
108
+ | `--raw` | — | Print raw RFC822 source including all headers |
109
+ | `--json` | — | Machine-readable output (see below) |
110
+
111
+ ---
112
+
113
+ ## `--json` flag
114
+
115
+ Every command accepts `--json`. Output goes to stdout as formatted JSON — no colors, no tables, no banners. Designed for piping into agents or scripts.
116
+
117
+ ```sh
118
+ broodnet mail inbox --json
119
+ ```
120
+
121
+ ```json
122
+ [
123
+ {
124
+ "uid": 1042,
125
+ "from": "alerts@github.com",
126
+ "subject": "[action required] review your billing",
127
+ "date": "2026-03-10T14:32:00.000Z",
128
+ "flags": { "seen": false, "answered": false, "flagged": true, "forwarded": false }
129
+ }
130
+ ]
131
+ ```
132
+
133
+ ```sh
134
+ broodnet mail open 1042 --json
135
+ ```
136
+
137
+ ```json
138
+ {
139
+ "uid": 1042,
140
+ "from": "alerts@github.com",
141
+ "to": "agent@yourdomain.broodnet.com",
142
+ "subject": "[action required] review your billing",
143
+ "date": "2026-03-10T14:32:00.000Z",
144
+ "body": "Hi there, ..."
145
+ }
146
+ ```
147
+
148
+ ## Environment variables
149
+
150
+ | Variable | Description |
151
+ | ------------------ | ---------------------------------------------------------------------------------------- |
152
+ | `BROODNET_TOKEN` | Mailbox token. Bypasses the config file entirely — useful in CI or containerized agents. |
153
+ | `BROODNET_MAILBOX` | Select a specific logged-in mailbox by address. |
154
+
155
+ When `BROODNET_TOKEN` is set, no login is required — the token is validated at runtime on every command.
156
+
157
+ ## Multiple accounts
158
+
159
+ Each `broodnet login` call adds an account to the local config. The first account becomes the active default. Switch between accounts with `--mailbox`:
160
+
161
+ ```sh
162
+ broodnet mail inbox --mailbox=agent-a@yourdomain.broodnet.com
163
+ broodnet mail inbox --mailbox=agent-b@yourdomain.broodnet.com
164
+ ```
165
+
166
+ ## Exit codes
167
+
168
+ | Code | Meaning |
169
+ | ---- | ------------------------------------- |
170
+ | `0` | Success |
171
+ | `1` | General error |
172
+ | `2` | Auth error (token invalid or missing) |
173
+ | `3` | IMAP connection error |
174
+
175
+ ## License
176
+
177
+ MIT — see [LICENSE](./LICENSE).