Repository navigation
Add vps-explorer extension - #22507
Conversation
- edit description - fixes and adding metadata - fix folder names spaces issue - fixing issues - Clean up Project - Clean up project - handling icons and markdowns with themes - implementing upload - Implemeting download - making the icons theme aware - Adding delete and create and rename functionality - Add Sorting - Adding icon type awareness - Adjustments - Handle GoTo and GoBack - Display UI of the root directory - starting point
commented
Oct 29, 2025
|
Congratulations on your new Raycast extension! 🚀 You can expect an initial review within five business days. Once the PR is approved and merged, the extension will be available on our Store. |
left a comment
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
This PR adds a new VPS Explorer extension that enables users to browse, upload, download, and manage files on remote VPS servers via SSH/SCP directly from Raycast.
Major Changes:
- Implemented SSH connection management using expect scripts for password authentication
- Created file browser UI with list/detail view showing file metadata (permissions, owner, size, modified time)
- Added file operations: upload, download, create directory, rename, delete
- Included sorting capabilities (by name, date, size, kind) and navigation history
- Provided comprehensive README and metadata images
Issues Found:
- Security vulnerability: passwords embedded in plain text in temporary expect scripts visible to process listing
- Logic bug: upload form allows multiple file selection but only uploads first file
- Logic bug: hardcoded
/rootpath assumption breaks parent directory navigation for non-root users - Logic bug: theme-based markdown icon function returns same icon for both light/dark themes
Confidence Score: 2/5
- This PR has a critical security vulnerability that must be resolved before merging
- The password security issue in vpsOperations.ts is a critical vulnerability that could expose user credentials. Additionally, there are several functional bugs that will cause user-facing issues (broken navigation for non-root users, misleading upload UI). These issues need to be addressed before the extension is production-ready.
- Critical attention needed for
services/vpsOperations.ts(security), andsrc/browse-vps-files.tsxandsrc/components/upload-file.tsx(functionality bugs)
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| extensions/vps-explorer/services/vpsOperations.ts | 2/5 | VPS SSH/SCP operations implementation with password security vulnerability in expect script generation |
| extensions/vps-explorer/src/browse-vps-files.tsx | 3/5 | Main UI component for browsing VPS files with hardcoded /root path assumption |
| extensions/vps-explorer/src/components/upload-file.tsx | 3/5 | File upload form with misleading multiple selection UI that only uploads first file |
| extensions/vps-explorer/lib/utils.ts | 4/5 | Utility functions for file icons, sorting, and markdown rendering with minor theme bug |
16 files reviewed, 4 comments
| private async createExpectScript(command: string, password?: string): Promise<string> { | ||
| const scriptPath = join(tmpdir(), `ssh_script_${Date.now()}.exp`); | ||
|
|
||
| const expectScript = password | ||
| ? `#!/usr/bin/expect -f | ||
| set timeout 30 | ||
| spawn ${command} | ||
| expect { | ||
| "password:" { | ||
| send "${password}\\r" | ||
| exp_continue | ||
| } | ||
| "Password:" { | ||
| send "${password}\\r" | ||
| exp_continue | ||
| } | ||
| "(yes/no)?" { | ||
| send "yes\\r" | ||
| exp_continue | ||
| } | ||
| "Connection test successful" { | ||
| exit 0 | ||
| } | ||
| timeout { | ||
| exit 1 | ||
| } | ||
| eof | ||
| } | ||
| ` | ||
| : `#!/usr/bin/expect -f | ||
| set timeout 30 | ||
| spawn ${command} | ||
| expect { | ||
| "(yes/no)?" { | ||
| send "yes\\r" | ||
| exp_continue | ||
| } | ||
| "Connection test successful" { | ||
| exit 0 | ||
| } | ||
| timeout { | ||
| exit 1 | ||
| } | ||
| eof | ||
| } | ||
| `; | ||
|
|
||
| writeFileSync(scriptPath, expectScript); | ||
| return scriptPath; |
There was a problem hiding this comment.
logic: Passwords embedded in shell scripts are vulnerable to exposure via process listing (e.g., ps aux) and system logs. The password appears in plain text in temporary expect scripts.
| private async createExpectScript(command: string, password?: string): Promise<string> { | |
| const scriptPath = join(tmpdir(), `ssh_script_${Date.now()}.exp`); | |
| const expectScript = password | |
| ? `#!/usr/bin/expect -f | |
| set timeout 30 | |
| spawn ${command} | |
| expect { | |
| "password:" { | |
| send "${password}\\r" | |
| exp_continue | |
| } | |
| "Password:" { | |
| send "${password}\\r" | |
| exp_continue | |
| } | |
| "(yes/no)?" { | |
| send "yes\\r" | |
| exp_continue | |
| } | |
| "Connection test successful" { | |
| exit 0 | |
| } | |
| timeout { | |
| exit 1 | |
| } | |
| eof | |
| } | |
| ` | |
| : `#!/usr/bin/expect -f | |
| set timeout 30 | |
| spawn ${command} | |
| expect { | |
| "(yes/no)?" { | |
| send "yes\\r" | |
| exp_continue | |
| } | |
| "Connection test successful" { | |
| exit 0 | |
| } | |
| timeout { | |
| exit 1 | |
| } | |
| eof | |
| } | |
| `; | |
| writeFileSync(scriptPath, expectScript); | |
| return scriptPath; | |
| private async createExpectScript(command: string, passwordFile?: string): Promise<string> { | |
| const scriptPath = join(tmpdir(), `ssh_script_${Date.now()}.exp`); | |
| const expectScript = passwordFile | |
| ? `#!/usr/bin/expect -f | |
| set timeout 30 | |
| set password [exec cat ${passwordFile}] | |
| spawn ${command} | |
| expect { | |
| "password:" { | |
| send "$password\\r" | |
| exp_continue | |
| } | |
| "Password:" { | |
| send "$password\\r" | |
| exp_continue | |
| } | |
| "(yes/no)?" { | |
| send "yes\\r" | |
| exp_continue | |
| } | |
| "Connection test successful" { | |
| exit 0 | |
| } | |
| timeout { | |
| exit 1 | |
| } | |
| eof | |
| } | |
| ` | |
| : `#!/usr/bin/expect -f | |
| set timeout 30 | |
| spawn ${command} | |
| expect { | |
| "(yes/no)?" { | |
| send "yes\\r" | |
| exp_continue | |
| } | |
| "Connection test successful" { | |
| exit 0 | |
| } | |
| timeout { | |
| exit 1 | |
| } | |
| eof | |
| } | |
| `; | |
| writeFileSync(scriptPath, expectScript, { mode: 0o700 }); | |
| return scriptPath; | |
| } |
| {...itemProps.files} | ||
| id="files" | ||
| title="Choose file to upload" | ||
| allowMultipleSelection={true} |
There was a problem hiding this comment.
logic: allowMultipleSelection={true} but only first file is uploaded (line 11). Either disable multiple selection or handle all selected files
| allowMultipleSelection={true} | |
| allowMultipleSelection={false} |
| {currentPath === "/root" && !isLoading && ( | ||
| <MainDirectoryItem onGoToParentDirectory={() => handleGoToDirectory("..")} /> | ||
| )} |
There was a problem hiding this comment.
logic: Hardcoded /root check doesn't work for non-root users. Parent directory navigation breaks when initial path isn't /root
| {currentPath === "/root" && !isLoading && ( | |
| <MainDirectoryItem onGoToParentDirectory={() => handleGoToDirectory("..")} /> | |
| )} | |
| {navigationHistory.length === 0 && !isLoading && ( | |
| <MainDirectoryItem onGoToParentDirectory={() => handleGoToDirectory("..")} /> | |
| )} |
| export const getMarkdownBasedOnTheme = () => { | ||
| if (environment.appearance === "dark") { | ||
| return markdownLightIcon; | ||
| } else { | ||
| return markdownLightIcon; | ||
| } | ||
| }; |
There was a problem hiding this comment.
logic: Always returns markdownLightIcon regardless of theme (both branches identical)
| export const getMarkdownBasedOnTheme = () => { | |
| if (environment.appearance === "dark") { | |
| return markdownLightIcon; | |
| } else { | |
| return markdownLightIcon; | |
| } | |
| }; | |
| export const getMarkdownBasedOnTheme = () => { | |
| if (environment.appearance === "dark") { | |
| return markdownLightIcon; | |
| } else { | |
| return markdownDarkIcon; | |
| } | |
| }; |
- Update condition for displaying MainDirectoryItem - Remove unused getMarkdownBasedOnTheme function - Restrict file upload to single selection
commented
Nov 3, 2025
|
@greptileai can you do a fresh review here |
left a comment
There was a problem hiding this comment.
I'll provide a comprehensive review of this VPS Explorer extension for Raycast. This is quite an impressive extension with a lot of functionality!
Overall Architecture & Design ⭐⭐⭐⭐
Strengths:
- Well-structured codebase with clear separation of concerns
- Good use of TypeScript interfaces and types
- Clean component architecture with reusable forms
- Proper error handling and user feedback via toasts
Areas for improvement:
- Some functions are quite large and could benefit from extraction
- Heavy reliance on shell commands could be more robust
Code Quality Issues
1. Security Concerns 🔴
The password handling and shell command execution needs attention:
// In vpsOperations.ts - this exposes passwords in process lists
const connectionScript = `#!/usr/bin/expect -f
set password [lindex $argv 0]
spawn ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR -o CheckHostIP=no -p ${this.config.port} ${this.config.username}@${this.config.host} "echo 'Connection test successful'"
expect {
"password:" {
send "$password\\r"
exp_continue
}Recommendation: Consider using SSH key authentication as the primary method, with password as fallback.
2. Error Handling Inconsistencies
Some operations have different error handling patterns:
// Sometimes returns empty array on error
catch (error) {
console.error(`Listing failed: ${error}`);
return []; // This masks errors
}
// Sometimes throws
catch (error) {
console.error(`Failed to create directory: ${error}`);
throw new Error(`Failed to create directory "${directoryName}": ${error instanceof Error ? error.message : "Unknown error"}`);
}Suggestion: Standardize error handling - either always throw or always return error states.
3. Code Duplication
There's significant duplication in the expect script generation:
// This pattern repeats many times with slight variations
const uploadScript = `#!/usr/bin/expect -f
set timeout 120
// ... nearly identical expect scriptsRecommendation: Create a generic createExpectScript helper function.
4. File Path Handling
Path joining and escaping is inconsistent:
// Sometimes uses join()
const fullPath = join(remotePath, directoryName);
// Sometimes manual concatenation
const lsCommand = fileGlob ? `ls -la '\$remote_path/${fileGlob}'` : `ls -la '\$remote_path'`;Suggestion: Use consistent path handling utilities.
UI/UX Issues
1. Loading States
The loading behavior could be more granular - currently the entire list shows loading during operations.
2. Icon System Complexity
The icon system with light/dark variants is overly complex:
// This is quite convoluted
export const getfileLightIcon = (fileName: string, type: string) => {
// ... lots of switching logic
return { source: { light: "dark/picture.svg", dark: "picture.svg" } };
};Suggestion: Simplify to use Raycast's built-in icon system where possible.
Performance Concerns
1. Inefficient File Operations
Each operation creates temporary files and scripts:
const scriptPath = join(tmpdir(), `ssh_script_${Date.now()}.exp`);
writeFileSync(scriptPath, expectScript);
// ... execute
unlinkSync(scriptPath); // cleanup in finallyRecommendation: Consider connection pooling or persistent connections for better performance.
Specific Suggestions
1. Constants Organization
// In lib/constants.ts - simplify icon constants
export const ICON_MAPPINGS = {
directory: Icon.Folder,
pdf: { source: { light: "dark/file-pdf.svg", dark: "file-pdf.svg" } },
image: { source: { light: "dark/picture.svg", dark: "picture.svg" } },
// ... etc
} as const;
2. Error Boundary Component
Consider adding error boundaries for better error handling:
// Add to components/
export function ErrorBoundary({ children, fallback }: { children: React.ReactNode; fallback: React.ComponentType }) {
// Implementation
}3. Connection Management
The connection handling could be more robust:
// Consider adding connection health checks
class VPSConnectionManager {
private connection: VPSOperations | null = null;
private lastHealthCheck = 0;
async ensureConnected() {
if (!this.connection?.isConnected() || this.needsHealthCheck()) {
await this.reconnect();
}
}
}Package.json Issues
The dependencies look appropriate, but consider:
- Adding
@types/expectif using expect programmatically - Consider if
date-fnsis necessary for the simple date formatting being done
Documentation
The README is comprehensive, but consider adding:
- Troubleshooting section for common SSH issues
- Security best practices
- Known limitations
Verdict
This is a solid extension with good functionality. The main concerns are:
- Security - Password handling and shell injection risks
- Performance - Temporary file creation for each operation
- Code organization - Some duplication and inconsistent patterns
Overall Rating: ⭐⭐⭐⭐ (4/5)
The extension works well and provides valuable functionality. With the security and performance improvements suggested above, this would be an excellent addition to the Raycast store.
Priority fixes:
- Improve password handling security
- Standardize error handling
- Reduce code duplication in script generation
- Add proper connection health management
Great work overall! This is a useful extension that fills a real need.
commented
Nov 4, 2025
|
Anything above you want to look into @Abdullah-Dev115 |
commented
Nov 4, 2025
I'll make a commit for error handling. for SSH, I tried use it (with ssh2-sftp-client or node-ssh) but it throws an error that kinda tells this not compatible with all cpu architectures (ARM, x86). so that is why I did the current approach with expect scripts and temproary files. |
left a comment
There was a problem hiding this comment.
Greptile Overview
Greptile Summary
This review covers only the changes made since the last review, not the entire PR. The main change in this latest update improves error handling in the listFiles method of the VPS operations service. Previously, when file listing failed, the method would silently catch errors and return an empty array, which could mislead users into thinking directories were empty when there were actually connection or permission issues. The updated implementation now properly throws descriptive errors when listing operations fail, allowing the calling code to handle failures appropriately and provide meaningful feedback to users.
This change aligns the listFiles method's error handling with the pattern used throughout the rest of the VPS operations class, where methods like connect(), createDirectory(), and deleteFile() all throw descriptive errors when operations fail. The improvement ensures users receive proper error messages instead of confusing empty directory displays when VPS operations encounter issues.
Important Files Changed
| Filename | Score | Overview |
|---|---|---|
| extensions/vps-explorer/services/vpsOperations.ts | 5/5 | Improved error handling in listFiles method by throwing descriptive errors instead of silently returning empty arrays |
Confidence score: 5/5
- This change is safe to merge with minimal risk as it only improves error handling without changing core functionality
- Score reflects a simple, well-implemented error handling improvement that follows established patterns in the codebase
- No files require special attention as this is a straightforward error handling enhancement
1 file reviewed, no comments
commented
Nov 7, 2025
|
@greptileai can you do a fresh review of the PR? |
left a comment
There was a problem hiding this comment.
I'll conduct a fresh review of this VPS Explorer extension PR. Let me analyze the codebase systematically.
Overall Assessment
This is a well-structured Raycast extension that provides VPS file management capabilities via SSH/SCP. The implementation demonstrates good TypeScript practices and follows Raycast conventions.
Strengths
✅ Clean Architecture: Well-organized with proper separation of concerns (services, components, utilities, types)
✅ Type Safety: Comprehensive TypeScript interfaces and proper error handling
✅ User Experience: Good use of Raycast UI components with loading states, toasts, and confirmations
✅ Security: Uses SSH/SCP with proper credential handling through Raycast preferences
✅ Feature Complete: Covers all essential file operations (browse, upload, download, create, rename, delete)
Issues to Address
1. Critical Security Concern
The password is embedded in plaintext within expect scripts:
// In vpsOperations.ts line ~87
spawn ssh ...
expect {
"password:" {
send "${this.config.password}\\r" // ⚠️ Password in plaintextRecommendation: Consider using SSH keys or at minimum, ensure temporary scripts are properly secured and cleaned up.
2. Error Handling
Some operations lack robust error handling:
// In browse-vps-files.tsx line ~328
const handleDownloadFile = async (remotePath: string, fileName: string) => {
// Missing validation if vpsOperations exists
await vpsOperations?.downloadFile(remotePath, localPath);Fix: Add null checks and better error boundaries.
3. Resource Management
The expect script cleanup could be more robust:
} finally {
if (scriptPath) {
try {
unlinkSync(scriptPath);
} catch (cleanupError) {
console.warn("Failed to cleanup temporary script:", cleanupError);
}
}
}Improvement: Use fs.promises.unlink and consider a more comprehensive cleanup strategy.
4. Performance Optimization
File icon determination is inefficient:
// In utils.ts - repeated string operations
const ext = fileName.split(".").pop()?.toLowerCase();
switch (ext) {
// Many cases...
}Optimization: Create a file extension to icon mapping object for O(1) lookup.
5. Code Quality Issues
Unused Constants: Many icon constants in constants.ts are defined but never used.
Inconsistent Naming:
export const pictruesLightIcon = // Typo: should be "picturesLightIcon"Magic Numbers: Hard-coded timeouts and port numbers should be configurable.
Minor Issues
6. UI/UX Improvements
- The empty folder handling could be more intuitive
- Sort functionality could remember user preference
- Consider adding file preview for common file types
7. Documentation
- README could include troubleshooting section
- Missing JSDoc comments for complex functions
Specific Code Suggestions
// Better error handling pattern
const handleOperation = async (operation: () => Promise<void>, errorMessage: string) => {
if (!vpsOperations) {
showToast({ title: "Not Connected", style: Toast.Style.Failure });
return;
}
try {
await operation();
} catch (error) {
showToast({
title: errorMessage,
message: error instanceof Error ? error.message : "Unknown error",
style: Toast.Style.Failure,
});
}
};Recommendations
- Security: Implement SSH key authentication as primary method
- Testing: Add unit tests for utility functions and service operations
- Performance: Implement file extension caching and icon optimization
- Reliability: Add connection recovery mechanisms
- User Experience: Add progress indicators for large file transfers
Verdict
This is a solid extension with good functionality and structure. The main concerns are around security practices and error handling robustness. With the suggested improvements, this would be an excellent addition to the Raycast store.
Status: Conditionally approve with requested security and error handling improvements.
left a comment
There was a problem hiding this comment.
This is pretty related to Raycast Store: SSH Connection Manager by @scopsy - right?
I know it's not quite the same, but maybe there is something you can learn from that extension, sending passwords in cleartext doesn't sound like the best solution
VPS Explorer is working as a mini SFTP Manager, from it is name…it focusing on making the users interaction with their VPSs through Raycast and they can manage them from it. |
- use spawn instead of exec, improving password handling and removing temporary script file usage - Updating package.json
commented
Nov 7, 2025
|
Hi @pernielsentikaer , now with latest commit, the passwords are now passed via the VPS_SSH_PASSWORD environment variable to the expect process, rather than being embedded in temporary script files. now the password should not be visible in proccess listing or command history. Thanks! |
commented
Nov 11, 2025
Great, Thanks! |
commented
Nov 11, 2025
|
Published to the Raycast Store: |
commented
Nov 11, 2025
|
🎉 🎉 🎉 Such a great contribution deserves a reward, but unfortunately we couldn't find your Raycast account based on your GitHub username (@Abdullah-Dev115). Please link your GitHub account to your Raycast account to receive your credits and soon be able to exchange them for some swag. |
Description
VPS Explorer is an Raycast extension that allows uses to browse, manage, and transfer files on thier VPS directly from Raycast. Connect via SSH to list directories, upload/download files, create folders, rename, and delete files, all without leaving the workflow.
Screencast
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare placed outside of themetadatafolder