Skip to content

Conversation

@ayuayue
Copy link

@ayuayue ayuayue commented Jan 10, 2026

Description

Screencast

Checklist

@raycastbot
Copy link
Collaborator

Congratulations on your new Raycast extension! 🚀

Due to our current reduced availability, the initial review may take up to 10-15 business days.

Once the PR is approved and merged, the extension will be available on our Store.

@ayuayue ayuayue marked this pull request as ready for review January 10, 2026 02:54
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 10, 2026

Greptile Overview

Greptile Summary

This PR adds a new DeepLX Translate extension for Raycast that provides translation functionality using the DeepLX API. The extension includes a single view-type command with a form interface for translating text between multiple languages.

Key Changes

  • New extension with translation form UI supporting 12 languages
  • Configurable API endpoint and optional API key via preferences
  • Auto-detection for source language and manual target language selection
  • Translation results displayed in a Detail view with copy actions

Critical Issues Found

Logic Errors:

  1. Target language auto-detection is backwards (line 74-76, 157): The code attempts to detect the language of the input text and use it as the target language, which would result in translating text to the same language (e.g., Chinese→Chinese). Auto-detection should only apply to source language.

  2. Missing metadata folder: Extensions with view-type commands require a metadata/ folder with Raycast-styled screenshots. Currently screenshots are in assets/screenshots/ which doesn't meet store requirements.

Syntax/Compliance Issues:
3. Unnecessary fetch import (line 13): Imports node-fetch despite Node.js 21+ having built-in fetch. The extension uses Node.js 22+ based on dependencies.

  1. Manual Preferences interface (lines 15-18): Manually defines the Preferences interface instead of using auto-generated types from raycast-env.d.ts, which can lead to type mismatches.

  2. Incorrect description (package.json line 5): "use deeplx api translate" should be properly capitalized and grammatically correct.

  3. Future date in CHANGELOG: Lists "2026-01-10" instead of "2025-01-10" for the initial release.

Recommendations

  • Remove the "auto" option from target language dropdown
  • Fix the translation logic to only auto-detect source language
  • Remove node-fetch dependency and import
  • Use auto-generated Preferences types
  • Create proper metadata/ folder with Raycast-styled screenshots
  • Fix description and date formatting issues

Confidence Score: 1/5

  • This PR has critical logic errors that will cause incorrect translation behavior and violates multiple repository standards
  • Score reflects two critical functional bugs: (1) backwards target language auto-detection logic that would translate text to the same language, and (2) missing required metadata folder for view-type commands. Additionally, there are multiple violations of repository coding standards including unnecessary dependencies, manual type definitions, and formatting issues. These issues must be resolved before the extension can function correctly and meet store requirements.
  • Pay close attention to src/translate.tsx (lines 74-76, 157) for the target language logic error and the missing metadata/ folder structure

Important Files Changed

File Analysis

Filename Score Overview
extensions/deeplx-translate/src/translate.tsx 1/5 Main translation component with critical logic errors in target language auto-detection and incorrect fetch import
extensions/deeplx-translate/package.json 2/5 Extension manifest with unnecessary node-fetch dependency, incorrect description format, and missing metadata folder
extensions/deeplx-translate/CHANGELOG.md 3/5 Changelog with future date (2026 instead of 2025) for initial release
extensions/deeplx-translate/README.md 4/5 Documentation is clear and comprehensive, though references screenshots in wrong location

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

8 files reviewed, 8 comments

Edit Code Review Agent Settings | Greptile

Icon,
} from "@raycast/api";
import { useState } from "react";
import fetch from "node-fetch";
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not import fetch from node-fetch in Node.js 21+, as fetch is a built-in global API. Since this extension uses Node.js 22+ (as indicated by the @types/node version 22.13.10), the fetch API is available natively.

Suggested change
import fetch from "node-fetch";
// Remove this import - fetch is built-in in Node.js 21+

Comment on lines 15 to 18
interface Preferences {
apiEndpoint: string;
apiKey?: string;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't manually define Preferences interface for getPreferenceValues(). These types are auto-generated in raycast-env.d.ts when the extension runs. Manual definitions can become out of sync with your actual configuration in package.json.

Suggested change
interface Preferences {
apiEndpoint: string;
apiKey?: string;
}
// Remove this manual interface - use auto-generated types from raycast-env.d.ts

Comment on lines 74 to 76
const detectedTargetLang = targetLang === "auto" ? detectLanguage(text) : targetLang;
const finalTargetLang = detectedTargetLang || "EN"; // Fallback to English if detection fails

Copy link
Contributor

Choose a reason for hiding this comment

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

This logic is incorrect. The code detects the language of the input text and uses it as the target language. This means if the input is Chinese, it would translate Chinese→Chinese, which doesn't make sense.

Auto-detection should only apply to the source language. The target language should always be explicitly selected by the user. The "auto" option should be removed from the target language dropdown (line 157).

</Form.Dropdown>

<Form.Dropdown id="targetLang" title="Target Language" value={targetLang} onChange={setTargetLang}>
<Form.Dropdown.Item value="auto" title="Auto Detect" />
Copy link
Contributor

Choose a reason for hiding this comment

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

The target language dropdown should not have an "auto" option. Auto-detection only makes sense for the source language, not the target. Remove this line.

Suggested change
<Form.Dropdown.Item value="auto" title="Auto Detect" />
<Form.Dropdown id="targetLang" title="Target Language" value={targetLang} onChange={setTargetLang}>

"$schema": "https://www.raycast.com/schemas/extension.json",
"name": "deeplx-translate",
"title": "DeepLX Translate",
"description": "use deeplx api translate",
Copy link
Contributor

Choose a reason for hiding this comment

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

The description should be properly capitalized and grammatically correct. Current: "use deeplx api translate"

Suggested change
"description": "use deeplx api translate",
"description": "Translate text using the DeepLX API",

"dependencies": {
"@raycast/api": "^1.103.0",
"@raycast/utils": "^2.2.1",
"node-fetch": "^2.7.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

This dependency should be removed since fetch is built-in in Node.js 21+. Additionally, if node-fetch were needed, most extensions in this repository use v3 instead of v2.

Suggested change
"node-fetch": "^2.7.0"
// Remove node-fetch dependency - use built-in fetch

- Add copy translation results to clipboard
- Improve API settings instructions

## [Initial Release] - 2026-01-10
Copy link
Contributor

Choose a reason for hiding this comment

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

The date "2026-01-10" is in the future. This should be "2025-01-10" or the actual release date.

Suggested change
## [Initial Release] - 2026-01-10
## [Initial Release] - 2025-01-10

Comment on lines +8 to +16
"commands": [
{
"name": "translate",
"title": "Translate",
"description": "Translate using DeepLX API",
"mode": "view",
"subtitle": "DeepLX Translation"
}
],
Copy link
Contributor

Choose a reason for hiding this comment

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

Extensions with view-type commands must include a metadata/ folder containing Raycast-styled screenshots. Currently, screenshots are in assets/screenshots/ but they should be in metadata/ instead.

The metadata folder should contain professionally styled screenshots following Raycast's store guidelines. See: https://developers.raycast.com/basics/prepare-an-extension-for-store#screenshots

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants