juanma-ai my-cursor-rules .cursorrules file for unknown

# VSCode/Cursor Extension Development Rules

You are an AI assistant helping with VSCode/Cursor extension development. Follow these guidelines:

## Project Context

- This is a VSCode/Cursor extension that helps users add .cursorrules files from GitHub repositories
- The extension provides a command to fetch and download .cursorrules templates
- The extension provides a command to overwrite .cursorrules files or to add fetched content to it
- The project uses TypeScript and follows VSCode extension patterns
- Focus on just one step at time to make it carefully and beatifully
- Document changes on each step in `CHANGELOG.md`. Document changes on each step under a new minor version.
  - Create a new minor version on each session
  - Add patches version on each new set of changes added to `CHANGELOG.md`
  - Place newer changes (and latest versions) first in `CHANGELOG.md`

## Project Iteration Steps

### Step 1

- Improve `src/utils/githubApi.js` so two repositories can be provided to fetch data:

  - Official one: `'https://api.github.com/repos/PatrickJS/awesome-cursorrules/contents/rules'` by default
  - Custom one: `'https://github.com/juanma-ai/my-cursor-rules/tree/main/rules'` by default

- The rules from both repos should be fetched and the ones from "custom one" should be placed first in the list

### Step 2

If there's a `.cursorrules` already created, once the user selects a rule from the QuickPick interface, provide the option to the user to:

- replace the current content of `.cursorrules` with the selecte one
- add the content of the selected rule at the end of the current content of `.cursorrules`

## Code Structure Patterns

- Use TypeScript for type safety and better maintainability
- Implement singleton patterns for services like caching
- Follow VSCode extension activation patterns and command registration
- Use async/await for API calls and file operations
- Implement proper error handling with user-friendly messages

## API Interaction Rules

- When fetching from GitHub API:
  1. Use proper error handling
  2. Implement caching mechanisms for API responses
  3. Show progress indicators for long-running operations
  4. Handle rate limiting and network errors gracefully

## UI/UX Guidelines

- Use VSCode's built-in UI components (QuickPick, Progress indicators)
- Provide clear feedback for user actions
- Show meaningful error messages
- Display progress for file downloads

## Error Handling

- Always wrap main functionality in try-catch blocks
- Show user-friendly error messages via vscode.window.showErrorMessage
- Log technical errors for debugging
- Gracefully handle:
  - Network failures
  - File system errors
  - Missing workspace errors
  - User cancellations

## Best Practices

- Cache API responses to reduce GitHub API calls
- Clean up resources properly
- Use proper TypeScript types and interfaces
- Follow VSCode extension lifecycle patterns
- Implement proper workspace checks before operations
- Keep the existing format rules of the code and add new code following exisiting formatting rules.

## File Operations

- Always check workspace existence before file operations
- Use proper path joining for cross-platform compatibility
- Handle file write operations with proper error handling
- Show progress for file operations

## Command Implementation

- Register commands in package.json
- Implement command handlers in separate files
- Use proper activation events
- Provide clear command titles and descriptions

Remember to maintain clean code structure and provide helpful user feedback for all operations.
typescript

First Time Repository

unknown
Created: 12/9/2024
Updated: 12/13/2024

All Repositories (1)