fix(weread): fix API endpoints, arg access, and include tests in CI#433
Merged
jackwener merged 1 commit intojackwener:mainfrom Mar 25, 2026
Merged
fix(weread): fix API endpoints, arg access, and include tests in CI#433jackwener merged 1 commit intojackwener:mainfrom
jackwener merged 1 commit intojackwener:mainfrom
Conversation
Contributor
|
Solid bug fix PR. All 5 fixes are correct and well-targeted:
Appreciate the thorough verification table covering all 7 commands. Clean diff, no regressions spotted. LGTM 👍 Minor suggestions (non-blocking):
|
9ab7586 to
8dbea4e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The weread adapter (added in #89) had several bugs that prevented authenticated commands from working. This PR fixes all of them and verifies all 7 weread commands working end-to-end.
Bugs Fixed
args['book-id']access — positional args are stored under their original kebab-case name, not camelCase.book.ts,highlights.ts, andnotes.tswere all accessingargs.bookId(undefined), causing every book-specific API call to sendbookId=undefined→ server rejected with errCode -2003.API base URL — authenticated endpoints are on
weread.qq.com/web/andweread.qq.com/api/, noti.weread.qq.com. Cross-origin fetches toi.weread.qq.comfrom aweread.qq.compage context fail at the browser level despite CORS headers.notebooksendpoint path — was/user/notebooks(404), correct path is/api/user/notebook.syncKeycasing — WeRead API usessyncKey(capital K), notsynckey.Error code handling —
weread.qq.com/web/endpoints returnerrCode/errMsg(camelCase) whilei.weread.qq.comuseserrcode/errmsg. Added fallback to handle both.Tests not running in CI —
src/clis/weread/**/*.test.tswas missing fromvitest.config.tsadapter project, so 15 existing util tests were silently skipped.Verified Working
weread search <query>weread rankingweread shelfweread notebooksweread book <id>weread notes <id>weread highlights <id>Test plan
npx vitest run --project adapter— all 18 tests passnpm run typecheck— no type errorsopencli weread search "三体"— returns book listopencli weread shelf— returns your bookshelf (requires Chrome login)opencli weread notebooks— returns books with notesopencli weread book <bookId>— returns book detailsopencli weread notes <bookId>— returns your notes on a book🤖 Generated with Claude Code