@jackwener/opencli 1.1.0 → 1.2.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.
- package/.agents/skills/cross-project-adapter-migration/SKILL.md +2 -2
- package/.github/pull_request_template.md +7 -0
- package/.github/workflows/doc-check.yml +36 -0
- package/.github/workflows/docs.yml +7 -42
- package/CHANGELOG.md +23 -0
- package/CLI-EXPLORER.md +9 -8
- package/CONTRIBUTING.md +39 -1
- package/README.md +33 -19
- package/README.zh-CN.md +64 -27
- package/SKILL.md +102 -33
- package/dist/browser/cdp.d.ts +4 -4
- package/dist/browser/cdp.js +45 -17
- package/dist/browser/daemon-client.d.ts +2 -1
- package/dist/browser/dom-helpers.js +38 -7
- package/dist/browser/dom-snapshot.d.ts +86 -0
- package/dist/browser/dom-snapshot.js +729 -0
- package/dist/browser/dom-snapshot.test.d.ts +11 -0
- package/dist/browser/dom-snapshot.test.js +212 -0
- package/dist/browser/index.d.ts +2 -0
- package/dist/browser/index.js +1 -0
- package/dist/browser/page.d.ts +18 -25
- package/dist/browser/page.js +44 -5
- package/dist/build-manifest.d.ts +11 -4
- package/dist/build-manifest.js +79 -34
- package/dist/build-manifest.test.js +58 -2
- package/dist/cli-manifest.json +4273 -1771
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +255 -162
- package/dist/clis/apple-podcasts/commands.test.d.ts +2 -0
- package/dist/clis/apple-podcasts/commands.test.js +76 -0
- package/dist/clis/apple-podcasts/search.js +2 -2
- package/dist/clis/apple-podcasts/top.js +9 -2
- package/dist/clis/arxiv/search.js +1 -1
- package/dist/clis/barchart/greeks.js +1 -1
- package/dist/clis/barchart/options.js +1 -1
- package/dist/clis/barchart/quote.js +1 -1
- package/dist/clis/bilibili/download.js +1 -1
- package/dist/clis/bilibili/dynamic.js +1 -1
- package/dist/clis/bilibili/favorite.js +1 -1
- package/dist/clis/bilibili/feed.js +1 -1
- package/dist/clis/bilibili/following.js +2 -2
- package/dist/clis/bilibili/history.js +1 -1
- package/dist/clis/bilibili/me.js +1 -1
- package/dist/clis/bilibili/ranking.js +1 -1
- package/dist/clis/bilibili/search.js +3 -3
- package/dist/clis/bilibili/subtitle.js +2 -2
- package/dist/clis/bilibili/user-videos.js +2 -2
- package/dist/{bilibili.d.ts → clis/bilibili/utils.d.ts} +1 -1
- package/dist/clis/bloomberg/businessweek.js +17 -0
- package/dist/clis/bloomberg/economics.js +17 -0
- package/dist/clis/bloomberg/feeds.d.ts +1 -0
- package/dist/clis/bloomberg/feeds.js +15 -0
- package/dist/clis/bloomberg/industries.d.ts +1 -0
- package/dist/clis/bloomberg/industries.js +17 -0
- package/dist/clis/bloomberg/main.d.ts +1 -0
- package/dist/clis/bloomberg/main.js +17 -0
- package/dist/clis/bloomberg/markets.d.ts +1 -0
- package/dist/clis/bloomberg/markets.js +17 -0
- package/dist/clis/bloomberg/news.d.ts +1 -0
- package/dist/clis/bloomberg/news.js +105 -0
- package/dist/clis/bloomberg/opinions.d.ts +1 -0
- package/dist/clis/bloomberg/opinions.js +17 -0
- package/dist/clis/bloomberg/politics.d.ts +1 -0
- package/dist/clis/bloomberg/politics.js +17 -0
- package/dist/clis/bloomberg/tech.d.ts +1 -0
- package/dist/clis/bloomberg/tech.js +17 -0
- package/dist/clis/bloomberg/utils.d.ts +34 -0
- package/dist/clis/bloomberg/utils.js +364 -0
- package/dist/clis/bloomberg/utils.test.d.ts +1 -0
- package/dist/clis/bloomberg/utils.test.js +129 -0
- package/dist/clis/boss/batchgreet.js +12 -99
- package/dist/clis/boss/chatlist.js +9 -26
- package/dist/clis/boss/chatmsg.js +11 -42
- package/dist/clis/boss/common.d.ts +92 -0
- package/dist/clis/boss/common.js +223 -0
- package/dist/clis/boss/detail.js +8 -50
- package/dist/clis/boss/exchange.js +13 -79
- package/dist/clis/boss/greet.js +20 -147
- package/dist/clis/boss/invite.js +26 -121
- package/dist/clis/boss/joblist.js +6 -31
- package/dist/clis/boss/mark.js +12 -85
- package/dist/clis/boss/recommend.js +10 -49
- package/dist/clis/boss/resume.js +18 -118
- package/dist/clis/boss/search.js +13 -61
- package/dist/clis/boss/send.js +18 -152
- package/dist/clis/boss/stats.js +20 -71
- package/dist/clis/chaoxing/assignments.js +1 -1
- package/dist/clis/chaoxing/exams.js +1 -1
- package/dist/{chaoxing.d.ts → clis/chaoxing/utils.d.ts} +1 -1
- package/dist/{chaoxing.js → clis/chaoxing/utils.js} +0 -2
- package/dist/clis/chaoxing/utils.test.d.ts +1 -0
- package/dist/{chaoxing.test.js → clis/chaoxing/utils.test.js} +1 -1
- package/dist/clis/chatgpt/read.js +1 -1
- package/dist/clis/chatwise/export.js +1 -1
- package/dist/clis/chatwise/model.js +2 -2
- package/dist/clis/chatwise/screenshot.js +1 -1
- package/dist/clis/codex/export.js +1 -1
- package/dist/clis/codex/model.js +2 -2
- package/dist/clis/codex/screenshot.js +1 -1
- package/dist/clis/coupang/add-to-cart.js +3 -4
- package/dist/clis/coupang/search.js +2 -4
- package/dist/clis/coupang/utils.test.d.ts +1 -0
- package/dist/{coupang.test.js → clis/coupang/utils.test.js} +1 -1
- package/dist/clis/ctrip/search.js +1 -1
- package/dist/clis/cursor/export.js +1 -1
- package/dist/clis/cursor/model.js +2 -2
- package/dist/clis/cursor/screenshot.js +1 -1
- package/dist/clis/devto/tag.yaml +34 -0
- package/dist/clis/devto/top.yaml +29 -0
- package/dist/clis/devto/user.yaml +33 -0
- package/dist/clis/douban/book-hot.d.ts +1 -0
- package/dist/clis/douban/book-hot.js +14 -0
- package/dist/clis/douban/marks.d.ts +1 -0
- package/dist/clis/douban/marks.js +115 -0
- package/dist/clis/douban/movie-hot.d.ts +1 -0
- package/dist/clis/douban/movie-hot.js +14 -0
- package/dist/clis/douban/reviews.d.ts +1 -0
- package/dist/clis/douban/reviews.js +106 -0
- package/dist/clis/douban/search.d.ts +1 -0
- package/dist/clis/douban/search.js +16 -0
- package/dist/clis/douban/shared.d.ts +4 -0
- package/dist/clis/douban/shared.js +155 -0
- package/dist/clis/douban/subject.yaml +76 -0
- package/dist/clis/douban/top250.yaml +70 -0
- package/dist/clis/douban/utils.d.ts +35 -0
- package/dist/clis/douban/utils.js +48 -0
- package/dist/clis/facebook/add-friend.yaml +43 -0
- package/dist/clis/facebook/events.yaml +44 -0
- package/dist/clis/facebook/feed.yaml +63 -0
- package/dist/clis/facebook/friends.yaml +42 -0
- package/dist/clis/facebook/groups.yaml +50 -0
- package/dist/clis/facebook/join-group.yaml +44 -0
- package/dist/clis/facebook/memories.yaml +39 -0
- package/dist/clis/facebook/notifications.yaml +40 -0
- package/dist/clis/facebook/profile.yaml +37 -0
- package/dist/clis/facebook/search.yaml +46 -0
- package/dist/clis/google/news.d.ts +5 -0
- package/dist/clis/google/news.js +58 -0
- package/dist/clis/google/search.d.ts +10 -0
- package/dist/clis/google/search.js +127 -0
- package/dist/clis/google/suggest.d.ts +5 -0
- package/dist/clis/google/suggest.js +34 -0
- package/dist/clis/google/trends.d.ts +5 -0
- package/dist/clis/google/trends.js +38 -0
- package/dist/clis/google/utils.d.ts +9 -0
- package/dist/clis/google/utils.js +23 -0
- package/dist/clis/google/utils.test.d.ts +1 -0
- package/dist/clis/google/utils.test.js +75 -0
- package/dist/clis/grok/ask.d.ts +14 -0
- package/dist/clis/grok/ask.js +257 -65
- package/dist/clis/grok/ask.test.d.ts +1 -0
- package/dist/clis/grok/ask.test.js +36 -0
- package/dist/clis/instagram/comment.yaml +52 -0
- package/dist/clis/instagram/explore.yaml +43 -0
- package/dist/clis/instagram/follow.yaml +41 -0
- package/dist/clis/instagram/followers.yaml +51 -0
- package/dist/clis/instagram/following.yaml +51 -0
- package/dist/clis/instagram/like.yaml +46 -0
- package/dist/clis/instagram/profile.yaml +42 -0
- package/dist/clis/instagram/save.yaml +46 -0
- package/dist/clis/instagram/saved.yaml +40 -0
- package/dist/clis/instagram/search.yaml +43 -0
- package/dist/clis/instagram/unfollow.yaml +38 -0
- package/dist/clis/instagram/unlike.yaml +46 -0
- package/dist/clis/instagram/unsave.yaml +46 -0
- package/dist/clis/instagram/user.yaml +54 -0
- package/dist/clis/jike/comment.js +2 -3
- package/dist/clis/jike/create.js +1 -2
- package/dist/clis/jike/feed.js +0 -1
- package/dist/clis/jike/like.js +1 -2
- package/dist/clis/jike/notifications.js +0 -1
- package/dist/clis/jike/post.yaml +1 -0
- package/dist/clis/jike/repost.js +2 -3
- package/dist/clis/jike/search.js +2 -3
- package/dist/clis/jike/topic.yaml +1 -0
- package/dist/clis/jike/user.yaml +1 -0
- package/dist/clis/jimeng/generate.yaml +1 -0
- package/dist/clis/jimeng/history.yaml +0 -1
- package/dist/clis/linkedin/search.js +7 -7
- package/dist/clis/linux-do/category.yaml +2 -0
- package/dist/clis/linux-do/search.yaml +4 -3
- package/dist/clis/linux-do/topic.yaml +1 -0
- package/dist/clis/lobsters/active.yaml +29 -0
- package/dist/clis/lobsters/hot.yaml +29 -0
- package/dist/clis/lobsters/newest.yaml +29 -0
- package/dist/clis/lobsters/tag.yaml +34 -0
- package/dist/clis/medium/feed.d.ts +1 -0
- package/dist/clis/medium/feed.js +15 -0
- package/dist/clis/medium/search.d.ts +1 -0
- package/dist/clis/medium/search.js +15 -0
- package/dist/clis/medium/shared.d.ts +5 -0
- package/dist/clis/medium/shared.js +78 -0
- package/dist/clis/medium/user.d.ts +1 -0
- package/dist/clis/medium/user.js +15 -0
- package/dist/clis/notion/export.js +1 -1
- package/dist/clis/reddit/comment.js +3 -4
- package/dist/clis/reddit/read.js +4 -5
- package/dist/clis/reddit/save.js +2 -3
- package/dist/clis/reddit/saved.js +0 -1
- package/dist/clis/reddit/search.yaml +1 -0
- package/dist/clis/reddit/subreddit.yaml +1 -0
- package/dist/clis/reddit/subscribe.js +1 -2
- package/dist/clis/reddit/upvote.js +2 -3
- package/dist/clis/reddit/upvoted.js +0 -1
- package/dist/clis/reddit/user-comments.yaml +1 -0
- package/dist/clis/reddit/user-posts.yaml +1 -0
- package/dist/clis/reddit/user.yaml +1 -0
- package/dist/clis/reuters/search.js +1 -1
- package/dist/clis/sinablog/article.d.ts +1 -0
- package/dist/clis/sinablog/article.js +14 -0
- package/dist/clis/sinablog/hot.d.ts +1 -0
- package/dist/clis/sinablog/hot.js +14 -0
- package/dist/clis/sinablog/search.d.ts +1 -0
- package/dist/clis/sinablog/search.js +51 -0
- package/dist/clis/sinablog/shared.d.ts +7 -0
- package/dist/clis/sinablog/shared.js +187 -0
- package/dist/clis/sinablog/user.d.ts +1 -0
- package/dist/clis/sinablog/user.js +15 -0
- package/dist/clis/smzdm/search.js +2 -3
- package/dist/clis/stackoverflow/search.yaml +1 -0
- package/dist/clis/steam/top-sellers.yaml +29 -0
- package/dist/clis/substack/feed.d.ts +1 -0
- package/dist/clis/substack/feed.js +15 -0
- package/dist/clis/substack/publication.d.ts +1 -0
- package/dist/clis/substack/publication.js +15 -0
- package/dist/clis/substack/search.d.ts +1 -0
- package/dist/clis/substack/search.js +77 -0
- package/dist/clis/substack/shared.d.ts +4 -0
- package/dist/clis/substack/shared.js +129 -0
- package/dist/clis/tiktok/comment.yaml +66 -0
- package/dist/clis/tiktok/explore.yaml +39 -0
- package/dist/clis/tiktok/follow.yaml +39 -0
- package/dist/clis/tiktok/following.yaml +46 -0
- package/dist/clis/tiktok/friends.yaml +47 -0
- package/dist/clis/tiktok/like.yaml +38 -0
- package/dist/clis/tiktok/live.yaml +51 -0
- package/dist/clis/tiktok/notifications.yaml +52 -0
- package/dist/clis/tiktok/profile.yaml +45 -0
- package/dist/clis/tiktok/save.yaml +34 -0
- package/dist/clis/tiktok/search.yaml +46 -0
- package/dist/clis/tiktok/unfollow.yaml +44 -0
- package/dist/clis/tiktok/unlike.yaml +38 -0
- package/dist/clis/tiktok/unsave.yaml +36 -0
- package/dist/clis/tiktok/user.yaml +44 -0
- package/dist/clis/twitter/accept.js +2 -2
- package/dist/clis/twitter/article.js +2 -2
- package/dist/clis/twitter/block.d.ts +1 -0
- package/dist/clis/twitter/block.js +88 -0
- package/dist/clis/twitter/delete.js +1 -1
- package/dist/clis/twitter/download.d.ts +1 -1
- package/dist/clis/twitter/download.js +3 -3
- package/dist/clis/twitter/followers.js +1 -1
- package/dist/clis/twitter/following.js +1 -1
- package/dist/clis/twitter/hide-reply.d.ts +1 -0
- package/dist/clis/twitter/hide-reply.js +66 -0
- package/dist/clis/twitter/like.js +1 -1
- package/dist/clis/twitter/post.js +1 -1
- package/dist/clis/twitter/reply-dm.js +1 -1
- package/dist/clis/twitter/reply.js +2 -2
- package/dist/clis/twitter/search.js +1 -1
- package/dist/clis/twitter/thread.js +2 -2
- package/dist/clis/twitter/timeline.d.ts +23 -0
- package/dist/clis/twitter/timeline.js +42 -14
- package/dist/clis/twitter/timeline.test.d.ts +1 -0
- package/dist/clis/twitter/timeline.test.js +102 -0
- package/dist/clis/twitter/trending.d.ts +1 -0
- package/dist/clis/twitter/trending.js +91 -0
- package/dist/clis/twitter/unblock.d.ts +1 -0
- package/dist/clis/twitter/unblock.js +71 -0
- package/dist/clis/v2ex/topic.yaml +1 -0
- package/dist/clis/weibo/hot.js +0 -1
- package/dist/clis/weread/book.js +1 -1
- package/dist/clis/weread/highlights.js +1 -1
- package/dist/clis/weread/notes.js +1 -1
- package/dist/clis/weread/search.js +1 -1
- package/dist/clis/wikipedia/random.d.ts +1 -0
- package/dist/clis/wikipedia/random.js +19 -0
- package/dist/clis/wikipedia/search.js +4 -4
- package/dist/clis/wikipedia/summary.js +4 -9
- package/dist/clis/wikipedia/trending.d.ts +1 -0
- package/dist/clis/wikipedia/trending.js +35 -0
- package/dist/clis/wikipedia/utils.d.ts +28 -0
- package/dist/clis/wikipedia/utils.js +13 -0
- package/dist/clis/xiaohongshu/creator-note-detail.d.ts +15 -0
- package/dist/clis/xiaohongshu/creator-note-detail.js +69 -5
- package/dist/clis/xiaohongshu/creator-note-detail.test.js +82 -33
- package/dist/clis/xiaohongshu/creator-notes.js +35 -5
- package/dist/clis/xiaohongshu/creator-notes.test.js +37 -6
- package/dist/clis/xiaohongshu/creator-profile.js +0 -1
- package/dist/clis/xiaohongshu/creator-stats.js +0 -1
- package/dist/clis/xiaohongshu/download.js +2 -3
- package/dist/clis/xiaohongshu/feed.yaml +0 -1
- package/dist/clis/xiaohongshu/notifications.yaml +0 -1
- package/dist/clis/xiaohongshu/search.js +2 -2
- package/dist/clis/xiaohongshu/user.js +1 -2
- package/dist/clis/xueqiu/earnings-date.yaml +69 -0
- package/dist/clis/xueqiu/search.yaml +2 -1
- package/dist/clis/xueqiu/stock.yaml +2 -0
- package/dist/clis/yahoo-finance/quote.js +1 -2
- package/dist/clis/youtube/search.js +1 -1
- package/dist/clis/youtube/transcript.js +1 -1
- package/dist/clis/youtube/video.js +1 -1
- package/dist/clis/zhihu/download.js +1 -2
- package/dist/clis/zhihu/question.js +1 -1
- package/dist/clis/zhihu/search.yaml +4 -3
- package/dist/commanderAdapter.d.ts +21 -0
- package/dist/commanderAdapter.js +117 -0
- package/dist/{engine.d.ts → discovery.d.ts} +6 -4
- package/dist/{engine.js → discovery.js} +93 -104
- package/dist/doctor.js +3 -1
- package/dist/doctor.test.js +46 -2
- package/dist/download/index.d.ts +2 -6
- package/dist/download/index.js +19 -46
- package/dist/engine.test.d.ts +0 -3
- package/dist/engine.test.js +80 -11
- package/dist/execution.d.ts +24 -0
- package/dist/execution.js +153 -0
- package/dist/explore.d.ts +76 -3
- package/dist/explore.js +132 -111
- package/dist/external-clis.yaml +48 -0
- package/dist/external.d.ts +7 -2
- package/dist/external.js +11 -14
- package/dist/generate.d.ts +41 -2
- package/dist/generate.js +5 -4
- package/dist/main.js +2 -1
- package/dist/pipeline/executor.d.ts +2 -2
- package/dist/pipeline/executor.js +2 -2
- package/dist/pipeline/executor.test.js +33 -6
- package/dist/pipeline/registry.d.ts +1 -1
- package/dist/pipeline/steps/browser.d.ts +7 -7
- package/dist/pipeline/steps/browser.js +21 -7
- package/dist/pipeline/steps/fetch.d.ts +1 -1
- package/dist/pipeline/steps/fetch.js +11 -7
- package/dist/pipeline/steps/transform.d.ts +6 -5
- package/dist/pipeline/steps/transform.js +30 -9
- package/dist/pipeline/template.d.ts +6 -6
- package/dist/pipeline/template.js +43 -5
- package/dist/pipeline/template.test.js +18 -0
- package/dist/pipeline/transform.test.js +11 -0
- package/dist/plugin.d.ts +31 -0
- package/dist/plugin.js +216 -0
- package/dist/plugin.test.d.ts +4 -0
- package/dist/plugin.test.js +76 -0
- package/dist/registry-api.d.ts +11 -0
- package/dist/registry-api.js +9 -0
- package/dist/registry.d.ts +13 -0
- package/dist/registry.js +8 -1
- package/dist/runtime.d.ts +5 -0
- package/dist/runtime.js +8 -0
- package/dist/serialization.d.ts +34 -0
- package/dist/serialization.js +63 -0
- package/dist/synthesize.d.ts +94 -4
- package/dist/synthesize.js +5 -4
- package/dist/types.d.ts +43 -27
- package/dist/validate.js +8 -2
- package/docs/.vitepress/config.mts +20 -7
- package/docs/adapters/browser/arxiv.md +27 -0
- package/docs/adapters/browser/barchart.md +33 -0
- package/docs/adapters/browser/bilibili.md +9 -0
- package/docs/adapters/browser/bloomberg.md +70 -0
- package/docs/adapters/browser/chaoxing.md +39 -0
- package/docs/adapters/browser/devto.md +35 -0
- package/docs/adapters/browser/douban.md +38 -0
- package/docs/adapters/browser/facebook.md +36 -0
- package/docs/adapters/browser/google.md +62 -0
- package/docs/adapters/browser/grok.md +53 -0
- package/docs/adapters/browser/hf.md +42 -0
- package/docs/adapters/browser/instagram.md +46 -0
- package/docs/adapters/browser/jike.md +45 -0
- package/docs/adapters/browser/jimeng.md +39 -0
- package/docs/adapters/browser/linux-do.md +45 -0
- package/docs/adapters/browser/lobsters.md +32 -0
- package/docs/adapters/browser/medium.md +32 -0
- package/docs/adapters/browser/reddit.md +9 -0
- package/docs/adapters/browser/sinablog.md +36 -0
- package/docs/adapters/browser/sinafinance.md +35 -0
- package/docs/adapters/browser/stackoverflow.md +35 -0
- package/docs/adapters/browser/steam.md +26 -0
- package/docs/adapters/browser/substack.md +38 -0
- package/docs/adapters/browser/tiktok.md +68 -0
- package/docs/adapters/browser/twitter.md +3 -0
- package/docs/adapters/browser/weread.md +48 -0
- package/docs/adapters/browser/wikipedia.md +39 -0
- package/docs/adapters/browser/xiaohongshu.md +5 -1
- package/docs/adapters/browser/xueqiu.md +10 -0
- package/docs/adapters/browser/yahoo-finance.md +6 -5
- package/docs/adapters/desktop/antigravity.md +6 -0
- package/docs/adapters/desktop/chatgpt.md +5 -4
- package/docs/adapters/desktop/codex.md +5 -1
- package/docs/adapters/desktop/cursor.md +4 -0
- package/docs/adapters/desktop/discord.md +7 -7
- package/docs/adapters/index.md +14 -4
- package/docs/advanced/download.md +4 -4
- package/docs/developer/architecture.md +17 -4
- package/docs/guide/getting-started.md +1 -0
- package/docs/guide/plugins.md +153 -0
- package/docs/zh/guide/plugins.md +107 -0
- package/extension/src/background.ts +18 -11
- package/package.json +10 -5
- package/scripts/check-doc-coverage.sh +69 -0
- package/scripts/clean-dist.cjs +13 -0
- package/scripts/copy-yaml.cjs +7 -0
- package/src/browser/cdp.ts +77 -32
- package/src/browser/daemon-client.ts +2 -1
- package/src/browser/dom-helpers.ts +38 -7
- package/src/browser/dom-snapshot.test.ts +249 -0
- package/src/browser/dom-snapshot.ts +770 -0
- package/src/browser/index.ts +2 -0
- package/src/browser/page.ts +57 -20
- package/src/build-manifest.test.ts +70 -2
- package/src/build-manifest.ts +114 -40
- package/src/cli.ts +287 -139
- package/src/clis/apple-podcasts/commands.test.ts +95 -0
- package/src/clis/apple-podcasts/search.ts +2 -2
- package/src/clis/apple-podcasts/top.ts +12 -2
- package/src/clis/arxiv/search.ts +1 -1
- package/src/clis/barchart/greeks.ts +1 -1
- package/src/clis/barchart/options.ts +1 -1
- package/src/clis/barchart/quote.ts +1 -1
- package/src/clis/bilibili/download.ts +1 -1
- package/src/clis/bilibili/dynamic.ts +1 -1
- package/src/clis/bilibili/favorite.ts +1 -1
- package/src/clis/bilibili/feed.ts +1 -1
- package/src/clis/bilibili/following.ts +2 -2
- package/src/clis/bilibili/history.ts +1 -1
- package/src/clis/bilibili/me.ts +1 -1
- package/src/clis/bilibili/ranking.ts +1 -1
- package/src/clis/bilibili/search.ts +3 -3
- package/src/clis/bilibili/subtitle.ts +2 -2
- package/src/clis/bilibili/user-videos.ts +2 -2
- package/src/{bilibili.ts → clis/bilibili/utils.ts} +1 -1
- package/src/clis/bloomberg/businessweek.ts +18 -0
- package/src/clis/bloomberg/economics.ts +18 -0
- package/src/clis/bloomberg/feeds.ts +16 -0
- package/src/clis/bloomberg/industries.ts +18 -0
- package/src/clis/bloomberg/main.ts +18 -0
- package/src/clis/bloomberg/markets.ts +18 -0
- package/src/clis/bloomberg/news.ts +136 -0
- package/src/clis/bloomberg/opinions.ts +18 -0
- package/src/clis/bloomberg/politics.ts +18 -0
- package/src/clis/bloomberg/tech.ts +18 -0
- package/src/clis/bloomberg/utils.test.ts +135 -0
- package/src/clis/bloomberg/utils.ts +429 -0
- package/src/clis/boss/batchgreet.ts +16 -108
- package/src/clis/boss/chatlist.ts +13 -27
- package/src/clis/boss/chatmsg.ts +16 -40
- package/src/clis/boss/common.ts +287 -0
- package/src/clis/boss/detail.ts +9 -55
- package/src/clis/boss/exchange.ts +15 -89
- package/src/clis/boss/greet.ts +25 -162
- package/src/clis/boss/invite.ts +36 -133
- package/src/clis/boss/joblist.ts +7 -36
- package/src/clis/boss/mark.ts +13 -94
- package/src/clis/boss/recommend.ts +12 -57
- package/src/clis/boss/resume.ts +19 -124
- package/src/clis/boss/search.ts +14 -67
- package/src/clis/boss/send.ts +22 -162
- package/src/clis/boss/stats.ts +21 -76
- package/src/clis/chaoxing/assignments.ts +1 -1
- package/src/clis/chaoxing/exams.ts +1 -1
- package/src/{chaoxing.test.ts → clis/chaoxing/utils.test.ts} +1 -1
- package/src/{chaoxing.ts → clis/chaoxing/utils.ts} +1 -3
- package/src/clis/chatgpt/read.ts +1 -1
- package/src/clis/chatwise/export.ts +1 -1
- package/src/clis/chatwise/model.ts +2 -2
- package/src/clis/chatwise/screenshot.ts +1 -1
- package/src/clis/codex/export.ts +1 -1
- package/src/clis/codex/model.ts +2 -2
- package/src/clis/codex/screenshot.ts +1 -1
- package/src/clis/coupang/add-to-cart.ts +3 -4
- package/src/clis/coupang/search.ts +2 -4
- package/src/{coupang.test.ts → clis/coupang/utils.test.ts} +1 -1
- package/src/clis/ctrip/search.ts +1 -1
- package/src/clis/cursor/export.ts +1 -1
- package/src/clis/cursor/model.ts +2 -2
- package/src/clis/cursor/screenshot.ts +1 -1
- package/src/clis/devto/tag.yaml +34 -0
- package/src/clis/devto/top.yaml +29 -0
- package/src/clis/devto/user.yaml +33 -0
- package/src/clis/douban/book-hot.ts +15 -0
- package/src/clis/douban/marks.ts +135 -0
- package/src/clis/douban/movie-hot.ts +15 -0
- package/src/clis/douban/reviews.ts +127 -0
- package/src/clis/douban/search.ts +17 -0
- package/src/clis/douban/shared.ts +165 -0
- package/src/clis/douban/subject.yaml +76 -0
- package/src/clis/douban/top250.yaml +70 -0
- package/src/clis/douban/utils.ts +81 -0
- package/src/clis/facebook/add-friend.yaml +43 -0
- package/src/clis/facebook/events.yaml +44 -0
- package/src/clis/facebook/feed.yaml +63 -0
- package/src/clis/facebook/friends.yaml +42 -0
- package/src/clis/facebook/groups.yaml +50 -0
- package/src/clis/facebook/join-group.yaml +44 -0
- package/src/clis/facebook/memories.yaml +39 -0
- package/src/clis/facebook/notifications.yaml +40 -0
- package/src/clis/facebook/profile.yaml +37 -0
- package/src/clis/facebook/search.yaml +46 -0
- package/src/clis/google/news.ts +66 -0
- package/src/clis/google/search.ts +133 -0
- package/src/clis/google/suggest.ts +40 -0
- package/src/clis/google/trends.ts +44 -0
- package/src/clis/google/utils.test.ts +82 -0
- package/src/clis/google/utils.ts +24 -0
- package/src/clis/grok/ask.test.ts +53 -0
- package/src/clis/grok/ask.ts +300 -69
- package/src/clis/instagram/comment.yaml +52 -0
- package/src/clis/instagram/explore.yaml +43 -0
- package/src/clis/instagram/follow.yaml +41 -0
- package/src/clis/instagram/followers.yaml +51 -0
- package/src/clis/instagram/following.yaml +51 -0
- package/src/clis/instagram/like.yaml +46 -0
- package/src/clis/instagram/profile.yaml +42 -0
- package/src/clis/instagram/save.yaml +46 -0
- package/src/clis/instagram/saved.yaml +40 -0
- package/src/clis/instagram/search.yaml +43 -0
- package/src/clis/instagram/unfollow.yaml +38 -0
- package/src/clis/instagram/unlike.yaml +46 -0
- package/src/clis/instagram/unsave.yaml +46 -0
- package/src/clis/instagram/user.yaml +54 -0
- package/src/clis/jike/comment.ts +2 -3
- package/src/clis/jike/create.ts +1 -2
- package/src/clis/jike/feed.ts +0 -1
- package/src/clis/jike/like.ts +1 -2
- package/src/clis/jike/notifications.ts +0 -1
- package/src/clis/jike/post.yaml +1 -0
- package/src/clis/jike/repost.ts +2 -3
- package/src/clis/jike/search.ts +2 -3
- package/src/clis/jike/topic.yaml +1 -0
- package/src/clis/jike/user.yaml +1 -0
- package/src/clis/jimeng/generate.yaml +1 -0
- package/src/clis/jimeng/history.yaml +0 -1
- package/src/clis/linkedin/search.ts +7 -7
- package/src/clis/linux-do/category.yaml +2 -0
- package/src/clis/linux-do/search.yaml +4 -3
- package/src/clis/linux-do/topic.yaml +1 -0
- package/src/clis/lobsters/active.yaml +29 -0
- package/src/clis/lobsters/hot.yaml +29 -0
- package/src/clis/lobsters/newest.yaml +29 -0
- package/src/clis/lobsters/tag.yaml +34 -0
- package/src/clis/medium/feed.ts +16 -0
- package/src/clis/medium/search.ts +16 -0
- package/src/clis/medium/shared.ts +83 -0
- package/src/clis/medium/user.ts +16 -0
- package/src/clis/notion/export.ts +1 -1
- package/src/clis/reddit/comment.ts +3 -4
- package/src/clis/reddit/read.ts +4 -5
- package/src/clis/reddit/save.ts +2 -3
- package/src/clis/reddit/saved.ts +0 -1
- package/src/clis/reddit/search.yaml +1 -0
- package/src/clis/reddit/subreddit.yaml +1 -0
- package/src/clis/reddit/subscribe.ts +1 -2
- package/src/clis/reddit/upvote.ts +2 -3
- package/src/clis/reddit/upvoted.ts +0 -1
- package/src/clis/reddit/user-comments.yaml +1 -0
- package/src/clis/reddit/user-posts.yaml +1 -0
- package/src/clis/reddit/user.yaml +1 -0
- package/src/clis/reuters/search.ts +1 -1
- package/src/clis/sinablog/article.ts +15 -0
- package/src/clis/sinablog/hot.ts +15 -0
- package/src/clis/sinablog/search.ts +56 -0
- package/src/clis/sinablog/shared.ts +198 -0
- package/src/clis/sinablog/user.ts +16 -0
- package/src/clis/smzdm/search.ts +2 -3
- package/src/clis/stackoverflow/search.yaml +1 -0
- package/src/clis/steam/top-sellers.yaml +29 -0
- package/src/clis/substack/feed.ts +16 -0
- package/src/clis/substack/publication.ts +16 -0
- package/src/clis/substack/search.ts +91 -0
- package/src/clis/substack/shared.ts +132 -0
- package/src/clis/tiktok/comment.yaml +66 -0
- package/src/clis/tiktok/explore.yaml +39 -0
- package/src/clis/tiktok/follow.yaml +39 -0
- package/src/clis/tiktok/following.yaml +46 -0
- package/src/clis/tiktok/friends.yaml +47 -0
- package/src/clis/tiktok/like.yaml +38 -0
- package/src/clis/tiktok/live.yaml +51 -0
- package/src/clis/tiktok/notifications.yaml +52 -0
- package/src/clis/tiktok/profile.yaml +45 -0
- package/src/clis/tiktok/save.yaml +34 -0
- package/src/clis/tiktok/search.yaml +46 -0
- package/src/clis/tiktok/unfollow.yaml +44 -0
- package/src/clis/tiktok/unlike.yaml +38 -0
- package/src/clis/tiktok/unsave.yaml +36 -0
- package/src/clis/tiktok/user.yaml +44 -0
- package/src/clis/twitter/accept.ts +2 -2
- package/src/clis/twitter/article.ts +2 -2
- package/src/clis/twitter/block.ts +92 -0
- package/src/clis/twitter/delete.ts +1 -1
- package/src/clis/twitter/download.ts +3 -3
- package/src/clis/twitter/followers.ts +1 -1
- package/src/clis/twitter/following.ts +1 -1
- package/src/clis/twitter/hide-reply.ts +70 -0
- package/src/clis/twitter/like.ts +1 -1
- package/src/clis/twitter/post.ts +1 -1
- package/src/clis/twitter/reply-dm.ts +1 -1
- package/src/clis/twitter/reply.ts +2 -2
- package/src/clis/twitter/search.ts +1 -1
- package/src/clis/twitter/thread.ts +2 -2
- package/src/clis/twitter/timeline.test.ts +109 -0
- package/src/clis/twitter/timeline.ts +59 -19
- package/src/clis/twitter/trending.ts +113 -0
- package/src/clis/twitter/unblock.ts +75 -0
- package/src/clis/v2ex/topic.yaml +1 -0
- package/src/clis/weibo/hot.ts +0 -1
- package/src/clis/weread/book.ts +1 -1
- package/src/clis/weread/highlights.ts +1 -1
- package/src/clis/weread/notes.ts +1 -1
- package/src/clis/weread/search.ts +1 -1
- package/src/clis/wikipedia/random.ts +19 -0
- package/src/clis/wikipedia/search.ts +11 -5
- package/src/clis/wikipedia/summary.ts +4 -9
- package/src/clis/wikipedia/trending.ts +41 -0
- package/src/clis/wikipedia/utils.ts +31 -0
- package/src/clis/xiaohongshu/creator-note-detail.test.ts +84 -33
- package/src/clis/xiaohongshu/creator-note-detail.ts +89 -5
- package/src/clis/xiaohongshu/creator-notes.test.ts +41 -6
- package/src/clis/xiaohongshu/creator-notes.ts +44 -5
- package/src/clis/xiaohongshu/creator-profile.ts +0 -1
- package/src/clis/xiaohongshu/creator-stats.ts +0 -1
- package/src/clis/xiaohongshu/download.ts +2 -3
- package/src/clis/xiaohongshu/feed.yaml +0 -1
- package/src/clis/xiaohongshu/notifications.yaml +0 -1
- package/src/clis/xiaohongshu/search.ts +2 -2
- package/src/clis/xiaohongshu/user.ts +1 -2
- package/src/clis/xueqiu/earnings-date.yaml +69 -0
- package/src/clis/xueqiu/search.yaml +2 -1
- package/src/clis/xueqiu/stock.yaml +2 -0
- package/src/clis/yahoo-finance/quote.ts +1 -2
- package/src/clis/youtube/search.ts +1 -1
- package/src/clis/youtube/transcript.ts +1 -1
- package/src/clis/youtube/video.ts +1 -1
- package/src/clis/zhihu/download.ts +1 -2
- package/src/clis/zhihu/question.ts +1 -1
- package/src/clis/zhihu/search.yaml +4 -3
- package/src/commanderAdapter.ts +120 -0
- package/src/discovery.ts +277 -0
- package/src/doctor.test.ts +59 -2
- package/src/doctor.ts +4 -2
- package/src/download/index.ts +21 -54
- package/src/engine.test.ts +85 -11
- package/src/execution.ts +164 -0
- package/src/explore.ts +211 -117
- package/src/external-clis.yaml +9 -0
- package/src/external.ts +15 -12
- package/src/generate.ts +58 -9
- package/src/main.ts +2 -1
- package/src/pipeline/executor.test.ts +35 -6
- package/src/pipeline/executor.ts +11 -7
- package/src/pipeline/registry.ts +3 -3
- package/src/pipeline/steps/browser.ts +29 -15
- package/src/pipeline/steps/fetch.ts +18 -13
- package/src/pipeline/steps/transform.ts +40 -15
- package/src/pipeline/template.test.ts +18 -0
- package/src/pipeline/template.ts +86 -13
- package/src/pipeline/transform.test.ts +15 -2
- package/src/plugin.test.ts +86 -0
- package/src/plugin.ts +254 -0
- package/src/registry-api.ts +12 -0
- package/src/registry.ts +24 -1
- package/src/runtime.ts +9 -0
- package/src/serialization.ts +79 -0
- package/src/synthesize.ts +102 -21
- package/src/types.ts +45 -13
- package/src/validate.ts +19 -4
- package/tests/e2e/browser-public.test.ts +36 -0
- package/tests/e2e/public-commands.test.ts +119 -1
- package/dist/clis/feishu/new.d.ts +0 -1
- package/dist/clis/feishu/new.js +0 -27
- package/dist/clis/feishu/read.d.ts +0 -1
- package/dist/clis/feishu/read.js +0 -40
- package/dist/clis/feishu/search.d.ts +0 -1
- package/dist/clis/feishu/search.js +0 -30
- package/dist/clis/feishu/send.d.ts +0 -1
- package/dist/clis/feishu/send.js +0 -39
- package/dist/clis/feishu/status.d.ts +0 -1
- package/dist/clis/feishu/status.js +0 -28
- package/dist/clis/neteasemusic/like.d.ts +0 -1
- package/dist/clis/neteasemusic/like.js +0 -25
- package/dist/clis/neteasemusic/lyrics.d.ts +0 -1
- package/dist/clis/neteasemusic/lyrics.js +0 -47
- package/dist/clis/neteasemusic/next.d.ts +0 -1
- package/dist/clis/neteasemusic/next.js +0 -26
- package/dist/clis/neteasemusic/play.d.ts +0 -1
- package/dist/clis/neteasemusic/play.js +0 -26
- package/dist/clis/neteasemusic/playing.d.ts +0 -1
- package/dist/clis/neteasemusic/playing.js +0 -59
- package/dist/clis/neteasemusic/playlist.d.ts +0 -1
- package/dist/clis/neteasemusic/playlist.js +0 -46
- package/dist/clis/neteasemusic/prev.d.ts +0 -1
- package/dist/clis/neteasemusic/prev.js +0 -25
- package/dist/clis/neteasemusic/search.d.ts +0 -1
- package/dist/clis/neteasemusic/search.js +0 -52
- package/dist/clis/neteasemusic/status.d.ts +0 -1
- package/dist/clis/neteasemusic/status.js +0 -16
- package/dist/clis/neteasemusic/volume.d.ts +0 -1
- package/dist/clis/neteasemusic/volume.js +0 -54
- package/dist/clis/twitter/trending.yaml +0 -46
- package/dist/clis/wechat/chats.d.ts +0 -1
- package/dist/clis/wechat/chats.js +0 -28
- package/dist/clis/wechat/contacts.d.ts +0 -1
- package/dist/clis/wechat/contacts.js +0 -28
- package/dist/clis/wechat/read.d.ts +0 -1
- package/dist/clis/wechat/read.js +0 -58
- package/dist/clis/wechat/search.d.ts +0 -1
- package/dist/clis/wechat/search.js +0 -31
- package/dist/clis/wechat/send.d.ts +0 -1
- package/dist/clis/wechat/send.js +0 -42
- package/dist/clis/wechat/status.d.ts +0 -1
- package/dist/clis/wechat/status.js +0 -29
- package/dist/pipeline.d.ts +0 -7
- package/dist/pipeline.js +0 -7
- package/docs/adapters/browser/github.md +0 -26
- package/docs/adapters/desktop/feishu.md +0 -20
- package/docs/adapters/desktop/neteasemusic.md +0 -31
- package/docs/adapters/desktop/wechat.md +0 -28
- package/docs/public/CNAME +0 -1
- package/src/clis/antigravity/README.md +0 -5
- package/src/clis/antigravity/README.zh-CN.md +0 -51
- package/src/clis/chaoxing/README.md +0 -14
- package/src/clis/chaoxing/README.zh-CN.md +0 -35
- package/src/clis/chatgpt/README.md +0 -5
- package/src/clis/chatgpt/README.zh-CN.md +0 -44
- package/src/clis/chatwise/README.md +0 -5
- package/src/clis/chatwise/README.zh-CN.md +0 -38
- package/src/clis/codex/README.md +0 -5
- package/src/clis/codex/README.zh-CN.md +0 -33
- package/src/clis/cursor/README.md +0 -5
- package/src/clis/cursor/README.zh-CN.md +0 -33
- package/src/clis/discord-app/README.md +0 -5
- package/src/clis/discord-app/README.zh-CN.md +0 -28
- package/src/clis/feishu/README.md +0 -5
- package/src/clis/feishu/README.zh-CN.md +0 -20
- package/src/clis/feishu/new.ts +0 -32
- package/src/clis/feishu/read.ts +0 -48
- package/src/clis/feishu/search.ts +0 -35
- package/src/clis/feishu/send.ts +0 -46
- package/src/clis/feishu/status.ts +0 -34
- package/src/clis/neteasemusic/README.md +0 -5
- package/src/clis/neteasemusic/README.zh-CN.md +0 -31
- package/src/clis/neteasemusic/like.ts +0 -28
- package/src/clis/neteasemusic/lyrics.ts +0 -53
- package/src/clis/neteasemusic/next.ts +0 -30
- package/src/clis/neteasemusic/play.ts +0 -30
- package/src/clis/neteasemusic/playing.ts +0 -62
- package/src/clis/neteasemusic/playlist.ts +0 -51
- package/src/clis/neteasemusic/prev.ts +0 -29
- package/src/clis/neteasemusic/search.ts +0 -58
- package/src/clis/neteasemusic/status.ts +0 -18
- package/src/clis/neteasemusic/volume.ts +0 -61
- package/src/clis/notion/README.md +0 -5
- package/src/clis/notion/README.zh-CN.md +0 -29
- package/src/clis/twitter/trending.yaml +0 -46
- package/src/clis/wechat/README.md +0 -5
- package/src/clis/wechat/README.zh-CN.md +0 -28
- package/src/clis/wechat/chats.ts +0 -33
- package/src/clis/wechat/contacts.ts +0 -33
- package/src/clis/wechat/read.ts +0 -72
- package/src/clis/wechat/search.ts +0 -36
- package/src/clis/wechat/send.ts +0 -49
- package/src/clis/wechat/status.ts +0 -35
- package/src/engine.ts +0 -274
- package/src/pipeline.ts +0 -8
- /package/dist/{bilibili.js → clis/bilibili/utils.js} +0 -0
- /package/dist/{chaoxing.test.d.ts → clis/bloomberg/businessweek.d.ts} +0 -0
- /package/dist/{coupang.test.d.ts → clis/bloomberg/economics.d.ts} +0 -0
- /package/dist/{coupang.d.ts → clis/coupang/utils.d.ts} +0 -0
- /package/dist/{coupang.js → clis/coupang/utils.js} +0 -0
- /package/src/{coupang.ts → clis/coupang/utils.ts} +0 -0
package/src/synthesize.ts
CHANGED
|
@@ -7,16 +7,96 @@ import * as fs from 'node:fs';
|
|
|
7
7
|
import * as path from 'node:path';
|
|
8
8
|
import yaml from 'js-yaml';
|
|
9
9
|
import { VOLATILE_PARAMS, SEARCH_PARAMS, LIMIT_PARAMS, PAGINATION_PARAMS } from './constants.js';
|
|
10
|
+
import type { ExploreAuthSummary, ExploreEndpointArtifact, ExploreManifest } from './explore.js';
|
|
10
11
|
|
|
11
12
|
/** Renamed aliases for backward compatibility with local references */
|
|
12
13
|
const SEARCH_PARAM_NAMES = SEARCH_PARAMS;
|
|
13
14
|
const LIMIT_PARAM_NAMES = LIMIT_PARAMS;
|
|
14
15
|
const PAGE_PARAM_NAMES = PAGINATION_PARAMS;
|
|
15
16
|
|
|
17
|
+
interface RecommendedArg {
|
|
18
|
+
name: string;
|
|
19
|
+
type?: string;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
default?: unknown;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface StoreHint {
|
|
25
|
+
store: string;
|
|
26
|
+
action: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface SynthesizeCapability {
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
strategy: string;
|
|
33
|
+
confidence?: number;
|
|
34
|
+
endpoint?: string;
|
|
35
|
+
itemPath?: string | null;
|
|
36
|
+
recommendedColumns?: string[];
|
|
37
|
+
recommendedArgs?: RecommendedArg[];
|
|
38
|
+
recommended_args?: RecommendedArg[];
|
|
39
|
+
recommendedColumnsLegacy?: string[];
|
|
40
|
+
recommended_columns?: string[];
|
|
41
|
+
storeHint?: StoreHint;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface GeneratedArgDefinition {
|
|
45
|
+
type: string;
|
|
46
|
+
required?: boolean;
|
|
47
|
+
default?: unknown;
|
|
48
|
+
description?: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type CandidatePipelineStep =
|
|
52
|
+
| { navigate: string }
|
|
53
|
+
| { wait: number }
|
|
54
|
+
| { evaluate: string }
|
|
55
|
+
| { select: string }
|
|
56
|
+
| { map: Record<string, string> }
|
|
57
|
+
| { limit: string }
|
|
58
|
+
| { fetch: { url: string } }
|
|
59
|
+
| { tap: { store: string; action: string; timeout: number; capture?: string; select?: string | null } };
|
|
60
|
+
|
|
61
|
+
export interface CandidateYaml {
|
|
62
|
+
site: string;
|
|
63
|
+
name: string;
|
|
64
|
+
description: string;
|
|
65
|
+
domain: string;
|
|
66
|
+
strategy: string;
|
|
67
|
+
browser: boolean;
|
|
68
|
+
args: Record<string, GeneratedArgDefinition>;
|
|
69
|
+
pipeline: CandidatePipelineStep[];
|
|
70
|
+
columns: string[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface SynthesizeCandidateSummary {
|
|
74
|
+
name: string;
|
|
75
|
+
path: string;
|
|
76
|
+
strategy: string;
|
|
77
|
+
confidence?: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface SynthesizeResult {
|
|
81
|
+
site: string;
|
|
82
|
+
explore_dir: string;
|
|
83
|
+
out_dir: string;
|
|
84
|
+
candidate_count: number;
|
|
85
|
+
candidates: SynthesizeCandidateSummary[];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
type ExploreManifestLike = Pick<ExploreManifest, 'target_url' | 'final_url'> & Partial<ExploreManifest>;
|
|
89
|
+
interface LoadedExploreBundle {
|
|
90
|
+
manifest: ExploreManifest;
|
|
91
|
+
endpoints: ExploreEndpointArtifact[];
|
|
92
|
+
capabilities: SynthesizeCapability[];
|
|
93
|
+
auth: ExploreAuthSummary;
|
|
94
|
+
}
|
|
95
|
+
|
|
16
96
|
export function synthesizeFromExplore(
|
|
17
97
|
target: string,
|
|
18
98
|
opts: { outDir?: string; top?: number } = {},
|
|
19
|
-
):
|
|
99
|
+
): SynthesizeResult {
|
|
20
100
|
const exploreDir = resolveExploreDir(target);
|
|
21
101
|
const bundle = loadExploreBundle(exploreDir);
|
|
22
102
|
|
|
@@ -25,9 +105,9 @@ export function synthesizeFromExplore(
|
|
|
25
105
|
|
|
26
106
|
const site = bundle.manifest.site;
|
|
27
107
|
const capabilities = (bundle.capabilities ?? [])
|
|
28
|
-
.sort((a
|
|
108
|
+
.sort((a, b) => (b.confidence ?? 0) - (a.confidence ?? 0))
|
|
29
109
|
.slice(0, opts.top ?? 3);
|
|
30
|
-
const candidates:
|
|
110
|
+
const candidates: SynthesizeCandidateSummary[] = [];
|
|
31
111
|
|
|
32
112
|
for (const cap of capabilities) {
|
|
33
113
|
const endpoint = chooseEndpoint(cap, bundle.endpoints);
|
|
@@ -44,7 +124,7 @@ export function synthesizeFromExplore(
|
|
|
44
124
|
return { site, explore_dir: exploreDir, out_dir: targetDir, candidate_count: candidates.length, candidates };
|
|
45
125
|
}
|
|
46
126
|
|
|
47
|
-
export function renderSynthesizeSummary(result:
|
|
127
|
+
export function renderSynthesizeSummary(result: SynthesizeResult): string {
|
|
48
128
|
const lines = ['opencli synthesize: OK', `Site: ${result.site}`, `Source: ${result.explore_dir}`, `Candidates: ${result.candidate_count}`];
|
|
49
129
|
for (const c of result.candidates ?? []) lines.push(` • ${c.name} (${c.strategy}, ${((c.confidence ?? 0) * 100).toFixed(0)}% confidence) → ${c.path}`);
|
|
50
130
|
return lines.join('\n');
|
|
@@ -57,33 +137,34 @@ export function resolveExploreDir(target: string): string {
|
|
|
57
137
|
throw new Error(`Explore directory not found: ${target}`);
|
|
58
138
|
}
|
|
59
139
|
|
|
60
|
-
export function loadExploreBundle(exploreDir: string):
|
|
140
|
+
export function loadExploreBundle(exploreDir: string): LoadedExploreBundle {
|
|
61
141
|
return {
|
|
62
|
-
manifest: JSON.parse(fs.readFileSync(path.join(exploreDir, 'manifest.json'), 'utf-8')),
|
|
63
|
-
endpoints: JSON.parse(fs.readFileSync(path.join(exploreDir, 'endpoints.json'), 'utf-8')),
|
|
64
|
-
capabilities: JSON.parse(fs.readFileSync(path.join(exploreDir, 'capabilities.json'), 'utf-8')),
|
|
142
|
+
manifest: JSON.parse(fs.readFileSync(path.join(exploreDir, 'manifest.json'), 'utf-8')) as ExploreManifest,
|
|
143
|
+
endpoints: JSON.parse(fs.readFileSync(path.join(exploreDir, 'endpoints.json'), 'utf-8')) as ExploreEndpointArtifact[],
|
|
144
|
+
capabilities: JSON.parse(fs.readFileSync(path.join(exploreDir, 'capabilities.json'), 'utf-8')) as SynthesizeCapability[],
|
|
65
145
|
auth: JSON.parse(fs.readFileSync(path.join(exploreDir, 'auth.json'), 'utf-8')),
|
|
66
146
|
};
|
|
67
147
|
}
|
|
68
148
|
|
|
69
|
-
function chooseEndpoint(cap:
|
|
149
|
+
function chooseEndpoint(cap: SynthesizeCapability, endpoints: ExploreEndpointArtifact[]): ExploreEndpointArtifact | null {
|
|
70
150
|
if (!endpoints.length) return null;
|
|
71
151
|
// Match by endpoint pattern from capability
|
|
72
152
|
if (cap.endpoint) {
|
|
73
|
-
const
|
|
153
|
+
const endpointPattern = cap.endpoint;
|
|
154
|
+
const match = endpoints.find((endpoint) => endpoint.pattern === endpointPattern || endpoint.url?.includes(endpointPattern));
|
|
74
155
|
if (match) return match;
|
|
75
156
|
}
|
|
76
|
-
return endpoints.sort((a
|
|
157
|
+
return [...endpoints].sort((a, b) => (b.score ?? 0) - (a.score ?? 0))[0];
|
|
77
158
|
}
|
|
78
159
|
|
|
79
160
|
// ── URL templating ─────────────────────────────────────────────────────────
|
|
80
161
|
|
|
81
|
-
function buildTemplatedUrl(rawUrl: string, cap:
|
|
162
|
+
function buildTemplatedUrl(rawUrl: string, cap: SynthesizeCapability, _endpoint: ExploreEndpointArtifact): string {
|
|
82
163
|
try {
|
|
83
164
|
const u = new URL(rawUrl);
|
|
84
165
|
const base = `${u.protocol}//${u.host}${u.pathname}`;
|
|
85
166
|
const params: Array<[string, string]> = [];
|
|
86
|
-
const hasKeyword = cap.recommendedArgs?.some((
|
|
167
|
+
const hasKeyword = cap.recommendedArgs?.some((arg) => arg.name === 'keyword');
|
|
87
168
|
|
|
88
169
|
u.searchParams.forEach((v, k) => {
|
|
89
170
|
if (VOLATILE_PARAMS.has(k)) return;
|
|
@@ -101,7 +182,7 @@ function buildTemplatedUrl(rawUrl: string, cap: any, _endpoint: any): string {
|
|
|
101
182
|
* Build inline evaluate script for browser-based fetch+parse.
|
|
102
183
|
* Follows patterns from bilibili/hot.yaml and twitter/trending.yaml.
|
|
103
184
|
*/
|
|
104
|
-
function buildEvaluateScript(url: string, itemPath: string, endpoint:
|
|
185
|
+
function buildEvaluateScript(url: string, itemPath: string, endpoint: ExploreEndpointArtifact): string {
|
|
105
186
|
const pathChain = itemPath.split('.').map((p: string) => `?.${p}`).join('');
|
|
106
187
|
const detectedFields = endpoint?.detectedFields ?? {};
|
|
107
188
|
const hasFields = Object.keys(detectedFields).length > 0;
|
|
@@ -127,9 +208,9 @@ function buildEvaluateScript(url: string, itemPath: string, endpoint: any): stri
|
|
|
127
208
|
|
|
128
209
|
// ── YAML pipeline generation ───────────────────────────────────────────────
|
|
129
210
|
|
|
130
|
-
function buildCandidateYaml(site: string, manifest:
|
|
211
|
+
function buildCandidateYaml(site: string, manifest: ExploreManifestLike, cap: SynthesizeCapability, endpoint: ExploreEndpointArtifact): { name: string; yaml: CandidateYaml } {
|
|
131
212
|
const needsBrowser = cap.strategy !== 'public';
|
|
132
|
-
const pipeline:
|
|
213
|
+
const pipeline: CandidatePipelineStep[] = [];
|
|
133
214
|
const templatedUrl = buildTemplatedUrl(endpoint?.url ?? manifest.target_url, cap, endpoint);
|
|
134
215
|
|
|
135
216
|
let domain = '';
|
|
@@ -139,7 +220,7 @@ function buildCandidateYaml(site: string, manifest: any, cap: any, endpoint: any
|
|
|
139
220
|
// Store Action: navigate + wait + tap (declarative, clean)
|
|
140
221
|
pipeline.push({ navigate: manifest.target_url });
|
|
141
222
|
pipeline.push({ wait: 3 });
|
|
142
|
-
const tapStep:
|
|
223
|
+
const tapStep: { store: string; action: string; timeout: number; capture?: string; select?: string | null } = {
|
|
143
224
|
store: cap.storeHint.store,
|
|
144
225
|
action: cap.storeHint.action,
|
|
145
226
|
timeout: 8,
|
|
@@ -170,7 +251,7 @@ function buildCandidateYaml(site: string, manifest: any, cap: any, endpoint: any
|
|
|
170
251
|
// Map fields
|
|
171
252
|
const mapStep: Record<string, string> = {};
|
|
172
253
|
const columns = cap.recommendedColumns ?? ['title', 'url'];
|
|
173
|
-
if (!cap.recommendedArgs?.some((
|
|
254
|
+
if (!cap.recommendedArgs?.some((arg) => arg.name === 'keyword')) mapStep['rank'] = '${{ index + 1 }}';
|
|
174
255
|
const detectedFields = endpoint?.detectedFields ?? {};
|
|
175
256
|
for (const col of columns) {
|
|
176
257
|
const fieldPath = detectedFields[col];
|
|
@@ -180,9 +261,9 @@ function buildCandidateYaml(site: string, manifest: any, cap: any, endpoint: any
|
|
|
180
261
|
pipeline.push({ limit: '${{ args.limit | default(20) }}' });
|
|
181
262
|
|
|
182
263
|
// Args
|
|
183
|
-
const argsDef: Record<string,
|
|
264
|
+
const argsDef: Record<string, GeneratedArgDefinition> = {};
|
|
184
265
|
for (const arg of cap.recommendedArgs ?? []) {
|
|
185
|
-
const def:
|
|
266
|
+
const def: GeneratedArgDefinition = { type: arg.type ?? 'str' };
|
|
186
267
|
if (arg.required) def.required = true;
|
|
187
268
|
if (arg.default != null) def.default = arg.default;
|
|
188
269
|
if (arg.name === 'keyword') def.description = 'Search keyword';
|
|
@@ -203,7 +284,7 @@ function buildCandidateYaml(site: string, manifest: any, cap: any, endpoint: any
|
|
|
203
284
|
}
|
|
204
285
|
|
|
205
286
|
/** Backward-compatible export for scaffold.ts */
|
|
206
|
-
export function buildCandidate(site: string, targetUrl: string, cap:
|
|
287
|
+
export function buildCandidate(site: string, targetUrl: string, cap: SynthesizeCapability, endpoint: ExploreEndpointArtifact): { name: string; yaml: CandidateYaml } {
|
|
207
288
|
// Map old-style field names to new ones
|
|
208
289
|
const normalizedCap = {
|
|
209
290
|
...cap,
|
package/src/types.ts
CHANGED
|
@@ -5,23 +5,55 @@
|
|
|
5
5
|
* instead of `any` for browser interactions.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
export interface BrowserCookie {
|
|
9
|
+
name: string;
|
|
10
|
+
value: string;
|
|
11
|
+
domain: string;
|
|
12
|
+
path?: string;
|
|
13
|
+
secure?: boolean;
|
|
14
|
+
httpOnly?: boolean;
|
|
15
|
+
expirationDate?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SnapshotOptions {
|
|
19
|
+
interactive?: boolean;
|
|
20
|
+
compact?: boolean;
|
|
21
|
+
maxDepth?: number;
|
|
22
|
+
raw?: boolean;
|
|
23
|
+
viewportExpand?: number;
|
|
24
|
+
maxTextLength?: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface WaitOptions {
|
|
28
|
+
text?: string;
|
|
29
|
+
time?: number;
|
|
30
|
+
timeout?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ScreenshotOptions {
|
|
34
|
+
format?: 'png' | 'jpeg';
|
|
35
|
+
quality?: number;
|
|
36
|
+
fullPage?: boolean;
|
|
37
|
+
path?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface BrowserSessionInfo {
|
|
41
|
+
workspace?: string;
|
|
42
|
+
connected?: boolean;
|
|
43
|
+
[key: string]: unknown;
|
|
44
|
+
}
|
|
45
|
+
|
|
8
46
|
export interface IPage {
|
|
9
|
-
goto(url: string): Promise<void>;
|
|
47
|
+
goto(url: string, options?: { waitUntil?: 'load' | 'none'; settleMs?: number }): Promise<void>;
|
|
10
48
|
evaluate(js: string): Promise<any>;
|
|
11
|
-
getCookies(opts?: { domain?: string; url?: string }): Promise<
|
|
12
|
-
|
|
13
|
-
value: string;
|
|
14
|
-
domain: string;
|
|
15
|
-
path?: string;
|
|
16
|
-
secure?: boolean;
|
|
17
|
-
httpOnly?: boolean;
|
|
18
|
-
expirationDate?: number;
|
|
19
|
-
}>>;
|
|
20
|
-
snapshot(opts?: { interactive?: boolean; compact?: boolean; maxDepth?: number; raw?: boolean }): Promise<any>;
|
|
49
|
+
getCookies(opts?: { domain?: string; url?: string }): Promise<BrowserCookie[]>;
|
|
50
|
+
snapshot(opts?: SnapshotOptions): Promise<any>;
|
|
21
51
|
click(ref: string): Promise<void>;
|
|
22
52
|
typeText(ref: string, text: string): Promise<void>;
|
|
23
53
|
pressKey(key: string): Promise<void>;
|
|
24
|
-
|
|
54
|
+
scrollTo(ref: string): Promise<any>;
|
|
55
|
+
getFormState(): Promise<any>;
|
|
56
|
+
wait(options: number | WaitOptions): Promise<void>;
|
|
25
57
|
tabs(): Promise<any>;
|
|
26
58
|
closeTab(index?: number): Promise<void>;
|
|
27
59
|
newTab(): Promise<void>;
|
|
@@ -32,5 +64,5 @@ export interface IPage {
|
|
|
32
64
|
autoScroll(options?: { times?: number; delayMs?: number }): Promise<void>;
|
|
33
65
|
installInterceptor(pattern: string): Promise<void>;
|
|
34
66
|
getInterceptedRequests(): Promise<any[]>;
|
|
35
|
-
screenshot(options?:
|
|
67
|
+
screenshot(options?: ScreenshotOptions): Promise<string>;
|
|
36
68
|
}
|
package/src/validate.ts
CHANGED
|
@@ -25,6 +25,22 @@ export interface ValidationReport {
|
|
|
25
25
|
files: number;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
interface ValidatedYamlCliDefinition {
|
|
29
|
+
site?: string;
|
|
30
|
+
name?: string;
|
|
31
|
+
pipeline?: unknown[];
|
|
32
|
+
columns?: unknown[];
|
|
33
|
+
args?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
37
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function getErrorMessage(error: unknown): string {
|
|
41
|
+
return error instanceof Error ? error.message : String(error);
|
|
42
|
+
}
|
|
43
|
+
|
|
28
44
|
export function validateClisWithTarget(dirs: string[], target?: string): ValidationReport {
|
|
29
45
|
const results: FileValidationResult[] = [];
|
|
30
46
|
let errors = 0; let warnings = 0; let files = 0;
|
|
@@ -53,8 +69,8 @@ function validateYamlFile(filePath: string): FileValidationResult {
|
|
|
53
69
|
const errors: string[] = []; const warnings: string[] = [];
|
|
54
70
|
try {
|
|
55
71
|
const raw = fs.readFileSync(filePath, 'utf-8');
|
|
56
|
-
const def = yaml.load(raw) as
|
|
57
|
-
if (!def
|
|
72
|
+
const def = yaml.load(raw) as ValidatedYamlCliDefinition | null;
|
|
73
|
+
if (!isRecord(def)) { errors.push('Not a valid YAML object'); return { path: filePath, errors, warnings }; }
|
|
58
74
|
if (!def.site) errors.push('Missing "site"');
|
|
59
75
|
if (!def.name) errors.push('Missing "name"');
|
|
60
76
|
if (def.pipeline && !Array.isArray(def.pipeline)) errors.push('"pipeline" must be an array');
|
|
@@ -74,7 +90,7 @@ function validateYamlFile(filePath: string): FileValidationResult {
|
|
|
74
90
|
}
|
|
75
91
|
}
|
|
76
92
|
}
|
|
77
|
-
} catch (e
|
|
93
|
+
} catch (e) { errors.push(`YAML parse error: ${getErrorMessage(e)}`); }
|
|
78
94
|
return { path: filePath, errors, warnings };
|
|
79
95
|
}
|
|
80
96
|
|
|
@@ -89,4 +105,3 @@ export function renderValidationReport(report: ValidationReport): string {
|
|
|
89
105
|
}
|
|
90
106
|
return lines.join('\n');
|
|
91
107
|
}
|
|
92
|
-
|
|
@@ -46,6 +46,31 @@ describe('browser public-data commands E2E', () => {
|
|
|
46
46
|
}
|
|
47
47
|
}, 60_000);
|
|
48
48
|
|
|
49
|
+
it('bloomberg news returns article detail when the article page is accessible', async () => {
|
|
50
|
+
const feedResult = await runCli(['bloomberg', 'tech', '--limit', '1', '-f', 'json']);
|
|
51
|
+
if (feedResult.code !== 0) {
|
|
52
|
+
console.warn('bloomberg news: skipped — could not load Bloomberg tech feed');
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const feedItems = parseJsonOutput(feedResult.stdout);
|
|
57
|
+
const link = Array.isArray(feedItems) ? feedItems[0]?.link : null;
|
|
58
|
+
if (!link) {
|
|
59
|
+
console.warn('bloomberg news: skipped — tech feed returned no link');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const data = await tryBrowserCommand(['bloomberg', 'news', link, '-f', 'json']);
|
|
64
|
+
expectDataOrSkip(data, 'bloomberg news');
|
|
65
|
+
if (data) {
|
|
66
|
+
expect(data[0]).toHaveProperty('title');
|
|
67
|
+
expect(data[0]).toHaveProperty('summary');
|
|
68
|
+
expect(data[0]).toHaveProperty('link');
|
|
69
|
+
expect(data[0]).toHaveProperty('mediaLinks');
|
|
70
|
+
expect(data[0]).toHaveProperty('content');
|
|
71
|
+
}
|
|
72
|
+
}, 60_000);
|
|
73
|
+
|
|
49
74
|
// ── v2ex daily (browser: true) ──
|
|
50
75
|
it('v2ex daily returns topics', async () => {
|
|
51
76
|
const data = await tryBrowserCommand(['v2ex', 'daily', '--limit', '3', '-f', 'json']);
|
|
@@ -161,6 +186,17 @@ describe('browser public-data commands E2E', () => {
|
|
|
161
186
|
expectDataOrSkip(data, 'xiaohongshu search');
|
|
162
187
|
}, 60_000);
|
|
163
188
|
|
|
189
|
+
// ── google search (browser: true, public strategy) ──
|
|
190
|
+
it('google search returns results', async () => {
|
|
191
|
+
const data = await tryBrowserCommand(['google', 'search', 'typescript', '--limit', '5', '-f', 'json']);
|
|
192
|
+
expectDataOrSkip(data, 'google search');
|
|
193
|
+
if (data) {
|
|
194
|
+
expect(data[0]).toHaveProperty('type');
|
|
195
|
+
expect(data[0]).toHaveProperty('title');
|
|
196
|
+
expect(data[0]).toHaveProperty('url');
|
|
197
|
+
}
|
|
198
|
+
}, 60_000);
|
|
199
|
+
|
|
164
200
|
// ── yahoo-finance (browser: true) ──
|
|
165
201
|
it('yahoo-finance quote returns stock data', async () => {
|
|
166
202
|
const data = await tryBrowserCommand(['yahoo-finance', 'quote', '--symbol', 'AAPL', '-f', 'json']);
|
|
@@ -11,10 +11,66 @@ function isExpectedChineseSiteRestriction(code: number, stderr: string): boolean
|
|
|
11
11
|
return /Error \[FETCH_ERROR\]: HTTP (403|429|451|503)\b/.test(stderr);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
function isExpectedApplePodcastsRestriction(code: number, stderr: string): boolean {
|
|
15
|
+
if (code === 0) return false;
|
|
16
|
+
return /Error \[FETCH_ERROR\]: (Charts API HTTP \d+|Unable to reach Apple Podcasts charts)/.test(stderr);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function isExpectedGoogleRestriction(code: number, stderr: string): boolean {
|
|
20
|
+
if (code === 0) return false;
|
|
21
|
+
// Network unreachable (DNS/proxy) or HTTP error from Google
|
|
22
|
+
return /fetch failed/.test(stderr) || /Error \[FETCH_ERROR\]: HTTP (403|429|451|503)\b/.test(stderr);
|
|
23
|
+
}
|
|
24
|
+
|
|
14
25
|
// Keep old name as alias for existing tests
|
|
15
26
|
const isExpectedXiaoyuzhouRestriction = isExpectedChineseSiteRestriction;
|
|
16
27
|
|
|
17
28
|
describe('public commands E2E', () => {
|
|
29
|
+
// ── bloomberg (RSS-backed, browser: false) ──
|
|
30
|
+
it('bloomberg main returns structured headline data', async () => {
|
|
31
|
+
const { stdout, code } = await runCli(['bloomberg', 'main', '--limit', '1', '-f', 'json']);
|
|
32
|
+
expect(code).toBe(0);
|
|
33
|
+
const data = parseJsonOutput(stdout);
|
|
34
|
+
expect(Array.isArray(data)).toBe(true);
|
|
35
|
+
expect(data.length).toBe(1);
|
|
36
|
+
expect(data[0]).toHaveProperty('title');
|
|
37
|
+
expect(data[0]).toHaveProperty('summary');
|
|
38
|
+
expect(data[0]).toHaveProperty('link');
|
|
39
|
+
expect(data[0]).toHaveProperty('mediaLinks');
|
|
40
|
+
expect(Array.isArray(data[0].mediaLinks)).toBe(true);
|
|
41
|
+
}, 30_000);
|
|
42
|
+
|
|
43
|
+
it.each(['markets', 'economics', 'industries', 'tech', 'politics', 'businessweek', 'opinions'])(
|
|
44
|
+
'bloomberg %s returns structured RSS items',
|
|
45
|
+
async (section) => {
|
|
46
|
+
const { stdout, code } = await runCli(['bloomberg', section, '--limit', '1', '-f', 'json']);
|
|
47
|
+
expect(code).toBe(0);
|
|
48
|
+
const data = parseJsonOutput(stdout);
|
|
49
|
+
expect(Array.isArray(data)).toBe(true);
|
|
50
|
+
expect(data.length).toBe(1);
|
|
51
|
+
expect(data[0]).toHaveProperty('title');
|
|
52
|
+
expect(data[0]).toHaveProperty('summary');
|
|
53
|
+
expect(data[0]).toHaveProperty('link');
|
|
54
|
+
expect(data[0]).toHaveProperty('mediaLinks');
|
|
55
|
+
},
|
|
56
|
+
30_000,
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
it('bloomberg feeds lists the supported RSS aliases', async () => {
|
|
60
|
+
const { stdout, code } = await runCli(['bloomberg', 'feeds', '-f', 'json']);
|
|
61
|
+
expect(code).toBe(0);
|
|
62
|
+
const data = parseJsonOutput(stdout);
|
|
63
|
+
expect(Array.isArray(data)).toBe(true);
|
|
64
|
+
expect(data).toEqual(
|
|
65
|
+
expect.arrayContaining([
|
|
66
|
+
expect.objectContaining({ name: 'main' }),
|
|
67
|
+
expect.objectContaining({ name: 'markets' }),
|
|
68
|
+
expect.objectContaining({ name: 'tech' }),
|
|
69
|
+
expect.objectContaining({ name: 'opinions' }),
|
|
70
|
+
]),
|
|
71
|
+
);
|
|
72
|
+
}, 30_000);
|
|
73
|
+
|
|
18
74
|
// ── apple-podcasts ──
|
|
19
75
|
it('apple-podcasts search returns structured podcast results', async () => {
|
|
20
76
|
const { stdout, code } = await runCli(['apple-podcasts', 'search', 'technology', '--limit', '3', '-f', 'json']);
|
|
@@ -39,7 +95,11 @@ describe('public commands E2E', () => {
|
|
|
39
95
|
}, 30_000);
|
|
40
96
|
|
|
41
97
|
it('apple-podcasts top returns ranked podcasts', async () => {
|
|
42
|
-
const { stdout, code } = await runCli(['apple-podcasts', 'top', '--limit', '3', '--country', 'us', '-f', 'json']);
|
|
98
|
+
const { stdout, stderr, code } = await runCli(['apple-podcasts', 'top', '--limit', '3', '--country', 'us', '-f', 'json']);
|
|
99
|
+
if (isExpectedApplePodcastsRestriction(code, stderr)) {
|
|
100
|
+
console.warn(`apple-podcasts top skipped: ${stderr.trim()}`);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
43
103
|
expect(code).toBe(0);
|
|
44
104
|
const data = parseJsonOutput(stdout);
|
|
45
105
|
expect(Array.isArray(data)).toBe(true);
|
|
@@ -153,6 +213,64 @@ describe('public commands E2E', () => {
|
|
|
153
213
|
expect(stderr).toMatch(/limit must be a positive integer|Argument "limit" must be a valid number/);
|
|
154
214
|
}, 30_000);
|
|
155
215
|
|
|
216
|
+
// ── google suggest (public JSON API) ──
|
|
217
|
+
it('google suggest returns suggestions', async () => {
|
|
218
|
+
const { stdout, stderr, code } = await runCli(['google', 'suggest', 'python', '-f', 'json']);
|
|
219
|
+
if (isExpectedGoogleRestriction(code, stderr)) {
|
|
220
|
+
console.warn(`google suggest skipped: ${stderr.trim()}`);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
expect(code).toBe(0);
|
|
224
|
+
const data = parseJsonOutput(stdout);
|
|
225
|
+
expect(Array.isArray(data)).toBe(true);
|
|
226
|
+
expect(data.length).toBeGreaterThanOrEqual(1);
|
|
227
|
+
expect(data[0]).toHaveProperty('suggestion');
|
|
228
|
+
}, 30_000);
|
|
229
|
+
|
|
230
|
+
// ── google news (public RSS) ──
|
|
231
|
+
it('google news returns headlines', async () => {
|
|
232
|
+
const { stdout, stderr, code } = await runCli(['google', 'news', '--limit', '3', '-f', 'json']);
|
|
233
|
+
if (isExpectedGoogleRestriction(code, stderr)) {
|
|
234
|
+
console.warn(`google news skipped: ${stderr.trim()}`);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
expect(code).toBe(0);
|
|
238
|
+
const data = parseJsonOutput(stdout);
|
|
239
|
+
expect(Array.isArray(data)).toBe(true);
|
|
240
|
+
expect(data.length).toBeGreaterThanOrEqual(1);
|
|
241
|
+
expect(data[0]).toHaveProperty('title');
|
|
242
|
+
expect(data[0]).toHaveProperty('source');
|
|
243
|
+
expect(data[0]).toHaveProperty('url');
|
|
244
|
+
}, 30_000);
|
|
245
|
+
|
|
246
|
+
it('google news search returns results', async () => {
|
|
247
|
+
const { stdout, stderr, code } = await runCli(['google', 'news', 'AI', '--limit', '3', '-f', 'json']);
|
|
248
|
+
if (isExpectedGoogleRestriction(code, stderr)) {
|
|
249
|
+
console.warn(`google news search skipped: ${stderr.trim()}`);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
expect(code).toBe(0);
|
|
253
|
+
const data = parseJsonOutput(stdout);
|
|
254
|
+
expect(Array.isArray(data)).toBe(true);
|
|
255
|
+
expect(data.length).toBeGreaterThanOrEqual(1);
|
|
256
|
+
expect(data[0]).toHaveProperty('title');
|
|
257
|
+
}, 30_000);
|
|
258
|
+
|
|
259
|
+
// ── google trends (public RSS) ──
|
|
260
|
+
it('google trends returns trending searches', async () => {
|
|
261
|
+
const { stdout, stderr, code } = await runCli(['google', 'trends', '--region', 'US', '--limit', '3', '-f', 'json']);
|
|
262
|
+
if (isExpectedGoogleRestriction(code, stderr)) {
|
|
263
|
+
console.warn(`google trends skipped: ${stderr.trim()}`);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
expect(code).toBe(0);
|
|
267
|
+
const data = parseJsonOutput(stdout);
|
|
268
|
+
expect(Array.isArray(data)).toBe(true);
|
|
269
|
+
expect(data.length).toBeGreaterThanOrEqual(1);
|
|
270
|
+
expect(data[0]).toHaveProperty('title');
|
|
271
|
+
expect(data[0]).toHaveProperty('traffic');
|
|
272
|
+
}, 30_000);
|
|
273
|
+
|
|
156
274
|
// ── weread (Chinese site — may return empty on overseas CI runners) ──
|
|
157
275
|
it('weread search returns books', async () => {
|
|
158
276
|
const { stdout, stderr, code } = await runCli(['weread', 'search', 'python', '--limit', '3', '-f', 'json']);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const newCommand: import("../../registry.js").CliCommand;
|
package/dist/clis/feishu/new.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'node:child_process';
|
|
2
|
-
import { cli, Strategy } from '../../registry.js';
|
|
3
|
-
export const newCommand = cli({
|
|
4
|
-
site: 'feishu',
|
|
5
|
-
name: 'new',
|
|
6
|
-
description: 'Create a new message or document in Feishu',
|
|
7
|
-
domain: 'localhost',
|
|
8
|
-
strategy: Strategy.PUBLIC,
|
|
9
|
-
browser: false,
|
|
10
|
-
args: [],
|
|
11
|
-
columns: ['Status'],
|
|
12
|
-
func: async (page) => {
|
|
13
|
-
try {
|
|
14
|
-
execSync("osascript -e 'tell application \"Lark\" to activate'");
|
|
15
|
-
execSync("osascript -e 'delay 0.3'");
|
|
16
|
-
// Cmd+N for new conversation/document
|
|
17
|
-
execSync("osascript " +
|
|
18
|
-
"-e 'tell application \"System Events\"' " +
|
|
19
|
-
"-e 'keystroke \"n\" using command down' " +
|
|
20
|
-
"-e 'end tell'");
|
|
21
|
-
return [{ Status: 'New item dialog opened (Cmd+N)' }];
|
|
22
|
-
}
|
|
23
|
-
catch (err) {
|
|
24
|
-
return [{ Status: 'Error: ' + err.message }];
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const readCommand: import("../../registry.js").CliCommand;
|
package/dist/clis/feishu/read.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { execSync, spawnSync } from 'node:child_process';
|
|
2
|
-
import { cli, Strategy } from '../../registry.js';
|
|
3
|
-
export const readCommand = cli({
|
|
4
|
-
site: 'feishu',
|
|
5
|
-
name: 'read',
|
|
6
|
-
description: 'Read the current chat content by selecting all and copying',
|
|
7
|
-
domain: 'localhost',
|
|
8
|
-
strategy: Strategy.PUBLIC,
|
|
9
|
-
browser: false,
|
|
10
|
-
args: [],
|
|
11
|
-
columns: ['Content'],
|
|
12
|
-
func: async (page) => {
|
|
13
|
-
try {
|
|
14
|
-
let clipBackup = '';
|
|
15
|
-
try {
|
|
16
|
-
clipBackup = execSync('pbpaste', { encoding: 'utf-8' });
|
|
17
|
-
}
|
|
18
|
-
catch { /* empty */ }
|
|
19
|
-
execSync("osascript -e 'tell application \"Lark\" to activate'");
|
|
20
|
-
execSync("osascript -e 'delay 0.3'");
|
|
21
|
-
execSync("osascript " +
|
|
22
|
-
"-e 'tell application \"System Events\"' " +
|
|
23
|
-
"-e 'keystroke \"a\" using command down' " +
|
|
24
|
-
"-e 'delay 0.2' " +
|
|
25
|
-
"-e 'keystroke \"c\" using command down' " +
|
|
26
|
-
"-e 'delay 0.2' " +
|
|
27
|
-
"-e 'end tell'");
|
|
28
|
-
const content = execSync('pbpaste', { encoding: 'utf-8' }).trim();
|
|
29
|
-
if (clipBackup) {
|
|
30
|
-
spawnSync('pbcopy', { input: clipBackup });
|
|
31
|
-
}
|
|
32
|
-
// Deselect
|
|
33
|
-
execSync("osascript -e 'tell application \"System Events\" to key code 53'");
|
|
34
|
-
return [{ Content: content || '(no content captured)' }];
|
|
35
|
-
}
|
|
36
|
-
catch (err) {
|
|
37
|
-
return [{ Content: 'Error: ' + err.message }];
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const searchCommand: import("../../registry.js").CliCommand;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'node:child_process';
|
|
2
|
-
import { cli, Strategy } from '../../registry.js';
|
|
3
|
-
export const searchCommand = cli({
|
|
4
|
-
site: 'feishu',
|
|
5
|
-
name: 'search',
|
|
6
|
-
description: 'Open Feishu global search and type a query (Cmd+K)',
|
|
7
|
-
domain: 'localhost',
|
|
8
|
-
strategy: Strategy.PUBLIC,
|
|
9
|
-
browser: false,
|
|
10
|
-
args: [{ name: 'query', required: true, positional: true, help: 'Search query' }],
|
|
11
|
-
columns: ['Status'],
|
|
12
|
-
func: async (page, kwargs) => {
|
|
13
|
-
const query = kwargs.query;
|
|
14
|
-
try {
|
|
15
|
-
execSync("osascript -e 'tell application \"Lark\" to activate'");
|
|
16
|
-
execSync("osascript -e 'delay 0.3'");
|
|
17
|
-
// Feishu uses Cmd+K for global search (similar to Slack/Notion)
|
|
18
|
-
execSync("osascript " +
|
|
19
|
-
"-e 'tell application \"System Events\"' " +
|
|
20
|
-
"-e 'keystroke \"k\" using command down' " +
|
|
21
|
-
"-e 'delay 0.5' " +
|
|
22
|
-
`-e 'keystroke ${JSON.stringify(query)}' ` +
|
|
23
|
-
"-e 'end tell'");
|
|
24
|
-
return [{ Status: `Searching for: ${query}` }];
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
return [{ Status: 'Error: ' + err.message }];
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const sendCommand: import("../../registry.js").CliCommand;
|