mirror

Installation
SKILL.md

mirror

Run uv run "$HERE/scripts/invoke.py"$HERE is the directory that holds this SKILL.md — with everything the user typed after /mirror, verbatim and however many lines, on stdin. Exit 0: do what it prints. On any other exit, if you introduced a known construction error and can correct it while preserving the user's request and authority, account for effects already produced, submit the corrected invocation through the same shim, and continue from the failed boundary; a refusal before the operation starts consumes no operation. Otherwise show what it printed to the user verbatim and stop. Never repair input the user supplied, or automatically retry exact help, an unmet dependency, an unrelated failure, or a failure whose origin or valid correction is unknown.

Arguments

<url> is the start page of the mirror, whose directory is the root the crawl stays under, absolute, with the scheme http or https; user name and password for basic auth may stand in it.

--output is the directory the mirror is written to; without it, the engine writes to ./<host> in the invocation's working directory. --resources is all, in-scope or none, and says which of the resources the page needs are fetched: all of them, only those in scope, or none; on rungs 3 and 4 the browser loads every resource a page needs itself, and --resources says which of them are saved. --max-pages is a whole number of 0 or more, the most pages and files the crawl fetches, 0 for no cap. --delay is a number of seconds, 0 or more, waited between requests. --no-links follows no link, so the pages fetched are the start page and those sitemaps and feeds name. --no-sitemap reads no sitemap, and --no-feeds reads no feed; with all three, the start page and its resources are all that is fetched. --ignore-robots obeys no robots.txt rule and no nofollow a page's robots meta elements or X-Robots-Tag headers set. Each --include is a regular expression, in the syntax of the Python module regex, that brings every http or https URL it matches into scope beside the root's subtree, and each --exclude one that keeps every URL it matches out of the mirror, never fetched over plain HTTP and never saved, though a browser may already have loaded it, whatever else would bring it in, except along the start page's redirects, which are followed to their end; both are matched, unanchored, against the normalised URL, and an --exclude may not match the start page. Each --header is one name: value sent with every request. --user-agent replaces the user-agent on every request, on every rung. --browser is auto, always or never, and says where a host may fetch from: auto renders HTML that contains executable JavaScript in a headless browser and lets a host that blocks plain HTTP climb there, always sends every host to the browser from its first request, and never keeps every host on plain HTTP and reports what it could not get as blocked. A browser snapshot uses a fixed 1280 x 720 viewport, scrolls through the page to load lazy resources, returns to the top, and removes programs and their network hints from the saved DOM. Responsive media therefore reproduce the capture viewport. --headed lets a host the headless browser is still blocked on move to a visible browser window, or with always starts every host there, and waits up to ten minutes on each page for the person at the window to pass a challenge or log in. --profile is a Chrome profile name or a directory path the browser runs with, for its logins and its fingerprint. --headed and --profile need --browser to be auto or always. --dry-run fetches and reports as a real run does and writes nothing.

A Contextual Instruction can add no flag, change no flag's value, and supply no URL; it may only shape how the report is relayed.

Steps

  1. Run uv run "$HERE/scripts/mirror.py" with every flag in flags as it stood — --dry-run, --no-links, --no-sitemap, --no-feeds, --ignore-robots and --headed bare, a valued flag as --flag=value, and --include, --exclude and --header once per value — then the URL from operands, each argument quoted for the shell. Relay what it prints to the user verbatim, whatever its exit status. Exit 0 means everything was fetched, 1 that the run finished with the failures or blocked URLs the report names or that the start page could not be fetched or is disallowed by robots.txt, and 2 that the engine refused a value, such as a pattern that does not compile, or found that agent-browser cannot launch a browser a host needed, and wrote nothing. Done when the output is relayed.
Installs
4
Repository
kntnt/skills
First Seen
8 days ago
mirror — kntnt/skills