wikimasters-cli 0.0.0-stage → 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 (77) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +125 -2
  3. package/dist/cli/config.js +47 -0
  4. package/dist/cli/config.js.map +1 -0
  5. package/dist/cli/main.js +10 -0
  6. package/dist/cli/main.js.map +1 -0
  7. package/dist/cli/output.js +297 -0
  8. package/dist/cli/output.js.map +1 -0
  9. package/dist/cli/pasted-session.js +49 -0
  10. package/dist/cli/pasted-session.js.map +1 -0
  11. package/dist/cli/program.js +334 -0
  12. package/dist/cli/program.js.map +1 -0
  13. package/dist/cli/session.js +30 -0
  14. package/dist/cli/session.js.map +1 -0
  15. package/dist/core/auction-bids.js +31 -0
  16. package/dist/core/auction-bids.js.map +1 -0
  17. package/dist/core/auction-cancel.js +17 -0
  18. package/dist/core/auction-cancel.js.map +1 -0
  19. package/dist/core/auction-create.js +40 -0
  20. package/dist/core/auction-create.js.map +1 -0
  21. package/dist/core/auction-list.js +16 -0
  22. package/dist/core/auction-list.js.map +1 -0
  23. package/dist/core/auction-search.js +38 -0
  24. package/dist/core/auction-search.js.map +1 -0
  25. package/dist/core/auction.js +79 -0
  26. package/dist/core/auction.js.map +1 -0
  27. package/dist/core/auth-cookie.js +50 -0
  28. package/dist/core/auth-cookie.js.map +1 -0
  29. package/dist/core/browser-login.js +81 -0
  30. package/dist/core/browser-login.js.map +1 -0
  31. package/dist/core/card-id.js +5 -0
  32. package/dist/core/card-id.js.map +1 -0
  33. package/dist/core/card-search.js +51 -0
  34. package/dist/core/card-search.js.map +1 -0
  35. package/dist/core/card-value.js +43 -0
  36. package/dist/core/card-value.js.map +1 -0
  37. package/dist/core/collection-list.js +44 -0
  38. package/dist/core/collection-list.js.map +1 -0
  39. package/dist/core/collection.js +46 -0
  40. package/dist/core/collection.js.map +1 -0
  41. package/dist/core/entry-id.js +4 -0
  42. package/dist/core/entry-id.js.map +1 -0
  43. package/dist/core/errors.js +28 -0
  44. package/dist/core/errors.js.map +1 -0
  45. package/dist/core/favourite.js +27 -0
  46. package/dist/core/favourite.js.map +1 -0
  47. package/dist/core/global-collection.js +58 -0
  48. package/dist/core/global-collection.js.map +1 -0
  49. package/dist/core/index.js +26 -0
  50. package/dist/core/index.js.map +1 -0
  51. package/dist/core/integer.js +15 -0
  52. package/dist/core/integer.js.map +1 -0
  53. package/dist/core/label.js +39 -0
  54. package/dist/core/label.js.map +1 -0
  55. package/dist/core/notification-list.js +32 -0
  56. package/dist/core/notification-list.js.map +1 -0
  57. package/dist/core/page.js +22 -0
  58. package/dist/core/page.js.map +1 -0
  59. package/dist/core/profile-collection.js +45 -0
  60. package/dist/core/profile-collection.js.map +1 -0
  61. package/dist/core/session.js +49 -0
  62. package/dist/core/session.js.map +1 -0
  63. package/dist/core/site.js +52 -0
  64. package/dist/core/site.js.map +1 -0
  65. package/dist/core/supabase.js +5 -0
  66. package/dist/core/supabase.js.map +1 -0
  67. package/dist/core/table-query.js +21 -0
  68. package/dist/core/table-query.js.map +1 -0
  69. package/dist/core/tag.js +25 -0
  70. package/dist/core/tag.js.map +1 -0
  71. package/dist/core/transient.js +40 -0
  72. package/dist/core/transient.js.map +1 -0
  73. package/dist/core/uuid.js +10 -0
  74. package/dist/core/uuid.js.map +1 -0
  75. package/dist/core/wishlist.js +66 -0
  76. package/dist/core/wishlist.js.map +1 -0
  77. package/package.json +42 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Quentin Pautrat
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 CHANGED
@@ -1,3 +1,126 @@
1
- # Temporary Holding Version
1
+ # wikimasters-cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `wikimasters` lets you play [WikiMasters](https://www.wiki-masters.com), the collectible card game built from Wikipedia articles, from the terminal. The site has no public API: the CLI calls the internal HTTP API its web front-end uses.
4
+
5
+ ## Prerequisites
6
+
7
+ - [Node.js](https://nodejs.org) 22.13.0 or later, with npm.
8
+ - A browser, to sign in to the site.
9
+ - For `login --firefox` only: Firefox installed in `/Applications` on macOS.
10
+
11
+ ## Getting started
12
+
13
+ 1. Install the CLI from npm:
14
+
15
+ ```sh
16
+ npm install -g wikimasters-cli
17
+ ```
18
+
19
+ 2. Sign in, as described in [Signing in](#signing-in):
20
+
21
+ ```sh
22
+ wikimasters login
23
+ ```
24
+
25
+ 3. Run a first read-only command:
26
+
27
+ ```sh
28
+ wikimasters wishlist list
29
+ ```
30
+
31
+ The CLI knows the site's public Supabase key. To replace it, set `WIKIMASTERS_SUPABASE_ANON_KEY` in the session file described in [Signing in](#signing-in) or in the environment; the file wins, and an empty value is ignored.
32
+
33
+ ## Commands
34
+
35
+ Run every command from any directory as `wikimasters <command>`. `wikimasters <command> --help` gives its arguments, options and examples.
36
+
37
+ | Command | What it does | Example |
38
+ |---|---|---|
39
+ | `login` | Signs in by pasting your browser's session, or with `--firefox` through a Firefox window it opens on macOS, and stores the session in `~/.config/wikimasters-cli/.env` | `wikimasters login` |
40
+ | `cards search <text...> [--in <field>]` | Finds the catalogue cards whose title contains the text, regardless of case, at most 50, ordered by title; `--in category` or `--in summary` searches the card's Wikipedia category or summary instead | `wikimasters cards search half dome` |
41
+ | `cards value <card-id...>` | Shows the average sale price in wikibidous of each card, owned or not, for each rarity it sold under, or that it never sold; stops at the first card the game refuses | `wikimasters cards value <card-uuid> <card-uuid>` |
42
+ | `cards global [text] [--page <n>] [--sort <field>] [--rarity <code>]... [--wishlist]` | Searches the game's Global Collection, in the card title and category, and prints one page of cards with whether you own or wish each one and the friends who own it with their rarities, then the total, the count by rarity, the pending offers and whether more cards match; options go to the game as given, pages counting from 0, `--rarity` repeated for several rarities, `--wishlist` keeping your wishlist's cards | `wikimasters cards global "Mont Blanc"` |
43
+ | `collection list [--rarity <code>] [--page <p>] [--limit <n>]` | Reads a page of your collection, earliest obtained first, with entry id, card id, owned rarity, copies, favourite and shiny state, labels and obtention date, and says when the page is full; `--rarity` keeps one of `C`, `PC`, `R`, `SR`, `UR`, `L`; `--page` reads the next pages, from 1 by default; `--limit` sets the cards per page, 1000 by default | `wikimasters collection list --rarity L --page 2` |
44
+ | `collection discard <entry-id...>` | Discards the entries of your collection of those ids, as given by `collection list`, for 1 wikibidou each, in a single request; the game refuses more than 100 ids | `wikimasters collection discard <entry-uuid> <entry-uuid>` |
45
+ | `collection star <entry-id>` | Marks an entry of your collection as favourite; fails when the game changes no entry, unknown or not yours | `wikimasters collection star <entry-uuid>` |
46
+ | `collection unstar <entry-id>` | Removes an entry of your collection from the favourites; fails when the game changes no entry, unknown or not yours | `wikimasters collection unstar <entry-uuid>` |
47
+ | `collection tag <entry-id> <label-id>` | Puts your label of that id, as given by `labels list`, on the entry of your collection of that id, as given by `collection list` | `wikimasters collection tag <entry-uuid> <label-uuid>` |
48
+ | `collection untag <entry-id> <label-id>` | Removes your label of that id, as given by `labels list`, from the entry of your collection of that id, as given by `collection list`; says so when the entry did not carry it | `wikimasters collection untag <entry-uuid> <label-uuid>` |
49
+ | `labels list` | Lists your labels, ordered by name, with their id, name and colour | `wikimasters labels list` |
50
+ | `labels create <name> [--color <colour>]` | Creates a label under the name as given and shows its id, name and colour; `--color` is sent to the game as given, a hex colour such as `#facc15` | `wikimasters labels create "Karmine Corp" --color "#facc15"` |
51
+ | `labels delete <label-id>` | Deletes your label of that id, as given by `labels list`, which removes it from your cards | `wikimasters labels delete <label-uuid>` |
52
+ | `profile collection <pseudo> [--page <n>] [--sort <field>] [--search <text>] [--rarity <code>]... [--wishlisted]` | Reads a page of a player's collection, at most 50 entries, with each entry's id, card id, title, owned rarity, copies, favourite and shiny state, labels and whether a pending trade holds the card, and says when the page is full; the options are sent to the game as given: `--page` from 0, the first page by default, `--sort` left out by default, `--rarity` repeated for several rarities, `--wishlisted` keeps the cards of your wishlist | `wikimasters profile collection LucasPerso --rarity UR` |
53
+ | `wishlist list` | Lists your wishlist, most recently added first, marking the cards already in your collection | `wikimasters wishlist list` |
54
+ | `wishlist add <card-id>` | Adds a catalogue card to your wishlist | `wikimasters wishlist add <card-uuid>` |
55
+ | `wishlist remove <card-id>` | Removes a card from your wishlist | `wikimasters wishlist remove <card-uuid>` |
56
+ | `notifications list [--type <type>]... [--unread] [--after <date>] [--page <p>] [--limit <n>]` | Reads a page of your notifications, most recent first, with date, type, whether it is unread, message and the other data the game attaches to it, such as the auction, card, player or trade concerned, and says when the page is full; `--type` keeps a type, sent as given, e.g. `marketplace_wishlist_listed`, repeated for several types; `--unread` keeps the unread ones; `--after` keeps those received strictly after a date, sent as given; `--page` reads the next pages, from 1 by default; `--limit` sets the notifications per page, 50 by default | `wikimasters notifications list --type marketplace_wishlist_listed --after 2026-10-16T13:31:00+00:00` |
57
+ | `auction list [--status <status>] [--limit <n>]` | Lists auctions in the order the game returns them, at most 50 by default, with card, status, end time, starting price, current bid, and whether you lead or sell them; `--status` keeps one status, e.g. `active` | `wikimasters auction list --status active --limit 20` |
58
+ | `auction search <text...> [--limit <n>] [--page <p>]` | Lists the auctions the game matches with the text, as the marketplace search field does, in its order, at most 50 by default, with the same details as `auction list`; `--page` reads the next pages, from 1 by default | `wikimasters auction search croix celtique` |
59
+ | `auction show <auction-id>` | Shows an auction's card, status, end time, starting price, current bid, and whether you lead or sell it | `wikimasters auction show 6e6bd506-4045-445c-8b6f-16a29592fe4d` |
60
+ | `auction bids [--page <p>] [--limit <n>]` | Reads a page of your bids on running auctions, in the order the game returns them, with auction id, card title, amount, date, the current bid, whether you lead and the end time, and says when the page is full; `--page` reads the next pages, from 1 by default; `--limit` sets the bids per page, 1000 by default | `wikimasters auction bids --page 2` |
61
+ | `auction create <entry-id> <starting-price> <duration>` | Puts the entry of your collection of that id, as given by `collection list`, up for auction at a starting price in wikibidous, for a duration in minutes, and prints the auction id; the game accepts or refuses it and gives its reason | `wikimasters auction create <entry-uuid> 50 60` |
62
+ | `auction cancel <auction-id>` | Cancels one of your auctions so its card returns to your collection, under a new id, and prints the auction id; the game accepts or refuses it and gives its reason | `wikimasters auction cancel <auction-uuid>` |
63
+ | `auction bid <auction-id> <amount>` | Bids an exact amount of wikibidous on an auction; the game accepts or refuses it and gives its reason | `wikimasters auction bid <auction-uuid> 25` |
64
+
65
+ A card id is the `id` that `cards search`, `cards global`, `collection list`, `profile collection` and `wishlist list` print, or the `card_id` in the data of a notification `notifications list` prints. An entry id is the `entryId` that `collection list` and `profile collection` print. A label id is the `id` that `labels list` and `labels create` print. An auction id is the `id` that `auction list`, `auction search` and `auction bids` print, the `auctionId` that `auction create` prints, the `auction_id` in the data of a notification `notifications list` prints, or the last part of the auction page URL, `https://www.wiki-masters.com/marketplace/<auction-id>`.
66
+
67
+ ### Output and exit codes
68
+
69
+ Results are text by default. With the global `--json` option, stdout carries only the result as JSON, e.g. `wikimasters wishlist list --json`. Messages and errors go to stderr.
70
+
71
+ | Code | Meaning |
72
+ |---|---|
73
+ | `0` | Success. |
74
+ | `1` | Failure: invalid argument, refusal by the game, network error. `collection discard` also exits 1 when the game refused some of the entries, after printing which ones and why. |
75
+ | `4` | You must sign in: no stored session, or the session expired, was revoked or was rejected by the API. Run `wikimasters login` again. |
76
+ | `75` | The API stayed unavailable after the CLI's own retries. Retry later. |
77
+
78
+ ## Signing in
79
+
80
+ The site signs in with an email and a password behind a captcha, so the CLI never signs in by itself: it takes the session of a browser where you signed in.
81
+
82
+ 1. Open `https://www.wiki-masters.com/login` in a private browser window and sign in.
83
+ 2. Open the developer tools: Storage tab in Firefox, Application tab in Chrome. In the cookies of `www.wiki-masters.com`, copy the value of `sb-cyrxjeppjqsxxjayfrur-auth-token`, or of each of its chunks `sb-cyrxjeppjqsxxjayfrur-auth-token.0`, `.1`…
84
+ 3. Close the private window without logging out.
85
+ 4. Run `wikimasters login` and paste each value in order, one per line, then an empty line. What you paste is not displayed.
86
+
87
+ On macOS with Firefox, `wikimasters login --firefox` does the same without copying anything: it opens Firefox on a throwaway profile, you sign in there, and the CLI reads the cookie from that profile, closes Firefox and deletes the profile. It waits 5 minutes at most.
88
+
89
+ What the CLI does with your session:
90
+
91
+ - It never sees your email or your password: you sign in on the site itself.
92
+ - The value you paste is a session, not your credentials. The CLI keeps only its refresh token, which Supabase, the site's back-end, replaces on every use: each command exchanges it for a new one, which only works once.
93
+ - The refresh token is stored only in `$XDG_CONFIG_HOME/wikimasters-cli/.env`, or `~/.config/wikimasters-cli/.env` when `XDG_CONFIG_HOME` is unset or empty, a file outside the repository that the CLI creates and makes readable by its owner only on macOS and Linux. The CLI never prints it.
94
+ - The session is sent only where the browser sends it: the site's Supabase (`https://cyrxjeppjqsxxjayfrur.supabase.co`) and the site's own `/api/...` routes (`https://www.wiki-masters.com`).
95
+ - Close the private window without logging out because logging out ends the very session you paste. Closing the window also stops the browser from refreshing that session: Supabase revokes a whole session when one of its used refresh tokens is reused, so the browser and the CLI cannot share it.
96
+ - Logging out on the site ends the CLI's session when it ends all your sessions, which is what Supabase's JavaScript sign-out does by default. The next command then exits with code 4; run `wikimasters login` again.
97
+
98
+ The code handling the session:
99
+
100
+ | File | Role |
101
+ |---|---|
102
+ | `src/cli/pasted-session.ts` | reads the pasted cookie value |
103
+ | `src/core/browser-login.ts` | reads the cookie from the throwaway Firefox profile |
104
+ | `src/core/auth-cookie.ts` | extracts the refresh token from the cookie, and builds the cookie sent to the `/api/...` routes |
105
+ | `src/cli/config.ts` | reads the session file and writes the new refresh token to it |
106
+ | `src/cli/session.ts`, `src/core/session.ts` | exchange the refresh token with Supabase and send the session with every Supabase request |
107
+ | `src/core/site.ts` | sends the session to the site's `/api/...` routes |
108
+
109
+ ## Running from a clone
110
+
111
+ To contribute, run the CLI from a clone instead, with [mise](https://mise.jdx.dev), which installs the pinned Node version and the git hook tools:
112
+
113
+ ```sh
114
+ git clone https://github.com/qpautrat/wikimasters-cli.git
115
+ cd wikimasters-cli
116
+ mise trust
117
+ mise install
118
+ ```
119
+
120
+ Then run every command from the repository root as `mise run wikimasters -- <command>`, e.g. `mise run wikimasters -- wishlist list`. Each command first rebuilds the CLI from `src/`. When that build fails, the CLI does not run: stderr carries the compiler errors, and the command exits 1. When a command fails, mise adds the line `[wikimasters] ERROR task failed` after the CLI's message.
121
+
122
+ ## Learn more
123
+
124
+ - [`docs/api.md`](docs/api.md): the tables and routes of the site's API the CLI uses.
125
+ - [`docs/game-rules.md`](docs/game-rules.md): the game rules the API enforces.
126
+ - To contribute, read [`CLAUDE.md`](CLAUDE.md) for the architecture and commands, and [`specs/`](specs/) for the specifications that drive the project.
@@ -0,0 +1,47 @@
1
+ import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync, } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { dirname, join } from "node:path";
4
+ import { parseEnv } from "node:util";
5
+ import { AuthRequiredError } from "../core/index.js";
6
+ const ANON_KEY = "WIKIMASTERS_SUPABASE_ANON_KEY";
7
+ const REFRESH_TOKEN = "WIKIMASTERS_REFRESH_TOKEN";
8
+ export function sessionFile(env = process.env) {
9
+ const configHome = env.XDG_CONFIG_HOME || join(homedir(), ".config");
10
+ return join(configHome, "wikimasters-cli", ".env");
11
+ }
12
+ export function loadConfig(envFile = sessionFile(), env = process.env) {
13
+ const fileEnv = existsSync(envFile)
14
+ ? parseEnv(readFileSync(envFile, "utf8"))
15
+ : {};
16
+ const read = (name) => fileEnv[name] || env[name] || undefined;
17
+ return {
18
+ anonKey: read(ANON_KEY),
19
+ refreshToken: read(REFRESH_TOKEN),
20
+ };
21
+ }
22
+ export function requireRefreshToken(config) {
23
+ if (!config.refreshToken) {
24
+ throw new AuthRequiredError("Not logged in");
25
+ }
26
+ return config.refreshToken;
27
+ }
28
+ export function saveRefreshToken(refreshToken, envFile = sessionFile()) {
29
+ const line = `${REFRESH_TOKEN}=${refreshToken}`;
30
+ const lines = existsSync(envFile)
31
+ ? readFileSync(envFile, "utf8").split("\n")
32
+ : [];
33
+ const index = lines.findIndex((existing) => existing.startsWith(`${REFRESH_TOKEN}=`));
34
+ if (index === -1) {
35
+ lines.splice(lines.at(-1) === "" ? lines.length - 1 : lines.length, 0, line);
36
+ }
37
+ else {
38
+ lines[index] = line;
39
+ }
40
+ const content = lines.join("\n");
41
+ mkdirSync(dirname(envFile), { recursive: true });
42
+ writeFileSync(envFile, content.endsWith("\n") ? content : `${content}\n`, {
43
+ mode: 0o600,
44
+ });
45
+ chmodSync(envFile, 0o600);
46
+ }
47
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/cli/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,YAAY,EACZ,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC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CAAC;IAChD,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC;QAC/B,CAAC,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;QAC3C,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,EAAE,CACzC,QAAQ,CAAC,UAAU,CAAC,GAAG,aAAa,GAAG,CAAC,CACzC,CAAC;IACF,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACjB,KAAK,CAAC,MAAM,CACV,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EACrD,CAAC,EACD,IAAI,CACL,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IACtB,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,EAAE;QACxE,IAAI,EAAE,KAAK;KACZ,CAAC,CAAC;IACH,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ import { program } from "./program.js";
3
+ import { reportFailure } from "./session.js";
4
+ try {
5
+ await program.parseAsync();
6
+ }
7
+ catch (error) {
8
+ reportFailure("wikimasters", error);
9
+ }
10
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,IAAI,CAAC;IACH,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;AAC7B,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,aAAa,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,297 @@
1
+ export function formatLogin(userId, format) {
2
+ return format === "json"
3
+ ? JSON.stringify({ userId })
4
+ : `Logged in as user ${userId}.`;
5
+ }
6
+ function cardLine({ id, title, rarity }) {
7
+ return `${id} ${title} (${rarity})`;
8
+ }
9
+ export function formatWishlist(cards, format) {
10
+ if (format === "json") {
11
+ return JSON.stringify(cards.map(({ id, title, rarity, owned }) => ({
12
+ id,
13
+ title,
14
+ rarity,
15
+ owned,
16
+ })));
17
+ }
18
+ if (cards.length === 0)
19
+ return "The wishlist is empty.";
20
+ return cards
21
+ .map((card) => `${cardLine(card)}${card.owned ? " [owned]" : ""}`)
22
+ .join("\n");
23
+ }
24
+ export function formatAddition({ cardId, title, added }, format) {
25
+ if (format === "json")
26
+ return JSON.stringify({ id: cardId, title, added });
27
+ return added
28
+ ? `Card ${cardId} (${title}) added to the wishlist.`
29
+ : `Card ${cardId} (${title}) was already in the wishlist.`;
30
+ }
31
+ export function formatRemoval({ cardId, removed }, format) {
32
+ if (format === "json")
33
+ return JSON.stringify({ id: cardId, removed });
34
+ return removed
35
+ ? `Card ${cardId} removed from the wishlist.`
36
+ : `Card ${cardId} was not in the wishlist.`;
37
+ }
38
+ export function formatCardSearch({ cards, truncated }, format) {
39
+ if (format === "json")
40
+ return JSON.stringify({ cards, truncated });
41
+ if (cards.length === 0)
42
+ return "No card of the catalogue matches.";
43
+ return [
44
+ ...cards.map(cardLine),
45
+ ...(truncated
46
+ ? [`Only the first ${cards.length} matches are shown; refine the name.`]
47
+ : []),
48
+ ].join("\n");
49
+ }
50
+ export function formatCardValues(values, format) {
51
+ if (format === "json")
52
+ return JSON.stringify(values);
53
+ return values
54
+ .map(({ id, title, averages }) => {
55
+ const prices = Object.entries(averages).map(([rarity, average]) => `${rarity} ${wikibidous(average)}`);
56
+ return `${id} ${title}: ${prices.length === 0
57
+ ? "never sold"
58
+ : `average sale price ${prices.join(", ")}`}`;
59
+ })
60
+ .join("\n");
61
+ }
62
+ function friendOwner({ id, username, rarities }) {
63
+ return `${id} ${username} (${rarities.join(", ")})`;
64
+ }
65
+ function globalCardLine(card) {
66
+ return [
67
+ cardLine(card),
68
+ ...(card.owned ? ["[owned]"] : []),
69
+ ...(card.wishlisted ? ["[wishlisted]"] : []),
70
+ ...(card.friends.length > 0
71
+ ? [`[friends: ${card.friends.map(friendOwner).join("; ")}]`]
72
+ : []),
73
+ ].join(" ");
74
+ }
75
+ export function formatGlobalCollection(search, format) {
76
+ if (format === "json")
77
+ return JSON.stringify(search);
78
+ const { cards: found, total, rarityCounts, pendingOfferKeys, hasMore, } = search;
79
+ const counts = Object.entries(rarityCounts ?? {});
80
+ return [
81
+ ...(found.length === 0
82
+ ? ["No card of the global collection matches."]
83
+ : found.map(globalCardLine)),
84
+ ...(total === null ? [] : [`Total: ${counted(total, "card")}.`]),
85
+ ...(counts.length > 0
86
+ ? [
87
+ `By rarity: ${counts.map(([rarity, count]) => `${rarity} ${count}`).join(", ")}.`,
88
+ ]
89
+ : []),
90
+ ...(pendingOfferKeys.length > 0
91
+ ? [`Pending offers (player id:card id): ${pendingOfferKeys.join(", ")}.`]
92
+ : []),
93
+ ...(hasMore ? ["More cards match beyond this page."] : []),
94
+ ].join("\n");
95
+ }
96
+ function collectionMarks({ starred, shiny, labels, }) {
97
+ return [
98
+ ...(starred ? ["[favourite]"] : []),
99
+ ...(shiny ? ["[shiny]"] : []),
100
+ ...(labels.length > 0
101
+ ? [`[labels: ${labels.map((label) => JSON.stringify(label)).join(", ")}]`]
102
+ : []),
103
+ ];
104
+ }
105
+ export function formatCollection(page, format, requestedRarity) {
106
+ if (format === "json")
107
+ return JSON.stringify(page);
108
+ const { cards: pageCards, full } = page;
109
+ if (pageCards.length === 0) {
110
+ return requestedRarity === undefined
111
+ ? "This page of the collection is empty."
112
+ : `This page of the collection holds no card of rarity ${requestedRarity}.`;
113
+ }
114
+ return [
115
+ ...pageCards.map(({ entryId, id, title, rarity, copies, starred, shiny, labels, obtainedAt, }) => [
116
+ `${entryId} ${id} ${title} (${rarity}) x${copies} obtained ${obtainedAt}`,
117
+ ...collectionMarks({ starred, shiny, labels }),
118
+ ].join(" ")),
119
+ ...fullPageNote(full, counted(pageCards.length, "card")),
120
+ ].join("\n");
121
+ }
122
+ export function formatProfileCollection(page, format) {
123
+ if (format === "json")
124
+ return JSON.stringify(page);
125
+ const { entries, full } = page;
126
+ if (entries.length === 0)
127
+ return "This page of the collection is empty.";
128
+ return [
129
+ ...entries.map(({ entryId, id, title, rarity, count, starred, shiny, labels, pendingTrade, }) => [
130
+ `${entryId} ${id} ${title} (${rarity}) x${count}`,
131
+ ...collectionMarks({ starred, shiny, labels }),
132
+ ...(pendingTrade ? ["[pending trade]"] : []),
133
+ ].join(" ")),
134
+ ...fullPageNote(full, `${entries.length} entries`),
135
+ ].join("\n");
136
+ }
137
+ function counted(count, noun) {
138
+ return `${count} ${noun}${count === 1 ? "" : "s"}`;
139
+ }
140
+ function fullPageNote(full, count) {
141
+ return full ? [`The page is full (${count}); more may follow.`] : [];
142
+ }
143
+ function wikibidous(count) {
144
+ return `${count} wikibidou${count === 1 ? "" : "s"}`;
145
+ }
146
+ export function formatDiscard({ discarded, gained, balance, failed }, format) {
147
+ if (format === "json") {
148
+ return JSON.stringify({
149
+ discarded,
150
+ gained,
151
+ balance,
152
+ failed,
153
+ });
154
+ }
155
+ const summary = discarded === 0
156
+ ? `No card discarded; balance ${wikibidous(balance)}.`
157
+ : `Discarded ${counted(discarded, "card")} for ${wikibidous(gained)}; balance ${wikibidous(balance)}.`;
158
+ return [
159
+ summary,
160
+ ...failed.map(({ entryId, reason }) => `Entry ${entryId} could not be discarded: ${reason}`),
161
+ ].join("\n");
162
+ }
163
+ export function formatBid({ auctionId, amount, balance }, format) {
164
+ if (format === "json")
165
+ return JSON.stringify({ id: auctionId, amount, balance });
166
+ return `Bid ${wikibidous(amount)} on auction ${auctionId}; balance ${wikibidous(balance)}.`;
167
+ }
168
+ export function formatCreatedAuction({ auctionId }, format) {
169
+ if (format === "json")
170
+ return JSON.stringify({ auctionId });
171
+ return `Auction ${auctionId} created.`;
172
+ }
173
+ export function formatCancelledAuction({ auctionId, status }, format) {
174
+ if (format === "json")
175
+ return JSON.stringify({ auctionId, status });
176
+ return `Auction ${auctionId} ${status}.`;
177
+ }
178
+ function currentBidState(currentBid, leading) {
179
+ return currentBid === null
180
+ ? "no bid yet"
181
+ : `current bid ${wikibidous(currentBid)} by ${leading ? "you" : "another player"}`;
182
+ }
183
+ export function formatRunningBids({ bids, full }, format) {
184
+ if (format === "json") {
185
+ return JSON.stringify({ bids: bids.map(withId), full });
186
+ }
187
+ if (bids.length === 0) {
188
+ return "This page of your bids on running auctions is empty.";
189
+ }
190
+ return [
191
+ ...bids.map(({ auctionId, title, amount, placedAt, currentBid, leading, endsAt }) => `${auctionId} ${title}: your bid ${wikibidous(amount)} placed ${placedAt}, ${currentBidState(currentBid, leading)}, ends ${endsAt}`),
192
+ ...fullPageNote(full, counted(bids.length, "bid")),
193
+ ].join("\n");
194
+ }
195
+ function notificationValue(value) {
196
+ return typeof value === "string" ? value : JSON.stringify(value);
197
+ }
198
+ export function formatNotifications({ notifications, full }, format) {
199
+ if (format === "json")
200
+ return JSON.stringify({ notifications, full });
201
+ if (notifications.length === 0) {
202
+ return "This page of your notifications is empty.";
203
+ }
204
+ return [
205
+ ...notifications.map(({ type, read, createdAt, data }) => [
206
+ `${createdAt} ${type}${read ? "" : " (unread)"}${"message" in data ? `: ${notificationValue(data.message)}` : ""}`,
207
+ ...Object.entries(data)
208
+ .filter(([key]) => key !== "title" && key !== "message")
209
+ .map(([key, value]) => `${key}=${notificationValue(value)}`),
210
+ ].join(" ")),
211
+ ...fullPageNote(full, counted(notifications.length, "notification")),
212
+ ].join("\n");
213
+ }
214
+ function withId({ auctionId, ...state }) {
215
+ return { id: auctionId, ...state };
216
+ }
217
+ function auctionedCopy({ title, rarity, shiny }) {
218
+ return `${title} (${rarity})${shiny ? " [shiny]" : ""}`;
219
+ }
220
+ function seller(selling) {
221
+ return selling ? "you" : "another player";
222
+ }
223
+ export function formatAuctions(auctions, format, requestedStatus) {
224
+ if (format === "json")
225
+ return JSON.stringify(auctions.map(withId));
226
+ if (auctions.length === 0) {
227
+ return requestedStatus === undefined
228
+ ? "No auction to list."
229
+ : `No auction with status ${requestedStatus}.`;
230
+ }
231
+ return auctions.map(auctionLine).join("\n");
232
+ }
233
+ function auctionLine(auction) {
234
+ return `${auction.auctionId} ${auctionedCopy(auction)}: ${auction.status}, ends ${auction.endsAt}, starting price ${wikibidous(auction.startingPrice)}, ${currentBidState(auction.currentBid, auction.leading)}, sold by ${seller(auction.selling)}`;
235
+ }
236
+ export function formatAuctionSearch({ auctions, truncated }, format) {
237
+ if (format === "json") {
238
+ return JSON.stringify({ auctions: auctions.map(withId), truncated });
239
+ }
240
+ if (auctions.length === 0)
241
+ return "No auction matches.";
242
+ return [
243
+ ...auctions.map(auctionLine),
244
+ ...(truncated ? ["More auctions match beyond this page."] : []),
245
+ ].join("\n");
246
+ }
247
+ export function formatAuction(auction, format) {
248
+ if (format === "json")
249
+ return JSON.stringify(withId(auction));
250
+ const { auctionId, status, endsAt, startingPrice, currentBid, leading } = auction;
251
+ return [
252
+ `Auction ${auctionId}: ${auctionedCopy(auction)}`,
253
+ `Status ${status}, ends ${endsAt}`,
254
+ `Starting price ${wikibidous(startingPrice)}; ${currentBidState(currentBid, leading)}`,
255
+ `Sold by ${seller(auction.selling)}`,
256
+ ].join("\n");
257
+ }
258
+ export function formatEntryFavourite({ entryId, starred }, format) {
259
+ if (format === "json")
260
+ return JSON.stringify({ entryId, starred });
261
+ return starred
262
+ ? `Entry ${entryId} marked as favourite.`
263
+ : `Entry ${entryId} removed from the favourites.`;
264
+ }
265
+ export function formatLabels(labels, format) {
266
+ if (format === "json") {
267
+ return JSON.stringify(labels.map(({ id, name, color }) => ({ id, name, color })));
268
+ }
269
+ if (labels.length === 0)
270
+ return "You have no label.";
271
+ return labels
272
+ .map(({ id, name, color }) => `${id} ${JSON.stringify(name)} (${color})`)
273
+ .join("\n");
274
+ }
275
+ export function formatLabelCreation({ id, name, color }, format) {
276
+ if (format === "json")
277
+ return JSON.stringify({ id, name, color });
278
+ return `Label ${JSON.stringify(name)} (${color}) created with id ${id}.`;
279
+ }
280
+ export function formatLabelDeletion({ id }, format) {
281
+ if (format === "json")
282
+ return JSON.stringify({ id });
283
+ return `Label ${id} deleted.`;
284
+ }
285
+ export function formatEntryTag({ entryId, labelId }, format) {
286
+ if (format === "json")
287
+ return JSON.stringify({ entryId, labelId });
288
+ return `Entry ${entryId} labelled with label ${labelId}.`;
289
+ }
290
+ export function formatEntryUntag({ entryId, labelId, removed }, format) {
291
+ if (format === "json")
292
+ return JSON.stringify({ entryId, labelId, removed });
293
+ return removed
294
+ ? `Label ${labelId} removed from entry ${entryId}.`
295
+ : `Entry ${entryId} did not have the label ${labelId}.`;
296
+ }
297
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AA8BA,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,MAAc;IACxD,OAAO,MAAM,KAAK,MAAM;QACtB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QAC5B,CAAC,CAAC,qBAAqB,MAAM,GAAG,CAAC;AACrC,CAAC;AAED,SAAS,QAAQ,CAAC,EAAE,EAAE,EAAE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AAC,CAAC;IACnE,OAAO,SAAS,OAAO,wBAAwB,OAAO,GAAG,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAc,EACzC,MAAc;IAEd,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5E,OAAO,OAAO;QACZ,CAAC,CAAC,SAAS,OAAO,uBAAuB,OAAO,GAAG;QACnD,CAAC,CAAC,SAAS,OAAO,2BAA2B,OAAO,GAAG,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { createInterface } from "node:readline";
2
+ import { Writable } from "node:stream";
3
+ import { AUTH_COOKIE_NAME, SITE_URL, WikiMastersError, refreshTokenFromAuthCookieChunks, } from "../core/index.js";
4
+ const discardedOutput = new Writable({
5
+ write: (_chunk, _encoding, done) => done(),
6
+ });
7
+ function pasteInstructions(hidden) {
8
+ return [
9
+ `Sign in to ${SITE_URL}/login in a private browser window.`,
10
+ `Open the developer tools (Storage tab in Firefox, Application tab in Chrome) and copy the value of the ${AUTH_COOKIE_NAME} cookie, or of each of its chunks ${AUTH_COOKIE_NAME}.0, .1…`,
11
+ "Close the private window without logging out, then paste each value here in order, one per line, and end with an empty line.",
12
+ ...(hidden ? ["What you paste is not displayed."] : []),
13
+ ].join("\n");
14
+ }
15
+ export function readPastedLines(input) {
16
+ const reader = createInterface({
17
+ input,
18
+ output: discardedOutput,
19
+ terminal: input.isTTY === true,
20
+ historySize: 0,
21
+ crlfDelay: Infinity,
22
+ });
23
+ const lines = [];
24
+ let ended = false;
25
+ return new Promise((resolve, reject) => {
26
+ reader.on("line", (line) => {
27
+ if (ended)
28
+ return;
29
+ const value = line.trim();
30
+ if (value === "") {
31
+ ended = true;
32
+ reader.close();
33
+ }
34
+ else {
35
+ lines.push(value);
36
+ }
37
+ });
38
+ reader.on("SIGINT", () => {
39
+ reject(new WikiMastersError("Login cancelled"));
40
+ reader.close();
41
+ });
42
+ reader.on("close", () => resolve(lines));
43
+ });
44
+ }
45
+ export async function readPastedRefreshToken(input = process.stdin) {
46
+ console.error(pasteInstructions(input.isTTY === true));
47
+ return refreshTokenFromAuthCookieChunks(await readPastedLines(input));
48
+ }
49
+ //# sourceMappingURL=pasted-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pasted-session.js","sourceRoot":"","sources":["../../src/cli/pasted-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,gCAAgC,GACjC,MAAM,kBAAkB,CAAC;AAI1B,MAAM,eAAe,GAAG,IAAI,QAAQ,CAAC;IACnC,KAAK,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE;CAC3C,CAAC,CAAC;AAEH,SAAS,iBAAiB,CAAC,MAAe;IACxC,OAAO;QACL,cAAc,QAAQ,qCAAqC;QAC3D,0GAA0G,gBAAgB,qCAAqC,gBAAgB,SAAS;QACxL,8HAA8H;QAC9H,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACxD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAiB;IAC/C,MAAM,MAAM,GAAG,eAAe,CAAC;QAC7B,KAAK;QACL,MAAM,EAAE,eAAe;QACvB,QAAQ,EAAE,KAAK,CAAC,KAAK,KAAK,IAAI;QAC9B,WAAW,EAAE,CAAC;QACd,SAAS,EAAE,QAAQ;KACpB,CAAC,CAAC;IACH,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI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