@sovovs/bycli 1.8.0 → 2.1.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/cli-manifest.json +0 -61
- package/clis/twitter/search.js +3 -3
- package/dist/src/adapter-shadow.js +2 -2
- package/dist/src/browser/analyze.d.ts +10 -99
- package/dist/src/browser/analyze.js +10 -226
- package/dist/src/browser/cdp.js +67 -7
- package/dist/src/browser/daemon-client.d.ts +2 -0
- package/dist/src/browser/daemon-client.js +1 -1
- package/dist/src/browser/extension-capabilities.d.ts +13 -0
- package/dist/src/browser/extension-capabilities.js +22 -0
- package/dist/src/browser/extension-capabilities.test.d.ts +1 -0
- package/dist/src/browser/extension-version-metadata.test.d.ts +1 -0
- package/dist/src/browser/navigation-guard.d.ts +78 -0
- package/dist/src/browser/navigation-guard.js +142 -0
- package/dist/src/browser/navigation-guard.test.d.ts +1 -0
- package/dist/src/browser/page.d.ts +1 -0
- package/dist/src/browser/page.js +20 -1
- package/dist/src/browser/url-policy.d.ts +89 -0
- package/dist/src/browser/url-policy.js +311 -0
- package/dist/src/browser/url-policy.test.d.ts +1 -0
- package/dist/src/browser/verify-fixture.js +2 -2
- package/dist/src/build-manifest.js +4 -2
- package/dist/src/capabilityRouting.d.ts +3 -2
- package/dist/src/capabilityRouting.js +10 -2
- package/dist/src/cli.js +11 -14
- package/dist/src/commanderAdapter.js +5 -5
- package/dist/src/config-paths.d.ts +19 -0
- package/dist/src/config-paths.js +31 -0
- package/dist/src/daemon.js +256 -0
- package/dist/src/discovery.d.ts +10 -3
- package/dist/src/discovery.js +20 -10
- package/dist/src/discovery.test.d.ts +1 -0
- package/dist/src/execution.d.ts +5 -0
- package/dist/src/execution.js +272 -48
- package/dist/src/help.js +8 -8
- package/dist/src/main.js +18 -2
- package/dist/src/manifest-schema.d.ts +9 -0
- package/dist/src/manifest-schema.js +162 -0
- package/dist/src/manifest-schema.test.d.ts +1 -0
- package/dist/src/manifest-types.d.ts +1 -1
- package/dist/src/observation/redaction.js +10 -4
- package/dist/src/plugin.js +11 -8
- package/dist/src/recorder/highlevel/analyze.d.ts +29 -0
- package/dist/src/recorder/highlevel/analyze.js +91 -0
- package/dist/src/recorder/highlevel/init.d.ts +125 -0
- package/dist/src/recorder/highlevel/init.js +279 -0
- package/dist/src/recorder/highlevel/init.test.d.ts +1 -0
- package/dist/src/recorder/highlevel/verify.d.ts +73 -0
- package/dist/src/recorder/highlevel/verify.js +74 -0
- package/dist/src/recorder/http/analyze-runner.d.ts +28 -0
- package/dist/src/recorder/http/analyze-runner.js +78 -0
- package/dist/src/recorder/http/analyze-runner.test.d.ts +1 -0
- package/dist/src/recorder/http/handlers.d.ts +51 -0
- package/dist/src/recorder/http/handlers.js +219 -0
- package/dist/src/recorder/http/wrapper-config.d.ts +20 -0
- package/dist/src/recorder/http/wrapper-config.js +82 -0
- package/dist/src/recorder/http/wrapper-envelope.d.ts +31 -0
- package/dist/src/recorder/http/wrapper-envelope.js +51 -0
- package/dist/src/recorder/http/wrapper-gates.d.ts +16 -0
- package/dist/src/recorder/http/wrapper-gates.js +28 -0
- package/dist/src/recorder/http/wrapper-metrics.d.ts +1 -0
- package/dist/src/recorder/http/wrapper-metrics.js +5 -0
- package/dist/src/recorder/http/wrapper-registry.d.ts +50 -0
- package/dist/src/recorder/http/wrapper-registry.js +98 -0
- package/dist/src/recorder/http/wrapper-server.d.ts +59 -0
- package/dist/src/recorder/http/wrapper-server.js +240 -0
- package/dist/src/recorder/http/wrapper.test.d.ts +1 -0
- package/dist/src/recorder/observability/logger.d.ts +5 -0
- package/dist/src/recorder/observability/logger.js +13 -0
- package/dist/src/recorder/runner/config.d.ts +34 -0
- package/dist/src/recorder/runner/config.js +84 -0
- package/dist/src/recorder/runner/config.test.d.ts +1 -0
- package/dist/src/recorder/runner/reap.d.ts +79 -0
- package/dist/src/recorder/runner/reap.js +230 -0
- package/dist/src/recorder/runner/reap.test.d.ts +1 -0
- package/dist/src/recorder/runner/runner-port.d.ts +95 -0
- package/dist/src/recorder/runner/runner-port.js +518 -0
- package/dist/src/recorder/runner/runner-port.test.d.ts +1 -0
- package/dist/src/recorder/runner/session-keys.d.ts +28 -0
- package/dist/src/recorder/runner/session-keys.js +72 -0
- package/dist/src/recorder/runner/session-keys.test.d.ts +1 -0
- package/dist/src/recorder/runner/verify-runner-main.d.ts +96 -0
- package/dist/src/recorder/runner/verify-runner-main.js +292 -0
- package/dist/src/recorder/runner/verify-runner-main.test.d.ts +1 -0
- package/dist/src/registry-api.d.ts +1 -1
- package/dist/src/registry-api.types.test.d.ts +1 -0
- package/dist/src/registry-transaction.d.ts +42 -0
- package/dist/src/registry-transaction.js +194 -0
- package/dist/src/registry-transaction.test.d.ts +1 -0
- package/dist/src/registry.d.ts +58 -16
- package/dist/src/registry.js +131 -15
- package/dist/src/serialization.d.ts +1 -1
- package/dist/src/serialization.js +3 -3
- package/dist/src/types.d.ts +2 -0
- package/package.json +8 -5
- package/scripts/m1-daemon-navigate-drive.mjs +138 -0
- package/scripts/m1-extension-spike.mjs +237 -0
- package/scripts/m1-live-spike.mjs +156 -0
- package/scripts/m6b-connect-back-spike.sh +31 -0
- package/clis/12306/utils.test.js +0 -331
- package/clis/1688/assets.test.js +0 -39
- package/clis/1688/download.test.js +0 -31
- package/clis/1688/item.test.js +0 -67
- package/clis/1688/search.test.js +0 -75
- package/clis/1688/shared.test.js +0 -57
- package/clis/1688/store.test.js +0 -62
- package/clis/36kr/article.test.js +0 -46
- package/clis/36kr/hot.test.js +0 -15
- package/clis/36kr/news.test.js +0 -85
- package/clis/51job/utils.test.js +0 -69
- package/clis/_atlassian/shared.test.js +0 -170
- package/clis/aibase/news.test.js +0 -59
- package/clis/amazon/bestsellers.test.js +0 -29
- package/clis/amazon/discussion.test.js +0 -124
- package/clis/amazon/offer.test.js +0 -29
- package/clis/amazon/product.test.js +0 -24
- package/clis/amazon/rankings.test.js +0 -41
- package/clis/amazon/search.test.js +0 -22
- package/clis/amazon/shared.test.js +0 -44
- package/clis/apple-podcasts/commands.test.js +0 -119
- package/clis/apple-podcasts/utils.test.js +0 -57
- package/clis/arxiv/arxiv.test.js +0 -112
- package/clis/baidu-scholar/search.test.js +0 -23
- package/clis/barchart/greeks.test.js +0 -138
- package/clis/bilibili/comment.test.js +0 -153
- package/clis/bilibili/comments.test.js +0 -142
- package/clis/bilibili/dynamic.test.js +0 -68
- package/clis/bilibili/hot.test.js +0 -17
- package/clis/bilibili/subtitle.test.js +0 -196
- package/clis/bilibili/summary.test.js +0 -210
- package/clis/bilibili/utils.test.js +0 -61
- package/clis/bilibili/video.test.js +0 -132
- package/clis/binance/commands.test.js +0 -70
- package/clis/bloomberg/utils.test.js +0 -129
- package/clis/booking/booking.test.js +0 -356
- package/clis/boss/chatlist.test.js +0 -211
- package/clis/boss/chatmsg.test.js +0 -230
- package/clis/boss/search.test.js +0 -78
- package/clis/boss/utils.test.js +0 -34
- package/clis/brave/search.test.js +0 -76
- package/clis/chaoxing/utils.test.js +0 -45
- package/clis/chatgpt/commands.test.js +0 -45
- package/clis/chatgpt/envelope.test.js +0 -108
- package/clis/chatgpt/image.test.js +0 -188
- package/clis/chatgpt/utils.test.js +0 -330
- package/clis/chatgpt-app/ax.test.js +0 -35
- package/clis/chatwise/composer.test.js +0 -186
- package/clis/chess/analyze.test.js +0 -79
- package/clis/chess/game.test.js +0 -178
- package/clis/chess/games.test.js +0 -164
- package/clis/chess/stats.test.js +0 -79
- package/clis/chess/utils.test.js +0 -230
- package/clis/claude/ask.test.js +0 -338
- package/clis/claude/commands.test.js +0 -118
- package/clis/claude/utils.test.js +0 -148
- package/clis/cnki/search.test.js +0 -18
- package/clis/codex/sidebar.test.js +0 -329
- package/clis/coingecko/coingecko.test.js +0 -109
- package/clis/confluence/commands.test.js +0 -195
- package/clis/coupang/coupang.test.js +0 -159
- package/clis/coupang/utils.test.js +0 -62
- package/clis/ctrip/ctrip.test.js +0 -719
- package/clis/dblp/dblp.test.js +0 -397
- package/clis/deepseek/ask.test.js +0 -312
- package/clis/deepseek/detail.test.js +0 -81
- package/clis/deepseek/send.test.js +0 -107
- package/clis/deepseek/utils.test.js +0 -370
- package/clis/defillama/defillama.test.js +0 -99
- package/clis/devto/devto.test.js +0 -236
- package/clis/dianping/dianping.test.js +0 -578
- package/clis/douban/download.test.js +0 -170
- package/clis/douban/movie-hot.test.js +0 -14
- package/clis/douban/search.test.js +0 -11
- package/clis/douban/subject.test.js +0 -11
- package/clis/douban/utils.test.js +0 -438
- package/clis/doubao/detail.test.js +0 -42
- package/clis/doubao/history.test.js +0 -37
- package/clis/doubao/utils.test.js +0 -344
- package/clis/douyin/_shared/browser-fetch.test.js +0 -64
- package/clis/douyin/_shared/creation-id.test.js +0 -22
- package/clis/douyin/_shared/imagex-upload.test.js +0 -87
- package/clis/douyin/_shared/sts2.test.js +0 -27
- package/clis/douyin/_shared/text-extra.test.js +0 -37
- package/clis/douyin/_shared/timing.test.js +0 -28
- package/clis/douyin/_shared/tos-upload-short-read.test.js +0 -83
- package/clis/douyin/_shared/tos-upload.test.js +0 -229
- package/clis/douyin/_shared/transcode.test.js +0 -91
- package/clis/douyin/_shared/vod-upload.test.js +0 -38
- package/clis/douyin/activities.test.js +0 -55
- package/clis/douyin/collections.test.js +0 -45
- package/clis/douyin/delete.test.js +0 -100
- package/clis/douyin/draft.test.js +0 -335
- package/clis/douyin/drafts.test.js +0 -11
- package/clis/douyin/hashtag.test.js +0 -171
- package/clis/douyin/location.test.js +0 -23
- package/clis/douyin/profile.test.js +0 -46
- package/clis/douyin/publish-upload-id.test.js +0 -170
- package/clis/douyin/publish.test.js +0 -38
- package/clis/douyin/stats.test.js +0 -22
- package/clis/douyin/update.test.js +0 -11
- package/clis/douyin/user-videos.test.js +0 -151
- package/clis/douyin/videos.test.js +0 -54
- package/clis/duckduckgo/search.test.js +0 -128
- package/clis/duckduckgo/suggest.test.js +0 -66
- package/clis/eastmoney/hot-rank.test.js +0 -59
- package/clis/endoflife/endoflife.test.js +0 -51
- package/clis/facebook/feed.test.js +0 -169
- package/clis/facebook/marketplace.test.js +0 -91
- package/clis/facebook/notifications.test.js +0 -458
- package/clis/facebook/search.test.js +0 -55
- package/clis/flathub/flathub.test.js +0 -90
- package/clis/flomo/memos.test.js +0 -144
- package/clis/gemini/ask.test.js +0 -100
- package/clis/gemini/deep-research-result.test.js +0 -155
- package/clis/gemini/deep-research.test.js +0 -181
- package/clis/gemini/reply-state.test.js +0 -671
- package/clis/gemini/utils.test.js +0 -198
- package/clis/geogebra/geogebra.test.js +0 -175
- package/clis/gitee/search.test.js +0 -65
- package/clis/gitee/user.test.js +0 -63
- package/clis/google/utils.test.js +0 -75
- package/clis/google-scholar/cite.test.js +0 -47
- package/clis/google-scholar/profile.test.js +0 -49
- package/clis/google-scholar/search.test.js +0 -71
- package/clis/goproxy/goproxy.test.js +0 -103
- package/clis/gov-law/commands.test.js +0 -39
- package/clis/gov-policy/gov-policy.test.js +0 -224
- package/clis/grok/ask.test.js +0 -29
- package/clis/grok/utils.test.js +0 -103
- package/clis/hackernews/hackernews.test.js +0 -132
- package/clis/hf/hf.test.js +0 -16
- package/clis/hupu/hot.test.js +0 -224
- package/clis/imdb/utils.test.js +0 -88
- package/clis/indeed/indeed.test.js +0 -375
- package/clis/instagram/_shared/private-publish.test.js +0 -705
- package/clis/instagram/_shared/protocol-capture.test.js +0 -114
- package/clis/instagram/download.test.js +0 -118
- package/clis/instagram/note.test.js +0 -53
- package/clis/instagram/post.test.js +0 -1647
- package/clis/instagram/reel.test.js +0 -167
- package/clis/instagram/story.test.js +0 -134
- package/clis/jd/commands.test.js +0 -41
- package/clis/jd/item.test.js +0 -354
- package/clis/jianyu/search.test.js +0 -153
- package/clis/jianyu/shared/procurement-contract.test.js +0 -72
- package/clis/jianyu/shared/procurement-detail.test.js +0 -84
- package/clis/jike/read.test.js +0 -86
- package/clis/jira/commands.test.js +0 -287
- package/clis/juejin/search.js +0 -123
- package/clis/juejin/search.test.js +0 -98
- package/clis/lesswrong/frontpage.test.js +0 -37
- package/clis/lichess/lichess.test.js +0 -85
- package/clis/linkedin/connect.test.js +0 -213
- package/clis/linkedin/inbox.test.js +0 -152
- package/clis/linkedin/job-detail.test.js +0 -38
- package/clis/linkedin/jobs-preferences.test.js +0 -43
- package/clis/linkedin/people-search.test.js +0 -216
- package/clis/linkedin/post-analytics.test.js +0 -40
- package/clis/linkedin/posts.test.js +0 -40
- package/clis/linkedin/profile-analytics.test.js +0 -67
- package/clis/linkedin/profile-experience.test.js +0 -152
- package/clis/linkedin/profile-projects.test.js +0 -111
- package/clis/linkedin/profile-read.test.js +0 -77
- package/clis/linkedin/safe-send.test.js +0 -204
- package/clis/linkedin/salesnav-inbox.test.js +0 -113
- package/clis/linkedin/salesnav-message.test.js +0 -172
- package/clis/linkedin/salesnav-search.test.js +0 -76
- package/clis/linkedin/salesnav-thread.test.js +0 -79
- package/clis/linkedin/search.test.js +0 -222
- package/clis/linkedin/sent-invitations.test.js +0 -62
- package/clis/linkedin/services-read.test.js +0 -105
- package/clis/linkedin/thread-snapshot.test.js +0 -89
- package/clis/linkedin/timeline.test.js +0 -81
- package/clis/linkedin-learning/course.test.js +0 -114
- package/clis/linkedin-learning/search.test.js +0 -144
- package/clis/linkedin-learning/trending.test.js +0 -123
- package/clis/linux-do/feed.test.js +0 -153
- package/clis/linux-do/topic-content.test.js +0 -59
- package/clis/lobsters/lobsters.test.js +0 -169
- package/clis/notebooklm/add-source.test.js +0 -97
- package/clis/notebooklm/compat.test.js +0 -16
- package/clis/notebooklm/create.test.js +0 -58
- package/clis/notebooklm/generate-audio.test.js +0 -63
- package/clis/notebooklm/generate-slides.test.js +0 -75
- package/clis/notebooklm/history.test.js +0 -58
- package/clis/notebooklm/note-list.test.js +0 -56
- package/clis/notebooklm/notes-get.test.js +0 -72
- package/clis/notebooklm/open.test.js +0 -63
- package/clis/notebooklm/rpc.test.js +0 -131
- package/clis/notebooklm/source-fulltext.test.js +0 -106
- package/clis/notebooklm/source-get.test.js +0 -84
- package/clis/notebooklm/source-guide.test.js +0 -104
- package/clis/notebooklm/summary.test.js +0 -78
- package/clis/notebooklm/utils.test.js +0 -449
- package/clis/notebooklm/write-note.test.js +0 -70
- package/clis/nuget/nuget.test.js +0 -111
- package/clis/oeis/oeis.test.js +0 -88
- package/clis/ones/task-helpers.test.js +0 -12
- package/clis/ones/worklog.test.js +0 -20
- package/clis/openfda/openfda.test.js +0 -114
- package/clis/openreview/openreview.test.js +0 -427
- package/clis/osv/osv.test.js +0 -97
- package/clis/paperreview/commands.test.js +0 -243
- package/clis/paperreview/utils.test.js +0 -49
- package/clis/pixiv/download.test.js +0 -87
- package/clis/pixiv/illusts.test.js +0 -99
- package/clis/pixiv/search.test.js +0 -83
- package/clis/powerchina/search.test.js +0 -93
- package/clis/producthunt/utils.test.js +0 -64
- package/clis/pubmed/pubmed.test.js +0 -276
- package/clis/quark/utils.test.js +0 -58
- package/clis/qwen/utils.test.js +0 -45
- package/clis/reddit/extract-media.test.js +0 -149
- package/clis/reddit/frontpage.test.js +0 -34
- package/clis/reddit/home.test.js +0 -170
- package/clis/reddit/hot.test.js +0 -32
- package/clis/reddit/popular.test.js +0 -26
- package/clis/reddit/read.test.js +0 -335
- package/clis/reddit/reply.test.js +0 -89
- package/clis/reddit/search.test.js +0 -26
- package/clis/reddit/subreddit-info.test.js +0 -163
- package/clis/reddit/subreddit.test.js +0 -31
- package/clis/reddit/subscribed.test.js +0 -168
- package/clis/reddit/whoami.test.js +0 -105
- package/clis/rednote/navigation.test.js +0 -26
- package/clis/rednote/rednote.test.js +0 -222
- package/clis/rest-countries/rest-countries.test.js +0 -83
- package/clis/reuters/reuters.test.js +0 -299
- package/clis/rfc/rfc.test.js +0 -74
- package/clis/sinafinance/stock.test.js +0 -59
- package/clis/spotify/utils.test.js +0 -67
- package/clis/stackoverflow/stackoverflow.test.js +0 -404
- package/clis/steam/steam.test.js +0 -46
- package/clis/substack/utils.test.js +0 -44
- package/clis/suno/commands.test.js +0 -188
- package/clis/suno/download.test.js +0 -151
- package/clis/suno/generate.test.js +0 -252
- package/clis/suno/utils.test.js +0 -329
- package/clis/taobao/commands.test.js +0 -41
- package/clis/tdx/hot-rank.test.js +0 -59
- package/clis/ths/hot-rank.test.js +0 -64
- package/clis/tieba/commands.test.js +0 -79
- package/clis/tieba/utils.test.js +0 -290
- package/clis/tiktok/creator-videos.test.js +0 -113
- package/clis/tiktok/refactor.test.js +0 -389
- package/clis/tiktok/write-refactor.test.js +0 -370
- package/clis/toutiao/toutiao.test.js +0 -378
- package/clis/tvmaze/tvmaze.test.js +0 -93
- package/clis/twitter/bookmark-folder.test.js +0 -395
- package/clis/twitter/bookmark-folders.test.js +0 -152
- package/clis/twitter/bookmark.test.js +0 -74
- package/clis/twitter/bookmarks.test.js +0 -205
- package/clis/twitter/delete.test.js +0 -85
- package/clis/twitter/device-follow.test.js +0 -287
- package/clis/twitter/download.test.js +0 -457
- package/clis/twitter/followers.test.js +0 -62
- package/clis/twitter/following.test.js +0 -338
- package/clis/twitter/hide-reply.test.js +0 -76
- package/clis/twitter/like.test.js +0 -73
- package/clis/twitter/likes.test.js +0 -220
- package/clis/twitter/list-add.test.js +0 -133
- package/clis/twitter/list-create.test.js +0 -169
- package/clis/twitter/list-remove.test.js +0 -110
- package/clis/twitter/list-tweets.test.js +0 -196
- package/clis/twitter/lists.test.js +0 -253
- package/clis/twitter/post.test.js +0 -258
- package/clis/twitter/profile.test.js +0 -39
- package/clis/twitter/quote.test.js +0 -194
- package/clis/twitter/reply.test.js +0 -237
- package/clis/twitter/retweet.test.js +0 -73
- package/clis/twitter/search.test.js +0 -349
- package/clis/twitter/shared.test.js +0 -794
- package/clis/twitter/thread.test.js +0 -58
- package/clis/twitter/timeline.test.js +0 -104
- package/clis/twitter/trending.test.js +0 -15
- package/clis/twitter/tweets.test.js +0 -362
- package/clis/twitter/unbookmark.test.js +0 -73
- package/clis/twitter/unlike.test.js +0 -75
- package/clis/twitter/unretweet.test.js +0 -73
- package/clis/twitter/utils.test.js +0 -169
- package/clis/uisdc/news.test.js +0 -66
- package/clis/uiverse/_shared.test.js +0 -62
- package/clis/uiverse/navigation.test.js +0 -12
- package/clis/upwork/upwork.test.js +0 -566
- package/clis/wanfang/search.test.js +0 -23
- package/clis/web/read.test.js +0 -392
- package/clis/weibo/delete.test.js +0 -94
- package/clis/weibo/envelope.test.js +0 -85
- package/clis/weibo/favorites.test.js +0 -114
- package/clis/weibo/publish.test.js +0 -192
- package/clis/weibo/user-posts.test.js +0 -92
- package/clis/weibo/utils.test.js +0 -36
- package/clis/weixin/drafts.test.js +0 -69
- package/clis/weixin/search.test.js +0 -227
- package/clis/weread/ai-outline.test.js +0 -83
- package/clis/weread/book-search.test.js +0 -242
- package/clis/weread/commands.test.js +0 -398
- package/clis/weread/private-api-regression.test.js +0 -369
- package/clis/weread/search-regression.test.js +0 -494
- package/clis/weread/utils.test.js +0 -128
- package/clis/weread-official/commands.test.js +0 -385
- package/clis/weread-official/utils.test.js +0 -242
- package/clis/wikidata/wikidata.test.js +0 -83
- package/clis/wikipedia/trending.test.js +0 -57
- package/clis/wttr/wttr.test.js +0 -84
- package/clis/xianyu/chat.test.js +0 -84
- package/clis/xianyu/im.test.js +0 -253
- package/clis/xianyu/item.test.js +0 -56
- package/clis/xianyu/publish.test.js +0 -220
- package/clis/xianyu/search.test.js +0 -17
- package/clis/xiaoe/xiaoe.test.js +0 -486
- package/clis/xiaohongshu/comments.test.js +0 -258
- package/clis/xiaohongshu/creator-note-detail.test.js +0 -451
- package/clis/xiaohongshu/creator-notes-summary.test.js +0 -94
- package/clis/xiaohongshu/creator-notes.test.js +0 -281
- package/clis/xiaohongshu/creator-stats.test.js +0 -24
- package/clis/xiaohongshu/delete-note.test.js +0 -172
- package/clis/xiaohongshu/download.test.js +0 -316
- package/clis/xiaohongshu/navigation.test.js +0 -34
- package/clis/xiaohongshu/note.test.js +0 -249
- package/clis/xiaohongshu/publish.test.js +0 -608
- package/clis/xiaohongshu/search.test.js +0 -325
- package/clis/xiaohongshu/user-helpers.test.js +0 -160
- package/clis/xiaoyuzhou/auth.test.js +0 -124
- package/clis/xiaoyuzhou/download.test.js +0 -135
- package/clis/xiaoyuzhou/podcast-episodes.test.js +0 -78
- package/clis/xiaoyuzhou/transcript.test.js +0 -195
- package/clis/xiaoyuzhou/utils.test.js +0 -39
- package/clis/xueqiu/comments.test.js +0 -696
- package/clis/xueqiu/danjuan-utils.test.js +0 -41
- package/clis/xueqiu/utils.test.js +0 -26
- package/clis/yahoo/search.test.js +0 -94
- package/clis/youdao/note.test.js +0 -99
- package/clis/youtube/channel.test.js +0 -59
- package/clis/youtube/feed.test.js +0 -131
- package/clis/youtube/transcript-group.test.js +0 -99
- package/clis/youtube/transcript.test.js +0 -296
- package/clis/youtube/utils.test.js +0 -84
- package/clis/yuanbao/ask.test.js +0 -124
- package/clis/yuanbao/new.test.js +0 -30
- package/clis/yuanbao/shared.test.js +0 -80
- package/clis/zhihu/answer-comments.test.js +0 -287
- package/clis/zhihu/answer-detail.test.js +0 -338
- package/clis/zhihu/answer.test.js +0 -54
- package/clis/zhihu/collection.test.js +0 -337
- package/clis/zhihu/collections.test.js +0 -182
- package/clis/zhihu/comment.test.js +0 -50
- package/clis/zhihu/download.test.js +0 -12
- package/clis/zhihu/favorite.test.js +0 -59
- package/clis/zhihu/follow.test.js +0 -42
- package/clis/zhihu/like.test.js +0 -41
- package/clis/zhihu/question.test.js +0 -251
- package/clis/zhihu/recommend.test.js +0 -143
- package/clis/zhihu/search.test.js +0 -198
- package/clis/zhihu/target.test.js +0 -77
- package/clis/zhihu/text.test.js +0 -24
- package/clis/zhihu/write-shared.test.js +0 -176
- package/clis/zlibrary/commands.test.js +0 -65
- package/clis/zsxq/search.test.js +0 -24
- package/clis/zsxq/topic.test.js +0 -30
- package/clis/zsxq/topics.test.js +0 -24
- package/clis/zsxq/utils.test.js +0 -31
- package/dist/src/adapter-shadow.test.js +0 -49
- package/dist/src/adapter-source.test.js +0 -29
- package/dist/src/browser/analyze.test.js +0 -166
- package/dist/src/browser/article-extract.e2e.test.js +0 -105
- package/dist/src/browser/article-extract.test.js +0 -94
- package/dist/src/browser/ax-snapshot.test.js +0 -91
- package/dist/src/browser/base-page.test.js +0 -758
- package/dist/src/browser/cdp-click-fixture.test.js +0 -87
- package/dist/src/browser/cdp.test.js +0 -79
- package/dist/src/browser/compound.test.js +0 -175
- package/dist/src/browser/daemon-client.test.js +0 -199
- package/dist/src/browser/dom-helpers.test.js +0 -106
- package/dist/src/browser/dom-snapshot.test.js +0 -313
- package/dist/src/browser/errors.test.js +0 -60
- package/dist/src/browser/extract.test.js +0 -129
- package/dist/src/browser/find.test.js +0 -180
- package/dist/src/browser/html-tree.test.js +0 -181
- package/dist/src/browser/network-cache.test.js +0 -58
- package/dist/src/browser/network-key.test.js +0 -49
- package/dist/src/browser/page.test.js +0 -378
- package/dist/src/browser/shape-filter.test.js +0 -101
- package/dist/src/browser/shape.test.js +0 -82
- package/dist/src/browser/stealth.test.js +0 -134
- package/dist/src/browser/target-errors.test.js +0 -94
- package/dist/src/browser/target-resolver.test.js +0 -118
- package/dist/src/browser/utils.test.js +0 -29
- package/dist/src/browser/verify-fixture.test.js +0 -219
- package/dist/src/browser.test.js +0 -232
- package/dist/src/build-manifest.test.js +0 -341
- package/dist/src/capabilityRouting.test.js +0 -63
- package/dist/src/cli-argv-preprocess.test.js +0 -209
- package/dist/src/cli.test.js +0 -2803
- package/dist/src/commanderAdapter.test.js +0 -352
- package/dist/src/commands/daemon.test.js +0 -219
- package/dist/src/completion.test.js +0 -24
- package/dist/src/convention-audit.test.js +0 -247
- package/dist/src/daemon.test.js +0 -60
- package/dist/src/doctor.test.js +0 -263
- package/dist/src/download/article-download.test.js +0 -235
- package/dist/src/download/index.test.js +0 -140
- package/dist/src/download/media-download.test.js +0 -112
- package/dist/src/download/progress.test.js +0 -36
- package/dist/src/electron-apps.test.js +0 -49
- package/dist/src/engine.test.js +0 -312
- package/dist/src/errors.test.js +0 -109
- package/dist/src/execution.test.js +0 -623
- package/dist/src/extension-manifest-regression.test.js +0 -12
- package/dist/src/external.test.js +0 -146
- package/dist/src/help.test.js +0 -58
- package/dist/src/hooks.test.js +0 -92
- package/dist/src/interceptor.test.js +0 -81
- package/dist/src/launcher.test.js +0 -138
- package/dist/src/node-network.test.js +0 -55
- package/dist/src/observation/artifact.test.js +0 -121
- package/dist/src/observation/manager.test.js +0 -13
- package/dist/src/observation/redaction.test.js +0 -32
- package/dist/src/observation/retention.test.js +0 -118
- package/dist/src/observation/ring-buffer.test.js +0 -22
- package/dist/src/output.test.js +0 -53
- package/dist/src/package-exports.test.js +0 -112
- package/dist/src/pipeline/executor.test.js +0 -182
- package/dist/src/pipeline/steps/download.test.js +0 -102
- package/dist/src/pipeline/steps/fetch.test.js +0 -117
- package/dist/src/pipeline/template.test.js +0 -175
- package/dist/src/pipeline/transform.test.js +0 -133
- package/dist/src/plugin-manifest.test.js +0 -179
- package/dist/src/plugin-scaffold.test.js +0 -83
- package/dist/src/plugin.test.js +0 -1324
- package/dist/src/registry.test.js +0 -209
- package/dist/src/runtime-detect.test.js +0 -39
- package/dist/src/serialization.test.js +0 -78
- package/dist/src/snapshotFormatter.test.js +0 -521
- package/dist/src/tui.test.js +0 -19
- package/dist/src/update-check.test.js +0 -116
- package/dist/src/utils.test.js +0 -155
- package/dist/src/validate.test.js +0 -90
- package/dist/src/weixin-download.test.js +0 -45
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { __test__ } from './offer.js';
|
|
3
|
-
describe('amazon offer normalization', () => {
|
|
4
|
-
it('extracts sold-by and fulfillment facts from product offer text', () => {
|
|
5
|
-
const result = __test__.normalizeOfferPayload({
|
|
6
|
-
href: 'https://www.amazon.com/dp/B0FJS72893',
|
|
7
|
-
price_text: '$15.99',
|
|
8
|
-
merchant_info: '',
|
|
9
|
-
sold_by: 'KUATUDIRECT',
|
|
10
|
-
ships_from_text: 'Ships from Amazon',
|
|
11
|
-
offer_link: null,
|
|
12
|
-
review_url: 'https://www.amazon.com/dp/B0FJS72893#customerReviews',
|
|
13
|
-
qa_url: null,
|
|
14
|
-
});
|
|
15
|
-
expect(result.asin).toBe('B0FJS72893');
|
|
16
|
-
expect(result.sold_by).toBe('KUATUDIRECT');
|
|
17
|
-
expect(result.ships_from).toBe('Amazon');
|
|
18
|
-
expect(result.is_amazon_sold).toBe(false);
|
|
19
|
-
expect(result.is_amazon_fulfilled).toBe(true);
|
|
20
|
-
});
|
|
21
|
-
it('parses merchant info fallback text', () => {
|
|
22
|
-
expect(__test__.extractSoldBy('Sold by Example Seller and Fulfilled by Amazon.')).toBe('Example Seller');
|
|
23
|
-
expect(__test__.extractShipsFrom('Ships from Amazon')).toBe('Amazon');
|
|
24
|
-
});
|
|
25
|
-
it('detects delivery-location blocking in the buy box text', () => {
|
|
26
|
-
expect(__test__.isDeliveryLocationBlocked('This item cannot be shipped to your selected delivery location. Similar items shipping to Hong Kong')).toBe(true);
|
|
27
|
-
expect(__test__.isDeliveryLocationBlocked('Ships from Amazon')).toBe(false);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { __test__ } from './product.js';
|
|
3
|
-
describe('amazon product normalization', () => {
|
|
4
|
-
it('normalizes product facts from the product page', () => {
|
|
5
|
-
const result = __test__.normalizeProductPayload({
|
|
6
|
-
href: 'https://www.amazon.com/dp/B0FJS72893',
|
|
7
|
-
title: 'Amazon.com: KVTUKIAIT Desktop Shelf Organizer',
|
|
8
|
-
product_title: 'White Desktop Shelf Organizer for Top of Desk',
|
|
9
|
-
byline: 'Visit the KVTUKIAIT Store',
|
|
10
|
-
price_text: '$15.99',
|
|
11
|
-
rating_text: '3.9 out of 5 stars',
|
|
12
|
-
review_count_text: '27 ratings',
|
|
13
|
-
review_url: 'https://www.amazon.com/dp/B0FJS72893#customerReviews',
|
|
14
|
-
qa_url: null,
|
|
15
|
-
bullets: ['SPACE-SAVING DESK SHELF ORGANIZER', 'SMALL AND STYLISH AESTHETIC DECOR'],
|
|
16
|
-
breadcrumbs: ['Office Products', 'Desktop & Off-Surface Shelves'],
|
|
17
|
-
});
|
|
18
|
-
expect(result.asin).toBe('B0FJS72893');
|
|
19
|
-
expect(result.price_value).toBe(15.99);
|
|
20
|
-
expect(result.rating_value).toBe(3.9);
|
|
21
|
-
expect(result.review_count).toBe(27);
|
|
22
|
-
expect(result.breadcrumbs).toEqual(['Office Products', 'Desktop & Off-Surface Shelves']);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { __test__ } from './rankings.js';
|
|
3
|
-
describe('amazon rankings helpers', () => {
|
|
4
|
-
it('normalizes ranking candidates with unified schema', () => {
|
|
5
|
-
const result = __test__.normalizeRankingCandidate({
|
|
6
|
-
rank_text: '#3',
|
|
7
|
-
asin: 'B0DR31GC3D',
|
|
8
|
-
title: 'Desk Shelves Desktop Organizer',
|
|
9
|
-
href: 'https://www.amazon.com/dp/B0DR31GC3D/ref=zg_bs',
|
|
10
|
-
price_text: '$25.92',
|
|
11
|
-
rating_text: '4.3 out of 5 stars',
|
|
12
|
-
review_count_text: '435',
|
|
13
|
-
}, {
|
|
14
|
-
listType: 'new_releases',
|
|
15
|
-
rankFallback: 3,
|
|
16
|
-
listTitle: 'Amazon New Releases',
|
|
17
|
-
sourceUrl: 'https://www.amazon.com/gp/new-releases',
|
|
18
|
-
categoryTitle: 'Home & Kitchen',
|
|
19
|
-
categoryUrl: 'https://www.amazon.com/gp/new-releases/home-garden',
|
|
20
|
-
categoryPath: ['Home & Kitchen'],
|
|
21
|
-
visibleCategoryLinks: [{ title: 'Storage', url: 'https://www.amazon.com/gp/new-releases/storage', node_id: null }],
|
|
22
|
-
});
|
|
23
|
-
expect(result.list_type).toBe('new_releases');
|
|
24
|
-
expect(result.rank).toBe(3);
|
|
25
|
-
expect(result.asin).toBe('B0DR31GC3D');
|
|
26
|
-
expect(result.product_url).toBe('https://www.amazon.com/dp/B0DR31GC3D');
|
|
27
|
-
expect(result.category_title).toBe('Home & Kitchen');
|
|
28
|
-
expect(result.visible_category_links).toEqual([
|
|
29
|
-
{ title: 'Storage', url: 'https://www.amazon.com/gp/new-releases/storage', node_id: null },
|
|
30
|
-
]);
|
|
31
|
-
});
|
|
32
|
-
it('deduplicates category links and parses rank fallback', () => {
|
|
33
|
-
const links = __test__.normalizeVisibleCategoryLinks([
|
|
34
|
-
{ title: 'Kitchen', url: '/gp/new-releases/home-garden' },
|
|
35
|
-
{ title: 'Kitchen', url: 'https://www.amazon.com/gp/new-releases/home-garden' },
|
|
36
|
-
{ title: 'Storage', url: '/gp/new-releases/storage', node_id: '1064954' },
|
|
37
|
-
]);
|
|
38
|
-
expect(links.length).toBe(2);
|
|
39
|
-
expect(__test__.parseRank('N/A', 8)).toBe(8);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { __test__ } from './search.js';
|
|
3
|
-
describe('amazon search normalization', () => {
|
|
4
|
-
it('normalizes search cards into research-friendly fields', () => {
|
|
5
|
-
const result = __test__.normalizeSearchCandidate({
|
|
6
|
-
asin: 'B0FJS72893',
|
|
7
|
-
title: 'White Desktop Shelf Organizer for Top of Desk',
|
|
8
|
-
href: 'https://www.amazon.com/KVTUKIAIT-White-Desktop-Shelf-Organizer/dp/B0FJS72893/ref=sr_1_1',
|
|
9
|
-
price_text: '$15.99',
|
|
10
|
-
rating_text: '3.9 out of 5 stars, rating details',
|
|
11
|
-
review_count_text: '(27)',
|
|
12
|
-
sponsored: false,
|
|
13
|
-
badge_texts: ['Limited time deal'],
|
|
14
|
-
}, 1, 'https://www.amazon.com/s?k=desk+shelf+organizer');
|
|
15
|
-
expect(result.asin).toBe('B0FJS72893');
|
|
16
|
-
expect(result.product_url).toBe('https://www.amazon.com/dp/B0FJS72893');
|
|
17
|
-
expect(result.price_value).toBe(15.99);
|
|
18
|
-
expect(result.rating_value).toBe(3.9);
|
|
19
|
-
expect(result.review_count).toBe(27);
|
|
20
|
-
expect(result.badges).toEqual(['Limited time deal']);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { __test__ } from './shared.js';
|
|
3
|
-
describe('amazon shared helpers', () => {
|
|
4
|
-
it('builds canonical product and discussion URLs from ASINs and product URLs', () => {
|
|
5
|
-
expect(__test__.buildProductUrl('B0FJS72893')).toBe('https://www.amazon.com/dp/B0FJS72893');
|
|
6
|
-
expect(__test__.buildProductUrl('https://www.amazon.com/dp/B0FJS72893/ref=something')).toBe('https://www.amazon.com/dp/B0FJS72893');
|
|
7
|
-
expect(__test__.buildDiscussionUrl('https://www.amazon.com/dp/B0FJS72893')).toBe('https://www.amazon.com/product-reviews/B0FJS72893');
|
|
8
|
-
});
|
|
9
|
-
it('parses price, rating, and review-count text', () => {
|
|
10
|
-
expect(__test__.parsePriceText('1 offer from $34.11')).toEqual({
|
|
11
|
-
price_text: '$34.11',
|
|
12
|
-
price_value: 34.11,
|
|
13
|
-
currency: 'USD',
|
|
14
|
-
});
|
|
15
|
-
expect(__test__.parseRatingValue('3.9 out of 5 stars, rating details')).toBe(3.9);
|
|
16
|
-
expect(__test__.parseReviewCount('27 global ratings')).toBe(27);
|
|
17
|
-
expect(__test__.parseReviewCount('(2.9K)')).toBe(2900);
|
|
18
|
-
expect(__test__.parseReviewCount('1.2M global ratings')).toBe(1200000);
|
|
19
|
-
expect(__test__.extractReviewCountFromCardText('Desk Shelf\n4.3 out of 5 stars\n435\n$25.92')).toBe('435');
|
|
20
|
-
});
|
|
21
|
-
it('recognizes robot checks and Amazon-owned merchants', () => {
|
|
22
|
-
expect(__test__.isAmazonEntity('Ships from Amazon')).toBe(true);
|
|
23
|
-
expect(__test__.trimRatingPrefix('5.0 out of 5 stars Great value and quality')).toBe('Great value and quality');
|
|
24
|
-
expect(__test__.isRobotState({
|
|
25
|
-
title: 'Robot Check',
|
|
26
|
-
body_text: 'Sorry, we just need to make sure you\'re not a robot',
|
|
27
|
-
})).toBe(true);
|
|
28
|
-
});
|
|
29
|
-
it('requires a real best-sellers URL or path', () => {
|
|
30
|
-
expect(__test__.resolveBestsellersUrl('/Best-Sellers/zgbs')).toBe('https://www.amazon.com/Best-Sellers/zgbs');
|
|
31
|
-
expect(() => __test__.resolveBestsellersUrl('desk shelf organizer')).toThrow('amazon bestsellers expects a best sellers URL or /zgbs path');
|
|
32
|
-
});
|
|
33
|
-
it('resolves and validates all ranking list URLs', () => {
|
|
34
|
-
expect(__test__.resolveRankingUrl('new_releases')).toBe('https://www.amazon.com/gp/new-releases');
|
|
35
|
-
expect(__test__.resolveRankingUrl('movers_shakers')).toBe('https://www.amazon.com/gp/movers-and-shakers');
|
|
36
|
-
expect(__test__.resolveRankingUrl('new_releases', '/gp/new-releases/kitchen')).toBe('https://www.amazon.com/gp/new-releases/kitchen');
|
|
37
|
-
expect(__test__.resolveRankingUrl('bestsellers', 'https://www.amazon.com/Best-Sellers/zgbs/ref=zg_bsnr_tab_bs')).toBe('https://www.amazon.com/Best-Sellers/zgbs');
|
|
38
|
-
expect(() => __test__.resolveRankingUrl('movers_shakers', 'https://example.com/gp/movers-and-shakers')).toThrow('Invalid Amazon URL');
|
|
39
|
-
});
|
|
40
|
-
it('extracts category node id from URL best effort', () => {
|
|
41
|
-
expect(__test__.extractCategoryNodeId('https://www.amazon.com/Best-Sellers-Home-Kitchen/zgbs/home-garden/3744371')).toBe('3744371');
|
|
42
|
-
expect(__test__.extractCategoryNodeId('https://www.amazon.com/s?k=desk+organizer&rh=n%3A1064954')).toBe('1064954');
|
|
43
|
-
});
|
|
44
|
-
});
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { getRegistry } from '@sovovs/bycli/registry';
|
|
3
|
-
import './search.js';
|
|
4
|
-
import './top.js';
|
|
5
|
-
describe('apple-podcasts search command', () => {
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
vi.restoreAllMocks();
|
|
8
|
-
});
|
|
9
|
-
it('uses the positional query argument for the iTunes search request', async () => {
|
|
10
|
-
const cmd = getRegistry().get('apple-podcasts/search');
|
|
11
|
-
expect(cmd?.func).toBeTypeOf('function');
|
|
12
|
-
const fetchMock = vi.fn().mockResolvedValue({
|
|
13
|
-
ok: true,
|
|
14
|
-
json: () => Promise.resolve({
|
|
15
|
-
results: [
|
|
16
|
-
{
|
|
17
|
-
collectionId: 42,
|
|
18
|
-
collectionName: 'Machine Learning Guide',
|
|
19
|
-
artistName: 'byCLI',
|
|
20
|
-
trackCount: 12,
|
|
21
|
-
primaryGenreName: 'Technology',
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
}),
|
|
25
|
-
});
|
|
26
|
-
vi.stubGlobal('fetch', fetchMock);
|
|
27
|
-
const result = await cmd.func({
|
|
28
|
-
query: 'machine learning',
|
|
29
|
-
keyword: 'sports',
|
|
30
|
-
limit: 5,
|
|
31
|
-
});
|
|
32
|
-
expect(fetchMock).toHaveBeenCalledWith('https://itunes.apple.com/search?term=machine%20learning&media=podcast&limit=5');
|
|
33
|
-
expect(result).toEqual([
|
|
34
|
-
expect.objectContaining({
|
|
35
|
-
id: 42,
|
|
36
|
-
title: 'Machine Learning Guide',
|
|
37
|
-
author: 'byCLI',
|
|
38
|
-
episodes: 12,
|
|
39
|
-
genre: 'Technology',
|
|
40
|
-
url: '',
|
|
41
|
-
}),
|
|
42
|
-
]);
|
|
43
|
-
});
|
|
44
|
-
it('emits empty-string for missing trackCount and primaryGenreName instead of a sentinel', async () => {
|
|
45
|
-
const cmd = getRegistry().get('apple-podcasts/search');
|
|
46
|
-
const fetchMock = vi.fn().mockResolvedValue({
|
|
47
|
-
ok: true,
|
|
48
|
-
json: () => Promise.resolve({
|
|
49
|
-
results: [
|
|
50
|
-
{
|
|
51
|
-
collectionId: 99,
|
|
52
|
-
collectionName: 'No-Meta Show',
|
|
53
|
-
artistName: 'Anon Host',
|
|
54
|
-
collectionViewUrl: 'https://example.com/p/99',
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
}),
|
|
58
|
-
});
|
|
59
|
-
vi.stubGlobal('fetch', fetchMock);
|
|
60
|
-
const result = await cmd.func({ query: 'no-meta', limit: 1 });
|
|
61
|
-
expect(result[0].episodes).toBe('');
|
|
62
|
-
expect(result[0].genre).toBe('');
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
describe('apple-podcasts top command', () => {
|
|
66
|
-
beforeEach(() => {
|
|
67
|
-
vi.restoreAllMocks();
|
|
68
|
-
});
|
|
69
|
-
it('adds a timeout signal to chart fetches', async () => {
|
|
70
|
-
const cmd = getRegistry().get('apple-podcasts/top');
|
|
71
|
-
expect(cmd?.func).toBeTypeOf('function');
|
|
72
|
-
const fetchMock = vi.fn().mockResolvedValue({
|
|
73
|
-
ok: true,
|
|
74
|
-
json: () => Promise.resolve({
|
|
75
|
-
feed: {
|
|
76
|
-
results: [
|
|
77
|
-
{ id: '100', name: 'Top Show', artistName: 'Host A' },
|
|
78
|
-
],
|
|
79
|
-
},
|
|
80
|
-
}),
|
|
81
|
-
});
|
|
82
|
-
vi.stubGlobal('fetch', fetchMock);
|
|
83
|
-
await cmd.func({ country: 'US', limit: 1 });
|
|
84
|
-
const [, options] = fetchMock.mock.calls[0] ?? [];
|
|
85
|
-
expect(options).toBeDefined();
|
|
86
|
-
expect(options.signal).toBeDefined();
|
|
87
|
-
expect(options.signal).toHaveProperty('aborted', false);
|
|
88
|
-
});
|
|
89
|
-
it('uses the canonical Apple charts host and maps ranked results', async () => {
|
|
90
|
-
const cmd = getRegistry().get('apple-podcasts/top');
|
|
91
|
-
expect(cmd?.func).toBeTypeOf('function');
|
|
92
|
-
const fetchMock = vi.fn().mockResolvedValue({
|
|
93
|
-
ok: true,
|
|
94
|
-
json: () => Promise.resolve({
|
|
95
|
-
feed: {
|
|
96
|
-
results: [
|
|
97
|
-
{ id: '100', name: 'Top Show', artistName: 'Host A' },
|
|
98
|
-
{ id: '101', name: 'Second Show', artistName: 'Host B' },
|
|
99
|
-
],
|
|
100
|
-
},
|
|
101
|
-
}),
|
|
102
|
-
});
|
|
103
|
-
vi.stubGlobal('fetch', fetchMock);
|
|
104
|
-
const result = await cmd.func({ country: 'US', limit: 2 });
|
|
105
|
-
expect(fetchMock).toHaveBeenCalledWith('https://rss.marketingtools.apple.com/api/v2/us/podcasts/top/2/podcasts.json', expect.objectContaining({
|
|
106
|
-
signal: expect.any(Object),
|
|
107
|
-
}));
|
|
108
|
-
expect(result).toEqual([
|
|
109
|
-
{ rank: 1, title: 'Top Show', author: 'Host A', id: '100' },
|
|
110
|
-
{ rank: 2, title: 'Second Show', author: 'Host B', id: '101' },
|
|
111
|
-
]);
|
|
112
|
-
});
|
|
113
|
-
it('normalizes network failures into CliError output', async () => {
|
|
114
|
-
const cmd = getRegistry().get('apple-podcasts/top');
|
|
115
|
-
expect(cmd?.func).toBeTypeOf('function');
|
|
116
|
-
vi.stubGlobal('fetch', vi.fn().mockRejectedValue(new Error('socket hang up')));
|
|
117
|
-
await expect(cmd.func({ country: 'us', limit: 3 })).rejects.toThrow('Unable to reach Apple Podcasts charts for US');
|
|
118
|
-
});
|
|
119
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
-
import { formatDuration, formatDate, itunesFetch } from './utils.js';
|
|
3
|
-
describe('formatDuration', () => {
|
|
4
|
-
it('formats typical duration in ms', () => {
|
|
5
|
-
expect(formatDuration(3661000)).toBe('61:01');
|
|
6
|
-
});
|
|
7
|
-
it('pads single-digit seconds', () => {
|
|
8
|
-
expect(formatDuration(65000)).toBe('1:05');
|
|
9
|
-
});
|
|
10
|
-
it('formats exact minutes', () => {
|
|
11
|
-
expect(formatDuration(3600000)).toBe('60:00');
|
|
12
|
-
});
|
|
13
|
-
it('rounds fractional milliseconds', () => {
|
|
14
|
-
expect(formatDuration(3600500)).toBe('60:01');
|
|
15
|
-
});
|
|
16
|
-
it('returns dash for zero', () => {
|
|
17
|
-
expect(formatDuration(0)).toBe('-');
|
|
18
|
-
});
|
|
19
|
-
it('returns dash for NaN', () => {
|
|
20
|
-
expect(formatDuration(NaN)).toBe('-');
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
describe('formatDate', () => {
|
|
24
|
-
it('extracts YYYY-MM-DD from ISO string', () => {
|
|
25
|
-
expect(formatDate('2026-03-19T12:00:00.000Z')).toBe('2026-03-19');
|
|
26
|
-
});
|
|
27
|
-
it('handles date-only string', () => {
|
|
28
|
-
expect(formatDate('2025-01-01')).toBe('2025-01-01');
|
|
29
|
-
});
|
|
30
|
-
it('returns dash for empty string', () => {
|
|
31
|
-
expect(formatDate('')).toBe('-');
|
|
32
|
-
});
|
|
33
|
-
it('returns dash for undefined', () => {
|
|
34
|
-
expect(formatDate(undefined)).toBe('-');
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
describe('itunesFetch', () => {
|
|
38
|
-
beforeEach(() => {
|
|
39
|
-
vi.restoreAllMocks();
|
|
40
|
-
});
|
|
41
|
-
it('returns parsed JSON on success', async () => {
|
|
42
|
-
const mockData = { resultCount: 1, results: [{ collectionId: 123 }] };
|
|
43
|
-
vi.stubGlobal('fetch', vi.fn().mockResolvedValue({
|
|
44
|
-
ok: true,
|
|
45
|
-
json: () => Promise.resolve(mockData),
|
|
46
|
-
}));
|
|
47
|
-
const result = await itunesFetch('/search?term=test&media=podcast&limit=1');
|
|
48
|
-
expect(result).toEqual(mockData);
|
|
49
|
-
});
|
|
50
|
-
it('throws CliError on HTTP error', async () => {
|
|
51
|
-
vi.stubGlobal('fetch', vi.fn().mockResolvedValue({
|
|
52
|
-
ok: false,
|
|
53
|
-
status: 403,
|
|
54
|
-
}));
|
|
55
|
-
await expect(itunesFetch('/search?term=test')).rejects.toThrow('iTunes API HTTP 403');
|
|
56
|
-
});
|
|
57
|
-
});
|
package/clis/arxiv/arxiv.test.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { getRegistry } from '@sovovs/bycli/registry';
|
|
3
|
-
import { normalizeArxivCategory, normalizeArxivLimit, parseEntries } from './utils.js';
|
|
4
|
-
import './paper.js';
|
|
5
|
-
import './search.js';
|
|
6
|
-
import './recent.js';
|
|
7
|
-
|
|
8
|
-
const SAMPLE_ENTRY_XML = `<?xml version='1.0' encoding='UTF-8'?>
|
|
9
|
-
<feed xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
|
|
10
|
-
xmlns:arxiv="http://arxiv.org/schemas/atom"
|
|
11
|
-
xmlns="http://www.w3.org/2005/Atom">
|
|
12
|
-
<entry>
|
|
13
|
-
<id>http://arxiv.org/abs/1706.03762v7</id>
|
|
14
|
-
<title>Attention Is All You Need & Friends</title>
|
|
15
|
-
<updated>2023-08-02T00:41:18Z</updated>
|
|
16
|
-
<link href="https://arxiv.org/abs/1706.03762v7" rel="alternate" type="text/html"/>
|
|
17
|
-
<link href="https://arxiv.org/pdf/1706.03762v7" rel="related" type="application/pdf" title="pdf"/>
|
|
18
|
-
<summary>The dominant sequence transduction models are based on complex recurrent or convolutional neural networks. We propose a new simple network architecture, the Transformer, based solely on attention.</summary>
|
|
19
|
-
<category term="cs.CL" scheme="http://arxiv.org/schemas/atom"/>
|
|
20
|
-
<category term="cs.LG" scheme="http://arxiv.org/schemas/atom"/>
|
|
21
|
-
<published>2017-06-12T17:57:34Z</published>
|
|
22
|
-
<arxiv:comment>15 pages, 5 figures</arxiv:comment>
|
|
23
|
-
<arxiv:primary_category term="cs.CL"/>
|
|
24
|
-
<author><name>Ashish Vaswani</name></author>
|
|
25
|
-
<author><name>Noam Shazeer</name></author>
|
|
26
|
-
<author><name>Niki Parmar</name></author>
|
|
27
|
-
<author><name>Jakob Uszkoreit</name></author>
|
|
28
|
-
<author><name>Llion Jones</name></author>
|
|
29
|
-
<author><name>Aidan N. Gomez</name></author>
|
|
30
|
-
<author><name>Lukasz Kaiser</name></author>
|
|
31
|
-
<author><name>Illia Polosukhin</name></author>
|
|
32
|
-
</entry>
|
|
33
|
-
</feed>`;
|
|
34
|
-
|
|
35
|
-
describe('arxiv adapter', () => {
|
|
36
|
-
it('registers paper, search and recent commands with the expected columns', () => {
|
|
37
|
-
const paper = getRegistry().get('arxiv/paper');
|
|
38
|
-
const search = getRegistry().get('arxiv/search');
|
|
39
|
-
const recent = getRegistry().get('arxiv/recent');
|
|
40
|
-
|
|
41
|
-
expect(paper).toBeDefined();
|
|
42
|
-
expect(search).toBeDefined();
|
|
43
|
-
expect(recent).toBeDefined();
|
|
44
|
-
|
|
45
|
-
expect(paper.columns).toEqual([
|
|
46
|
-
'id', 'title', 'authors', 'published', 'updated',
|
|
47
|
-
'primary_category', 'categories', 'abstract', 'comment', 'pdf', 'url',
|
|
48
|
-
]);
|
|
49
|
-
expect(search.columns).toEqual([
|
|
50
|
-
'id', 'title', 'authors', 'published', 'primary_category', 'url',
|
|
51
|
-
]);
|
|
52
|
-
expect(recent.columns).toEqual([
|
|
53
|
-
'id', 'title', 'authors', 'published', 'primary_category', 'url',
|
|
54
|
-
]);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('parseEntries returns full abstract, all authors, pdf, primary category and comment', () => {
|
|
58
|
-
const [entry] = parseEntries(SAMPLE_ENTRY_XML);
|
|
59
|
-
|
|
60
|
-
expect(entry.id).toBe('1706.03762');
|
|
61
|
-
expect(entry.title).toBe('Attention Is All You Need & Friends');
|
|
62
|
-
// All 8 authors must be present — earlier impl truncated to 3.
|
|
63
|
-
expect(entry.authors.split(', ')).toHaveLength(8);
|
|
64
|
-
expect(entry.authors).toContain('Ashish Vaswani');
|
|
65
|
-
expect(entry.authors).toContain('Illia Polosukhin');
|
|
66
|
-
// Full abstract — earlier impl truncated at 200 chars.
|
|
67
|
-
expect(entry.abstract.length).toBeGreaterThan(140);
|
|
68
|
-
expect(entry.abstract.endsWith('...')).toBe(false);
|
|
69
|
-
expect(entry.abstract).toContain('attention');
|
|
70
|
-
expect(entry.published).toBe('2017-06-12');
|
|
71
|
-
expect(entry.updated).toBe('2023-08-02');
|
|
72
|
-
expect(entry.primary_category).toBe('cs.CL');
|
|
73
|
-
expect(entry.categories).toBe('cs.CL, cs.LG');
|
|
74
|
-
expect(entry.comment).toBe('15 pages, 5 figures');
|
|
75
|
-
expect(entry.pdf).toBe('https://arxiv.org/pdf/1706.03762v7');
|
|
76
|
-
expect(entry.url).toBe('https://arxiv.org/abs/1706.03762');
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('parseEntries returns an empty list for feeds with no entries', () => {
|
|
80
|
-
expect(parseEntries('<feed></feed>')).toEqual([]);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('recent rejects malformed category strings', async () => {
|
|
84
|
-
const recent = getRegistry().get('arxiv/recent');
|
|
85
|
-
await expect(recent.func({ category: 'not a category', limit: 5 })).rejects.toMatchObject({
|
|
86
|
-
code: 'ARGUMENT',
|
|
87
|
-
});
|
|
88
|
-
await expect(recent.func({ category: '', limit: 5 })).rejects.toMatchObject({
|
|
89
|
-
code: 'ARGUMENT',
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('category validation accepts real arXiv archive and subcategory forms', () => {
|
|
94
|
-
expect(normalizeArxivCategory('cs.CL')).toBe('cs.CL');
|
|
95
|
-
expect(normalizeArxivCategory('math')).toBe('math');
|
|
96
|
-
expect(normalizeArxivCategory('physics.comp-ph')).toBe('physics.comp-ph');
|
|
97
|
-
expect(normalizeArxivCategory('physics.data-an')).toBe('physics.data-an');
|
|
98
|
-
expect(normalizeArxivCategory('cond-mat.soft')).toBe('cond-mat.soft');
|
|
99
|
-
expect(normalizeArxivCategory('q-bio.NC')).toBe('q-bio.NC');
|
|
100
|
-
expect(() => normalizeArxivCategory('not a category')).toThrow('Invalid arXiv category');
|
|
101
|
-
expect(() => normalizeArxivCategory('cs/CL')).toThrow('Invalid arXiv category');
|
|
102
|
-
expect(() => normalizeArxivCategory('')).toThrow('Invalid arXiv category');
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it('limit validation rejects non-positive, non-integer and over-cap values', () => {
|
|
106
|
-
expect(normalizeArxivLimit(10, 5, 25)).toBe(10);
|
|
107
|
-
expect(normalizeArxivLimit(undefined, 5, 25)).toBe(5);
|
|
108
|
-
expect(() => normalizeArxivLimit(0, 5, 25)).toThrow('positive integer');
|
|
109
|
-
expect(() => normalizeArxivLimit(1.5, 5, 25)).toThrow('positive integer');
|
|
110
|
-
expect(() => normalizeArxivLimit(26, 5, 25)).toThrow('<= 25');
|
|
111
|
-
});
|
|
112
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { getRegistry } from '@sovovs/bycli/registry';
|
|
3
|
-
import './search.js';
|
|
4
|
-
|
|
5
|
-
describe('baidu-scholar search command', () => {
|
|
6
|
-
const command = getRegistry().get('baidu-scholar/search');
|
|
7
|
-
|
|
8
|
-
it('registers as a public browser command', () => {
|
|
9
|
-
expect(command).toBeDefined();
|
|
10
|
-
expect(command.site).toBe('baidu-scholar');
|
|
11
|
-
expect(command.strategy).toBe('public');
|
|
12
|
-
expect(command.browser).toBe(true);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('rejects empty queries before browser navigation', async () => {
|
|
16
|
-
const page = { goto: vi.fn() };
|
|
17
|
-
await expect(command.func(page, { query: ' ' })).rejects.toMatchObject({
|
|
18
|
-
name: 'ArgumentError',
|
|
19
|
-
code: 'ARGUMENT',
|
|
20
|
-
});
|
|
21
|
-
expect(page.goto).not.toHaveBeenCalled();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { getRegistry } from '@sovovs/bycli/registry';
|
|
3
|
-
import { ArgumentError, CommandExecutionError, EmptyResultError } from '@sovovs/bycli/errors';
|
|
4
|
-
import './greeks.js';
|
|
5
|
-
|
|
6
|
-
const { normalizeExpiration, normalizeSymbol, parseLimit, unwrapBrowserResult } = await import('./greeks.js').then((m) => m.__test__);
|
|
7
|
-
|
|
8
|
-
function makePage(evaluateResult) {
|
|
9
|
-
return {
|
|
10
|
-
goto: vi.fn().mockResolvedValue(undefined),
|
|
11
|
-
wait: vi.fn().mockResolvedValue(undefined),
|
|
12
|
-
evaluate: vi.fn().mockResolvedValue(evaluateResult),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
describe('barchart greeks command', () => {
|
|
17
|
-
const command = getRegistry().get('barchart/greeks');
|
|
18
|
-
|
|
19
|
-
it('registers with the expected shape', () => {
|
|
20
|
-
expect(command).toBeDefined();
|
|
21
|
-
expect(command.access).toBe('read');
|
|
22
|
-
expect(command.browser).toBe(true);
|
|
23
|
-
expect(command.columns).toEqual([
|
|
24
|
-
'type', 'strike', 'last', 'iv', 'delta', 'gamma', 'theta', 'vega', 'rho',
|
|
25
|
-
'volume', 'openInterest', 'expiration',
|
|
26
|
-
]);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('maps returned option rows without changing the declared output shape', async () => {
|
|
30
|
-
const page = makePage({
|
|
31
|
-
session: 'site:barchart',
|
|
32
|
-
data: {
|
|
33
|
-
ok: true,
|
|
34
|
-
rows: [
|
|
35
|
-
{
|
|
36
|
-
type: 'Call',
|
|
37
|
-
strike: 190,
|
|
38
|
-
last: 3.456,
|
|
39
|
-
iv: 21.234,
|
|
40
|
-
delta: 0.56789,
|
|
41
|
-
gamma: 0.01234,
|
|
42
|
-
theta: -0.12345,
|
|
43
|
-
vega: 0.23456,
|
|
44
|
-
rho: 0.03456,
|
|
45
|
-
volume: 123,
|
|
46
|
-
openInterest: 456,
|
|
47
|
-
expiration: '2026-06-19',
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
const rows = await command.func(page, { symbol: 'aapl', limit: 1 });
|
|
54
|
-
|
|
55
|
-
expect(page.goto).toHaveBeenCalledWith('https://www.barchart.com/stocks/quotes/AAPL/options');
|
|
56
|
-
expect(page.wait).toHaveBeenCalledWith(4);
|
|
57
|
-
expect(rows).toEqual([
|
|
58
|
-
{
|
|
59
|
-
type: 'Call',
|
|
60
|
-
strike: 190,
|
|
61
|
-
last: 3.46,
|
|
62
|
-
iv: '21.23%',
|
|
63
|
-
delta: 0.5679,
|
|
64
|
-
gamma: 0.0123,
|
|
65
|
-
theta: -0.1235,
|
|
66
|
-
vega: 0.2346,
|
|
67
|
-
rho: 0.0346,
|
|
68
|
-
volume: 123,
|
|
69
|
-
openInterest: 456,
|
|
70
|
-
expiration: '2026-06-19',
|
|
71
|
-
},
|
|
72
|
-
]);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('validates args before browser navigation and unwraps bridge envelopes', async () => {
|
|
76
|
-
expect(normalizeSymbol(' aapl ')).toBe('AAPL');
|
|
77
|
-
expect(normalizeExpiration('2026-06-19')).toBe('2026-06-19');
|
|
78
|
-
expect(parseLimit(undefined)).toBe(10);
|
|
79
|
-
expect(parseLimit(100)).toBe(100);
|
|
80
|
-
expect(unwrapBrowserResult({ session: 'site:barchart', data: { ok: true } })).toEqual({ ok: true });
|
|
81
|
-
|
|
82
|
-
await expect(command.func(makePage({ ok: true, rows: [] }), { symbol: '', limit: 1 }))
|
|
83
|
-
.rejects.toBeInstanceOf(ArgumentError);
|
|
84
|
-
await expect(command.func(makePage({ ok: true, rows: [] }), { symbol: 'AAPL', expiration: '2026-02-30', limit: 1 }))
|
|
85
|
-
.rejects.toBeInstanceOf(ArgumentError);
|
|
86
|
-
await expect(command.func(makePage({ ok: true, rows: [] }), { symbol: 'AAPL', limit: 101 }))
|
|
87
|
-
.rejects.toBeInstanceOf(ArgumentError);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it('embeds expiration and limit in the browser-side request script', async () => {
|
|
91
|
-
const page = makePage({
|
|
92
|
-
ok: true,
|
|
93
|
-
rows: [{
|
|
94
|
-
type: 'Put',
|
|
95
|
-
strike: 185,
|
|
96
|
-
last: null,
|
|
97
|
-
iv: null,
|
|
98
|
-
delta: null,
|
|
99
|
-
gamma: null,
|
|
100
|
-
theta: null,
|
|
101
|
-
vega: null,
|
|
102
|
-
rho: null,
|
|
103
|
-
volume: 0,
|
|
104
|
-
openInterest: 0,
|
|
105
|
-
expiration: '2026-07-17',
|
|
106
|
-
}],
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
await command.func(page, { symbol: 'MSFT', expiration: '2026-07-17', limit: 7 });
|
|
110
|
-
const script = page.evaluate.mock.calls[0][0];
|
|
111
|
-
|
|
112
|
-
expect(script).toContain('const expDate = "2026-07-17"');
|
|
113
|
-
expect(script).toContain('const limit = 7');
|
|
114
|
-
expect(script).toContain("url += '&expirationDate=' + encodeURIComponent(expDate)");
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('throws CommandExecutionError for HTTP, malformed, exception, and missing payload states', async () => {
|
|
118
|
-
await expect(command.func(makePage({ ok: false, reason: 'http', status: 403, statusText: 'Forbidden' }), { symbol: 'AAPL' }))
|
|
119
|
-
.rejects.toBeInstanceOf(CommandExecutionError);
|
|
120
|
-
await expect(command.func(makePage({ ok: false, reason: 'malformed' }), { symbol: 'AAPL' }))
|
|
121
|
-
.rejects.toBeInstanceOf(CommandExecutionError);
|
|
122
|
-
await expect(command.func(makePage({ ok: false, reason: 'exception', message: 'network down' }), { symbol: 'AAPL' }))
|
|
123
|
-
.rejects.toBeInstanceOf(CommandExecutionError);
|
|
124
|
-
await expect(command.func(makePage({ ok: false, reason: 'malformed', message: 'options rows did not include call or put identities' }), { symbol: 'AAPL' }))
|
|
125
|
-
.rejects.toThrow('call or put identities');
|
|
126
|
-
await expect(command.func(makePage(null), { symbol: 'AAPL' }))
|
|
127
|
-
.rejects.toBeInstanceOf(CommandExecutionError);
|
|
128
|
-
await expect(command.func(makePage({ ok: true, rows: 'bad' }), { symbol: 'AAPL' }))
|
|
129
|
-
.rejects.toBeInstanceOf(CommandExecutionError);
|
|
130
|
-
await expect(command.func(makePage({ ok: true, rows: [{ type: 'Call', strike: null, expiration: '' }] }), { symbol: 'AAPL' }))
|
|
131
|
-
.rejects.toThrow('malformed option row identity');
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it('throws EmptyResultError when Barchart returns no greeks rows', async () => {
|
|
135
|
-
await expect(command.func(makePage({ ok: true, rows: [] }), { symbol: 'AAPL' }))
|
|
136
|
-
.rejects.toBeInstanceOf(EmptyResultError);
|
|
137
|
-
});
|
|
138
|
-
});
|