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

zugar

v1.0.1

Published

Zugar is a library for building pipelines for AI-powered applications.

Readme

Zugar

Zugar is a TypeScript library for building AI-powered pipelines with a DSPy-inspired API. Define your data with Zod schemas, and Zugar handles prompt generation, LLM calls, and structured output — all with full type safety.

Features

  • Zod v4 .meta() descriptions — your schema is the program. No more duplicating field descriptions in prompt strings.
  • Two modes — extraction (raw input → structured output) and transformation (structured input → structured output).
  • Multimodal support — text, image, and multimodal inputs out of the box.
  • Full type safety — input and output types are inferred from your Zod schemas.
  • Zero config prompts — Zugar builds the user prompt from your schema's .meta() descriptions automatically.

Installation

npm install zugar
# or
bun add zugar

Input Kinds

| inputKind | Use case | Input shape | |---|---|---| | "text" | Extract from text | { text: string } | | "image" | Extract from base64 image | { image: string } | | "multimodal" | Combine text + image | { text?: string; image?: string } | | "schema" | Transform structured data | { data: T } |

All modes accept an optional context: string for cross-module continuity.

Quick Start

Extraction Mode

Turn unstructured input into structured data:

import { zugar, z } from "zugar";
import { createOpenAI } from "@ai-sdk/openai";

const PhotoSchema = z.object({
  subject: z.string().meta({ description: "The main subject" }),
  style: z.string().meta({ description: "The art style" }),
  tone: z.string().meta({ description: "The mood or tone" }),
});

const PhotoReader = zugar({
  description: "Analyze a photograph and extract structured metadata.",
  schema: PhotoSchema,
  model: createOpenAI({ apiKey: process.env.OPENAI_API_KEY })("gpt-4o"),
  inputKind: "image",
});

const result = await PhotoReader({ image: base64Image });
// result is fully typed as { subject: string; style: string; tone: string }

Transformation Mode

Chain modules — feed the output of one into the next:

const PromptSchema = z.object({
  prompt: z.string().meta({ description: "The generated image prompt" }),
});

const PromptWriter = zugar({
  description: "Generate an image generation prompt from photo analysis.",
  inputSchema: PhotoSchema,
  schema: PromptSchema,
  model: createOpenAI({ apiKey: process.env.OPENAI_API_KEY })("gpt-4o"),
  inputKind: "schema",
});

// Pipeline: extract → transform
const analysis = await PhotoReader({ image: base64Image });
const { prompt } = await PromptWriter({ data: analysis });

Re-exports

zugar re-exports z (Zod) and Output (AI SDK) for convenience — no need to install them separately just for the types.

License

MIT