@jackwener/opencli 1.6.8 → 1.6.10
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.
- package/README.md +117 -59
- package/README.zh-CN.md +123 -79
- package/dist/clis/_shared/common.d.ts +3 -0
- package/dist/clis/_shared/common.js +22 -0
- package/dist/clis/bilibili/hot.d.ts +1 -0
- package/dist/clis/bilibili/hot.js +35 -0
- package/dist/clis/bluesky/feeds.d.ts +1 -0
- package/dist/clis/bluesky/feeds.js +27 -0
- package/dist/clis/bluesky/followers.d.ts +1 -0
- package/dist/clis/bluesky/followers.js +27 -0
- package/dist/clis/bluesky/following.d.ts +1 -0
- package/dist/clis/bluesky/following.js +27 -0
- package/dist/clis/bluesky/profile.d.ts +1 -0
- package/dist/clis/bluesky/profile.js +29 -0
- package/dist/clis/bluesky/search.d.ts +1 -0
- package/dist/clis/bluesky/search.js +28 -0
- package/dist/clis/bluesky/starter-packs.d.ts +1 -0
- package/dist/clis/bluesky/starter-packs.js +28 -0
- package/dist/clis/bluesky/thread.d.ts +1 -0
- package/dist/clis/bluesky/thread.js +30 -0
- package/dist/clis/bluesky/trending.d.ts +1 -0
- package/dist/clis/bluesky/trending.js +19 -0
- package/dist/clis/bluesky/user.d.ts +1 -0
- package/dist/clis/bluesky/user.js +33 -0
- package/dist/clis/cnki/search.d.ts +1 -0
- package/dist/clis/cnki/search.js +60 -0
- package/dist/clis/cnki/search.test.d.ts +1 -0
- package/dist/clis/cnki/search.test.js +18 -0
- package/dist/clis/devto/tag.d.ts +1 -0
- package/dist/clis/devto/tag.js +32 -0
- package/dist/clis/devto/top.d.ts +1 -0
- package/dist/clis/devto/top.js +26 -0
- package/dist/clis/devto/user.d.ts +1 -0
- package/dist/clis/devto/user.js +31 -0
- package/dist/clis/dictionary/examples.d.ts +1 -0
- package/dist/clis/dictionary/examples.js +27 -0
- package/dist/clis/dictionary/search.d.ts +1 -0
- package/dist/clis/dictionary/search.js +29 -0
- package/dist/clis/dictionary/synonyms.d.ts +1 -0
- package/dist/clis/dictionary/synonyms.js +27 -0
- package/dist/clis/douban/subject.d.ts +1 -0
- package/dist/clis/douban/subject.js +118 -0
- package/dist/clis/douban/top250.d.ts +1 -0
- package/dist/clis/douban/top250.js +67 -0
- package/dist/clis/facebook/add-friend.d.ts +1 -0
- package/dist/clis/facebook/add-friend.js +43 -0
- package/dist/clis/facebook/events.d.ts +1 -0
- package/dist/clis/facebook/events.js +40 -0
- package/dist/clis/facebook/feed.d.ts +1 -0
- package/dist/clis/facebook/feed.js +59 -0
- package/dist/clis/facebook/friends.d.ts +1 -0
- package/dist/clis/facebook/friends.js +38 -0
- package/dist/clis/facebook/groups.d.ts +1 -0
- package/dist/clis/facebook/groups.js +46 -0
- package/dist/clis/facebook/join-group.d.ts +1 -0
- package/dist/clis/facebook/join-group.js +44 -0
- package/dist/clis/facebook/memories.d.ts +1 -0
- package/dist/clis/facebook/memories.js +35 -0
- package/dist/clis/facebook/notifications.d.ts +1 -0
- package/dist/clis/facebook/notifications.js +36 -0
- package/dist/clis/facebook/profile.d.ts +1 -0
- package/dist/clis/facebook/profile.js +37 -0
- package/dist/clis/facebook/search.d.ts +1 -0
- package/dist/clis/facebook/search.js +38 -0
- package/dist/clis/facebook/search.test.d.ts +1 -1
- package/dist/clis/facebook/search.test.js +6 -9
- package/dist/clis/gitee/index.d.ts +3 -0
- package/dist/clis/gitee/index.js +3 -0
- package/dist/clis/gitee/search.d.ts +1 -0
- package/dist/clis/gitee/search.js +136 -0
- package/dist/clis/gitee/trending.d.ts +1 -0
- package/dist/clis/gitee/trending.js +567 -0
- package/dist/clis/gitee/user.d.ts +1 -0
- package/dist/clis/gitee/user.js +199 -0
- package/dist/clis/gitee/user.test.d.ts +1 -0
- package/dist/clis/gitee/user.test.js +63 -0
- package/dist/clis/hackernews/ask.d.ts +1 -0
- package/dist/clis/hackernews/ask.js +29 -0
- package/dist/clis/hackernews/best.d.ts +1 -0
- package/dist/clis/hackernews/best.js +29 -0
- package/dist/clis/hackernews/jobs.d.ts +1 -0
- package/dist/clis/hackernews/jobs.js +27 -0
- package/dist/clis/hackernews/new.d.ts +1 -0
- package/dist/clis/hackernews/new.js +29 -0
- package/dist/clis/hackernews/search.d.ts +1 -0
- package/dist/clis/hackernews/search.js +36 -0
- package/dist/clis/hackernews/show.d.ts +1 -0
- package/dist/clis/hackernews/show.js +29 -0
- package/dist/clis/hackernews/top.d.ts +1 -0
- package/dist/clis/hackernews/top.js +29 -0
- package/dist/clis/hackernews/user.d.ts +1 -0
- package/dist/clis/hackernews/user.js +22 -0
- package/dist/clis/hupu/hot.d.ts +1 -0
- package/dist/clis/hupu/hot.js +40 -0
- package/dist/clis/instagram/comment.d.ts +1 -0
- package/dist/clis/instagram/comment.js +47 -0
- package/dist/clis/instagram/explore.d.ts +1 -0
- package/dist/clis/instagram/explore.js +41 -0
- package/dist/clis/instagram/follow.d.ts +1 -0
- package/dist/clis/instagram/follow.js +43 -0
- package/dist/clis/instagram/followers.d.ts +1 -0
- package/dist/clis/instagram/followers.js +45 -0
- package/dist/clis/instagram/following.d.ts +1 -0
- package/dist/clis/instagram/following.js +45 -0
- package/dist/clis/instagram/like.d.ts +1 -0
- package/dist/clis/instagram/like.js +45 -0
- package/dist/clis/instagram/profile.d.ts +1 -0
- package/dist/clis/instagram/profile.js +39 -0
- package/dist/clis/instagram/save.d.ts +1 -0
- package/dist/clis/instagram/save.js +45 -0
- package/dist/clis/instagram/saved.d.ts +1 -0
- package/dist/clis/instagram/saved.js +38 -0
- package/dist/clis/instagram/search.d.ts +1 -0
- package/dist/clis/instagram/search.js +38 -0
- package/dist/clis/instagram/unfollow.d.ts +1 -0
- package/dist/clis/instagram/unfollow.js +40 -0
- package/dist/clis/instagram/unlike.d.ts +1 -0
- package/dist/clis/instagram/unlike.js +45 -0
- package/dist/clis/instagram/unsave.d.ts +1 -0
- package/dist/clis/instagram/unsave.js +45 -0
- package/dist/clis/instagram/user.d.ts +1 -0
- package/dist/clis/instagram/user.js +48 -0
- package/dist/clis/jd/add-cart.d.ts +1 -0
- package/dist/clis/jd/add-cart.js +71 -0
- package/dist/clis/jd/cart.d.ts +1 -0
- package/dist/clis/jd/cart.js +79 -0
- package/dist/clis/jd/commands.test.d.ts +5 -0
- package/dist/clis/jd/commands.test.js +64 -0
- package/dist/clis/jd/detail.d.ts +1 -0
- package/dist/clis/jd/detail.js +62 -0
- package/dist/clis/jd/reviews.d.ts +1 -0
- package/dist/clis/jd/reviews.js +54 -0
- package/dist/clis/jd/search.d.ts +1 -0
- package/dist/clis/jd/search.js +65 -0
- package/dist/clis/jianyu/search.d.ts +14 -0
- package/dist/clis/jianyu/search.js +135 -0
- package/dist/clis/jianyu/search.test.d.ts +1 -0
- package/dist/clis/jianyu/search.test.js +23 -0
- package/dist/clis/jike/post.d.ts +1 -0
- package/dist/clis/jike/post.js +61 -0
- package/dist/clis/jike/topic.d.ts +1 -0
- package/dist/clis/jike/topic.js +51 -0
- package/dist/clis/jike/user.d.ts +1 -0
- package/dist/clis/jike/user.js +50 -0
- package/dist/clis/jimeng/generate.d.ts +1 -0
- package/dist/clis/jimeng/generate.js +83 -0
- package/dist/clis/jimeng/history.d.ts +1 -0
- package/dist/clis/jimeng/history.js +47 -0
- package/dist/clis/jimeng/new.d.ts +1 -0
- package/dist/clis/jimeng/new.js +43 -0
- package/dist/clis/jimeng/workspaces.d.ts +1 -0
- package/dist/clis/jimeng/workspaces.js +41 -0
- package/dist/clis/linux-do/categories.d.ts +1 -0
- package/dist/clis/linux-do/categories.js +65 -0
- package/dist/clis/linux-do/search.d.ts +1 -0
- package/dist/clis/linux-do/search.js +41 -0
- package/dist/clis/linux-do/tags.d.ts +1 -0
- package/dist/clis/linux-do/tags.js +39 -0
- package/dist/clis/linux-do/topic-content.test.js +5 -5
- package/dist/clis/linux-do/topic.d.ts +1 -0
- package/dist/clis/linux-do/topic.js +56 -0
- package/dist/clis/linux-do/user-posts.d.ts +1 -0
- package/dist/clis/linux-do/user-posts.js +61 -0
- package/dist/clis/linux-do/user-topics.d.ts +1 -0
- package/dist/clis/linux-do/user-topics.js +48 -0
- package/dist/clis/lobsters/active.d.ts +1 -0
- package/dist/clis/lobsters/active.js +26 -0
- package/dist/clis/lobsters/hot.d.ts +1 -0
- package/dist/clis/lobsters/hot.js +26 -0
- package/dist/clis/lobsters/newest.d.ts +1 -0
- package/dist/clis/lobsters/newest.js +26 -0
- package/dist/clis/lobsters/tag.d.ts +1 -0
- package/dist/clis/lobsters/tag.js +32 -0
- package/dist/clis/pixiv/detail.d.ts +1 -0
- package/dist/clis/pixiv/detail.js +58 -0
- package/dist/clis/pixiv/ranking.d.ts +1 -0
- package/dist/clis/pixiv/ranking.js +59 -0
- package/dist/clis/pixiv/user.d.ts +1 -0
- package/dist/clis/pixiv/user.js +52 -0
- package/dist/clis/quark/ls.d.ts +1 -0
- package/dist/clis/quark/ls.js +63 -0
- package/dist/clis/quark/mkdir.d.ts +1 -0
- package/dist/clis/quark/mkdir.js +36 -0
- package/dist/clis/quark/mv.d.ts +1 -0
- package/dist/clis/quark/mv.js +53 -0
- package/dist/clis/quark/rename.d.ts +1 -0
- package/dist/clis/quark/rename.js +26 -0
- package/dist/clis/quark/rm.d.ts +1 -0
- package/dist/clis/quark/rm.js +24 -0
- package/dist/clis/quark/save.d.ts +1 -0
- package/dist/clis/quark/save.js +80 -0
- package/dist/clis/quark/share-tree.d.ts +1 -0
- package/dist/clis/quark/share-tree.js +45 -0
- package/dist/clis/quark/utils.d.ts +50 -0
- package/dist/clis/quark/utils.js +146 -0
- package/dist/clis/quark/utils.test.d.ts +1 -0
- package/dist/clis/quark/utils.test.js +58 -0
- package/dist/clis/reddit/frontpage.d.ts +1 -0
- package/dist/clis/reddit/frontpage.js +31 -0
- package/dist/clis/reddit/hot.d.ts +1 -0
- package/dist/clis/reddit/hot.js +45 -0
- package/dist/clis/reddit/popular.d.ts +1 -0
- package/dist/clis/reddit/popular.js +41 -0
- package/dist/clis/reddit/search.d.ts +1 -0
- package/dist/clis/reddit/search.js +65 -0
- package/dist/clis/reddit/subreddit.d.ts +1 -0
- package/dist/clis/reddit/subreddit.js +52 -0
- package/dist/clis/reddit/user-comments.d.ts +1 -0
- package/dist/clis/reddit/user-comments.js +44 -0
- package/dist/clis/reddit/user-posts.d.ts +1 -0
- package/dist/clis/reddit/user-posts.js +42 -0
- package/dist/clis/reddit/user.d.ts +1 -0
- package/dist/clis/reddit/user.js +37 -0
- package/dist/clis/stackoverflow/bounties.d.ts +1 -0
- package/dist/clis/stackoverflow/bounties.js +27 -0
- package/dist/clis/stackoverflow/hot.d.ts +1 -0
- package/dist/clis/stackoverflow/hot.js +24 -0
- package/dist/clis/stackoverflow/search.d.ts +1 -0
- package/dist/clis/stackoverflow/search.js +27 -0
- package/dist/clis/stackoverflow/unanswered.d.ts +1 -0
- package/dist/clis/stackoverflow/unanswered.js +26 -0
- package/dist/clis/steam/top-sellers.d.ts +1 -0
- package/dist/clis/steam/top-sellers.js +25 -0
- package/dist/clis/taobao/add-cart.d.ts +1 -0
- package/dist/clis/taobao/add-cart.js +149 -0
- package/dist/clis/taobao/cart.d.ts +1 -0
- package/dist/clis/taobao/cart.js +95 -0
- package/dist/clis/taobao/commands.test.d.ts +5 -0
- package/dist/clis/taobao/commands.test.js +64 -0
- package/dist/clis/taobao/detail.d.ts +1 -0
- package/dist/clis/taobao/detail.js +70 -0
- package/dist/clis/taobao/reviews.d.ts +1 -0
- package/dist/clis/taobao/reviews.js +76 -0
- package/dist/clis/taobao/search.d.ts +1 -0
- package/dist/clis/taobao/search.js +96 -0
- package/dist/clis/tiktok/comment.d.ts +1 -0
- package/dist/clis/tiktok/comment.js +57 -0
- package/dist/clis/tiktok/explore.d.ts +1 -0
- package/dist/clis/tiktok/explore.js +35 -0
- package/dist/clis/tiktok/follow.d.ts +1 -0
- package/dist/clis/tiktok/follow.js +39 -0
- package/dist/clis/tiktok/following.d.ts +1 -0
- package/dist/clis/tiktok/following.js +42 -0
- package/dist/clis/tiktok/friends.d.ts +1 -0
- package/dist/clis/tiktok/friends.js +43 -0
- package/dist/clis/tiktok/like.d.ts +1 -0
- package/dist/clis/tiktok/like.js +33 -0
- package/dist/clis/tiktok/live.d.ts +1 -0
- package/dist/clis/tiktok/live.js +47 -0
- package/dist/clis/tiktok/notifications.d.ts +1 -0
- package/dist/clis/tiktok/notifications.js +49 -0
- package/dist/clis/tiktok/profile.d.ts +1 -0
- package/dist/clis/tiktok/profile.js +54 -0
- package/dist/clis/tiktok/save.d.ts +1 -0
- package/dist/clis/tiktok/save.js +29 -0
- package/dist/clis/tiktok/search.d.ts +1 -0
- package/dist/clis/tiktok/search.js +39 -0
- package/dist/clis/tiktok/unfollow.d.ts +1 -0
- package/dist/clis/tiktok/unfollow.js +44 -0
- package/dist/clis/tiktok/unlike.d.ts +1 -0
- package/dist/clis/tiktok/unlike.js +33 -0
- package/dist/clis/tiktok/unsave.d.ts +1 -0
- package/dist/clis/tiktok/unsave.js +31 -0
- package/dist/clis/tiktok/user.d.ts +1 -0
- package/dist/clis/tiktok/user.js +41 -0
- package/dist/clis/twitter/reply.js +3 -8
- package/dist/clis/twitter/reply.test.js +5 -5
- package/dist/clis/v2ex/hot.d.ts +1 -0
- package/dist/clis/v2ex/hot.js +25 -0
- package/dist/clis/v2ex/latest.d.ts +1 -0
- package/dist/clis/v2ex/latest.js +25 -0
- package/dist/clis/v2ex/member.d.ts +1 -0
- package/dist/clis/v2ex/member.js +27 -0
- package/dist/clis/v2ex/node.d.ts +1 -0
- package/dist/clis/v2ex/node.js +38 -0
- package/dist/clis/v2ex/nodes.d.ts +1 -0
- package/dist/clis/v2ex/nodes.js +25 -0
- package/dist/clis/v2ex/replies.d.ts +1 -0
- package/dist/clis/v2ex/replies.js +26 -0
- package/dist/clis/v2ex/topic.d.ts +1 -0
- package/dist/clis/v2ex/topic.js +30 -0
- package/dist/clis/v2ex/user.d.ts +1 -0
- package/dist/clis/v2ex/user.js +33 -0
- package/dist/clis/xiaoe/catalog.d.ts +1 -0
- package/dist/clis/xiaoe/catalog.js +125 -0
- package/dist/clis/xiaoe/content.d.ts +1 -0
- package/dist/clis/xiaoe/content.js +39 -0
- package/dist/clis/xiaoe/courses.d.ts +1 -0
- package/dist/clis/xiaoe/courses.js +69 -0
- package/dist/clis/xiaoe/detail.d.ts +1 -0
- package/dist/clis/xiaoe/detail.js +35 -0
- package/dist/clis/xiaoe/play-url.d.ts +1 -0
- package/dist/clis/xiaoe/play-url.js +120 -0
- package/dist/clis/xiaohongshu/feed.d.ts +1 -0
- package/dist/clis/xiaohongshu/feed.js +32 -0
- package/dist/clis/xiaohongshu/note.js +8 -3
- package/dist/clis/xiaohongshu/note.test.js +11 -0
- package/dist/clis/xiaohongshu/notifications.d.ts +1 -0
- package/dist/clis/xiaohongshu/notifications.js +38 -0
- package/dist/clis/xueqiu/earnings-date.d.ts +1 -0
- package/dist/clis/xueqiu/earnings-date.js +61 -0
- package/dist/clis/xueqiu/feed.d.ts +1 -0
- package/dist/clis/xueqiu/feed.js +48 -0
- package/dist/clis/xueqiu/groups.d.ts +1 -0
- package/dist/clis/xueqiu/groups.js +25 -0
- package/dist/clis/xueqiu/hot-stock.d.ts +1 -0
- package/dist/clis/xueqiu/hot-stock.js +44 -0
- package/dist/clis/xueqiu/hot.d.ts +1 -0
- package/dist/clis/xueqiu/hot.js +44 -0
- package/dist/clis/xueqiu/kline.d.ts +1 -0
- package/dist/clis/xueqiu/kline.js +64 -0
- package/dist/clis/xueqiu/search.d.ts +1 -0
- package/dist/clis/xueqiu/search.js +49 -0
- package/dist/clis/xueqiu/stock.d.ts +1 -0
- package/dist/clis/xueqiu/stock.js +72 -0
- package/dist/clis/xueqiu/watchlist.d.ts +1 -0
- package/dist/clis/xueqiu/watchlist.js +45 -0
- package/dist/clis/zhihu/answer.d.ts +1 -0
- package/dist/clis/zhihu/answer.js +194 -0
- package/dist/clis/zhihu/answer.test.d.ts +1 -0
- package/dist/clis/zhihu/answer.test.js +81 -0
- package/dist/clis/zhihu/comment.d.ts +1 -0
- package/dist/clis/zhihu/comment.js +335 -0
- package/dist/clis/zhihu/comment.test.d.ts +1 -0
- package/dist/clis/zhihu/comment.test.js +54 -0
- package/dist/clis/zhihu/favorite.d.ts +1 -0
- package/dist/clis/zhihu/favorite.js +224 -0
- package/dist/clis/zhihu/favorite.test.d.ts +1 -0
- package/dist/clis/zhihu/favorite.test.js +196 -0
- package/dist/clis/zhihu/follow.d.ts +1 -0
- package/dist/clis/zhihu/follow.js +80 -0
- package/dist/clis/zhihu/follow.test.d.ts +1 -0
- package/dist/clis/zhihu/follow.test.js +45 -0
- package/dist/clis/zhihu/hot.d.ts +1 -0
- package/dist/clis/zhihu/hot.js +43 -0
- package/dist/clis/zhihu/like.d.ts +1 -0
- package/dist/clis/zhihu/like.js +91 -0
- package/dist/clis/zhihu/like.test.d.ts +1 -0
- package/dist/clis/zhihu/like.test.js +64 -0
- package/dist/clis/zhihu/search.d.ts +1 -0
- package/dist/clis/zhihu/search.js +52 -0
- package/dist/clis/zhihu/target.d.ts +24 -0
- package/dist/clis/zhihu/target.js +91 -0
- package/dist/clis/zhihu/target.test.d.ts +1 -0
- package/dist/clis/zhihu/target.test.js +77 -0
- package/dist/clis/zhihu/write-shared.d.ts +32 -0
- package/dist/clis/zhihu/write-shared.js +221 -0
- package/dist/clis/zhihu/write-shared.test.d.ts +1 -0
- package/dist/clis/zhihu/write-shared.test.js +175 -0
- package/dist/src/browser/bridge.d.ts +2 -0
- package/dist/src/browser/bridge.js +30 -24
- package/dist/src/browser/daemon-client.d.ts +30 -10
- package/dist/src/browser/daemon-client.js +42 -27
- package/dist/src/browser/daemon-client.test.js +32 -25
- package/dist/src/browser/dom-helpers.test.js +3 -2
- package/dist/src/browser/errors.d.ts +26 -1
- package/dist/src/browser/errors.js +40 -7
- package/dist/src/browser/errors.test.d.ts +1 -0
- package/dist/src/browser/errors.test.js +51 -0
- package/dist/src/browser/index.d.ts +2 -1
- package/dist/src/browser/index.js +1 -1
- package/dist/src/browser/page.d.ts +9 -8
- package/dist/src/browser/page.js +33 -31
- package/dist/src/browser.test.js +27 -8
- package/dist/src/build-manifest.d.ts +5 -11
- package/dist/src/build-manifest.js +6 -75
- package/dist/src/build-manifest.test.js +1 -39
- package/dist/src/cascade.js +3 -2
- package/dist/src/cli.d.ts +3 -3
- package/dist/src/cli.js +73 -65
- package/dist/src/cli.test.js +20 -15
- package/dist/src/clis/binance/asks.d.ts +1 -0
- package/dist/src/clis/binance/asks.js +20 -0
- package/dist/src/clis/binance/commands.test.d.ts +3 -0
- package/dist/src/clis/binance/commands.test.js +58 -0
- package/dist/src/clis/binance/depth.d.ts +1 -0
- package/dist/src/clis/binance/depth.js +20 -0
- package/dist/src/clis/binance/gainers.d.ts +1 -0
- package/dist/src/clis/binance/gainers.js +21 -0
- package/dist/src/clis/binance/klines.d.ts +1 -0
- package/dist/src/clis/binance/klines.js +20 -0
- package/dist/src/clis/binance/losers.d.ts +1 -0
- package/dist/src/clis/binance/losers.js +21 -0
- package/dist/src/clis/binance/pairs.d.ts +1 -0
- package/dist/src/clis/binance/pairs.js +20 -0
- package/dist/src/clis/binance/price.d.ts +1 -0
- package/dist/src/clis/binance/price.js +17 -0
- package/dist/src/clis/binance/prices.d.ts +1 -0
- package/dist/src/clis/binance/prices.js +18 -0
- package/dist/src/clis/binance/ticker.d.ts +1 -0
- package/dist/src/clis/binance/ticker.js +20 -0
- package/dist/src/clis/binance/top.d.ts +1 -0
- package/dist/src/clis/binance/top.js +20 -0
- package/dist/src/clis/binance/trades.d.ts +1 -0
- package/dist/src/clis/binance/trades.js +19 -0
- package/dist/src/commanderAdapter.js +19 -6
- package/dist/src/completion-fast.d.ts +25 -0
- package/dist/src/completion-fast.js +140 -0
- package/dist/src/completion.d.ts +1 -0
- package/dist/src/completion.js +1 -0
- package/dist/src/diagnostic.d.ts +1 -0
- package/dist/src/diagnostic.js +64 -2
- package/dist/src/diagnostic.test.js +93 -3
- package/dist/src/discovery.d.ts +3 -3
- package/dist/src/discovery.js +34 -97
- package/dist/src/doctor.d.ts +2 -0
- package/dist/src/doctor.js +59 -31
- package/dist/src/doctor.test.js +89 -16
- package/dist/src/download/index.d.ts +1 -1
- package/dist/src/engine.test.js +4 -19
- package/dist/src/execution.js +1 -13
- package/dist/src/explore.js +1 -1
- package/dist/src/generate-verified.d.ts +105 -0
- package/dist/src/generate-verified.js +696 -0
- package/dist/src/generate-verified.test.d.ts +1 -0
- package/dist/src/generate-verified.test.js +925 -0
- package/dist/src/generate.d.ts +11 -6
- package/dist/src/generate.js +4 -7
- package/dist/src/main.js +65 -12
- package/dist/src/pipeline/steps/download.d.ts +1 -17
- package/dist/src/pipeline/steps/download.js +20 -31
- package/dist/src/pipeline/steps/intercept.d.ts +1 -1
- package/dist/src/pipeline/steps/intercept.js +1 -1
- package/dist/src/pipeline/steps/tap.d.ts +1 -1
- package/dist/src/pipeline/steps/tap.js +1 -1
- package/dist/src/plugin-scaffold.d.ts +2 -2
- package/dist/src/plugin-scaffold.js +24 -21
- package/dist/src/plugin-scaffold.test.js +1 -1
- package/dist/src/plugin.d.ts +3 -2
- package/dist/src/plugin.js +29 -14
- package/dist/src/plugin.test.js +47 -32
- package/dist/src/record.js +26 -25
- package/dist/src/runtime-detect.js +3 -7
- package/dist/src/scripts/framework.d.ts +3 -0
- package/dist/src/scripts/framework.js +8 -4
- package/dist/src/scripts/store.d.ts +5 -1
- package/dist/src/scripts/store.js +5 -1
- package/dist/src/skill-generate.d.ts +30 -0
- package/dist/src/skill-generate.js +75 -0
- package/dist/src/skill-generate.test.d.ts +1 -0
- package/dist/src/skill-generate.test.js +173 -0
- package/dist/src/synthesize.d.ts +1 -1
- package/dist/src/synthesize.js +7 -8
- package/dist/src/types.d.ts +3 -1
- package/package.json +5 -5
- package/dist/clis/bilibili/hot.yaml +0 -38
- package/dist/clis/bluesky/feeds.yaml +0 -29
- package/dist/clis/bluesky/followers.yaml +0 -33
- package/dist/clis/bluesky/following.yaml +0 -33
- package/dist/clis/bluesky/profile.yaml +0 -27
- package/dist/clis/bluesky/search.yaml +0 -34
- package/dist/clis/bluesky/starter-packs.yaml +0 -34
- package/dist/clis/bluesky/thread.yaml +0 -32
- package/dist/clis/bluesky/trending.yaml +0 -27
- package/dist/clis/bluesky/user.yaml +0 -34
- package/dist/clis/devto/tag.yaml +0 -34
- package/dist/clis/devto/top.yaml +0 -29
- package/dist/clis/devto/user.yaml +0 -33
- package/dist/clis/dictionary/examples.yaml +0 -25
- package/dist/clis/dictionary/search.yaml +0 -27
- package/dist/clis/dictionary/synonyms.yaml +0 -25
- package/dist/clis/douban/subject.yaml +0 -107
- package/dist/clis/douban/top250.yaml +0 -70
- package/dist/clis/facebook/add-friend.yaml +0 -43
- package/dist/clis/facebook/events.yaml +0 -44
- package/dist/clis/facebook/feed.yaml +0 -63
- package/dist/clis/facebook/friends.yaml +0 -42
- package/dist/clis/facebook/groups.yaml +0 -50
- package/dist/clis/facebook/join-group.yaml +0 -44
- package/dist/clis/facebook/memories.yaml +0 -39
- package/dist/clis/facebook/notifications.yaml +0 -40
- package/dist/clis/facebook/profile.yaml +0 -37
- package/dist/clis/facebook/search.yaml +0 -47
- package/dist/clis/hackernews/ask.yaml +0 -38
- package/dist/clis/hackernews/best.yaml +0 -38
- package/dist/clis/hackernews/jobs.yaml +0 -36
- package/dist/clis/hackernews/new.yaml +0 -38
- package/dist/clis/hackernews/search.yaml +0 -44
- package/dist/clis/hackernews/show.yaml +0 -38
- package/dist/clis/hackernews/top.yaml +0 -38
- package/dist/clis/hackernews/user.yaml +0 -25
- package/dist/clis/hupu/hot.yaml +0 -43
- package/dist/clis/instagram/comment.yaml +0 -52
- package/dist/clis/instagram/explore.yaml +0 -43
- package/dist/clis/instagram/follow.yaml +0 -41
- package/dist/clis/instagram/followers.yaml +0 -51
- package/dist/clis/instagram/following.yaml +0 -51
- package/dist/clis/instagram/like.yaml +0 -46
- package/dist/clis/instagram/profile.yaml +0 -42
- package/dist/clis/instagram/save.yaml +0 -46
- package/dist/clis/instagram/saved.yaml +0 -40
- package/dist/clis/instagram/search.yaml +0 -44
- package/dist/clis/instagram/unfollow.yaml +0 -38
- package/dist/clis/instagram/unlike.yaml +0 -46
- package/dist/clis/instagram/unsave.yaml +0 -46
- package/dist/clis/instagram/user.yaml +0 -54
- package/dist/clis/jike/post.yaml +0 -59
- package/dist/clis/jike/topic.yaml +0 -53
- package/dist/clis/jike/user.yaml +0 -52
- package/dist/clis/jimeng/generate.yaml +0 -85
- package/dist/clis/jimeng/history.yaml +0 -46
- package/dist/clis/linux-do/categories.yaml +0 -70
- package/dist/clis/linux-do/search.yaml +0 -48
- package/dist/clis/linux-do/tags.yaml +0 -41
- package/dist/clis/linux-do/topic.yaml +0 -62
- package/dist/clis/linux-do/user-posts.yaml +0 -67
- package/dist/clis/linux-do/user-topics.yaml +0 -54
- package/dist/clis/lobsters/active.yaml +0 -29
- package/dist/clis/lobsters/hot.yaml +0 -29
- package/dist/clis/lobsters/newest.yaml +0 -29
- package/dist/clis/lobsters/tag.yaml +0 -34
- package/dist/clis/pixiv/detail.yaml +0 -49
- package/dist/clis/pixiv/ranking.yaml +0 -53
- package/dist/clis/pixiv/user.yaml +0 -46
- package/dist/clis/reddit/frontpage.yaml +0 -30
- package/dist/clis/reddit/hot.yaml +0 -47
- package/dist/clis/reddit/popular.yaml +0 -40
- package/dist/clis/reddit/search.yaml +0 -61
- package/dist/clis/reddit/subreddit.yaml +0 -50
- package/dist/clis/reddit/user-comments.yaml +0 -46
- package/dist/clis/reddit/user-posts.yaml +0 -44
- package/dist/clis/reddit/user.yaml +0 -40
- package/dist/clis/stackoverflow/bounties.yaml +0 -29
- package/dist/clis/stackoverflow/hot.yaml +0 -28
- package/dist/clis/stackoverflow/search.yaml +0 -33
- package/dist/clis/stackoverflow/unanswered.yaml +0 -28
- package/dist/clis/steam/top-sellers.yaml +0 -29
- package/dist/clis/tiktok/comment.yaml +0 -66
- package/dist/clis/tiktok/explore.yaml +0 -39
- package/dist/clis/tiktok/follow.yaml +0 -39
- package/dist/clis/tiktok/following.yaml +0 -46
- package/dist/clis/tiktok/friends.yaml +0 -47
- package/dist/clis/tiktok/like.yaml +0 -38
- package/dist/clis/tiktok/live.yaml +0 -51
- package/dist/clis/tiktok/notifications.yaml +0 -52
- package/dist/clis/tiktok/profile.yaml +0 -45
- package/dist/clis/tiktok/save.yaml +0 -34
- package/dist/clis/tiktok/search.yaml +0 -47
- package/dist/clis/tiktok/unfollow.yaml +0 -44
- package/dist/clis/tiktok/unlike.yaml +0 -38
- package/dist/clis/tiktok/unsave.yaml +0 -36
- package/dist/clis/tiktok/user.yaml +0 -44
- package/dist/clis/v2ex/hot.yaml +0 -28
- package/dist/clis/v2ex/latest.yaml +0 -28
- package/dist/clis/v2ex/member.yaml +0 -29
- package/dist/clis/v2ex/node.yaml +0 -34
- package/dist/clis/v2ex/nodes.yaml +0 -31
- package/dist/clis/v2ex/replies.yaml +0 -32
- package/dist/clis/v2ex/topic.yaml +0 -33
- package/dist/clis/v2ex/user.yaml +0 -34
- package/dist/clis/xiaoe/catalog.yaml +0 -129
- package/dist/clis/xiaoe/content.yaml +0 -43
- package/dist/clis/xiaoe/courses.yaml +0 -73
- package/dist/clis/xiaoe/detail.yaml +0 -39
- package/dist/clis/xiaoe/play-url.yaml +0 -124
- package/dist/clis/xiaohongshu/feed.yaml +0 -31
- package/dist/clis/xiaohongshu/notifications.yaml +0 -37
- package/dist/clis/xueqiu/earnings-date.yaml +0 -69
- package/dist/clis/xueqiu/feed.yaml +0 -53
- package/dist/clis/xueqiu/groups.yaml +0 -23
- package/dist/clis/xueqiu/hot-stock.yaml +0 -49
- package/dist/clis/xueqiu/hot.yaml +0 -46
- package/dist/clis/xueqiu/kline.yaml +0 -65
- package/dist/clis/xueqiu/search.yaml +0 -55
- package/dist/clis/xueqiu/stock.yaml +0 -69
- package/dist/clis/xueqiu/watchlist.yaml +0 -46
- package/dist/clis/zhihu/hot.yaml +0 -46
- package/dist/clis/zhihu/search.yaml +0 -59
- package/dist/src/browser/discover.d.ts +0 -15
- package/dist/src/browser/discover.js +0 -19
- package/dist/src/yaml-schema.d.ts +0 -29
- package/dist/src/yaml-schema.js +0 -22
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { getRegistry } from '@jackwener/opencli/registry';
|
|
3
|
+
import './favorite.js';
|
|
4
|
+
describe('zhihu favorite', () => {
|
|
5
|
+
it('rejects missing collection selectors before opening the chooser', async () => {
|
|
6
|
+
const cmd = getRegistry().get('zhihu/favorite');
|
|
7
|
+
expect(cmd?.func).toBeTypeOf('function');
|
|
8
|
+
const page = { goto: vi.fn(), evaluate: vi.fn() };
|
|
9
|
+
await expect(cmd.func(page, { target: 'article:1', execute: true })).rejects.toMatchObject({
|
|
10
|
+
code: 'INVALID_INPUT',
|
|
11
|
+
});
|
|
12
|
+
expect(page.goto).not.toHaveBeenCalled();
|
|
13
|
+
expect(page.evaluate).not.toHaveBeenCalled();
|
|
14
|
+
});
|
|
15
|
+
it('requires persisted read-back and preserves previously selected collections', async () => {
|
|
16
|
+
const cmd = getRegistry().get('zhihu/favorite');
|
|
17
|
+
const page = {
|
|
18
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
19
|
+
evaluate: vi.fn()
|
|
20
|
+
.mockResolvedValueOnce({
|
|
21
|
+
chooserRows: [
|
|
22
|
+
{ id: 'fav-a', name: '已存在', selected: true },
|
|
23
|
+
{ id: 'fav-b', name: '默认收藏夹', selected: false },
|
|
24
|
+
],
|
|
25
|
+
targetRowId: 'fav-b',
|
|
26
|
+
targetRowName: '默认收藏夹',
|
|
27
|
+
})
|
|
28
|
+
.mockResolvedValueOnce({
|
|
29
|
+
persisted: true,
|
|
30
|
+
readbackSource: 'reopened_chooser',
|
|
31
|
+
selectedBefore: ['fav-a'],
|
|
32
|
+
selectedAfter: ['fav-a', 'fav-b'],
|
|
33
|
+
targetSelected: true,
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
await expect(cmd.func(page, { target: 'article:1', collection: '默认收藏夹', execute: true })).resolves.toEqual([
|
|
37
|
+
expect.objectContaining({ outcome: 'applied', collection_name: '默认收藏夹', target: 'article:1' }),
|
|
38
|
+
]);
|
|
39
|
+
expect(page.evaluate.mock.calls[1][0]).toContain('waitForChooserRows(false)');
|
|
40
|
+
expect(page.evaluate.mock.calls[1][0]).toContain("readbackSource");
|
|
41
|
+
});
|
|
42
|
+
it('requires persisted read-back before returning already_applied', async () => {
|
|
43
|
+
const cmd = getRegistry().get('zhihu/favorite');
|
|
44
|
+
const page = {
|
|
45
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
46
|
+
evaluate: vi.fn()
|
|
47
|
+
.mockResolvedValueOnce({
|
|
48
|
+
chooserRows: [{ id: 'fav-a', name: '默认收藏夹', selected: true }],
|
|
49
|
+
targetRowId: 'fav-a',
|
|
50
|
+
targetRowName: '默认收藏夹',
|
|
51
|
+
})
|
|
52
|
+
.mockResolvedValueOnce({
|
|
53
|
+
persisted: true,
|
|
54
|
+
readbackSource: 'reopened_chooser',
|
|
55
|
+
selectedAfter: ['fav-a'],
|
|
56
|
+
targetSelected: true,
|
|
57
|
+
}),
|
|
58
|
+
};
|
|
59
|
+
await expect(cmd.func(page, { target: 'article:1', collection: '默认收藏夹', execute: true })).resolves.toEqual([
|
|
60
|
+
expect.objectContaining({ outcome: 'already_applied', collection_name: '默认收藏夹' }),
|
|
61
|
+
]);
|
|
62
|
+
});
|
|
63
|
+
it('accepts --collection-id as the stable selector path', async () => {
|
|
64
|
+
const cmd = getRegistry().get('zhihu/favorite');
|
|
65
|
+
const page = {
|
|
66
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
67
|
+
evaluate: vi.fn()
|
|
68
|
+
.mockResolvedValueOnce({
|
|
69
|
+
chooserRows: [
|
|
70
|
+
{ id: 'fav-a', name: '默认收藏夹', selected: false },
|
|
71
|
+
{ id: 'fav-b', name: '同名收藏夹', selected: false },
|
|
72
|
+
],
|
|
73
|
+
targetRowId: 'fav-b',
|
|
74
|
+
targetRowName: null,
|
|
75
|
+
})
|
|
76
|
+
.mockResolvedValueOnce({
|
|
77
|
+
persisted: true,
|
|
78
|
+
readbackSource: 'reopened_chooser',
|
|
79
|
+
selectedAfter: ['fav-b'],
|
|
80
|
+
targetSelected: true,
|
|
81
|
+
}),
|
|
82
|
+
};
|
|
83
|
+
await expect(cmd.func(page, { target: 'article:1', 'collection-id': 'fav-b', execute: true })).resolves.toEqual([
|
|
84
|
+
expect.objectContaining({ outcome: 'applied', collection_id: 'fav-b' }),
|
|
85
|
+
]);
|
|
86
|
+
});
|
|
87
|
+
it('rejects duplicate collection names before selecting any row', async () => {
|
|
88
|
+
const cmd = getRegistry().get('zhihu/favorite');
|
|
89
|
+
const page = {
|
|
90
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
91
|
+
evaluate: vi.fn().mockResolvedValue({
|
|
92
|
+
chooserRows: [
|
|
93
|
+
{ id: 'fav-a', name: '默认收藏夹', selected: false },
|
|
94
|
+
{ id: 'fav-b', name: '默认收藏夹', selected: false },
|
|
95
|
+
],
|
|
96
|
+
}),
|
|
97
|
+
};
|
|
98
|
+
await expect(cmd.func(page, { target: 'article:1', collection: '默认收藏夹', execute: true })).rejects.toMatchObject({ code: 'ACTION_NOT_AVAILABLE' });
|
|
99
|
+
});
|
|
100
|
+
it('rejects optimistic chooser state that was not re-read from a reopened chooser', async () => {
|
|
101
|
+
const cmd = getRegistry().get('zhihu/favorite');
|
|
102
|
+
const page = {
|
|
103
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
104
|
+
evaluate: vi.fn()
|
|
105
|
+
.mockResolvedValueOnce({
|
|
106
|
+
chooserRows: [
|
|
107
|
+
{ id: 'fav-a', name: '已存在', selected: true },
|
|
108
|
+
{ id: 'fav-b', name: '默认收藏夹', selected: false },
|
|
109
|
+
],
|
|
110
|
+
targetRowId: 'fav-b',
|
|
111
|
+
targetRowName: '默认收藏夹',
|
|
112
|
+
})
|
|
113
|
+
.mockResolvedValueOnce({
|
|
114
|
+
persisted: true,
|
|
115
|
+
readbackSource: 'same_modal',
|
|
116
|
+
selectedAfter: ['fav-a', 'fav-b'],
|
|
117
|
+
targetSelected: true,
|
|
118
|
+
}),
|
|
119
|
+
};
|
|
120
|
+
await expect(cmd.func(page, { target: 'article:1', collection: '默认收藏夹', execute: true })).rejects.toMatchObject({ code: 'OUTCOME_UNKNOWN' });
|
|
121
|
+
});
|
|
122
|
+
it('matches unique collection names even when chooser rows include extra UI text', async () => {
|
|
123
|
+
const cmd = getRegistry().get('zhihu/favorite');
|
|
124
|
+
const page = {
|
|
125
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
126
|
+
evaluate: vi.fn()
|
|
127
|
+
.mockResolvedValueOnce({
|
|
128
|
+
chooserRows: [
|
|
129
|
+
{ id: 'fav-b', name: '默认收藏夹 12 条内容', selected: false },
|
|
130
|
+
],
|
|
131
|
+
targetRowId: null,
|
|
132
|
+
targetRowName: '默认收藏夹',
|
|
133
|
+
})
|
|
134
|
+
.mockResolvedValueOnce({
|
|
135
|
+
persisted: true,
|
|
136
|
+
readbackSource: 'reopened_chooser',
|
|
137
|
+
selectedAfter: ['fav-b'],
|
|
138
|
+
targetSelected: true,
|
|
139
|
+
}),
|
|
140
|
+
};
|
|
141
|
+
await expect(cmd.func(page, { target: 'article:1', collection: '默认收藏夹', execute: true })).resolves.toEqual([
|
|
142
|
+
expect.objectContaining({ outcome: 'applied', collection_name: '默认收藏夹' }),
|
|
143
|
+
]);
|
|
144
|
+
expect(page.evaluate.mock.calls[1][0]).toContain('normalizeCollectionName');
|
|
145
|
+
});
|
|
146
|
+
it('normalizes id-less row keys during reopened chooser verification', async () => {
|
|
147
|
+
const cmd = getRegistry().get('zhihu/favorite');
|
|
148
|
+
const page = {
|
|
149
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
150
|
+
evaluate: vi.fn()
|
|
151
|
+
.mockResolvedValueOnce({
|
|
152
|
+
chooserRows: [
|
|
153
|
+
{ id: '', name: '默认收藏夹 12 条内容', selected: false },
|
|
154
|
+
],
|
|
155
|
+
targetRowId: null,
|
|
156
|
+
targetRowName: '默认收藏夹',
|
|
157
|
+
})
|
|
158
|
+
.mockResolvedValueOnce({
|
|
159
|
+
persisted: true,
|
|
160
|
+
readbackSource: 'reopened_chooser',
|
|
161
|
+
selectedAfter: ['name:默认收藏夹'],
|
|
162
|
+
targetSelected: true,
|
|
163
|
+
}),
|
|
164
|
+
};
|
|
165
|
+
await expect(cmd.func(page, { target: 'article:1', collection: '默认收藏夹', execute: true })).resolves.toEqual([
|
|
166
|
+
expect.objectContaining({ outcome: 'applied', collection_name: '默认收藏夹' }),
|
|
167
|
+
]);
|
|
168
|
+
expect(page.evaluate.mock.calls[1][0]).toContain("const rowKey = (row) => row.id || 'name:' + normalizeCollectionName(row.name);");
|
|
169
|
+
expect(page.evaluate.mock.calls[1][0]).toContain('selectedAfter: chooserRows.filter((row) => row.selected).map(rowKey)');
|
|
170
|
+
});
|
|
171
|
+
it('reuses data-attribute answer anchoring during reopened chooser verification', async () => {
|
|
172
|
+
const cmd = getRegistry().get('zhihu/favorite');
|
|
173
|
+
const page = {
|
|
174
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
175
|
+
evaluate: vi.fn()
|
|
176
|
+
.mockResolvedValueOnce({
|
|
177
|
+
chooserRows: [
|
|
178
|
+
{ id: 'fav-b', name: '默认收藏夹', selected: false },
|
|
179
|
+
],
|
|
180
|
+
targetRowId: 'fav-b',
|
|
181
|
+
targetRowName: null,
|
|
182
|
+
})
|
|
183
|
+
.mockResolvedValueOnce({
|
|
184
|
+
persisted: true,
|
|
185
|
+
readbackSource: 'reopened_chooser',
|
|
186
|
+
selectedAfter: ['fav-b'],
|
|
187
|
+
targetSelected: true,
|
|
188
|
+
}),
|
|
189
|
+
};
|
|
190
|
+
await expect(cmd.func(page, { target: 'answer:1:2', 'collection-id': 'fav-b', execute: true })).resolves.toEqual([
|
|
191
|
+
expect.objectContaining({ outcome: 'applied', collection_id: 'fav-b', target: 'answer:1:2' }),
|
|
192
|
+
]);
|
|
193
|
+
expect(page.evaluate.mock.calls[1][0]).toContain("node.getAttribute('data-answerid')");
|
|
194
|
+
expect(page.evaluate.mock.calls[1][0]).toContain("node.getAttribute('data-zop-question-answer')");
|
|
195
|
+
});
|
|
196
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { CliError, CommandExecutionError } from '@jackwener/opencli/errors';
|
|
2
|
+
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
3
|
+
import { assertAllowedKinds, parseTarget } from './target.js';
|
|
4
|
+
import { buildResultRow, requireExecute } from './write-shared.js';
|
|
5
|
+
cli({
|
|
6
|
+
site: 'zhihu',
|
|
7
|
+
name: 'follow',
|
|
8
|
+
description: 'Follow a Zhihu user or question',
|
|
9
|
+
domain: 'www.zhihu.com',
|
|
10
|
+
strategy: Strategy.UI,
|
|
11
|
+
browser: true,
|
|
12
|
+
args: [
|
|
13
|
+
{ name: 'target', positional: true, required: true, help: 'Zhihu target URL or typed target' },
|
|
14
|
+
{ name: 'execute', type: 'boolean', help: 'Actually perform the write action' },
|
|
15
|
+
],
|
|
16
|
+
columns: ['status', 'outcome', 'message', 'target_type', 'target'],
|
|
17
|
+
func: async (page, kwargs) => {
|
|
18
|
+
if (!page)
|
|
19
|
+
throw new CommandExecutionError('Browser session required for zhihu follow');
|
|
20
|
+
requireExecute(kwargs);
|
|
21
|
+
const rawTarget = String(kwargs.target);
|
|
22
|
+
const target = assertAllowedKinds('follow', parseTarget(rawTarget));
|
|
23
|
+
await page.goto(target.url);
|
|
24
|
+
const result = await page.evaluate(`(async () => {
|
|
25
|
+
const targetKind = ${JSON.stringify(target.kind)};
|
|
26
|
+
const mainRoot = document.querySelector('main') || document;
|
|
27
|
+
let followBtn = null;
|
|
28
|
+
|
|
29
|
+
if (targetKind === 'question') {
|
|
30
|
+
const questionRoots = Array.from(mainRoot.querySelectorAll('.QuestionHeader, .Question-main, [data-zop-question-id], [class*="QuestionHeader"]'));
|
|
31
|
+
const scopedRoots = questionRoots.length ? questionRoots : [mainRoot];
|
|
32
|
+
const candidates = Array.from(new Set(scopedRoots.flatMap((root) => Array.from(root.querySelectorAll('button, a'))))).filter((node) => {
|
|
33
|
+
const text = (node.textContent || '').trim();
|
|
34
|
+
const inAside = Boolean(node.closest('aside, [data-testid*="recommend"], .Recommendations'));
|
|
35
|
+
const inAnswerBlock = Boolean(node.closest('article, .AnswerItem, [data-zop-question-answer]'));
|
|
36
|
+
return /关注问题|已关注/.test(text) && !inAside && !inAnswerBlock;
|
|
37
|
+
});
|
|
38
|
+
if (candidates.length !== 1) return { state: 'ambiguous_question_follow' };
|
|
39
|
+
followBtn = candidates[0];
|
|
40
|
+
} else {
|
|
41
|
+
const candidates = Array.from(mainRoot.querySelectorAll('button, a')).filter((node) => {
|
|
42
|
+
const text = (node.textContent || '').trim();
|
|
43
|
+
const inAside = Boolean(node.closest('aside, [data-testid*="recommend"], .Recommendations'));
|
|
44
|
+
return /关注|已关注/.test(text) && !/邀请|收藏|评论/.test(text) && !inAside;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
if (candidates.length !== 1) return { state: 'ambiguous_user_follow' };
|
|
48
|
+
followBtn = candidates[0];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!followBtn) return { state: 'missing' };
|
|
52
|
+
if ((followBtn.textContent || '').includes('已关注') || followBtn.getAttribute('aria-pressed') === 'true') {
|
|
53
|
+
return { state: 'already_following' };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
followBtn.click();
|
|
57
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
58
|
+
|
|
59
|
+
return ((followBtn.textContent || '').includes('已关注') || followBtn.getAttribute('aria-pressed') === 'true')
|
|
60
|
+
? { state: 'followed' }
|
|
61
|
+
: { state: 'unknown' };
|
|
62
|
+
})()`);
|
|
63
|
+
if (result?.state === 'already_following') {
|
|
64
|
+
return buildResultRow(`Already followed ${target.kind}`, target.kind, rawTarget, 'already_applied');
|
|
65
|
+
}
|
|
66
|
+
if (result?.state === 'ambiguous_question_follow') {
|
|
67
|
+
throw new CliError('ACTION_NOT_AVAILABLE', 'Question follow control was not uniquely anchored on the requested question page');
|
|
68
|
+
}
|
|
69
|
+
if (result?.state === 'ambiguous_user_follow') {
|
|
70
|
+
throw new CliError('ACTION_NOT_AVAILABLE', 'User follow control was not uniquely anchored on the requested profile page');
|
|
71
|
+
}
|
|
72
|
+
if (result?.state === 'missing') {
|
|
73
|
+
throw new CliError('ACTION_FAILED', 'Zhihu follow control was missing before any write was dispatched');
|
|
74
|
+
}
|
|
75
|
+
if (result?.state !== 'followed') {
|
|
76
|
+
throw new CliError('OUTCOME_UNKNOWN', 'Zhihu follow click was dispatched, but the final state could not be verified safely');
|
|
77
|
+
}
|
|
78
|
+
return buildResultRow(`Followed ${target.kind}`, target.kind, rawTarget, 'applied');
|
|
79
|
+
},
|
|
80
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './follow.js';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { getRegistry } from '@jackwener/opencli/registry';
|
|
3
|
+
import './follow.js';
|
|
4
|
+
describe('zhihu follow', () => {
|
|
5
|
+
it('rejects missing --execute before any browser write path', async () => {
|
|
6
|
+
const cmd = getRegistry().get('zhihu/follow');
|
|
7
|
+
expect(cmd?.func).toBeTypeOf('function');
|
|
8
|
+
const page = { goto: vi.fn(), evaluate: vi.fn() };
|
|
9
|
+
await expect(cmd.func(page, { target: 'question:123' })).rejects.toMatchObject({ code: 'INVALID_INPUT' });
|
|
10
|
+
expect(page.goto).not.toHaveBeenCalled();
|
|
11
|
+
expect(page.evaluate).not.toHaveBeenCalled();
|
|
12
|
+
});
|
|
13
|
+
it('rejects user pages where the primary follow control is not uniquely anchored', async () => {
|
|
14
|
+
const cmd = getRegistry().get('zhihu/follow');
|
|
15
|
+
const page = {
|
|
16
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
17
|
+
evaluate: vi.fn().mockResolvedValue({ state: 'ambiguous_user_follow' }),
|
|
18
|
+
};
|
|
19
|
+
await expect(cmd.func(page, { target: 'user:alice', execute: true })).rejects.toMatchObject({
|
|
20
|
+
code: 'ACTION_NOT_AVAILABLE',
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
it('returns already_applied when already following', async () => {
|
|
24
|
+
const cmd = getRegistry().get('zhihu/follow');
|
|
25
|
+
const page = {
|
|
26
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
27
|
+
evaluate: vi.fn().mockResolvedValue({ state: 'already_following' }),
|
|
28
|
+
};
|
|
29
|
+
await expect(cmd.func(page, { target: 'question:123', execute: true })).resolves.toEqual([
|
|
30
|
+
expect.objectContaining({ outcome: 'already_applied', target_type: 'question', target: 'question:123' }),
|
|
31
|
+
]);
|
|
32
|
+
});
|
|
33
|
+
it('rejects question pages where the question follow control is not uniquely anchored', async () => {
|
|
34
|
+
const cmd = getRegistry().get('zhihu/follow');
|
|
35
|
+
const page = {
|
|
36
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
37
|
+
evaluate: vi.fn().mockResolvedValue({ state: 'ambiguous_question_follow' }),
|
|
38
|
+
};
|
|
39
|
+
await expect(cmd.func(page, { target: 'question:123', execute: true })).rejects.toMatchObject({
|
|
40
|
+
code: 'ACTION_NOT_AVAILABLE',
|
|
41
|
+
});
|
|
42
|
+
expect(page.evaluate.mock.calls[0][0]).toContain('QuestionHeader');
|
|
43
|
+
expect(page.evaluate.mock.calls[0][0]).toContain('new Set(');
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { cli } from '@jackwener/opencli/registry';
|
|
2
|
+
cli({
|
|
3
|
+
site: 'zhihu',
|
|
4
|
+
name: 'hot',
|
|
5
|
+
description: '知乎热榜',
|
|
6
|
+
domain: 'www.zhihu.com',
|
|
7
|
+
args: [
|
|
8
|
+
{ name: 'limit', type: 'int', default: 20, help: 'Number of items to return' },
|
|
9
|
+
],
|
|
10
|
+
columns: ['rank', 'title', 'heat', 'answers'],
|
|
11
|
+
pipeline: [
|
|
12
|
+
{ navigate: 'https://www.zhihu.com' },
|
|
13
|
+
{ evaluate: `(async () => {
|
|
14
|
+
const res = await fetch('https://www.zhihu.com/api/v3/feed/topstory/hot-lists/total?limit=50', {
|
|
15
|
+
credentials: 'include'
|
|
16
|
+
});
|
|
17
|
+
const text = await res.text();
|
|
18
|
+
const d = JSON.parse(
|
|
19
|
+
text.replace(/("id"\\s*:\\s*)(\\d{16,})/g, '$1"$2"')
|
|
20
|
+
);
|
|
21
|
+
return (d?.data || []).map((item) => {
|
|
22
|
+
const t = item.target || {};
|
|
23
|
+
const questionId = t.id == null ? '' : String(t.id);
|
|
24
|
+
return {
|
|
25
|
+
title: t.title,
|
|
26
|
+
url: 'https://www.zhihu.com/question/' + questionId,
|
|
27
|
+
answer_count: t.answer_count,
|
|
28
|
+
follower_count: t.follower_count,
|
|
29
|
+
heat: item.detail_text || '',
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
})()
|
|
33
|
+
` },
|
|
34
|
+
{ map: {
|
|
35
|
+
rank: '${{ index + 1 }}',
|
|
36
|
+
title: '${{ item.title }}',
|
|
37
|
+
heat: '${{ item.heat }}',
|
|
38
|
+
answers: '${{ item.answer_count }}',
|
|
39
|
+
url: '${{ item.url }}',
|
|
40
|
+
} },
|
|
41
|
+
{ limit: '${{ args.limit }}' },
|
|
42
|
+
],
|
|
43
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { CliError, CommandExecutionError } from '@jackwener/opencli/errors';
|
|
2
|
+
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
3
|
+
import { assertAllowedKinds, parseTarget } from './target.js';
|
|
4
|
+
import { buildResultRow, requireExecute } from './write-shared.js';
|
|
5
|
+
cli({
|
|
6
|
+
site: 'zhihu',
|
|
7
|
+
name: 'like',
|
|
8
|
+
description: 'Like a Zhihu answer or article',
|
|
9
|
+
domain: 'zhihu.com',
|
|
10
|
+
strategy: Strategy.UI,
|
|
11
|
+
browser: true,
|
|
12
|
+
args: [
|
|
13
|
+
{ name: 'target', positional: true, required: true, help: 'Zhihu target URL or typed target' },
|
|
14
|
+
{ name: 'execute', type: 'boolean', help: 'Actually perform the write action' },
|
|
15
|
+
],
|
|
16
|
+
columns: ['status', 'outcome', 'message', 'target_type', 'target'],
|
|
17
|
+
func: async (page, kwargs) => {
|
|
18
|
+
if (!page)
|
|
19
|
+
throw new CommandExecutionError('Browser session required for zhihu like');
|
|
20
|
+
requireExecute(kwargs);
|
|
21
|
+
const rawTarget = String(kwargs.target);
|
|
22
|
+
const target = assertAllowedKinds('like', parseTarget(rawTarget));
|
|
23
|
+
await page.goto(target.url);
|
|
24
|
+
const result = await page.evaluate(`(async () => {
|
|
25
|
+
const targetKind = ${JSON.stringify(target.kind)};
|
|
26
|
+
const targetQuestionId = ${JSON.stringify(target.kind === 'answer' ? target.questionId : null)};
|
|
27
|
+
const targetAnswerId = ${JSON.stringify(target.kind === 'answer' ? target.id : null)};
|
|
28
|
+
|
|
29
|
+
let btn = null;
|
|
30
|
+
if (targetKind === 'answer') {
|
|
31
|
+
const block = Array.from(document.querySelectorAll('article, .AnswerItem, [data-zop-question-answer]')).find((node) => {
|
|
32
|
+
const dataAnswerId = node.getAttribute('data-answerid') || node.getAttribute('data-zop-question-answer') || '';
|
|
33
|
+
if (dataAnswerId && dataAnswerId.includes(targetAnswerId)) return true;
|
|
34
|
+
return Array.from(node.querySelectorAll('a[href*="/answer/"]')).some((link) => {
|
|
35
|
+
const href = link.getAttribute('href') || '';
|
|
36
|
+
return href.includes('/question/' + targetQuestionId + '/answer/' + targetAnswerId);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
if (!block) return { state: 'wrong_answer' };
|
|
40
|
+
const candidates = Array.from(block?.querySelectorAll('button') || []).filter((node) => {
|
|
41
|
+
const text = (node.textContent || '').trim();
|
|
42
|
+
const inCommentItem = Boolean(node.closest('[data-comment-id], .CommentItem'));
|
|
43
|
+
return /赞同|赞/.test(text) && node.hasAttribute('aria-pressed') && !inCommentItem;
|
|
44
|
+
});
|
|
45
|
+
if (candidates.length !== 1) return { state: 'ambiguous_answer_like' };
|
|
46
|
+
btn = candidates[0];
|
|
47
|
+
} else {
|
|
48
|
+
const articleRoot =
|
|
49
|
+
document.querySelector('article')
|
|
50
|
+
|| document.querySelector('.Post-Main')
|
|
51
|
+
|| document.querySelector('[itemprop="articleBody"]')
|
|
52
|
+
|| document;
|
|
53
|
+
const candidates = Array.from(articleRoot.querySelectorAll('button')).filter((node) => {
|
|
54
|
+
const text = (node.textContent || '').trim();
|
|
55
|
+
return /赞同|赞/.test(text) && node.hasAttribute('aria-pressed');
|
|
56
|
+
});
|
|
57
|
+
if (candidates.length !== 1) return { state: 'ambiguous_article_like' };
|
|
58
|
+
btn = candidates[0];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!btn) return { state: 'missing' };
|
|
62
|
+
if (btn.getAttribute('aria-pressed') === 'true') return { state: 'already_liked' };
|
|
63
|
+
|
|
64
|
+
btn.click();
|
|
65
|
+
await new Promise((resolve) => setTimeout(resolve, 1200));
|
|
66
|
+
|
|
67
|
+
return btn.getAttribute('aria-pressed') === 'true'
|
|
68
|
+
? { state: 'liked' }
|
|
69
|
+
: { state: 'unknown' };
|
|
70
|
+
})()`);
|
|
71
|
+
if (result?.state === 'wrong_answer') {
|
|
72
|
+
throw new CliError('TARGET_NOT_FOUND', 'Resolved answer target no longer matches the requested answer:<questionId>:<answerId>');
|
|
73
|
+
}
|
|
74
|
+
if (result?.state === 'already_liked') {
|
|
75
|
+
return buildResultRow(`Already liked ${target.kind}`, target.kind, rawTarget, 'already_applied');
|
|
76
|
+
}
|
|
77
|
+
if (result?.state === 'ambiguous_answer_like') {
|
|
78
|
+
throw new CliError('ACTION_NOT_AVAILABLE', 'Answer like control was not uniquely anchored on the requested answer');
|
|
79
|
+
}
|
|
80
|
+
if (result?.state === 'ambiguous_article_like') {
|
|
81
|
+
throw new CliError('ACTION_NOT_AVAILABLE', 'Article like control was not uniquely anchored on the requested target');
|
|
82
|
+
}
|
|
83
|
+
if (result?.state === 'missing') {
|
|
84
|
+
throw new CliError('ACTION_FAILED', 'Zhihu like control was missing before any write was dispatched');
|
|
85
|
+
}
|
|
86
|
+
if (result?.state !== 'liked') {
|
|
87
|
+
throw new CliError('OUTCOME_UNKNOWN', 'Zhihu like click was dispatched, but the final state could not be verified safely');
|
|
88
|
+
}
|
|
89
|
+
return buildResultRow(`Liked ${target.kind}`, target.kind, rawTarget, 'applied');
|
|
90
|
+
},
|
|
91
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './like.js';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { getRegistry } from '@jackwener/opencli/registry';
|
|
3
|
+
import './like.js';
|
|
4
|
+
describe('zhihu like', () => {
|
|
5
|
+
it('rejects article pages where the like control is not uniquely anchored', async () => {
|
|
6
|
+
const cmd = getRegistry().get('zhihu/like');
|
|
7
|
+
expect(cmd?.func).toBeTypeOf('function');
|
|
8
|
+
const page = {
|
|
9
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
10
|
+
evaluate: vi.fn().mockResolvedValue({ state: 'ambiguous_article_like' }),
|
|
11
|
+
};
|
|
12
|
+
await expect(cmd.func(page, { target: 'article:9', execute: true })).rejects.toMatchObject({
|
|
13
|
+
code: 'ACTION_NOT_AVAILABLE',
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
it('returns already_applied for an already-liked article target', async () => {
|
|
17
|
+
const cmd = getRegistry().get('zhihu/like');
|
|
18
|
+
const page = {
|
|
19
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
20
|
+
evaluate: vi.fn().mockResolvedValue({ state: 'already_liked' }),
|
|
21
|
+
};
|
|
22
|
+
await expect(cmd.func(page, { target: 'article:9', execute: true })).resolves.toEqual([
|
|
23
|
+
expect.objectContaining({ outcome: 'already_applied', target_type: 'article', target: 'article:9' }),
|
|
24
|
+
]);
|
|
25
|
+
});
|
|
26
|
+
it('anchors to the requested answer block before clicking like', async () => {
|
|
27
|
+
const cmd = getRegistry().get('zhihu/like');
|
|
28
|
+
const page = {
|
|
29
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
30
|
+
evaluate: vi.fn().mockResolvedValue({ state: 'liked' }),
|
|
31
|
+
};
|
|
32
|
+
await expect(cmd.func(page, { target: 'answer:123:456', execute: true })).resolves.toEqual([
|
|
33
|
+
expect.objectContaining({ outcome: 'applied', target_type: 'answer', target: 'answer:123:456' }),
|
|
34
|
+
]);
|
|
35
|
+
expect(page.goto).toHaveBeenCalledWith('https://www.zhihu.com/question/123/answer/456');
|
|
36
|
+
expect(page.evaluate).toHaveBeenCalledTimes(1);
|
|
37
|
+
expect(page.evaluate.mock.calls[0][0]).toContain('targetQuestionId');
|
|
38
|
+
expect(page.evaluate.mock.calls[0][0]).toContain('"123"');
|
|
39
|
+
expect(page.evaluate.mock.calls[0][0]).toContain('"456"');
|
|
40
|
+
expect(page.evaluate.mock.calls[0][0]).toContain("node.getAttribute('data-answerid')");
|
|
41
|
+
expect(page.evaluate.mock.calls[0][0]).toContain("node.getAttribute('data-zop-question-answer')");
|
|
42
|
+
});
|
|
43
|
+
it('rejects answer targets when the answer-level like control is not unique', async () => {
|
|
44
|
+
const cmd = getRegistry().get('zhihu/like');
|
|
45
|
+
const page = {
|
|
46
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
47
|
+
evaluate: vi.fn().mockResolvedValue({ state: 'ambiguous_answer_like' }),
|
|
48
|
+
};
|
|
49
|
+
await expect(cmd.func(page, { target: 'answer:123:456', execute: true })).rejects.toMatchObject({
|
|
50
|
+
code: 'ACTION_NOT_AVAILABLE',
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
it('maps missing answer blocks to TARGET_NOT_FOUND', async () => {
|
|
54
|
+
const cmd = getRegistry().get('zhihu/like');
|
|
55
|
+
const page = {
|
|
56
|
+
goto: vi.fn().mockResolvedValue(undefined),
|
|
57
|
+
evaluate: vi.fn().mockResolvedValue({ state: 'wrong_answer' }),
|
|
58
|
+
};
|
|
59
|
+
await expect(cmd.func(page, { target: 'answer:123:456', execute: true })).rejects.toMatchObject({
|
|
60
|
+
code: 'TARGET_NOT_FOUND',
|
|
61
|
+
});
|
|
62
|
+
expect(page.evaluate.mock.calls[0][0]).toContain("if (!block) return { state: 'wrong_answer' }");
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { cli } from '@jackwener/opencli/registry';
|
|
2
|
+
cli({
|
|
3
|
+
site: 'zhihu',
|
|
4
|
+
name: 'search',
|
|
5
|
+
description: '知乎搜索',
|
|
6
|
+
domain: 'www.zhihu.com',
|
|
7
|
+
args: [
|
|
8
|
+
{ name: 'query', required: true, positional: true, help: 'Search query' },
|
|
9
|
+
{ name: 'limit', type: 'int', default: 10, help: 'Number of results' },
|
|
10
|
+
],
|
|
11
|
+
columns: ['rank', 'title', 'type', 'author', 'votes', 'url'],
|
|
12
|
+
pipeline: [
|
|
13
|
+
{ navigate: 'https://www.zhihu.com' },
|
|
14
|
+
{ evaluate: `(async () => {
|
|
15
|
+
const strip = (html) => (html || '').replace(/<[^>]+>/g, '').replace(/ /g, ' ').replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&').replace(/<em>/g, '').replace(/<\\/em>/g, '').trim();
|
|
16
|
+
const keyword = \${{ args.query | json }};
|
|
17
|
+
const limit = \${{ args.limit }};
|
|
18
|
+
const res = await fetch('https://www.zhihu.com/api/v4/search_v3?q=' + encodeURIComponent(keyword) + '&t=general&offset=0&limit=' + limit, {
|
|
19
|
+
credentials: 'include'
|
|
20
|
+
});
|
|
21
|
+
const d = await res.json();
|
|
22
|
+
return (d?.data || [])
|
|
23
|
+
.filter(item => item.type === 'search_result')
|
|
24
|
+
.map(item => {
|
|
25
|
+
const obj = item.object || {};
|
|
26
|
+
const q = obj.question || {};
|
|
27
|
+
return {
|
|
28
|
+
type: obj.type,
|
|
29
|
+
title: strip(obj.title || q.name || ''),
|
|
30
|
+
excerpt: strip(obj.excerpt || '').substring(0, 100),
|
|
31
|
+
author: obj.author?.name || '',
|
|
32
|
+
votes: obj.voteup_count || 0,
|
|
33
|
+
url: obj.type === 'answer'
|
|
34
|
+
? 'https://www.zhihu.com/question/' + q.id + '/answer/' + obj.id
|
|
35
|
+
: obj.type === 'article'
|
|
36
|
+
? 'https://zhuanlan.zhihu.com/p/' + obj.id
|
|
37
|
+
: 'https://www.zhihu.com/question/' + obj.id,
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
})()
|
|
41
|
+
` },
|
|
42
|
+
{ map: {
|
|
43
|
+
rank: '${{ index + 1 }}',
|
|
44
|
+
title: '${{ item.title }}',
|
|
45
|
+
type: '${{ item.type }}',
|
|
46
|
+
author: '${{ item.author }}',
|
|
47
|
+
votes: '${{ item.votes }}',
|
|
48
|
+
url: '${{ item.url }}',
|
|
49
|
+
} },
|
|
50
|
+
{ limit: '${{ args.limit }}' },
|
|
51
|
+
],
|
|
52
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type ZhihuTarget = {
|
|
2
|
+
kind: 'user';
|
|
3
|
+
slug: string;
|
|
4
|
+
url: string;
|
|
5
|
+
} | {
|
|
6
|
+
kind: 'question';
|
|
7
|
+
id: string;
|
|
8
|
+
url: string;
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'answer';
|
|
11
|
+
questionId: string;
|
|
12
|
+
id: string;
|
|
13
|
+
url: string;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'article';
|
|
16
|
+
id: string;
|
|
17
|
+
url: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function parseTarget(input: string): ZhihuTarget;
|
|
20
|
+
export declare function assertAllowedKinds(command: string, target: ZhihuTarget): ZhihuTarget;
|
|
21
|
+
export declare const __test__: {
|
|
22
|
+
parseTarget: typeof parseTarget;
|
|
23
|
+
assertAllowedKinds: typeof assertAllowedKinds;
|
|
24
|
+
};
|