@aronnaxlin/bgm-cli 1.1.4 → 1.1.5

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.
@@ -0,0 +1,476 @@
1
+ # Command Reference
2
+
3
+ This reference is for agents operating `bgm-cli` as a user-facing tool.
4
+
5
+ ## Preferred Patterns
6
+
7
+ - prefer `bgm --json <command...>` for reads
8
+ - prefer exact IDs over title search
9
+ - prefer ordinary CLI commands over `bgm tui`
10
+ - keep search result sets small
11
+ - re-read state after important writes
12
+
13
+ ## Capability And Config
14
+
15
+ ```bash
16
+ bgm --version
17
+ bgm --help
18
+ bgm episode --help
19
+ bgm --json config show
20
+ bgm auth status
21
+ bgm auth session-status
22
+ bgm auth clear
23
+ bgm --json auth profile list
24
+ bgm auth profile save <name>
25
+ bgm auth profile use <name>
26
+ bgm auth profile delete <name>
27
+ bgm --profile <name> <command> ...
28
+ ```
29
+
30
+ `bgm --profile <name>` runs one command as a saved account profile without switching; it is read-only and rejects credential-writing commands.
31
+
32
+ Use `bgm --help` for the compact overview only. For detailed command discovery, prefer `bgm <group> --help`.
33
+
34
+ ## URL Resolution
35
+
36
+ ```bash
37
+ bgm --json <bangumi_url>
38
+ bgm --json url <bangumi_url>
39
+ bgm --json --url <bangumi_url>
40
+ bgm --json --url <bangumi_url> --dry-run
41
+ ```
42
+
43
+ Turns a pasted Bangumi link into the matching command and runs it. Hosts: `bgm.tv`, `bangumi.tv`, `chii.in`, `next.bgm.tv`, `api.bgm.tv`; `https://` and `www.` prefixes are optional. `-url` is an alias for `--url`.
44
+
45
+ | Link | Resolves to |
46
+ | --- | --- |
47
+ | `/subject/<id>` | `subject get <id>` |
48
+ | `/subject/<id>/comments\|reviews\|board` | `subject comments\|reviews\|topics <id>` |
49
+ | `/subject/<id>/characters\|persons\|collections\|index` | `subject characters\|staff\|collects\|indexes <id>` |
50
+ | `/subject/<id>/ep` | `episode list <id>` |
51
+ | `/subject/topic/<id>` | `subject topic <id>` |
52
+ | `/group/topic/<id>` | `group topic <id>` |
53
+ | `/group/topic/<id>#post_<pid>` | `group post <pid>` |
54
+ | `/group/<name>[/forum\|members]` | `group get\|topics\|members <name>` |
55
+ | `/ep/<id>` | `episode get <id>` |
56
+ | `/character/<id>`, `/person/<id>` | `character\|person get <id>` |
57
+ | `/blog/<id>`, `/index/<id>` | `blog\|index get <id>` |
58
+ | `/user/<name>[/timeline\|blog\|index\|friends\|followers\|groups]` | matching user/timeline/blog/index/group command |
59
+ | `/<anime\|book\|music\|game\|real>/list/<name>[/<status>]` | `collection list --user <name> --type <type> [--status ...]` |
60
+ | `/subject_search/<keyword>?cat=n` | `subject search <keyword> [--type ...]` |
61
+ | `api.bgm.tv/v0/...` | matching read command |
62
+
63
+ Rules:
64
+
65
+ - Resolution is offline and read-only; a link never triggers a write.
66
+ - `--dry-run` prints the resolved command and stops. Use it when the mapping matters.
67
+ - `--json` output is the target command payload plus a `resolvedFrom` field.
68
+ - `?page=n` becomes `--offset` with `--limit 20` pinned; unknown query keys are ignored.
69
+ - Extra flags on the command line are forwarded to the resolved command.
70
+ - Quote links containing `#`.
71
+ - Unsupported paths error with a `Did you mean: bgm ...` suggestion. `/rakuen/topic/...` links are in this category.
72
+ - Run `bgm url --help` for the full list.
73
+
74
+ ## User Reads
75
+
76
+ ```bash
77
+ bgm --json user me
78
+ bgm --json user get sai
79
+ bgm --json user friends sai --limit 10
80
+ bgm --json user followers sai --limit 10
81
+ ```
82
+
83
+ ## Notifications
84
+
85
+ ```bash
86
+ bgm --json notify --limit 10
87
+ bgm --json notify list --limit 10 --unread true
88
+ bgm notify clear 123456
89
+ bgm notify clear
90
+ ```
91
+
92
+ Operational notes:
93
+
94
+ - `notify clear` with no IDs marks all notifications as read
95
+ - friend request notifications use notification type to produce a human-readable title; accepting or rejecting the request is not exposed through `notify`
96
+
97
+ ## Subject Reads
98
+
99
+ ```bash
100
+ bgm --json subject get 12
101
+ bgm subject get 12 --verbose
102
+ bgm --json subject list --type anime --sort rank --limit 10
103
+ bgm --json subject list --type anime --tag 百合 --sort rank --limit 10
104
+ bgm --json subject list --type anime --tag 百合,科幻 --tagsCat meta --sort rank --limit 10
105
+ bgm --json subject search "Ghost in the Shell" --type anime --limit 5
106
+ bgm --json subject comments 12 --limit 10
107
+ bgm --json subject topics 12 --limit 10
108
+ bgm --json subject recent-topics --limit 10
109
+ bgm --json subject topic 29892
110
+ bgm --json subject characters 12 --limit 10
111
+ bgm --json subject collects 12 --type doing --limit 10
112
+ bgm --json subject staff 12 --limit 10
113
+ bgm --json subject indexes 12 --limit 10
114
+ bgm --json subject relations 12 --limit 10
115
+ bgm --json subject recs 12 --limit 10
116
+ bgm --json trending subject-topics --limit 10
117
+ ```
118
+
119
+ ## Subject Topic Writes
120
+
121
+ Preferred path: let the CLI obtain a token automatically through Bangumi's hosted official Turnstile page.
122
+
123
+ ```bash
124
+ bgm subject create-topic 12 "Title" "Content"
125
+ bgm subject reply 29892 "Reply content"
126
+ ```
127
+
128
+ With an explicit Turnstile token:
129
+
130
+ ```bash
131
+ bgm subject create-topic 12 "Title" "Content" --turnstile-token YOUR_TOKEN
132
+ bgm subject reply 29892 "Reply content" --reply-to 123456 --turnstile-token YOUR_TOKEN
133
+ bgm subject edit-topic 29892 "Updated title" "Updated content"
134
+ bgm subject post 123456
135
+ bgm subject edit-post 123456 "Updated reply"
136
+ bgm subject delete-post 123456
137
+ bgm subject like-post 123456 140
138
+ bgm subject unlike-post 123456
139
+ bgm subject like-collect 123456 140
140
+ bgm subject unlike-collect 123456
141
+ ```
142
+
143
+ Operational notes:
144
+
145
+ - subject topic create/reply are Turnstile-gated
146
+ - edit/delete/reaction commands require the target to be valid for the current user and Bangumi-side permissions
147
+ - reaction values are sticker ids, not a like toggle; see `reactions.md` for the value table and per-target allow-lists
148
+
149
+ ## Episode Reads
150
+
151
+ ```bash
152
+ bgm --json episode list 253 --type main --limit 5
153
+ bgm --json episode list 253 --type sp --limit 5
154
+ bgm --json episode list 253 --type op_ed --limit 10
155
+ bgm --json episode comments 103232
156
+ bgm --json episode comments 253 1
157
+ bgm --json episode comments 253 1 --type main
158
+ ```
159
+
160
+ Operational notes:
161
+
162
+ - `episode watch` only works by main-story episode number
163
+ - `episode status` works by concrete `episode_id`
164
+ - `episode comments <subject_id> <episode_number>` resolves the concrete episode inside that subject first
165
+ - NSFW / R18 subjects may return a misleading `404` when no usable auth context is attached
166
+ - parent subjects must already be collected before episode progress can be changed
167
+
168
+ ## Group Reads
169
+
170
+ ```bash
171
+ bgm --json group list --sort members --limit 10
172
+ bgm --json group get boring
173
+ bgm --json group topics boring --limit 20
174
+ bgm --json group topic 498114
175
+ bgm --json group members boring --role member --limit 20
176
+ bgm --json group recent-topics --mode all --limit 10
177
+ bgm --json group latest-replies --limit 10
178
+ bgm --json group hot --window day --limit 10
179
+ bgm --json group hot-topics --window week --limit 10
180
+ ```
181
+
182
+ ## Group Writes
183
+
184
+ Preferred path: let the CLI obtain a token automatically through Bangumi's hosted official Turnstile page.
185
+
186
+ ```bash
187
+ bgm group create-topic boring "Title" "Content"
188
+ bgm group reply 498114 "Reply content"
189
+ ```
190
+
191
+ With an explicit Turnstile token:
192
+
193
+ ```bash
194
+ bgm group create-topic boring "Title" "Content" --turnstile-token YOUR_TOKEN
195
+ bgm group reply 498114 "Reply content" --turnstile-token YOUR_TOKEN
196
+ ```
197
+
198
+ Using the built-in local helper flow explicitly:
199
+
200
+ ```bash
201
+ bgm group create-topic boring "Title" "Content"
202
+ bgm group reply 498114 "Reply content"
203
+ bgm group create-topic boring "Title" "Content" --manual --port 8765
204
+ bgm group reply 498114 "Reply content" --manual --port 8765
205
+ ```
206
+
207
+ ### Agent posting Turnstile human-in-the-loop flow
208
+
209
+ When an agent is creating a group topic or reply on behalf of a user, the agent cannot complete the Turnstile CAPTCHA itself. Follow this verified workflow:
210
+
211
+ 1. **Attempt the post directly**:
212
+ ```bash
213
+ bgm group create-topic dev "Title" "Content"
214
+ ```
215
+ The CLI will fail with `Turnstile verification is required`.
216
+
217
+ 2. **Generate the official Turnstile URL**:
218
+ ```bash
219
+ bgm auth turnstile
220
+ ```
221
+ The CLI prints an official Bangumi Turnstile URL. In most agent environments, automatic browser launch is unavailable and the command will time out — this is expected.
222
+
223
+ 3. **Send the URL to the user**:
224
+ Copy the printed URL and send it to the user. The user opens it in their browser, completes the CAPTCHA, and is redirected to the hosted callback.
225
+
226
+ 4. **Receive the token from the user**:
227
+ After the user completes verification, the callback URL contains a `token` query parameter. The user copies the full callback URL (or just the token string) and sends it back to the agent.
228
+
229
+ 5. **Re-run the post with the token**:
230
+ ```bash
231
+ bgm group create-topic dev "Title" "Content" --turnstile-token "YOUR_TOKEN"
232
+ ```
233
+
234
+ The same flow applies to `group reply`, `timeline say`, `timeline reply`, and experimental `blog reply`.
235
+
236
+ ## Blog Reads [New]
237
+
238
+ ```bash
239
+ bgm --json blog list --user sai --limit 10
240
+ bgm --json blog get 371953
241
+ bgm --json blog comments 371953
242
+ bgm --json blog photos 371953
243
+ bgm --json blog subjects 371953
244
+ ```
245
+
246
+ ## Blog Writes [Experimental]
247
+
248
+ Preferred path: let the CLI try Bangumi's hosted official Turnstile page first.
249
+
250
+ ```bash
251
+ bgm blog reply 371953 "Reply content"
252
+ ```
253
+
254
+ With an explicit Turnstile token:
255
+
256
+ ```bash
257
+ bgm blog reply 371953 "Reply content" --turnstile-token YOUR_TOKEN
258
+ bgm blog edit-comment 123456 "Updated content"
259
+ bgm blog delete-comment 123456
260
+ ```
261
+
262
+ Using the built-in local helper flow for reply only:
263
+
264
+ ```bash
265
+ bgm blog reply 371953 "Reply content"
266
+ bgm blog reply 371953 "Reply content" --manual --port 8765
267
+ ```
268
+
269
+ Treat these as experimental. Current Bangumi-side behavior may still fail even with a fresh token.
270
+
271
+ ## Timeline Reads [New]
272
+
273
+ ```bash
274
+ bgm --json timeline list --mode friends --limit 10
275
+ bgm --json timeline user sai --limit 10
276
+ bgm --json timeline replies 123456
277
+ ```
278
+
279
+ ## Timeline Writes [New]
280
+
281
+ Preferred path: let the CLI try Bangumi's hosted official Turnstile page first.
282
+
283
+ ```bash
284
+ bgm timeline say "off work"
285
+ bgm timeline reply 123456 "seen"
286
+ ```
287
+
288
+ With an explicit Turnstile token:
289
+
290
+ ```bash
291
+ bgm timeline say "off work" --turnstile-token YOUR_TOKEN
292
+ bgm timeline reply 123456 "seen" --turnstile-token YOUR_TOKEN
293
+ ```
294
+
295
+ Using the built-in local helper flow explicitly:
296
+
297
+ ```bash
298
+ bgm timeline say "off work" --manual --port 8765
299
+ bgm timeline reply 123456 "seen" --manual --port 8765
300
+ ```
301
+
302
+ Other timeline operations:
303
+
304
+ ```bash
305
+ bgm timeline delete 123456
306
+ bgm timeline like 123456 140
307
+ bgm timeline unlike 123456
308
+ ```
309
+
310
+ ## Collection Reads
311
+
312
+ ```bash
313
+ bgm --json collection list --status doing --type anime --sort updated
314
+ bgm --json collection list --user sai --type anime --limit 10 --offset 0
315
+ bgm --json collection list --tag 百合
316
+ bgm --json collection list --tag 百合 --tag 恋爱
317
+ bgm --json collection list --tag 百合,恋爱 --sort rank
318
+ bgm --json collection get 348335
319
+ bgm --json collection get --search "Heike Monogatari" --pick 1
320
+ bgm --json collection characters --user sai --limit 10
321
+ bgm --json collection persons --user sai --limit 10
322
+ bgm --json collection indexes --user sai --limit 10
323
+ ```
324
+
325
+ ## Collection Writes
326
+
327
+ ```bash
328
+ bgm collection collect 348335 collect
329
+ bgm collection status 348335 doing
330
+ bgm collection rate 348335 8
331
+ bgm collection comment 348335 "Backfill"
332
+ bgm collection collect-character 1
333
+ bgm collection uncollect-character 1
334
+ bgm collection collect-person 1
335
+ bgm collection uncollect-person 1
336
+ bgm collection collect-index 1
337
+ bgm collection uncollect-index 1
338
+ ```
339
+
340
+ ## Book Reads and Writes
341
+
342
+ ```bash
343
+ bgm --json book get 3510
344
+ bgm book ep 3510 10
345
+ bgm book vol 3510 2
346
+ ```
347
+
348
+ Operational notes:
349
+
350
+ - `book` commands only work for book-type subjects
351
+ - if a non-book subject is targeted, the CLI suggests using `episode` commands instead
352
+ - the parent subject must already be in the user's collection before updating progress
353
+ - `book ep` updates chapter progress (`ep_status`)
354
+ - `book vol` updates volume progress (`vol_status`)
355
+ - writes are verified after the PATCH; mismatches are reported explicitly
356
+
357
+ ## Episode Writes
358
+
359
+ ```bash
360
+ bgm episode watch 253 1
361
+ bgm episode status 103232 watched
362
+ bgm episode status 103232 queue
363
+ bgm episode status 103232 drop
364
+ bgm episode status 103232 remove
365
+ ```
366
+
367
+ Write constraints observed in real Bangumi behavior:
368
+
369
+ - the parent subject must already be in the user's collection
370
+ - the parent collection does not need to be `doing`
371
+ - `wish`, `collect`, `doing`, `on_hold`, and `dropped` all currently allow episode writes
372
+
373
+ Search-first variants:
374
+
375
+ ```bash
376
+ bgm collection status --search "Gundam" doing --pick 1
377
+ bgm collection rate --search "Heike Monogatari" 8 --pick 1
378
+ bgm collection comment --search "Heike Monogatari" "Backfill" --pick 1
379
+ ```
380
+
381
+ ## Character Reads and Writes
382
+
383
+ ```bash
384
+ bgm --json character search "夏娜" --limit 5
385
+ bgm --json character get 1
386
+ bgm --json character casts 1 --limit 10
387
+ bgm --json character collects 1 --limit 10
388
+ bgm --json character comments 1 --limit 10
389
+ bgm --json character indexes 1 --limit 10
390
+ bgm --json character photos 1 --limit 10
391
+ bgm --json character photos-preview 1 --limit 5
392
+ bgm --json character photo 1 123
393
+ bgm --json character photo-comments 1 123
394
+ bgm --json character relations 1 --limit 10
395
+ bgm character comment 1 "Comment content" --turnstile-token YOUR_TOKEN
396
+ bgm character edit-comment 123456 "Updated content"
397
+ bgm character delete-comment 123456
398
+ ```
399
+
400
+ ## Person Reads and Writes
401
+
402
+ ```bash
403
+ bgm --json person search "坂本真綾" --career seiyu --limit 5
404
+ bgm --json person get 1
405
+ bgm --json person casts 1 --limit 10
406
+ bgm --json person collects 1 --limit 10
407
+ bgm --json person comments 1 --limit 10
408
+ bgm --json person indexes 1 --limit 10
409
+ bgm --json person photos 1 --limit 10
410
+ bgm --json person photos-preview 1 --limit 5
411
+ bgm --json person photo 1 123
412
+ bgm --json person photo-comments 1 123
413
+ bgm --json person relations 1 --limit 10
414
+ bgm --json person works 1 --limit 10
415
+ bgm person comment 1 "Comment content" --turnstile-token YOUR_TOKEN
416
+ bgm person edit-comment 123456 "Updated content"
417
+ bgm person delete-comment 123456
418
+ ```
419
+
420
+ Operational notes:
421
+
422
+ - character/person comment creation is Turnstile-gated
423
+ - edit/delete commands require Bangumi-side permission on the comment
424
+
425
+ ## Index Reads and Writes
426
+
427
+ ```bash
428
+ bgm --json index get 1
429
+ bgm --json index comments 1
430
+ bgm --json index related 1 --cat subject --type anime --limit 10
431
+ bgm --json index user sai --limit 10
432
+ bgm index create "My Index" "Description" --private false
433
+ bgm index update 123 --title "New Title" --desc "New Description"
434
+ bgm index delete 123
435
+ bgm index comment 123 "Nice index" --turnstile-token YOUR_TOKEN
436
+ bgm index edit-comment 456 "Updated comment"
437
+ bgm index delete-comment 456
438
+ bgm index add-related 123 --cat subject --sid 348335 --order 1 --comment "Why"
439
+ bgm index update-related 123 456 --order 2 --comment "Updated"
440
+ bgm index delete-related 123 456
441
+ ```
442
+
443
+ ## Calendar Reads
444
+
445
+ ```bash
446
+ bgm --json calendar
447
+ bgm --json calendar all
448
+ bgm --json calendar mon
449
+ bgm --json calendar tue
450
+ ```
451
+
452
+ Operational notes:
453
+
454
+ - `calendar` with no subcommand defaults to today
455
+ - `calendar all` returns the full 7-day schedule
456
+ - weekday abbreviations are accepted (`mon`, `tue`, `wed`, `thu`, `fri`, `sat`, `sun`)
457
+
458
+ ## Verification After Writes
459
+
460
+ ```bash
461
+ bgm --json collection get 348335
462
+ bgm --json collection get 253
463
+ bgm --json group topic 498114
464
+ bgm --json subject topic 29892
465
+ bgm --json blog comments 371953
466
+ bgm --json character comments 1 --limit 5
467
+ bgm --json person comments 1 --limit 5
468
+ bgm --json timeline user - --limit 5
469
+ ```
470
+
471
+ Use this when:
472
+
473
+ - the user needs strong confirmation
474
+ - the write result was terse
475
+ - the command depended on search and pick resolution
476
+ - the final visible state matters
@@ -0,0 +1,69 @@
1
+ # Community Boundaries
2
+
3
+ This reference helps agents avoid overpromising unsupported Bangumi community actions through `bgm`.
4
+
5
+ ## Stable Community-Like Operations
6
+
7
+ These are the most realistic public operations to expose through the CLI:
8
+
9
+ - user profile reads
10
+ - friend and follower list reads
11
+ - notification list reads and mark-read operations
12
+ - subject search and reads
13
+ - subject interest comments, discussion topic lists, latest subject discussions, topic detail, topic replies, and supported subject topic/post reactions
14
+ - collection list, get, and update
15
+ - character, person, and index collection reads; character/person/index collect and uncollect operations
16
+ - episode list and episode progress updates when the parent subject is already collected
17
+ - book progress reads and writes (`book get`, `book ep`, `book vol`) for book-type subjects when the parent subject is already collected
18
+ - episode comments by episode ID or by resolving a subject episode number
19
+ - group list and group detail reads
20
+ - group topic detail and topic list reads
21
+ - group membership list reads
22
+ - derived group discovery views such as recent topics, latest replies, hot groups, and hot topics
23
+ - group topic creation and replies when the CLI can obtain a valid Turnstile token
24
+ - new blog reads such as list, detail, comments, photos, and related subjects
25
+ - experimental blog comment writes when the CLI can obtain a valid Turnstile token
26
+ - character/person search, detail, related resources, photos, photo comments, and comment writes when the CLI can obtain a valid Turnstile token
27
+ - index reads and writes (list, get, comments, related items) when auth permits
28
+ - timeline list, user timeline, replies, delete, and reaction operations
29
+ - timeline `say` and `reply` when the CLI can obtain a valid Turnstile token
30
+ - weekly anime broadcast calendar reads
31
+
32
+ ## Treat As Limited Or Unsupported
33
+
34
+ Do not assume stable public support for:
35
+
36
+ - Rakuen
37
+ - blog entry CRUD
38
+ - forum-style topic CRUD outside the exposed group surfaces
39
+ - friend/follow relationship mutations such as add, remove, accept, reject, or block
40
+ - accepting or rejecting friend requests directly from notifications
41
+ - blacklist management
42
+
43
+ Also avoid promising other Bangumi community surfaces unless the command is visible in current CLI help.
44
+
45
+ If a user asks for these, verify current CLI support first. If the CLI does not expose them, say so plainly instead of guessing.
46
+
47
+ ## Collection Caveats
48
+
49
+ - private collections require the right auth context
50
+ - collection `updated_at` is not a reliable last-change timestamp
51
+ - completion progress fields are not universally safe across all subject types
52
+ - for book-type subjects, use dedicated `book` commands (`book get`, `book ep`, `book vol`)
53
+ - for non-book subjects, prefer dedicated episode endpoints over subject collection `ep_status`
54
+ - Bangumi currently ties episode writes to "subject is collected" rather than to a specific collection status such as `doing`
55
+ - NSFW episode reads may fail with an auth-looking `404` when no usable auth context is attached
56
+ - for `p1` requests, the CLI uses a private session cookie when available and falls back to Access Token when no session is saved
57
+
58
+ ## Operator Rule
59
+
60
+ When the request touches ambiguous community features, prefer:
61
+
62
+ 1. checking the CLI help
63
+ 2. checking whether the command exists
64
+ 3. reporting the supported scope precisely
65
+ 4. calling out Turnstile requirements for supported write flows
66
+ 5. marking blog comment writes as experimental when relevant
67
+ 6. calling out that Turnstile now prefers the hosted official flow and only falls back to the local helper when needed
68
+
69
+ Do not infer unsupported commands from Bangumi website features alone.