@iflow-mcp/jakeliume-webpeel 0.22.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/LICENSE +15 -0
- package/README.md +313 -0
- package/dist/cache.d.ts +30 -0
- package/dist/cache.js +139 -0
- package/dist/cli/commands/auth.d.ts +5 -0
- package/dist/cli/commands/auth.js +411 -0
- package/dist/cli/commands/doctor.d.ts +37 -0
- package/dist/cli/commands/doctor.js +371 -0
- package/dist/cli/commands/fetch.d.ts +6 -0
- package/dist/cli/commands/fetch.js +1345 -0
- package/dist/cli/commands/guide.d.ts +2 -0
- package/dist/cli/commands/guide.js +183 -0
- package/dist/cli/commands/interact.d.ts +5 -0
- package/dist/cli/commands/interact.js +840 -0
- package/dist/cli/commands/jobs.d.ts +5 -0
- package/dist/cli/commands/jobs.js +997 -0
- package/dist/cli/commands/monitor.d.ts +12 -0
- package/dist/cli/commands/monitor.js +197 -0
- package/dist/cli/commands/observe.d.ts +12 -0
- package/dist/cli/commands/observe.js +158 -0
- package/dist/cli/commands/screenshot.d.ts +5 -0
- package/dist/cli/commands/screenshot.js +282 -0
- package/dist/cli/commands/search.d.ts +5 -0
- package/dist/cli/commands/search.js +1021 -0
- package/dist/cli/commands/setup.d.ts +13 -0
- package/dist/cli/commands/setup.js +244 -0
- package/dist/cli/commands/skill.d.ts +15 -0
- package/dist/cli/commands/skill.js +195 -0
- package/dist/cli/utils.d.ts +84 -0
- package/dist/cli/utils.js +806 -0
- package/dist/cli-auth.d.ts +75 -0
- package/dist/cli-auth.js +369 -0
- package/dist/cli.d.ts +17 -0
- package/dist/cli.js +99 -0
- package/dist/core/actions.d.ts +69 -0
- package/dist/core/actions.js +495 -0
- package/dist/core/agent.d.ts +98 -0
- package/dist/core/agent.js +558 -0
- package/dist/core/answer.d.ts +42 -0
- package/dist/core/answer.js +395 -0
- package/dist/core/application-tracker.d.ts +84 -0
- package/dist/core/application-tracker.js +184 -0
- package/dist/core/apply.d.ts +162 -0
- package/dist/core/apply.js +816 -0
- package/dist/core/auth-detection.d.ts +35 -0
- package/dist/core/auth-detection.js +358 -0
- package/dist/core/auto-extract.d.ts +82 -0
- package/dist/core/auto-extract.js +604 -0
- package/dist/core/auto-interact.d.ts +23 -0
- package/dist/core/auto-interact.js +246 -0
- package/dist/core/bm25-filter.d.ts +66 -0
- package/dist/core/bm25-filter.js +288 -0
- package/dist/core/branding.d.ts +54 -0
- package/dist/core/branding.js +234 -0
- package/dist/core/browser-fetch.d.ts +323 -0
- package/dist/core/browser-fetch.js +1600 -0
- package/dist/core/browser-pool.d.ts +91 -0
- package/dist/core/browser-pool.js +550 -0
- package/dist/core/budget.d.ts +42 -0
- package/dist/core/budget.js +324 -0
- package/dist/core/business-intel.d.ts +47 -0
- package/dist/core/business-intel.js +279 -0
- package/dist/core/cache.d.ts +13 -0
- package/dist/core/cache.js +121 -0
- package/dist/core/cf-worker-proxy.d.ts +32 -0
- package/dist/core/cf-worker-proxy.js +87 -0
- package/dist/core/challenge-detection.d.ts +26 -0
- package/dist/core/challenge-detection.js +468 -0
- package/dist/core/change-tracking.d.ts +75 -0
- package/dist/core/change-tracking.js +276 -0
- package/dist/core/chunker.d.ts +46 -0
- package/dist/core/chunker.js +249 -0
- package/dist/core/chunking.d.ts +42 -0
- package/dist/core/chunking.js +181 -0
- package/dist/core/circuit-breaker.d.ts +44 -0
- package/dist/core/circuit-breaker.js +85 -0
- package/dist/core/content-pruner.d.ts +47 -0
- package/dist/core/content-pruner.js +425 -0
- package/dist/core/cookie-cache.d.ts +60 -0
- package/dist/core/cookie-cache.js +163 -0
- package/dist/core/crawl-checkpoint.d.ts +54 -0
- package/dist/core/crawl-checkpoint.js +104 -0
- package/dist/core/crawler.d.ts +84 -0
- package/dist/core/crawler.js +349 -0
- package/dist/core/cross-verify.d.ts +27 -0
- package/dist/core/cross-verify.js +93 -0
- package/dist/core/deep-fetch.d.ts +74 -0
- package/dist/core/deep-fetch.js +405 -0
- package/dist/core/deep-research.d.ts +141 -0
- package/dist/core/deep-research.js +972 -0
- package/dist/core/design-analysis.d.ts +70 -0
- package/dist/core/design-analysis.js +490 -0
- package/dist/core/design-compare.d.ts +38 -0
- package/dist/core/design-compare.js +264 -0
- package/dist/core/diff.d.ts +61 -0
- package/dist/core/diff.js +289 -0
- package/dist/core/dns-cache.d.ts +20 -0
- package/dist/core/dns-cache.js +198 -0
- package/dist/core/documents.d.ts +23 -0
- package/dist/core/documents.js +123 -0
- package/dist/core/domain-memory.d.ts +66 -0
- package/dist/core/domain-memory.js +163 -0
- package/dist/core/domain-verify.d.ts +40 -0
- package/dist/core/domain-verify.js +379 -0
- package/dist/core/engine-ranker.d.ts +112 -0
- package/dist/core/engine-ranker.js +395 -0
- package/dist/core/extract-inline.d.ts +38 -0
- package/dist/core/extract-inline.js +215 -0
- package/dist/core/extract-listings.d.ts +38 -0
- package/dist/core/extract-listings.js +461 -0
- package/dist/core/extract.d.ts +9 -0
- package/dist/core/extract.js +139 -0
- package/dist/core/fetch-cache.d.ts +57 -0
- package/dist/core/fetch-cache.js +95 -0
- package/dist/core/fetcher.d.ts +13 -0
- package/dist/core/fetcher.js +12 -0
- package/dist/core/google-cache.d.ts +29 -0
- package/dist/core/google-cache.js +180 -0
- package/dist/core/google-serp-parser.d.ts +82 -0
- package/dist/core/google-serp-parser.js +287 -0
- package/dist/core/hotel-search.d.ts +122 -0
- package/dist/core/hotel-search.js +382 -0
- package/dist/core/http-fetch.d.ts +72 -0
- package/dist/core/http-fetch.js +820 -0
- package/dist/core/human.d.ts +175 -0
- package/dist/core/human.js +680 -0
- package/dist/core/image-caption.d.ts +44 -0
- package/dist/core/image-caption.js +271 -0
- package/dist/core/jobs.d.ts +75 -0
- package/dist/core/jobs.js +634 -0
- package/dist/core/json-ld.d.ts +15 -0
- package/dist/core/json-ld.js +617 -0
- package/dist/core/language-detect.d.ts +18 -0
- package/dist/core/language-detect.js +135 -0
- package/dist/core/links.d.ts +10 -0
- package/dist/core/links.js +44 -0
- package/dist/core/llm-extract.d.ts +71 -0
- package/dist/core/llm-extract.js +507 -0
- package/dist/core/llm-provider.d.ts +100 -0
- package/dist/core/llm-provider.js +702 -0
- package/dist/core/local-search.d.ts +60 -0
- package/dist/core/local-search.js +308 -0
- package/dist/core/logger.d.ts +28 -0
- package/dist/core/logger.js +104 -0
- package/dist/core/map.d.ts +33 -0
- package/dist/core/map.js +127 -0
- package/dist/core/markdown.d.ts +92 -0
- package/dist/core/markdown.js +809 -0
- package/dist/core/metadata.d.ts +34 -0
- package/dist/core/metadata.js +422 -0
- package/dist/core/observe.d.ts +113 -0
- package/dist/core/observe.js +395 -0
- package/dist/core/ocr.d.ts +12 -0
- package/dist/core/ocr.js +33 -0
- package/dist/core/paginate.d.ts +31 -0
- package/dist/core/paginate.js +106 -0
- package/dist/core/pdf.d.ts +8 -0
- package/dist/core/pdf.js +25 -0
- package/dist/core/peel-tls.d.ts +25 -0
- package/dist/core/peel-tls.js +220 -0
- package/dist/core/pipeline.d.ts +132 -0
- package/dist/core/pipeline.js +1666 -0
- package/dist/core/profiles.d.ts +61 -0
- package/dist/core/profiles.js +350 -0
- package/dist/core/prompt-guard.d.ts +30 -0
- package/dist/core/prompt-guard.js +119 -0
- package/dist/core/proxy-config.d.ts +90 -0
- package/dist/core/proxy-config.js +172 -0
- package/dist/core/quick-answer.d.ts +53 -0
- package/dist/core/quick-answer.js +833 -0
- package/dist/core/rate-governor.d.ts +80 -0
- package/dist/core/rate-governor.js +238 -0
- package/dist/core/readability.d.ts +57 -0
- package/dist/core/readability.js +533 -0
- package/dist/core/research.d.ts +66 -0
- package/dist/core/research.js +270 -0
- package/dist/core/retry.d.ts +60 -0
- package/dist/core/retry.js +119 -0
- package/dist/core/safe-browsing.d.ts +30 -0
- package/dist/core/safe-browsing.js +206 -0
- package/dist/core/schema-extraction.d.ts +66 -0
- package/dist/core/schema-extraction.js +352 -0
- package/dist/core/schema-postprocess.d.ts +32 -0
- package/dist/core/schema-postprocess.js +469 -0
- package/dist/core/schema-templates.d.ts +19 -0
- package/dist/core/schema-templates.js +143 -0
- package/dist/core/screenshot.d.ts +224 -0
- package/dist/core/screenshot.js +207 -0
- package/dist/core/search-engines.d.ts +25 -0
- package/dist/core/search-engines.js +182 -0
- package/dist/core/search-provider.d.ts +243 -0
- package/dist/core/search-provider.js +1629 -0
- package/dist/core/searxng-provider.d.ts +35 -0
- package/dist/core/searxng-provider.js +105 -0
- package/dist/core/selective-evidence.d.ts +151 -0
- package/dist/core/selective-evidence.js +389 -0
- package/dist/core/site-search.d.ts +44 -0
- package/dist/core/site-search.js +252 -0
- package/dist/core/sitemap.d.ts +23 -0
- package/dist/core/sitemap.js +105 -0
- package/dist/core/source-credibility.d.ts +29 -0
- package/dist/core/source-credibility.js +584 -0
- package/dist/core/source-scoring.d.ts +166 -0
- package/dist/core/source-scoring.js +396 -0
- package/dist/core/stemmer.d.ts +38 -0
- package/dist/core/stemmer.js +509 -0
- package/dist/core/strategies.d.ts +104 -0
- package/dist/core/strategies.js +1044 -0
- package/dist/core/strategy-hooks.d.ts +145 -0
- package/dist/core/strategy-hooks.js +74 -0
- package/dist/core/structured-extract.d.ts +43 -0
- package/dist/core/structured-extract.js +550 -0
- package/dist/core/summarize.d.ts +17 -0
- package/dist/core/summarize.js +78 -0
- package/dist/core/synonyms.d.ts +42 -0
- package/dist/core/synonyms.js +184 -0
- package/dist/core/system-monitor.d.ts +61 -0
- package/dist/core/system-monitor.js +133 -0
- package/dist/core/table-format.d.ts +30 -0
- package/dist/core/table-format.js +146 -0
- package/dist/core/threat-feeds.d.ts +23 -0
- package/dist/core/threat-feeds.js +104 -0
- package/dist/core/timing.d.ts +21 -0
- package/dist/core/timing.js +33 -0
- package/dist/core/transcript-export.d.ts +47 -0
- package/dist/core/transcript-export.js +107 -0
- package/dist/core/user-agents.d.ts +82 -0
- package/dist/core/user-agents.js +239 -0
- package/dist/core/vertical-search.d.ts +54 -0
- package/dist/core/vertical-search.js +158 -0
- package/dist/core/watch-manager.d.ts +175 -0
- package/dist/core/watch-manager.js +416 -0
- package/dist/core/watch.d.ts +101 -0
- package/dist/core/watch.js +389 -0
- package/dist/core/youtube.d.ts +130 -0
- package/dist/core/youtube.js +1175 -0
- package/dist/ee/challenge-re-export.d.ts +1 -0
- package/dist/ee/challenge-re-export.js +1 -0
- package/dist/ee/challenge-solver.d.ts +72 -0
- package/dist/ee/challenge-solver.js +720 -0
- package/dist/ee/domain-extractors.d.ts +8 -0
- package/dist/ee/domain-extractors.js +8 -0
- package/dist/ee/domain-intel.d.ts +16 -0
- package/dist/ee/domain-intel.js +133 -0
- package/dist/ee/extractors/allrecipes.d.ts +2 -0
- package/dist/ee/extractors/allrecipes.js +120 -0
- package/dist/ee/extractors/amazon.d.ts +2 -0
- package/dist/ee/extractors/amazon.js +78 -0
- package/dist/ee/extractors/arxiv.d.ts +2 -0
- package/dist/ee/extractors/arxiv.js +137 -0
- package/dist/ee/extractors/bestbuy.d.ts +2 -0
- package/dist/ee/extractors/bestbuy.js +78 -0
- package/dist/ee/extractors/carscom.d.ts +2 -0
- package/dist/ee/extractors/carscom.js +121 -0
- package/dist/ee/extractors/coingecko.d.ts +2 -0
- package/dist/ee/extractors/coingecko.js +134 -0
- package/dist/ee/extractors/craigslist.d.ts +2 -0
- package/dist/ee/extractors/craigslist.js +92 -0
- package/dist/ee/extractors/devto.d.ts +2 -0
- package/dist/ee/extractors/devto.js +135 -0
- package/dist/ee/extractors/ebay.d.ts +2 -0
- package/dist/ee/extractors/ebay.js +90 -0
- package/dist/ee/extractors/espn.d.ts +2 -0
- package/dist/ee/extractors/espn.js +260 -0
- package/dist/ee/extractors/etsy.d.ts +2 -0
- package/dist/ee/extractors/etsy.js +52 -0
- package/dist/ee/extractors/facebook.d.ts +2 -0
- package/dist/ee/extractors/facebook.js +46 -0
- package/dist/ee/extractors/github.d.ts +2 -0
- package/dist/ee/extractors/github.js +196 -0
- package/dist/ee/extractors/google-flights.d.ts +2 -0
- package/dist/ee/extractors/google-flights.js +176 -0
- package/dist/ee/extractors/hackernews.d.ts +2 -0
- package/dist/ee/extractors/hackernews.js +147 -0
- package/dist/ee/extractors/imdb.d.ts +2 -0
- package/dist/ee/extractors/imdb.js +172 -0
- package/dist/ee/extractors/index.d.ts +26 -0
- package/dist/ee/extractors/index.js +247 -0
- package/dist/ee/extractors/instagram.d.ts +2 -0
- package/dist/ee/extractors/instagram.js +102 -0
- package/dist/ee/extractors/kalshi.d.ts +2 -0
- package/dist/ee/extractors/kalshi.js +121 -0
- package/dist/ee/extractors/kayak-cars.d.ts +2 -0
- package/dist/ee/extractors/kayak-cars.js +270 -0
- package/dist/ee/extractors/linkedin.d.ts +2 -0
- package/dist/ee/extractors/linkedin.js +113 -0
- package/dist/ee/extractors/medium.d.ts +2 -0
- package/dist/ee/extractors/medium.js +130 -0
- package/dist/ee/extractors/news.d.ts +4 -0
- package/dist/ee/extractors/news.js +173 -0
- package/dist/ee/extractors/npm.d.ts +2 -0
- package/dist/ee/extractors/npm.js +86 -0
- package/dist/ee/extractors/pdf.d.ts +2 -0
- package/dist/ee/extractors/pdf.js +108 -0
- package/dist/ee/extractors/pinterest.d.ts +2 -0
- package/dist/ee/extractors/pinterest.js +34 -0
- package/dist/ee/extractors/polymarket.d.ts +2 -0
- package/dist/ee/extractors/polymarket.js +358 -0
- package/dist/ee/extractors/producthunt.d.ts +2 -0
- package/dist/ee/extractors/producthunt.js +88 -0
- package/dist/ee/extractors/pubmed.d.ts +2 -0
- package/dist/ee/extractors/pubmed.js +162 -0
- package/dist/ee/extractors/pypi.d.ts +2 -0
- package/dist/ee/extractors/pypi.js +80 -0
- package/dist/ee/extractors/reddit.d.ts +2 -0
- package/dist/ee/extractors/reddit.js +438 -0
- package/dist/ee/extractors/redfin.d.ts +2 -0
- package/dist/ee/extractors/redfin.js +156 -0
- package/dist/ee/extractors/semanticscholar.d.ts +2 -0
- package/dist/ee/extractors/semanticscholar.js +131 -0
- package/dist/ee/extractors/shared.d.ts +12 -0
- package/dist/ee/extractors/shared.js +76 -0
- package/dist/ee/extractors/soundcloud.d.ts +2 -0
- package/dist/ee/extractors/soundcloud.js +34 -0
- package/dist/ee/extractors/sportsbetting.d.ts +2 -0
- package/dist/ee/extractors/sportsbetting.js +37 -0
- package/dist/ee/extractors/spotify.d.ts +2 -0
- package/dist/ee/extractors/spotify.js +34 -0
- package/dist/ee/extractors/stackoverflow.d.ts +2 -0
- package/dist/ee/extractors/stackoverflow.js +61 -0
- package/dist/ee/extractors/substack.d.ts +2 -0
- package/dist/ee/extractors/substack.js +115 -0
- package/dist/ee/extractors/substackroot.d.ts +2 -0
- package/dist/ee/extractors/substackroot.js +46 -0
- package/dist/ee/extractors/tiktok.d.ts +2 -0
- package/dist/ee/extractors/tiktok.js +29 -0
- package/dist/ee/extractors/tradingview.d.ts +2 -0
- package/dist/ee/extractors/tradingview.js +182 -0
- package/dist/ee/extractors/twitch.d.ts +2 -0
- package/dist/ee/extractors/twitch.js +36 -0
- package/dist/ee/extractors/twitter.d.ts +2 -0
- package/dist/ee/extractors/twitter.js +327 -0
- package/dist/ee/extractors/types.d.ts +14 -0
- package/dist/ee/extractors/types.js +1 -0
- package/dist/ee/extractors/walmart.d.ts +2 -0
- package/dist/ee/extractors/walmart.js +50 -0
- package/dist/ee/extractors/weather.d.ts +2 -0
- package/dist/ee/extractors/weather.js +133 -0
- package/dist/ee/extractors/wikipedia.d.ts +4 -0
- package/dist/ee/extractors/wikipedia.js +235 -0
- package/dist/ee/extractors/yelp.d.ts +2 -0
- package/dist/ee/extractors/yelp.js +216 -0
- package/dist/ee/extractors/youtube.d.ts +2 -0
- package/dist/ee/extractors/youtube.js +189 -0
- package/dist/ee/extractors/zillow.d.ts +54 -0
- package/dist/ee/extractors/zillow.js +247 -0
- package/dist/ee/extractors-re-export.d.ts +1 -0
- package/dist/ee/extractors-re-export.js +1 -0
- package/dist/ee/premium-hooks.d.ts +20 -0
- package/dist/ee/premium-hooks.js +50 -0
- package/dist/ee/spa-detection.d.ts +2 -0
- package/dist/ee/spa-detection.js +2 -0
- package/dist/ee/stability.d.ts +4 -0
- package/dist/ee/stability.js +29 -0
- package/dist/ee/swr-cache.d.ts +14 -0
- package/dist/ee/swr-cache.js +34 -0
- package/dist/index.d.ts +143 -0
- package/dist/index.js +291 -0
- package/dist/integrations/index.d.ts +2 -0
- package/dist/integrations/index.js +2 -0
- package/dist/integrations/langchain.d.ts +64 -0
- package/dist/integrations/langchain.js +115 -0
- package/dist/integrations/llamaindex.d.ts +50 -0
- package/dist/integrations/llamaindex.js +91 -0
- package/dist/mcp/handlers/act.d.ts +5 -0
- package/dist/mcp/handlers/act.js +34 -0
- package/dist/mcp/handlers/definitions.d.ts +6 -0
- package/dist/mcp/handlers/definitions.js +395 -0
- package/dist/mcp/handlers/extract.d.ts +7 -0
- package/dist/mcp/handlers/extract.js +135 -0
- package/dist/mcp/handlers/fetch.d.ts +6 -0
- package/dist/mcp/handlers/fetch.js +98 -0
- package/dist/mcp/handlers/find.d.ts +5 -0
- package/dist/mcp/handlers/find.js +137 -0
- package/dist/mcp/handlers/index.d.ts +13 -0
- package/dist/mcp/handlers/index.js +63 -0
- package/dist/mcp/handlers/legacy.d.ts +25 -0
- package/dist/mcp/handlers/legacy.js +450 -0
- package/dist/mcp/handlers/meta.d.ts +6 -0
- package/dist/mcp/handlers/meta.js +40 -0
- package/dist/mcp/handlers/monitor.d.ts +5 -0
- package/dist/mcp/handlers/monitor.js +41 -0
- package/dist/mcp/handlers/observe.d.ts +8 -0
- package/dist/mcp/handlers/observe.js +37 -0
- package/dist/mcp/handlers/read.d.ts +6 -0
- package/dist/mcp/handlers/read.js +78 -0
- package/dist/mcp/handlers/see.d.ts +5 -0
- package/dist/mcp/handlers/see.js +75 -0
- package/dist/mcp/handlers/types.d.ts +29 -0
- package/dist/mcp/handlers/types.js +28 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.js +108 -0
- package/dist/mcp/smart-router.d.ts +23 -0
- package/dist/mcp/smart-router.js +178 -0
- package/dist/server/app.d.ts +14 -0
- package/dist/server/app.js +632 -0
- package/dist/server/auth-store.d.ts +28 -0
- package/dist/server/auth-store.js +88 -0
- package/dist/server/bull-queues.d.ts +60 -0
- package/dist/server/bull-queues.js +90 -0
- package/dist/server/email-service.d.ts +55 -0
- package/dist/server/email-service.js +291 -0
- package/dist/server/job-queue.d.ts +100 -0
- package/dist/server/job-queue.js +145 -0
- package/dist/server/logger.d.ts +10 -0
- package/dist/server/logger.js +37 -0
- package/dist/server/middleware/audit-log.d.ts +14 -0
- package/dist/server/middleware/audit-log.js +73 -0
- package/dist/server/middleware/auth.d.ts +35 -0
- package/dist/server/middleware/auth.js +225 -0
- package/dist/server/middleware/rate-limit.d.ts +50 -0
- package/dist/server/middleware/rate-limit.js +270 -0
- package/dist/server/middleware/scope-guard.d.ts +25 -0
- package/dist/server/middleware/scope-guard.js +45 -0
- package/dist/server/middleware/url-validator.d.ts +15 -0
- package/dist/server/middleware/url-validator.js +201 -0
- package/dist/server/openapi.yaml +6418 -0
- package/dist/server/pg-auth-store.d.ts +146 -0
- package/dist/server/pg-auth-store.js +576 -0
- package/dist/server/pg-job-queue.d.ts +59 -0
- package/dist/server/pg-job-queue.js +375 -0
- package/dist/server/routes/activity.d.ts +6 -0
- package/dist/server/routes/activity.js +79 -0
- package/dist/server/routes/admin-active.d.ts +7 -0
- package/dist/server/routes/admin-active.js +120 -0
- package/dist/server/routes/admin-stats.d.ts +7 -0
- package/dist/server/routes/admin-stats.js +176 -0
- package/dist/server/routes/agent.d.ts +24 -0
- package/dist/server/routes/agent.js +480 -0
- package/dist/server/routes/answer.d.ts +5 -0
- package/dist/server/routes/answer.js +125 -0
- package/dist/server/routes/ask.d.ts +28 -0
- package/dist/server/routes/ask.js +295 -0
- package/dist/server/routes/batch.d.ts +6 -0
- package/dist/server/routes/batch.js +493 -0
- package/dist/server/routes/cache-warm.d.ts +25 -0
- package/dist/server/routes/cache-warm.js +212 -0
- package/dist/server/routes/cli-usage.d.ts +6 -0
- package/dist/server/routes/cli-usage.js +127 -0
- package/dist/server/routes/compat.d.ts +23 -0
- package/dist/server/routes/compat.js +652 -0
- package/dist/server/routes/crawl.d.ts +13 -0
- package/dist/server/routes/crawl.js +287 -0
- package/dist/server/routes/deep-fetch.d.ts +8 -0
- package/dist/server/routes/deep-fetch.js +57 -0
- package/dist/server/routes/deep-research.d.ts +11 -0
- package/dist/server/routes/deep-research.js +232 -0
- package/dist/server/routes/demo.d.ts +24 -0
- package/dist/server/routes/demo.js +517 -0
- package/dist/server/routes/do.d.ts +8 -0
- package/dist/server/routes/do.js +72 -0
- package/dist/server/routes/extract.d.ts +14 -0
- package/dist/server/routes/extract.js +325 -0
- package/dist/server/routes/feed.d.ts +15 -0
- package/dist/server/routes/feed.js +311 -0
- package/dist/server/routes/fetch-queue.d.ts +13 -0
- package/dist/server/routes/fetch-queue.js +357 -0
- package/dist/server/routes/fetch.d.ts +7 -0
- package/dist/server/routes/fetch.js +1274 -0
- package/dist/server/routes/go.d.ts +14 -0
- package/dist/server/routes/go.js +81 -0
- package/dist/server/routes/health.d.ts +11 -0
- package/dist/server/routes/health.js +141 -0
- package/dist/server/routes/jobs.d.ts +7 -0
- package/dist/server/routes/jobs.js +574 -0
- package/dist/server/routes/map.d.ts +11 -0
- package/dist/server/routes/map.js +116 -0
- package/dist/server/routes/mcp.d.ts +14 -0
- package/dist/server/routes/mcp.js +197 -0
- package/dist/server/routes/metrics.d.ts +37 -0
- package/dist/server/routes/metrics.js +149 -0
- package/dist/server/routes/oauth.d.ts +9 -0
- package/dist/server/routes/oauth.js +396 -0
- package/dist/server/routes/playground.d.ts +17 -0
- package/dist/server/routes/playground.js +283 -0
- package/dist/server/routes/reader.d.ts +18 -0
- package/dist/server/routes/reader.js +192 -0
- package/dist/server/routes/research.d.ts +14 -0
- package/dist/server/routes/research.js +482 -0
- package/dist/server/routes/screenshot.d.ts +22 -0
- package/dist/server/routes/screenshot.js +820 -0
- package/dist/server/routes/search.d.ts +6 -0
- package/dist/server/routes/search.js +874 -0
- package/dist/server/routes/session.d.ts +17 -0
- package/dist/server/routes/session.js +548 -0
- package/dist/server/routes/share.d.ts +18 -0
- package/dist/server/routes/share.js +462 -0
- package/dist/server/routes/smart-search/handlers/cars.d.ts +2 -0
- package/dist/server/routes/smart-search/handlers/cars.js +102 -0
- package/dist/server/routes/smart-search/handlers/flights.d.ts +2 -0
- package/dist/server/routes/smart-search/handlers/flights.js +72 -0
- package/dist/server/routes/smart-search/handlers/general.d.ts +13 -0
- package/dist/server/routes/smart-search/handlers/general.js +717 -0
- package/dist/server/routes/smart-search/handlers/hotels.d.ts +2 -0
- package/dist/server/routes/smart-search/handlers/hotels.js +88 -0
- package/dist/server/routes/smart-search/handlers/products.d.ts +2 -0
- package/dist/server/routes/smart-search/handlers/products.js +1309 -0
- package/dist/server/routes/smart-search/handlers/rental.d.ts +2 -0
- package/dist/server/routes/smart-search/handlers/rental.js +154 -0
- package/dist/server/routes/smart-search/handlers/restaurants.d.ts +2 -0
- package/dist/server/routes/smart-search/handlers/restaurants.js +225 -0
- package/dist/server/routes/smart-search/handlers/transit-verdict.d.ts +41 -0
- package/dist/server/routes/smart-search/handlers/transit-verdict.js +224 -0
- package/dist/server/routes/smart-search/index.d.ts +19 -0
- package/dist/server/routes/smart-search/index.js +546 -0
- package/dist/server/routes/smart-search/intent.d.ts +3 -0
- package/dist/server/routes/smart-search/intent.js +264 -0
- package/dist/server/routes/smart-search/llm.d.ts +16 -0
- package/dist/server/routes/smart-search/llm.js +70 -0
- package/dist/server/routes/smart-search/sources/reddit.d.ts +18 -0
- package/dist/server/routes/smart-search/sources/reddit.js +34 -0
- package/dist/server/routes/smart-search/sources/yelp.d.ts +25 -0
- package/dist/server/routes/smart-search/sources/yelp.js +171 -0
- package/dist/server/routes/smart-search/sources/youtube.d.ts +8 -0
- package/dist/server/routes/smart-search/sources/youtube.js +9 -0
- package/dist/server/routes/smart-search/types.d.ts +81 -0
- package/dist/server/routes/smart-search/types.js +1 -0
- package/dist/server/routes/smart-search/utils.d.ts +20 -0
- package/dist/server/routes/smart-search/utils.js +146 -0
- package/dist/server/routes/stats.d.ts +6 -0
- package/dist/server/routes/stats.js +71 -0
- package/dist/server/routes/stripe.d.ts +15 -0
- package/dist/server/routes/stripe.js +296 -0
- package/dist/server/routes/transcript-export.d.ts +10 -0
- package/dist/server/routes/transcript-export.js +178 -0
- package/dist/server/routes/usage.d.ts +9 -0
- package/dist/server/routes/usage.js +279 -0
- package/dist/server/routes/users.d.ts +8 -0
- package/dist/server/routes/users.js +1867 -0
- package/dist/server/routes/watch.d.ts +15 -0
- package/dist/server/routes/watch.js +309 -0
- package/dist/server/routes/webhooks.d.ts +26 -0
- package/dist/server/routes/webhooks.js +170 -0
- package/dist/server/routes/youtube.d.ts +6 -0
- package/dist/server/routes/youtube.js +130 -0
- package/dist/server/sentry.d.ts +14 -0
- package/dist/server/sentry.js +104 -0
- package/dist/server/types.d.ts +15 -0
- package/dist/server/types.js +7 -0
- package/dist/server/utils/response.d.ts +44 -0
- package/dist/server/utils/response.js +69 -0
- package/dist/server/utils/sse.d.ts +22 -0
- package/dist/server/utils/sse.js +38 -0
- package/dist/types.d.ts +552 -0
- package/dist/types.js +39 -0
- package/llms.txt +105 -0
- package/package.json +189 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `webpeel setup` — Interactive onboarding wizard.
|
|
3
|
+
*
|
|
4
|
+
* Walks the user through:
|
|
5
|
+
* 1. API key configuration (optional — local mode is fine)
|
|
6
|
+
* 2. Browser installation (Chromium via Playwright)
|
|
7
|
+
* 3. LLM key for AI extraction (optional)
|
|
8
|
+
* 4. Quick smoke test
|
|
9
|
+
*
|
|
10
|
+
* Non-interactive when piped (detects !isTTY).
|
|
11
|
+
*/
|
|
12
|
+
import type { Command } from 'commander';
|
|
13
|
+
export declare function registerSetupCommand(program: Command): void;
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `webpeel setup` — Interactive onboarding wizard.
|
|
3
|
+
*
|
|
4
|
+
* Walks the user through:
|
|
5
|
+
* 1. API key configuration (optional — local mode is fine)
|
|
6
|
+
* 2. Browser installation (Chromium via Playwright)
|
|
7
|
+
* 3. LLM key for AI extraction (optional)
|
|
8
|
+
* 4. Quick smoke test
|
|
9
|
+
*
|
|
10
|
+
* Non-interactive when piped (detects !isTTY).
|
|
11
|
+
*/
|
|
12
|
+
import { createInterface } from 'readline';
|
|
13
|
+
import { existsSync } from 'fs';
|
|
14
|
+
import { loadConfig, saveConfig } from '../../cli-auth.js';
|
|
15
|
+
import { cliVersion, NO_COLOR } from '../utils.js';
|
|
16
|
+
import { runDoctor } from './doctor.js';
|
|
17
|
+
// ── ANSI helpers ────────────────────────────────────────────────────────────
|
|
18
|
+
const bold = (s) => NO_COLOR ? s : `\x1b[1m${s}\x1b[0m`;
|
|
19
|
+
const dim = (s) => NO_COLOR ? s : `\x1b[2m${s}\x1b[0m`;
|
|
20
|
+
const green = (s) => NO_COLOR ? s : `\x1b[32m${s}\x1b[0m`;
|
|
21
|
+
const yellow = (s) => NO_COLOR ? s : `\x1b[33m${s}\x1b[0m`;
|
|
22
|
+
const cyan = (s) => NO_COLOR ? s : `\x1b[36m${s}\x1b[0m`;
|
|
23
|
+
// ── Prompt helper ───────────────────────────────────────────────────────────
|
|
24
|
+
function ask(rl, question) {
|
|
25
|
+
return new Promise((resolve) => {
|
|
26
|
+
rl.question(question, (answer) => resolve(answer.trim()));
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async function confirm(rl, question, defaultYes = true) {
|
|
30
|
+
const suffix = defaultYes ? '[Y/n]' : '[y/N]';
|
|
31
|
+
const answer = await ask(rl, `${question} ${dim(suffix)} `);
|
|
32
|
+
if (answer === '')
|
|
33
|
+
return defaultYes;
|
|
34
|
+
return /^y(es)?$/i.test(answer);
|
|
35
|
+
}
|
|
36
|
+
// ── Wizard steps ────────────────────────────────────────────────────────────
|
|
37
|
+
async function stepApiKey(rl) {
|
|
38
|
+
const cfg = loadConfig();
|
|
39
|
+
const existing = cfg.apiKey || process.env.WEBPEEL_API_KEY;
|
|
40
|
+
console.log('');
|
|
41
|
+
console.log(bold('Step 1: API Key'));
|
|
42
|
+
console.log(dim('An API key unlocks cloud features (faster, higher limits, no browser needed).'));
|
|
43
|
+
console.log(dim('WebPeel works locally without one — this is optional.'));
|
|
44
|
+
console.log('');
|
|
45
|
+
if (existing) {
|
|
46
|
+
console.log(green(` ✅ API key already configured: ${existing.slice(0, 8)}...${existing.slice(-4)}`));
|
|
47
|
+
const change = await confirm(rl, ' Change it?', false);
|
|
48
|
+
if (!change)
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const key = await ask(rl, ` Enter API key ${dim('(or press Enter to skip)')}: `);
|
|
52
|
+
if (!key) {
|
|
53
|
+
console.log(dim(' Skipped — using local mode.'));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
// Quick validation
|
|
57
|
+
const apiUrl = process.env.WEBPEEL_API_URL || 'https://api.webpeel.dev';
|
|
58
|
+
process.stdout.write(' Verifying...');
|
|
59
|
+
try {
|
|
60
|
+
const res = await fetch(`${apiUrl}/v1/usage`, {
|
|
61
|
+
headers: { Authorization: `Bearer ${key}` },
|
|
62
|
+
signal: AbortSignal.timeout(8000),
|
|
63
|
+
});
|
|
64
|
+
if (res.status === 401) {
|
|
65
|
+
console.log(` ${yellow('invalid key')}. Skipping.`);
|
|
66
|
+
console.log(dim(' Get a free key at: https://app.webpeel.dev/keys'));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (res.ok) {
|
|
70
|
+
const data = await res.json();
|
|
71
|
+
const plan = data?.tier || (typeof data?.plan === 'string' ? data?.plan : data?.plan?.tier) || 'free';
|
|
72
|
+
cfg.apiKey = key;
|
|
73
|
+
saveConfig(cfg);
|
|
74
|
+
console.log(` ${green(`✅ Verified (${plan} plan)`)}`);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
// Non-200, non-401 — save anyway
|
|
78
|
+
cfg.apiKey = key;
|
|
79
|
+
saveConfig(cfg);
|
|
80
|
+
console.log(` ${yellow(`saved (API returned ${res.status})`)}`);
|
|
81
|
+
}
|
|
82
|
+
catch (e) {
|
|
83
|
+
// Network error — save key, warn
|
|
84
|
+
cfg.apiKey = key;
|
|
85
|
+
saveConfig(cfg);
|
|
86
|
+
console.log(` ${yellow(`saved (couldn't verify: ${e.message})`)}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function stepBrowser(rl) {
|
|
90
|
+
console.log('');
|
|
91
|
+
console.log(bold('Step 2: Browser (Chromium)'));
|
|
92
|
+
console.log(dim('Required for --render, --stealth, --screenshot, and JS-heavy sites.'));
|
|
93
|
+
console.log('');
|
|
94
|
+
let installed = false;
|
|
95
|
+
try {
|
|
96
|
+
const pw = await import('playwright');
|
|
97
|
+
const execPath = pw.chromium.executablePath();
|
|
98
|
+
installed = existsSync(execPath);
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
// playwright not importable
|
|
102
|
+
}
|
|
103
|
+
if (installed) {
|
|
104
|
+
console.log(green(' ✅ Chromium is already installed.'));
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const install = await confirm(rl, ' Install Chromium now? (~150MB, takes ~30s)', true);
|
|
108
|
+
if (!install) {
|
|
109
|
+
console.log(dim(' Skipped — browser features will auto-install on first use.'));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
console.log(dim(' Installing Chromium via Playwright...'));
|
|
113
|
+
try {
|
|
114
|
+
const { execSync } = await import('child_process');
|
|
115
|
+
execSync('npx playwright install chromium', {
|
|
116
|
+
stdio: 'inherit',
|
|
117
|
+
timeout: 120_000,
|
|
118
|
+
});
|
|
119
|
+
console.log(green(' ✅ Chromium installed.'));
|
|
120
|
+
}
|
|
121
|
+
catch (e) {
|
|
122
|
+
console.log(yellow(` ⚠️ Install failed: ${e.message}`));
|
|
123
|
+
console.log(dim(' You can install later: npx playwright install chromium'));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async function stepLlm(rl) {
|
|
127
|
+
const cfg = loadConfig();
|
|
128
|
+
const existing = cfg.llm?.apiKey || process.env.OPENAI_API_KEY || process.env.ANTHROPIC_API_KEY || process.env.GOOGLE_API_KEY;
|
|
129
|
+
console.log('');
|
|
130
|
+
console.log(bold('Step 3: LLM Key (AI Extraction)'));
|
|
131
|
+
console.log(dim('Enables --extract for structured data extraction using AI.'));
|
|
132
|
+
console.log(dim('Supports OpenAI, Anthropic, or Google keys. Optional.'));
|
|
133
|
+
console.log('');
|
|
134
|
+
if (existing) {
|
|
135
|
+
const source = cfg.llm?.apiKey ? 'config' : 'environment variable';
|
|
136
|
+
console.log(green(` ✅ LLM key found (via ${source}).`));
|
|
137
|
+
const change = await confirm(rl, ' Change it?', false);
|
|
138
|
+
if (!change)
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const key = await ask(rl, ` Enter OpenAI/Anthropic/Google API key ${dim('(or Enter to skip)')}: `);
|
|
142
|
+
if (!key) {
|
|
143
|
+
console.log(dim(' Skipped — set later with `webpeel config set llm.apiKey <key>`.'));
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (!cfg.llm)
|
|
147
|
+
cfg.llm = {};
|
|
148
|
+
cfg.llm.apiKey = key;
|
|
149
|
+
saveConfig(cfg);
|
|
150
|
+
console.log(green(' ✅ LLM key saved.'));
|
|
151
|
+
// Ask for model preference
|
|
152
|
+
const model = await ask(rl, ` Model name ${dim('(default: gpt-4o-mini, Enter to accept)')}: `);
|
|
153
|
+
if (model) {
|
|
154
|
+
cfg.llm.model = model;
|
|
155
|
+
saveConfig(cfg);
|
|
156
|
+
console.log(green(` ✅ Model set to ${model}.`));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
async function stepSmokeTest(rl) {
|
|
160
|
+
console.log('');
|
|
161
|
+
console.log(bold('Step 4: Quick Test'));
|
|
162
|
+
console.log('');
|
|
163
|
+
const runTest = await confirm(rl, ' Run a quick fetch test?', true);
|
|
164
|
+
if (!runTest) {
|
|
165
|
+
console.log(dim(' Skipped.'));
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
process.stdout.write(' Fetching https://example.com...');
|
|
169
|
+
try {
|
|
170
|
+
// Use local peel to test
|
|
171
|
+
const { peel } = await import('../../index.js');
|
|
172
|
+
const start = Date.now();
|
|
173
|
+
const result = await peel('https://example.com');
|
|
174
|
+
const elapsed = Date.now() - start;
|
|
175
|
+
const tokens = result.tokens ?? result.content.split(/\s+/).length;
|
|
176
|
+
console.log(` ${green(`✅ ${tokens} tokens in ${elapsed}ms`)}`);
|
|
177
|
+
}
|
|
178
|
+
catch (e) {
|
|
179
|
+
console.log(` ${yellow(`⚠️ ${e.message}`)}`);
|
|
180
|
+
console.log(dim(' This is expected for some network configurations. CLI still works fine.'));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// ── Main wizard ─────────────────────────────────────────────────────────────
|
|
184
|
+
async function runSetup() {
|
|
185
|
+
console.log('');
|
|
186
|
+
console.log(bold('🔧 WebPeel Setup'));
|
|
187
|
+
console.log(dim(`v${cliVersion} — Fast web fetcher for AI agents`));
|
|
188
|
+
console.log(dim('─'.repeat(50)));
|
|
189
|
+
const isTTY = process.stdin.isTTY && process.stdout.isTTY;
|
|
190
|
+
if (!isTTY) {
|
|
191
|
+
console.log('');
|
|
192
|
+
console.log('Non-interactive mode detected. Running doctor instead...');
|
|
193
|
+
console.log('');
|
|
194
|
+
const report = await runDoctor();
|
|
195
|
+
console.log(JSON.stringify(report, null, 2));
|
|
196
|
+
process.exit(report.summary.error > 0 ? 1 : 0);
|
|
197
|
+
}
|
|
198
|
+
const rl = createInterface({
|
|
199
|
+
input: process.stdin,
|
|
200
|
+
output: process.stdout,
|
|
201
|
+
});
|
|
202
|
+
try {
|
|
203
|
+
await stepApiKey(rl);
|
|
204
|
+
await stepBrowser(rl);
|
|
205
|
+
await stepLlm(rl);
|
|
206
|
+
await stepSmokeTest(rl);
|
|
207
|
+
// Final summary — run doctor
|
|
208
|
+
console.log('');
|
|
209
|
+
console.log(dim('─'.repeat(50)));
|
|
210
|
+
console.log(bold('📋 Final Status'));
|
|
211
|
+
const report = await runDoctor();
|
|
212
|
+
// Print compact summary
|
|
213
|
+
for (const check of report.checks) {
|
|
214
|
+
const icon = check.status === 'ok' ? green('✓') : check.status === 'warn' ? yellow('○') : check.status === 'error' ? '✗' : dim('·');
|
|
215
|
+
console.log(` ${icon} ${check.name}: ${check.detail}`);
|
|
216
|
+
}
|
|
217
|
+
console.log('');
|
|
218
|
+
if (report.summary.error === 0) {
|
|
219
|
+
console.log(green(bold('🎉 Setup complete! WebPeel is ready.')));
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
console.log(yellow('⚠️ Setup complete with some issues. Run `webpeel doctor` for details.'));
|
|
223
|
+
}
|
|
224
|
+
console.log('');
|
|
225
|
+
console.log(dim('Quick start:'));
|
|
226
|
+
console.log(cyan(' webpeel "https://news.ycombinator.com"'));
|
|
227
|
+
console.log(cyan(' webpeel search "latest AI news"'));
|
|
228
|
+
console.log(cyan(' webpeel doctor'));
|
|
229
|
+
console.log('');
|
|
230
|
+
}
|
|
231
|
+
finally {
|
|
232
|
+
rl.close();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// ── Commander registration ──────────────────────────────────────────────────
|
|
236
|
+
export function registerSetupCommand(program) {
|
|
237
|
+
program
|
|
238
|
+
.command('setup')
|
|
239
|
+
.description('Interactive setup wizard — configure API key, browser, and LLM')
|
|
240
|
+
.action(async () => {
|
|
241
|
+
await runSetup();
|
|
242
|
+
process.exit(0);
|
|
243
|
+
});
|
|
244
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `webpeel skill` — Manage optional capabilities.
|
|
3
|
+
*
|
|
4
|
+
* Lists, installs, and uninstalls optional components:
|
|
5
|
+
* - browser — Chromium via Playwright (--render, --stealth, --screenshot)
|
|
6
|
+
* - yt-dlp — YouTube transcript extraction (auto-detected)
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* webpeel skill — list all skills with status
|
|
10
|
+
* webpeel skill --install browser — install Chromium
|
|
11
|
+
* webpeel skill --uninstall browser — remove Chromium
|
|
12
|
+
* webpeel skill --json — machine-readable output
|
|
13
|
+
*/
|
|
14
|
+
import type { Command } from 'commander';
|
|
15
|
+
export declare function registerSkillCommand(program: Command): void;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `webpeel skill` — Manage optional capabilities.
|
|
3
|
+
*
|
|
4
|
+
* Lists, installs, and uninstalls optional components:
|
|
5
|
+
* - browser — Chromium via Playwright (--render, --stealth, --screenshot)
|
|
6
|
+
* - yt-dlp — YouTube transcript extraction (auto-detected)
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* webpeel skill — list all skills with status
|
|
10
|
+
* webpeel skill --install browser — install Chromium
|
|
11
|
+
* webpeel skill --uninstall browser — remove Chromium
|
|
12
|
+
* webpeel skill --json — machine-readable output
|
|
13
|
+
*/
|
|
14
|
+
import { existsSync } from 'fs';
|
|
15
|
+
import { execSync } from 'child_process';
|
|
16
|
+
import { NO_COLOR } from '../utils.js';
|
|
17
|
+
// ── ANSI helpers ────────────────────────────────────────────────────────────
|
|
18
|
+
const bold = (s) => NO_COLOR ? s : `\x1b[1m${s}\x1b[0m`;
|
|
19
|
+
const dim = (s) => NO_COLOR ? s : `\x1b[2m${s}\x1b[0m`;
|
|
20
|
+
const green = (s) => NO_COLOR ? s : `\x1b[32m${s}\x1b[0m`;
|
|
21
|
+
const yellow = (s) => NO_COLOR ? s : `\x1b[33m${s}\x1b[0m`;
|
|
22
|
+
const red = (s) => NO_COLOR ? s : `\x1b[31m${s}\x1b[0m`;
|
|
23
|
+
async function isBrowserInstalled() {
|
|
24
|
+
try {
|
|
25
|
+
const pw = await import('playwright');
|
|
26
|
+
return existsSync(pw.chromium.executablePath());
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function isYtdlpInstalled() {
|
|
33
|
+
try {
|
|
34
|
+
execSync('yt-dlp --version', { stdio: 'pipe', timeout: 5000 });
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const SKILLS = [
|
|
42
|
+
{
|
|
43
|
+
name: 'browser',
|
|
44
|
+
description: 'Chromium browser via Playwright',
|
|
45
|
+
features: '--render, --stealth, --screenshot, --action, interactive sessions',
|
|
46
|
+
installed: isBrowserInstalled,
|
|
47
|
+
install: async () => {
|
|
48
|
+
console.log(dim('Installing Chromium via Playwright...'));
|
|
49
|
+
execSync('npx playwright install chromium', { stdio: 'inherit', timeout: 120_000 });
|
|
50
|
+
},
|
|
51
|
+
uninstall: async () => {
|
|
52
|
+
console.log(dim('Removing Playwright browsers...'));
|
|
53
|
+
execSync('npx playwright uninstall', { stdio: 'inherit', timeout: 60_000 });
|
|
54
|
+
},
|
|
55
|
+
installHint: 'npx playwright install chromium',
|
|
56
|
+
uninstallHint: 'npx playwright uninstall',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'yt-dlp',
|
|
60
|
+
description: 'YouTube transcript & metadata extractor',
|
|
61
|
+
features: 'Enhanced YouTube extraction (transcripts, metadata, chapters)',
|
|
62
|
+
installed: () => isYtdlpInstalled(),
|
|
63
|
+
install: async () => {
|
|
64
|
+
const platform = process.platform;
|
|
65
|
+
if (platform === 'darwin') {
|
|
66
|
+
console.log(dim('Installing yt-dlp via Homebrew...'));
|
|
67
|
+
execSync('brew install yt-dlp', { stdio: 'inherit', timeout: 120_000 });
|
|
68
|
+
}
|
|
69
|
+
else if (platform === 'linux') {
|
|
70
|
+
console.log(dim('Installing yt-dlp via pip...'));
|
|
71
|
+
execSync('pip3 install yt-dlp', { stdio: 'inherit', timeout: 120_000 });
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
console.log(dim('Installing yt-dlp via pip...'));
|
|
75
|
+
execSync('pip install yt-dlp', { stdio: 'inherit', timeout: 120_000 });
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
uninstall: async () => {
|
|
79
|
+
const platform = process.platform;
|
|
80
|
+
if (platform === 'darwin') {
|
|
81
|
+
console.log(dim('Uninstalling yt-dlp via Homebrew...'));
|
|
82
|
+
execSync('brew uninstall yt-dlp', { stdio: 'inherit', timeout: 60_000 });
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
console.log(dim('Uninstalling yt-dlp via pip...'));
|
|
86
|
+
execSync('pip3 uninstall -y yt-dlp', { stdio: 'inherit', timeout: 60_000 });
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
installHint: process.platform === 'darwin' ? 'brew install yt-dlp' : 'pip3 install yt-dlp',
|
|
90
|
+
uninstallHint: process.platform === 'darwin' ? 'brew uninstall yt-dlp' : 'pip3 uninstall yt-dlp',
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
async function getSkillStatuses() {
|
|
94
|
+
const results = [];
|
|
95
|
+
for (const skill of SKILLS) {
|
|
96
|
+
const installed = await skill.installed();
|
|
97
|
+
results.push({
|
|
98
|
+
name: skill.name,
|
|
99
|
+
description: skill.description,
|
|
100
|
+
features: skill.features,
|
|
101
|
+
installed,
|
|
102
|
+
installHint: skill.installHint,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return results;
|
|
106
|
+
}
|
|
107
|
+
// ── Commander registration ──────────────────────────────────────────────────
|
|
108
|
+
export function registerSkillCommand(program) {
|
|
109
|
+
program
|
|
110
|
+
.command('skill')
|
|
111
|
+
.description('Manage optional capabilities (browser, yt-dlp)')
|
|
112
|
+
.option('--install <name>', 'Install a skill')
|
|
113
|
+
.option('--uninstall <name>', 'Uninstall a skill')
|
|
114
|
+
.option('--json', 'Output as JSON')
|
|
115
|
+
.action(async (opts) => {
|
|
116
|
+
// ── Install mode ──────────────────────────────────────────────────
|
|
117
|
+
if (opts.install) {
|
|
118
|
+
const skill = SKILLS.find((s) => s.name === opts.install);
|
|
119
|
+
if (!skill) {
|
|
120
|
+
console.error(`Unknown skill: ${opts.install}`);
|
|
121
|
+
console.error(`Available: ${SKILLS.map((s) => s.name).join(', ')}`);
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
const alreadyInstalled = await skill.installed();
|
|
125
|
+
if (alreadyInstalled) {
|
|
126
|
+
console.log(green(`✅ ${skill.name} is already installed.`));
|
|
127
|
+
process.exit(0);
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
await skill.install();
|
|
131
|
+
const nowInstalled = await skill.installed();
|
|
132
|
+
if (nowInstalled) {
|
|
133
|
+
console.log(green(`✅ ${skill.name} installed successfully.`));
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
console.log(yellow(`⚠️ Install command ran but ${skill.name} not detected. Try manually: ${skill.installHint}`));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch (e) {
|
|
140
|
+
console.error(red(`❌ Failed to install ${skill.name}: ${e.message}`));
|
|
141
|
+
console.error(dim(` Try manually: ${skill.installHint}`));
|
|
142
|
+
process.exit(1);
|
|
143
|
+
}
|
|
144
|
+
process.exit(0);
|
|
145
|
+
}
|
|
146
|
+
// ── Uninstall mode ────────────────────────────────────────────────
|
|
147
|
+
if (opts.uninstall) {
|
|
148
|
+
const skill = SKILLS.find((s) => s.name === opts.uninstall);
|
|
149
|
+
if (!skill) {
|
|
150
|
+
console.error(`Unknown skill: ${opts.uninstall}`);
|
|
151
|
+
console.error(`Available: ${SKILLS.map((s) => s.name).join(', ')}`);
|
|
152
|
+
process.exit(1);
|
|
153
|
+
}
|
|
154
|
+
const isInstalled = await skill.installed();
|
|
155
|
+
if (!isInstalled) {
|
|
156
|
+
console.log(dim(`${skill.name} is not installed.`));
|
|
157
|
+
process.exit(0);
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
await skill.uninstall();
|
|
161
|
+
console.log(green(`✅ ${skill.name} uninstalled.`));
|
|
162
|
+
}
|
|
163
|
+
catch (e) {
|
|
164
|
+
console.error(red(`❌ Failed to uninstall ${skill.name}: ${e.message}`));
|
|
165
|
+
console.error(dim(` Try manually: ${skill.uninstallHint}`));
|
|
166
|
+
process.exit(1);
|
|
167
|
+
}
|
|
168
|
+
process.exit(0);
|
|
169
|
+
}
|
|
170
|
+
// ── List mode (default) ───────────────────────────────────────────
|
|
171
|
+
const statuses = await getSkillStatuses();
|
|
172
|
+
if (opts.json) {
|
|
173
|
+
console.log(JSON.stringify(statuses, null, 2));
|
|
174
|
+
process.exit(0);
|
|
175
|
+
}
|
|
176
|
+
console.log('');
|
|
177
|
+
console.log(bold('WebPeel Skills'));
|
|
178
|
+
console.log(dim('Optional capabilities that enhance WebPeel'));
|
|
179
|
+
console.log('');
|
|
180
|
+
for (const skill of statuses) {
|
|
181
|
+
const icon = skill.installed ? green('✅') : yellow('○');
|
|
182
|
+
const status = skill.installed ? green('installed') : dim('not installed');
|
|
183
|
+
console.log(` ${icon} ${bold(skill.name.padEnd(12))} ${status}`);
|
|
184
|
+
console.log(` ${skill.description}`);
|
|
185
|
+
console.log(` ${dim(`Enables: ${skill.features}`)}`);
|
|
186
|
+
if (!skill.installed) {
|
|
187
|
+
console.log(` ${dim(`Install: webpeel skill --install ${skill.name}`)}`);
|
|
188
|
+
}
|
|
189
|
+
console.log('');
|
|
190
|
+
}
|
|
191
|
+
console.log(dim('Usage: webpeel skill --install <name> | --uninstall <name>'));
|
|
192
|
+
console.log('');
|
|
193
|
+
process.exit(0);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CLI utilities — config, API client, output formatting, helpers.
|
|
3
|
+
* Imported by all command modules.
|
|
4
|
+
*/
|
|
5
|
+
import type { PeelResult, PeelEnvelope, PageAction, PeelOptions } from '../types.js';
|
|
6
|
+
export declare const cliVersion: string;
|
|
7
|
+
export declare const VERB_ALIASES: Set<string>;
|
|
8
|
+
export declare function checkForUpdates(): Promise<void>;
|
|
9
|
+
export declare const NO_COLOR: boolean;
|
|
10
|
+
export declare const bold: (s: string) => string;
|
|
11
|
+
export declare const dim: (s: string) => string;
|
|
12
|
+
export declare const cyan: (s: string) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Parse action strings into PageAction array
|
|
15
|
+
* Formats:
|
|
16
|
+
* click:.selector — click an element
|
|
17
|
+
* type:.selector=text — type text into an input
|
|
18
|
+
* fill:.selector=text — fill an input (replaces existing value)
|
|
19
|
+
* scroll:down:500 — scroll direction + amount
|
|
20
|
+
* scroll:bottom — scroll to bottom (legacy)
|
|
21
|
+
* scroll:top — scroll to top (legacy)
|
|
22
|
+
* wait:2000 — wait N ms
|
|
23
|
+
* press:Enter — press a keyboard key
|
|
24
|
+
* hover:.selector — hover over an element
|
|
25
|
+
* waitFor:.selector — wait for a selector to appear
|
|
26
|
+
* select:.selector=value — select dropdown option
|
|
27
|
+
* screenshot — take a screenshot
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseActions(actionStrings: string[]): PageAction[];
|
|
30
|
+
/**
|
|
31
|
+
* Format an error with actionable suggestions based on error type
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatError(error: Error, _url: string, options: any): string;
|
|
34
|
+
/**
|
|
35
|
+
* Routes ALL fetch requests through the WebPeel API.
|
|
36
|
+
* CLI is a pure API client — no local Playwright.
|
|
37
|
+
*/
|
|
38
|
+
export declare function fetchViaApi(url: string, options: PeelOptions, apiKey: string, apiUrl: string): Promise<any>;
|
|
39
|
+
/**
|
|
40
|
+
* Reconstruct the standard Commander help layout for --help-all and subcommands.
|
|
41
|
+
* This mirrors Commander's own default formatHelp() so subcommand help keeps working.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildCommanderHelp(cmd: any, helper: any): string;
|
|
44
|
+
/**
|
|
45
|
+
* Condensed, Anthropic-style help for the root command (default --help).
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildCondensedHelp(): string;
|
|
48
|
+
/**
|
|
49
|
+
* Format a past Date relative to now (e.g. "2h ago", "5m ago").
|
|
50
|
+
*/
|
|
51
|
+
export declare function formatRelativeTime(past: Date): string;
|
|
52
|
+
export declare function classifyErrorCode(error: unknown): string;
|
|
53
|
+
export interface OutputExtra {
|
|
54
|
+
/** Was this result served from the local cache? */
|
|
55
|
+
cached?: boolean;
|
|
56
|
+
/** Structured listings data (from --extract-all) */
|
|
57
|
+
structured?: Record<string, unknown>[];
|
|
58
|
+
/** Was content distilled/truncated to fit a budget? */
|
|
59
|
+
truncated?: boolean;
|
|
60
|
+
/** Total items available before budget limiting (listings only) */
|
|
61
|
+
totalAvailable?: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Build a unified PeelEnvelope from a PeelResult.
|
|
65
|
+
*
|
|
66
|
+
* All existing PeelResult fields are spread first (backward compatibility),
|
|
67
|
+
* then canonical envelope fields override/extend them.
|
|
68
|
+
*/
|
|
69
|
+
export declare function buildEnvelope(result: PeelResult, extra: OutputExtra): PeelEnvelope & Record<string, unknown>;
|
|
70
|
+
export declare function outputResult(result: PeelResult, options: any, extra?: OutputExtra): Promise<void>;
|
|
71
|
+
export declare function writeStdout(data: string): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Convert an array of listing items to CSV.
|
|
74
|
+
*/
|
|
75
|
+
export declare function formatListingsCsv(items: Array<Record<string, string | undefined>>): string;
|
|
76
|
+
/**
|
|
77
|
+
* Normalise the result of --extract (which may be a flat object or contain
|
|
78
|
+
* arrays) into an array of row objects suitable for CSV / table rendering.
|
|
79
|
+
*/
|
|
80
|
+
export declare function normaliseExtractedToRows(extracted: Record<string, any>): Array<Record<string, string | undefined>>;
|
|
81
|
+
/** Helper function to extract colors from content */
|
|
82
|
+
export declare function extractColors(content: string): string[];
|
|
83
|
+
/** Helper function to extract font information */
|
|
84
|
+
export declare function extractFonts(content: string): string[];
|