@jackwener/opencli 1.6.9 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -59
- package/README.zh-CN.md +134 -78
- package/dist/clis/_shared/common.d.ts +3 -0
- package/dist/clis/_shared/common.js +22 -0
- package/dist/clis/bilibili/hot.js +35 -0
- package/dist/clis/bluesky/feeds.d.ts +1 -0
- package/dist/clis/bluesky/feeds.js +27 -0
- package/dist/clis/bluesky/followers.d.ts +1 -0
- package/dist/clis/bluesky/followers.js +27 -0
- package/dist/clis/bluesky/following.d.ts +1 -0
- package/dist/clis/bluesky/following.js +27 -0
- package/dist/clis/bluesky/profile.d.ts +1 -0
- package/dist/clis/bluesky/profile.js +29 -0
- package/dist/clis/bluesky/search.d.ts +1 -0
- package/dist/clis/bluesky/search.js +28 -0
- package/dist/clis/bluesky/starter-packs.d.ts +1 -0
- package/dist/clis/bluesky/starter-packs.js +28 -0
- package/dist/clis/bluesky/thread.d.ts +1 -0
- package/dist/clis/bluesky/thread.js +30 -0
- package/dist/clis/bluesky/trending.d.ts +1 -0
- package/dist/clis/bluesky/trending.js +19 -0
- package/dist/clis/bluesky/user.d.ts +1 -0
- package/dist/clis/bluesky/user.js +33 -0
- package/dist/clis/cnki/search.d.ts +1 -0
- package/dist/clis/cnki/search.js +60 -0
- package/dist/clis/cnki/search.test.d.ts +1 -0
- package/dist/clis/cnki/search.test.js +18 -0
- package/dist/clis/devto/tag.d.ts +1 -0
- package/dist/clis/devto/tag.js +32 -0
- package/dist/clis/devto/top.d.ts +1 -0
- package/dist/clis/devto/top.js +26 -0
- package/dist/clis/devto/user.d.ts +1 -0
- package/dist/clis/devto/user.js +31 -0
- package/dist/clis/dictionary/examples.d.ts +1 -0
- package/dist/clis/dictionary/examples.js +27 -0
- package/dist/clis/dictionary/search.d.ts +1 -0
- package/dist/clis/dictionary/search.js +29 -0
- package/dist/clis/dictionary/synonyms.d.ts +1 -0
- package/dist/clis/dictionary/synonyms.js +27 -0
- package/dist/clis/douban/subject.d.ts +1 -0
- package/dist/clis/douban/subject.js +118 -0
- package/dist/clis/douban/top250.d.ts +1 -0
- package/dist/clis/douban/top250.js +67 -0
- package/dist/clis/facebook/add-friend.d.ts +1 -0
- package/dist/clis/facebook/add-friend.js +43 -0
- package/dist/clis/facebook/events.d.ts +1 -0
- package/dist/clis/facebook/events.js +40 -0
- package/dist/clis/facebook/feed.d.ts +1 -0
- package/dist/clis/facebook/feed.js +59 -0
- package/dist/clis/facebook/friends.d.ts +1 -0
- package/dist/clis/facebook/friends.js +38 -0
- package/dist/clis/facebook/groups.d.ts +1 -0
- package/dist/clis/facebook/groups.js +46 -0
- package/dist/clis/facebook/join-group.d.ts +1 -0
- package/dist/clis/facebook/join-group.js +44 -0
- package/dist/clis/facebook/memories.d.ts +1 -0
- package/dist/clis/facebook/memories.js +35 -0
- package/dist/clis/facebook/notifications.d.ts +1 -0
- package/dist/clis/facebook/notifications.js +36 -0
- package/dist/clis/facebook/profile.d.ts +1 -0
- package/dist/clis/facebook/profile.js +37 -0
- package/dist/clis/facebook/search.d.ts +1 -0
- package/dist/clis/facebook/search.js +38 -0
- package/dist/clis/facebook/search.test.d.ts +1 -1
- package/dist/clis/facebook/search.test.js +6 -9
- package/dist/clis/gitee/index.d.ts +3 -0
- package/dist/clis/gitee/index.js +3 -0
- package/dist/clis/gitee/search.d.ts +1 -0
- package/dist/clis/gitee/search.js +136 -0
- package/dist/clis/gitee/trending.d.ts +1 -0
- package/dist/clis/gitee/trending.js +567 -0
- package/dist/clis/gitee/user.d.ts +1 -0
- package/dist/clis/gitee/user.js +199 -0
- package/dist/clis/gitee/user.test.d.ts +1 -0
- package/dist/clis/gitee/user.test.js +63 -0
- package/dist/clis/hackernews/ask.d.ts +1 -0
- package/dist/clis/hackernews/ask.js +29 -0
- package/dist/clis/hackernews/best.d.ts +1 -0
- package/dist/clis/hackernews/best.js +29 -0
- package/dist/clis/hackernews/jobs.d.ts +1 -0
- package/dist/clis/hackernews/jobs.js +27 -0
- package/dist/clis/hackernews/new.d.ts +1 -0
- package/dist/clis/hackernews/new.js +29 -0
- package/dist/clis/hackernews/search.d.ts +1 -0
- package/dist/clis/hackernews/search.js +36 -0
- package/dist/clis/hackernews/show.d.ts +1 -0
- package/dist/clis/hackernews/show.js +29 -0
- package/dist/clis/hackernews/top.d.ts +1 -0
- package/dist/clis/hackernews/top.js +29 -0
- package/dist/clis/hackernews/user.d.ts +1 -0
- package/dist/clis/hackernews/user.js +22 -0
- package/dist/clis/hupu/hot.d.ts +1 -0
- package/dist/clis/hupu/hot.js +40 -0
- package/dist/clis/instagram/comment.d.ts +1 -0
- package/dist/clis/instagram/comment.js +47 -0
- package/dist/clis/instagram/explore.d.ts +1 -0
- package/dist/clis/instagram/explore.js +41 -0
- package/dist/clis/instagram/follow.d.ts +1 -0
- package/dist/clis/instagram/follow.js +43 -0
- package/dist/clis/instagram/followers.d.ts +1 -0
- package/dist/clis/instagram/followers.js +45 -0
- package/dist/clis/instagram/following.d.ts +1 -0
- package/dist/clis/instagram/following.js +45 -0
- package/dist/clis/instagram/like.d.ts +1 -0
- package/dist/clis/instagram/like.js +45 -0
- package/dist/clis/instagram/profile.d.ts +1 -0
- package/dist/clis/instagram/profile.js +39 -0
- package/dist/clis/instagram/save.d.ts +1 -0
- package/dist/clis/instagram/save.js +45 -0
- package/dist/clis/instagram/saved.d.ts +1 -0
- package/dist/clis/instagram/saved.js +38 -0
- package/dist/clis/instagram/search.d.ts +1 -0
- package/dist/clis/instagram/search.js +38 -0
- package/dist/clis/instagram/unfollow.d.ts +1 -0
- package/dist/clis/instagram/unfollow.js +40 -0
- package/dist/clis/instagram/unlike.d.ts +1 -0
- package/dist/clis/instagram/unlike.js +45 -0
- package/dist/clis/instagram/unsave.d.ts +1 -0
- package/dist/clis/instagram/unsave.js +45 -0
- package/dist/clis/instagram/user.d.ts +1 -0
- package/dist/clis/instagram/user.js +48 -0
- package/dist/clis/jd/add-cart.d.ts +1 -0
- package/dist/clis/jd/add-cart.js +71 -0
- package/dist/clis/jd/cart.d.ts +1 -0
- package/dist/clis/jd/cart.js +79 -0
- package/dist/clis/jd/commands.test.d.ts +5 -0
- package/dist/clis/jd/commands.test.js +64 -0
- package/dist/clis/jd/detail.d.ts +1 -0
- package/dist/clis/jd/detail.js +62 -0
- package/dist/clis/jd/reviews.d.ts +1 -0
- package/dist/clis/jd/reviews.js +54 -0
- package/dist/clis/jd/search.d.ts +1 -0
- package/dist/clis/jd/search.js +65 -0
- package/dist/clis/jianyu/detail.d.ts +1 -0
- package/dist/clis/jianyu/detail.js +20 -0
- package/dist/clis/jianyu/search.d.ts +41 -4
- package/dist/clis/jianyu/search.js +458 -96
- package/dist/clis/jianyu/search.test.js +105 -0
- package/dist/clis/jianyu/shared/china-bid-search.d.ts +12 -0
- package/dist/clis/jianyu/shared/china-bid-search.js +165 -0
- package/dist/clis/jianyu/shared/procurement-contract.d.ts +68 -0
- package/dist/clis/jianyu/shared/procurement-contract.js +324 -0
- package/dist/clis/jianyu/shared/procurement-contract.test.d.ts +1 -0
- package/dist/clis/jianyu/shared/procurement-contract.test.js +72 -0
- package/dist/clis/jianyu/shared/procurement-detail.d.ts +6 -0
- package/dist/clis/jianyu/shared/procurement-detail.js +92 -0
- package/dist/clis/jianyu/shared/procurement-detail.test.d.ts +1 -0
- package/dist/clis/jianyu/shared/procurement-detail.test.js +72 -0
- package/dist/clis/jike/post.d.ts +1 -0
- package/dist/clis/jike/post.js +61 -0
- package/dist/clis/jike/topic.d.ts +1 -0
- package/dist/clis/jike/topic.js +51 -0
- package/dist/clis/jike/user.d.ts +1 -0
- package/dist/clis/jike/user.js +50 -0
- package/dist/clis/jimeng/generate.d.ts +1 -0
- package/dist/clis/jimeng/generate.js +83 -0
- package/dist/clis/jimeng/history.d.ts +1 -0
- package/dist/clis/jimeng/history.js +47 -0
- package/dist/clis/jimeng/new.d.ts +1 -0
- package/dist/clis/jimeng/new.js +43 -0
- package/dist/clis/jimeng/workspaces.d.ts +1 -0
- package/dist/clis/jimeng/workspaces.js +41 -0
- package/dist/clis/linux-do/categories.d.ts +1 -0
- package/dist/clis/linux-do/categories.js +65 -0
- package/dist/clis/linux-do/search.d.ts +1 -0
- package/dist/clis/linux-do/search.js +41 -0
- package/dist/clis/linux-do/tags.d.ts +1 -0
- package/dist/clis/linux-do/tags.js +39 -0
- package/dist/clis/linux-do/topic-content.test.js +5 -5
- package/dist/clis/linux-do/topic.d.ts +1 -0
- package/dist/clis/linux-do/topic.js +56 -0
- package/dist/clis/linux-do/user-posts.d.ts +1 -0
- package/dist/clis/linux-do/user-posts.js +61 -0
- package/dist/clis/linux-do/user-topics.d.ts +1 -0
- package/dist/clis/linux-do/user-topics.js +48 -0
- package/dist/clis/lobsters/active.d.ts +1 -0
- package/dist/clis/lobsters/active.js +26 -0
- package/dist/clis/lobsters/hot.d.ts +1 -0
- package/dist/clis/lobsters/hot.js +26 -0
- package/dist/clis/lobsters/newest.d.ts +1 -0
- package/dist/clis/lobsters/newest.js +26 -0
- package/dist/clis/lobsters/tag.d.ts +1 -0
- package/dist/clis/lobsters/tag.js +32 -0
- package/dist/clis/pixiv/detail.d.ts +1 -0
- package/dist/clis/pixiv/detail.js +58 -0
- package/dist/clis/pixiv/ranking.d.ts +1 -0
- package/dist/clis/pixiv/ranking.js +59 -0
- package/dist/clis/pixiv/user.d.ts +1 -0
- package/dist/clis/pixiv/user.js +52 -0
- package/dist/clis/reddit/frontpage.d.ts +1 -0
- package/dist/clis/reddit/frontpage.js +31 -0
- package/dist/clis/reddit/hot.d.ts +1 -0
- package/dist/clis/reddit/hot.js +45 -0
- package/dist/clis/reddit/popular.d.ts +1 -0
- package/dist/clis/reddit/popular.js +41 -0
- package/dist/clis/reddit/search.d.ts +1 -0
- package/dist/clis/reddit/search.js +65 -0
- package/dist/clis/reddit/subreddit.d.ts +1 -0
- package/dist/clis/reddit/subreddit.js +52 -0
- package/dist/clis/reddit/user-comments.d.ts +1 -0
- package/dist/clis/reddit/user-comments.js +44 -0
- package/dist/clis/reddit/user-posts.d.ts +1 -0
- package/dist/clis/reddit/user-posts.js +42 -0
- package/dist/clis/reddit/user.d.ts +1 -0
- package/dist/clis/reddit/user.js +37 -0
- package/dist/clis/stackoverflow/bounties.d.ts +1 -0
- package/dist/clis/stackoverflow/bounties.js +27 -0
- package/dist/clis/stackoverflow/hot.d.ts +1 -0
- package/dist/clis/stackoverflow/hot.js +24 -0
- package/dist/clis/stackoverflow/search.d.ts +1 -0
- package/dist/clis/stackoverflow/search.js +27 -0
- package/dist/clis/stackoverflow/unanswered.d.ts +1 -0
- package/dist/clis/stackoverflow/unanswered.js +26 -0
- package/dist/clis/steam/top-sellers.d.ts +1 -0
- package/dist/clis/steam/top-sellers.js +25 -0
- package/dist/clis/taobao/add-cart.d.ts +1 -0
- package/dist/clis/taobao/add-cart.js +149 -0
- package/dist/clis/taobao/cart.d.ts +1 -0
- package/dist/clis/taobao/cart.js +95 -0
- package/dist/clis/taobao/commands.test.d.ts +5 -0
- package/dist/clis/taobao/commands.test.js +64 -0
- package/dist/clis/taobao/detail.d.ts +1 -0
- package/dist/clis/taobao/detail.js +70 -0
- package/dist/clis/taobao/reviews.d.ts +1 -0
- package/dist/clis/taobao/reviews.js +76 -0
- package/dist/clis/taobao/search.d.ts +1 -0
- package/dist/clis/taobao/search.js +96 -0
- package/dist/clis/tiktok/comment.d.ts +1 -0
- package/dist/clis/tiktok/comment.js +57 -0
- package/dist/clis/tiktok/explore.d.ts +1 -0
- package/dist/clis/tiktok/explore.js +35 -0
- package/dist/clis/tiktok/follow.d.ts +1 -0
- package/dist/clis/tiktok/follow.js +39 -0
- package/dist/clis/tiktok/following.d.ts +1 -0
- package/dist/clis/tiktok/following.js +42 -0
- package/dist/clis/tiktok/friends.d.ts +1 -0
- package/dist/clis/tiktok/friends.js +43 -0
- package/dist/clis/tiktok/like.d.ts +1 -0
- package/dist/clis/tiktok/like.js +33 -0
- package/dist/clis/tiktok/live.d.ts +1 -0
- package/dist/clis/tiktok/live.js +47 -0
- package/dist/clis/tiktok/notifications.d.ts +1 -0
- package/dist/clis/tiktok/notifications.js +49 -0
- package/dist/clis/tiktok/profile.d.ts +1 -0
- package/dist/clis/tiktok/profile.js +54 -0
- package/dist/clis/tiktok/save.d.ts +1 -0
- package/dist/clis/tiktok/save.js +29 -0
- package/dist/clis/tiktok/search.d.ts +1 -0
- package/dist/clis/tiktok/search.js +39 -0
- package/dist/clis/tiktok/unfollow.d.ts +1 -0
- package/dist/clis/tiktok/unfollow.js +44 -0
- package/dist/clis/tiktok/unlike.d.ts +1 -0
- package/dist/clis/tiktok/unlike.js +33 -0
- package/dist/clis/tiktok/unsave.d.ts +1 -0
- package/dist/clis/tiktok/unsave.js +31 -0
- package/dist/clis/tiktok/user.d.ts +1 -0
- package/dist/clis/tiktok/user.js +41 -0
- package/dist/clis/v2ex/hot.d.ts +1 -0
- package/dist/clis/v2ex/hot.js +25 -0
- package/dist/clis/v2ex/latest.d.ts +1 -0
- package/dist/clis/v2ex/latest.js +25 -0
- package/dist/clis/v2ex/member.d.ts +1 -0
- package/dist/clis/v2ex/member.js +27 -0
- package/dist/clis/v2ex/node.d.ts +1 -0
- package/dist/clis/v2ex/node.js +38 -0
- package/dist/clis/v2ex/nodes.d.ts +1 -0
- package/dist/clis/v2ex/nodes.js +25 -0
- package/dist/clis/v2ex/replies.d.ts +1 -0
- package/dist/clis/v2ex/replies.js +26 -0
- package/dist/clis/v2ex/topic.d.ts +1 -0
- package/dist/clis/v2ex/topic.js +30 -0
- package/dist/clis/v2ex/user.d.ts +1 -0
- package/dist/clis/v2ex/user.js +33 -0
- package/dist/clis/xiaoe/catalog.d.ts +1 -0
- package/dist/clis/xiaoe/catalog.js +161 -0
- package/dist/clis/xiaoe/content.d.ts +1 -0
- package/dist/clis/xiaoe/content.js +39 -0
- package/dist/clis/xiaoe/courses.d.ts +1 -0
- package/dist/clis/xiaoe/courses.js +69 -0
- package/dist/clis/xiaoe/detail.d.ts +1 -0
- package/dist/clis/xiaoe/detail.js +35 -0
- package/dist/clis/xiaoe/play-url.d.ts +1 -0
- package/dist/clis/xiaoe/play-url.js +120 -0
- package/dist/clis/xiaohongshu/feed.d.ts +1 -0
- package/dist/clis/xiaohongshu/feed.js +32 -0
- package/dist/clis/xiaohongshu/notifications.d.ts +1 -0
- package/dist/clis/xiaohongshu/notifications.js +38 -0
- package/dist/clis/xueqiu/earnings-date.d.ts +1 -0
- package/dist/clis/xueqiu/earnings-date.js +61 -0
- package/dist/clis/xueqiu/feed.d.ts +1 -0
- package/dist/clis/xueqiu/feed.js +48 -0
- package/dist/clis/xueqiu/groups.d.ts +1 -0
- package/dist/clis/xueqiu/groups.js +25 -0
- package/dist/clis/xueqiu/hot-stock.d.ts +1 -0
- package/dist/clis/xueqiu/hot-stock.js +44 -0
- package/dist/clis/xueqiu/hot.d.ts +1 -0
- package/dist/clis/xueqiu/hot.js +44 -0
- package/dist/clis/xueqiu/kline.d.ts +1 -0
- package/dist/clis/xueqiu/kline.js +64 -0
- package/dist/clis/xueqiu/search.d.ts +1 -0
- package/dist/clis/xueqiu/search.js +49 -0
- package/dist/clis/xueqiu/stock.d.ts +1 -0
- package/dist/clis/xueqiu/stock.js +72 -0
- package/dist/clis/xueqiu/watchlist.d.ts +1 -0
- package/dist/clis/xueqiu/watchlist.js +45 -0
- package/dist/clis/zhihu/hot.d.ts +1 -0
- package/dist/clis/zhihu/hot.js +43 -0
- package/dist/clis/zhihu/search.d.ts +1 -0
- package/dist/clis/zhihu/search.js +52 -0
- package/dist/src/browser/bridge.js +1 -1
- package/dist/src/browser/daemon-client.d.ts +16 -4
- package/dist/src/browser/daemon-client.js +33 -15
- package/dist/src/browser/daemon-client.test.js +0 -3
- package/dist/src/browser/dom-helpers.test.js +3 -2
- package/dist/src/browser/errors.d.ts +26 -1
- package/dist/src/browser/errors.js +40 -7
- package/dist/src/browser/errors.test.d.ts +1 -0
- package/dist/src/browser/errors.test.js +51 -0
- package/dist/src/browser/page.d.ts +9 -8
- package/dist/src/browser/page.js +33 -31
- package/dist/src/browser.test.js +25 -6
- package/dist/src/build-manifest.d.ts +5 -11
- package/dist/src/build-manifest.js +6 -75
- package/dist/src/build-manifest.test.js +1 -39
- package/dist/src/cascade.js +3 -2
- package/dist/src/cli.d.ts +3 -3
- package/dist/src/cli.js +71 -71
- package/dist/src/cli.test.js +20 -15
- package/dist/src/clis/binance/asks.d.ts +1 -0
- package/dist/src/clis/binance/asks.js +20 -0
- package/dist/src/clis/binance/commands.test.d.ts +3 -1
- package/dist/src/clis/binance/commands.test.js +10 -6
- package/dist/src/clis/binance/depth.d.ts +1 -0
- package/dist/src/clis/binance/depth.js +20 -0
- package/dist/src/clis/binance/gainers.d.ts +1 -0
- package/dist/src/clis/binance/gainers.js +21 -0
- package/dist/src/clis/binance/klines.d.ts +1 -0
- package/dist/src/clis/binance/klines.js +20 -0
- package/dist/src/clis/binance/losers.d.ts +1 -0
- package/dist/src/clis/binance/losers.js +21 -0
- package/dist/src/clis/binance/pairs.d.ts +1 -0
- package/dist/src/clis/binance/pairs.js +20 -0
- package/dist/src/clis/binance/price.d.ts +1 -0
- package/dist/src/clis/binance/price.js +17 -0
- package/dist/src/clis/binance/prices.d.ts +1 -0
- package/dist/src/clis/binance/prices.js +18 -0
- package/dist/src/clis/binance/ticker.d.ts +1 -0
- package/dist/src/clis/binance/ticker.js +20 -0
- package/dist/src/clis/binance/top.d.ts +1 -0
- package/dist/src/clis/binance/top.js +20 -0
- package/dist/src/clis/binance/trades.d.ts +1 -0
- package/dist/src/clis/binance/trades.js +19 -0
- package/dist/src/commands/daemon.d.ts +2 -6
- package/dist/src/commands/daemon.js +2 -58
- package/dist/src/commands/daemon.test.js +24 -120
- package/dist/src/completion-fast.d.ts +25 -0
- package/dist/src/completion-fast.js +140 -0
- package/dist/src/completion.d.ts +1 -0
- package/dist/src/completion.js +1 -0
- package/dist/src/constants.d.ts +0 -2
- package/dist/src/constants.js +0 -2
- package/dist/src/daemon.d.ts +1 -1
- package/dist/src/daemon.js +2 -15
- package/dist/src/diagnostic.test.js +2 -2
- package/dist/src/discovery.d.ts +3 -3
- package/dist/src/discovery.js +34 -97
- package/dist/src/download/index.d.ts +1 -1
- package/dist/src/engine.test.js +4 -19
- package/dist/src/execution.js +5 -1
- package/dist/src/generate-verified.d.ts +105 -0
- package/dist/src/generate-verified.js +696 -0
- package/dist/src/generate-verified.test.d.ts +1 -0
- package/dist/src/generate-verified.test.js +925 -0
- package/dist/src/generate.d.ts +9 -1
- package/dist/src/generate.js +2 -2
- package/dist/src/main.js +65 -12
- package/dist/src/pipeline/steps/download.d.ts +1 -17
- package/dist/src/pipeline/steps/download.js +20 -31
- package/dist/src/pipeline/steps/intercept.d.ts +1 -1
- package/dist/src/pipeline/steps/intercept.js +1 -1
- package/dist/src/pipeline/steps/tap.d.ts +1 -1
- package/dist/src/pipeline/steps/tap.js +1 -1
- package/dist/src/plugin-scaffold.d.ts +2 -2
- package/dist/src/plugin-scaffold.js +24 -21
- package/dist/src/plugin-scaffold.test.js +1 -1
- package/dist/src/plugin.d.ts +1 -1
- package/dist/src/plugin.js +4 -6
- package/dist/src/plugin.test.js +31 -31
- package/dist/src/record.js +26 -25
- package/dist/src/runtime-detect.js +3 -7
- package/dist/src/scripts/framework.d.ts +3 -0
- package/dist/src/scripts/framework.js +8 -4
- package/dist/src/scripts/store.d.ts +5 -1
- package/dist/src/scripts/store.js +5 -1
- package/dist/src/skill-generate.d.ts +30 -0
- package/dist/src/skill-generate.js +75 -0
- package/dist/src/skill-generate.test.d.ts +1 -0
- package/dist/src/skill-generate.test.js +173 -0
- package/dist/src/synthesize.d.ts +1 -1
- package/dist/src/synthesize.js +7 -8
- package/dist/src/types.d.ts +3 -1
- package/package.json +4 -3
- package/dist/clis/bilibili/hot.yaml +0 -38
- package/dist/clis/bluesky/feeds.yaml +0 -29
- package/dist/clis/bluesky/followers.yaml +0 -33
- package/dist/clis/bluesky/following.yaml +0 -33
- package/dist/clis/bluesky/profile.yaml +0 -27
- package/dist/clis/bluesky/search.yaml +0 -34
- package/dist/clis/bluesky/starter-packs.yaml +0 -34
- package/dist/clis/bluesky/thread.yaml +0 -32
- package/dist/clis/bluesky/trending.yaml +0 -27
- package/dist/clis/bluesky/user.yaml +0 -34
- package/dist/clis/devto/tag.yaml +0 -34
- package/dist/clis/devto/top.yaml +0 -29
- package/dist/clis/devto/user.yaml +0 -33
- package/dist/clis/dictionary/examples.yaml +0 -25
- package/dist/clis/dictionary/search.yaml +0 -27
- package/dist/clis/dictionary/synonyms.yaml +0 -25
- package/dist/clis/douban/subject.yaml +0 -107
- package/dist/clis/douban/top250.yaml +0 -70
- package/dist/clis/facebook/add-friend.yaml +0 -43
- package/dist/clis/facebook/events.yaml +0 -44
- package/dist/clis/facebook/feed.yaml +0 -63
- package/dist/clis/facebook/friends.yaml +0 -42
- package/dist/clis/facebook/groups.yaml +0 -50
- package/dist/clis/facebook/join-group.yaml +0 -44
- package/dist/clis/facebook/memories.yaml +0 -39
- package/dist/clis/facebook/notifications.yaml +0 -40
- package/dist/clis/facebook/profile.yaml +0 -37
- package/dist/clis/facebook/search.yaml +0 -47
- package/dist/clis/hackernews/ask.yaml +0 -38
- package/dist/clis/hackernews/best.yaml +0 -38
- package/dist/clis/hackernews/jobs.yaml +0 -36
- package/dist/clis/hackernews/new.yaml +0 -38
- package/dist/clis/hackernews/search.yaml +0 -44
- package/dist/clis/hackernews/show.yaml +0 -38
- package/dist/clis/hackernews/top.yaml +0 -38
- package/dist/clis/hackernews/user.yaml +0 -25
- package/dist/clis/hupu/hot.yaml +0 -43
- package/dist/clis/instagram/comment.yaml +0 -52
- package/dist/clis/instagram/explore.yaml +0 -43
- package/dist/clis/instagram/follow.yaml +0 -41
- package/dist/clis/instagram/followers.yaml +0 -51
- package/dist/clis/instagram/following.yaml +0 -51
- package/dist/clis/instagram/like.yaml +0 -46
- package/dist/clis/instagram/profile.yaml +0 -42
- package/dist/clis/instagram/save.yaml +0 -46
- package/dist/clis/instagram/saved.yaml +0 -40
- package/dist/clis/instagram/search.yaml +0 -44
- package/dist/clis/instagram/unfollow.yaml +0 -38
- package/dist/clis/instagram/unlike.yaml +0 -46
- package/dist/clis/instagram/unsave.yaml +0 -46
- package/dist/clis/instagram/user.yaml +0 -54
- package/dist/clis/jike/post.yaml +0 -59
- package/dist/clis/jike/topic.yaml +0 -53
- package/dist/clis/jike/user.yaml +0 -52
- package/dist/clis/jimeng/generate.yaml +0 -85
- package/dist/clis/jimeng/history.yaml +0 -46
- package/dist/clis/linux-do/categories.yaml +0 -70
- package/dist/clis/linux-do/search.yaml +0 -48
- package/dist/clis/linux-do/tags.yaml +0 -41
- package/dist/clis/linux-do/topic.yaml +0 -62
- package/dist/clis/linux-do/user-posts.yaml +0 -67
- package/dist/clis/linux-do/user-topics.yaml +0 -54
- package/dist/clis/lobsters/active.yaml +0 -29
- package/dist/clis/lobsters/hot.yaml +0 -29
- package/dist/clis/lobsters/newest.yaml +0 -29
- package/dist/clis/lobsters/tag.yaml +0 -34
- package/dist/clis/pixiv/detail.yaml +0 -49
- package/dist/clis/pixiv/ranking.yaml +0 -53
- package/dist/clis/pixiv/user.yaml +0 -46
- package/dist/clis/reddit/frontpage.yaml +0 -30
- package/dist/clis/reddit/hot.yaml +0 -47
- package/dist/clis/reddit/popular.yaml +0 -40
- package/dist/clis/reddit/search.yaml +0 -61
- package/dist/clis/reddit/subreddit.yaml +0 -50
- package/dist/clis/reddit/user-comments.yaml +0 -46
- package/dist/clis/reddit/user-posts.yaml +0 -44
- package/dist/clis/reddit/user.yaml +0 -40
- package/dist/clis/stackoverflow/bounties.yaml +0 -29
- package/dist/clis/stackoverflow/hot.yaml +0 -28
- package/dist/clis/stackoverflow/search.yaml +0 -33
- package/dist/clis/stackoverflow/unanswered.yaml +0 -28
- package/dist/clis/steam/top-sellers.yaml +0 -29
- package/dist/clis/tiktok/comment.yaml +0 -66
- package/dist/clis/tiktok/explore.yaml +0 -39
- package/dist/clis/tiktok/follow.yaml +0 -39
- package/dist/clis/tiktok/following.yaml +0 -46
- package/dist/clis/tiktok/friends.yaml +0 -47
- package/dist/clis/tiktok/like.yaml +0 -38
- package/dist/clis/tiktok/live.yaml +0 -51
- package/dist/clis/tiktok/notifications.yaml +0 -52
- package/dist/clis/tiktok/profile.yaml +0 -45
- package/dist/clis/tiktok/save.yaml +0 -34
- package/dist/clis/tiktok/search.yaml +0 -47
- package/dist/clis/tiktok/unfollow.yaml +0 -44
- package/dist/clis/tiktok/unlike.yaml +0 -38
- package/dist/clis/tiktok/unsave.yaml +0 -36
- package/dist/clis/tiktok/user.yaml +0 -44
- package/dist/clis/v2ex/hot.yaml +0 -28
- package/dist/clis/v2ex/latest.yaml +0 -28
- package/dist/clis/v2ex/member.yaml +0 -29
- package/dist/clis/v2ex/node.yaml +0 -34
- package/dist/clis/v2ex/nodes.yaml +0 -31
- package/dist/clis/v2ex/replies.yaml +0 -32
- package/dist/clis/v2ex/topic.yaml +0 -33
- package/dist/clis/v2ex/user.yaml +0 -34
- package/dist/clis/xiaoe/catalog.yaml +0 -129
- package/dist/clis/xiaoe/content.yaml +0 -43
- package/dist/clis/xiaoe/courses.yaml +0 -73
- package/dist/clis/xiaoe/detail.yaml +0 -39
- package/dist/clis/xiaoe/play-url.yaml +0 -124
- package/dist/clis/xiaohongshu/feed.yaml +0 -31
- package/dist/clis/xiaohongshu/notifications.yaml +0 -37
- package/dist/clis/xueqiu/earnings-date.yaml +0 -69
- package/dist/clis/xueqiu/feed.yaml +0 -53
- package/dist/clis/xueqiu/groups.yaml +0 -23
- package/dist/clis/xueqiu/hot-stock.yaml +0 -49
- package/dist/clis/xueqiu/hot.yaml +0 -46
- package/dist/clis/xueqiu/kline.yaml +0 -65
- package/dist/clis/xueqiu/search.yaml +0 -55
- package/dist/clis/xueqiu/stock.yaml +0 -69
- package/dist/clis/xueqiu/watchlist.yaml +0 -46
- package/dist/clis/zhihu/hot.yaml +0 -46
- package/dist/clis/zhihu/search.yaml +0 -59
- package/dist/src/daemon.test.js +0 -65
- package/dist/src/idle-manager.d.ts +0 -19
- package/dist/src/idle-manager.js +0 -54
- package/dist/src/yaml-schema.d.ts +0 -29
- package/dist/src/yaml-schema.js +0 -22
- /package/dist/{src/daemon.test.d.ts → clis/bilibili/hot.d.ts} +0 -0
package/dist/src/generate.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* explore (Deep Explore) → synthesize (YAML generation + candidate ranking)
|
|
6
6
|
*/
|
|
7
7
|
import type { IBrowserFactory } from './runtime.js';
|
|
8
|
-
import { type SynthesizeCandidateSummary } from './synthesize.js';
|
|
8
|
+
import { type SynthesizeCandidateSummary, type SynthesizeResult } from './synthesize.js';
|
|
9
9
|
export interface GenerateCliOptions {
|
|
10
10
|
url: string;
|
|
11
11
|
BrowserFactory: new () => IBrowserFactory;
|
|
@@ -34,5 +34,13 @@ export interface GenerateCliResult {
|
|
|
34
34
|
candidates: Array<Pick<SynthesizeCandidateSummary, 'name' | 'strategy'>>;
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Normalize a goal string to a standard capability name.
|
|
39
|
+
*/
|
|
40
|
+
export declare function normalizeGoal(goal?: string | null): string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Select the best candidate matching the user's goal.
|
|
43
|
+
*/
|
|
44
|
+
export declare function selectCandidate(candidates: SynthesizeResult['candidates'], goal?: string | null): SynthesizeCandidateSummary | null;
|
|
37
45
|
export declare function generateCliFromUrl(opts: GenerateCliOptions): Promise<GenerateCliResult>;
|
|
38
46
|
export declare function renderGenerateSummary(r: GenerateCliResult): string;
|
package/dist/src/generate.js
CHANGED
|
@@ -20,7 +20,7 @@ const CAPABILITY_ALIASES = {
|
|
|
20
20
|
/**
|
|
21
21
|
* Normalize a goal string to a standard capability name.
|
|
22
22
|
*/
|
|
23
|
-
function normalizeGoal(goal) {
|
|
23
|
+
export function normalizeGoal(goal) {
|
|
24
24
|
if (!goal)
|
|
25
25
|
return null;
|
|
26
26
|
const lower = goal.trim().toLowerCase();
|
|
@@ -33,7 +33,7 @@ function normalizeGoal(goal) {
|
|
|
33
33
|
/**
|
|
34
34
|
* Select the best candidate matching the user's goal.
|
|
35
35
|
*/
|
|
36
|
-
function selectCandidate(candidates, goal) {
|
|
36
|
+
export function selectCandidate(candidates, goal) {
|
|
37
37
|
if (!candidates.length)
|
|
38
38
|
return null;
|
|
39
39
|
if (!goal)
|
package/dist/src/main.js
CHANGED
|
@@ -12,20 +12,75 @@ if (process.platform !== 'win32') {
|
|
|
12
12
|
cur.add(p);
|
|
13
13
|
process.env.PATH = [...cur].join(':');
|
|
14
14
|
}
|
|
15
|
+
import * as fs from 'node:fs';
|
|
16
|
+
import * as os from 'node:os';
|
|
15
17
|
import * as path from 'node:path';
|
|
16
18
|
import { fileURLToPath } from 'node:url';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { emitHook } from './hooks.js';
|
|
21
|
-
import { installNodeNetwork } from './node-network.js';
|
|
22
|
-
import { registerUpdateNoticeOnExit, checkForUpdateBackground } from './update-check.js';
|
|
19
|
+
import { getCompletionsFromManifest, hasAllManifests, printCompletionScriptFast } from './completion-fast.js';
|
|
20
|
+
import { getCliManifestPath } from './package-paths.js';
|
|
21
|
+
import { PKG_VERSION } from './version.js';
|
|
23
22
|
import { EXIT_CODES } from './errors.js';
|
|
24
|
-
installNodeNetwork();
|
|
25
23
|
const __filename = fileURLToPath(import.meta.url);
|
|
26
24
|
const __dirname = path.dirname(__filename);
|
|
27
25
|
const BUILTIN_CLIS = path.resolve(__dirname, '..', 'clis');
|
|
28
|
-
const USER_CLIS =
|
|
26
|
+
const USER_CLIS = path.join(os.homedir(), '.opencli', 'clis');
|
|
27
|
+
// ── Ultra-fast path: lightweight commands bypass full discovery ──────────
|
|
28
|
+
// These are high-frequency or trivial paths that must not pay the startup tax.
|
|
29
|
+
const argv = process.argv.slice(2);
|
|
30
|
+
// Fast path: --version (only when it's the top-level intent, not passed to a subcommand)
|
|
31
|
+
// e.g. `opencli --version` or `opencli -V`, but NOT `opencli gh --version`
|
|
32
|
+
if (argv[0] === '--version' || argv[0] === '-V') {
|
|
33
|
+
process.stdout.write(PKG_VERSION + '\n');
|
|
34
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
35
|
+
}
|
|
36
|
+
// Fast path: completion <shell> — print shell script without discovery
|
|
37
|
+
if (argv[0] === 'completion' && argv.length >= 2) {
|
|
38
|
+
if (printCompletionScriptFast(argv[1])) {
|
|
39
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
40
|
+
}
|
|
41
|
+
// Unknown shell — fall through to full path for proper error handling
|
|
42
|
+
}
|
|
43
|
+
// Fast path: --get-completions — read from manifest, skip discovery
|
|
44
|
+
const getCompIdx = process.argv.indexOf('--get-completions');
|
|
45
|
+
if (getCompIdx !== -1) {
|
|
46
|
+
// Only require manifest for directories that actually exist.
|
|
47
|
+
// If user clis dir doesn't exist, there are no user adapters to miss.
|
|
48
|
+
const manifestPaths = [getCliManifestPath(BUILTIN_CLIS)];
|
|
49
|
+
try {
|
|
50
|
+
fs.accessSync(USER_CLIS);
|
|
51
|
+
manifestPaths.push(getCliManifestPath(USER_CLIS));
|
|
52
|
+
}
|
|
53
|
+
catch { /* no user dir */ }
|
|
54
|
+
if (hasAllManifests(manifestPaths)) {
|
|
55
|
+
const rest = process.argv.slice(getCompIdx + 1);
|
|
56
|
+
let cursor;
|
|
57
|
+
const words = [];
|
|
58
|
+
for (let i = 0; i < rest.length; i++) {
|
|
59
|
+
if (rest[i] === '--cursor' && i + 1 < rest.length) {
|
|
60
|
+
cursor = parseInt(rest[i + 1], 10);
|
|
61
|
+
i++;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
words.push(rest[i]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (cursor === undefined)
|
|
68
|
+
cursor = words.length;
|
|
69
|
+
const candidates = getCompletionsFromManifest(words, cursor, manifestPaths);
|
|
70
|
+
process.stdout.write(candidates.join('\n') + '\n');
|
|
71
|
+
process.exit(EXIT_CODES.SUCCESS);
|
|
72
|
+
}
|
|
73
|
+
// No manifest — fall through to full discovery path below
|
|
74
|
+
}
|
|
75
|
+
// ── Full startup path ───────────────────────────────────────────────────
|
|
76
|
+
// Dynamic imports: these are deferred so the fast path above never pays the cost.
|
|
77
|
+
const { discoverClis, discoverPlugins, ensureUserCliCompatShims, ensureUserAdapters } = await import('./discovery.js');
|
|
78
|
+
const { getCompletions } = await import('./completion.js');
|
|
79
|
+
const { runCli } = await import('./cli.js');
|
|
80
|
+
const { emitHook } = await import('./hooks.js');
|
|
81
|
+
const { installNodeNetwork } = await import('./node-network.js');
|
|
82
|
+
const { registerUpdateNoticeOnExit, checkForUpdateBackground } = await import('./update-check.js');
|
|
83
|
+
installNodeNetwork();
|
|
29
84
|
// Sequential: plugins must run after built-in discovery so they can override built-in commands.
|
|
30
85
|
await ensureUserCliCompatShims();
|
|
31
86
|
await ensureUserAdapters();
|
|
@@ -35,9 +90,7 @@ await discoverPlugins();
|
|
|
35
90
|
registerUpdateNoticeOnExit();
|
|
36
91
|
// Kick off background fetch for next run (non-blocking)
|
|
37
92
|
checkForUpdateBackground();
|
|
38
|
-
// ──
|
|
39
|
-
// Usage: opencli --get-completions --cursor <N> [word1 word2 ...]
|
|
40
|
-
const getCompIdx = process.argv.indexOf('--get-completions');
|
|
93
|
+
// ── Fallback completion: manifest unavailable, use full registry ─────────
|
|
41
94
|
if (getCompIdx !== -1) {
|
|
42
95
|
const rest = process.argv.slice(getCompIdx + 1);
|
|
43
96
|
let cursor;
|
|
@@ -45,7 +98,7 @@ if (getCompIdx !== -1) {
|
|
|
45
98
|
for (let i = 0; i < rest.length; i++) {
|
|
46
99
|
if (rest[i] === '--cursor' && i + 1 < rest.length) {
|
|
47
100
|
cursor = parseInt(rest[i + 1], 10);
|
|
48
|
-
i++;
|
|
101
|
+
i++;
|
|
49
102
|
}
|
|
50
103
|
else {
|
|
51
104
|
words.push(rest[i]);
|
|
@@ -15,20 +15,4 @@ export interface DownloadResult {
|
|
|
15
15
|
error?: string;
|
|
16
16
|
duration?: number;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
* Download step handler for YAML pipelines.
|
|
20
|
-
*
|
|
21
|
-
* Usage in YAML:
|
|
22
|
-
* ```yaml
|
|
23
|
-
* pipeline:
|
|
24
|
-
* - download:
|
|
25
|
-
* url: ${{ item.imageUrl }}
|
|
26
|
-
* dir: ./downloads
|
|
27
|
-
* filename: ${{ item.title }}.jpg
|
|
28
|
-
* concurrency: 5
|
|
29
|
-
* skip_existing: true
|
|
30
|
-
* use_ytdlp: false
|
|
31
|
-
* type: auto
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare function stepDownload(page: IPage | null, params: any, data: any, args: Record<string, any>): Promise<any>;
|
|
18
|
+
export declare function stepDownload(page: IPage | null, params: unknown, data: unknown, args: Record<string, unknown>): Promise<unknown>;
|
|
@@ -54,41 +54,31 @@ function dedupeCookies(cookies) {
|
|
|
54
54
|
}
|
|
55
55
|
return [...deduped.values()];
|
|
56
56
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Download step handler for YAML pipelines.
|
|
59
|
-
*
|
|
60
|
-
* Usage in YAML:
|
|
61
|
-
* ```yaml
|
|
62
|
-
* pipeline:
|
|
63
|
-
* - download:
|
|
64
|
-
* url: ${{ item.imageUrl }}
|
|
65
|
-
* dir: ./downloads
|
|
66
|
-
* filename: ${{ item.title }}.jpg
|
|
67
|
-
* concurrency: 5
|
|
68
|
-
* skip_existing: true
|
|
69
|
-
* use_ytdlp: false
|
|
70
|
-
* type: auto
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
73
57
|
export async function stepDownload(page, params, data, args) {
|
|
74
58
|
// Parse parameters with defaults
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const
|
|
59
|
+
const p = typeof params === 'object' && params !== null ? params : {};
|
|
60
|
+
const urlTemplate = typeof params === 'string' ? params : (p.url ?? '');
|
|
61
|
+
const dirTemplate = p.dir ?? './downloads';
|
|
62
|
+
const filenameTemplate = p.filename ?? '';
|
|
63
|
+
const concurrency = typeof p.concurrency === 'number' ? p.concurrency : 3;
|
|
64
|
+
const skipExisting = p.skip_existing !== false;
|
|
65
|
+
const timeout = typeof p.timeout === 'number' ? p.timeout * 1000 : 30000;
|
|
66
|
+
const useYtdlp = p.use_ytdlp ?? false;
|
|
67
|
+
const ytdlpArgs = Array.isArray(p.ytdlp_args)
|
|
68
|
+
? p.ytdlp_args.map((v) => String(v))
|
|
69
|
+
: [];
|
|
70
|
+
const contentType = p.type ?? 'auto';
|
|
71
|
+
const showProgress = p.progress !== false;
|
|
72
|
+
const contentTemplate = p.content;
|
|
73
|
+
const metadataTemplate = p.metadata;
|
|
87
74
|
// Resolve output directory
|
|
88
75
|
const dir = String(render(dirTemplate, { args, data }));
|
|
89
76
|
fs.mkdirSync(dir, { recursive: true });
|
|
90
|
-
// Normalize data to array
|
|
91
|
-
|
|
77
|
+
// Normalize data to array. Items are row records (string-keyed) produced by
|
|
78
|
+
// upstream steps; we treat them as Record<string, unknown> and narrow per-use.
|
|
79
|
+
const items = Array.isArray(data) ? data
|
|
80
|
+
: data ? [data]
|
|
81
|
+
: [];
|
|
92
82
|
if (items.length === 0) {
|
|
93
83
|
return [];
|
|
94
84
|
}
|
|
@@ -128,7 +118,6 @@ export async function stepDownload(page, params, data, args) {
|
|
|
128
118
|
}
|
|
129
119
|
}
|
|
130
120
|
}
|
|
131
|
-
// Process downloads with concurrency
|
|
132
121
|
const results = await mapConcurrent(items, concurrency, async (item, index) => {
|
|
133
122
|
const startTime = Date.now();
|
|
134
123
|
// Render URL
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Pipeline step: intercept — declarative XHR interception.
|
|
3
3
|
*/
|
|
4
4
|
import type { IPage } from '../../types.js';
|
|
5
|
-
export declare function stepIntercept(page: IPage | null, params:
|
|
5
|
+
export declare function stepIntercept(page: IPage | null, params: unknown, data: unknown, args: Record<string, unknown>): Promise<unknown>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { render, normalizeEvaluateSource } from '../template.js';
|
|
5
5
|
export async function stepIntercept(page, params, data, args) {
|
|
6
|
-
const cfg = typeof params === 'object' ? params : {};
|
|
6
|
+
const cfg = typeof params === 'object' && params !== null ? params : {};
|
|
7
7
|
const trigger = cfg.trigger ?? '';
|
|
8
8
|
const capturePattern = cfg.capture ?? '';
|
|
9
9
|
const timeout = cfg.timeout ?? 8;
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
* 5. Returns the captured data (optionally sub-selected)
|
|
10
10
|
*/
|
|
11
11
|
import type { IPage } from '../../types.js';
|
|
12
|
-
export declare function stepTap(page: IPage | null, params:
|
|
12
|
+
export declare function stepTap(page: IPage | null, params: unknown, data: unknown, args: Record<string, unknown>): Promise<unknown>;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { render } from '../template.js';
|
|
12
12
|
import { generateTapInterceptorJs } from '../../interceptor.js';
|
|
13
13
|
export async function stepTap(page, params, data, args) {
|
|
14
|
-
const cfg = typeof params === 'object' ? params : {};
|
|
14
|
+
const cfg = typeof params === 'object' && params !== null ? params : {};
|
|
15
15
|
const storeName = String(render(cfg.store ?? '', { args, data }));
|
|
16
16
|
const actionName = String(render(cfg.action ?? '', { args, data }));
|
|
17
17
|
const capturePattern = String(render(cfg.capture ?? '', { args, data }));
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* <name>/
|
|
8
8
|
* opencli-plugin.json — manifest with name, version, description
|
|
9
9
|
* package.json — ESM package with opencli peer dependency
|
|
10
|
-
* hello.
|
|
11
|
-
|
|
10
|
+
* hello.ts — sample pipeline command
|
|
11
|
+
* greet.ts — sample TS command using func()
|
|
12
12
|
* README.md — basic documentation
|
|
13
13
|
*/
|
|
14
14
|
export interface ScaffoldOptions {
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* <name>/
|
|
8
8
|
* opencli-plugin.json — manifest with name, version, description
|
|
9
9
|
* package.json — ESM package with opencli peer dependency
|
|
10
|
-
* hello.
|
|
11
|
-
|
|
10
|
+
* hello.ts — sample pipeline command
|
|
11
|
+
* greet.ts — sample TS command using func()
|
|
12
12
|
* README.md — basic documentation
|
|
13
13
|
*/
|
|
14
14
|
import * as fs from 'node:fs';
|
|
@@ -52,26 +52,29 @@ export function createPluginScaffold(name, opts = {}) {
|
|
|
52
52
|
};
|
|
53
53
|
writeFile(targetDir, 'package.json', JSON.stringify(pkg, null, 2) + '\n');
|
|
54
54
|
files.push('package.json');
|
|
55
|
-
// hello.
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
name: hello
|
|
61
|
-
description: "A sample YAML command"
|
|
62
|
-
strategy: public
|
|
63
|
-
browser: false
|
|
55
|
+
// hello.ts — sample pipeline command
|
|
56
|
+
const helloContent = `/**
|
|
57
|
+
* Sample pipeline command for ${name}.
|
|
58
|
+
* Demonstrates the declarative pipeline API.
|
|
59
|
+
*/
|
|
64
60
|
|
|
65
|
-
|
|
61
|
+
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
66
62
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
cli({
|
|
64
|
+
site: '${name}',
|
|
65
|
+
name: 'hello',
|
|
66
|
+
description: 'A sample pipeline command',
|
|
67
|
+
strategy: Strategy.PUBLIC,
|
|
68
|
+
browser: false,
|
|
69
|
+
columns: ['greeting'],
|
|
70
|
+
pipeline: [
|
|
71
|
+
{ fetch: { url: 'https://httpbin.org/get?greeting=hello' } },
|
|
72
|
+
{ select: 'args' },
|
|
73
|
+
],
|
|
74
|
+
});
|
|
72
75
|
`;
|
|
73
|
-
writeFile(targetDir, 'hello.
|
|
74
|
-
files.push('hello.
|
|
76
|
+
writeFile(targetDir, 'hello.ts', helloContent);
|
|
77
|
+
files.push('hello.ts');
|
|
75
78
|
// greet.ts — sample TS command using registry API
|
|
76
79
|
const tsContent = `/**
|
|
77
80
|
* Sample TypeScript command for ${name}.
|
|
@@ -114,8 +117,8 @@ opencli plugin install github:<user>/opencli-plugin-${name}
|
|
|
114
117
|
|
|
115
118
|
| Command | Type | Description |
|
|
116
119
|
|---------|------|-------------|
|
|
117
|
-
| \`${name}/hello\` |
|
|
118
|
-
| \`${name}/greet\` | TypeScript | Sample TS command |
|
|
120
|
+
| \`${name}/hello\` | Pipeline | Sample pipeline command |
|
|
121
|
+
| \`${name}/greet\` | TypeScript | Sample TS command with func() |
|
|
119
122
|
|
|
120
123
|
## Development
|
|
121
124
|
|
|
@@ -25,7 +25,7 @@ describe('createPluginScaffold', () => {
|
|
|
25
25
|
expect(result.dir).toBe(dir);
|
|
26
26
|
expect(result.files).toContain('opencli-plugin.json');
|
|
27
27
|
expect(result.files).toContain('package.json');
|
|
28
|
-
expect(result.files).toContain('hello.
|
|
28
|
+
expect(result.files).toContain('hello.ts');
|
|
29
29
|
expect(result.files).toContain('greet.ts');
|
|
30
30
|
expect(result.files).toContain('README.md');
|
|
31
31
|
// All files exist
|
package/dist/src/plugin.d.ts
CHANGED
|
@@ -80,7 +80,7 @@ export declare function writeLockFile(lock: Record<string, LockEntry>): void;
|
|
|
80
80
|
export declare function getCommitHash(dir: string): string | undefined;
|
|
81
81
|
/**
|
|
82
82
|
* Validate that a downloaded plugin directory is a structurally valid plugin.
|
|
83
|
-
* Checks for at least one command file (.
|
|
83
|
+
* Checks for at least one command file (.ts, .js) and a valid
|
|
84
84
|
* package.json if it contains .ts files.
|
|
85
85
|
*/
|
|
86
86
|
export declare function validatePluginStructure(pluginDir: string): ValidationResult;
|
package/dist/src/plugin.js
CHANGED
|
@@ -453,7 +453,7 @@ export function getCommitHash(dir) {
|
|
|
453
453
|
}
|
|
454
454
|
/**
|
|
455
455
|
* Validate that a downloaded plugin directory is a structurally valid plugin.
|
|
456
|
-
* Checks for at least one command file (.
|
|
456
|
+
* Checks for at least one command file (.ts, .js) and a valid
|
|
457
457
|
* package.json if it contains .ts files.
|
|
458
458
|
*/
|
|
459
459
|
export function validatePluginStructure(pluginDir) {
|
|
@@ -462,11 +462,10 @@ export function validatePluginStructure(pluginDir) {
|
|
|
462
462
|
return { valid: false, errors: ['Plugin directory does not exist'] };
|
|
463
463
|
}
|
|
464
464
|
const files = fs.readdirSync(pluginDir);
|
|
465
|
-
const hasYaml = files.some(f => f.endsWith('.yaml') || f.endsWith('.yml'));
|
|
466
465
|
const hasTs = files.some(f => f.endsWith('.ts') && !f.endsWith('.d.ts') && !f.endsWith('.test.ts'));
|
|
467
466
|
const hasJs = files.some(f => f.endsWith('.js') && !f.endsWith('.d.js'));
|
|
468
|
-
if (!
|
|
469
|
-
errors.push('No command files found in plugin directory. A plugin must contain at least one .
|
|
467
|
+
if (!hasTs && !hasJs) {
|
|
468
|
+
errors.push('No command files found in plugin directory. A plugin must contain at least one .ts or .js command file.');
|
|
470
469
|
}
|
|
471
470
|
if (hasTs) {
|
|
472
471
|
const pkgJsonPath = path.join(pluginDir, 'package.json');
|
|
@@ -981,8 +980,7 @@ function scanPluginCommands(dir) {
|
|
|
981
980
|
try {
|
|
982
981
|
const files = fs.readdirSync(dir);
|
|
983
982
|
const names = new Set(files
|
|
984
|
-
.filter(f => f.endsWith('.
|
|
985
|
-
(f.endsWith('.ts') && !f.endsWith('.d.ts') && !f.endsWith('.test.ts')) ||
|
|
983
|
+
.filter(f => (f.endsWith('.ts') && !f.endsWith('.d.ts') && !f.endsWith('.test.ts')) ||
|
|
986
984
|
(f.endsWith('.js') && !f.endsWith('.d.js')))
|
|
987
985
|
.map(f => path.basename(f, path.extname(f))));
|
|
988
986
|
return [...names];
|