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

@pr-pm/converters

v2.1.38

Published

Format converters for AI prompts - shared between CLI and registry

Readme

@pr-pm/converters

Format converters for AI prompts - converts between different AI IDE formats and PRPM's canonical format.

Overview

This package provides:

  • Format Converters - Convert between Cursor, Claude Code, Continue, Windsurf, Copilot, Kiro, agents.md, and canonical formats
  • JSON Schemas - Validate package structure for each format
  • Validation System - Ensure packages match format specifications
  • Documentation - Comprehensive specs for all supported formats

Installation

npm install @pr-pm/converters

Usage

Converting Formats

import { fromCursor, toClaude } from '@pr-pm/converters';

// Parse Cursor .cursor/rules to canonical format
const cursorContent = `---
description: React component standards
globs: ["src/**/*.tsx"]
---

# React Standards

Use functional components with hooks.
`;

const canonical = fromCursor(cursorContent, 'react-standards');

// Convert canonical to Claude format
const claudeResult = toClaude(canonical);
console.log(claudeResult.content);

Validating Packages

import { validateMarkdown, formatValidationErrors } from '@pr-pm/converters';

const result = validateMarkdown('cursor', fileContent);

if (!result.valid) {
  console.error(formatValidationErrors(result));
  // Output:
  // Validation Errors:
  //   - /frontmatter/description: must have required property 'description'
}

Supported Conversions

All formats can convert to/from the canonical format:

Cursor ←→ Canonical ←→ Claude
Continue ←→ Canonical ←→ Windsurf
Copilot ←→ Canonical ←→ Kiro
agents.md ←→ Canonical

Available Converters

From Converters (Format → Canonical)

import {
  fromCursor,
  fromClaude,
  fromContinue,
  fromWindsurf,
  fromCopilot,
  fromKiro,
  fromAgentsMd,
} from '@pr-pm/converters';

To Converters (Canonical → Format)

import {
  toCursor,
  toClaude,
  toContinue,
  toWindsurf,
  toCopilot,
  toKiro,
  toAgentsMd,
} from '@pr-pm/converters';

Validation

Functions

// Validate markdown file with frontmatter
validateMarkdown(format: FormatType, markdown: string): ValidationResult

// Validate structured data
validateFormat(format: FormatType, data: unknown): ValidationResult

// Validate conversion output
validateConversion(
  format: FormatType,
  frontmatter: Record<string, unknown>,
  content: string
): ValidationResult

// Format errors for display
formatValidationErrors(result: ValidationResult): string

Format Types

type FormatType =
  | 'cursor'
  | 'claude'
  | 'continue'
  | 'windsurf'
  | 'copilot'
  | 'kiro'
  | 'agents-md'
  | 'canonical';

Validation Result

interface ValidationResult {
  valid: boolean;
  errors: ValidationError[];    // Blocking issues
  warnings: ValidationError[];  // Non-blocking suggestions
}

interface ValidationError {
  path: string;      // JSON path to the error
  message: string;   // Human-readable error message
  value?: unknown;   // The invalid value
}

Documentation

Format Specifications

Detailed documentation for each format is available in docs/:

See docs/README.md for complete format comparison.

JSON Schemas

All schemas are available in schemas/:

  • Base format schemas (cursor, claude, continue, etc.)
  • Claude subtypes (skills, agents, commands, hooks)
  • Kiro types (steering, hooks)
  • Canonical format schema

See schemas/README.md for schema documentation.

Examples

Round-trip Conversion

import { fromCursor, toClaude, fromClaude, toCursor } from '@pr-pm/converters';

// Start with Cursor format
const original = `---
description: Testing standards
---
# Tests
Write tests first.`;

// Convert: Cursor → Canonical → Claude → Canonical → Cursor
const canonical1 = fromCursor(original, 'testing-standards');
const claude = toClaude(canonical1);
const canonical2 = fromClaude(claude.content, 'testing-standards');
const cursor = toCursor(canonical2);

// cursor.content should match original (lossless conversion)

Quality Scoring

Converters return quality scores to indicate conversion fidelity:

const result = toCursor(canonical);

console.log(result.qualityScore); // 0-100
console.log(result.lossyConversion); // true if information was lost
console.log(result.warnings); // Array of conversion warnings

Validation in Publish Flow

import { validateMarkdown } from '@pr-pm/converters';
import { readFile } from 'fs/promises';

async function validatePackage(filePath: string, format: string) {
  const content = await readFile(filePath, 'utf-8');
  const result = validateMarkdown(format, content);

  if (!result.valid) {
    throw new Error(`Invalid ${format} format:\n${formatValidationErrors(result)}`);
  }

  if (result.warnings.length > 0) {
    console.warn(`Warnings:\n${formatValidationErrors(result)}`);
  }
}

TypeScript

Full TypeScript support with type definitions:

import type {
  CanonicalPackage,
  ConversionResult,
  ValidationResult,
  FormatType,
} from '@pr-pm/converters';

Development

Building

pnpm build

Testing

pnpm test              # Run all tests
pnpm test:watch       # Watch mode
pnpm test:coverage    # With coverage

Project Structure

src/
  from-*.ts           # Format → Canonical converters
  to-*.ts             # Canonical → Format converters
  validation.ts       # Validation system
  types/
    canonical.ts      # TypeScript types
  __tests__/
    from-*.test.ts    # Parser tests
    to-*.test.ts      # Generator tests
    validation.test.ts # Schema validation tests
    roundtrip.test.ts  # Round-trip conversion tests
    cross-format.test.ts # Cross-format conversion tests
docs/
  *.md               # Format specifications
  README.md          # Documentation index
schemas/
  *.schema.json      # JSON Schema definitions
  README.md          # Schema documentation

Contributing

See CONTRIBUTING.md for guidelines.

When adding support for a new format:

  1. Create format specification in docs/<format>.md
  2. Create JSON schema in schemas/<format>.schema.json
  3. Implement parser in src/from-<format>.ts
  4. Implement generator in src/to-<format>.ts
  5. Add comprehensive tests
  6. Update documentation and READMEs

License

MIT - See LICENSE for details.