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

cursorai-errorprompter

v1.0.0

Published

AI-powered runtime error fixing for developers using Cursor

Readme

DevMate 🤖

npm version License: MIT PRs Welcome CI

AI-powered runtime error fixing for developers using Cursor

DevMate Demo

Watch DevMate automatically detect and fix runtime errors in your code

📁 Project Structure

| Directory | Description | |-----------|-------------| | src/ | Core source code and TypeScript files | | dist/ | Compiled JavaScript output | | docs/ | Documentation and guides | | example/ | Example projects demonstrating usage | | .github/ | GitHub templates and workflows | | __tests__/ | Test files and test utilities |

🚀 Quick Install

# Using npx (recommended)
npx devmate run --cmd="npm run dev"

# Or install globally
npm install -g devmate
devmate run --cmd="npm run dev"

⚡️ Quick Start

  1. Run your app with DevMate

    # For Node.js apps
    devmate run --cmd="node app.js"
    
    # For React apps
    devmate run --cmd="npm run dev"
    
    # For TypeScript apps
    devmate run --cmd="ts-node app.ts"
  2. When an error occurs

    • DevMate detects the error
    • Generates a .cursor_prompt.md file
    • Cursor AI suggests a fix
  3. Apply the fix

    • Review the suggestion in Cursor
    • Apply the fix with one click
    • Your app continues running

🧠 What is DevMate?

DevMate is a CLI tool that transforms runtime errors into AI-powered fixes. It works by:

  1. Detecting runtime errors in your Node.js or browser applications
  2. Sending them to GPT for intelligent analysis
  3. Generating a .cursor_prompt.md file with fix suggestions
  4. Letting Cursor AI automatically apply the fixes

🔍 How it Works

graph LR
    A[Your App] -->|Runtime Error| B[DevMate]
    B -->|Error Analysis| C[GPT]
    C -->|Fix Suggestion| B
    B -->|Generate| D[.cursor_prompt.md]
    D -->|Auto-fix| E[Cursor AI]
  1. Run your app with DevMate: devmate run --cmd="npm run dev"
  2. DevMate monitors for runtime errors
  3. When an error occurs, GPT analyzes it
  4. DevMate generates a .cursor_prompt.md with the fix
  5. Cursor AI picks up the prompt and offers to fix the code

💡 Features

  • 🔍 Smart Error Detection

    • Node.js runtime errors
    • Browser console errors
    • TypeScript compilation errors
    • Custom error pattern support
  • 🤖 AI-Powered Analysis

    • GPT-4 integration for intelligent error analysis
    • Context-aware fix suggestions
    • Confidence scoring for suggestions
    • Fallback to template mode if GPT is unavailable
  • 📝 Cursor Integration

    • Automatic .cursor_prompt.md generation
    • Structured error context
    • Code snippets with before/after context
    • Step-by-step fix instructions
  • ⚡️ Developer Experience

    • Zero configuration to start
    • Real-time error monitoring
    • Optional file watching
    • Automatic server restart

⚙️ Configuration

Create a devmate.config.json in your project root:

{
  "command": "npm run dev",
  "targetLanguage": "typescript",
  "browserToolsEnabled": true,
  "errorPatterns": [
    {
      "type": "TypeScript Error",
      "regex": "TS\\d+",
      "filePathGroup": 1,
      "lineNumberGroup": 2,
      "messageGroup": 3
    }
  ],
  "gpt": {
    "apiKey": "YOUR_API_KEY",
    "model": "gpt-4-turbo-preview",
    "temperature": 0.3,
    "maxTokens": 1000
  }
}

GPT Configuration

DevMate supports OpenAI's GPT models for intelligent error analysis. To configure GPT:

  1. Get an API Key

    • Sign up at OpenAI
    • Create an API key in your dashboard
    • Copy the key to your configuration
  2. Configure in devmate.config.json

    "gpt": {
      "apiKey": "YOUR_API_KEY",
      "model": "gpt-4-turbo-preview",
      "temperature": 0.3,
      "maxTokens": 1000
    }
  3. Test Your Configuration

    npm run test-gpt
  4. Security Best Practices

    • Never commit your API key to git
    • Use environment variables:
      # .env file
      OPENAI_API_KEY=your_key_here
    • Or use a secrets manager
  5. Template-Only Mode

    • If no API key is provided, DevMate runs in template-only mode
    • Basic error analysis is still available
    • GPT features are disabled

Configuration Options

| Option | Type | Description | |--------|------|-------------| | command | string | Command to run your development server | | targetLanguage | string | Primary language (typescript/javascript) | | browserToolsEnabled | boolean | Enable browser error detection | | errorPatterns | array | Custom error detection patterns | | gpt.apiKey | string | OpenAI API key | | gpt.model | string | GPT model to use | | gpt.temperature | number | Response creativity (0-1) | | gpt.maxTokens | number | Maximum response length |

🧪 Testing

DevMate uses Vitest for testing. To run the tests:

# Install dependencies
npm install

# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm run test:coverage

Test Structure

src/
├── __tests__/
│   ├── promptBuilder.test.ts  # Tests for prompt generation
│   ├── gptService.test.ts     # Tests for GPT integration
│   └── runner.test.ts         # Tests for process runner

Example Tests

// Example test for GPT service
describe('GPTService', () => {
  it('should handle API errors gracefully', async () => {
    const service = new GPTService(config);
    await expect(service.getErrorFix(error))
      .rejects
      .toThrow('Invalid OpenAI API key');
  });
});

🧩 Examples

Check out our example projects:

👥 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Cursor for the amazing AI-powered IDE
  • OpenAI for the GPT API
  • All our contributors and users

🤖 GPT Integration

JSON Response Format

DevMate enforces structured JSON responses from GPT to ensure consistent error analysis. When creating custom prompts:

  1. Always Require JSON

    // Good: Explicit JSON requirement
    "You MUST respond ONLY with a valid JSON object: { ... }"
       
    // Bad: Ambiguous format
    "Please provide a response in any format"
  2. Include Response Example

    // Good: Clear example
    "Response format:
    {
      'suggestion': 'The fix',
      'explanation': 'Why it works',
      'confidence': 0.9
    }"
  3. Handle Parsing Gracefully

    • DevMate attempts multiple parsing strategies:
      1. Direct JSON parsing
      2. JSON extraction from text
      3. Fallback to raw response
    • All responses are structured, even if parsing fails

Example Prompt

const prompt = `
Analyze this error and provide a fix.

IMPORTANT: You MUST respond ONLY with a valid JSON object:
{
  "suggestion": "The complete code fix",
  "explanation": "Brief explanation of why this fixes the issue",
  "confidence": 0.0-1.0
}

Do not include any text outside the JSON object.`;

Response Handling

DevMate automatically handles various response scenarios:

  1. Valid JSON

    {
      "suggestion": "Add type annotation",
      "explanation": "Missing type causes TypeScript error",
      "confidence": 0.95
    }
  2. JSON in Text

    Here's my analysis:
    {
      "suggestion": "Add type annotation",
      "explanation": "Missing type causes TypeScript error",
      "confidence": 0.95
    }
    Hope this helps!
  3. Raw Text Fallback

    You should add a type annotation to fix this error.

    → Automatically converted to structured response