@agnamo/craw
v0.1.1
Published
Craw base host and plugin endpoint runtime for public-page scraping.
Readme
@agnamo/craw
Craw is the base host for Agnamo scraping packages. The host owns the generic public-page scraper and plugin endpoint contract; vertical tools such as jobs, social, and ecommerce register as plugins that use the Craw base.
Use
Local scrape does not need Apify, an Apify token, or the Apify SDK. Runtime CLI dependencies are cheerio, tsx, and zod. apify is an optional peer for the private Actor entry only.
npm install
node bin/craw.js
node bin/craw.js scrape https://example.com
node bin/craw.js scrape --schema schema.json https://example.com
node bin/craw.js scrape --route brightdata https://example.com
node bin/craw.js scrape --route search "site:example.com docs"
node bin/craw.js doctor
node bin/craw.js plugins --json
node bin/craw.js firecrawl scrape https://example.comcraw with no arguments opens the interactive TUI. Use p for the command palette, / for slash commands, click or arrows to move, Enter to run, l for plugin menus, and q to quit. /scrape <url> runs the host scraper in place.
craw scrape writes storage/datasets/default/stream.jsonl, storage/key_value_stores/default/CONTEXT.json, and CARD.json in the current working directory.
Optional Layers
- Firecrawl is an optional schema extraction fallback. When
--schemais set and eitherFIRECRAWL_API_KEYor a localFIRECRAWL_URLis configured, Craw probes Firecrawl with a 500ms timeout and then callsPOST /v2/scrapeonly after local JSON-LD, embedded JSON, and RSS extraction fail. If Firecrawl is missing or down, Craw skips it. - Bright Data Unlocker is an explicit route only:
--route brightdata. Craw never upgrades direct 403s to Bright Data automatically, including LinkedIn and Indeed URLs.BRIGHTDATA_API_TOKENis required; 401/403 responses are reported as denied, not thrown. - SearXNG search is local JSON only: set
SEARXNG_URLto a localhost URL and use--route search. Public sidecar URLs are rejected by the same local bind check used by host sidecars.
craw doctor reports Firecrawl, Bright Data, and SearXNG as pass, warn, or missing without printing secrets.
Site
The static landing and marketplace surface lives in site/.
npm run site:serveThe site reads site/plugins.json, which mirrors the { "plugins": [...] } payload from craw plugins --json. Refresh that file from the CLI output before uploading the directory to R2.
Plugin Manifest
Marketplace sites can index Craw packages without installing them by reading each package's static manifest() export or mirrored package metadata:
import { type CrawPlugin } from "@agnamo/craw";
export function manifest() {
return {
id: "craw-jobs",
name: "unjobbed",
title: "Craw Jobs",
description: "Jobs scraper plugin endpoint powered by Unjobbed.",
version: "1.1.0",
npmName: "@agnamo/craw-jobs",
kind: "plugin",
endpoints: ["scrape", "run", "doctor"],
vertical: "jobs",
license: "MIT",
homepage: "https://github.com/LuxDevNet/unjobbed",
};
}
export default {
manifest,
async scrape(urls, opts) {
// call @agnamo/craw base or a vertical-specific scraper
},
} satisfies CrawPlugin;Required manifest fields are id, name, title, description, version, npmName, kind, endpoints, vertical, license, and optional homepage.
Plugin Discovery
craw plugins --json prints:
{
"plugins": [
{
"id": "craw",
"npmName": "@agnamo/craw",
"kind": "host",
"endpoints": ["scrape", "doctor", "plugins"]
},
{
"id": "firecrawl",
"kind": "plugin",
"layer": "optional",
"defaultScraper": false
},
{
"id": "brightdata",
"kind": "plugin",
"layer": "optional",
"defaultScraper": false
}
]
}Discovery checks:
- packages listed in
package.jsonundercraw.plugins - dependencies named
@agnamo/craw-* - local entries under
./plugins/
Host, Firecrawl, and Bright Data register as loadable plugins with scrape/doctor hooks. craw-jobs loads from unjobbed when that package is a dependency, listed in craw.plugins, present under ./plugins/, or found at the sibling Plugins/unjobbed checkout.
Sync
- GitHub repo: https://github.com/LuxDevNet/craw
- npm package:
@agnamo/crawis not on the registry yet. Use this checkout andnode bin/craw.jsuntil publish exists. - Cloudflare public site: https://agnamo-craw.agnamo.workers.dev
The Cloudflare site serves static files from site/ through Worker agnamo-craw and R2 bucket agnamo-craw. GET /plugins.json exposes the Craw plugin manifest feed for marketplace discovery.
Deploy the site and Worker with one command:
npm run deploy:siteApify Actor (optional, private)
Apify is optional convenience, not the product. The owner Actor luxdev/craw is private (isPublic false, limited permissions, source hidden). It is not a Store listing and it is not public.
.actor/ plus src/main.ts wrap the same public-page template with Actor.init(), Actor.getInput(), Actor.pushData(), and Actor.exit(). The Actor image installs apify after npm ci. Input is startUrls plus page, record, and maxTotalChargeUsd caps. Output is a PageRecord dataset and a CONTEXT key-value record.
Job collection is the unjobbed jobs plugin, loaded from a local checkout or a future @agnamo/craw-jobs package. Its cold APIs and feeds are that plugin's default source list. These source ids stay opt-in on the jobs plugin and are not selected by the Craw Actor: linkedin, indeed, glassdoor, upwork, ziprecruiter, simplyhired, monster, wellfound, builtin, dice, workday.
callOptInActor in src/routing/delegate.ts is an optional apify-client path. It requires an explicit Actor id, APIFY_TOKEN, and maxTotalChargeUsd. The template entrypoint does not call it. apify and apify-client are optional peer dependencies.
Owner-only platform run from this checkout (does not publish or Store-list):
apify run --purge --input-file ./input.example.jsonDo not apify push, set isPublic true, or Store-list this Actor from day-to-day work. Keep it private.
Publish
The npm package is not published yet. When an org token that can create @agnamo/craw exists, publish from this checkout. Until then, run node bin/craw.js.
