feat: add Chinese academic & policy database adapters#243
feat: add Chinese academic & policy database adapters#243jackwener merged 1 commit intojackwener:mainfrom
Conversation
Astro-Han
left a comment
There was a problem hiding this comment.
Great coverage of academic and government data sources — the gov-law Vue Router technique is clever. A few things I noticed:
gov-policy/recent.ts — missing navigateBefore: false
The other 6 adapters all set navigateBefore: false, but this one doesn't. With Strategy.COOKIE + domain, the framework will auto-navigate to www.gov.cn before func runs, then func navigates again to the target URL — double navigation adding 2-4s overhead.
Strategy — COOKIE vs PUBLIC
These sites all serve public data without requiring login. Strategy.COOKIE forces users to go through the browser extension flow, while Strategy.PUBLIC (with browser: true if DOM extraction is needed) would be lighter. See google/search.ts for a similar pattern.
baidu-scholar/search.ts:43 — duplicate condition
if (t.startsWith('《') || t.startsWith('《'))Both sides are the same character (U+300A). The second branch is always redundant.
gov-law — Vue Router fallback
app.__vue_app__.config.globalProperties.$router is a Vue 3 internal — if the site upgrades or restructures, this silently returns nothing. A null guard with a descriptive CliError would help users understand why the command stopped working.
Tests & docs
No E2E tests or documentation updates (README, docs/adapters/, SKILL.md, vitepress sidebar). Per TESTING.md, browser commands should have entries in browser-public.test.ts (or browser-auth.test.ts).
Astro-Han
left a comment
There was a problem hiding this comment.
Thanks for addressing the feedback! Strategy, tests, duplicate condition, and Vue Router guard all look good now. LGTM from my side.
Minor remaining nits (non-blocking):
gov-law/recent.tsandsearch.tsshare ~15 lines of identical DOM extraction — could be a shared helper- The
'no_router'return fromevaluateis not consumed; thelocation.hrefcheck works but is indirect - No doc updates (README,
docs/adapters/, SKILL.md) — deferring to maintainer on whether that's needed in this PR
e2b85d7 to
4a31891
Compare
Summary
baidu-scholar/search,wanfang/search,google-scholar/searchgov-law/search,gov-law/recent,gov-policy/search,gov-policy/recentDetails
baidu-scholar search <query>wanfang search <query>google-scholar search <query>gov-law search <query>gov-law recentgov-policy search <query>gov-policy recentNotable techniques
Vue Router.push()withsearchWordquery param, after injecting the search term into the input via native value setter to trigger Vue's reactivity.sousuo.www.gov.cn/sousuo/search.shtml(not the obvioussousuo.gov.cnwhich doesn't resolve).span.title,span.authors,span.essay-typeremain stable selectors.Test plan
npx tsc --noEmit— type check passednpx vitest run src/— 306 tests passedopencli validate— 86 CLI definitions validated, 0 errors🤖 Generated with Claude Code