GitResolve separates page-fetching concerns from link extraction through theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/clyrisai/gitresolve/llms.txt
Use this file to discover all available pages before exploring further.
BrowserProvider interface. This lets you choose between a lightweight plain-fetch approach and a full headless browser without changing any other code. The createProvider factory handles automatic detection so most applications never need to instantiate a provider class directly.
createProvider
Creates and returns the best available BrowserProvider. Providers are tested for availability before being returned, so the result is always usable.
Parameters
Optional explicit provider name. When specified,
createProvider attempts to use only that provider. If the requested provider is unavailable, the function throws rather than silently falling back.Returns
Promise<BrowserProvider> — a ready-to-use provider instance.
Resolution order
preferredargument — if supplied, that provider is attempted. ThrowsError("Requested provider '${preferred}' is not available")if unavailable.BROWSER_PROVIDERenvironment variable — if set to a validProviderName, behaves as ifpreferredwas passed (including the throw-on-unavailable behaviour).- Automatic fallback chain —
puppeteer→browserless→fetch. The first provider that reportsisAvailable() === trueis returned.
FetchProvider.isAvailable() always returns true (built into Node.js 18+), so the automatic fallback chain never exhausts all options. If neither Puppeteer nor a Browserless instance is reachable, FetchProvider is returned as the ultimate fallback.Examples
ProviderName type
BrowserProvider interface
The contract that all three provider classes — and any custom provider — must implement.
Human-readable identifier for the provider. Used in
scrapePortfolio warning messages. Values for the built-in providers: 'fetch', 'puppeteer', 'browserless'.Fetches a URL and returns the fully rendered HTML as a string. For
FetchProvider this is the raw server response. For PuppeteerProvider and BrowserlessProvider this is the post-JavaScript-execution DOM serialisation.Returns
true if the provider can be used in the current environment. FetchProvider always returns true. PuppeteerProvider attempts a dynamic import of puppeteer. BrowserlessProvider attempts a GET /json/version health check with a 3-second timeout.Releases any held resources. For
PuppeteerProvider this closes the managed browser instance. For FetchProvider and BrowserlessProvider this is a no-op. Always call cleanup() in a finally block.BrowserProviderOptions
Options accepted by getPageContent to control navigation behaviour.
Navigation timeout in milliseconds. Defaults differ by provider:
| Provider | Default |
|---|---|
FetchProvider | 15000 ms |
PuppeteerProvider | 30000 ms |
BrowserlessProvider | 30000 ms |
When to consider the navigation complete. Applies only to
PuppeteerProvider and BrowserlessProvider — FetchProvider ignores this option since fetch has no page lifecycle events.| Value | Meaning |
|---|---|
'load' | Wait for the load event to fire |
'domcontentloaded' | Wait for DOMContentLoaded — faster but JS may not have run |
'networkidle0' | Wait until there are zero in-flight network requests for 500 ms |
'networkidle2' | Wait until there are ≤ 2 in-flight network requests for 500 ms (default) |
Provider classes
FetchProvider
Uses Node.js built-in fetch to download HTML. No extra dependencies, no browser process. Works on any static site or server-rendered page. Does not execute JavaScript.
- Best for: Static portfolio sites, GitHub Pages sites, server-rendered Rails/Django/Next.js apps with SSR.
- Not suitable for: SPAs that render links via React, Vue, Angular, or similar client-side routing.
- Sends a realistic
User-Agentheader (Mozilla/5.0 (compatible; ClyrisBot/1.0)) to avoid bot-blocking on common static hosts.
PuppeteerProvider
Launches a headless Chromium browser via Puppeteer. One browser instance is reused across multiple getPageContent calls within the same provider instance.
- Launches Chrome with
--no-sandbox --disable-setuid-sandboxflags (required for most CI/container environments). - Each page is opened in a new tab and closed after
getPageContentreturns. - Call
provider.cleanup()to close the browser and free resources.
BrowserlessProvider
Uses the Browserless /content REST endpoint for full JS rendering without managing a local browser process. Ideal for serverless environments and autoscaled pipelines.
- Constructor argument
baseUrl BROWSERLESS_URLenvironment variable- Default:
http://localhost:3000
isAvailable() performs a GET {baseUrl}/json/version health check with a 3-second timeout. cleanup() is a no-op since the provider is stateless REST.
Custom provider
You can implement your own provider by satisfying theBrowserProvider interface. This is useful for injecting a mock in tests or integrating an alternative rendering service.