@jackwener/opencli 1.7.11 → 1.7.12
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.zh-CN.md +2 -1
- package/cli-manifest.json +1417 -24
- package/clis/1688/assets.js +1 -0
- package/clis/1688/download.js +1 -0
- package/clis/1688/item.js +1 -0
- package/clis/1688/search.js +2 -1
- package/clis/1688/store.js +1 -0
- package/clis/36kr/article.js +1 -0
- package/clis/36kr/hot.js +1 -0
- package/clis/36kr/news.js +1 -0
- package/clis/36kr/search.js +1 -0
- package/clis/51job/company.js +1 -0
- package/clis/51job/detail.js +1 -0
- package/clis/51job/hot.js +1 -0
- package/clis/51job/search.js +1 -0
- package/clis/amazon/bestsellers.js +1 -0
- package/clis/amazon/discussion.js +1 -0
- package/clis/amazon/movers-shakers.js +1 -0
- package/clis/amazon/new-releases.js +1 -0
- package/clis/amazon/offer.js +1 -0
- package/clis/amazon/product.js +1 -0
- package/clis/amazon/rankings.js +1 -0
- package/clis/amazon/search.js +1 -0
- package/clis/antigravity/dump.js +1 -0
- package/clis/antigravity/extract-code.js +1 -0
- package/clis/antigravity/model.js +1 -0
- package/clis/antigravity/new.js +1 -0
- package/clis/antigravity/read.js +1 -0
- package/clis/antigravity/send.js +1 -0
- package/clis/antigravity/status.js +1 -0
- package/clis/antigravity/watch.js +1 -0
- package/clis/apple-podcasts/episodes.js +1 -0
- package/clis/apple-podcasts/search.js +1 -0
- package/clis/apple-podcasts/top.js +1 -0
- package/clis/arxiv/arxiv.test.js +112 -0
- package/clis/arxiv/paper.js +4 -3
- package/clis/arxiv/recent.js +33 -0
- package/clis/arxiv/search.js +19 -7
- package/clis/arxiv/utils.js +68 -5
- package/clis/baidu-scholar/search.js +1 -0
- package/clis/band/bands.js +1 -0
- package/clis/band/mentions.js +1 -0
- package/clis/band/post.js +1 -0
- package/clis/band/posts.js +1 -0
- package/clis/barchart/flow.js +1 -0
- package/clis/barchart/greeks.js +1 -0
- package/clis/barchart/options.js +1 -0
- package/clis/barchart/quote.js +1 -0
- package/clis/bbc/news.js +1 -0
- package/clis/bilibili/comments.js +1 -0
- package/clis/bilibili/download.js +1 -0
- package/clis/bilibili/dynamic.js +1 -0
- package/clis/bilibili/favorite.js +1 -0
- package/clis/bilibili/feed.js +2 -0
- package/clis/bilibili/following.js +1 -0
- package/clis/bilibili/history.js +1 -0
- package/clis/bilibili/hot.js +6 -1
- package/clis/bilibili/hot.test.js +17 -0
- package/clis/bilibili/me.js +1 -1
- package/clis/bilibili/ranking.js +1 -0
- package/clis/bilibili/search.js +1 -1
- package/clis/bilibili/subtitle.js +1 -0
- package/clis/bilibili/user-videos.js +1 -0
- package/clis/bilibili/video.js +1 -0
- package/clis/binance/asks.js +1 -0
- package/clis/binance/depth.js +1 -0
- package/clis/binance/gainers.js +1 -0
- package/clis/binance/klines.js +1 -0
- package/clis/binance/losers.js +1 -0
- package/clis/binance/pairs.js +1 -0
- package/clis/binance/price.js +1 -0
- package/clis/binance/prices.js +1 -0
- package/clis/binance/ticker.js +1 -0
- package/clis/binance/top.js +1 -0
- package/clis/binance/trades.js +1 -0
- package/clis/bloomberg/businessweek.js +1 -0
- package/clis/bloomberg/economics.js +1 -0
- package/clis/bloomberg/feeds.js +1 -0
- package/clis/bloomberg/industries.js +1 -0
- package/clis/bloomberg/main.js +1 -0
- package/clis/bloomberg/markets.js +1 -0
- package/clis/bloomberg/news.js +1 -0
- package/clis/bloomberg/opinions.js +1 -0
- package/clis/bloomberg/politics.js +1 -0
- package/clis/bloomberg/tech.js +1 -0
- package/clis/bluesky/feeds.js +1 -0
- package/clis/bluesky/followers.js +1 -0
- package/clis/bluesky/following.js +1 -0
- package/clis/bluesky/profile.js +1 -0
- package/clis/bluesky/search.js +1 -0
- package/clis/bluesky/starter-packs.js +1 -0
- package/clis/bluesky/thread.js +1 -0
- package/clis/bluesky/trending.js +1 -0
- package/clis/bluesky/user.js +3 -1
- package/clis/boss/batchgreet.js +1 -0
- package/clis/boss/chatlist.js +1 -0
- package/clis/boss/chatmsg.js +1 -0
- package/clis/boss/detail.js +1 -0
- package/clis/boss/exchange.js +1 -0
- package/clis/boss/greet.js +1 -0
- package/clis/boss/invite.js +1 -0
- package/clis/boss/joblist.js +1 -0
- package/clis/boss/mark.js +1 -0
- package/clis/boss/recommend.js +1 -0
- package/clis/boss/resume.js +1 -0
- package/clis/boss/search.js +1 -0
- package/clis/boss/send.js +1 -0
- package/clis/boss/stats.js +1 -0
- package/clis/chaoxing/assignments.js +1 -0
- package/clis/chaoxing/exams.js +1 -0
- package/clis/chatgpt/image.js +1 -0
- package/clis/chatgpt-app/ask.js +1 -0
- package/clis/chatgpt-app/model.js +1 -0
- package/clis/chatgpt-app/new.js +1 -0
- package/clis/chatgpt-app/read.js +1 -0
- package/clis/chatgpt-app/send.js +1 -0
- package/clis/chatgpt-app/status.js +1 -0
- package/clis/chatwise/ask.js +1 -0
- package/clis/chatwise/export.js +1 -0
- package/clis/chatwise/history.js +1 -0
- package/clis/chatwise/model.js +1 -0
- package/clis/chatwise/read.js +1 -0
- package/clis/chatwise/send.js +1 -0
- package/clis/claude/ask.js +1 -0
- package/clis/claude/detail.js +1 -0
- package/clis/claude/history.js +1 -0
- package/clis/claude/new.js +1 -0
- package/clis/claude/read.js +1 -0
- package/clis/claude/send.js +1 -0
- package/clis/claude/status.js +1 -0
- package/clis/cnki/search.js +1 -0
- package/clis/codex/ask.js +1 -0
- package/clis/codex/export.js +1 -0
- package/clis/codex/extract-diff.js +1 -0
- package/clis/codex/history.js +1 -0
- package/clis/codex/model.js +1 -0
- package/clis/codex/read.js +1 -0
- package/clis/codex/send.js +1 -0
- package/clis/coupang/add-to-cart.js +1 -0
- package/clis/coupang/search.js +1 -0
- package/clis/ctrip/search.js +1 -0
- package/clis/cursor/ask.js +1 -0
- package/clis/cursor/composer.js +1 -0
- package/clis/cursor/export.js +1 -0
- package/clis/cursor/extract-code.js +1 -0
- package/clis/cursor/history.js +1 -0
- package/clis/cursor/model.js +1 -0
- package/clis/cursor/read.js +1 -0
- package/clis/cursor/send.js +1 -0
- package/clis/dblp/dblp.test.js +397 -0
- package/clis/dblp/paper.js +40 -0
- package/clis/dblp/search.js +45 -0
- package/clis/dblp/utils.js +290 -0
- package/clis/deepseek/ask.js +1 -0
- package/clis/deepseek/history.js +1 -0
- package/clis/deepseek/new.js +1 -0
- package/clis/deepseek/read.js +1 -0
- package/clis/deepseek/status.js +1 -0
- package/clis/devto/devto.test.js +236 -0
- package/clis/devto/read.js +103 -0
- package/clis/devto/tag.js +5 -1
- package/clis/devto/top.js +5 -1
- package/clis/devto/user.js +5 -1
- package/clis/dianping/__fixtures__/search.html +168 -0
- package/clis/dianping/__fixtures__/shop.html +6 -0
- package/clis/dianping/dianping.test.js +424 -0
- package/clis/dianping/search.js +154 -0
- package/clis/dianping/shop.js +173 -0
- package/clis/dianping/utils.js +157 -0
- package/clis/dictionary/examples.js +1 -0
- package/clis/dictionary/search.js +1 -0
- package/clis/dictionary/synonyms.js +1 -0
- package/clis/discord-app/channels.js +1 -0
- package/clis/discord-app/delete.js +1 -0
- package/clis/discord-app/members.js +1 -0
- package/clis/discord-app/read.js +1 -0
- package/clis/discord-app/search.js +1 -0
- package/clis/discord-app/send.js +1 -0
- package/clis/discord-app/servers.js +1 -0
- package/clis/discord-app/status.js +1 -0
- package/clis/douban/book-hot.js +1 -0
- package/clis/douban/download.js +1 -0
- package/clis/douban/marks.js +1 -0
- package/clis/douban/movie-hot.js +2 -1
- package/clis/douban/movie-hot.test.js +14 -0
- package/clis/douban/photos.js +2 -1
- package/clis/douban/reviews.js +1 -0
- package/clis/douban/search.js +1 -0
- package/clis/douban/subject.js +1 -0
- package/clis/douban/top250.js +1 -0
- package/clis/douban/utils.js +11 -13
- package/clis/douban/utils.test.js +79 -0
- package/clis/doubao/ask.js +1 -0
- package/clis/doubao/detail.js +1 -0
- package/clis/doubao/history.js +1 -0
- package/clis/doubao/meeting-summary.js +1 -0
- package/clis/doubao/meeting-transcript.js +1 -0
- package/clis/doubao/new.js +1 -0
- package/clis/doubao/read.js +1 -0
- package/clis/doubao/send.js +1 -0
- package/clis/doubao/status.js +1 -0
- package/clis/doubao-app/ask.js +1 -0
- package/clis/doubao-app/dump.js +1 -0
- package/clis/doubao-app/new.js +1 -0
- package/clis/doubao-app/read.js +1 -0
- package/clis/doubao-app/screenshot.js +1 -0
- package/clis/doubao-app/send.js +1 -0
- package/clis/doubao-app/status.js +1 -0
- package/clis/douyin/activities.js +1 -0
- package/clis/douyin/collections.js +1 -0
- package/clis/douyin/delete.js +1 -0
- package/clis/douyin/draft.js +1 -0
- package/clis/douyin/drafts.js +1 -0
- package/clis/douyin/hashtag.js +1 -0
- package/clis/douyin/location.js +1 -0
- package/clis/douyin/profile.js +1 -0
- package/clis/douyin/publish.js +1 -0
- package/clis/douyin/stats.js +1 -0
- package/clis/douyin/update.js +1 -0
- package/clis/douyin/user-videos.js +1 -0
- package/clis/douyin/videos.js +1 -0
- package/clis/eastmoney/announcement.js +1 -0
- package/clis/eastmoney/convertible.js +1 -0
- package/clis/eastmoney/etf.js +1 -0
- package/clis/eastmoney/holders.js +1 -0
- package/clis/eastmoney/hot-rank.js +1 -0
- package/clis/eastmoney/index-board.js +1 -0
- package/clis/eastmoney/kline.js +1 -0
- package/clis/eastmoney/kuaixun.js +1 -0
- package/clis/eastmoney/longhu.js +1 -0
- package/clis/eastmoney/money-flow.js +1 -0
- package/clis/eastmoney/northbound.js +1 -0
- package/clis/eastmoney/quote.js +1 -0
- package/clis/eastmoney/rank.js +1 -0
- package/clis/eastmoney/sectors.js +1 -0
- package/clis/facebook/add-friend.js +1 -0
- package/clis/facebook/events.js +1 -0
- package/clis/facebook/feed.js +1 -0
- package/clis/facebook/friends.js +1 -0
- package/clis/facebook/groups.js +1 -0
- package/clis/facebook/join-group.js +1 -0
- package/clis/facebook/marketplace-inbox.js +1 -0
- package/clis/facebook/marketplace-listings.js +1 -0
- package/clis/facebook/memories.js +1 -0
- package/clis/facebook/notifications.js +1 -0
- package/clis/facebook/profile.js +1 -0
- package/clis/facebook/search.js +1 -0
- package/clis/gemini/ask.js +1 -0
- package/clis/gemini/deep-research-result.js +1 -0
- package/clis/gemini/deep-research.js +1 -0
- package/clis/gemini/image.js +1 -0
- package/clis/gemini/new.js +1 -0
- package/clis/gitee/search.js +1 -0
- package/clis/gitee/trending.js +1 -0
- package/clis/gitee/user.js +1 -0
- package/clis/google/news.js +1 -0
- package/clis/google/search.js +1 -0
- package/clis/google/suggest.js +1 -0
- package/clis/google/trends.js +1 -0
- package/clis/google-scholar/cite.js +1 -0
- package/clis/google-scholar/profile.js +1 -0
- package/clis/google-scholar/search.js +1 -0
- package/clis/gov-law/recent.js +1 -0
- package/clis/gov-law/search.js +1 -0
- package/clis/gov-policy/recent.js +1 -0
- package/clis/gov-policy/search.js +1 -0
- package/clis/grok/ask.js +1 -0
- package/clis/grok/image.ts +1 -0
- package/clis/hackernews/ask.js +3 -1
- package/clis/hackernews/best.js +3 -1
- package/clis/hackernews/hackernews.test.js +132 -0
- package/clis/hackernews/jobs.js +3 -1
- package/clis/hackernews/new.js +3 -1
- package/clis/hackernews/read.js +188 -0
- package/clis/hackernews/search.js +3 -1
- package/clis/hackernews/show.js +3 -1
- package/clis/hackernews/top.js +3 -1
- package/clis/hackernews/user.js +1 -0
- package/clis/hf/top.js +1 -0
- package/clis/hupu/detail.js +1 -0
- package/clis/hupu/hot.js +3 -1
- package/clis/hupu/like.js +1 -0
- package/clis/hupu/mentions.js +2 -1
- package/clis/hupu/reply.js +1 -0
- package/clis/hupu/search.js +3 -1
- package/clis/hupu/unlike.js +1 -0
- package/clis/imdb/person.js +1 -0
- package/clis/imdb/reviews.js +1 -0
- package/clis/imdb/search.js +1 -0
- package/clis/imdb/title.js +1 -0
- package/clis/imdb/top.js +1 -0
- package/clis/imdb/trending.js +1 -0
- package/clis/indeed/indeed.test.js +375 -0
- package/clis/indeed/job.js +86 -0
- package/clis/indeed/search.js +110 -0
- package/clis/indeed/utils.js +152 -0
- package/clis/instagram/collection-create.js +1 -0
- package/clis/instagram/collection-delete.js +1 -0
- package/clis/instagram/comment.js +1 -0
- package/clis/instagram/download.js +1 -0
- package/clis/instagram/explore.js +1 -0
- package/clis/instagram/follow.js +1 -0
- package/clis/instagram/followers.js +1 -0
- package/clis/instagram/following.js +1 -0
- package/clis/instagram/like.js +1 -0
- package/clis/instagram/note.js +1 -0
- package/clis/instagram/post.js +1 -0
- package/clis/instagram/profile.js +1 -0
- package/clis/instagram/reel.js +1 -0
- package/clis/instagram/save.js +1 -0
- package/clis/instagram/saved.js +1 -0
- package/clis/instagram/search.js +1 -0
- package/clis/instagram/story.js +1 -0
- package/clis/instagram/unfollow.js +1 -0
- package/clis/instagram/unlike.js +1 -0
- package/clis/instagram/unsave.js +1 -0
- package/clis/instagram/user.js +1 -0
- package/clis/jd/add-cart.js +1 -0
- package/clis/jd/cart.js +1 -0
- package/clis/jd/detail.js +1 -0
- package/clis/jd/item.js +1 -0
- package/clis/jd/reviews.js +1 -0
- package/clis/jd/search.js +1 -0
- package/clis/jianyu/detail.js +1 -0
- package/clis/jianyu/search.js +1 -0
- package/clis/jike/comment.js +1 -0
- package/clis/jike/create.js +1 -0
- package/clis/jike/feed.js +3 -1
- package/clis/jike/like.js +1 -0
- package/clis/jike/notifications.js +1 -0
- package/clis/jike/post.js +1 -0
- package/clis/jike/repost.js +1 -0
- package/clis/jike/search.js +3 -1
- package/clis/jike/topic.js +1 -0
- package/clis/jike/user.js +3 -1
- package/clis/jimeng/generate.js +1 -0
- package/clis/jimeng/history.js +1 -0
- package/clis/jimeng/new.js +1 -0
- package/clis/jimeng/workspaces.js +1 -0
- package/clis/ke/chengjiao.js +1 -0
- package/clis/ke/ershoufang.js +1 -0
- package/clis/ke/xiaoqu.js +1 -0
- package/clis/ke/zufang.js +1 -0
- package/clis/lesswrong/comments.js +1 -0
- package/clis/lesswrong/curated.js +1 -0
- package/clis/lesswrong/frontpage.js +1 -0
- package/clis/lesswrong/new.js +1 -0
- package/clis/lesswrong/read.js +1 -0
- package/clis/lesswrong/sequences.js +1 -0
- package/clis/lesswrong/shortform.js +1 -0
- package/clis/lesswrong/tag.js +1 -0
- package/clis/lesswrong/tags.js +1 -0
- package/clis/lesswrong/top-month.js +1 -0
- package/clis/lesswrong/top-week.js +1 -0
- package/clis/lesswrong/top-year.js +1 -0
- package/clis/lesswrong/top.js +1 -0
- package/clis/lesswrong/user-posts.js +1 -0
- package/clis/lesswrong/user.js +1 -0
- package/clis/linkedin/search.js +1 -0
- package/clis/linkedin/timeline.js +1 -0
- package/clis/linux-do/categories.js +1 -0
- package/clis/linux-do/category.js +1 -0
- package/clis/linux-do/feed.js +1 -0
- package/clis/linux-do/hot.js +1 -0
- package/clis/linux-do/latest.js +1 -0
- package/clis/linux-do/search.js +1 -0
- package/clis/linux-do/tags.js +2 -1
- package/clis/linux-do/topic-content.js +1 -0
- package/clis/linux-do/topic.js +1 -0
- package/clis/linux-do/user-posts.js +1 -0
- package/clis/linux-do/user-topics.js +1 -0
- package/clis/lobsters/active.js +4 -1
- package/clis/lobsters/hot.js +4 -1
- package/clis/lobsters/lobsters.test.js +169 -0
- package/clis/lobsters/newest.js +4 -1
- package/clis/lobsters/read.js +196 -0
- package/clis/lobsters/tag.js +4 -1
- package/clis/maimai/search-talents.js +1 -0
- package/clis/medium/feed.js +1 -0
- package/clis/medium/search.js +1 -0
- package/clis/medium/user.js +1 -0
- package/clis/mubu/doc.js +1 -0
- package/clis/mubu/docs.js +1 -0
- package/clis/mubu/notes.js +1 -0
- package/clis/mubu/recent.js +1 -0
- package/clis/mubu/search.js +1 -0
- package/clis/notebooklm/current.js +1 -0
- package/clis/notebooklm/get.js +1 -0
- package/clis/notebooklm/history.js +1 -0
- package/clis/notebooklm/list.js +1 -0
- package/clis/notebooklm/note-list.js +1 -0
- package/clis/notebooklm/notes-get.js +1 -0
- package/clis/notebooklm/open.js +1 -0
- package/clis/notebooklm/source-fulltext.js +1 -0
- package/clis/notebooklm/source-get.js +1 -0
- package/clis/notebooklm/source-guide.js +1 -0
- package/clis/notebooklm/source-list.js +1 -0
- package/clis/notebooklm/status.js +1 -0
- package/clis/notebooklm/summary.js +1 -0
- package/clis/notion/export.js +1 -0
- package/clis/notion/favorites.js +1 -0
- package/clis/notion/new.js +1 -0
- package/clis/notion/read.js +1 -0
- package/clis/notion/search.js +1 -0
- package/clis/notion/sidebar.js +1 -0
- package/clis/notion/status.js +1 -0
- package/clis/notion/write.js +1 -0
- package/clis/nowcoder/companies.js +1 -0
- package/clis/nowcoder/creators.js +1 -0
- package/clis/nowcoder/detail.js +1 -0
- package/clis/nowcoder/experience.js +1 -0
- package/clis/nowcoder/hot.js +1 -0
- package/clis/nowcoder/jobs.js +1 -0
- package/clis/nowcoder/notifications.js +1 -0
- package/clis/nowcoder/papers.js +1 -0
- package/clis/nowcoder/practice.js +1 -0
- package/clis/nowcoder/recommend.js +1 -0
- package/clis/nowcoder/referral.js +1 -0
- package/clis/nowcoder/salary.js +1 -0
- package/clis/nowcoder/search.js +1 -0
- package/clis/nowcoder/suggest.js +1 -0
- package/clis/nowcoder/topics.js +1 -0
- package/clis/nowcoder/trending.js +1 -0
- package/clis/ones/login.js +1 -0
- package/clis/ones/logout.js +1 -0
- package/clis/ones/me.js +1 -0
- package/clis/ones/my-tasks.js +1 -0
- package/clis/ones/task.js +1 -0
- package/clis/ones/tasks.js +1 -0
- package/clis/ones/token-info.js +1 -0
- package/clis/ones/worklog.js +1 -0
- package/clis/openreview/openreview.test.js +345 -0
- package/clis/openreview/paper.js +43 -0
- package/clis/openreview/reviews.js +131 -0
- package/clis/openreview/search.js +46 -0
- package/clis/openreview/utils.js +158 -0
- package/clis/openreview/venue.js +63 -0
- package/clis/paperreview/feedback.js +1 -0
- package/clis/paperreview/review.js +1 -0
- package/clis/paperreview/submit.js +1 -0
- package/clis/pixiv/detail.js +1 -0
- package/clis/pixiv/download.js +1 -0
- package/clis/pixiv/illusts.js +2 -1
- package/clis/pixiv/ranking.js +2 -1
- package/clis/pixiv/search.js +2 -1
- package/clis/pixiv/user.js +2 -0
- package/clis/powerchina/search.js +1 -0
- package/clis/producthunt/browse.js +1 -0
- package/clis/producthunt/hot.js +1 -0
- package/clis/producthunt/posts.js +1 -0
- package/clis/producthunt/today.js +1 -0
- package/clis/quark/ls.js +1 -0
- package/clis/quark/mkdir.js +1 -0
- package/clis/quark/mv.js +1 -0
- package/clis/quark/rename.js +1 -0
- package/clis/quark/rm.js +1 -0
- package/clis/quark/save.js +1 -0
- package/clis/quark/share-tree.js +1 -0
- package/clis/reddit/comment.js +1 -0
- package/clis/reddit/frontpage.js +1 -0
- package/clis/reddit/hot.js +6 -1
- package/clis/reddit/hot.test.js +18 -0
- package/clis/reddit/popular.js +1 -0
- package/clis/reddit/read.js +1 -0
- package/clis/reddit/save.js +1 -0
- package/clis/reddit/saved.js +1 -0
- package/clis/reddit/search.js +1 -0
- package/clis/reddit/subreddit.js +1 -0
- package/clis/reddit/subscribe.js +1 -0
- package/clis/reddit/upvote.js +1 -0
- package/clis/reddit/upvoted.js +1 -0
- package/clis/reddit/user-comments.js +1 -0
- package/clis/reddit/user-posts.js +1 -0
- package/clis/reddit/user.js +1 -0
- package/clis/reuters/search.js +1 -0
- package/clis/sinablog/article.js +1 -0
- package/clis/sinablog/hot.js +1 -0
- package/clis/sinablog/search.js +1 -0
- package/clis/sinablog/user.js +1 -0
- package/clis/sinafinance/news.js +1 -0
- package/clis/sinafinance/rolling-news.js +1 -0
- package/clis/sinafinance/stock-rank.js +1 -0
- package/clis/sinafinance/stock.js +1 -0
- package/clis/smzdm/search.js +1 -0
- package/clis/spotify/spotify.js +11 -0
- package/clis/stackoverflow/bounties.js +11 -3
- package/clis/stackoverflow/hot.js +10 -2
- package/clis/stackoverflow/read.js +314 -0
- package/clis/stackoverflow/search.js +10 -2
- package/clis/stackoverflow/stackoverflow.test.js +346 -0
- package/clis/stackoverflow/unanswered.js +9 -2
- package/clis/steam/top-sellers.js +1 -0
- package/clis/substack/feed.js +1 -0
- package/clis/substack/publication.js +1 -0
- package/clis/substack/search.js +1 -0
- package/clis/taobao/add-cart.js +1 -0
- package/clis/taobao/cart.js +1 -0
- package/clis/taobao/detail.js +1 -0
- package/clis/taobao/reviews.js +1 -0
- package/clis/taobao/search.js +1 -0
- package/clis/tdx/hot-rank.js +1 -0
- package/clis/ths/hot-rank.js +1 -0
- package/clis/tieba/hot.js +2 -1
- package/clis/tieba/posts.js +1 -0
- package/clis/tieba/read.js +1 -0
- package/clis/tieba/search.js +2 -1
- package/clis/tiktok/comment.js +1 -0
- package/clis/tiktok/explore.js +1 -0
- package/clis/tiktok/follow.js +1 -0
- package/clis/tiktok/following.js +1 -0
- package/clis/tiktok/friends.js +1 -0
- package/clis/tiktok/like.js +1 -0
- package/clis/tiktok/live.js +1 -0
- package/clis/tiktok/notifications.js +1 -0
- package/clis/tiktok/profile.js +1 -0
- package/clis/tiktok/save.js +1 -0
- package/clis/tiktok/search.js +1 -0
- package/clis/tiktok/unfollow.js +1 -0
- package/clis/tiktok/unlike.js +1 -0
- package/clis/tiktok/unsave.js +1 -0
- package/clis/tiktok/user.js +1 -0
- package/clis/toutiao/articles.js +1 -0
- package/clis/twitter/accept.js +1 -0
- package/clis/twitter/article.js +1 -0
- package/clis/twitter/block.js +1 -0
- package/clis/twitter/bookmark.js +1 -0
- package/clis/twitter/bookmarks.js +2 -1
- package/clis/twitter/delete.js +1 -0
- package/clis/twitter/download.js +1 -0
- package/clis/twitter/follow.js +1 -0
- package/clis/twitter/followers.js +1 -0
- package/clis/twitter/following.js +1 -0
- package/clis/twitter/hide-reply.js +1 -0
- package/clis/twitter/like.js +1 -0
- package/clis/twitter/likes.js +2 -1
- package/clis/twitter/list-add.js +1 -0
- package/clis/twitter/list-remove.js +1 -0
- package/clis/twitter/list-tweets.js +1 -0
- package/clis/twitter/lists.js +1 -0
- package/clis/twitter/notifications.js +1 -0
- package/clis/twitter/post.js +1 -0
- package/clis/twitter/profile.js +1 -0
- package/clis/twitter/reply-dm.js +1 -0
- package/clis/twitter/reply.js +1 -0
- package/clis/twitter/search.js +1 -0
- package/clis/twitter/thread.js +1 -0
- package/clis/twitter/timeline.js +1 -0
- package/clis/twitter/trending.js +11 -12
- package/clis/twitter/trending.test.js +15 -0
- package/clis/twitter/tweets.js +2 -1
- package/clis/twitter/tweets.test.js +2 -2
- package/clis/twitter/unblock.js +1 -0
- package/clis/twitter/unbookmark.js +1 -0
- package/clis/twitter/unfollow.js +1 -0
- package/clis/uiverse/code.js +1 -0
- package/clis/uiverse/preview.js +1 -0
- package/clis/v2ex/daily.js +1 -0
- package/clis/v2ex/hot.js +1 -0
- package/clis/v2ex/latest.js +1 -0
- package/clis/v2ex/me.js +1 -0
- package/clis/v2ex/member.js +1 -0
- package/clis/v2ex/node.js +1 -0
- package/clis/v2ex/nodes.js +1 -0
- package/clis/v2ex/notifications.js +1 -0
- package/clis/v2ex/replies.js +1 -0
- package/clis/v2ex/topic.js +1 -0
- package/clis/v2ex/user.js +1 -0
- package/clis/wanfang/search.js +1 -0
- package/clis/web/read.js +1 -0
- package/clis/weibo/comments.js +1 -0
- package/clis/weibo/favorites.js +1 -0
- package/clis/weibo/feed.js +3 -1
- package/clis/weibo/hot.js +1 -0
- package/clis/weibo/me.js +1 -0
- package/clis/weibo/post.js +1 -0
- package/clis/weibo/publish.js +1 -0
- package/clis/weibo/search.js +8 -2
- package/clis/weibo/user.js +1 -0
- package/clis/weixin/create-draft.js +1 -0
- package/clis/weixin/download.js +1 -0
- package/clis/weixin/drafts.js +1 -0
- package/clis/weread/ai-outline.js +1 -0
- package/clis/weread/book.js +1 -0
- package/clis/weread/highlights.js +1 -0
- package/clis/weread/notebooks.js +1 -0
- package/clis/weread/notes.js +1 -0
- package/clis/weread/ranking.js +1 -0
- package/clis/weread/search.js +1 -0
- package/clis/weread/shelf.js +1 -0
- package/clis/wikipedia/random.js +1 -0
- package/clis/wikipedia/search.js +1 -0
- package/clis/wikipedia/summary.js +1 -0
- package/clis/wikipedia/trending.js +1 -0
- package/clis/xianyu/chat.js +1 -0
- package/clis/xianyu/item.js +1 -0
- package/clis/xianyu/search.js +1 -0
- package/clis/xiaoe/catalog.js +2 -1
- package/clis/xiaoe/content.js +1 -0
- package/clis/xiaoe/courses.js +1 -0
- package/clis/xiaoe/detail.js +1 -0
- package/clis/xiaoe/play-url.js +1 -0
- package/clis/xiaohongshu/comments.js +1 -0
- package/clis/xiaohongshu/creator-note-detail.js +1 -0
- package/clis/xiaohongshu/creator-notes-summary.js +1 -0
- package/clis/xiaohongshu/creator-notes.js +1 -0
- package/clis/xiaohongshu/creator-profile.js +1 -0
- package/clis/xiaohongshu/creator-stats.js +1 -0
- package/clis/xiaohongshu/download.js +1 -0
- package/clis/xiaohongshu/feed.js +2 -1
- package/clis/xiaohongshu/note.js +1 -0
- package/clis/xiaohongshu/notifications.js +1 -0
- package/clis/xiaohongshu/publish.js +1 -0
- package/clis/xiaohongshu/search.js +1 -0
- package/clis/xiaohongshu/user.js +1 -0
- package/clis/xiaoyuzhou/download.js +1 -0
- package/clis/xiaoyuzhou/episode.js +1 -0
- package/clis/xiaoyuzhou/podcast-episodes.js +1 -0
- package/clis/xiaoyuzhou/podcast.js +1 -0
- package/clis/xiaoyuzhou/transcript.js +1 -0
- package/clis/xueqiu/comments.js +1 -0
- package/clis/xueqiu/earnings-date.js +1 -0
- package/clis/xueqiu/feed.js +1 -0
- package/clis/xueqiu/fund-holdings.js +1 -0
- package/clis/xueqiu/fund-snapshot.js +1 -0
- package/clis/xueqiu/groups.js +1 -0
- package/clis/xueqiu/hot-stock.js +1 -0
- package/clis/xueqiu/hot.js +1 -0
- package/clis/xueqiu/kline.js +1 -0
- package/clis/xueqiu/search.js +1 -0
- package/clis/xueqiu/stock.js +1 -0
- package/clis/xueqiu/watchlist.js +1 -0
- package/clis/yahoo-finance/quote.js +1 -0
- package/clis/yollomi/background.js +1 -0
- package/clis/yollomi/edit.js +1 -0
- package/clis/yollomi/face-swap.js +1 -0
- package/clis/yollomi/generate.js +1 -0
- package/clis/yollomi/models.js +1 -0
- package/clis/yollomi/object-remover.js +1 -0
- package/clis/yollomi/remove-bg.js +1 -0
- package/clis/yollomi/restore.js +1 -0
- package/clis/yollomi/try-on.js +1 -0
- package/clis/yollomi/upload.js +1 -0
- package/clis/yollomi/upscale.js +1 -0
- package/clis/yollomi/video.js +1 -0
- package/clis/youtube/channel.js +1 -0
- package/clis/youtube/comments.js +1 -0
- package/clis/youtube/feed.js +8 -7
- package/clis/youtube/feed.test.js +131 -0
- package/clis/youtube/history.js +1 -0
- package/clis/youtube/like.js +1 -0
- package/clis/youtube/playlist.js +1 -0
- package/clis/youtube/search.js +1 -0
- package/clis/youtube/subscribe.js +1 -0
- package/clis/youtube/subscriptions.js +1 -0
- package/clis/youtube/transcript.js +1 -0
- package/clis/youtube/unlike.js +1 -0
- package/clis/youtube/unsubscribe.js +1 -0
- package/clis/youtube/video.js +1 -0
- package/clis/youtube/watch-later.js +1 -0
- package/clis/yuanbao/ask.js +1 -0
- package/clis/yuanbao/new.js +1 -0
- package/clis/zhihu/answer.js +1 -0
- package/clis/zhihu/collection.js +1 -0
- package/clis/zhihu/collections.js +1 -0
- package/clis/zhihu/comment.js +1 -0
- package/clis/zhihu/download.js +1 -0
- package/clis/zhihu/favorite.js +1 -0
- package/clis/zhihu/follow.js +1 -0
- package/clis/zhihu/hot.js +1 -0
- package/clis/zhihu/like.js +1 -0
- package/clis/zhihu/question.js +1 -0
- package/clis/zhihu/search.js +1 -0
- package/clis/zlibrary/info.js +1 -0
- package/clis/zlibrary/search.js +1 -0
- package/clis/zsxq/dynamics.js +1 -0
- package/clis/zsxq/groups.js +1 -0
- package/clis/zsxq/search.js +1 -0
- package/clis/zsxq/topic.js +1 -0
- package/clis/zsxq/topics.js +1 -0
- package/dist/src/adapter-source.test.js +1 -1
- package/dist/src/browser/analyze.test.js +2 -0
- package/dist/src/browser/base-page.d.ts +9 -0
- package/dist/src/browser/base-page.js +72 -3
- package/dist/src/browser/base-page.test.js +42 -0
- package/dist/src/browser/cdp.js +6 -0
- package/dist/src/browser/cdp.test.js +3 -0
- package/dist/src/browser/page.d.ts +1 -0
- package/dist/src/browser/page.js +6 -0
- package/dist/src/browser/page.test.js +17 -0
- package/dist/src/browser/target-resolver.d.ts +10 -3
- package/dist/src/browser/target-resolver.js +16 -10
- package/dist/src/browser/verify-fixture.d.ts +6 -1
- package/dist/src/browser/verify-fixture.js +87 -0
- package/dist/src/browser/verify-fixture.test.js +44 -1
- package/dist/src/build-manifest.js +3 -0
- package/dist/src/build-manifest.test.js +18 -12
- package/dist/src/capabilityRouting.test.js +1 -1
- package/dist/src/cli.js +141 -5
- package/dist/src/cli.test.js +179 -0
- package/dist/src/commanderAdapter.d.ts +1 -1
- package/dist/src/commanderAdapter.js +17 -7
- package/dist/src/commanderAdapter.test.js +7 -6
- package/dist/src/convention-audit.d.ts +50 -0
- package/dist/src/convention-audit.js +546 -0
- package/dist/src/convention-audit.test.d.ts +1 -0
- package/dist/src/convention-audit.test.js +226 -0
- package/dist/src/discovery.js +2 -0
- package/dist/src/doctor.js +0 -1
- package/dist/src/doctor.test.js +1 -1
- package/dist/src/engine.test.js +10 -10
- package/dist/src/execution.js +1 -1
- package/dist/src/execution.test.js +9 -9
- package/dist/src/help.d.ts +15 -0
- package/dist/src/help.js +149 -0
- package/dist/src/main.js +13 -7
- package/dist/src/manifest-types.d.ts +2 -0
- package/dist/src/plugin.test.js +26 -26
- package/dist/src/registry.d.ts +5 -0
- package/dist/src/registry.js +8 -0
- package/dist/src/registry.test.js +27 -20
- package/dist/src/serialization.d.ts +4 -0
- package/dist/src/serialization.js +27 -1
- package/dist/src/serialization.test.js +24 -2
- package/dist/src/types.d.ts +2 -0
- package/package.json +4 -1
- package/scripts/check-listing-id-pairing.mjs +193 -0
- package/scripts/check-silent-column-drop.mjs +105 -0
- package/scripts/check-typed-error-lint.mjs +118 -0
- package/scripts/silent-column-drop-baseline.json +962 -0
- package/scripts/typed-error-lint-baseline.json +1586 -0
package/clis/sinablog/hot.js
CHANGED
package/clis/sinablog/search.js
CHANGED
package/clis/sinablog/user.js
CHANGED
package/clis/sinafinance/news.js
CHANGED
package/clis/smzdm/search.js
CHANGED
package/clis/spotify/spotify.js
CHANGED
|
@@ -106,6 +106,7 @@ function openBrowser(url) {
|
|
|
106
106
|
cli({
|
|
107
107
|
site: 'spotify',
|
|
108
108
|
name: 'auth',
|
|
109
|
+
access: 'write',
|
|
109
110
|
description: 'Authenticate with Spotify (OAuth — run once)',
|
|
110
111
|
strategy: Strategy.PUBLIC,
|
|
111
112
|
browser: false,
|
|
@@ -172,6 +173,7 @@ cli({
|
|
|
172
173
|
cli({
|
|
173
174
|
site: 'spotify',
|
|
174
175
|
name: 'status',
|
|
176
|
+
access: 'read',
|
|
175
177
|
description: 'Show current playback status',
|
|
176
178
|
strategy: Strategy.PUBLIC,
|
|
177
179
|
browser: false,
|
|
@@ -193,6 +195,7 @@ cli({
|
|
|
193
195
|
cli({
|
|
194
196
|
site: 'spotify',
|
|
195
197
|
name: 'play',
|
|
198
|
+
access: 'write',
|
|
196
199
|
description: 'Resume playback or search and play a track/artist',
|
|
197
200
|
strategy: Strategy.PUBLIC,
|
|
198
201
|
browser: false,
|
|
@@ -211,6 +214,7 @@ cli({
|
|
|
211
214
|
cli({
|
|
212
215
|
site: 'spotify',
|
|
213
216
|
name: 'pause',
|
|
217
|
+
access: 'write',
|
|
214
218
|
description: 'Pause playback',
|
|
215
219
|
strategy: Strategy.PUBLIC,
|
|
216
220
|
browser: false,
|
|
@@ -221,6 +225,7 @@ cli({
|
|
|
221
225
|
cli({
|
|
222
226
|
site: 'spotify',
|
|
223
227
|
name: 'next',
|
|
228
|
+
access: 'write',
|
|
224
229
|
description: 'Skip to next track',
|
|
225
230
|
strategy: Strategy.PUBLIC,
|
|
226
231
|
browser: false,
|
|
@@ -231,6 +236,7 @@ cli({
|
|
|
231
236
|
cli({
|
|
232
237
|
site: 'spotify',
|
|
233
238
|
name: 'prev',
|
|
239
|
+
access: 'write',
|
|
234
240
|
description: 'Skip to previous track',
|
|
235
241
|
strategy: Strategy.PUBLIC,
|
|
236
242
|
browser: false,
|
|
@@ -241,6 +247,7 @@ cli({
|
|
|
241
247
|
cli({
|
|
242
248
|
site: 'spotify',
|
|
243
249
|
name: 'volume',
|
|
250
|
+
access: 'write',
|
|
244
251
|
description: 'Set playback volume (0-100)',
|
|
245
252
|
strategy: Strategy.PUBLIC,
|
|
246
253
|
browser: false,
|
|
@@ -257,6 +264,7 @@ cli({
|
|
|
257
264
|
cli({
|
|
258
265
|
site: 'spotify',
|
|
259
266
|
name: 'search',
|
|
267
|
+
access: 'read',
|
|
260
268
|
description: 'Search for tracks',
|
|
261
269
|
strategy: Strategy.PUBLIC,
|
|
262
270
|
browser: false,
|
|
@@ -277,6 +285,7 @@ cli({
|
|
|
277
285
|
cli({
|
|
278
286
|
site: 'spotify',
|
|
279
287
|
name: 'queue',
|
|
288
|
+
access: 'write',
|
|
280
289
|
description: 'Add a track to the playback queue',
|
|
281
290
|
strategy: Strategy.PUBLIC,
|
|
282
291
|
browser: false,
|
|
@@ -291,6 +300,7 @@ cli({
|
|
|
291
300
|
cli({
|
|
292
301
|
site: 'spotify',
|
|
293
302
|
name: 'shuffle',
|
|
303
|
+
access: 'write',
|
|
294
304
|
description: 'Toggle shuffle on/off',
|
|
295
305
|
strategy: Strategy.PUBLIC,
|
|
296
306
|
browser: false,
|
|
@@ -304,6 +314,7 @@ cli({
|
|
|
304
314
|
cli({
|
|
305
315
|
site: 'spotify',
|
|
306
316
|
name: 'repeat',
|
|
317
|
+
access: 'write',
|
|
307
318
|
description: 'Set repeat mode (off / track / context)',
|
|
308
319
|
strategy: Strategy.PUBLIC,
|
|
309
320
|
browser: false,
|
|
@@ -2,6 +2,7 @@ import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
|
2
2
|
cli({
|
|
3
3
|
site: 'stackoverflow',
|
|
4
4
|
name: 'bounties',
|
|
5
|
+
access: 'read',
|
|
5
6
|
description: 'Active bounties on Stack Overflow',
|
|
6
7
|
domain: 'stackoverflow.com',
|
|
7
8
|
strategy: Strategy.PUBLIC,
|
|
@@ -9,17 +10,24 @@ cli({
|
|
|
9
10
|
args: [
|
|
10
11
|
{ name: 'limit', type: 'int', default: 10, help: 'Max number of results' },
|
|
11
12
|
],
|
|
12
|
-
columns: ['bounty', 'title', 'score', 'answers', 'url'],
|
|
13
|
+
columns: ['rank', 'id', 'bounty', 'title', 'score', 'answers', 'views', 'is_answered', 'tags', 'author', 'creation_date', 'url'],
|
|
13
14
|
pipeline: [
|
|
14
15
|
{ fetch: {
|
|
15
|
-
url: 'https://api.stackexchange.com/2.3/questions/featured?order=desc&sort=activity&site=stackoverflow',
|
|
16
|
+
url: 'https://api.stackexchange.com/2.3/questions/featured?order=desc&sort=activity&site=stackoverflow&pagesize=${{ args.limit }}',
|
|
16
17
|
} },
|
|
17
18
|
{ select: 'items' },
|
|
18
19
|
{ map: {
|
|
19
|
-
|
|
20
|
+
rank: '${{ index + 1 }}',
|
|
21
|
+
id: '${{ item.question_id }}',
|
|
20
22
|
bounty: '${{ item.bounty_amount }}',
|
|
23
|
+
title: '${{ item.title }}',
|
|
21
24
|
score: '${{ item.score }}',
|
|
22
25
|
answers: '${{ item.answer_count }}',
|
|
26
|
+
views: '${{ item.view_count }}',
|
|
27
|
+
is_answered: '${{ item.is_answered }}',
|
|
28
|
+
tags: `\${{ item.tags | join(', ') }}`,
|
|
29
|
+
author: '${{ item.owner.display_name }}',
|
|
30
|
+
creation_date: '${{ item.creation_date }}',
|
|
23
31
|
url: '${{ item.link }}',
|
|
24
32
|
} },
|
|
25
33
|
{ limit: '${{ args.limit }}' },
|
|
@@ -2,6 +2,7 @@ import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
|
2
2
|
cli({
|
|
3
3
|
site: 'stackoverflow',
|
|
4
4
|
name: 'hot',
|
|
5
|
+
access: 'read',
|
|
5
6
|
description: 'Hot Stack Overflow questions',
|
|
6
7
|
domain: 'stackoverflow.com',
|
|
7
8
|
strategy: Strategy.PUBLIC,
|
|
@@ -9,14 +10,21 @@ cli({
|
|
|
9
10
|
args: [
|
|
10
11
|
{ name: 'limit', type: 'int', default: 10, help: 'Max number of results' },
|
|
11
12
|
],
|
|
12
|
-
columns: ['title', 'score', 'answers', 'url'],
|
|
13
|
+
columns: ['rank', 'id', 'title', 'score', 'answers', 'views', 'is_answered', 'tags', 'author', 'creation_date', 'url'],
|
|
13
14
|
pipeline: [
|
|
14
|
-
{ fetch: { url: 'https://api.stackexchange.com/2.3/questions?order=desc&sort=hot&site=stackoverflow' } },
|
|
15
|
+
{ fetch: { url: 'https://api.stackexchange.com/2.3/questions?order=desc&sort=hot&site=stackoverflow&pagesize=${{ args.limit }}' } },
|
|
15
16
|
{ select: 'items' },
|
|
16
17
|
{ map: {
|
|
18
|
+
rank: '${{ index + 1 }}',
|
|
19
|
+
id: '${{ item.question_id }}',
|
|
17
20
|
title: '${{ item.title }}',
|
|
18
21
|
score: '${{ item.score }}',
|
|
19
22
|
answers: '${{ item.answer_count }}',
|
|
23
|
+
views: '${{ item.view_count }}',
|
|
24
|
+
is_answered: '${{ item.is_answered }}',
|
|
25
|
+
tags: `\${{ item.tags | join(', ') }}`,
|
|
26
|
+
author: '${{ item.owner.display_name }}',
|
|
27
|
+
creation_date: '${{ item.creation_date }}',
|
|
20
28
|
url: '${{ item.link }}',
|
|
21
29
|
} },
|
|
22
30
|
{ limit: '${{ args.limit }}' },
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stack Overflow question reader.
|
|
3
|
+
*
|
|
4
|
+
* Hits the public Stack Exchange API:
|
|
5
|
+
* GET /questions/{id}?site=stackoverflow&filter=withbody
|
|
6
|
+
* GET /questions/{id}/answers?site=stackoverflow&filter=withbody
|
|
7
|
+
* GET /questions/{id}/comments?site=stackoverflow&filter=withbody
|
|
8
|
+
* GET /answers/{a1;a2;...}/comments?site=stackoverflow&filter=withbody
|
|
9
|
+
*
|
|
10
|
+
* Three calls are needed because comments under answers are not bundled in
|
|
11
|
+
* the answers payload. We batch all answer-comment fetches into a single
|
|
12
|
+
* semicolon-joined call. SO has its own quota (300/day for unauthenticated
|
|
13
|
+
* IP), but a `read` consumes at most 4 quota units, or 5 when the accepted
|
|
14
|
+
* answer is missing from the requested answer page and must be fetched by id.
|
|
15
|
+
*
|
|
16
|
+
* Output rows mirror `hackernews read` and `lobsters read`:
|
|
17
|
+
* - first row is the question itself (`type=POST`)
|
|
18
|
+
* - one row per top-level question comment (`type=Q-COMMENT`)
|
|
19
|
+
* - per answer: an `ANSWER` row plus its `A-COMMENT` rows indented under it
|
|
20
|
+
* - the accepted answer (if any) is surfaced first and tagged `accepted=true`
|
|
21
|
+
*/
|
|
22
|
+
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
23
|
+
import { ArgumentError, CommandExecutionError, EmptyResultError } from '@jackwener/opencli/errors';
|
|
24
|
+
|
|
25
|
+
const SE_API_BASE = 'https://api.stackexchange.com/2.3';
|
|
26
|
+
const SE_SITE = 'stackoverflow';
|
|
27
|
+
const SE_MAX_PAGE_SIZE = 100;
|
|
28
|
+
|
|
29
|
+
async function fetchJson(url, label) {
|
|
30
|
+
let res;
|
|
31
|
+
try {
|
|
32
|
+
res = await fetch(url);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
const detail = e instanceof Error ? e.message : String(e);
|
|
35
|
+
throw new CommandExecutionError(
|
|
36
|
+
`Network failure fetching ${label}: ${detail}`,
|
|
37
|
+
'Check connectivity to api.stackexchange.com',
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
if (res.status === 404) {
|
|
41
|
+
throw new EmptyResultError(label, `${label} not found`);
|
|
42
|
+
}
|
|
43
|
+
if (!res.ok) {
|
|
44
|
+
throw new CommandExecutionError(
|
|
45
|
+
`Stack Exchange API HTTP ${res.status} for ${label}`,
|
|
46
|
+
'Check the question id and quota (300/day per IP)',
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
let json;
|
|
50
|
+
try {
|
|
51
|
+
json = await res.json();
|
|
52
|
+
} catch (e) {
|
|
53
|
+
const detail = e instanceof Error ? e.message : String(e);
|
|
54
|
+
throw new CommandExecutionError(
|
|
55
|
+
`Malformed JSON from Stack Exchange API for ${label}: ${detail}`,
|
|
56
|
+
'The API returned a non-JSON body — likely a transient outage',
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
if (json && json.error_id) {
|
|
60
|
+
throw new CommandExecutionError(
|
|
61
|
+
`Stack Exchange API error ${json.error_id} (${json.error_name}) for ${label}: ${json.error_message || ''}`,
|
|
62
|
+
'Common causes: invalid filter, throttled, or quota exhausted',
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return json;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* CLI args may arrive as strings (`--limit 5` → `'5'`) when not coerced by the
|
|
70
|
+
* arg type system. Coerce-then-validate so `Number.isInteger` actually catches
|
|
71
|
+
* the bad cases, and reject NaN explicitly.
|
|
72
|
+
*/
|
|
73
|
+
function coerceInt(value) {
|
|
74
|
+
if (value === undefined || value === null || value === '') return NaN;
|
|
75
|
+
const n = typeof value === 'number' ? value : Number(value);
|
|
76
|
+
return Number.isFinite(n) && Number.isInteger(n) ? n : NaN;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function requireMinInt(value, min, label) {
|
|
80
|
+
const n = coerceInt(value);
|
|
81
|
+
if (!Number.isInteger(n) || n < min) {
|
|
82
|
+
throw new ArgumentError(`${label} must be an integer >= ${min}, got ${JSON.stringify(value)}`);
|
|
83
|
+
}
|
|
84
|
+
return n;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function requireBoundedInt(value, min, max, label) {
|
|
88
|
+
const n = coerceInt(value);
|
|
89
|
+
if (!Number.isInteger(n) || n < min || n > max) {
|
|
90
|
+
throw new ArgumentError(`${label} must be an integer between ${min} and ${max}, got ${JSON.stringify(value)}`);
|
|
91
|
+
}
|
|
92
|
+
return n;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function byAcceptedThenScoreDesc(question, answers) {
|
|
96
|
+
const acceptedAnswerId = question.accepted_answer_id;
|
|
97
|
+
return answers
|
|
98
|
+
.slice()
|
|
99
|
+
.sort((a, b) => {
|
|
100
|
+
const aAccepted = a.is_accepted || (acceptedAnswerId && a.answer_id === acceptedAnswerId);
|
|
101
|
+
const bAccepted = b.is_accepted || (acceptedAnswerId && b.answer_id === acceptedAnswerId);
|
|
102
|
+
if (aAccepted !== bAccepted) return aAccepted ? -1 : 1;
|
|
103
|
+
return (b.score ?? 0) - (a.score ?? 0);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async function fetchMissingAcceptedAnswer(question, answers, label) {
|
|
108
|
+
const acceptedAnswerId = question.accepted_answer_id;
|
|
109
|
+
if (!acceptedAnswerId || answers.some((answer) => answer.answer_id === acceptedAnswerId)) {
|
|
110
|
+
return answers;
|
|
111
|
+
}
|
|
112
|
+
const acceptedData = await fetchJson(
|
|
113
|
+
`${SE_API_BASE}/answers/${acceptedAnswerId}?site=${SE_SITE}&filter=withbody`,
|
|
114
|
+
`${label}/accepted-answer`,
|
|
115
|
+
);
|
|
116
|
+
const accepted = (acceptedData.items || [])[0];
|
|
117
|
+
return accepted ? answers.concat(accepted) : answers;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async function fetchAnswerCommentsByAnswerId(answers, commentsLimit, label) {
|
|
121
|
+
const answerCommentsByAnswerId = new Map();
|
|
122
|
+
if (answers.length === 0) return answerCommentsByAnswerId;
|
|
123
|
+
|
|
124
|
+
const ids = answers.map((a) => a.answer_id).join(';');
|
|
125
|
+
const pageSize = Math.min(SE_MAX_PAGE_SIZE, answers.length * commentsLimit);
|
|
126
|
+
const ansCommentsData = await fetchJson(
|
|
127
|
+
`${SE_API_BASE}/answers/${ids}/comments?site=${SE_SITE}&filter=withbody&order=asc&sort=creation&pagesize=${pageSize}`,
|
|
128
|
+
`${label}/answer-comments`,
|
|
129
|
+
);
|
|
130
|
+
for (const c of ansCommentsData.items || []) {
|
|
131
|
+
if (!c.post_id) continue;
|
|
132
|
+
if (!answerCommentsByAnswerId.has(c.post_id)) {
|
|
133
|
+
answerCommentsByAnswerId.set(c.post_id, []);
|
|
134
|
+
}
|
|
135
|
+
answerCommentsByAnswerId.get(c.post_id).push(c);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (ansCommentsData.has_more) {
|
|
139
|
+
const missingForSelectedAnswer = answers.some((answer) => {
|
|
140
|
+
const comments = answerCommentsByAnswerId.get(answer.answer_id) || [];
|
|
141
|
+
return comments.length < commentsLimit;
|
|
142
|
+
});
|
|
143
|
+
if (missingForSelectedAnswer) {
|
|
144
|
+
throw new CommandExecutionError(
|
|
145
|
+
`Stack Exchange answer comments for ${label} exceed one API page`,
|
|
146
|
+
'Lower --answers-limit or --comments-limit; refusing to return a partial answer-comment set.',
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return answerCommentsByAnswerId;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const NAMED_ENTITIES = {
|
|
155
|
+
amp: '&', lt: '<', gt: '>', quot: '"', apos: "'", nbsp: ' ',
|
|
156
|
+
hellip: '…', mdash: '—', ndash: '–', laquo: '«', raquo: '»',
|
|
157
|
+
copy: '©', reg: '®', trade: '™', euro: '€', pound: '£', yen: '¥',
|
|
158
|
+
rsquo: '’', lsquo: '‘', rdquo: '”', ldquo: '“',
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/** Decode named/numeric HTML entities. Used on both body HTML and display names. */
|
|
162
|
+
function decodeEntities(text) {
|
|
163
|
+
if (!text) return '';
|
|
164
|
+
return String(text)
|
|
165
|
+
.replace(/&#x([0-9a-fA-F]+);/g, (_, hex) => {
|
|
166
|
+
const code = parseInt(hex, 16);
|
|
167
|
+
return Number.isFinite(code) ? String.fromCodePoint(code) : '';
|
|
168
|
+
})
|
|
169
|
+
.replace(/&#(\d+);/g, (_, dec) => {
|
|
170
|
+
const code = parseInt(dec, 10);
|
|
171
|
+
return Number.isFinite(code) ? String.fromCodePoint(code) : '';
|
|
172
|
+
})
|
|
173
|
+
.replace(/&([a-zA-Z]+);/g, (match, name) => NAMED_ENTITIES[name] ?? match);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** SO renders bodies as HTML — convert to plain text similar to HN/lobsters. */
|
|
177
|
+
function htmlToText(html) {
|
|
178
|
+
if (!html) return '';
|
|
179
|
+
const stripped = String(html)
|
|
180
|
+
.replace(/<pre[^>]*><code[^>]*>([\s\S]*?)<\/code><\/pre>/gi, '\n$1\n')
|
|
181
|
+
.replace(/<code[^>]*>(.*?)<\/code>/gi, '`$1`')
|
|
182
|
+
.replace(/<p[^>]*>/gi, '\n\n')
|
|
183
|
+
.replace(/<\/p>/gi, '')
|
|
184
|
+
.replace(/<br\s*\/?>/gi, '\n')
|
|
185
|
+
.replace(/<li[^>]*>/gi, '\n- ')
|
|
186
|
+
.replace(/<\/li>/gi, '')
|
|
187
|
+
.replace(/<a[^>]*href="([^"]*)"[^>]*>(.*?)<\/a>/gi, '$2 ($1)')
|
|
188
|
+
.replace(/<[^>]+>/g, '');
|
|
189
|
+
return decodeEntities(stripped)
|
|
190
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
191
|
+
.trim();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function authorName(owner) {
|
|
195
|
+
return decodeEntities(owner?.display_name || '') || '[deleted]';
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function truncate(text, maxLength) {
|
|
199
|
+
if (!text || text.length <= maxLength) return text || '';
|
|
200
|
+
return text.slice(0, maxLength) + ' ... [truncated]';
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function indentLines(text, depth) {
|
|
204
|
+
if (depth === 0) return text;
|
|
205
|
+
const indent = ' '.repeat(depth);
|
|
206
|
+
const prefix = `${indent}> `;
|
|
207
|
+
return text.split('\n').map((line) => prefix + line).join('\n');
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
cli({
|
|
211
|
+
site: 'stackoverflow',
|
|
212
|
+
name: 'read',
|
|
213
|
+
access: 'read',
|
|
214
|
+
description: 'Read a Stack Overflow question with answers and comments',
|
|
215
|
+
domain: 'stackoverflow.com',
|
|
216
|
+
strategy: Strategy.PUBLIC,
|
|
217
|
+
browser: false,
|
|
218
|
+
args: [
|
|
219
|
+
{ name: 'id', required: true, positional: true, help: 'Stack Overflow question id (numeric, e.g. 79935770)' },
|
|
220
|
+
{ name: 'answers-limit', type: 'int', default: 10, help: 'Max answers to include (1-100; accepted answer always included first)' },
|
|
221
|
+
{ name: 'comments-limit', type: 'int', default: 5, help: 'Max comments per question/answer (1-100)' },
|
|
222
|
+
{ name: 'max-length', type: 'int', default: 4000, help: 'Max characters per body / answer / comment (min 100)' },
|
|
223
|
+
],
|
|
224
|
+
columns: ['type', 'author', 'score', 'accepted', 'text'],
|
|
225
|
+
func: async (args) => {
|
|
226
|
+
const id = String(args.id || '').trim();
|
|
227
|
+
if (!/^\d+$/.test(id)) {
|
|
228
|
+
throw new ArgumentError(`Invalid Stack Overflow question id: ${args.id}`, 'Pass a numeric id like 79935770');
|
|
229
|
+
}
|
|
230
|
+
const answersLimit = requireBoundedInt(args['answers-limit'] ?? 10, 1, SE_MAX_PAGE_SIZE, 'stackoverflow read --answers-limit');
|
|
231
|
+
const commentsLimit = requireBoundedInt(args['comments-limit'] ?? 5, 1, SE_MAX_PAGE_SIZE, 'stackoverflow read --comments-limit');
|
|
232
|
+
const maxLength = requireMinInt(args['max-length'] ?? 4000, 100, 'stackoverflow read --max-length');
|
|
233
|
+
|
|
234
|
+
const label = `stackoverflow/${id}`;
|
|
235
|
+
const qUrl = `${SE_API_BASE}/questions/${id}?site=${SE_SITE}&filter=withbody`;
|
|
236
|
+
const qData = await fetchJson(qUrl, label);
|
|
237
|
+
const question = (qData.items || [])[0];
|
|
238
|
+
if (!question) {
|
|
239
|
+
throw new EmptyResultError(label, 'Question not found');
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Fetch question comments and answers in parallel.
|
|
243
|
+
const [qCommentsData, answersData] = await Promise.all([
|
|
244
|
+
fetchJson(
|
|
245
|
+
`${SE_API_BASE}/questions/${id}/comments?site=${SE_SITE}&filter=withbody&order=asc&sort=creation&pagesize=${commentsLimit}`,
|
|
246
|
+
`${label}/comments`,
|
|
247
|
+
),
|
|
248
|
+
fetchJson(
|
|
249
|
+
`${SE_API_BASE}/questions/${id}/answers?site=${SE_SITE}&filter=withbody&order=desc&sort=votes&pagesize=${answersLimit}`,
|
|
250
|
+
`${label}/answers`,
|
|
251
|
+
),
|
|
252
|
+
]);
|
|
253
|
+
|
|
254
|
+
const allAnswers = await fetchMissingAcceptedAnswer(question, answersData.items || [], label);
|
|
255
|
+
// Surface accepted answer first, then by score order.
|
|
256
|
+
const orderedAnswers = byAcceptedThenScoreDesc(question, allAnswers).slice(0, answersLimit);
|
|
257
|
+
|
|
258
|
+
const answerCommentsByAnswerId = await fetchAnswerCommentsByAnswerId(orderedAnswers, commentsLimit, label);
|
|
259
|
+
|
|
260
|
+
const rows = [];
|
|
261
|
+
|
|
262
|
+
// POST row: question
|
|
263
|
+
const qBody = htmlToText(question.body || '');
|
|
264
|
+
const qTextParts = [
|
|
265
|
+
question.title || '',
|
|
266
|
+
qBody,
|
|
267
|
+
question.link || '',
|
|
268
|
+
].filter(Boolean);
|
|
269
|
+
rows.push({
|
|
270
|
+
type: 'POST',
|
|
271
|
+
author: authorName(question.owner),
|
|
272
|
+
score: question.score ?? 0,
|
|
273
|
+
accepted: '',
|
|
274
|
+
text: truncate(qTextParts.join('\n\n'), maxLength),
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
// Q-COMMENT rows
|
|
278
|
+
const qComments = (qCommentsData.items || []).slice(0, commentsLimit);
|
|
279
|
+
for (const c of qComments) {
|
|
280
|
+
const text = indentLines(htmlToText(c.body || ''), 1);
|
|
281
|
+
rows.push({
|
|
282
|
+
type: 'Q-COMMENT',
|
|
283
|
+
author: authorName(c.owner),
|
|
284
|
+
score: c.score ?? 0,
|
|
285
|
+
accepted: '',
|
|
286
|
+
text: truncate(text, maxLength),
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// ANSWER + A-COMMENT rows
|
|
291
|
+
for (const ans of orderedAnswers) {
|
|
292
|
+
rows.push({
|
|
293
|
+
type: 'ANSWER',
|
|
294
|
+
author: authorName(ans.owner),
|
|
295
|
+
score: ans.score ?? 0,
|
|
296
|
+
accepted: ans.is_accepted ? 'true' : '',
|
|
297
|
+
text: truncate(htmlToText(ans.body || ''), maxLength),
|
|
298
|
+
});
|
|
299
|
+
const ansComments = (answerCommentsByAnswerId.get(ans.answer_id) || []).slice(0, commentsLimit);
|
|
300
|
+
for (const c of ansComments) {
|
|
301
|
+
const text = indentLines(htmlToText(c.body || ''), 1);
|
|
302
|
+
rows.push({
|
|
303
|
+
type: 'A-COMMENT',
|
|
304
|
+
author: authorName(c.owner),
|
|
305
|
+
score: c.score ?? 0,
|
|
306
|
+
accepted: '',
|
|
307
|
+
text: truncate(text, maxLength),
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return rows;
|
|
313
|
+
},
|
|
314
|
+
});
|
|
@@ -2,6 +2,7 @@ import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
|
2
2
|
cli({
|
|
3
3
|
site: 'stackoverflow',
|
|
4
4
|
name: 'search',
|
|
5
|
+
access: 'read',
|
|
5
6
|
description: 'Search Stack Overflow questions',
|
|
6
7
|
domain: 'stackoverflow.com',
|
|
7
8
|
strategy: Strategy.PUBLIC,
|
|
@@ -10,16 +11,23 @@ cli({
|
|
|
10
11
|
{ name: 'query', type: 'string', required: true, positional: true, help: 'Search query' },
|
|
11
12
|
{ name: 'limit', type: 'int', default: 10, help: 'Max number of results' },
|
|
12
13
|
],
|
|
13
|
-
columns: ['title', 'score', 'answers', 'url'],
|
|
14
|
+
columns: ['rank', 'id', 'title', 'score', 'answers', 'views', 'is_answered', 'tags', 'author', 'creation_date', 'url'],
|
|
14
15
|
pipeline: [
|
|
15
16
|
{ fetch: {
|
|
16
|
-
url: 'https://api.stackexchange.com/2.3/search/advanced?order=desc&sort=relevance&q=${{ args.query }}&site=stackoverflow',
|
|
17
|
+
url: 'https://api.stackexchange.com/2.3/search/advanced?order=desc&sort=relevance&q=${{ args.query }}&site=stackoverflow&pagesize=${{ args.limit }}',
|
|
17
18
|
} },
|
|
18
19
|
{ select: 'items' },
|
|
19
20
|
{ map: {
|
|
21
|
+
rank: '${{ index + 1 }}',
|
|
22
|
+
id: '${{ item.question_id }}',
|
|
20
23
|
title: '${{ item.title }}',
|
|
21
24
|
score: '${{ item.score }}',
|
|
22
25
|
answers: '${{ item.answer_count }}',
|
|
26
|
+
views: '${{ item.view_count }}',
|
|
27
|
+
is_answered: '${{ item.is_answered }}',
|
|
28
|
+
tags: `\${{ item.tags | join(', ') }}`,
|
|
29
|
+
author: '${{ item.owner.display_name }}',
|
|
30
|
+
creation_date: '${{ item.creation_date }}',
|
|
23
31
|
url: '${{ item.link }}',
|
|
24
32
|
} },
|
|
25
33
|
{ limit: '${{ args.limit }}' },
|