npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pluckr/core

v0.1.1

Published

Schema-first, self-healing HTML data extraction with LLM-generated selectors

Readme

@pluckr/core

Schema-first, self-healing HTML data extraction powered by LLMs. Define what you want with a Zod schema, and Pluckr figures out how to extract it.

Installation

npm install @pluckr/core

You also need an AI SDK provider:

npm install @ai-sdk/anthropic   # or @ai-sdk/openai, @ai-sdk/google

Quick Start

import { Pluckr } from '@pluckr/core'
import { anthropic } from '@ai-sdk/anthropic'
import { z } from 'zod'

const pluckr = new Pluckr({
  model: anthropic('claude-haiku-4-5-20251001'),
})

const result = await pluckr.extract({
  html: '<html>...</html>',
  schema: z.object({
    title: z.string(),
    price: z.coerce.number().positive(),
    inStock: z.coerce.boolean(),
  }),
  cacheKey: 'my-product-page',
})

if (result.success) {
  console.log(result.data.title)  // fully typed!
}

await pluckr.close()

How it works

  1. You provide HTML and a Zod schema describing the data you want
  2. An LLM generates CSS selectors for each schema field
  3. Selectors are tested and verified via an agentic tool loop
  4. Zod validates and coerces the extracted data
  5. Working selectors are cached — subsequent extractions are instant (no LLM calls)
  6. If the page changes and selectors break, Pluckr asks the LLM to fix them

Bring your own model

Pluckr accepts any Vercel AI SDK compatible model:

import { anthropic } from '@ai-sdk/anthropic'
import { openai } from '@ai-sdk/openai'
import { google } from '@ai-sdk/google'

new Pluckr({ model: anthropic('claude-haiku-4-5-20251001') })
new Pluckr({ model: openai('gpt-4o-mini') })
new Pluckr({ model: google('gemini-2.0-flash') })

Use z.coerce for non-string fields

CSS selectors extract text from HTML, so all raw values are strings. Use z.coerce.number(), z.coerce.boolean(), etc. so Zod converts "29.99" to 29.99 and "true" to true.

Caching

By default, Pluckr uses in-memory storage. For persistent caching, use @pluckr/sqlite:

import { SqliteStorage } from '@pluckr/sqlite'

const pluckr = new Pluckr({
  model: anthropic('claude-haiku-4-5-20251001'),
  storage: new SqliteStorage(),  // defaults to .pluckr/cache.db
})

You can also implement the Storage interface for any backend (Redis, Postgres, etc.).

Error Handling

extract() returns a discriminated union — no exceptions:

const result = await pluckr.extract({ html, schema, cacheKey: 'my-page' })

if (result.success) {
  console.log(result.data)
} else {
  // result.error.code: 'NO_DATA' | 'EXTRACTION_FAILED' | 'PERMANENT_FAILURE'
  console.error(result.error.message)
}

API

new Pluckr(config)

| Option | Type | Default | Description | |--------|------|---------|-------------| | model | LanguageModel | required | Any Vercel AI SDK model | | storage | Storage | MemoryStorage | Cache backend | | debug | boolean | false | Log extraction steps | | maxToolCallsPerField | number | 3 | Max LLM tool calls per schema field |

pluckr.extract(options)

| Option | Type | Description | |--------|------|-------------| | html | string | Raw HTML to extract from | | schema | ZodObject | Zod schema describing desired data | | cacheKey | string? | Optional key for selector caching |

Returns ExtractResult<T>: { success: true, data: T } or { success: false, error: ExtractError }.

License

MIT