@noisybrood/cli 0.2.0 → 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 +6 -5
- package/dist/brood/api/src/client.js +13 -0
- package/dist/brood/api/src/values.js +247 -5
- package/dist/brood/figures/index.js +2 -0
- package/dist/commands.js +855 -26
- package/dist/main.js +86 -6
- package/dist/sign-in.js +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
|
+
import { APP_ORIGIN } from "./brood/api/src/origin.js";
|
|
2
3
|
import { call } from "./client.js";
|
|
3
4
|
import { COMMANDS } from "./commands.js";
|
|
4
5
|
import { Refused, Refusal, SessionEnded } from "./io.js";
|
|
@@ -10,8 +11,14 @@ import { depthOf, wrenIn } from "./wren.js";
|
|
|
10
11
|
/**
|
|
11
12
|
* `brood`, the command line over Brood's index (DD10): it answers questions
|
|
12
13
|
* about a mailbox without opening one, and changes it only by `hush`,
|
|
13
|
-
* `unhush
|
|
14
|
-
*
|
|
14
|
+
* `unhush`, `keep-out`, `rules file`, `batch`, `quieted restore`, `own-rules
|
|
15
|
+
* adopt`, `proposals file`, `unsubscribe` and `keep add`, which changes
|
|
16
|
+
* Brood's filters to keep mail in view; `own-rules` reads the mailbox's own
|
|
17
|
+
* filters. `accounts disconnect`, `keep remove` and `programs allow` and
|
|
18
|
+
* `revoke` ask for a change the person approves in the app, and change
|
|
19
|
+
* nothing until they do (DD21 §4). `relationships add` changes what Brood proposes, never the
|
|
20
|
+
* mailbox, and the rule book what Brood decides on its next run, which can
|
|
21
|
+
* quiet a home or stop filing one. Bare `brood` prints this help, never a report (DD10 §3), so it is
|
|
15
22
|
* never a status glanced at, under the wren.
|
|
16
23
|
*/
|
|
17
24
|
const HELP = `brood answers questions about your mailbox from Brood's index. It never reads a message.
|
|
@@ -27,20 +34,74 @@ Structure
|
|
|
27
34
|
brood classifications [<path>] what Brood has decided, and its state
|
|
28
35
|
brood classification <id> one, with the reason for its state
|
|
29
36
|
brood rules [<id>] the filters Brood installed
|
|
37
|
+
brood rule-book the numbers Brood decides by
|
|
30
38
|
|
|
31
39
|
Suppression, which changes your mailbox
|
|
32
40
|
brood hush <domain|address|id> file a sender, proposed or not
|
|
33
41
|
brood unhush <domain|address|id> undo the filing
|
|
42
|
+
brood keep-out <address> keep one address out of its domain's filing, and bring its mail back
|
|
43
|
+
brood rules file <id> file the mail already there that a filter would have filed
|
|
44
|
+
brood batch <home> on|off bring a home's mail back at your arrival hours
|
|
45
|
+
brood quieted homes Brood quieted for their silence
|
|
46
|
+
brood quieted restore <home> bring one back, filing again
|
|
47
|
+
brood quieted leave <home> leave one quiet after its sender wrote again
|
|
48
|
+
Your own filters
|
|
49
|
+
brood own-rules your filters in each mailbox, read now
|
|
50
|
+
brood own-rules adopt <mailbox> <id>
|
|
51
|
+
let Brood take one over, filing the same sender
|
|
52
|
+
The rule book, which changes what Brood decides
|
|
53
|
+
brood rule-book set <name>=<n>... see what a change would do, then save it
|
|
54
|
+
brood rule-book reset every number back to its default
|
|
55
|
+
|
|
56
|
+
Proposals, what Brood would file
|
|
57
|
+
brood proposals what it proposes; those marked ready can be filed together
|
|
58
|
+
brood proposals file <id>... file these, or --all for those marked ready
|
|
59
|
+
brood proposals decline <id> not this one, and never proposed again
|
|
60
|
+
brood proposals again <id> put a declined one back among the proposals
|
|
61
|
+
|
|
62
|
+
Unsubscribing, which cannot be taken back
|
|
63
|
+
brood unsubscribe who Brood can ask to stop
|
|
64
|
+
brood unsubscribe <address> ask one now
|
|
65
|
+
brood unsubscribe <address>... ask several in turn, or --all for everyone listed
|
|
34
66
|
|
|
35
67
|
Keeping in view, which changes Brood's filters so it never files these senders
|
|
36
68
|
brood keep your never-quiet list
|
|
37
69
|
brood keep add [<file>] add addresses and domains, one a line, from a file or standard input
|
|
70
|
+
brood keep remove <entry> [<kind>]
|
|
71
|
+
take one off the list, once you approve it in the app
|
|
38
72
|
|
|
39
|
-
|
|
40
|
-
brood
|
|
73
|
+
Relationships, whose mail Brood gives a home of its own
|
|
74
|
+
brood relationships who is on the list, and who Brood suggests
|
|
75
|
+
brood relationships add --group <name> [<file>]
|
|
76
|
+
add them to a group, one a line, as Name: domain, domain
|
|
77
|
+
brood relationships accept <who> --group <name>
|
|
78
|
+
take up a suggestion
|
|
79
|
+
brood relationships dismiss <who> set a suggestion aside for good
|
|
80
|
+
brood relationships move <who> --group <name>
|
|
81
|
+
put one in another group
|
|
82
|
+
brood relationships remove <who> take one off the list; its mail stays filed
|
|
83
|
+
brood groups your groups
|
|
84
|
+
brood groups add <name> make one
|
|
85
|
+
brood groups rename <name> <new> rename one
|
|
86
|
+
brood groups comes-back <name> on|off
|
|
87
|
+
whether they return after a quiet spell
|
|
88
|
+
brood groups remove <name> remove one with nobody in it
|
|
89
|
+
|
|
90
|
+
Your account
|
|
91
|
+
brood preferences the letter, the first proposals' email and your arrival hours
|
|
92
|
+
brood preferences letter off|month|week
|
|
93
|
+
brood preferences first-proposals on|off
|
|
94
|
+
brood preferences hours <h> [<h>] when batched mail comes back, in this machine's time
|
|
95
|
+
brood programs the programs you allow to call Brood for you
|
|
96
|
+
brood programs allow|revoke <name>
|
|
97
|
+
allow one again, or revoke it, once you approve it in the app
|
|
98
|
+
brood connect where to connect a mailbox, in the app
|
|
99
|
+
brood plan where to choose a plan and pay, in the app
|
|
41
100
|
|
|
42
101
|
Accounts and session
|
|
43
102
|
brood accounts your mailboxes, and whether Brood can read them
|
|
103
|
+
brood accounts disconnect <mailbox>
|
|
104
|
+
let one go, once you approve it in the app
|
|
44
105
|
brood login [--read-only] sign in, by a code you approve in a browser
|
|
45
106
|
brood logout end this session
|
|
46
107
|
brood version
|
|
@@ -53,8 +114,10 @@ Options
|
|
|
53
114
|
--state <state> classifications in one state
|
|
54
115
|
--week <monday> brood week for an earlier week
|
|
55
116
|
--classification <id> brood rules for one classification
|
|
56
|
-
--
|
|
57
|
-
--
|
|
117
|
+
--all proposals file: those marked ready; unsubscribe: everyone listed
|
|
118
|
+
--group <name> relationships add, accept, move: the group they join, made if it is new
|
|
119
|
+
--check keep add, relationships add and remove, proposals file, unsubscribe, rule-book set: say what it would do, and do nothing
|
|
120
|
+
--yes keep add, relationships add and remove, proposals file, unsubscribe, keep-out, own-rules adopt, rule-book set and reset: do it without asking
|
|
58
121
|
--owner <user id> the index of someone who granted you access
|
|
59
122
|
--no-color no dimming, as NO_COLOR also asks`;
|
|
60
123
|
async function logout(io) {
|
|
@@ -92,6 +155,8 @@ const OPTION_NAMES = [
|
|
|
92
155
|
"week",
|
|
93
156
|
"sender",
|
|
94
157
|
"classification",
|
|
158
|
+
"group",
|
|
159
|
+
"all",
|
|
95
160
|
"check",
|
|
96
161
|
"yes",
|
|
97
162
|
];
|
|
@@ -114,6 +179,8 @@ export async function run(io, argv) {
|
|
|
114
179
|
week: { type: "string" },
|
|
115
180
|
sender: { type: "string" },
|
|
116
181
|
classification: { type: "string" },
|
|
182
|
+
group: { type: "string" },
|
|
183
|
+
all: { type: "boolean" },
|
|
117
184
|
check: { type: "boolean" },
|
|
118
185
|
yes: { type: "boolean" },
|
|
119
186
|
owner: { type: "string" },
|
|
@@ -156,6 +223,17 @@ export async function run(io, argv) {
|
|
|
156
223
|
io.out(VERSION);
|
|
157
224
|
return 0;
|
|
158
225
|
}
|
|
226
|
+
// Connecting and paying happen on the mail provider's and Stripe's own
|
|
227
|
+
// pages, reached from the app (#1729), so these name the app's page and
|
|
228
|
+
// read nothing, as `brood login` names the page it approves on.
|
|
229
|
+
if (command === "connect" || command === "plan") {
|
|
230
|
+
takes([]);
|
|
231
|
+
session();
|
|
232
|
+
io.out(command === "connect"
|
|
233
|
+
? `Connect a mailbox in Brood, where your mail provider asks you to allow it: ${APP_ORIGIN}/account/connect`
|
|
234
|
+
: `Choose your plan in Brood. Paying is on Stripe's page, reached from there: ${APP_ORIGIN}/account#plan`);
|
|
235
|
+
return 0;
|
|
236
|
+
}
|
|
159
237
|
if (command === "login") {
|
|
160
238
|
takes([], true);
|
|
161
239
|
session(true);
|
|
@@ -189,6 +267,8 @@ export async function run(io, argv) {
|
|
|
189
267
|
...(values.classification === undefined
|
|
190
268
|
? {}
|
|
191
269
|
: { classification: values.classification }),
|
|
270
|
+
...(values.group === undefined ? {} : { group: values.group }),
|
|
271
|
+
...(values.all ? { all: true } : {}),
|
|
192
272
|
...(values.check ? { check: true } : {}),
|
|
193
273
|
...(values.yes ? { yes: true } : {}),
|
|
194
274
|
};
|
package/dist/sign-in.js
CHANGED
|
@@ -95,7 +95,7 @@ export async function login(io, readOnly, noColor = false) {
|
|
|
95
95
|
io.err(line);
|
|
96
96
|
io.err("");
|
|
97
97
|
io.err(acts(credentials.scope)
|
|
98
|
-
? "Signed in. brood can read your index, hush and unhush senders, keep senders in view, and add
|
|
98
|
+
? "Signed in. brood can read your index, hush and unhush senders, keep senders in view, and add relationships."
|
|
99
99
|
: "Signed in. brood can read your index, and change nothing.");
|
|
100
100
|
return;
|
|
101
101
|
}
|