@jackwener/opencli 1.6.9 → 1.7.0

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.
Files changed (531) hide show
  1. package/README.md +128 -59
  2. package/README.zh-CN.md +134 -78
  3. package/dist/clis/_shared/common.d.ts +3 -0
  4. package/dist/clis/_shared/common.js +22 -0
  5. package/dist/clis/bilibili/hot.js +35 -0
  6. package/dist/clis/bluesky/feeds.d.ts +1 -0
  7. package/dist/clis/bluesky/feeds.js +27 -0
  8. package/dist/clis/bluesky/followers.d.ts +1 -0
  9. package/dist/clis/bluesky/followers.js +27 -0
  10. package/dist/clis/bluesky/following.d.ts +1 -0
  11. package/dist/clis/bluesky/following.js +27 -0
  12. package/dist/clis/bluesky/profile.d.ts +1 -0
  13. package/dist/clis/bluesky/profile.js +29 -0
  14. package/dist/clis/bluesky/search.d.ts +1 -0
  15. package/dist/clis/bluesky/search.js +28 -0
  16. package/dist/clis/bluesky/starter-packs.d.ts +1 -0
  17. package/dist/clis/bluesky/starter-packs.js +28 -0
  18. package/dist/clis/bluesky/thread.d.ts +1 -0
  19. package/dist/clis/bluesky/thread.js +30 -0
  20. package/dist/clis/bluesky/trending.d.ts +1 -0
  21. package/dist/clis/bluesky/trending.js +19 -0
  22. package/dist/clis/bluesky/user.d.ts +1 -0
  23. package/dist/clis/bluesky/user.js +33 -0
  24. package/dist/clis/cnki/search.d.ts +1 -0
  25. package/dist/clis/cnki/search.js +60 -0
  26. package/dist/clis/cnki/search.test.d.ts +1 -0
  27. package/dist/clis/cnki/search.test.js +18 -0
  28. package/dist/clis/devto/tag.d.ts +1 -0
  29. package/dist/clis/devto/tag.js +32 -0
  30. package/dist/clis/devto/top.d.ts +1 -0
  31. package/dist/clis/devto/top.js +26 -0
  32. package/dist/clis/devto/user.d.ts +1 -0
  33. package/dist/clis/devto/user.js +31 -0
  34. package/dist/clis/dictionary/examples.d.ts +1 -0
  35. package/dist/clis/dictionary/examples.js +27 -0
  36. package/dist/clis/dictionary/search.d.ts +1 -0
  37. package/dist/clis/dictionary/search.js +29 -0
  38. package/dist/clis/dictionary/synonyms.d.ts +1 -0
  39. package/dist/clis/dictionary/synonyms.js +27 -0
  40. package/dist/clis/douban/subject.d.ts +1 -0
  41. package/dist/clis/douban/subject.js +118 -0
  42. package/dist/clis/douban/top250.d.ts +1 -0
  43. package/dist/clis/douban/top250.js +67 -0
  44. package/dist/clis/facebook/add-friend.d.ts +1 -0
  45. package/dist/clis/facebook/add-friend.js +43 -0
  46. package/dist/clis/facebook/events.d.ts +1 -0
  47. package/dist/clis/facebook/events.js +40 -0
  48. package/dist/clis/facebook/feed.d.ts +1 -0
  49. package/dist/clis/facebook/feed.js +59 -0
  50. package/dist/clis/facebook/friends.d.ts +1 -0
  51. package/dist/clis/facebook/friends.js +38 -0
  52. package/dist/clis/facebook/groups.d.ts +1 -0
  53. package/dist/clis/facebook/groups.js +46 -0
  54. package/dist/clis/facebook/join-group.d.ts +1 -0
  55. package/dist/clis/facebook/join-group.js +44 -0
  56. package/dist/clis/facebook/memories.d.ts +1 -0
  57. package/dist/clis/facebook/memories.js +35 -0
  58. package/dist/clis/facebook/notifications.d.ts +1 -0
  59. package/dist/clis/facebook/notifications.js +36 -0
  60. package/dist/clis/facebook/profile.d.ts +1 -0
  61. package/dist/clis/facebook/profile.js +37 -0
  62. package/dist/clis/facebook/search.d.ts +1 -0
  63. package/dist/clis/facebook/search.js +38 -0
  64. package/dist/clis/facebook/search.test.d.ts +1 -1
  65. package/dist/clis/facebook/search.test.js +6 -9
  66. package/dist/clis/gitee/index.d.ts +3 -0
  67. package/dist/clis/gitee/index.js +3 -0
  68. package/dist/clis/gitee/search.d.ts +1 -0
  69. package/dist/clis/gitee/search.js +136 -0
  70. package/dist/clis/gitee/trending.d.ts +1 -0
  71. package/dist/clis/gitee/trending.js +567 -0
  72. package/dist/clis/gitee/user.d.ts +1 -0
  73. package/dist/clis/gitee/user.js +199 -0
  74. package/dist/clis/gitee/user.test.d.ts +1 -0
  75. package/dist/clis/gitee/user.test.js +63 -0
  76. package/dist/clis/hackernews/ask.d.ts +1 -0
  77. package/dist/clis/hackernews/ask.js +29 -0
  78. package/dist/clis/hackernews/best.d.ts +1 -0
  79. package/dist/clis/hackernews/best.js +29 -0
  80. package/dist/clis/hackernews/jobs.d.ts +1 -0
  81. package/dist/clis/hackernews/jobs.js +27 -0
  82. package/dist/clis/hackernews/new.d.ts +1 -0
  83. package/dist/clis/hackernews/new.js +29 -0
  84. package/dist/clis/hackernews/search.d.ts +1 -0
  85. package/dist/clis/hackernews/search.js +36 -0
  86. package/dist/clis/hackernews/show.d.ts +1 -0
  87. package/dist/clis/hackernews/show.js +29 -0
  88. package/dist/clis/hackernews/top.d.ts +1 -0
  89. package/dist/clis/hackernews/top.js +29 -0
  90. package/dist/clis/hackernews/user.d.ts +1 -0
  91. package/dist/clis/hackernews/user.js +22 -0
  92. package/dist/clis/hupu/hot.d.ts +1 -0
  93. package/dist/clis/hupu/hot.js +40 -0
  94. package/dist/clis/instagram/comment.d.ts +1 -0
  95. package/dist/clis/instagram/comment.js +47 -0
  96. package/dist/clis/instagram/explore.d.ts +1 -0
  97. package/dist/clis/instagram/explore.js +41 -0
  98. package/dist/clis/instagram/follow.d.ts +1 -0
  99. package/dist/clis/instagram/follow.js +43 -0
  100. package/dist/clis/instagram/followers.d.ts +1 -0
  101. package/dist/clis/instagram/followers.js +45 -0
  102. package/dist/clis/instagram/following.d.ts +1 -0
  103. package/dist/clis/instagram/following.js +45 -0
  104. package/dist/clis/instagram/like.d.ts +1 -0
  105. package/dist/clis/instagram/like.js +45 -0
  106. package/dist/clis/instagram/profile.d.ts +1 -0
  107. package/dist/clis/instagram/profile.js +39 -0
  108. package/dist/clis/instagram/save.d.ts +1 -0
  109. package/dist/clis/instagram/save.js +45 -0
  110. package/dist/clis/instagram/saved.d.ts +1 -0
  111. package/dist/clis/instagram/saved.js +38 -0
  112. package/dist/clis/instagram/search.d.ts +1 -0
  113. package/dist/clis/instagram/search.js +38 -0
  114. package/dist/clis/instagram/unfollow.d.ts +1 -0
  115. package/dist/clis/instagram/unfollow.js +40 -0
  116. package/dist/clis/instagram/unlike.d.ts +1 -0
  117. package/dist/clis/instagram/unlike.js +45 -0
  118. package/dist/clis/instagram/unsave.d.ts +1 -0
  119. package/dist/clis/instagram/unsave.js +45 -0
  120. package/dist/clis/instagram/user.d.ts +1 -0
  121. package/dist/clis/instagram/user.js +48 -0
  122. package/dist/clis/jd/add-cart.d.ts +1 -0
  123. package/dist/clis/jd/add-cart.js +71 -0
  124. package/dist/clis/jd/cart.d.ts +1 -0
  125. package/dist/clis/jd/cart.js +79 -0
  126. package/dist/clis/jd/commands.test.d.ts +5 -0
  127. package/dist/clis/jd/commands.test.js +64 -0
  128. package/dist/clis/jd/detail.d.ts +1 -0
  129. package/dist/clis/jd/detail.js +62 -0
  130. package/dist/clis/jd/reviews.d.ts +1 -0
  131. package/dist/clis/jd/reviews.js +54 -0
  132. package/dist/clis/jd/search.d.ts +1 -0
  133. package/dist/clis/jd/search.js +65 -0
  134. package/dist/clis/jianyu/detail.d.ts +1 -0
  135. package/dist/clis/jianyu/detail.js +20 -0
  136. package/dist/clis/jianyu/search.d.ts +41 -4
  137. package/dist/clis/jianyu/search.js +458 -96
  138. package/dist/clis/jianyu/search.test.js +105 -0
  139. package/dist/clis/jianyu/shared/china-bid-search.d.ts +12 -0
  140. package/dist/clis/jianyu/shared/china-bid-search.js +165 -0
  141. package/dist/clis/jianyu/shared/procurement-contract.d.ts +68 -0
  142. package/dist/clis/jianyu/shared/procurement-contract.js +324 -0
  143. package/dist/clis/jianyu/shared/procurement-contract.test.d.ts +1 -0
  144. package/dist/clis/jianyu/shared/procurement-contract.test.js +72 -0
  145. package/dist/clis/jianyu/shared/procurement-detail.d.ts +6 -0
  146. package/dist/clis/jianyu/shared/procurement-detail.js +92 -0
  147. package/dist/clis/jianyu/shared/procurement-detail.test.d.ts +1 -0
  148. package/dist/clis/jianyu/shared/procurement-detail.test.js +72 -0
  149. package/dist/clis/jike/post.d.ts +1 -0
  150. package/dist/clis/jike/post.js +61 -0
  151. package/dist/clis/jike/topic.d.ts +1 -0
  152. package/dist/clis/jike/topic.js +51 -0
  153. package/dist/clis/jike/user.d.ts +1 -0
  154. package/dist/clis/jike/user.js +50 -0
  155. package/dist/clis/jimeng/generate.d.ts +1 -0
  156. package/dist/clis/jimeng/generate.js +83 -0
  157. package/dist/clis/jimeng/history.d.ts +1 -0
  158. package/dist/clis/jimeng/history.js +47 -0
  159. package/dist/clis/jimeng/new.d.ts +1 -0
  160. package/dist/clis/jimeng/new.js +43 -0
  161. package/dist/clis/jimeng/workspaces.d.ts +1 -0
  162. package/dist/clis/jimeng/workspaces.js +41 -0
  163. package/dist/clis/linux-do/categories.d.ts +1 -0
  164. package/dist/clis/linux-do/categories.js +65 -0
  165. package/dist/clis/linux-do/search.d.ts +1 -0
  166. package/dist/clis/linux-do/search.js +41 -0
  167. package/dist/clis/linux-do/tags.d.ts +1 -0
  168. package/dist/clis/linux-do/tags.js +39 -0
  169. package/dist/clis/linux-do/topic-content.test.js +5 -5
  170. package/dist/clis/linux-do/topic.d.ts +1 -0
  171. package/dist/clis/linux-do/topic.js +56 -0
  172. package/dist/clis/linux-do/user-posts.d.ts +1 -0
  173. package/dist/clis/linux-do/user-posts.js +61 -0
  174. package/dist/clis/linux-do/user-topics.d.ts +1 -0
  175. package/dist/clis/linux-do/user-topics.js +48 -0
  176. package/dist/clis/lobsters/active.d.ts +1 -0
  177. package/dist/clis/lobsters/active.js +26 -0
  178. package/dist/clis/lobsters/hot.d.ts +1 -0
  179. package/dist/clis/lobsters/hot.js +26 -0
  180. package/dist/clis/lobsters/newest.d.ts +1 -0
  181. package/dist/clis/lobsters/newest.js +26 -0
  182. package/dist/clis/lobsters/tag.d.ts +1 -0
  183. package/dist/clis/lobsters/tag.js +32 -0
  184. package/dist/clis/pixiv/detail.d.ts +1 -0
  185. package/dist/clis/pixiv/detail.js +58 -0
  186. package/dist/clis/pixiv/ranking.d.ts +1 -0
  187. package/dist/clis/pixiv/ranking.js +59 -0
  188. package/dist/clis/pixiv/user.d.ts +1 -0
  189. package/dist/clis/pixiv/user.js +52 -0
  190. package/dist/clis/reddit/frontpage.d.ts +1 -0
  191. package/dist/clis/reddit/frontpage.js +31 -0
  192. package/dist/clis/reddit/hot.d.ts +1 -0
  193. package/dist/clis/reddit/hot.js +45 -0
  194. package/dist/clis/reddit/popular.d.ts +1 -0
  195. package/dist/clis/reddit/popular.js +41 -0
  196. package/dist/clis/reddit/search.d.ts +1 -0
  197. package/dist/clis/reddit/search.js +65 -0
  198. package/dist/clis/reddit/subreddit.d.ts +1 -0
  199. package/dist/clis/reddit/subreddit.js +52 -0
  200. package/dist/clis/reddit/user-comments.d.ts +1 -0
  201. package/dist/clis/reddit/user-comments.js +44 -0
  202. package/dist/clis/reddit/user-posts.d.ts +1 -0
  203. package/dist/clis/reddit/user-posts.js +42 -0
  204. package/dist/clis/reddit/user.d.ts +1 -0
  205. package/dist/clis/reddit/user.js +37 -0
  206. package/dist/clis/stackoverflow/bounties.d.ts +1 -0
  207. package/dist/clis/stackoverflow/bounties.js +27 -0
  208. package/dist/clis/stackoverflow/hot.d.ts +1 -0
  209. package/dist/clis/stackoverflow/hot.js +24 -0
  210. package/dist/clis/stackoverflow/search.d.ts +1 -0
  211. package/dist/clis/stackoverflow/search.js +27 -0
  212. package/dist/clis/stackoverflow/unanswered.d.ts +1 -0
  213. package/dist/clis/stackoverflow/unanswered.js +26 -0
  214. package/dist/clis/steam/top-sellers.d.ts +1 -0
  215. package/dist/clis/steam/top-sellers.js +25 -0
  216. package/dist/clis/taobao/add-cart.d.ts +1 -0
  217. package/dist/clis/taobao/add-cart.js +149 -0
  218. package/dist/clis/taobao/cart.d.ts +1 -0
  219. package/dist/clis/taobao/cart.js +95 -0
  220. package/dist/clis/taobao/commands.test.d.ts +5 -0
  221. package/dist/clis/taobao/commands.test.js +64 -0
  222. package/dist/clis/taobao/detail.d.ts +1 -0
  223. package/dist/clis/taobao/detail.js +70 -0
  224. package/dist/clis/taobao/reviews.d.ts +1 -0
  225. package/dist/clis/taobao/reviews.js +76 -0
  226. package/dist/clis/taobao/search.d.ts +1 -0
  227. package/dist/clis/taobao/search.js +96 -0
  228. package/dist/clis/tiktok/comment.d.ts +1 -0
  229. package/dist/clis/tiktok/comment.js +57 -0
  230. package/dist/clis/tiktok/explore.d.ts +1 -0
  231. package/dist/clis/tiktok/explore.js +35 -0
  232. package/dist/clis/tiktok/follow.d.ts +1 -0
  233. package/dist/clis/tiktok/follow.js +39 -0
  234. package/dist/clis/tiktok/following.d.ts +1 -0
  235. package/dist/clis/tiktok/following.js +42 -0
  236. package/dist/clis/tiktok/friends.d.ts +1 -0
  237. package/dist/clis/tiktok/friends.js +43 -0
  238. package/dist/clis/tiktok/like.d.ts +1 -0
  239. package/dist/clis/tiktok/like.js +33 -0
  240. package/dist/clis/tiktok/live.d.ts +1 -0
  241. package/dist/clis/tiktok/live.js +47 -0
  242. package/dist/clis/tiktok/notifications.d.ts +1 -0
  243. package/dist/clis/tiktok/notifications.js +49 -0
  244. package/dist/clis/tiktok/profile.d.ts +1 -0
  245. package/dist/clis/tiktok/profile.js +54 -0
  246. package/dist/clis/tiktok/save.d.ts +1 -0
  247. package/dist/clis/tiktok/save.js +29 -0
  248. package/dist/clis/tiktok/search.d.ts +1 -0
  249. package/dist/clis/tiktok/search.js +39 -0
  250. package/dist/clis/tiktok/unfollow.d.ts +1 -0
  251. package/dist/clis/tiktok/unfollow.js +44 -0
  252. package/dist/clis/tiktok/unlike.d.ts +1 -0
  253. package/dist/clis/tiktok/unlike.js +33 -0
  254. package/dist/clis/tiktok/unsave.d.ts +1 -0
  255. package/dist/clis/tiktok/unsave.js +31 -0
  256. package/dist/clis/tiktok/user.d.ts +1 -0
  257. package/dist/clis/tiktok/user.js +41 -0
  258. package/dist/clis/v2ex/hot.d.ts +1 -0
  259. package/dist/clis/v2ex/hot.js +25 -0
  260. package/dist/clis/v2ex/latest.d.ts +1 -0
  261. package/dist/clis/v2ex/latest.js +25 -0
  262. package/dist/clis/v2ex/member.d.ts +1 -0
  263. package/dist/clis/v2ex/member.js +27 -0
  264. package/dist/clis/v2ex/node.d.ts +1 -0
  265. package/dist/clis/v2ex/node.js +38 -0
  266. package/dist/clis/v2ex/nodes.d.ts +1 -0
  267. package/dist/clis/v2ex/nodes.js +25 -0
  268. package/dist/clis/v2ex/replies.d.ts +1 -0
  269. package/dist/clis/v2ex/replies.js +26 -0
  270. package/dist/clis/v2ex/topic.d.ts +1 -0
  271. package/dist/clis/v2ex/topic.js +30 -0
  272. package/dist/clis/v2ex/user.d.ts +1 -0
  273. package/dist/clis/v2ex/user.js +33 -0
  274. package/dist/clis/xiaoe/catalog.d.ts +1 -0
  275. package/dist/clis/xiaoe/catalog.js +161 -0
  276. package/dist/clis/xiaoe/content.d.ts +1 -0
  277. package/dist/clis/xiaoe/content.js +39 -0
  278. package/dist/clis/xiaoe/courses.d.ts +1 -0
  279. package/dist/clis/xiaoe/courses.js +69 -0
  280. package/dist/clis/xiaoe/detail.d.ts +1 -0
  281. package/dist/clis/xiaoe/detail.js +35 -0
  282. package/dist/clis/xiaoe/play-url.d.ts +1 -0
  283. package/dist/clis/xiaoe/play-url.js +120 -0
  284. package/dist/clis/xiaohongshu/feed.d.ts +1 -0
  285. package/dist/clis/xiaohongshu/feed.js +32 -0
  286. package/dist/clis/xiaohongshu/notifications.d.ts +1 -0
  287. package/dist/clis/xiaohongshu/notifications.js +38 -0
  288. package/dist/clis/xueqiu/earnings-date.d.ts +1 -0
  289. package/dist/clis/xueqiu/earnings-date.js +61 -0
  290. package/dist/clis/xueqiu/feed.d.ts +1 -0
  291. package/dist/clis/xueqiu/feed.js +48 -0
  292. package/dist/clis/xueqiu/groups.d.ts +1 -0
  293. package/dist/clis/xueqiu/groups.js +25 -0
  294. package/dist/clis/xueqiu/hot-stock.d.ts +1 -0
  295. package/dist/clis/xueqiu/hot-stock.js +44 -0
  296. package/dist/clis/xueqiu/hot.d.ts +1 -0
  297. package/dist/clis/xueqiu/hot.js +44 -0
  298. package/dist/clis/xueqiu/kline.d.ts +1 -0
  299. package/dist/clis/xueqiu/kline.js +64 -0
  300. package/dist/clis/xueqiu/search.d.ts +1 -0
  301. package/dist/clis/xueqiu/search.js +49 -0
  302. package/dist/clis/xueqiu/stock.d.ts +1 -0
  303. package/dist/clis/xueqiu/stock.js +72 -0
  304. package/dist/clis/xueqiu/watchlist.d.ts +1 -0
  305. package/dist/clis/xueqiu/watchlist.js +45 -0
  306. package/dist/clis/zhihu/hot.d.ts +1 -0
  307. package/dist/clis/zhihu/hot.js +43 -0
  308. package/dist/clis/zhihu/search.d.ts +1 -0
  309. package/dist/clis/zhihu/search.js +52 -0
  310. package/dist/src/browser/bridge.js +1 -1
  311. package/dist/src/browser/daemon-client.d.ts +16 -4
  312. package/dist/src/browser/daemon-client.js +33 -15
  313. package/dist/src/browser/daemon-client.test.js +0 -3
  314. package/dist/src/browser/dom-helpers.test.js +3 -2
  315. package/dist/src/browser/errors.d.ts +26 -1
  316. package/dist/src/browser/errors.js +40 -7
  317. package/dist/src/browser/errors.test.d.ts +1 -0
  318. package/dist/src/browser/errors.test.js +51 -0
  319. package/dist/src/browser/page.d.ts +9 -8
  320. package/dist/src/browser/page.js +33 -31
  321. package/dist/src/browser.test.js +25 -6
  322. package/dist/src/build-manifest.d.ts +5 -11
  323. package/dist/src/build-manifest.js +6 -75
  324. package/dist/src/build-manifest.test.js +1 -39
  325. package/dist/src/cascade.js +3 -2
  326. package/dist/src/cli.d.ts +3 -3
  327. package/dist/src/cli.js +71 -71
  328. package/dist/src/cli.test.js +20 -15
  329. package/dist/src/clis/binance/asks.d.ts +1 -0
  330. package/dist/src/clis/binance/asks.js +20 -0
  331. package/dist/src/clis/binance/commands.test.d.ts +3 -1
  332. package/dist/src/clis/binance/commands.test.js +10 -6
  333. package/dist/src/clis/binance/depth.d.ts +1 -0
  334. package/dist/src/clis/binance/depth.js +20 -0
  335. package/dist/src/clis/binance/gainers.d.ts +1 -0
  336. package/dist/src/clis/binance/gainers.js +21 -0
  337. package/dist/src/clis/binance/klines.d.ts +1 -0
  338. package/dist/src/clis/binance/klines.js +20 -0
  339. package/dist/src/clis/binance/losers.d.ts +1 -0
  340. package/dist/src/clis/binance/losers.js +21 -0
  341. package/dist/src/clis/binance/pairs.d.ts +1 -0
  342. package/dist/src/clis/binance/pairs.js +20 -0
  343. package/dist/src/clis/binance/price.d.ts +1 -0
  344. package/dist/src/clis/binance/price.js +17 -0
  345. package/dist/src/clis/binance/prices.d.ts +1 -0
  346. package/dist/src/clis/binance/prices.js +18 -0
  347. package/dist/src/clis/binance/ticker.d.ts +1 -0
  348. package/dist/src/clis/binance/ticker.js +20 -0
  349. package/dist/src/clis/binance/top.d.ts +1 -0
  350. package/dist/src/clis/binance/top.js +20 -0
  351. package/dist/src/clis/binance/trades.d.ts +1 -0
  352. package/dist/src/clis/binance/trades.js +19 -0
  353. package/dist/src/commands/daemon.d.ts +2 -6
  354. package/dist/src/commands/daemon.js +2 -58
  355. package/dist/src/commands/daemon.test.js +24 -120
  356. package/dist/src/completion-fast.d.ts +25 -0
  357. package/dist/src/completion-fast.js +140 -0
  358. package/dist/src/completion.d.ts +1 -0
  359. package/dist/src/completion.js +1 -0
  360. package/dist/src/constants.d.ts +0 -2
  361. package/dist/src/constants.js +0 -2
  362. package/dist/src/daemon.d.ts +1 -1
  363. package/dist/src/daemon.js +2 -15
  364. package/dist/src/diagnostic.test.js +2 -2
  365. package/dist/src/discovery.d.ts +3 -3
  366. package/dist/src/discovery.js +34 -97
  367. package/dist/src/download/index.d.ts +1 -1
  368. package/dist/src/engine.test.js +4 -19
  369. package/dist/src/execution.js +5 -1
  370. package/dist/src/generate-verified.d.ts +105 -0
  371. package/dist/src/generate-verified.js +696 -0
  372. package/dist/src/generate-verified.test.d.ts +1 -0
  373. package/dist/src/generate-verified.test.js +925 -0
  374. package/dist/src/generate.d.ts +9 -1
  375. package/dist/src/generate.js +2 -2
  376. package/dist/src/main.js +65 -12
  377. package/dist/src/pipeline/steps/download.d.ts +1 -17
  378. package/dist/src/pipeline/steps/download.js +20 -31
  379. package/dist/src/pipeline/steps/intercept.d.ts +1 -1
  380. package/dist/src/pipeline/steps/intercept.js +1 -1
  381. package/dist/src/pipeline/steps/tap.d.ts +1 -1
  382. package/dist/src/pipeline/steps/tap.js +1 -1
  383. package/dist/src/plugin-scaffold.d.ts +2 -2
  384. package/dist/src/plugin-scaffold.js +24 -21
  385. package/dist/src/plugin-scaffold.test.js +1 -1
  386. package/dist/src/plugin.d.ts +1 -1
  387. package/dist/src/plugin.js +4 -6
  388. package/dist/src/plugin.test.js +31 -31
  389. package/dist/src/record.js +26 -25
  390. package/dist/src/runtime-detect.js +3 -7
  391. package/dist/src/scripts/framework.d.ts +3 -0
  392. package/dist/src/scripts/framework.js +8 -4
  393. package/dist/src/scripts/store.d.ts +5 -1
  394. package/dist/src/scripts/store.js +5 -1
  395. package/dist/src/skill-generate.d.ts +30 -0
  396. package/dist/src/skill-generate.js +75 -0
  397. package/dist/src/skill-generate.test.d.ts +1 -0
  398. package/dist/src/skill-generate.test.js +173 -0
  399. package/dist/src/synthesize.d.ts +1 -1
  400. package/dist/src/synthesize.js +7 -8
  401. package/dist/src/types.d.ts +3 -1
  402. package/package.json +4 -3
  403. package/dist/clis/bilibili/hot.yaml +0 -38
  404. package/dist/clis/bluesky/feeds.yaml +0 -29
  405. package/dist/clis/bluesky/followers.yaml +0 -33
  406. package/dist/clis/bluesky/following.yaml +0 -33
  407. package/dist/clis/bluesky/profile.yaml +0 -27
  408. package/dist/clis/bluesky/search.yaml +0 -34
  409. package/dist/clis/bluesky/starter-packs.yaml +0 -34
  410. package/dist/clis/bluesky/thread.yaml +0 -32
  411. package/dist/clis/bluesky/trending.yaml +0 -27
  412. package/dist/clis/bluesky/user.yaml +0 -34
  413. package/dist/clis/devto/tag.yaml +0 -34
  414. package/dist/clis/devto/top.yaml +0 -29
  415. package/dist/clis/devto/user.yaml +0 -33
  416. package/dist/clis/dictionary/examples.yaml +0 -25
  417. package/dist/clis/dictionary/search.yaml +0 -27
  418. package/dist/clis/dictionary/synonyms.yaml +0 -25
  419. package/dist/clis/douban/subject.yaml +0 -107
  420. package/dist/clis/douban/top250.yaml +0 -70
  421. package/dist/clis/facebook/add-friend.yaml +0 -43
  422. package/dist/clis/facebook/events.yaml +0 -44
  423. package/dist/clis/facebook/feed.yaml +0 -63
  424. package/dist/clis/facebook/friends.yaml +0 -42
  425. package/dist/clis/facebook/groups.yaml +0 -50
  426. package/dist/clis/facebook/join-group.yaml +0 -44
  427. package/dist/clis/facebook/memories.yaml +0 -39
  428. package/dist/clis/facebook/notifications.yaml +0 -40
  429. package/dist/clis/facebook/profile.yaml +0 -37
  430. package/dist/clis/facebook/search.yaml +0 -47
  431. package/dist/clis/hackernews/ask.yaml +0 -38
  432. package/dist/clis/hackernews/best.yaml +0 -38
  433. package/dist/clis/hackernews/jobs.yaml +0 -36
  434. package/dist/clis/hackernews/new.yaml +0 -38
  435. package/dist/clis/hackernews/search.yaml +0 -44
  436. package/dist/clis/hackernews/show.yaml +0 -38
  437. package/dist/clis/hackernews/top.yaml +0 -38
  438. package/dist/clis/hackernews/user.yaml +0 -25
  439. package/dist/clis/hupu/hot.yaml +0 -43
  440. package/dist/clis/instagram/comment.yaml +0 -52
  441. package/dist/clis/instagram/explore.yaml +0 -43
  442. package/dist/clis/instagram/follow.yaml +0 -41
  443. package/dist/clis/instagram/followers.yaml +0 -51
  444. package/dist/clis/instagram/following.yaml +0 -51
  445. package/dist/clis/instagram/like.yaml +0 -46
  446. package/dist/clis/instagram/profile.yaml +0 -42
  447. package/dist/clis/instagram/save.yaml +0 -46
  448. package/dist/clis/instagram/saved.yaml +0 -40
  449. package/dist/clis/instagram/search.yaml +0 -44
  450. package/dist/clis/instagram/unfollow.yaml +0 -38
  451. package/dist/clis/instagram/unlike.yaml +0 -46
  452. package/dist/clis/instagram/unsave.yaml +0 -46
  453. package/dist/clis/instagram/user.yaml +0 -54
  454. package/dist/clis/jike/post.yaml +0 -59
  455. package/dist/clis/jike/topic.yaml +0 -53
  456. package/dist/clis/jike/user.yaml +0 -52
  457. package/dist/clis/jimeng/generate.yaml +0 -85
  458. package/dist/clis/jimeng/history.yaml +0 -46
  459. package/dist/clis/linux-do/categories.yaml +0 -70
  460. package/dist/clis/linux-do/search.yaml +0 -48
  461. package/dist/clis/linux-do/tags.yaml +0 -41
  462. package/dist/clis/linux-do/topic.yaml +0 -62
  463. package/dist/clis/linux-do/user-posts.yaml +0 -67
  464. package/dist/clis/linux-do/user-topics.yaml +0 -54
  465. package/dist/clis/lobsters/active.yaml +0 -29
  466. package/dist/clis/lobsters/hot.yaml +0 -29
  467. package/dist/clis/lobsters/newest.yaml +0 -29
  468. package/dist/clis/lobsters/tag.yaml +0 -34
  469. package/dist/clis/pixiv/detail.yaml +0 -49
  470. package/dist/clis/pixiv/ranking.yaml +0 -53
  471. package/dist/clis/pixiv/user.yaml +0 -46
  472. package/dist/clis/reddit/frontpage.yaml +0 -30
  473. package/dist/clis/reddit/hot.yaml +0 -47
  474. package/dist/clis/reddit/popular.yaml +0 -40
  475. package/dist/clis/reddit/search.yaml +0 -61
  476. package/dist/clis/reddit/subreddit.yaml +0 -50
  477. package/dist/clis/reddit/user-comments.yaml +0 -46
  478. package/dist/clis/reddit/user-posts.yaml +0 -44
  479. package/dist/clis/reddit/user.yaml +0 -40
  480. package/dist/clis/stackoverflow/bounties.yaml +0 -29
  481. package/dist/clis/stackoverflow/hot.yaml +0 -28
  482. package/dist/clis/stackoverflow/search.yaml +0 -33
  483. package/dist/clis/stackoverflow/unanswered.yaml +0 -28
  484. package/dist/clis/steam/top-sellers.yaml +0 -29
  485. package/dist/clis/tiktok/comment.yaml +0 -66
  486. package/dist/clis/tiktok/explore.yaml +0 -39
  487. package/dist/clis/tiktok/follow.yaml +0 -39
  488. package/dist/clis/tiktok/following.yaml +0 -46
  489. package/dist/clis/tiktok/friends.yaml +0 -47
  490. package/dist/clis/tiktok/like.yaml +0 -38
  491. package/dist/clis/tiktok/live.yaml +0 -51
  492. package/dist/clis/tiktok/notifications.yaml +0 -52
  493. package/dist/clis/tiktok/profile.yaml +0 -45
  494. package/dist/clis/tiktok/save.yaml +0 -34
  495. package/dist/clis/tiktok/search.yaml +0 -47
  496. package/dist/clis/tiktok/unfollow.yaml +0 -44
  497. package/dist/clis/tiktok/unlike.yaml +0 -38
  498. package/dist/clis/tiktok/unsave.yaml +0 -36
  499. package/dist/clis/tiktok/user.yaml +0 -44
  500. package/dist/clis/v2ex/hot.yaml +0 -28
  501. package/dist/clis/v2ex/latest.yaml +0 -28
  502. package/dist/clis/v2ex/member.yaml +0 -29
  503. package/dist/clis/v2ex/node.yaml +0 -34
  504. package/dist/clis/v2ex/nodes.yaml +0 -31
  505. package/dist/clis/v2ex/replies.yaml +0 -32
  506. package/dist/clis/v2ex/topic.yaml +0 -33
  507. package/dist/clis/v2ex/user.yaml +0 -34
  508. package/dist/clis/xiaoe/catalog.yaml +0 -129
  509. package/dist/clis/xiaoe/content.yaml +0 -43
  510. package/dist/clis/xiaoe/courses.yaml +0 -73
  511. package/dist/clis/xiaoe/detail.yaml +0 -39
  512. package/dist/clis/xiaoe/play-url.yaml +0 -124
  513. package/dist/clis/xiaohongshu/feed.yaml +0 -31
  514. package/dist/clis/xiaohongshu/notifications.yaml +0 -37
  515. package/dist/clis/xueqiu/earnings-date.yaml +0 -69
  516. package/dist/clis/xueqiu/feed.yaml +0 -53
  517. package/dist/clis/xueqiu/groups.yaml +0 -23
  518. package/dist/clis/xueqiu/hot-stock.yaml +0 -49
  519. package/dist/clis/xueqiu/hot.yaml +0 -46
  520. package/dist/clis/xueqiu/kline.yaml +0 -65
  521. package/dist/clis/xueqiu/search.yaml +0 -55
  522. package/dist/clis/xueqiu/stock.yaml +0 -69
  523. package/dist/clis/xueqiu/watchlist.yaml +0 -46
  524. package/dist/clis/zhihu/hot.yaml +0 -46
  525. package/dist/clis/zhihu/search.yaml +0 -59
  526. package/dist/src/daemon.test.js +0 -65
  527. package/dist/src/idle-manager.d.ts +0 -19
  528. package/dist/src/idle-manager.js +0 -54
  529. package/dist/src/yaml-schema.d.ts +0 -29
  530. package/dist/src/yaml-schema.js +0 -22
  531. /package/dist/{src/daemon.test.d.ts → clis/bilibili/hot.d.ts} +0 -0
@@ -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 {};