Getting Started
Relevant source files
The following files were used as context for generating this wiki page:
Regxa is a universal, PURL-native package registry client designed to normalize package metadata across multiple ecosystems, including npm, PyPI, crates.io, RubyGems, Packagist, and Arch Linux. It provides both a TypeScript library for programmatic access and a CLI for terminal-based queries, ensuring that developers receive a consistent data model regardless of the underlying registry.
The project is built as an ESM-only TypeScript library using the Package URL (PURL) specification for addressing. It features storage-backed caching, exponential backoff with jitter for network requests, and a specialized integration for AI applications via the Vercel AI SDK.
Sources: README.md:1-26, AGENTS.md:3-5
Development Environment Setup
To begin working with the regxa codebase, you must ensure your environment meets the minimum requirements and use the standardized task runner commands.
Prerequisites
- Node.js: Version
>=22.6.0is required for modern syntax support. - Package Manager:
pnpmis used for dependency management.
Sources: package.json:115-118, AGENTS.md:112-113
Installation and Build Commands
The following commands are used to prepare the development environment and build the project:
| Command | Description |
|---|---|
pnpm install | Installs all project dependencies. |
pnpm dev:prepare | Performs a stub build for development using obuild. |
pnpm build | Compiles the production build into the dist/ directory. |
pnpm typecheck | Runs tsc --noEmit to verify type safety. |
pnpm lint | Checks code style using oxlint and oxfmt. |
pnpm fmt | Automatically fixes linting issues and formats code. |
Sources: AGENTS.md:7-14, package.json:67-73
Library Usage
The library provides high-level helpers and a lower-level registry factory for interacting with package data.
High-Level PURL Helpers
The simplest way to integrate regxa is through the "one-shot" PURL helpers exported from src/helpers.ts. These functions handle registry instantiation and PURL parsing internally.
import {
fetchPackageFromPURL,
fetchVersionsFromPURL
} from "regxa";
// Fetch normalized metadata
const pkg = await fetchPackageFromPURL("pkg:npm/lodash");
// Fetch all versions
const versions = await fetchVersionsFromPURL("pkg:cargo/serde");
Sources: skills/regxa/SKILL.md:76-100, src/helpers.ts:7-27
Core Data Flow
The following diagram illustrates how a PURL request flows through the internal architecture:
The internal architecture separates ecosystem-specific logic (Adapters) from shared HTTP and retry logic (Core Client).
Sources: src/core/AGENTS.md:6-23, src/AGENTS.md:21-27
CLI Usage
The regxa CLI allows for quick metadata retrieval without writing code. The pkg: prefix is optional when using the CLI.
Common CLI Commands
| Action | CLI Command Example |
|---|---|
| View Package Info | regxa info npm/lodash |
| List Versions | regxa versions cargo/serde |
| View Dependencies | regxa deps pypi/flask@3.1.1 |
| List Maintainers | regxa maintainers gem/rails |
| Clear Cache | regxa cache clear |
Sources: README.md:144-153, skills/regxa/SKILL.md:46-64
Project Structure
Developers contributing to the project should adhere to the established module boundaries:
Module Guidelines:
src/core/: Defines types, the PURL parser, and the HTTP client. No ecosystem-specific assumptions are allowed here.src/registries/: Contains adapters (npm, pypi, etc.) that map upstream responses to the core data model.src/cache/: An optional decorator that provides storage-backed persistence for registry calls.
Sources: AGENTS.md:23-38, src/AGENTS.md:7-17, src/core/AGENTS.md:7-23
Summary
Regxa provides a standardized gateway to package registry data. By utilizing PURL addressing and a unified data model, it simplifies cross-ecosystem metadata consumption for both human users (CLI) and automated systems (Library/AI Tooling).
Sources: README.md:11-20, skills/regxa/SKILL.md:7-12