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

@designforge/ai

v1.0.0

Published

[![npm](https://img.shields.io/npm/v/@designforge/ai?color=6d28d9)](https://www.npmjs.com/package/@designforge/ai) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](../../LICENSE)

Readme

@designforge/ai

npm License: MIT

Server-side AI utilities that power the DesignForge component generator. Provides the prompt assembly, response parsing, and validation pipeline used by the /api/generate and /api/validate Edge/Node.js routes.

Server-only. This package contains no client-side code. Do not import it in browser bundles or React Server Components that run on the client.

Installation

npm install @designforge/ai

No peer dependencies. Designed for use in Node.js 20+ and Vercel Edge runtime environments.

API

PromptBuilder

Assembles the structured system prompt sent to the LLM on every generation request. The prompt is split into 5 versioned sections (~1,800 tokens total): role definition, design token reference, component API conventions, accessibility requirements, and output format.

import { PromptBuilder } from '@designforge/ai'

const pb = new PromptBuilder()

// In your API route:
const systemPrompt = pb.build()  // → full prompt string
const version = pb.getVersion()  // → e.g. "1.0.0" (for logging)

| Method | Returns | Description | |---|---|---| | build() | string | Assembled system prompt | | getVersion() | string | Prompt version string (for logging / cache-busting) |


ResponseParser

Parses raw LLM output from the streaming generation response. Extracts the code block, validates completeness, infers the component name, and checks for disallowed imports.

import { ResponseParser } from '@designforge/ai'

const parser = new ResponseParser()

const code = parser.extractCode(rawLLMText)         // string | null
const ready = parser.isComplete(code)               // boolean
const name  = parser.getComponentName(code)         // "SearchBar" | "GeneratedComponent"
const bad   = parser.findDisallowedImports(code)    // string[] (empty = clean)

| Method | Signature | Description | |---|---|---| | extractCode | (raw: string) => string \| null | Extracts the first ```tsx block | | isComplete | (code: string) => boolean | Returns true if code has a default export | | getComponentName | (code: string) => string | Infers name from export default function | | findDisallowedImports | (code: string) => string[] | Lists imports outside the allowed DesignForge packages |


ValidationPipeline

Aggregates results from the 3-step validation pipeline (TypeScript → ESLint → axe-core) into a single structured result. Stateless — callers pass in step results and receive a summary.

import { ValidationPipeline, type ValidationStepResult } from '@designforge/ai'

const pipeline = new ValidationPipeline()

const steps: ValidationStepResult[] = [
  { step: 'typescript', passed: true,  errors: [], warnings: [] },
  { step: 'eslint',     passed: false, errors: ['no-unused-vars'], warnings: [] },
  { step: 'axe',        passed: true,  errors: [], warnings: [] },
]

const result = pipeline.aggregate(steps)
// result.passed  → false
// result.summary → "ESLint issues found — TypeScript ✓  ESLint ✗  Accessibility ✓"

Types:

interface ValidationStepResult {
  step:     'typescript' | 'eslint' | 'axe'
  passed:   boolean
  errors:   string[]
  warnings: string[]
}

interface ValidationResult {
  steps:   ValidationStepResult[]
  passed:  boolean   // true only if ALL steps passed
  summary: string    // human-readable summary for the UI badge
}

SYSTEM_PROMPT_VERSION

Exported constant — the current system prompt version string. Used for logging, cache-busting, and debugging prompt drift.

import { SYSTEM_PROMPT_VERSION } from '@designforge/ai'

console.log(SYSTEM_PROMPT_VERSION) // e.g. "1.0.0"

Architecture Note

The validation pipeline runs across three separate environments:

| Step | Where | Latency | |---|---|---| | TypeScript | Monaco language service (client) | Instant | | ESLint | /api/validate Node.js route | ~1–2 s | | axe-core | Sandboxed iframe postMessage | ~200–500 ms |

ValidationPipeline.aggregate() is called on the client to combine results received from all three sources.

License

MIT © 2026 Mayank — see LICENSE