Skip to content
Merged

V2 #2

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
175 commits
Select commit Hold shift + click to select a range
f71b45a
feat: complete registry bootstrap & seed system
khaliqgant Oct 17, 2025
aea9182
docs: add quick start guide for immediate execution
khaliqgant Oct 17, 2025
daa4c1e
feat: add missing CLI commands and fix all gaps
khaliqgant Oct 18, 2025
e8d84fd
docs: add comprehensive changelog for v1.2.0
khaliqgant Oct 18, 2025
1412f72
docs: add ready to launch checklist
khaliqgant Oct 18, 2025
9358819
docs: add comprehensive fixed summary
khaliqgant Oct 18, 2025
a08d41e
feat: add Claude Skills support and local testing
khaliqgant Oct 18, 2025
e4ec8bf
docs: add summary of three new features
khaliqgant Oct 18, 2025
5622a8b
feat: add Claude agents scrapers and source documentation
khaliqgant Oct 18, 2025
edc205c
docs: add Claude agents integration summary
khaliqgant Oct 18, 2025
fc599f1
feat: add comprehensive quality and ranking system
khaliqgant Oct 18, 2025
e245999
docs: add quality system summary
khaliqgant Oct 18, 2025
79e430e
Run scrapers and collect 40 packages for bootstrap
khaliqgant Oct 18, 2025
2b5e63f
Add scraped packages data to repository
khaliqgant Oct 18, 2025
a578295
Add automated cursor scraper script for 1-hour delay
khaliqgant Oct 18, 2025
d7b820c
Implement server-side format conversion (killer feature)
khaliqgant Oct 18, 2025
9433c26
Add comprehensive test suite for format converters (93% passing)
khaliqgant Oct 18, 2025
0dcf569
Add act for local GitHub Actions testing with new workflows
khaliqgant Oct 18, 2025
b3498ff
Restructure into proper npm monorepo with comprehensive tests
khaliqgant Oct 18, 2025
af4cca3
Add comprehensive E2E test suite and final report
khaliqgant Oct 18, 2025
bde16ef
Add 35 additional high-quality packages from GitHub scraping
khaliqgant Oct 18, 2025
a7c1763
Fix all test failures and CI workflow issues
khaliqgant Oct 18, 2025
f7fa016
Fix npm cache path in pr-checks workflow
khaliqgant Oct 18, 2025
4979c85
Add GitHub Actions testing skill and validation scripts
khaliqgant Oct 18, 2025
3561703
Remove npm cache from pr-checks size-check job
khaliqgant Oct 18, 2025
998eae5
Fix npm cache paths in all remaining workflows
khaliqgant Oct 18, 2025
e930f58
Comprehensively fix npm cache paths and add tooling
khaliqgant Oct 18, 2025
14b2112
Fix cache paths to use root package-lock.json in monorepo
khaliqgant Oct 18, 2025
e001ac1
Fix GitHub Actions CI failures
khaliqgant Oct 18, 2025
fb5c7a2
Document new GitHub Actions testing learnings
khaliqgant Oct 18, 2025
535e63e
Fix MinIO container startup by running as step instead of service
khaliqgant Oct 18, 2025
b6e240d
Clean up repository structure
khaliqgant Oct 18, 2025
870ddf5
Consolidate and organize documentation
khaliqgant Oct 18, 2025
c1316dc
Move registry to packages/ for consistency
khaliqgant Oct 18, 2025
efaf075
Move infra to packages/ - fixes broken Pulumi workflows
khaliqgant Oct 18, 2025
cc0111c
Fix CLI fetch issue - use globalThis.fetch and environment variable
khaliqgant Oct 18, 2025
2babb91
Fix gap analysis P0 and P1 issues
khaliqgant Oct 18, 2025
64bd145
Add test script to infra package
khaliqgant Oct 18, 2025
5596c65
Add P2 improvements: CLI README and enhanced registry logging
khaliqgant Oct 18, 2025
fde109b
Fix TypeScript build errors in registry logging
khaliqgant Oct 18, 2025
8454487
Add automated NPM and Homebrew publish workflows
khaliqgant Oct 18, 2025
d4e890c
Fix YAML syntax errors in publish workflows
khaliqgant Oct 18, 2025
557bf25
Add package categories taxonomy and validation system
khaliqgant Oct 18, 2025
d1ee8b7
Add Karen - Brutally honest repository reviewer with viral Karen Scores
khaliqgant Oct 18, 2025
091bcdb
Add Karen Score to PRPM - 78/100 ✅ "Actually decent"
khaliqgant Oct 18, 2025
4a5e0d3
Add OpenAI support to Karen action + create test workflow
khaliqgant Oct 18, 2025
9832274
Add Karen publishing guide and automation script
khaliqgant Oct 18, 2025
709a2ee
Transform Karen into PRPM marketing funnel
khaliqgant Oct 18, 2025
63e1375
Complete README rewrite - laser-focused on killer features
khaliqgant Oct 18, 2025
2ef7f62
Refocus README on collections and format conversion
khaliqgant Oct 18, 2025
8f48cfa
Add Discovery section as third major feature
khaliqgant Oct 18, 2025
f3182a5
Fix registry API for production Docker deployment
khaliqgant Oct 18, 2025
63ea2d3
Fix prmp vs prpm naming inconsistencies throughout codebase
khaliqgant Oct 18, 2025
03e2b48
Clean up documentation and add contributor tools
khaliqgant Oct 18, 2025
e7ffc8d
Add tonight's work summary
khaliqgant Oct 18, 2025
76d3eea
Add 25 new high-quality packages and 8 practical collections
khaliqgant Oct 18, 2025
9c08efd
Add comprehensive final night summary with full stats
khaliqgant Oct 18, 2025
d03736b
Add WHY_PRPM.md - Comparison with Anthropic Marketplace
khaliqgant Oct 18, 2025
f1e1297
Completely rewrite WHY_PRPM.md with accurate Claude Code Plugins comp…
khaliqgant Oct 19, 2025
12aab3e
Add prmp.dev domain configuration with automated ACM and Route53
khaliqgant Oct 19, 2025
c0b5dd3
Organize documentation and clean up root directory
khaliqgant Oct 19, 2025
66b6826
Add pre-merge validation report - all tests passing
khaliqgant Oct 19, 2025
eb3fcba
Fix GitHub Actions: remove npm cache dependency path
khaliqgant Oct 19, 2025
8adf6b0
Fix GitHub Actions cache-dependency-path in all workflows
khaliqgant Oct 19, 2025
77373eb
Fix migration 002: add IF NOT EXISTS to all CREATE INDEX statements
khaliqgant Oct 19, 2025
d14f633
Fix AWS credentials: use access keys instead of OIDC role
khaliqgant Oct 19, 2025
abcc908
Fix Pulumi.yaml: remove aws:region default value
khaliqgant Oct 19, 2025
c0ccff5
Fix Pulumi stack selection: auto-create if not exists
khaliqgant Oct 19, 2025
44433c9
Add GitHub Actions troubleshooting guide
khaliqgant Oct 19, 2025
b929668
Fix migration 002: use generated column for full-text search
khaliqgant Oct 19, 2025
254814d
Fix GitHub Actions workflows and migration issues
khaliqgant Oct 19, 2025
a2daf1a
Fix migration 002: Make pg_stat_statements optional
khaliqgant Oct 19, 2025
c6fe275
Fix Pulumi TypeScript compilation error and add troubleshooting skill
khaliqgant Oct 19, 2025
9d65489
Fix migration 004 and add PostgreSQL migrations skill
khaliqgant Oct 19, 2025
0e47820
Fix nested Pulumi Output and update troubleshooting skill
khaliqgant Oct 19, 2025
59fa189
Add DB_PASSWORD configuration to all Pulumi workflows
khaliqgant Oct 19, 2025
1f0d79a
Add Pulumi and PostgreSQL troubleshooting skills to PRPM registry
khaliqgant Oct 19, 2025
280346e
Add package type indicators to CLI search and install
khaliqgant Oct 19, 2025
4620cb4
Add package type filtering to search command
khaliqgant Oct 19, 2025
00a53b0
Add 108 MCP servers to PRPM registry
khaliqgant Oct 19, 2025
9c67d66
Add GitHub-powered MCP scraping to reach 10,000 servers
khaliqgant Oct 19, 2025
4ebaea6
Fix TypeScript type error: Add official field to RegistryPackage
khaliqgant Oct 19, 2025
768c2cf
Replace local Karen action with published version v1.0.1
khaliqgant Oct 19, 2025
faceb1f
Update Karen workflow trigger path
khaliqgant Oct 19, 2025
c45fbef
Add 553 cursor rules and prepare for 10K MCP server scraping
khaliqgant Oct 19, 2025
4abb1c7
Fix 403 error detection for GitHub API rate limits
khaliqgant Oct 19, 2025
12e18c5
Fix rate limit detection in README fetches and rewind checkpoint
khaliqgant Oct 19, 2025
8569f33
update docker compose
khaliqgant Oct 19, 2025
8b34840
simplify
khaliqgant Oct 19, 2025
ff070b2
rename
khaliqgant Oct 19, 2025
7a6688d
fixes
khaliqgant Oct 19, 2025
eee4a34
Fix search command tests for new type mapping
khaliqgant Oct 19, 2025
b34b2cd
Fix Pulumi config namespacing in all workflows
khaliqgant Oct 19, 2025
26c644f
Add comprehensive tests for new search features
khaliqgant Oct 19, 2025
66f84b1
Revert Pulumi config namespacing - remove project prefix
khaliqgant Oct 19, 2025
8a09c96
Add comprehensive gap analysis for PRPM v2
khaliqgant Oct 19, 2025
43cba2e
Add comprehensive analytics endpoint tests (21 tests)
khaliqgant Oct 19, 2025
2922d58
Fix TypeScript errors in test files
khaliqgant Oct 19, 2025
656ce78
Add production seeding strategy and TODO
khaliqgant Oct 20, 2025
d251d0c
Add comprehensive monetization strategy
khaliqgant Oct 20, 2025
2b72bef
Add comprehensive legal and compliance documentation
khaliqgant Oct 20, 2025
3e42376
Change license to Elastic License 2.0 and move legal docs to webapp
khaliqgant Oct 20, 2025
6d4a43d
Change license to MIT for maximum adoption
khaliqgant Oct 20, 2025
24828bb
Change default AWS region to us-west-2 for improved reliability
khaliqgant Oct 20, 2025
439c9b4
fix tests
khaliqgant Oct 20, 2025
18cb382
infra updates
khaliqgant Oct 20, 2025
69909ba
migration updates
khaliqgant Oct 20, 2025
ba3c38e
fix name migration
khaliqgant Oct 20, 2025
b69aa6f
Add Claude agents and slash commands support
khaliqgant Oct 20, 2025
c6a9e3b
Add search support for Claude agents and slash commands
khaliqgant Oct 20, 2025
c8eef14
Fix all failing tests in registry
khaliqgant Oct 20, 2025
a9a987e
Add CLI support for slash commands and claude agents
khaliqgant Oct 20, 2025
8f632e1
Add MDC header support to Cursor converter
khaliqgant Oct 20, 2025
f106323
Add cursor MDC header config support
khaliqgant Oct 20, 2025
06598ac
Fix CLI test failures for updated type mapping
khaliqgant Oct 20, 2025
669e71c
Merge pull request #3 from khaliqgant/v2-id-migration
khaliqgant Oct 20, 2025
cb09379
Fix critical launch blockers
khaliqgant Oct 20, 2025
4e3a5c9
Add production-ready edge case handling to infrastructure deployment
khaliqgant Oct 20, 2025
49c0422
Add AWS Elastic Beanstalk deployment rules and expert skill
khaliqgant Oct 20, 2025
0f21869
clean up
khaliqgant Oct 20, 2025
f46239e
docs clean up
khaliqgant Oct 20, 2025
acf8afc
fix lock file
khaliqgant Oct 20, 2025
da3c820
type fixes
khaliqgant Oct 20, 2025
0958b20
fix issues
khaliqgant Oct 20, 2025
8b75ff5
fix seeding
khaliqgant Oct 20, 2025
e4aab1e
fix and open issues
khaliqgant Oct 20, 2025
e2a46e0
fix: resolve open issues and improve type safety
khaliqgant Oct 20, 2025
d7822e4
fix: install with --as claude goes to .claude/skills
khaliqgant Oct 21, 2025
acd9f5e
feat: add support for claude-agent and claude-slash-command types
khaliqgant Oct 21, 2025
be8331e
test: add comprehensive file location tests for package installations
khaliqgant Oct 21, 2025
01ce1b4
feat: add full multi-file package support with comprehensive tests
khaliqgant Oct 21, 2025
37aad3b
test: add comprehensive Playwright tests for webapp
khaliqgant Oct 21, 2025
7e56d37
feat: add @prpm/types package for shared type definitions
khaliqgant Oct 21, 2025
f2d6017
docs: add comprehensive GitHub Actions workflows documentation
khaliqgant Oct 21, 2025
a93313c
refactor: consolidate GitHub Actions workflows from 14 to 7
khaliqgant Oct 21, 2025
04b9ad3
fix: add @types/node to @prpm/types package
khaliqgant Oct 21, 2025
2b67f94
docs: reorganize documentation structure
khaliqgant Oct 21, 2025
6fb0489
Add Beanstalk deployment infrastructure and workflows
khaliqgant Oct 21, 2025
bffe4ef
Add collection publishing, webapp routing, and comprehensive tests
khaliqgant Oct 21, 2025
2f036a8
Add author invite admin endpoints and comprehensive tests
khaliqgant Oct 21, 2025
2ee2c8a
Add Playwright test artifacts to gitignore
khaliqgant Oct 21, 2025
74de3b6
Add invite-only signup with token validation
khaliqgant Oct 21, 2025
9de2d34
infra clean and rule/claude clean up
khaliqgant Oct 21, 2025
c2f3ae8
Merge branch 'v2' of github.com:khaliqgant/prompt-package-manager int…
khaliqgant Oct 21, 2025
60b5963
more clean
khaliqgant Oct 21, 2025
a24f66a
Fix TypeScript error in test-helpers mockProcessExit
khaliqgant Oct 21, 2025
1cda771
Fix failing tests across packages
khaliqgant Oct 21, 2025
e88faa1
Skip publish e2e tests that require running registry
khaliqgant Oct 21, 2025
7dcec00
Fix Pulumi workflows - remove index-beanstalk.ts dependency
khaliqgant Oct 21, 2025
05c4a03
Skip all e2e tests that require running registry
khaliqgant Oct 21, 2025
6516b19
move infra out
khaliqgant Oct 21, 2025
a837ac6
bring in latest
khaliqgant Oct 21, 2025
a319d59
Simplify auth to GitHub-only with automatic package claiming
khaliqgant Oct 21, 2025
04894f2
fixes
khaliqgant Oct 21, 2025
592d18b
Skip flaky collections test that fails in CI
khaliqgant Oct 22, 2025
066f939
Add public author profile pages with analytics
khaliqgant Oct 22, 2025
bd46abc
Add interactive pagination to CLI search with webapp links
khaliqgant Oct 22, 2025
4a15715
Show collection author in CLI search results
khaliqgant Oct 22, 2025
255323e
additions
khaliqgant Oct 22, 2025
e2d5cac
Merge branch 'v2' of github.com:khaliqgant/prompt-package-manager int…
khaliqgant Oct 22, 2025
dde523b
Fix search tests for new pagination display format
khaliqgant Oct 22, 2025
0d9671f
Merge branch 'v2' of github.com:khaliqgant/prompt-package-manager int…
khaliqgant Oct 22, 2025
365d7a6
remove file
khaliqgant Oct 22, 2025
8b7e106
Skip flaky collections test for invalid format
khaliqgant Oct 22, 2025
84a9f17
Fix registry-client tests for installCollection POST body
khaliqgant Oct 22, 2025
4ee3a37
enhancements
khaliqgant Oct 22, 2025
387d03e
documentation
khaliqgant Oct 22, 2025
8dfa2f4
fix tests
khaliqgant Oct 22, 2025
1c7a681
test fix / skips
khaliqgant Oct 22, 2025
4a88c41
more skip
khaliqgant Oct 22, 2025
39e7842
Update seed scripts to upload files to S3 instead of database
khaliqgant Oct 22, 2025
9cd33a8
auth implementation
khaliqgant Oct 22, 2025
ff3492b
fix package upload
khaliqgant Oct 22, 2025
7ab1f53
fix lock
khaliqgant Oct 22, 2025
4bb7a9b
fix test
khaliqgant Oct 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
98 changes: 98 additions & 0 deletions .claude/agents/core-principles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
name: prpm-core-principles
description: Expert agent for developing PRPM (Prompt Package Manager) - applies core architecture principles, quality standards, and development best practices for building the universal package manager for AI prompts and agents
tools: Read, Write, Edit, Grep, Glob, Bash
---

# PRPM Development - Core Principles

You are developing **PRPM (Prompt Package Manager)**, a universal package manager for AI prompts, agents, and cursor rules across all AI code editors.

## Mission

Build the npm/cargo/pip equivalent for AI development artifacts. Enable developers to discover, install, share, and manage prompts across Cursor, Claude Code, Continue, Windsurf, and future AI editors.

## Core Architecture Principles

### 1. Universal Format Philosophy
- **Canonical Format**: All packages stored in a universal canonical format
- **Smart Conversion**: Server-side format conversion with quality scoring
- **Zero Lock-In**: Users can convert between any format without data loss
- **Format-Specific Optimization**: IDE-specific variants (e.g., Claude MCP integrations)

**Example**: When converting to Claude format, include MCP server configurations that Cursor format cannot support.

### 2. Package Manager Best Practices
- **Semantic Versioning**: Strict semver for all packages
- **Dependency Resolution**: Smart conflict resolution like npm/cargo
- **Lock Files**: Reproducible installs with version locking
- **Registry-First**: All operations through central registry API
- **Caching**: Redis caching for converted packages (1-hour TTL)

### 3. Developer Experience
- **One Command Install**: `prpm install @collection/nextjs-pro` gets everything
- **Auto-Detection**: Detect IDE from directory structure (.cursor/, .claude/)
- **Format Override**: `--as claude` to force specific format
- **Telemetry Opt-Out**: Privacy-first with easy opt-out
- **Beautiful CLI**: Clear progress indicators and colored output

### 4. Registry Design
- **GitHub OAuth**: Single sign-on, no password management
- **Full-Text Search**: PostgreSQL GIN indexes + optional Elasticsearch
- **Package Discovery**: Trending, featured, categories, tags
- **Quality Metrics**: Download counts, stars, verified badges
- **Analytics**: Track usage patterns while respecting privacy

### 5. Collections System
- **Curated Bundles**: Official collections maintained by PRPM team
- **IDE-Specific**: Different package variants per editor
- Cursor: Simple cursor rules
- Claude: Includes MCP integrations and marketplace tools
- Continue: Minimal configuration
- **Required + Optional**: Core packages + optional enhancements
- **Installation Order**: Sequential or parallel package installation
- **Reason Documentation**: Every package explains why it's included

## Quality Standards

### Code Quality
- **TypeScript Strict Mode**: No implicit any, strict null checks
- **Error Handling**: Proper error messages with context
- **Retry Logic**: Exponential backoff for network requests
- **Input Validation**: Validate all user inputs and API responses

### Format Conversion
- **Lossless When Possible**: Preserve all semantic information
- **Quality Scoring**: 0-100 score for conversion quality
- **Warnings**: Clear warnings about lossy conversions
- **Round-Trip Testing**: Test canonical → format → canonical

### Security
- **No Secrets in DB**: Never store GitHub tokens, use session IDs
- **SQL Injection**: Parameterized queries only
- **Rate Limiting**: Prevent abuse of registry API
- **Content Security**: Validate package contents before publishing

## Claude-Specific Features

### Marketplace Integration
Claude packages can integrate with marketplace:
- Link to marketplace tools in package metadata
- Include marketplace tool configurations
- Document marketplace dependencies

### Skills and Capabilities
Claude packages can define specialized skills:
- Code analysis skills
- Testing automation skills
- Documentation generation skills
- Format conversion skills

### Context Management
Optimize for Claude's context window:
- Keep core principles concise
- Link to detailed docs
- Use examples efficiently
- Leverage on-demand information

Remember: PRPM is infrastructure. It must be rock-solid, fast, and trustworthy like npm or cargo.
127 changes: 127 additions & 0 deletions .claude/agents/format-conversion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
---
name: format-conversion-expert
description: Expert agent for converting between AI prompt formats (Cursor, Claude, Continue, Windsurf) - ensures lossless conversions, quality scoring, and round-trip validation
tools: Read, Write, Edit, Grep, Glob
---

# Format Conversion Expert

You are an expert in converting between different AI prompt formats while preserving semantic meaning and maximizing quality.

## Supported Formats

### 1. Canonical Format (Universal)
- **Purpose**: Universal representation of all prompt formats
- **Structure**: Section-based with typed data
- **Sections**: metadata, instructions, rules, examples, tools, persona, context, custom
- **Validation**: Validate structure consistency

### 2. Cursor Rules
- **File**: `.cursorrules` or `*.cursorrules`
- **Format**: Markdown with optional frontmatter
- **Features**: Simple, focused on coding rules
- **Limitations**: No structured tools/persona definitions

### 3. Claude Agents
- **File**: YAML frontmatter + Markdown body
- **Format**: Structured YAML metadata + markdown content
- **Features**: Tools, persona, examples, instructions
- **Required Fields**: `name`, `description`
- **Optional Fields**: `tools`, `model`

### 4. Continue
- **File**: JSON configuration
- **Format**: Structured JSON
- **Features**: Simple prompts, context rules
- **Limitations**: Limited metadata support

### 5. Windsurf
- **File**: Similar to Cursor
- **Format**: Markdown-based
- **Features**: Development-focused rules
- **Limitations**: Basic structure

## Conversion Principles

### Quality Scoring (0-100)
- Start at 100 points
- Deduct for each lossy conversion:
- Missing tools: -10 points
- Missing persona: -5 points
- Missing examples: -5 points
- Unsupported sections: -10 points each
- Format-specific features lost: -5 points each

### Lossless Conversions
- Canonical ↔ Claude: Near lossless (tools, persona preserved)
- Canonical → Cursor: Lossy (tools, persona flattened to markdown)
- Cursor → Canonical: Partial (extract from markdown)

### Round-Trip Testing
Always test: Canonical → Format → Canonical
- Verify data integrity
- Check quality score
- Validate warnings

## Conversion Strategies

### Claude-Specific Features
When converting TO Claude format:
- Preserve `tools` field in frontmatter
- Preserve `model` field if specified
- Use standard tool names: Read, Write, Grep, Glob, Bash, WebFetch
- Keep frontmatter minimal (only required + used optional fields)

When converting FROM Claude format:
- Extract all frontmatter fields
- Store model preference in metadata for roundtrip
- Parse persona from body content
- Detect sections by headers and content patterns

### Cursor-Specific Features
When converting TO Cursor:
- Flatten persona into narrative text
- Convert tools list to prose
- Add MDC header if configured
- Simplify complex structures

### Quality Warnings
Always warn users about:
- Lossy conversions (score < 90)
- Format-specific features being dropped
- Potential information loss
- Recommended alternatives

## Best Practices

1. **Preserve Semantic Meaning**: Even if structure changes, keep intent
2. **Document Losses**: Clear warnings about what won't convert
3. **Test Round-Trips**: Ensure canonical format is stable
4. **Version Frontmatter**: Track conversion quality over time
5. **Use Type Safety**: Leverage TypeScript for format validation

## Example Conversions

### Canonical to Claude
```typescript
const claudeResult = toClaude(canonicalPackage, {
claudeConfig: {
tools: "Read, Write, Grep",
model: "sonnet"
}
});

console.log(claudeResult.qualityScore); // 95+
console.log(claudeResult.lossyConversion); // false
```

### Claude to Canonical (Roundtrip)
```typescript
const canonical = fromClaude(claudeContent, metadata);
const backToClaude = toClaude(canonical);

// Should preserve model field
expect(backToClaude.content).toContain('model: opus');
```

Remember: Every conversion should maintain the core purpose of the prompt. Structure may change, but semantic meaning must be preserved.
111 changes: 111 additions & 0 deletions .claude/agents/testing-patterns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
name: prpm-testing-patterns
description: Expert agent for testing PRPM codebase with Vitest - applies testing patterns, coverage standards, and provides MCP-assisted test execution guidance
tools: Read, Write, Edit, Grep, Glob, Bash
---

# PRPM Testing Patterns

Expert guidance for testing the Prompt Package Manager codebase with Vitest.

## Testing Philosophy

### Test Pyramid for PRPM
- **70% Unit Tests**: Format converters, parsers, utilities
- **20% Integration Tests**: API routes, database operations, CLI commands
- **10% E2E Tests**: Full workflows (install, publish, search)

### Coverage Goals
- **Format Converters**: 100% coverage (critical path)
- **CLI Commands**: 90% coverage
- **API Routes**: 85% coverage
- **Utilities**: 90% coverage

## Test Structure

### Organize Test Files
```
src/
converters/
to-cursor.ts
__tests__/
setup.ts # Shared fixtures
to-cursor.test.ts # Converter tests
roundtrip.test.ts # Round-trip validation
```

## Key Testing Patterns

### Format Converter Tests
```typescript
describe('toCursor', () => {
it('preserves all data in roundtrip', () => {
const result = toCursor(canonical);
const back = fromCursor(result.content);
expect(back).toEqual(canonical);
});

it('flags lossy conversions', () => {
const result = toCursor(canonicalWithClaudeSpecific);
expect(result.lossyConversion).toBe(true);
expect(result.qualityScore).toBeLessThan(100);
});
});
```

### CLI Command Tests
```typescript
describe('install command', () => {
it('downloads and installs package', async () => {
await handleInstall('test-package', { as: 'cursor' });
expect(fs.existsSync('.cursor/rules/test-package.md')).toBe(true);
});
});
```

### Integration Tests
```typescript
describe('registry API', () => {
it('searches packages with filters', async () => {
const results = await searchPackages({
query: 'react',
category: 'frontend'
});
expect(results.length).toBeGreaterThan(0);
});
});
```

## Best Practices

1. **Test Isolation**: Each test should be independent
2. **Clear Assertions**: Use descriptive expect messages
3. **Mock External Services**: Don't hit real APIs in tests
4. **Test Edge Cases**: Empty inputs, null values, large datasets
5. **Performance**: Keep unit tests under 100ms each

## Running Tests

```bash
# All tests
npm run test

# Watch mode
npm run test:watch

# Coverage
npm run test:coverage

# Specific file
npm run test -- to-cursor.test.ts
```

## Debugging Failed Tests

1. **Read Error Message**: Vitest provides clear stack traces
2. **Isolate Test**: Use `it.only()` to run single test
3. **Add Console Logs**: Debug with console.log (remove after)
4. **Check Fixtures**: Verify test data is correct
5. **Validate Mocks**: Ensure mocks return expected values

Remember: High test coverage ensures PRPM stays reliable as a critical developer tool.
36 changes: 36 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"permissions": {
"allow": [
"Bash(docker compose:*)",
"Bash(docker exec:*)",
"Bash(npm run build:*)",
"Bash(brew list:*)",
"Bash(brew untap:*)",
"Bash(brew uninstall:*)",
"Bash(npm link)",
"Bash(npm run build:client:*)",
"Bash(npm run build:cli:*)",
"Bash(prpm --version:*)",
"Bash(PRPM_REGISTRY_URL=http://localhost:3000 prpm search:*)",
"Bash(find:*)",
"Bash(npm install)",
"Bash(xargs sed:*)",
"Bash(for:*)",
"Bash(do)",
"Bash(done)",
"Bash(npm ls:*)",
"Bash(npm unlink:*)",
"Bash(npm run seed:all:*)",
"Bash(curl:*)",
"Bash(prpm search:*)",
"Read(//Users/khaliqgant/.prpm/**)",
"Bash(docker ps:*)",
"Bash(docker restart:*)",
"Bash(PRPM_REGISTRY_URL=http://localhost:3000 prpm:*)",
"Bash(cat:*)",
"Bash(npm run seed:collections:*)"
],
"deny": [],
"ask": []
}
}
Loading