@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,567 @@
|
|
|
1
|
+
import { CliError } from '@jackwener/opencli/errors';
|
|
2
|
+
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
3
|
+
import { isRecord } from '@jackwener/opencli/utils';
|
|
4
|
+
const GITEE_EXPLORE_URL = 'https://gitee.com/explore';
|
|
5
|
+
const MAX_LIMIT = 50;
|
|
6
|
+
const MAX_DESCRIPTION_LENGTH = 48;
|
|
7
|
+
const GITEE_HOSTS = new Set(['gitee.com', 'www.gitee.com']);
|
|
8
|
+
const RESERVED_SEGMENTS = new Set([
|
|
9
|
+
'about',
|
|
10
|
+
'account',
|
|
11
|
+
'ai',
|
|
12
|
+
'all',
|
|
13
|
+
'api',
|
|
14
|
+
'apps',
|
|
15
|
+
'blog',
|
|
16
|
+
'contact',
|
|
17
|
+
'dashboard',
|
|
18
|
+
'docs',
|
|
19
|
+
'enterprise',
|
|
20
|
+
'enterprises',
|
|
21
|
+
'explore',
|
|
22
|
+
'features',
|
|
23
|
+
'help',
|
|
24
|
+
'issues',
|
|
25
|
+
'login',
|
|
26
|
+
'marketplace',
|
|
27
|
+
'organizations',
|
|
28
|
+
'pricing',
|
|
29
|
+
'pulls',
|
|
30
|
+
'security',
|
|
31
|
+
'settings',
|
|
32
|
+
'signup',
|
|
33
|
+
'sitemap',
|
|
34
|
+
'stars',
|
|
35
|
+
'support',
|
|
36
|
+
'terms',
|
|
37
|
+
'users',
|
|
38
|
+
]);
|
|
39
|
+
const STAR_KEYS = [
|
|
40
|
+
'stars',
|
|
41
|
+
'star',
|
|
42
|
+
'stars_count',
|
|
43
|
+
'star_count',
|
|
44
|
+
'stargazers_count',
|
|
45
|
+
'stargazer_count',
|
|
46
|
+
'watch_count',
|
|
47
|
+
'watchers_count',
|
|
48
|
+
];
|
|
49
|
+
function normalizeWhitespace(value) {
|
|
50
|
+
return value.replace(/\s+/g, ' ').trim();
|
|
51
|
+
}
|
|
52
|
+
function normalizeStars(value) {
|
|
53
|
+
const compact = normalizeWhitespace(value).replace(/\s+/g, '');
|
|
54
|
+
if (!compact)
|
|
55
|
+
return '-';
|
|
56
|
+
const match = compact.match(/\d+(?:[.,]\d+)?(?:[kKmMwW]|\u4E07)?/);
|
|
57
|
+
return match ? match[0] : compact;
|
|
58
|
+
}
|
|
59
|
+
function compactDescription(value) {
|
|
60
|
+
const normalized = normalizeWhitespace(value);
|
|
61
|
+
if (!normalized || normalized === '-')
|
|
62
|
+
return '-';
|
|
63
|
+
if (normalized.length <= MAX_DESCRIPTION_LENGTH)
|
|
64
|
+
return normalized;
|
|
65
|
+
return `${normalized.slice(0, MAX_DESCRIPTION_LENGTH - 3)}...`;
|
|
66
|
+
}
|
|
67
|
+
function clampLimit(value) {
|
|
68
|
+
const parsed = Number(value);
|
|
69
|
+
if (Number.isNaN(parsed))
|
|
70
|
+
return 20;
|
|
71
|
+
return Math.max(1, Math.min(parsed, MAX_LIMIT));
|
|
72
|
+
}
|
|
73
|
+
function normalizeRepoUrl(value) {
|
|
74
|
+
try {
|
|
75
|
+
const parsed = new URL(value, 'https://gitee.com');
|
|
76
|
+
if (!GITEE_HOSTS.has(parsed.hostname.toLowerCase()))
|
|
77
|
+
return null;
|
|
78
|
+
const parts = parsed.pathname.split('/').filter(Boolean);
|
|
79
|
+
if (parts.length !== 2)
|
|
80
|
+
return null;
|
|
81
|
+
const owner = parts[0];
|
|
82
|
+
const repo = parts[1];
|
|
83
|
+
if (RESERVED_SEGMENTS.has(owner.toLowerCase()) || RESERVED_SEGMENTS.has(repo.toLowerCase()))
|
|
84
|
+
return null;
|
|
85
|
+
return `https://gitee.com/${owner}/${repo}`;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function repoUrlFromPath(value) {
|
|
92
|
+
const compact = value.trim().replace(/^\/+|\/+$/g, '');
|
|
93
|
+
if (!compact.includes('/'))
|
|
94
|
+
return null;
|
|
95
|
+
return normalizeRepoUrl(`https://gitee.com/${compact}`);
|
|
96
|
+
}
|
|
97
|
+
function toCaptureProject(record) {
|
|
98
|
+
const urlCandidates = [];
|
|
99
|
+
const pushUrlCandidate = (raw) => {
|
|
100
|
+
if (typeof raw !== 'string')
|
|
101
|
+
return;
|
|
102
|
+
const normalized = normalizeRepoUrl(raw) ?? repoUrlFromPath(raw);
|
|
103
|
+
if (normalized)
|
|
104
|
+
urlCandidates.push(normalized);
|
|
105
|
+
};
|
|
106
|
+
pushUrlCandidate(record.url);
|
|
107
|
+
pushUrlCandidate(record.html_url);
|
|
108
|
+
pushUrlCandidate(record.project_url);
|
|
109
|
+
pushUrlCandidate(record.web_url);
|
|
110
|
+
pushUrlCandidate(record.path_with_namespace);
|
|
111
|
+
pushUrlCandidate(record.name_with_namespace);
|
|
112
|
+
pushUrlCandidate(record.full_name);
|
|
113
|
+
pushUrlCandidate(record.fullName);
|
|
114
|
+
pushUrlCandidate(record.path);
|
|
115
|
+
const url = urlCandidates[0];
|
|
116
|
+
if (!url)
|
|
117
|
+
return null;
|
|
118
|
+
let name = '';
|
|
119
|
+
const nameCandidate = [
|
|
120
|
+
record.name_with_namespace,
|
|
121
|
+
record.full_name,
|
|
122
|
+
record.fullName,
|
|
123
|
+
record.path_with_namespace,
|
|
124
|
+
record.name,
|
|
125
|
+
].find((value) => typeof value === 'string' && value.trim());
|
|
126
|
+
if (typeof nameCandidate === 'string') {
|
|
127
|
+
name = normalizeWhitespace(nameCandidate.replace(/\s*\/\s*/g, '/'));
|
|
128
|
+
}
|
|
129
|
+
let description = '';
|
|
130
|
+
const descCandidate = [
|
|
131
|
+
record.description,
|
|
132
|
+
record.desc,
|
|
133
|
+
record.summary,
|
|
134
|
+
record.project_description,
|
|
135
|
+
record.intro,
|
|
136
|
+
record.tagline,
|
|
137
|
+
].find((value) => typeof value === 'string' && value.trim());
|
|
138
|
+
if (typeof descCandidate === 'string') {
|
|
139
|
+
description = normalizeWhitespace(descCandidate);
|
|
140
|
+
}
|
|
141
|
+
let stars = '';
|
|
142
|
+
for (const key of STAR_KEYS) {
|
|
143
|
+
const value = record[key];
|
|
144
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
145
|
+
stars = String(value);
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
if (typeof value === 'string' && value.trim()) {
|
|
149
|
+
stars = value;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
url,
|
|
155
|
+
name: name || undefined,
|
|
156
|
+
description: description || undefined,
|
|
157
|
+
stars: stars ? normalizeStars(stars) : undefined,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function tryParseJson(raw) {
|
|
161
|
+
const text = raw.trim();
|
|
162
|
+
if (!text || (!text.startsWith('{') && !text.startsWith('[')))
|
|
163
|
+
return null;
|
|
164
|
+
try {
|
|
165
|
+
return JSON.parse(text);
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
const lastBrace = Math.max(text.lastIndexOf('}'), text.lastIndexOf(']'));
|
|
169
|
+
if (lastBrace <= 0)
|
|
170
|
+
return null;
|
|
171
|
+
const clipped = text.slice(0, lastBrace + 1);
|
|
172
|
+
try {
|
|
173
|
+
return JSON.parse(clipped);
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function parseCaptureBody(entry) {
|
|
181
|
+
if (!isRecord(entry))
|
|
182
|
+
return null;
|
|
183
|
+
const preview = typeof entry.responsePreview === 'string' ? entry.responsePreview : '';
|
|
184
|
+
if (!preview || preview.startsWith('base64:'))
|
|
185
|
+
return null;
|
|
186
|
+
const contentType = typeof entry.responseContentType === 'string'
|
|
187
|
+
? entry.responseContentType.toLowerCase()
|
|
188
|
+
: '';
|
|
189
|
+
if (contentType && !contentType.includes('json') && !contentType.includes('javascript') && !contentType.includes('text')) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
return tryParseJson(preview);
|
|
193
|
+
}
|
|
194
|
+
function choosePreferredText(current, incoming) {
|
|
195
|
+
if (!incoming || incoming === '-')
|
|
196
|
+
return current;
|
|
197
|
+
if (!current || current === '-')
|
|
198
|
+
return incoming;
|
|
199
|
+
return incoming.length > current.length ? incoming : current;
|
|
200
|
+
}
|
|
201
|
+
function collectProjectsFromUnknown(value, out, seen, depth) {
|
|
202
|
+
if (depth > 8 || value === null || value === undefined || typeof value !== 'object')
|
|
203
|
+
return;
|
|
204
|
+
if (seen.has(value))
|
|
205
|
+
return;
|
|
206
|
+
seen.add(value);
|
|
207
|
+
if (Array.isArray(value)) {
|
|
208
|
+
for (const item of value) {
|
|
209
|
+
collectProjectsFromUnknown(item, out, seen, depth + 1);
|
|
210
|
+
}
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const record = value;
|
|
214
|
+
const candidate = toCaptureProject(record);
|
|
215
|
+
if (candidate) {
|
|
216
|
+
const previous = out.get(candidate.url);
|
|
217
|
+
if (!previous) {
|
|
218
|
+
out.set(candidate.url, candidate);
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
out.set(candidate.url, {
|
|
222
|
+
url: candidate.url,
|
|
223
|
+
name: choosePreferredText(previous.name, candidate.name),
|
|
224
|
+
description: choosePreferredText(previous.description, candidate.description),
|
|
225
|
+
stars: previous.stars && previous.stars !== '-' ? previous.stars : candidate.stars,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
for (const child of Object.values(record)) {
|
|
230
|
+
collectProjectsFromUnknown(child, out, seen, depth + 1);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function collectProjectsFromCapture(entries) {
|
|
234
|
+
const collected = new Map();
|
|
235
|
+
const seen = new Set();
|
|
236
|
+
for (const entry of entries) {
|
|
237
|
+
const body = parseCaptureBody(entry);
|
|
238
|
+
if (body !== null) {
|
|
239
|
+
collectProjectsFromUnknown(body, collected, seen, 0);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return collected;
|
|
243
|
+
}
|
|
244
|
+
function toProject(value) {
|
|
245
|
+
if (!value || typeof value !== 'object')
|
|
246
|
+
return null;
|
|
247
|
+
const row = value;
|
|
248
|
+
const name = typeof row.name === 'string' ? normalizeWhitespace(row.name) : '';
|
|
249
|
+
const urlRaw = typeof row.url === 'string' ? row.url.trim() : '';
|
|
250
|
+
const url = normalizeRepoUrl(urlRaw);
|
|
251
|
+
if (!name || !url)
|
|
252
|
+
return null;
|
|
253
|
+
const description = typeof row.description === 'string'
|
|
254
|
+
? normalizeWhitespace(row.description)
|
|
255
|
+
: '';
|
|
256
|
+
const stars = typeof row.stars === 'string' ? normalizeStars(row.stars) : '-';
|
|
257
|
+
return {
|
|
258
|
+
name,
|
|
259
|
+
description: description || '-',
|
|
260
|
+
stars,
|
|
261
|
+
url,
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
function mergeCapturedProject(project, captured) {
|
|
265
|
+
if (!captured)
|
|
266
|
+
return project;
|
|
267
|
+
const mergedName = captured.name ? normalizeWhitespace(captured.name) : '';
|
|
268
|
+
const mergedDescription = captured.description ? normalizeWhitespace(captured.description) : '';
|
|
269
|
+
const mergedStars = captured.stars ? normalizeStars(captured.stars) : '-';
|
|
270
|
+
return {
|
|
271
|
+
name: mergedName && mergedName.length <= 120 ? mergedName : project.name,
|
|
272
|
+
description: project.description !== '-' ? project.description : (mergedDescription || '-'),
|
|
273
|
+
stars: project.stars !== '-' ? project.stars : mergedStars,
|
|
274
|
+
url: project.url,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
cli({
|
|
278
|
+
site: 'gitee',
|
|
279
|
+
name: 'trending',
|
|
280
|
+
description: 'Recommended open-source projects on Gitee Explore',
|
|
281
|
+
domain: 'gitee.com',
|
|
282
|
+
strategy: Strategy.PUBLIC,
|
|
283
|
+
browser: true,
|
|
284
|
+
args: [
|
|
285
|
+
{ name: 'limit', type: 'int', default: 20, help: 'Number of projects (max 50)' },
|
|
286
|
+
],
|
|
287
|
+
columns: ['name', 'description', 'stars', 'url'],
|
|
288
|
+
func: async (page, args) => {
|
|
289
|
+
const limit = clampLimit(args.limit);
|
|
290
|
+
let projectsFromCapture = new Map();
|
|
291
|
+
if (page.startNetworkCapture) {
|
|
292
|
+
try {
|
|
293
|
+
await page.startNetworkCapture('gitee.com');
|
|
294
|
+
}
|
|
295
|
+
catch {
|
|
296
|
+
// best-effort enrichment path
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
await page.goto(GITEE_EXPLORE_URL);
|
|
300
|
+
await page.wait(3);
|
|
301
|
+
if (page.readNetworkCapture) {
|
|
302
|
+
try {
|
|
303
|
+
const captureEntries = await page.readNetworkCapture();
|
|
304
|
+
projectsFromCapture = collectProjectsFromCapture(captureEntries);
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
// best-effort enrichment path
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
const rawProjects = await page.evaluate(`
|
|
311
|
+
(() => {
|
|
312
|
+
const RESERVED = new Set([
|
|
313
|
+
'about',
|
|
314
|
+
'account',
|
|
315
|
+
'ai',
|
|
316
|
+
'all',
|
|
317
|
+
'api',
|
|
318
|
+
'apps',
|
|
319
|
+
'blog',
|
|
320
|
+
'contact',
|
|
321
|
+
'dashboard',
|
|
322
|
+
'docs',
|
|
323
|
+
'enterprise',
|
|
324
|
+
'enterprises',
|
|
325
|
+
'explore',
|
|
326
|
+
'features',
|
|
327
|
+
'help',
|
|
328
|
+
'issues',
|
|
329
|
+
'login',
|
|
330
|
+
'marketplace',
|
|
331
|
+
'organizations',
|
|
332
|
+
'pricing',
|
|
333
|
+
'pulls',
|
|
334
|
+
'security',
|
|
335
|
+
'settings',
|
|
336
|
+
'signup',
|
|
337
|
+
'sitemap',
|
|
338
|
+
'stars',
|
|
339
|
+
'support',
|
|
340
|
+
'terms',
|
|
341
|
+
'users',
|
|
342
|
+
]);
|
|
343
|
+
|
|
344
|
+
const KEYWORDS = [
|
|
345
|
+
'\\u63A8\\u8350\\u5F00\\u6E90\\u9879\\u76EE',
|
|
346
|
+
'\\u63A8\\u8350\\u9879\\u76EE',
|
|
347
|
+
'\\u63A8\\u8350\\u4ED3\\u5E93',
|
|
348
|
+
'Recommended Projects',
|
|
349
|
+
];
|
|
350
|
+
const STAR_TOKEN = /(\\d+(?:[.,]\\d+)?(?:\\s*[kKmMwW\\u4E07])?)/;
|
|
351
|
+
|
|
352
|
+
const normalize = (value) => (value || '').replace(/\\s+/g, ' ').trim();
|
|
353
|
+
|
|
354
|
+
const toRepoUrl = (href) => {
|
|
355
|
+
if (!href) return '';
|
|
356
|
+
try {
|
|
357
|
+
const url = new URL(href, location.origin);
|
|
358
|
+
if (url.origin !== location.origin) return '';
|
|
359
|
+
|
|
360
|
+
const parts = url.pathname.split('/').filter(Boolean);
|
|
361
|
+
if (parts.length !== 2) return '';
|
|
362
|
+
|
|
363
|
+
const owner = parts[0].toLowerCase();
|
|
364
|
+
const repo = parts[1].toLowerCase();
|
|
365
|
+
if (RESERVED.has(owner) || RESERVED.has(repo)) return '';
|
|
366
|
+
|
|
367
|
+
return url.origin + '/' + parts[0] + '/' + parts[1];
|
|
368
|
+
} catch {
|
|
369
|
+
return '';
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
const scoreCard = (node) => {
|
|
374
|
+
const text = normalize(node.textContent || '');
|
|
375
|
+
const linkCount = node.querySelectorAll('a[href]').length;
|
|
376
|
+
if (!text || linkCount > 45) return -Infinity;
|
|
377
|
+
|
|
378
|
+
const hasDesc = !!node.querySelector('.project-desc, .project-description, .description, .desc, [class*="desc"], [class*="intro"], [class*="summary"], p');
|
|
379
|
+
const hasMetric = !!node.querySelector('a[href*="stargazers"], a[href*="stars"], [class*="star"], [class*="collect"], [class*="watch"], [aria-label*="star" i], [title*="star" i]');
|
|
380
|
+
let score = Math.min(text.length, 1200) - linkCount * 6;
|
|
381
|
+
if (hasDesc) score += 260;
|
|
382
|
+
if (hasMetric) score += 360;
|
|
383
|
+
if (/(?:stars?|star|stargazers?|\\u6536\\u85CF|\\u5173\\u6CE8|\\u70B9\\u8D5E|★|⭐)/i.test(text)) score += 220;
|
|
384
|
+
return score;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
const pickCard = (link) => {
|
|
388
|
+
let best = link;
|
|
389
|
+
let bestScore = scoreCard(link);
|
|
390
|
+
let node = link;
|
|
391
|
+
for (let i = 0; i < 7 && node.parentElement; i++) {
|
|
392
|
+
node = node.parentElement;
|
|
393
|
+
const score = scoreCard(node);
|
|
394
|
+
if (score > bestScore) {
|
|
395
|
+
best = node;
|
|
396
|
+
bestScore = score;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return best;
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
const extractStars = (card) => {
|
|
403
|
+
const classToken = /(star|stargazer|collect|watch)/i;
|
|
404
|
+
const metricNodes = card.querySelectorAll(
|
|
405
|
+
'a[href*="stargazers"], a[href*="stars"], [class*="star"], [class*="collect"], [class*="watch"], [aria-label*="star" i], [title*="star" i], span, strong, small, em, div'
|
|
406
|
+
);
|
|
407
|
+
for (const node of metricNodes) {
|
|
408
|
+
const className = String(node.className || '');
|
|
409
|
+
const raw = normalize([
|
|
410
|
+
node.textContent || '',
|
|
411
|
+
node.getAttribute?.('title') || '',
|
|
412
|
+
node.getAttribute?.('aria-label') || '',
|
|
413
|
+
node.nextElementSibling?.textContent || '',
|
|
414
|
+
].join(' '));
|
|
415
|
+
if (!raw) continue;
|
|
416
|
+
if (!/(?:stars?|star|stargazers?|\\u6536\\u85CF|\\u5173\\u6CE8|\\u70B9\\u8D5E|★|⭐)/i.test(raw) && !classToken.test(className)) continue;
|
|
417
|
+
const match = raw.match(STAR_TOKEN);
|
|
418
|
+
if (match) return match[1].replace(/\\s+/g, '');
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
const directStar = card.querySelector(
|
|
422
|
+
'.project-stars-count-box .stars-count, .stars-count, [class*="stars-count"], [class*="starsCount"]'
|
|
423
|
+
);
|
|
424
|
+
const directStarText = normalize(directStar?.textContent || '');
|
|
425
|
+
const directMatch = directStarText.match(STAR_TOKEN);
|
|
426
|
+
if (directMatch) return directMatch[1].replace(/\\s+/g, '');
|
|
427
|
+
|
|
428
|
+
const text = normalize(card.textContent || '');
|
|
429
|
+
const patterns = [
|
|
430
|
+
/(?:stars?|star|stargazers?|\\u6536\\u85CF|\\u5173\\u6CE8|\\u70B9\\u8D5E)\\s*[::]?\\s*(\\d+(?:[.,]\\d+)?(?:\\s*[kKmMwW\\u4E07])?)/i,
|
|
431
|
+
/(\\d+(?:[.,]\\d+)?(?:\\s*[kKmMwW\\u4E07])?)\\s*(?:stars?|star|stargazers?|\\u6536\\u85CF|\\u5173\\u6CE8|\\u70B9\\u8D5E)/i,
|
|
432
|
+
/[★⭐]\\s*(\\d+(?:[.,]\\d+)?(?:\\s*[kKmMwW\\u4E07])?)/,
|
|
433
|
+
];
|
|
434
|
+
|
|
435
|
+
for (const pattern of patterns) {
|
|
436
|
+
const match = text.match(pattern);
|
|
437
|
+
if (match) return match[1].replace(/\\s+/g, '');
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
return '';
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
const pickDescription = (card, name) => {
|
|
444
|
+
const directNodes = Array.from(
|
|
445
|
+
card.querySelectorAll('.project-desc, .project-description, .description, .desc, [class*="description"], [class*="desc"], [class*="intro"], [class*="summary"], p')
|
|
446
|
+
);
|
|
447
|
+
|
|
448
|
+
const seen = new Set();
|
|
449
|
+
const candidates = [];
|
|
450
|
+
for (const node of directNodes) {
|
|
451
|
+
const textCandidates = [
|
|
452
|
+
node.textContent || '',
|
|
453
|
+
node.getAttribute?.('title') || '',
|
|
454
|
+
node.getAttribute?.('aria-label') || '',
|
|
455
|
+
].map((value) => normalize(value || '')).filter(Boolean);
|
|
456
|
+
|
|
457
|
+
for (const text of textCandidates) {
|
|
458
|
+
if (!text || text === name || seen.has(text)) continue;
|
|
459
|
+
if (text.length < 6 || text.length > 320) continue;
|
|
460
|
+
if (/^(?:stars?|star|fork|issues?|\\u6536\\u85CF|\\u5173\\u6CE8|\\u70B9\\u8D5E|\\d+(?:[.,]\\d+)?)$/i.test(text)) continue;
|
|
461
|
+
seen.add(text);
|
|
462
|
+
candidates.push(text);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
if (candidates.length > 0) {
|
|
466
|
+
candidates.sort((left, right) => right.length - left.length);
|
|
467
|
+
return candidates[0];
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
const text = normalize(card.textContent || '')
|
|
471
|
+
.replace(/window\\.gon\\._errorText\\s*=\\s*\"[^\"]*\"/g, '');
|
|
472
|
+
if (!text) return '-';
|
|
473
|
+
const cleaned = text
|
|
474
|
+
.replace(name, '')
|
|
475
|
+
.replace(/(?:stars?|star|stargazers?|fork|issues?|\\u6536\\u85CF|\\u5173\\u6CE8|\\u70B9\\u8D5E)\\s*[::]?\\s*\\d+(?:[.,]\\d+)?(?:\\s*[kKmMwW\\u4E07])?/ig, '')
|
|
476
|
+
.replace(/\\d+(?:[.,]\\d+)?(?:\\s*[kKmMwW\\u4E07])?\\s*(?:stars?|star|stargazers?|\\u6536\\u85CF|\\u5173\\u6CE8|\\u70B9\\u8D5E)/ig, '')
|
|
477
|
+
.replace(/\\|\\s*\\d+\\s*(?:\\u79D2\\u524D|\\u5206\\u949F\\u524D|\\u5C0F\\u65F6\\u524D|\\u5929\\u524D)/g, '')
|
|
478
|
+
.replace(/\\s+/g, ' ')
|
|
479
|
+
.trim();
|
|
480
|
+
return cleaned ? cleaned.slice(0, 300) : '-';
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
const countRepoLinks = (root) => {
|
|
484
|
+
const links = root.querySelectorAll('a[href]');
|
|
485
|
+
let count = 0;
|
|
486
|
+
for (const link of links) {
|
|
487
|
+
if (toRepoUrl(link.getAttribute('href') || '')) count++;
|
|
488
|
+
}
|
|
489
|
+
return count;
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
let root = document;
|
|
493
|
+
const headingNodes = Array.from(document.querySelectorAll('h1, h2, h3, h4, h5, div, span'))
|
|
494
|
+
.filter((node) => {
|
|
495
|
+
const text = normalize(node.textContent || '');
|
|
496
|
+
if (!text || text.length > 20) return false;
|
|
497
|
+
return KEYWORDS.some((keyword) => text.includes(keyword));
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
let bestCount = 0;
|
|
501
|
+
for (const heading of headingNodes) {
|
|
502
|
+
let candidate = heading;
|
|
503
|
+
for (let i = 0; i < 4 && candidate.parentElement; i++) {
|
|
504
|
+
candidate = candidate.parentElement;
|
|
505
|
+
const count = countRepoLinks(candidate);
|
|
506
|
+
if (count > bestCount) {
|
|
507
|
+
bestCount = count;
|
|
508
|
+
root = candidate;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
const seen = new Set();
|
|
514
|
+
const projects = [];
|
|
515
|
+
const collect = (scope) => {
|
|
516
|
+
const links = scope.querySelectorAll('a[href]');
|
|
517
|
+
for (const link of links) {
|
|
518
|
+
const url = toRepoUrl(link.getAttribute('href') || '');
|
|
519
|
+
if (!url || seen.has(url)) continue;
|
|
520
|
+
|
|
521
|
+
const card = pickCard(link);
|
|
522
|
+
const titleAttr = normalize(link.getAttribute('title') || '');
|
|
523
|
+
const nameText = normalize(link.textContent || '');
|
|
524
|
+
const pathParts = new URL(url).pathname.split('/').filter(Boolean);
|
|
525
|
+
const fallbackName = pathParts.join('/');
|
|
526
|
+
const nameCandidate = titleAttr || nameText;
|
|
527
|
+
const name = (nameCandidate && nameCandidate.length <= 120
|
|
528
|
+
? nameCandidate.replace(/\\s*\\/\\s*/g, '/')
|
|
529
|
+
: fallbackName) || fallbackName;
|
|
530
|
+
if (!name) continue;
|
|
531
|
+
|
|
532
|
+
projects.push({
|
|
533
|
+
name,
|
|
534
|
+
description: pickDescription(card, name),
|
|
535
|
+
stars: extractStars(card),
|
|
536
|
+
url,
|
|
537
|
+
});
|
|
538
|
+
seen.add(url);
|
|
539
|
+
}
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
collect(root);
|
|
543
|
+
if (projects.length < 8 && root !== document) {
|
|
544
|
+
collect(document);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
return projects;
|
|
548
|
+
})()
|
|
549
|
+
`);
|
|
550
|
+
if (!Array.isArray(rawProjects)) {
|
|
551
|
+
throw new CliError('FETCH_ERROR', 'Failed to parse Gitee Explore page', 'Gitee may have changed its page structure');
|
|
552
|
+
}
|
|
553
|
+
const projects = rawProjects
|
|
554
|
+
.map(toProject)
|
|
555
|
+
.filter((project) => project !== null)
|
|
556
|
+
.map((project) => mergeCapturedProject(project, projectsFromCapture.get(project.url)))
|
|
557
|
+
.map((project) => ({
|
|
558
|
+
...project,
|
|
559
|
+
description: compactDescription(project.description),
|
|
560
|
+
}))
|
|
561
|
+
.slice(0, limit);
|
|
562
|
+
if (projects.length === 0) {
|
|
563
|
+
throw new CliError('NOT_FOUND', 'No recommended projects found on Gitee Explore', 'Gitee may be blocking this request or the page structure changed');
|
|
564
|
+
}
|
|
565
|
+
return projects;
|
|
566
|
+
},
|
|
567
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|