Cursor Prompt Saver Extension
A powerful Cursor IDE extension that allows you to save, manage, and organize your AI chat prompts directly to GitHub repositories with advanced features and secure configuration management.
🚀 Features
Core Functionality
- One-Click Saving: Save any chat prompt to GitHub with a single command
- Smart Prompt Detection: Automatically detects selected text or clipboard content
- Advanced Prompt Management: View, organize, copy, and delete saved prompts
- Directory Organization: Organize prompts in custom directories
- Secure Configuration: Encrypted storage of GitHub credentials
- Multiple Token Support: Works with both classic and fine-grained GitHub tokens
User Interface
- Modern Dialog System: Clean, responsive webview dialogs
- Prompt Preview: View full prompt content before saving
- File Management: Browse, search, and manage all saved prompts
- Copy to Clipboard: Easy copying of prompt content
- GitHub Integration: Direct links to view prompts on GitHub
Security & Reliability
- Encrypted Configuration: All sensitive data is encrypted using AES-256-CBC
- Rate Limiting: Built-in GitHub API rate limiting
- Error Handling: Comprehensive error handling with user-friendly messages
- Token Validation: Automatic validation of GitHub token formats
- Connection Testing: Verify repository access before operations
📦 Installation
Method 1: Install from VSIX (Recommended)
- Download the extension: Get the latest
.vsix file from releases
- Open Cursor IDE
- Go to Extensions: Press
Ctrl+Shift+X (or Cmd+Shift+X on Mac)
- Install from VSIX: Click "Install from VSIX..." and select the downloaded file
⚙️ Configuration
Initial Setup
- Open Command Palette: Press
Ctrl+Shift+P (or Cmd+Shift+P on Mac)
- Search for: "Configure Prompt Saver"
- Enter your GitHub credentials:
- GitHub Token: Your Personal Access Token
- Repository Owner: Your GitHub username or organization
- Repository Name: The repository where prompts will be saved
- Branch: The branch to save to (default:
main)
- Author: Your name for attribution
GitHub Token Setup
Classic Personal Access Token
- Go to GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic)
- Click "Generate new token (classic)"
- Select scopes:
repo (full control of private repositories)
- Copy the token (starts with
ghp_)
Fine-Grained Personal Access Token
- Go to GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens
- Click "Generate new token"
- Select your repository and grant "Contents" permissions
- Copy the token (starts with
github_pat_)
Security Features
- Encrypted Storage: All configuration is encrypted using AES-256-CBC encryption
- Secure Migration: Automatically migrates from old unencrypted configurations
- Token Validation: Validates token format and permissions
- No Plain Text: Never stores sensitive data in plain text
🎯 Commands & Usage
Available Commands
Access all commands via Command Palette (Ctrl+Shift+P):
| Command |
Description |
Usage |
Configure Prompt Saver |
Set up GitHub credentials |
Initial setup and reconfiguration |
Save Current Prompt to GitHub |
Save prompt to repository |
Main saving functionality |
Manage Saved Prompts |
View and manage all prompts |
Browse, view, copy, delete prompts |
Test Extension |
Verify extension functionality |
Troubleshooting and testing |
How to Use Commands
1. Save Current Prompt to GitHub
Method 1: Using Command Palette
- Select text in your editor or copy content to clipboard
- Press
Ctrl+Shift+P (or Cmd+Shift+P on Mac)
- Type "Save Current Prompt to GitHub"
- Press Enter
Method 2: Using Keyboard Shortcut (if configured)
- Assign a custom keyboard shortcut in Cursor's keyboard shortcuts settings
What happens:
- Opens a dialog with detected content
- Allows you to edit the prompt text
- Set a custom title
- Choose a directory for organization
- Saves to GitHub with automatic formatting
2. Manage Saved Prompts
- Press
Ctrl+Shift+P (or Cmd+Shift+P on Mac)
- Type "Manage Saved Prompts"
- Press Enter
Features:
- Browse All Prompts: View all saved prompts in a list
- Search & Filter: Find specific prompts quickly
- Preview Content: See prompt content without opening
- View Full Prompt: Open detailed view with full content
- Copy to Clipboard: Copy prompt content for reuse
- Delete Prompts: Remove unwanted prompts
- Directory Organization: See prompts organized by directory
- Press
Ctrl+Shift+P (or Cmd+Shift+P on Mac)
- Type "Configure Prompt Saver"
- Press Enter
Configuration Options:
- GitHub Token: Personal Access Token (encrypted)
- Repository Owner: Username or organization
- Repository Name: Target repository
- Branch: Git branch (default: main)
- Author: Your name for attribution
📁 File Organization
Directory Structure
Prompts are organized in your GitHub repository as follows:
your-repo/
├── prompts/ # Default directory (optional)
│ ├── ai-assistance/
│ ├── code-review/
│ └── debugging/
├── prompt-title-author-timestamp.md
└── another-prompt-author-timestamp.md
File Naming Convention
Files are automatically named using this pattern:
{title-slug}-{author-slug}-{unix-timestamp}.md
Examples:
create-react-component-john-doe-1703123456.md
debug-api-issues-jane-smith-1703123789.md
ai-assistance/optimize-sql-query-bob-wilson-1703124000.md
Saved prompts are stored as Markdown files:
# Your Prompt Title
Your full prompt content here...
---
🔧 Advanced Features
Smart Content Detection
The extension automatically detects content from:
- Selected Text: Text selected in the active editor
- Clipboard Content: Content copied to clipboard
- Manual Input: Content typed directly in the dialog
Directory Organization
- Custom Directories: Organize prompts in custom folders
- Automatic Slugification: Directory names are automatically made URL-safe
- Nested Structure: Support for nested directory organization
Prompt Management
- Full-Text Search: Search through all saved prompts
- Content Preview: Quick preview without opening full content
- Bulk Operations: Manage multiple prompts efficiently
- GitHub Integration: Direct links to view prompts on GitHub
🛠️ Troubleshooting
Common Issues
Configuration Issues
"Please configure your GitHub settings first"
- Run:
Ctrl+Shift+P → "Configure Prompt Saver"
- Ensure all fields are filled correctly
"Invalid GitHub token format"
- Check token starts with
ghp_ (classic) or github_pat_ (fine-grained)
- Verify token hasn't expired
- Ensure token has proper permissions
"Repository not found"
- Verify owner and repository name are correct
- Check repository exists and is accessible
- Ensure token has access to the repository
Permission Issues
"Access denied"
- Verify token has
repo permissions (classic) or Contents permissions (fine-grained)
- Check if repository is private and token has access
- Ensure you're not hitting GitHub API rate limits
Extension Issues
Commands not appearing
- Restart Cursor IDE
- Check if extension is enabled in Extensions panel
- Verify extension is properly installed
Dialog not opening
- Check Cursor IDE console for errors
- Ensure webview permissions are enabled
- Try running "Test Extension" command
Debugging
- Open Developer Tools: Help → Toggle Developer Tools
- Check Console: Look for error messages
- Test Connection: Use "Test Extension" command
- Verify Configuration: Check if all settings are properly saved
🔒 Security & Privacy
Data Protection
- Encrypted Configuration: All sensitive data encrypted with AES-256-CBC
- No Data Collection: Extension doesn't collect or transmit personal data
- Local Storage: Configuration stored locally in Cursor IDE settings
- Secure Transmission: All GitHub API calls use HTTPS
Token Security
- Encrypted Storage: Tokens never stored in plain text
- Automatic Cleanup: Old unencrypted configurations automatically migrated
- Validation: Token format and permissions validated before use
- No Logging: Tokens never logged or transmitted to external services
🚀 Development
Project Structure
src/
├── extension.js # Main extension logic and command handling
├── github-api.js # GitHub API integration and rate limiting
├── config-manager.js # Encrypted configuration management
├── prompt-dialog.html # Save prompt dialog UI
├── manage-prompts-dialog.html # Prompt management UI
└── view-prompt-dialog.html # Prompt viewing UI
Key Components
- Extension.js: Command registration, dialog management, and user interactions
- GitHubAPI.js: GitHub REST API integration with rate limiting and error handling
- ConfigManager.js: Encrypted configuration storage and validation
- HTML Dialogs: Modern webview-based user interfaces
Building
# Install dependencies
npm install
# Package extension
npm run package
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name
- Make your changes
- Test thoroughly
- Submit a pull request
📋 Changelog
v1.0.9 (Latest)
- Enhanced Security: AES-256-CBC encryption for all configuration data
- Multiple Token Support: Support for both classic and fine-grained GitHub tokens
- Advanced Prompt Management: Full CRUD operations for saved prompts
- Directory Organization: Custom directory support for prompt organization
- Modern UI: Redesigned webview dialogs with better UX
- Rate Limiting: Built-in GitHub API rate limiting
- Connection Testing: Repository access verification
- Smart Content Detection: Automatic detection of selected text and clipboard content
v1.0.8
- Improved error handling and user feedback
- Enhanced file naming with timestamps
- Better configuration validation
v1.0.0
- Initial release with basic prompt saving functionality
- Configuration management
- Error handling and user feedback
- Automatic file naming and formatting
📄 License
MIT License - see LICENSE file for details
Made with ❤️ for the Cursor IDE community