Skip to content

Add vps-explorer extension - #22507

Merged
raycastbot merged 7 commits into
raycast:mainfrom
Abdullah-Dev115:ext/vps-explorer
Nov 11, 2025
Merged

raycastbot merged 7 commits into
raycast:mainfrom
Abdullah-Dev115:ext/vps-explorer

Conversation

@Abdullah-Dev115

@Abdullah-Dev115 Abdullah-Dev115 commented Oct 29, 2025 •

Copy link
Copy Markdown
Contributor

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

- 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
@raycastbot raycastbot added the new extension Label for PRs with new extensions label Oct 29, 2025
@raycastbot

ghost commented Oct 29, 2025

Copy link
Copy Markdown
Collaborator

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.

@Abdullah-Dev115
Abdullah-Dev115 marked this pull request as ready for review October 29, 2025 13:08

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 /root path 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), and src/browse-vps-files.tsx and src/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

Edit Code Review Agent Settings | Greptile

Comment on lines +18 to +66
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;

ghost Oct 29, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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}

ghost Oct 29, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: allowMultipleSelection={true} but only first file is uploaded (line 11). Either disable multiple selection or handle all selected files

Suggested change
allowMultipleSelection={true}
allowMultipleSelection={false}

Comment on lines +590 to +592
{currentPath === "/root" && !isLoading && (
<MainDirectoryItem onGoToParentDirectory={() => handleGoToDirectory("..")} />
)}

ghost Oct 29, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Hardcoded /root check doesn't work for non-root users. Parent directory navigation breaks when initial path isn't /root

Suggested change
{currentPath === "/root" && !isLoading && (
<MainDirectoryItem onGoToParentDirectory={() => handleGoToDirectory("..")} />
)}
{navigationHistory.length === 0 && !isLoading && (
<MainDirectoryItem onGoToParentDirectory={() => handleGoToDirectory("..")} />
)}

Comment thread extensions/vps-explorer/lib/utils.ts Outdated
Comment on lines +240 to +246
export const getMarkdownBasedOnTheme = () => {
if (environment.appearance === "dark") {
return markdownLightIcon;
} else {
return markdownLightIcon;
}
};

ghost Oct 29, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Always returns markdownLightIcon regardless of theme (both branches identical)

Suggested change
export const getMarkdownBasedOnTheme = () => {
if (environment.appearance === "dark") {
return markdownLightIcon;
} else {
return markdownLightIcon;
}
};
export const getMarkdownBasedOnTheme = () => {
if (environment.appearance === "dark") {
return markdownLightIcon;
} else {
return markdownDarkIcon;
}
};

Abdullah-Dev115 added 2 commits October 29, 2025 16:48
- Update condition for displaying MainDirectoryItem
- Remove unused getMarkdownBasedOnTheme function
- Restrict file upload to single selection
@pernielsentikaer

ghost commented Nov 3, 2025

Copy link
Copy Markdown
Contributor

@greptileai can you do a fresh review here

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 scripts

Recommendation: 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 finally

Recommendation: 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/expect if using expect programmatically
  • Consider if date-fns is 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:

  1. Security - Password handling and shell injection risks
  2. Performance - Temporary file creation for each operation
  3. 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:

  1. Improve password handling security
  2. Standardize error handling
  3. Reduce code duplication in script generation
  4. Add proper connection health management

Great work overall! This is a useful extension that fills a real need.

@pernielsentikaer

ghost commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

Anything above you want to look into @Abdullah-Dev115

@pernielsentikaer
pernielsentikaer marked this pull request as draft November 4, 2025 06:10
@Abdullah-Dev115

ghost commented Nov 4, 2025

Copy link
Copy Markdown
Contributor Author

Anything above you want to look into @Abdullah-Dev115

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.

@Abdullah-Dev115
Abdullah-Dev115 marked this pull request as ready for review November 4, 2025 19:16

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Edit Code Review Agent Settings | Greptile

@pernielsentikaer

ghost commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

@greptileai can you do a fresh review of the PR?

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 plaintext

Recommendation: 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

  1. Security: Implement SSH key authentication as primary method
  2. Testing: Add unit tests for utility functions and service operations
  3. Performance: Implement file extension caching and icon optimization
  4. Reliability: Add connection recovery mechanisms
  5. 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.

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Abdullah-Dev115

ghost commented Nov 7, 2025 •

Copy link
Copy Markdown
Contributor Author

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.
This extension https://www.raycast.com/dimagrossman/ssh-manager is good! But it is for SSH connections management only.

- use spawn instead of exec, improving password handling and removing temporary script file usage
- Updating package.json
@Abdullah-Dev115

ghost commented Nov 7, 2025

Copy link
Copy Markdown
Contributor Author

Hi @pernielsentikaer ,
Thank you for the feedback

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!

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, approved 🔥

@Abdullah-Dev115

ghost commented Nov 11, 2025

Copy link
Copy Markdown
Contributor Author

Looks good to me, approved 🔥

Great, Thanks!

@raycastbot
raycastbot merged commit b4006be into raycast:main Nov 11, 2025
@github-actions

ghost commented Nov 11, 2025

Copy link
Copy Markdown
Contributor

@raycastbot

ghost commented Nov 11, 2025

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

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.

@Abdullah-Dev115
Abdullah-Dev115 deleted the ext/vps-explorer branch November 11, 2025 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new extension Label for PRs with new extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants