@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
package/dist/src/browser.test.js
DELETED
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
-
import { BrowserBridge, generateStealthJs } from './browser/index.js';
|
|
3
|
-
import { extractTabEntries, diffTabIndexes, appendLimited } from './browser/tabs.js';
|
|
4
|
-
import { withTimeoutMs } from './runtime.js';
|
|
5
|
-
import { __test__ as cdpTest } from './browser/cdp.js';
|
|
6
|
-
import { classifyBrowserError } from './browser/errors.js';
|
|
7
|
-
import * as daemonClient from './browser/daemon-client.js';
|
|
8
|
-
describe('browser helpers', () => {
|
|
9
|
-
it('extracts tab entries from string snapshots', () => {
|
|
10
|
-
const entries = extractTabEntries('Tab 0 https://example.com\nTab 1 Chrome Extension');
|
|
11
|
-
expect(entries).toEqual([
|
|
12
|
-
{ index: 0, identity: 'https://example.com' },
|
|
13
|
-
{ index: 1, identity: 'Chrome Extension' },
|
|
14
|
-
]);
|
|
15
|
-
});
|
|
16
|
-
it('extracts tab entries from MCP markdown format', () => {
|
|
17
|
-
const entries = extractTabEntries('- 0: (current) [Playwright MCP extension](chrome-extension://abc/connect.html)\n- 1: [知乎 - 首页](https://www.zhihu.com/)');
|
|
18
|
-
expect(entries).toEqual([
|
|
19
|
-
{ index: 0, identity: '(current) [Playwright MCP extension](chrome-extension://abc/connect.html)' },
|
|
20
|
-
{ index: 1, identity: '[知乎 - 首页](https://www.zhihu.com/)' },
|
|
21
|
-
]);
|
|
22
|
-
});
|
|
23
|
-
it('closes only tabs that were opened during the session', () => {
|
|
24
|
-
const tabsToClose = diffTabIndexes(['https://example.com', 'Chrome Extension'], [
|
|
25
|
-
{ index: 0, identity: 'https://example.com' },
|
|
26
|
-
{ index: 1, identity: 'Chrome Extension' },
|
|
27
|
-
{ index: 2, identity: 'https://target.example/page' },
|
|
28
|
-
{ index: 3, identity: 'chrome-extension://bridge' },
|
|
29
|
-
]);
|
|
30
|
-
expect(tabsToClose).toEqual([3, 2]);
|
|
31
|
-
});
|
|
32
|
-
it('keeps only the tail of stderr buffers', () => {
|
|
33
|
-
expect(appendLimited('12345', '67890', 8)).toBe('34567890');
|
|
34
|
-
});
|
|
35
|
-
it('times out slow promises', async () => {
|
|
36
|
-
await expect(withTimeoutMs(new Promise(() => { }), 10, 'timeout')).rejects.toThrow('timeout');
|
|
37
|
-
});
|
|
38
|
-
it('classifies browser errors with correct kind and retry advice', () => {
|
|
39
|
-
// CDP target navigation — page-level settle retry
|
|
40
|
-
const nav = classifyBrowserError(new Error('{"code":-32000,"message":"Inspected target navigated or closed"}'));
|
|
41
|
-
expect(nav.kind).toBe('target-navigation');
|
|
42
|
-
expect(nav.delayMs).toBe(200);
|
|
43
|
-
// Extension transient — daemon-client retry only, NOT page-level
|
|
44
|
-
const ext = classifyBrowserError(new Error('Extension disconnected'));
|
|
45
|
-
expect(ext.kind).toBe('extension-transient');
|
|
46
|
-
expect(ext.delayMs).toBe(1500);
|
|
47
|
-
// Non-transient errors — not retryable
|
|
48
|
-
expect(classifyBrowserError(new Error('malformed exec payload')).kind).toBe('non-retryable');
|
|
49
|
-
expect(classifyBrowserError(new Error('Permission denied')).kind).toBe('non-retryable');
|
|
50
|
-
});
|
|
51
|
-
it('prefers the real Electron app target over DevTools and blank pages', () => {
|
|
52
|
-
const target = cdpTest.selectCDPTarget([
|
|
53
|
-
{
|
|
54
|
-
type: 'page',
|
|
55
|
-
title: 'DevTools - localhost:9224',
|
|
56
|
-
url: 'devtools://devtools/bundled/inspector.html',
|
|
57
|
-
webSocketDebuggerUrl: 'ws://127.0.0.1:9224/devtools',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
type: 'page',
|
|
61
|
-
title: '',
|
|
62
|
-
url: 'about:blank',
|
|
63
|
-
webSocketDebuggerUrl: 'ws://127.0.0.1:9224/blank',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
type: 'app',
|
|
67
|
-
title: 'Antigravity',
|
|
68
|
-
url: 'http://localhost:3000/',
|
|
69
|
-
webSocketDebuggerUrl: 'ws://127.0.0.1:9224/app',
|
|
70
|
-
},
|
|
71
|
-
]);
|
|
72
|
-
expect(target?.webSocketDebuggerUrl).toBe('ws://127.0.0.1:9224/app');
|
|
73
|
-
});
|
|
74
|
-
it('honors BYCLI_CDP_TARGET when multiple inspectable targets exist', () => {
|
|
75
|
-
vi.stubEnv('BYCLI_CDP_TARGET', 'codex');
|
|
76
|
-
const target = cdpTest.selectCDPTarget([
|
|
77
|
-
{
|
|
78
|
-
type: 'app',
|
|
79
|
-
title: 'Cursor',
|
|
80
|
-
url: 'http://localhost:3000/cursor',
|
|
81
|
-
webSocketDebuggerUrl: 'ws://127.0.0.1:9226/cursor',
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
type: 'app',
|
|
85
|
-
title: 'OpenAI Codex',
|
|
86
|
-
url: 'http://localhost:3000/codex',
|
|
87
|
-
webSocketDebuggerUrl: 'ws://127.0.0.1:9226/codex',
|
|
88
|
-
},
|
|
89
|
-
]);
|
|
90
|
-
expect(target?.webSocketDebuggerUrl).toBe('ws://127.0.0.1:9226/codex');
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
describe('BrowserBridge state', () => {
|
|
94
|
-
it('transitions to closed after close()', async () => {
|
|
95
|
-
const bridge = new BrowserBridge();
|
|
96
|
-
expect(bridge.state).toBe('idle');
|
|
97
|
-
await bridge.close();
|
|
98
|
-
expect(bridge.state).toBe('closed');
|
|
99
|
-
});
|
|
100
|
-
it('rejects connect() after the session has been closed', async () => {
|
|
101
|
-
const bridge = new BrowserBridge();
|
|
102
|
-
await bridge.close();
|
|
103
|
-
await expect(bridge.connect()).rejects.toThrow('Session is closed');
|
|
104
|
-
});
|
|
105
|
-
it('rejects connect() while already connecting', async () => {
|
|
106
|
-
const bridge = new BrowserBridge();
|
|
107
|
-
bridge._state = 'connecting';
|
|
108
|
-
await expect(bridge.connect()).rejects.toThrow('Already connecting');
|
|
109
|
-
});
|
|
110
|
-
it('rejects connect() while closing', async () => {
|
|
111
|
-
const bridge = new BrowserBridge();
|
|
112
|
-
bridge._state = 'closing';
|
|
113
|
-
await expect(bridge.connect()).rejects.toThrow('Session is closing');
|
|
114
|
-
});
|
|
115
|
-
it('fails fast when daemon is running but extension is disconnected (same version)', async () => {
|
|
116
|
-
const { PKG_VERSION } = await import('./version.js');
|
|
117
|
-
vi.spyOn(daemonClient, 'getDaemonHealth').mockResolvedValue({
|
|
118
|
-
state: 'no-extension',
|
|
119
|
-
status: {
|
|
120
|
-
ok: true,
|
|
121
|
-
pid: 1,
|
|
122
|
-
uptime: 0,
|
|
123
|
-
daemonVersion: PKG_VERSION,
|
|
124
|
-
extensionConnected: false,
|
|
125
|
-
pending: 0,
|
|
126
|
-
memoryMB: 0,
|
|
127
|
-
port: 0,
|
|
128
|
-
},
|
|
129
|
-
});
|
|
130
|
-
const bridge = new BrowserBridge();
|
|
131
|
-
await expect(bridge.connect({ timeout: 0.1 })).rejects.toThrow('Browser Bridge extension not connected');
|
|
132
|
-
});
|
|
133
|
-
it('attempts stale daemon replacement when daemonVersion is missing', async () => {
|
|
134
|
-
vi.spyOn(daemonClient, 'getDaemonHealth').mockResolvedValue({
|
|
135
|
-
state: 'no-extension',
|
|
136
|
-
status: {
|
|
137
|
-
ok: true,
|
|
138
|
-
pid: 1,
|
|
139
|
-
uptime: 0,
|
|
140
|
-
extensionConnected: false,
|
|
141
|
-
pending: 0,
|
|
142
|
-
memoryMB: 0,
|
|
143
|
-
port: 0,
|
|
144
|
-
},
|
|
145
|
-
});
|
|
146
|
-
vi.spyOn(daemonClient, 'requestDaemonShutdown').mockResolvedValue(false);
|
|
147
|
-
const bridge = new BrowserBridge();
|
|
148
|
-
await expect(bridge.connect({ timeout: 0.1 })).rejects.toThrow('Stale daemon could not be replaced');
|
|
149
|
-
});
|
|
150
|
-
it('attempts stale daemon replacement when daemonVersion mismatches', async () => {
|
|
151
|
-
vi.spyOn(daemonClient, 'getDaemonHealth').mockResolvedValue({
|
|
152
|
-
state: 'no-extension',
|
|
153
|
-
status: {
|
|
154
|
-
ok: true,
|
|
155
|
-
pid: 1,
|
|
156
|
-
uptime: 0,
|
|
157
|
-
daemonVersion: '0.0.1',
|
|
158
|
-
extensionConnected: false,
|
|
159
|
-
pending: 0,
|
|
160
|
-
memoryMB: 0,
|
|
161
|
-
port: 0,
|
|
162
|
-
},
|
|
163
|
-
});
|
|
164
|
-
vi.spyOn(daemonClient, 'requestDaemonShutdown').mockResolvedValue(false);
|
|
165
|
-
const bridge = new BrowserBridge();
|
|
166
|
-
await expect(bridge.connect({ timeout: 0.1 })).rejects.toThrow('Stale daemon could not be replaced');
|
|
167
|
-
});
|
|
168
|
-
it('attempts stale daemon replacement even when extension is connected', async () => {
|
|
169
|
-
vi.spyOn(daemonClient, 'getDaemonHealth').mockResolvedValue({
|
|
170
|
-
state: 'ready',
|
|
171
|
-
status: {
|
|
172
|
-
ok: true,
|
|
173
|
-
pid: 1,
|
|
174
|
-
uptime: 0,
|
|
175
|
-
daemonVersion: '0.0.1',
|
|
176
|
-
extensionConnected: true,
|
|
177
|
-
pending: 0,
|
|
178
|
-
memoryMB: 0,
|
|
179
|
-
port: 0,
|
|
180
|
-
},
|
|
181
|
-
});
|
|
182
|
-
vi.spyOn(daemonClient, 'requestDaemonShutdown').mockResolvedValue(false);
|
|
183
|
-
const bridge = new BrowserBridge();
|
|
184
|
-
await expect(bridge.connect({ timeout: 0.1 })).rejects.toThrow('Stale daemon could not be replaced');
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
describe('stealth anti-detection', () => {
|
|
188
|
-
it('generates non-empty JS string', () => {
|
|
189
|
-
const js = generateStealthJs();
|
|
190
|
-
expect(typeof js).toBe('string');
|
|
191
|
-
expect(js.length).toBeGreaterThan(100);
|
|
192
|
-
});
|
|
193
|
-
it('contains all 7 anti-detection patches', () => {
|
|
194
|
-
const js = generateStealthJs();
|
|
195
|
-
// 1. webdriver
|
|
196
|
-
expect(js).toContain('navigator');
|
|
197
|
-
expect(js).toContain('webdriver');
|
|
198
|
-
// 2. chrome stub
|
|
199
|
-
expect(js).toContain('window.chrome');
|
|
200
|
-
// 3. plugins
|
|
201
|
-
expect(js).toContain('plugins');
|
|
202
|
-
expect(js).toContain('PDF Viewer');
|
|
203
|
-
// 4. languages
|
|
204
|
-
expect(js).toContain('languages');
|
|
205
|
-
// 5. permissions
|
|
206
|
-
expect(js).toContain('Permissions');
|
|
207
|
-
expect(js).toContain('notifications');
|
|
208
|
-
// 6. automation artifacts (dynamic cdc_ scan)
|
|
209
|
-
expect(js).toContain('__playwright');
|
|
210
|
-
expect(js).toContain('__puppeteer');
|
|
211
|
-
expect(js).toContain('getOwnPropertyNames');
|
|
212
|
-
expect(js).toContain('cdc_');
|
|
213
|
-
// 7. CDP stack trace cleanup
|
|
214
|
-
expect(js).toContain('Error.prototype');
|
|
215
|
-
expect(js).toContain('puppeteer_evaluation_script');
|
|
216
|
-
expect(js).toContain('getOwnPropertyDescriptor');
|
|
217
|
-
});
|
|
218
|
-
it('includes guard flag to prevent double-injection', () => {
|
|
219
|
-
const js = generateStealthJs();
|
|
220
|
-
// Guard uses a non-enumerable property on a built-in prototype
|
|
221
|
-
expect(js).toContain("EventTarget.prototype");
|
|
222
|
-
// Guard should check early and return 'skipped'
|
|
223
|
-
expect(js).toContain("return 'skipped'");
|
|
224
|
-
// Normal path returns 'applied'
|
|
225
|
-
expect(js).toContain("return 'applied'");
|
|
226
|
-
});
|
|
227
|
-
it('generates syntactically valid JS', () => {
|
|
228
|
-
const js = generateStealthJs();
|
|
229
|
-
// Should not throw when parsed
|
|
230
|
-
expect(() => new Function(js)).not.toThrow();
|
|
231
|
-
});
|
|
232
|
-
});
|
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it } from 'vitest';
|
|
2
|
-
import * as fs from 'node:fs';
|
|
3
|
-
import * as os from 'node:os';
|
|
4
|
-
import * as path from 'node:path';
|
|
5
|
-
import { cli, getRegistry, Strategy } from './registry.js';
|
|
6
|
-
import { ManifestImportError, diffRemovedEntries, findManifestMetadataIssues, loadManifestEntries, normalizeManifestPath, parseBuildManifestArgs, scanClisDir, serializeManifest, } from './build-manifest.js';
|
|
7
|
-
describe('manifest helper rules', () => {
|
|
8
|
-
const tempDirs = [];
|
|
9
|
-
afterEach(() => {
|
|
10
|
-
for (const dir of tempDirs.splice(0)) {
|
|
11
|
-
fs.rmSync(dir, { recursive: true, force: true });
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
it('skips TS files that do not register a cli', () => {
|
|
15
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'bycli-manifest-'));
|
|
16
|
-
tempDirs.push(dir);
|
|
17
|
-
const file = path.join(dir, 'utils.ts');
|
|
18
|
-
fs.writeFileSync(file, `export function helper() { return 'noop'; }`);
|
|
19
|
-
return expect(loadManifestEntries(file, 'demo', async () => ({}))).resolves.toEqual([]);
|
|
20
|
-
});
|
|
21
|
-
it('builds TS manifest entries from exported runtime commands', async () => {
|
|
22
|
-
const site = `manifest-hydrate-${Date.now()}`;
|
|
23
|
-
const key = `${site}/dynamic`;
|
|
24
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'bycli-manifest-'));
|
|
25
|
-
tempDirs.push(dir);
|
|
26
|
-
const file = path.join(dir, `${site}.ts`);
|
|
27
|
-
fs.writeFileSync(file, `export const command = cli({ site: '${site}', name: 'dynamic', access: 'read' });`);
|
|
28
|
-
const entries = await loadManifestEntries(file, site, async () => ({
|
|
29
|
-
command: cli({
|
|
30
|
-
site,
|
|
31
|
-
name: 'dynamic',
|
|
32
|
-
access: 'read',
|
|
33
|
-
description: 'dynamic command',
|
|
34
|
-
strategy: Strategy.PUBLIC,
|
|
35
|
-
browser: false,
|
|
36
|
-
aliases: ['metadata'],
|
|
37
|
-
args: [
|
|
38
|
-
{
|
|
39
|
-
name: 'model',
|
|
40
|
-
required: true,
|
|
41
|
-
positional: true,
|
|
42
|
-
help: 'Choose a model',
|
|
43
|
-
choices: ['auto', 'thinking'],
|
|
44
|
-
default: '30',
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
domain: 'localhost',
|
|
48
|
-
navigateBefore: 'https://example.com/session',
|
|
49
|
-
defaultFormat: 'plain',
|
|
50
|
-
}),
|
|
51
|
-
}));
|
|
52
|
-
expect(entries).toMatchObject([
|
|
53
|
-
{
|
|
54
|
-
site,
|
|
55
|
-
name: 'dynamic',
|
|
56
|
-
access: 'read',
|
|
57
|
-
description: 'dynamic command',
|
|
58
|
-
domain: 'localhost',
|
|
59
|
-
strategy: 'public',
|
|
60
|
-
browser: false,
|
|
61
|
-
aliases: ['metadata'],
|
|
62
|
-
args: [
|
|
63
|
-
expect.objectContaining({
|
|
64
|
-
name: 'model',
|
|
65
|
-
type: 'str',
|
|
66
|
-
required: true,
|
|
67
|
-
positional: true,
|
|
68
|
-
help: 'Choose a model',
|
|
69
|
-
choices: ['auto', 'thinking'],
|
|
70
|
-
default: '30',
|
|
71
|
-
}),
|
|
72
|
-
],
|
|
73
|
-
type: 'js',
|
|
74
|
-
modulePath: `${site}/${site}.js`,
|
|
75
|
-
navigateBefore: 'https://example.com/session',
|
|
76
|
-
defaultFormat: 'plain',
|
|
77
|
-
},
|
|
78
|
-
]);
|
|
79
|
-
// Verify sourceFile is included and stable for manifest consumers.
|
|
80
|
-
expect(entries[0].sourceFile).toBeDefined();
|
|
81
|
-
expect(entries[0].sourceFile).not.toContain('\\');
|
|
82
|
-
getRegistry().delete(key);
|
|
83
|
-
});
|
|
84
|
-
it('falls back to registry delta for side-effect-only cli modules', async () => {
|
|
85
|
-
const site = `manifest-side-effect-${Date.now()}`;
|
|
86
|
-
const key = `${site}/legacy`;
|
|
87
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'bycli-manifest-'));
|
|
88
|
-
tempDirs.push(dir);
|
|
89
|
-
const file = path.join(dir, `${site}.ts`);
|
|
90
|
-
fs.writeFileSync(file, `cli({ site: '${site}', name: 'legacy', access: 'read' });`);
|
|
91
|
-
const entries = await loadManifestEntries(file, site, async () => {
|
|
92
|
-
cli({
|
|
93
|
-
site,
|
|
94
|
-
name: 'legacy',
|
|
95
|
-
access: 'read',
|
|
96
|
-
description: 'legacy command',
|
|
97
|
-
});
|
|
98
|
-
return {};
|
|
99
|
-
});
|
|
100
|
-
expect(entries).toMatchObject([
|
|
101
|
-
{
|
|
102
|
-
site,
|
|
103
|
-
name: 'legacy',
|
|
104
|
-
access: 'read',
|
|
105
|
-
description: 'legacy command',
|
|
106
|
-
strategy: 'cookie',
|
|
107
|
-
browser: true,
|
|
108
|
-
args: [],
|
|
109
|
-
type: 'js',
|
|
110
|
-
modulePath: `${site}/${site}.js`,
|
|
111
|
-
},
|
|
112
|
-
]);
|
|
113
|
-
// Verify sourceFile is included
|
|
114
|
-
expect(entries[0].sourceFile).toBeDefined();
|
|
115
|
-
getRegistry().delete(key);
|
|
116
|
-
});
|
|
117
|
-
it('keeps every command a module exports instead of guessing by site', async () => {
|
|
118
|
-
const site = `manifest-multi-${Date.now()}`;
|
|
119
|
-
const screenKey = `${site}/screen`;
|
|
120
|
-
const statusKey = `${site}/status`;
|
|
121
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'bycli-manifest-'));
|
|
122
|
-
tempDirs.push(dir);
|
|
123
|
-
const file = path.join(dir, `${site}.ts`);
|
|
124
|
-
fs.writeFileSync(file, `export const screen = cli({ site: '${site}', name: 'screen', access: 'read' });`);
|
|
125
|
-
const entries = await loadManifestEntries(file, site, async () => ({
|
|
126
|
-
screen: cli({
|
|
127
|
-
site,
|
|
128
|
-
name: 'screen',
|
|
129
|
-
access: 'read',
|
|
130
|
-
description: 'capture screen',
|
|
131
|
-
}),
|
|
132
|
-
status: cli({
|
|
133
|
-
site,
|
|
134
|
-
name: 'status',
|
|
135
|
-
access: 'read',
|
|
136
|
-
description: 'show status',
|
|
137
|
-
}),
|
|
138
|
-
}));
|
|
139
|
-
expect(entries.map(entry => entry.name)).toEqual(['screen', 'status']);
|
|
140
|
-
getRegistry().delete(screenKey);
|
|
141
|
-
getRegistry().delete(statusKey);
|
|
142
|
-
});
|
|
143
|
-
it('normalizes manifest paths to POSIX separators', () => {
|
|
144
|
-
expect(normalizeManifestPath('demo\\status.js')).toBe('demo/status.js');
|
|
145
|
-
expect(normalizeManifestPath('demo/status.js')).toBe('demo/status.js');
|
|
146
|
-
});
|
|
147
|
-
it('serializes manifest json with a trailing newline', () => {
|
|
148
|
-
const serialized = serializeManifest([{
|
|
149
|
-
site: 'demo',
|
|
150
|
-
name: 'status', access: 'read',
|
|
151
|
-
description: '',
|
|
152
|
-
strategy: 'public',
|
|
153
|
-
browser: false,
|
|
154
|
-
args: [],
|
|
155
|
-
type: 'js',
|
|
156
|
-
}]);
|
|
157
|
-
expect(serialized.endsWith('\n')).toBe(true);
|
|
158
|
-
expect(serialized).toContain('\n]');
|
|
159
|
-
});
|
|
160
|
-
it('throws ManifestImportError when an adapter looks like a CLI module but fails to import', async () => {
|
|
161
|
-
// Reproduces the "stale dist drops adapters silently" incident: the file
|
|
162
|
-
// matches the cli() pattern (so it's not just a helper), but the importer
|
|
163
|
-
// throws — we want the failure surfaced, not swallowed.
|
|
164
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'bycli-manifest-fail-'));
|
|
165
|
-
tempDirs.push(dir);
|
|
166
|
-
const file = path.join(dir, 'broken.ts');
|
|
167
|
-
fs.writeFileSync(file, `export const command = cli({ site: 'demo', name: 'broken', access: 'read' });`);
|
|
168
|
-
const importer = async () => { throw new Error('boom: stale dist'); };
|
|
169
|
-
await expect(loadManifestEntries(file, 'demo', importer))
|
|
170
|
-
.rejects.toBeInstanceOf(ManifestImportError);
|
|
171
|
-
try {
|
|
172
|
-
await loadManifestEntries(file, 'demo', importer);
|
|
173
|
-
}
|
|
174
|
-
catch (err) {
|
|
175
|
-
expect(err).toBeInstanceOf(ManifestImportError);
|
|
176
|
-
const e = err;
|
|
177
|
-
expect(e.filePath).toBe(file);
|
|
178
|
-
expect(e.message).toContain('boom: stale dist');
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
it('still silently skips files that do not call cli() even if the importer would have thrown', async () => {
|
|
182
|
-
// The cli() pattern check happens before importing — we don't even ask
|
|
183
|
-
// the importer about helper modules, so a thrown import does not turn
|
|
184
|
-
// them into failures.
|
|
185
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'bycli-manifest-helper-'));
|
|
186
|
-
tempDirs.push(dir);
|
|
187
|
-
const file = path.join(dir, 'helper.ts');
|
|
188
|
-
fs.writeFileSync(file, `export const helper = () => 42;`);
|
|
189
|
-
const importer = async () => { throw new Error('should never be called'); };
|
|
190
|
-
await expect(loadManifestEntries(file, 'demo', importer)).resolves.toEqual([]);
|
|
191
|
-
});
|
|
192
|
-
it('scanClisDir aggregates per-adapter import failures instead of silently dropping them', async () => {
|
|
193
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'bycli-clis-'));
|
|
194
|
-
tempDirs.push(root);
|
|
195
|
-
const siteDir = path.join(root, 'demo');
|
|
196
|
-
fs.mkdirSync(siteDir);
|
|
197
|
-
fs.writeFileSync(path.join(siteDir, 'good.js'), `export const cmd = cli({ site: 'demo', name: 'good', access: 'read' });`);
|
|
198
|
-
fs.writeFileSync(path.join(siteDir, 'broken.js'), `export const cmd = cli({ site: 'demo', name: 'broken', access: 'read' });`);
|
|
199
|
-
const importer = async (href) => {
|
|
200
|
-
if (href.endsWith('broken.js'))
|
|
201
|
-
throw new Error('stale dist drops broken');
|
|
202
|
-
return { cmd: cli({ site: 'demo', name: 'good', access: 'read', description: 'ok' }) };
|
|
203
|
-
};
|
|
204
|
-
const result = await scanClisDir(root, importer);
|
|
205
|
-
expect(result.failures).toHaveLength(1);
|
|
206
|
-
expect(result.failures[0]).toBeInstanceOf(ManifestImportError);
|
|
207
|
-
expect(result.failures[0].filePath).toMatch(/broken\.js$/);
|
|
208
|
-
expect(result.failures[0].message).toContain('stale dist drops broken');
|
|
209
|
-
expect(result.entries.map(e => e.name)).toEqual(['good']);
|
|
210
|
-
getRegistry().delete('demo/good');
|
|
211
|
-
});
|
|
212
|
-
it('diffRemovedEntries returns site/name keys present only in prev', () => {
|
|
213
|
-
const prev = [
|
|
214
|
-
{ site: 'a', name: '1', access: 'read', description: '', strategy: 'public', browser: false, args: [], type: 'js' },
|
|
215
|
-
{ site: 'a', name: '2', access: 'read', description: '', strategy: 'public', browser: false, args: [], type: 'js' },
|
|
216
|
-
{ site: 'b', name: '3', access: 'read', description: '', strategy: 'public', browser: false, args: [], type: 'js' },
|
|
217
|
-
];
|
|
218
|
-
const next = [
|
|
219
|
-
{ site: 'a', name: '1', access: 'read', description: '', strategy: 'public', browser: false, args: [], type: 'js' },
|
|
220
|
-
];
|
|
221
|
-
expect(diffRemovedEntries(prev, next)).toEqual(['a/2', 'b/3']);
|
|
222
|
-
expect(diffRemovedEntries(prev, prev)).toEqual([]);
|
|
223
|
-
expect(diffRemovedEntries([], next)).toEqual([]);
|
|
224
|
-
});
|
|
225
|
-
it('findManifestMetadataIssues flags positionals with empty/missing help', () => {
|
|
226
|
-
// The build-time hard gate. A positional with `help: ''` or no `help` at
|
|
227
|
-
// all renders `Arguments:\n <name>` with a blank trailing column —
|
|
228
|
-
// unrecoverable for both humans and agents reading help. Failing closed
|
|
229
|
-
// here is the only way to keep help text trustworthy as adapters land.
|
|
230
|
-
//
|
|
231
|
-
// Semantic quality (e.g. what does an *optional* positional mean when
|
|
232
|
-
// omitted?) is intentionally NOT enforced — that belongs to the planned
|
|
233
|
-
// Arg metadata v2 advisory pass.
|
|
234
|
-
const entries = [
|
|
235
|
-
// Positional with usable help — clean.
|
|
236
|
-
{
|
|
237
|
-
site: 'demo',
|
|
238
|
-
name: 'ok',
|
|
239
|
-
access: 'read',
|
|
240
|
-
description: '',
|
|
241
|
-
strategy: 'public',
|
|
242
|
-
browser: false,
|
|
243
|
-
args: [
|
|
244
|
-
{ name: 'q', positional: true, required: true, help: 'Search query' },
|
|
245
|
-
],
|
|
246
|
-
type: 'js',
|
|
247
|
-
sourceFile: 'demo/ok.js',
|
|
248
|
-
},
|
|
249
|
-
// Positional with empty help string — must flag.
|
|
250
|
-
{
|
|
251
|
-
site: 'demo',
|
|
252
|
-
name: 'empty-help',
|
|
253
|
-
access: 'read',
|
|
254
|
-
description: '',
|
|
255
|
-
strategy: 'public',
|
|
256
|
-
browser: false,
|
|
257
|
-
args: [
|
|
258
|
-
{ name: 'user', positional: true, required: false, help: '' },
|
|
259
|
-
],
|
|
260
|
-
type: 'js',
|
|
261
|
-
sourceFile: 'demo/empty.js',
|
|
262
|
-
},
|
|
263
|
-
// Positional with whitespace-only help — must flag.
|
|
264
|
-
{
|
|
265
|
-
site: 'demo',
|
|
266
|
-
name: 'whitespace-help',
|
|
267
|
-
access: 'read',
|
|
268
|
-
description: '',
|
|
269
|
-
strategy: 'public',
|
|
270
|
-
browser: false,
|
|
271
|
-
args: [
|
|
272
|
-
{ name: 'id', positional: true, required: true, help: ' ' },
|
|
273
|
-
],
|
|
274
|
-
type: 'js',
|
|
275
|
-
},
|
|
276
|
-
// Positional with no help field at all — must flag.
|
|
277
|
-
{
|
|
278
|
-
site: 'demo',
|
|
279
|
-
name: 'missing-help',
|
|
280
|
-
access: 'read',
|
|
281
|
-
description: '',
|
|
282
|
-
strategy: 'public',
|
|
283
|
-
browser: false,
|
|
284
|
-
args: [
|
|
285
|
-
{ name: 'name', positional: true, required: true },
|
|
286
|
-
],
|
|
287
|
-
type: 'js',
|
|
288
|
-
},
|
|
289
|
-
// NON-positional flag with empty help — must NOT flag (gate is
|
|
290
|
-
// intentionally scoped to positionals; named flags carry the flag
|
|
291
|
-
// name itself in the help line).
|
|
292
|
-
{
|
|
293
|
-
site: 'demo',
|
|
294
|
-
name: 'flag-only',
|
|
295
|
-
access: 'read',
|
|
296
|
-
description: '',
|
|
297
|
-
strategy: 'public',
|
|
298
|
-
browser: false,
|
|
299
|
-
args: [
|
|
300
|
-
{ name: 'limit', required: false, help: '' },
|
|
301
|
-
],
|
|
302
|
-
type: 'js',
|
|
303
|
-
},
|
|
304
|
-
];
|
|
305
|
-
const issues = findManifestMetadataIssues(entries);
|
|
306
|
-
expect(issues).toHaveLength(3);
|
|
307
|
-
expect(issues.map(i => `${i.site}/${i.command}/${i.arg}`).sort()).toEqual([
|
|
308
|
-
'demo/empty-help/user',
|
|
309
|
-
'demo/missing-help/name',
|
|
310
|
-
'demo/whitespace-help/id',
|
|
311
|
-
]);
|
|
312
|
-
// sourceFile flows through when present so the build error points at the
|
|
313
|
-
// exact file to fix.
|
|
314
|
-
const emptyHelp = issues.find(i => i.command === 'empty-help');
|
|
315
|
-
expect(emptyHelp?.sourceFile).toBe('demo/empty.js');
|
|
316
|
-
});
|
|
317
|
-
it('findManifestMetadataIssues returns [] for fully-documented entries', () => {
|
|
318
|
-
expect(findManifestMetadataIssues([])).toEqual([]);
|
|
319
|
-
expect(findManifestMetadataIssues([
|
|
320
|
-
{
|
|
321
|
-
site: 'demo',
|
|
322
|
-
name: 'no-args',
|
|
323
|
-
access: 'read',
|
|
324
|
-
description: '',
|
|
325
|
-
strategy: 'public',
|
|
326
|
-
browser: false,
|
|
327
|
-
args: [],
|
|
328
|
-
type: 'js',
|
|
329
|
-
},
|
|
330
|
-
])).toEqual([]);
|
|
331
|
-
});
|
|
332
|
-
it('parseBuildManifestArgs reads --allow-removals[=N]', () => {
|
|
333
|
-
expect(parseBuildManifestArgs([]).allowRemovals).toBe(0);
|
|
334
|
-
expect(parseBuildManifestArgs(['--allow-removals=5']).allowRemovals).toBe(5);
|
|
335
|
-
expect(parseBuildManifestArgs(['--allow-removals=0']).allowRemovals).toBe(0);
|
|
336
|
-
// Bare flag is the explicit "I know what I'm doing" escape hatch.
|
|
337
|
-
expect(parseBuildManifestArgs(['--allow-removals']).allowRemovals).toBe(Number.POSITIVE_INFINITY);
|
|
338
|
-
// Unknown flags are ignored.
|
|
339
|
-
expect(parseBuildManifestArgs(['--something-else']).allowRemovals).toBe(0);
|
|
340
|
-
});
|
|
341
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { Strategy } from './registry.js';
|
|
3
|
-
import { BROWSER_ONLY_STEPS, _validateBrowserOnlyStepsAgainstRegistry, shouldUseBrowserSession } from './capabilityRouting.js';
|
|
4
|
-
import { getRegisteredStepNames } from './pipeline/registry.js';
|
|
5
|
-
function makeCmd(partial) {
|
|
6
|
-
return {
|
|
7
|
-
site: 'test',
|
|
8
|
-
name: 'command', access: 'read',
|
|
9
|
-
description: '',
|
|
10
|
-
args: [],
|
|
11
|
-
...partial,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
describe('shouldUseBrowserSession', () => {
|
|
15
|
-
it('skips browser session for public fetch-only pipelines', () => {
|
|
16
|
-
expect(shouldUseBrowserSession(makeCmd({
|
|
17
|
-
browser: true,
|
|
18
|
-
strategy: Strategy.PUBLIC,
|
|
19
|
-
pipeline: [{ fetch: 'https://example.com/api' }, { select: 'items' }],
|
|
20
|
-
}))).toBe(false);
|
|
21
|
-
});
|
|
22
|
-
it('keeps browser session for public pipelines with browser-only steps', () => {
|
|
23
|
-
expect(shouldUseBrowserSession(makeCmd({
|
|
24
|
-
browser: true,
|
|
25
|
-
strategy: Strategy.PUBLIC,
|
|
26
|
-
pipeline: [{ navigate: 'https://example.com' }, { evaluate: '() => []' }],
|
|
27
|
-
}))).toBe(true);
|
|
28
|
-
});
|
|
29
|
-
it('keeps browser session for non-public strategies (via normalized navigateBefore)', () => {
|
|
30
|
-
// After normalizeCommand, COOKIE strategy without domain sets navigateBefore: true
|
|
31
|
-
// (signals "needs authenticated browser context" without a specific pre-nav URL).
|
|
32
|
-
expect(shouldUseBrowserSession(makeCmd({
|
|
33
|
-
browser: true,
|
|
34
|
-
strategy: Strategy.COOKIE,
|
|
35
|
-
navigateBefore: true,
|
|
36
|
-
pipeline: [{ fetch: 'https://example.com/api' }],
|
|
37
|
-
}))).toBe(true);
|
|
38
|
-
});
|
|
39
|
-
it('keeps browser session for function adapters', () => {
|
|
40
|
-
expect(shouldUseBrowserSession(makeCmd({
|
|
41
|
-
browser: true,
|
|
42
|
-
strategy: Strategy.PUBLIC,
|
|
43
|
-
func: async () => [],
|
|
44
|
-
}))).toBe(true);
|
|
45
|
-
});
|
|
46
|
-
it('routes pipelines containing the fill step into a browser session', () => {
|
|
47
|
-
expect(shouldUseBrowserSession(makeCmd({
|
|
48
|
-
browser: true,
|
|
49
|
-
strategy: Strategy.PUBLIC,
|
|
50
|
-
pipeline: [{ navigate: 'https://example.com' }, { fill: { ref: '#q', text: 'hello' } }],
|
|
51
|
-
}))).toBe(true);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
describe('BROWSER_ONLY_STEPS / pipeline registry alignment', () => {
|
|
55
|
-
it('is a subset of registered pipeline step names', () => {
|
|
56
|
-
const { extras } = _validateBrowserOnlyStepsAgainstRegistry();
|
|
57
|
-
expect(extras).toEqual([]);
|
|
58
|
-
});
|
|
59
|
-
it('includes fill (DOM-touching step added in PR #1222)', () => {
|
|
60
|
-
expect(BROWSER_ONLY_STEPS.has('fill')).toBe(true);
|
|
61
|
-
expect(getRegisteredStepNames()).toContain('fill');
|
|
62
|
-
});
|
|
63
|
-
});
|