ReCodeX Extension
Turn research papers into executable code — and verify it actually works.
ReCodeX is a VS Code extension that transforms academic research papers (PDFs) into runnable code implementations. Simply upload a paper, and ReCodeX will analyze it and generate the corresponding source code files directly in your workspace.
Features
- PDF Upload: Select and upload research papers directly from VS Code
- Automatic Code Generation: Converts paper algorithms and methods into executable code
- Workspace Integration: Generated files are organized in your project directory
- Real-time Progress Tracking: Visual progress bar shows processing status
- Backend Health Monitoring: Live connectivity status indicator
- Secure File Handling: Path validation and sanitization for safe file operations
Installation
From Source
Clone the repository:
git clone https://github.com/your-username/recodex-extension.git
cd recodex-extension
Install dependencies:
npm install
Compile the extension:
npm run compile
Press F5 in VS Code to launch the Extension Development Host.
From VSIX Package
Build the package:
npm run package
Install the .vsix file via VS Code:
- Open Command Palette (
Cmd+Shift+P / Ctrl+Shift+P)
- Run "Extensions: Install from VSIX..."
- Select the generated
.vsix file
Requirements
- VS Code: Version 1.107.0 or higher
- Backend Service: A running ReCodeX backend server (default:
http://localhost:8000)
Uploading PDF Files
ReCodeX makes it easy to upload research papers and generate code. Here's everything you need to know about the PDF upload process.
How to Upload a PDF
There are two ways to upload a research paper:
Method 1: Using the Command Palette
- Open the Command Palette (
Cmd+Shift+P on macOS / Ctrl+Shift+P on Windows/Linux)
- Type "ReCodeX: Upload Research Paper"
- Press Enter
- Select your PDF file from the file dialog
- Click the ReCodeX icon (beaker) in the Activity Bar on the left side of VS Code
- In the sidebar panel, click the "Upload Research Paper" button
- Select your PDF file from the file dialog
PDF File Requirements
| Requirement |
Details |
| File Format |
PDF only (.pdf extension) |
| File Count |
One file at a time |
| File Size |
Limited by backend configuration (2-minute timeout) |
| Content |
Research papers, academic articles, technical documents |
Upload Process Step-by-Step
+-------------------------------------------------------------------+
| 1. SELECT FILE |
| --> File dialog opens -> Choose your PDF |
| |
| 2. FILE VALIDATION |
| --> Extension verifies PDF format |
| |
| 3. SAVE PDF LOCALLY |
| --> PDF saved to .recodex/uploads/ in your workspace |
| |
| 4. UPLOAD TO BACKEND |
| --> PDF sent via multipart/form-data to /implement |
| --> Progress bar shows real-time status |
| |
| 5. CODE GENERATION |
| --> Backend analyzes paper and generates code |
| |
| 6. FILE CREATION |
| --> Generated files written to workspace: |
| <paper-name>/ |
| +-- src/main.py |
| +-- requirements.txt |
| +-- README.md |
| +-- ... |
| |
| 7. COMPLETION |
| --> Success message displayed with file count |
| --> Upload another paper to create another directory |
+-------------------------------------------------------------------+
What Happens During Upload
File Selection
- A native file picker dialog opens
- Only PDF files can be selected (filtered by
.pdf extension)
- The file path is validated before proceeding
Reading the PDF
- The PDF file is read from disk as binary data
- File contents are prepared for transmission
Local Storage
- The PDF is saved to
.recodex/uploads/ in your workspace
- Filename includes timestamp for uniqueness (e.g.,
2024-01-15T10-30-00_paper.pdf)
- This allows you to reference the original paper later
Backend Communication
- The PDF is sent to the backend via HTTP POST request
- Uses
multipart/form-data encoding for file upload
- Request includes:
- Binary PDF file data
- Original filename
Processing
- Backend analyzes the research paper
- Extracts algorithms, methods, and implementation details
- Generates corresponding source code
File Generation
- Response contains generated file paths and contents
- Files are written to
<paper-name>/ directory at workspace root
- Each paper gets its own directory for easy organization
Progress Tracking
During upload and processing, the sidebar displays:
- Progress Bar: Visual indicator with percentage (0-100%)
- Status Messages: Current operation being performed
- Connection Status: Green dot (connected) or red dot (disconnected)
Generated Output Structure
Each PDF gets its own directory at the workspace root, allowing you to work on multiple research papers:
your-workspace/
├── .recodex/
│ └── uploads/ # Uploaded PDFs are saved here
│ ├── 2024-01-15T10-30-00_attention_paper.pdf
│ └── 2024-01-15T11-45-00_transformer_paper.pdf
│
├── attention_paper/ # First paper's implementation
│ ├── src/
│ │ ├── main.py
│ │ └── utils.py
│ ├── requirements.txt
│ ├── README.md
│ └── .gitignore
│
└── transformer_paper/ # Second paper's implementation
├── src/
│ ├── main.py
│ └── utils.py
├── requirements.txt
├── README.md
└── .gitignore
This structure allows you to:
- Upload multiple papers one after another
- Keep each implementation separate and organized
- Compare different paper implementations side by side
Handling Existing Files
If generated files already exist in your workspace:
- A confirmation dialog will appear
- Choose "Yes" to overwrite existing files
- Choose "No" to cancel and preserve existing files
Supported PDF Content
ReCodeX works best with:
- Machine learning research papers
- Algorithm descriptions and pseudocode
- Technical specifications
- Academic papers with clear methodology sections
- Papers containing mathematical formulas and implementations
Troubleshooting PDF Upload
| Issue |
Cause |
Solution |
| "Backend unavailable" |
Backend server not running |
Start the backend server and verify connectivity |
| "Open a workspace folder" |
No folder open in VS Code |
Click "Open Folder" when prompted, or open a folder first |
| Upload times out |
Large file or slow connection |
Check network; try a smaller PDF; increase timeout in backend |
| No files generated |
Backend processing error |
Check the ReCodeX output log for details |
| Invalid file format |
Wrong file extension |
Ensure file has .pdf extension (case-insensitive) |
| "Path validation failed" |
Security check triggered |
Report this issue; may indicate a backend problem |
Viewing Upload Logs
To see detailed upload and processing logs:
Method 1: Sidebar Button
- Click "View Logs" in the ReCodeX sidebar
Method 2: Output Panel
- Open Output panel (
View -> Output or Cmd+Shift+U)
- Select "ReCodeX" from the dropdown menu
Logs include:
- File selection events
- Upload progress
- Backend responses
- Error details with stack traces
Backend API
ReCodeX communicates with a backend service that processes PDFs and returns generated code.
Full API Documentation: See docs/BACKEND_API.md for complete backend implementation guide including:
- Detailed endpoint specifications
- Request/response schemas
- Implementation examples (Python, Node.js, Go)
- Security considerations
- Deployment checklist
Quick Reference
| Endpoint |
Method |
Description |
/ |
GET |
Health check (returns {"status": "ready"}) |
/implement |
POST |
Upload PDF, receive generated implementation |
Implement Endpoint
POST /implement
Content-Type: multipart/form-data
Form Fields:
- file: PDF binary data (required)
- query: Custom prompt (optional)
- chunk_size: Text chunk size (optional)
- chunk_overlap: Chunk overlap (optional)
- top_k_retrieve: Retrieval count (optional)
- top_k_rerank: Rerank count (optional)
Response:
{
"success": true,
"filename": "paper.pdf",
"chunks_count": 42,
"implementation": "# Full generated implementation code here...",
"error": null
}
Running the Mock Server (Development)
For testing without a real backend:
npm run mock-server
This starts a mock server on port 8000 that:
- Accepts any PDF upload
- Returns sample Python files after a 1.5-second delay
- Useful for testing the extension UI and workflow
Development
Project Structure
recodex-extension/
├── src/
│ ├── api/
│ │ ├── backendClient.ts # HTTP client for backend API
│ │ └── types.ts # TypeScript interfaces
│ ├── commands/
│ │ └── uploadPaper.ts # Upload command handler
│ ├── ui/
│ │ └── sidebarProvider.ts # Webview sidebar UI
│ ├── utils/
│ │ ├── logger.ts # Output channel logging
│ │ ├── paths.ts # Path validation utilities
│ │ └── pdf.ts # PDF file utilities
│ ├── workspace/
│ │ ├── fileWriter.ts # Safe file writing
│ │ └── projectLayout.ts # Project directory setup
│ └── extension.ts # Extension entry point
├── test-fixtures/
│ ├── mock-server.js # Mock backend for testing
│ └── sample-paper.pdf # Sample PDF for testing
└── package.json
Available Scripts
| Script |
Description |
npm run compile |
Compile and bundle for development |
npm run package |
Build production bundle |
npm run watch |
Watch mode for development |
npm run lint |
Run ESLint |
npm run check-types |
TypeScript type checking |
npm test |
Run extension tests |
npm run mock-server |
Start mock backend server |
Debugging
- Open the project in VS Code
- Press
F5 to launch Extension Development Host
- Set breakpoints in TypeScript files
- Use the Debug Console to inspect variables
Security
ReCodeX implements several security measures to protect your system:
- Path Traversal Prevention: Rejects paths containing
.. or absolute paths
- Filename Sanitization: Removes dangerous characters (
<>:"|?*)
- Workspace Boundary Enforcement: All files written within workspace root only
- Content Security Policy: Webview restricted to extension resources
- Input Validation: All API responses validated before processing
- No Arbitrary Code Execution: Generated files are written, not executed
Dependencies
Production
| Package |
Version |
Purpose |
| axios |
^1.13.2 |
HTTP client for backend communication |
| form-data |
^4.0.1 |
Multipart form data handling for PDF uploads |
Development
| Package |
Version |
Purpose |
| typescript |
^5.9.3 |
Type-safe JavaScript |
| esbuild |
^0.27.1 |
Fast bundler |
| @types/vscode |
^1.107.0 |
VS Code API types |
| eslint |
- |
Code quality |
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature)
- Commit your changes (
git commit -m 'Add amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Pull Request
Development Setup
# Clone your fork
git clone https://github.com/your-username/recodex-extension.git
cd recodex-extension
# Install dependencies
npm install
# Start development
npm run watch
# In another terminal, start mock server
npm run mock-server
# Press F5 in VS Code to test
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- Issues: GitHub Issues
- Documentation: Check this README and inline code comments
- Logs: Use the "View Logs" button in the sidebar for debugging