@whatcha/cli 0.1.0 → 0.3.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.
Files changed (37) hide show
  1. package/README.md +185 -24
  2. package/dist/auth/session.js +50 -0
  3. package/dist/auth/session.js.map +1 -1
  4. package/dist/auth/token-store.js.map +1 -1
  5. package/dist/cli.js +36 -5
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/diaries.js +14 -3
  8. package/dist/commands/diaries.js.map +1 -1
  9. package/dist/commands/login.js +82 -7
  10. package/dist/commands/login.js.map +1 -1
  11. package/dist/commands/profiles.js +122 -11
  12. package/dist/commands/profiles.js.map +1 -1
  13. package/dist/commands/publish.js +81 -0
  14. package/dist/commands/publish.js.map +1 -0
  15. package/dist/commands/shared-diary.js +255 -0
  16. package/dist/commands/shared-diary.js.map +1 -0
  17. package/dist/commands/whoami.js +50 -0
  18. package/dist/commands/whoami.js.map +1 -0
  19. package/dist/commands/wiki.js +386 -0
  20. package/dist/commands/wiki.js.map +1 -0
  21. package/dist/commands/write.js +34 -3
  22. package/dist/commands/write.js.map +1 -1
  23. package/dist/http-client.js +16 -0
  24. package/dist/http-client.js.map +1 -1
  25. package/dist/lib/append-entry.js +60 -8
  26. package/dist/lib/append-entry.js.map +1 -1
  27. package/dist/lib/entry-date.js +22 -2
  28. package/dist/lib/entry-date.js.map +1 -1
  29. package/dist/lib/image-upload.js +126 -0
  30. package/dist/lib/image-upload.js.map +1 -0
  31. package/dist/lib/personal-access-token.js +46 -0
  32. package/dist/lib/personal-access-token.js.map +1 -0
  33. package/dist/lib/profile-family.js +29 -0
  34. package/dist/lib/profile-family.js.map +1 -0
  35. package/dist/lib/publication.js +55 -0
  36. package/dist/lib/publication.js.map +1 -0
  37. package/package.json +4 -4
package/README.md CHANGED
@@ -25,18 +25,34 @@ Requires Node >= 22 (fetch, `node:util`'s `parseArgs`, and the fixed
25
25
  ### `whatcha login`
26
26
 
27
27
  ```
28
- whatcha login [--email <email>] [--password <password>] [--token <refresh-token>] [--json]
28
+ whatcha login --key <personal-access-key> [--json]
29
+ whatcha login [--email <email>] [--password <password>] [--json]
30
+ whatcha login --token <refresh-token> [--json]
29
31
  ```
30
32
 
33
+ **For scripts, servers and AI agents, use a personal access key (#1663).**
34
+ Issue one in the app under *Profile → Connected apps and keys* (#1469,
35
+ server side in #1550) -- read-only or read/write, with an expiry -- and
36
+ pass it as `--key`, or set `WHATCHA_KEY` and run `whatcha login`. A key
37
+ handed to `--token` / `WHATCHA_TOKEN` is recognised by its `whatcha_pat_`
38
+ prefix and used as a key too. `login` checks the key with `GET /me`
39
+ before saving it. A key is the Bearer credential itself: it is never
40
+ refreshed, never meets a captcha, and stops working the moment it is
41
+ revoked -- every command then fails with `KEY_REVOKED` (or `KEY_EXPIRED`
42
+ once it expires) and a pointer to where to issue a new one. Explicit
43
+ `--email` / `--password` / `--token` flags win over a `WHATCHA_KEY` left
44
+ in the environment.
45
+
31
46
  Signs in and stores the session -- an OS credential store when one is
32
47
  available (macOS Keychain via `security`, Linux's Secret Service via
33
48
  `secret-tool`), otherwise a `0600` file under the OS config dir
34
49
  (`~/.config/whatcha/credentials.json` on Linux, `~/Library/.../whatcha` is
35
50
  not used on macOS since the Keychain is tried first, `%APPDATA%\whatcha` on
36
51
  Windows). Every other command reads that session and refreshes it as
37
- needed; there is no separate `whatcha logout` in this first version -- clear
38
- the credential store yourself (Keychain Access, `secret-tool clear service
39
- whatcha-cli account whatcha`, or delete the file) if you need to.
52
+ needed (a key is never refreshed); there is no `whatcha logout` -- revoke
53
+ a key in the app, or clear the credential store yourself (Keychain Access,
54
+ `secret-tool clear service whatcha-cli account whatcha`, or delete the
55
+ file) if you need to.
40
56
 
41
57
  Email and password can come from `--email`/`--password`, from
42
58
  `WHATCHA_EMAIL`/`WHATCHA_PASSWORD`, or (only when neither is set) an
@@ -50,20 +66,29 @@ failed" / "Please complete the verification") trying to sign in an AI
50
66
  partner account. `POST /auth/login` also answers a captcha rejection with
51
67
  the same generic 401 as a wrong password, so `whatcha` frequently cannot
52
68
  tell you which one happened. Do not keep retrying the password in that
53
- case. Instead:
69
+ case: use a personal access key (above). A refresh token still works as
70
+ before:
54
71
 
55
72
  ```
56
73
  whatcha login --token <refresh-token>
57
74
  ```
58
75
 
59
76
  or set `WHATCHA_TOKEN` to the same value. This calls `POST /auth/refresh`
60
- directly, which is **not** captcha-gated, so it works from a machine that
61
- can never pass Turnstile. The refresh token itself has to come from
62
- somewhere that *can* solve the challenge -- a browser or the mobile app,
63
- signed in once, with the token then handed to the headless machine out of
64
- band. As of this writing there is no self-service "show me my token" screen
65
- in the app to get one from; see this PR's description for what a real fix
66
- looks like on the API/product side.
77
+ directly, which is **not** captcha-gated. The refresh token has to come
78
+ from somewhere that *can* solve the challenge -- a browser or the mobile
79
+ app -- and unlike a key it cannot be limited to read-only or revoked on its
80
+ own, so prefer a key.
81
+
82
+ ### `whatcha whoami`
83
+
84
+ ```
85
+ whatcha whoami [--json]
86
+ ```
87
+
88
+ Asks the API (`GET /me`) who the saved credential is -- `id`, `username`,
89
+ `displayName`, `email` -- plus `authKind` (`"session"` or `"key"`) and
90
+ whether the CLI is switched into a sub-profile. A revoked key shows up here
91
+ as `KEY_REVOKED`.
67
92
 
68
93
  Advanced: if `WHATCHA_SUPABASE_URL` and `WHATCHA_SUPABASE_ANON_KEY` are both
69
94
  set, `whatcha login` talks to GoTrue directly instead of through
@@ -82,14 +107,85 @@ whatcha diaries [--json]
82
107
 
83
108
  Lists the diaries you can see (your personal shelf, same set `GET /diaries`
84
109
  without `groupId` returns -- so not diaries in a system group like Public
85
- Square).
110
+ Square). Each one in `--json` also carries `isPublic` and `publicUrl`
111
+ (#1701; `null` unless public) -- see `whatcha publish` for what makes a
112
+ diary public. Working that out costs one `GET /groups` walk plus one
113
+ `GET /diaries/{id}` per diary in a published group; a shelf with no shared
114
+ diaries costs nothing extra.
115
+
116
+ ### `whatcha diary-new` / `whatcha invite`
117
+
118
+ ```
119
+ whatcha diary-new <name> [--with <@handle>]... [--timezone <tz>] [--description "..."] [--json]
120
+ whatcha invite <diary> <@handle> [--json]
121
+ ```
122
+
123
+ A diary written together (#1700) -- an exchange diary with a friend, or with
124
+ an AI partner profile. `diary-new` does what the app's "Write this diary
125
+ with someone" does: it creates a group named after the diary (you own it;
126
+ the plan's limit on owned groups applies), then the diary in that group,
127
+ readable by every member. `--timezone` is an IANA zone (`Asia/Tokyo`) and
128
+ decides which day an entry lands on; without it the server's default is
129
+ used. `--description` (at most 1,000 characters) goes on both. If the diary
130
+ cannot be created, the empty group is deleted again.
131
+
132
+ Membership is the group's, and the API joins nobody without their own
133
+ accept -- there is no "add this user" call. So `--with` (repeatable) and
134
+ `invite` do one of three things per `@handle`:
135
+
136
+ - **One of this login's sub-profiles** (see `profile-add`): it joins on the
137
+ spot. The CLI mints a one-use invite and accepts it *as that profile*,
138
+ with a session for it used once and never saved -- the CLI stays signed
139
+ in as it was.
140
+ - **The profile you are signed in as**: already a member; nothing is sent.
141
+ - **Anybody else** (and the account itself, seen from a sub-profile -- the
142
+ API issues no account session from there): a one-use invite link, valid
143
+ 7 days, for them to open and accept, exactly as the app's invite card
144
+ hands out. The `@handle` is only a label for it.
145
+
146
+ Creating an invite is the group owner's, as in the app. `diary-new --json`
147
+ prints `diary` (the created diary), `groupId` and `members`; each member,
148
+ like `invite --json` (which adds `diaryId` and `groupId`), is `handle`,
149
+ `profileId` (`null` when not one of yours), `joined`, `alreadyMember`,
150
+ `inviteUrl`/`expiresAt` (for a link) and `error` (`{code, message}`, when
151
+ that one handle failed). `diary-new` still creates the diary when a member
152
+ fails -- it exits with status 2 and says which, for `whatcha invite` to
153
+ retry. A diary on your personal shelf cannot be shared; start one with
154
+ `diary-new`.
155
+
156
+ ### `whatcha publish`
157
+
158
+ ```
159
+ whatcha publish <diary> [--off] [--json]
160
+ ```
161
+
162
+ Puts a diary on the web for anybody to read, signed in or not, and prints
163
+ where: `https://whatareyoudo.ing/diaries/<id>` (#1701). The API publishes
164
+ groups, not single diaries, so this is the app's "Publish" switch on the
165
+ diary's group (`PUT /groups/{id}/publication`, owner only): **every diary in
166
+ that group its members can read becomes public with it.** A diary from
167
+ `diary-new` has a group of its own, so there that is just the one diary. A
168
+ diary kept to its creator would stay private in a published group, so
169
+ `publish` opens it to the group first (`PUT /diaries/{id}/visibility`,
170
+ reported as `openedToGroup: true`) -- otherwise the printed link would be a
171
+ 404. `--off` takes the group back off the web and changes nothing else. A
172
+ diary on your personal shelf cannot be published. `--json` prints
173
+ `diaryId`, `groupId`, `groupName`, `isPublic`, `url` (`null` with `--off`)
174
+ and `openedToGroup`.
86
175
 
87
176
  ### `whatcha write`
88
177
 
89
178
  ```
90
- whatcha write <diary> --text "..." [--time HH:MM] [--date YYYY-MM-DD] [--json]
179
+ whatcha write <diary> --text "..." [--title "..."] [--tag <tag>]... [--time HH:MM] [--date YYYY-MM-DD] [--json]
91
180
  ```
92
181
 
182
+ `--title` and `--tag` (#1665) set the same `content.title` / `content.tags`
183
+ the app does, under the same rule as the text -- nothing somebody else
184
+ wrote is removed: `--title` only fills an entry that has no title yet (an
185
+ existing one is kept, reported as `titleKept: true` and a note on stderr),
186
+ and `--tag` (repeat it for several) only adds to the entry's tags --
187
+ trimmed, exact duplicates dropped, at most 32 in all, 64 characters each.
188
+
93
189
  `<diary>` is a diary id or its exact name (case-insensitive; an ambiguous
94
190
  name lists the matches and asks for the id instead). `--date`/`--time`
95
191
  default to today/now in **the diary's own timezone**, not the machine's --
@@ -127,12 +223,14 @@ no `?date=` filter, so this pages through the diary's entries
127
223
  newest-first (`src/lib/entry-find.ts`) until it finds that day or passes it
128
224
  -- exact, not fuzzy, but not O(1) for a very old date on a very active diary.
129
225
 
130
- ### `whatcha profiles` / `whatcha switch`
226
+ ### `whatcha profiles` / `whatcha switch` / `whatcha profile-add` / `whatcha profile-rm`
131
227
 
132
228
  ```
133
229
  whatcha profiles [--json]
134
230
  whatcha switch <@handle> [--json]
135
231
  whatcha switch --account [--json]
232
+ whatcha profile-add <@handle> --name <display name> [--avatar <file>] [--json]
233
+ whatcha profile-rm <@handle> [--json]
136
234
  ```
137
235
 
138
236
  Sub-accounts (#1538): one login, more than one profile. A sub-profile is an
@@ -140,34 +238,97 @@ ordinary user with its own `@handle`, so after a switch `write`, `read` and
140
238
  `diaries` all act as that profile -- none of them takes a flag, and none of
141
239
  them knows the feature exists. The saved session simply is that profile.
142
240
 
143
- `profiles` marks the current one with `*` and labels the account. Creating a
144
- sub-profile is done in the app; this CLI switches between the ones that
145
- exist.
241
+ `profiles` marks the current one with `*` and labels the account; `--json`
242
+ adds `remaining`, how many more the plan allows.
243
+
244
+ `profile-add` (#1699) creates one (`POST /me/profiles`, as the app's "Add a
245
+ profile" does): a `@handle` of 3-30 letters, digits, `_` or `-` starting
246
+ with a letter or digit, and a `--name` of at most 80 characters. A taken
247
+ handle or a full plan is the API's refusal. It does not switch -- run
248
+ `whatcha switch <@handle>` for that. `--avatar <file>` (JPEG, PNG, WebP, GIF
249
+ or AVIF, at most 5 MB, checked before anything is created) is set as the
250
+ new profile itself would set it: `POST /me/avatar` with a session for the
251
+ profile, used once and never saved. If the profile is created but the
252
+ avatar fails, the profile stays, `avatarError` says why and the exit status
253
+ is 2. `--json` prints `profile` (`id`, `username`, `displayName`,
254
+ `avatarUrl`, `parentProfileId`) and `avatarError` (`null`, or
255
+ `{code, message}`).
146
256
 
147
257
  `switch --account` is how you come back. The API refuses to mint an account
148
258
  session from a sub-profile's session on purpose -- a sub-profile that could
149
259
  ask for one would be a way to take the account over -- so `switch` sets the
150
260
  account's refresh token aside in the same credential store and `--account`
151
261
  spends it. Switching from one sub-profile to a sibling carries it forward
152
- unchanged.
262
+ unchanged. Logged in with a personal access key, it is the key that is set
263
+ aside (`accountKey`), and `--account` goes back to it.
264
+
265
+ `profile-rm` deletes a sub-profile and everything it wrote; the API refuses
266
+ the account itself and the profile currently in use.
153
267
 
154
268
  Billing is the one thing a sub-profile does not have: the account's plan is
155
269
  its plan, and a sub-profile's own limits are the account's.
156
270
 
271
+ ### `whatcha wiki`
272
+
273
+ ```
274
+ whatcha wiki list [--search <text>] [--group <group-id>] [--limit N] [--cursor <c>] [--json]
275
+ whatcha wiki read <page> [--group <group-id>] [--json]
276
+ whatcha wiki write <page> --text "..." [--image <file>]... [--cover <file>] [--replace] [--message "..."] [--group <group-id>] [--json]
277
+ whatcha wiki cover <page> <file> | --clear [--group <group-id>] [--json]
278
+ ```
279
+
280
+ The Experience Wiki (#1664), on the app's own routes: Public Square's
281
+ `/experience-pages`, or with `--group` that group's
282
+ `/groups/:groupId/experience-pages` (#1348; `whatcha diaries --json` shows
283
+ each diary's `groupId`). `<page>` is the page's tag, e.g. `"Kyoto Tower"`
284
+ (a leading `#` is dropped). Who may read or write which page -- group
285
+ membership, a page's Owner and edit policy (#1344), a lock -- is the API's
286
+ call; a page this account cannot see reads as `found: false`, any other
287
+ refusal is printed as the API sent it.
288
+
289
+ `wiki write` appends below the page's current text and creates the page if
290
+ it does not exist; `--replace` saves the text as the page's new version
291
+ instead. Either way every earlier version stays in the page's history. The
292
+ wiki's `PUT` takes no expected revision, so if somebody else saves between
293
+ `write`'s read and its `PUT`, that is reported (`concurrentEdit: true`, a
294
+ warning on stderr, exit status 2) rather than passed off as a clean save --
295
+ their version is in the history to merge back.
296
+
297
+ Images (#1667). `--image <file>` (repeatable) uploads a local image and
298
+ appends `![<file name>](media:<mediaAssetId>)` for it below the text, in the
299
+ order given, one paragraph each; with images, `--text` may be left out.
300
+ `--cover <file>` uploads an image and makes it the page's cover in the same
301
+ save. `wiki cover <page> <file>` sets the cover of an existing page on its
302
+ own, and `wiki cover <page> --clear` removes it. Uploads go through the
303
+ app's own flow (`POST /uploads` into the page's group -- Public Square's for
304
+ the public wiki -- the PUT to the signed URL, then
305
+ `POST /uploads/:id/complete`), so the server's limits apply: JPEG, PNG,
306
+ WebP, GIF or AVIF, at most 40 MB, within the account's storage quota. Both
307
+ are checked before anything is sent -- the type from the file's first
308
+ bytes, not its name -- and so is the page's 20,000-character limit, so a bad
309
+ file or an over-long page uploads nothing. `wiki read` lists each image's
310
+ signed URL (valid for about an hour) after the text, and the cover's above
311
+ it; `--json` adds `media` (`id`, `url`, `mimeType`, `altText`),
312
+ `coverMediaAssetId` and `coverUrl`. `wiki write --json` reports `images`
313
+ (`file`, `mediaAssetId`) and `coverMediaAssetId`.
314
+
157
315
  ## The `--json` contract
158
316
 
159
317
  Every command accepts `--json`. On success it prints exactly one JSON
160
318
  object to stdout: `{"ok": true, ...}`, with the fields documented per
161
- command above (`diaries`, `entryId`/`mode`/`verified` for `write`,
162
- `body`/`title`/`tags`/... for `read`). On failure it prints
319
+ command above (`diaries`, `entryId`/`mode`/`verified`/`title`/`tags`/`titleKept`
320
+ for `write`, `body`/`title`/`tags`/... for `read`, `pages` / `body` /
321
+ `mode`/`concurrentEdit` for `wiki`, `profile`/`avatarError` for
322
+ `profile-add`, `diary`/`members` for `diary-new`, `url`/`isPublic` for
323
+ `publish`). On failure it prints
163
324
  `{"ok": false, "error": {"code", "message"}}` -- still to stdout, so a
164
325
  script doing `whatcha ... --json | jq` gets parseable JSON either way,
165
326
  without also having to capture stderr.
166
327
 
167
328
  **Never included, on success or failure:** an access token, a refresh
168
- token, or a password. `whatcha login --json`'s output is
169
- `{"ok", "userId", "email", "credentialStore"}` -- the store's name, never
170
- its contents.
329
+ token, a personal access key, or a password. `whatcha login --json`'s
330
+ output is `{"ok", "userId", "email", "credentialStore"}` (plus
331
+ `"authKind": "key"` for a key) -- the store's name, never its contents.
171
332
 
172
333
  ## Tests
173
334
 
@@ -1,13 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KeyErrorClient = void 0;
3
4
  exports.saveSession = saveSession;
4
5
  exports.loadSession = loadSession;
5
6
  exports.clearSession = clearSession;
6
7
  exports.authenticatedClient = authenticatedClient;
8
+ exports.personalAccessTokenClient = personalAccessTokenClient;
7
9
  exports.anonymousClient = anonymousClient;
8
10
  const http_client_1 = require("../http-client");
9
11
  const config_1 = require("../config");
10
12
  const errors_1 = require("../errors");
13
+ const personal_access_token_1 = require("../lib/personal-access-token");
11
14
  const token_store_1 = require("./token-store");
12
15
  /** Refresh this many seconds before actual expiry, so a call in flight does not race the token dying mid-request. */
13
16
  const REFRESH_MARGIN_SECONDS = 60;
@@ -65,6 +68,11 @@ async function authenticatedClient(stores = (0, token_store_1.candidateStores)()
65
68
  throw new errors_1.CliUsageError("Not logged in. Run `whatcha login` first.");
66
69
  }
67
70
  const baseUrl = session.apiBaseUrl || (0, config_1.apiBaseUrl)();
71
+ if (session.authKind === "key") {
72
+ // A personal access key is the Bearer itself: nothing to refresh, and
73
+ // its refusals are reworded as the key's (KEY_REVOKED / KEY_EXPIRED).
74
+ return { client: personalAccessTokenClient(baseUrl, session.accessToken), session };
75
+ }
68
76
  const nowSeconds = Date.now() / 1000;
69
77
  if (session.expiresAt / 1000 - nowSeconds < REFRESH_MARGIN_SECONDS) {
70
78
  const anon = new http_client_1.FetchWhatchaClient(baseUrl, async () => undefined);
@@ -90,6 +98,48 @@ async function authenticatedClient(stores = (0, token_store_1.candidateStores)()
90
98
  const client = new http_client_1.FetchWhatchaClient(baseUrl, async () => `Bearer ${session.accessToken}`);
91
99
  return { client, session };
92
100
  }
101
+ /**
102
+ * A client that sends a personal access key (#1663) as its Bearer and
103
+ * reports a 401 as the key's problem -- see lib/personal-access-token.ts.
104
+ */
105
+ function personalAccessTokenClient(baseUrl, key) {
106
+ return new KeyErrorClient(new http_client_1.FetchWhatchaClient(baseUrl, async () => `Bearer ${key}`));
107
+ }
108
+ /** Wraps any client so a 401 reads as KEY_REVOKED/KEY_EXPIRED. Exported for tests. */
109
+ class KeyErrorClient {
110
+ inner;
111
+ constructor(inner) {
112
+ this.inner = inner;
113
+ }
114
+ wrap(p) {
115
+ return p.catch((err) => {
116
+ throw (0, personal_access_token_1.translateKeyError)(err);
117
+ });
118
+ }
119
+ get(path, query) {
120
+ return this.wrap(this.inner.get(path, query));
121
+ }
122
+ post(path, body) {
123
+ return this.wrap(this.inner.post(path, body));
124
+ }
125
+ put(path, body) {
126
+ return this.wrap(this.inner.put(path, body));
127
+ }
128
+ patch(path, body) {
129
+ return this.wrap(this.inner.patch(path, body));
130
+ }
131
+ delete(path) {
132
+ return this.wrap(this.inner.delete(path));
133
+ }
134
+ getPage(path, query) {
135
+ return this.wrap(this.inner.getPage(path, query));
136
+ }
137
+ /** Not wrapped: the signed URL carries no key, so its 401/403 is never the key's. */
138
+ putBytes(url, headers, bytes) {
139
+ return this.inner.putBytes(url, headers, bytes);
140
+ }
141
+ }
142
+ exports.KeyErrorClient = KeyErrorClient;
93
143
  /** An unauthenticated client for `/auth/login` itself, or for `--api-url` probing. */
94
144
  function anonymousClient(baseUrl = (0, config_1.apiBaseUrl)()) {
95
145
  return new http_client_1.FetchWhatchaClient(baseUrl, async () => undefined);
@@ -1 +1 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/auth/session.ts"],"names":[],"mappings":";;AAoBA,kCAYC;AAGD,kCAOC;AAGD,oCAIC;AAUD,kDAkCC;AAGD,0CAEC;AAlGD,gDAAmE;AACnE,sCAAuC;AACvC,sCAA0C;AAE1C,+CAA2E;AAE3E,qHAAqH;AACrH,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAMlC;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAAC,OAAsB,EAAE,SAAuB,IAAA,6BAAe,GAAE;IAChG,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,WAAW,EAAE,CAAC;YAAE,SAAS;QAC3C,IAAI,CAAC;YACH,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC1B,OAAO,EAAE,KAAK,EAAE,CAAC;QACnB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAA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EAAE,CAAC,CAAC;IACtD,CAAC;CACF;AA9BD,wCA8BC;AAED;;;;;;;GAOG;AACH,SAAgB,eAAe;IAC7B,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ;QAAE,MAAM,CAAC,IAAI,CAAC,IAAI,gBAAgB,EAAE,CAAC,CAAC;IACvE,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;QAAE,MAAM,CAAC,IAAI,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;IAC1E,MAAM,CAAC,IAAI,CAAC,IAAI,cAAc,EAAE,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/dist/cli.js CHANGED
@@ -7,25 +7,41 @@ const diaries_1 = require("./commands/diaries");
7
7
  const write_1 = require("./commands/write");
8
8
  const read_1 = require("./commands/read");
9
9
  const profiles_1 = require("./commands/profiles");
10
+ const shared_diary_1 = require("./commands/shared-diary");
11
+ const publish_1 = require("./commands/publish");
12
+ const whoami_1 = require("./commands/whoami");
13
+ const wiki_1 = require("./commands/wiki");
10
14
  const output_1 = require("./lib/output");
11
15
  const USAGE = `whatcha -- command-line client for what-are-you-do-ing
12
16
 
13
17
  Usage:
14
18
  whatcha login [--email <email>] [--password <password>] [--json]
19
+ whatcha login --key <personal-access-key> [--json]
15
20
  whatcha login --token <refresh-token> [--json]
21
+ whatcha whoami [--json]
16
22
  whatcha diaries [--json]
17
- whatcha write <diary> --text "..." [--time HH:MM] [--date YYYY-MM-DD] [--json]
23
+ whatcha diary-new <name> [--with <@handle>]... [--timezone <tz>] [--description "..."] [--json]
24
+ whatcha invite <diary> <@handle> [--json]
25
+ whatcha publish <diary> [--off] [--json]
26
+ whatcha write <diary> --text "..." [--title "..."] [--tag <tag>]... [--time HH:MM] [--date YYYY-MM-DD] [--json]
18
27
  whatcha read <diary> [--date YYYY-MM-DD] [--json]
19
28
  whatcha profiles [--json]
20
29
  whatcha switch <@handle> [--json]
21
30
  whatcha switch --account [--json]
31
+ whatcha profile-add <@handle> --name <display name> [--avatar <file>] [--json]
22
32
  whatcha profile-rm <@handle> [--json]
33
+ whatcha wiki list [--search <text>] [--group <group-id>] [--limit N] [--cursor <c>] [--json]
34
+ whatcha wiki read <page> [--group <group-id>] [--json]
35
+ whatcha wiki write <page> --text "..." [--image <file>]... [--cover <file>] [--replace] [--message "..."] [--group <group-id>] [--json]
36
+ whatcha wiki cover <page> <file> | --clear [--group <group-id>] [--json]
23
37
 
24
38
  Every command accepts --json for machine-readable output.
25
- Credentials for login can also come from WHATCHA_EMAIL / WHATCHA_PASSWORD,
26
- or WHATCHA_TOKEN for a pre-issued refresh token (see README.md -- this is
27
- the escape hatch for a headless machine that cannot pass a captcha
28
- challenge, issue #1428).
39
+ For scripts and servers, log in with a personal access key (issue one in
40
+ Profile -> Connected apps and keys): --key, or WHATCHA_KEY. A key is used
41
+ as-is, never refreshed, and stops working the moment it is revoked
42
+ (error code KEY_REVOKED). Credentials for login can also come from
43
+ WHATCHA_EMAIL / WHATCHA_PASSWORD, or WHATCHA_TOKEN for a refresh token
44
+ (which may also hold a key).
29
45
  `;
30
46
  /**
31
47
  * The whole CLI as one testable function: argv in, exit code out, nothing
@@ -55,16 +71,31 @@ async function run(argv) {
55
71
  return (await (0, login_1.runLogin)((0, login_1.parseLoginArgs)(rest))).exitCode;
56
72
  case "diaries":
57
73
  return (await (0, diaries_1.runDiaries)((0, diaries_1.parseDiariesArgs)(rest))).exitCode;
74
+ // A diary written together, and putting it on the web (#1700, #1701).
75
+ case "diary-new":
76
+ return (await (0, shared_diary_1.runDiaryNew)((0, shared_diary_1.parseDiaryNewArgs)(rest))).exitCode;
77
+ case "invite":
78
+ return (await (0, shared_diary_1.runInvite)((0, shared_diary_1.parseInviteArgs)(rest))).exitCode;
79
+ case "publish":
80
+ return (await (0, publish_1.runPublish)((0, publish_1.parsePublishArgs)(rest))).exitCode;
58
81
  case "write":
59
82
  return (await (0, write_1.runWrite)((0, write_1.parseWriteArgs)(rest))).exitCode;
60
83
  case "read":
61
84
  return (await (0, read_1.runRead)((0, read_1.parseReadArgs)(rest))).exitCode;
85
+ case "whoami":
86
+ return (await (0, whoami_1.runWhoami)((0, whoami_1.parseWhoamiArgs)(rest))).exitCode;
87
+ // Experience Wiki (#1664). Public Square's pages, or a group's with
88
+ // --group; images and covers from local files (#1667).
89
+ case "wiki":
90
+ return (await (0, wiki_1.runWiki)((0, wiki_1.parseWikiArgs)(rest))).exitCode;
62
91
  // Sub-accounts (#1538). After a switch every command above acts as
63
92
  // the profile switched into -- the saved session simply is it.
64
93
  case "profiles":
65
94
  return (await (0, profiles_1.runProfiles)((0, profiles_1.parseProfilesArgs)(rest))).exitCode;
66
95
  case "switch":
67
96
  return (await (0, profiles_1.runSwitch)((0, profiles_1.parseSwitchArgs)(rest))).exitCode;
97
+ case "profile-add":
98
+ return (await (0, profiles_1.runAdd)((0, profiles_1.parseAddArgs)(rest))).exitCode;
68
99
  case "profile-rm":
69
100
  return (await (0, profiles_1.runRemove)((0, profiles_1.parseRemoveArgs)(rest))).exitCode;
70
101
  default:
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AAyCA,kBA2CC;AApFD,qCAAmD;AACnD,4CAA4D;AAC5D,gDAAkE;AAClE,4CAA4D;AAC5D,0CAAyD;AACzD,kDAO6B;AAC7B,yCAAyD;AAEzD,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;CAkBb,CAAC;AAEF;;;;;GAKG;AACI,KAAK,UAAU,GAAG,CAAC,IAAc;IACtC,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEhC,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACzD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC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E,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;;YACpF,IAAA,uBAAc,EAAC,GAAG,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACnD,OAAO,CAAC,CAAC;IACX,CAAC;IACD,mEAAmE;IACnE,wEAAwE;IACxE,kDAAkD;IAClD,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,IAAI,SAAS;QAAE,IAAA,kBAAS,EAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;;QACzE,IAAA,uBAAc,EAAC,4BAA4B,OAAO,EAAE,CAAC,CAAC;IAC3D,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -4,9 +4,11 @@ exports.parseDiariesArgs = parseDiariesArgs;
4
4
  exports.runDiaries = runDiaries;
5
5
  const node_util_1 = require("node:util");
6
6
  const session_1 = require("../auth/session");
7
+ const config_1 = require("../config");
7
8
  const errors_1 = require("../errors");
8
9
  const diary_resolve_1 = require("../lib/diary-resolve");
9
10
  const output_1 = require("../lib/output");
11
+ const publication_1 = require("../lib/publication");
10
12
  function parseDiariesArgs(argv) {
11
13
  let values;
12
14
  try {
@@ -22,8 +24,16 @@ function parseDiariesArgs(argv) {
22
24
  return { json: values.json };
23
25
  }
24
26
  async function runDiaries(opts, deps = {}) {
25
- const client = deps.client ?? (await (0, session_1.authenticatedClient)()).client;
26
- const diaries = await (0, diary_resolve_1.listAllDiaries)(client);
27
+ const resolved = deps.client ? null : await (0, session_1.authenticatedClient)();
28
+ const client = deps.client ?? resolved.client;
29
+ const base = deps.apiBaseUrl ?? (resolved?.session.apiBaseUrl || (0, config_1.apiBaseUrl)());
30
+ const listed = await (0, diary_resolve_1.listAllDiaries)(client);
31
+ // #1701: whether each diary is published, and where it is read.
32
+ const published = await (0, publication_1.publicDiaryIds)(client, listed);
33
+ const diaries = listed.map((d) => {
34
+ const isPublic = published.has(d.id);
35
+ return { ...d, isPublic, publicUrl: isPublic ? (0, publication_1.publicDiaryUrl)(base, d.id) : null };
36
+ });
27
37
  if (opts.json) {
28
38
  (0, output_1.printJson)({ ok: true, diaries });
29
39
  return { exitCode: 0 };
@@ -34,7 +44,8 @@ async function runDiaries(opts, deps = {}) {
34
44
  }
35
45
  for (const d of diaries) {
36
46
  const entries = d.entryCount === 1 ? "1 entry" : `${d.entryCount} entries`;
37
- (0, output_1.printLine)(`${d.id} ${d.name} [${d.groupName}] ${entries} tz=${d.timezone}`);
47
+ const pub = d.publicUrl ? ` public: ${d.publicUrl}` : "";
48
+ (0, output_1.printLine)(`${d.id} ${d.name} [${d.groupName}] ${entries} tz=${d.timezone}${pub}`);
38
49
  }
39
50
  return { exitCode: 0 };
40
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"diaries.js","sourceRoot":"","sources":["../../src/commands/diaries.ts"],"names":[],"mappings":";;AAWA,4CAYC;AAED,gCAqBC;AA9CD,yCAAsC;AACtC,6CAAsD;AACtD,sCAA0C;AAE1C,wDAAsD;AACtD,0CAAqD;AAMrD,SAAgB,gBAAgB,CAAC,IAAc;IAC7C,IAAI,MAAM,CAAC;IACX,IAAI,CAAC;QACH,CAAC,EAAE,MAAM,EAAE,GAAG,IAAA,qBAAS,EAAC;YACtB,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;YACtD,gBAAgB,EAAE,KAAK;SACxB,CAAC,CAAC,CAAC;IACN,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,sBAAa,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,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