Skip to content

Update knowyourmeme extension - #22705

Merged
raycastbot merged 2 commits into
raycast:mainfrom
muhammadrizo-y:ext/knowyourmeme
Nov 6, 2025
Merged

raycastbot merged 2 commits into
raycast:mainfrom
muhammadrizo-y:ext/knowyourmeme

Conversation

@muhammadrizo-y

@muhammadrizo-y muhammadrizo-y commented Nov 6, 2025 •

Copy link
Copy Markdown
Contributor

Description

Screencast

Checklist

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: knowyourmeme Issues related to the knowyourmeme extension platform: macOS platform: Windows OP is author The OP of the PR is the author of the extension labels Nov 6, 2025
@raycastbot

ghost commented Nov 6, 2025

Copy link
Copy Markdown
Collaborator

Thank you for the update! 🎉

You can expect an initial review within five business days.

@muhammadrizo-y
muhammadrizo-y marked this pull request as ready for review November 6, 2025 11:11

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 🔥

@raycastbot
raycastbot merged commit 071ad2f into raycast:main Nov 6, 2025
@github-actions

ghost commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

@raycastbot

ghost commented Nov 6, 2025

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

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 updates the knowyourmeme extension by adding image download and copy functionality while significantly improving code organization. The changes introduce new action components that allow users to copy meme images to clipboard and download them to a specified directory. The codebase has been refactored to follow better separation of concerns - extracting reusable action components, moving large components to separate files, and creating dedicated utilities for image handling and HTML escaping. A new types.ts file consolidates type definitions, and the CHANGELOG properly documents the version increment with the required template format. The extension now includes user preferences for download paths and adds necessary dependencies (axios, file-type) to support the new image functionality.

Important Files Changed

Filename Score Overview
extensions/knowyourmeme/src/types.ts 5/5 New file defining a clean SearchResult type with name, url, and image properties
extensions/knowyourmeme/src/search.tsx 5/5 Refactored to use extracted action components and moved large components to separate files
extensions/knowyourmeme/.gitignore 5/5 Added .vscode to exclude VS Code configuration files
extensions/knowyourmeme/src/components/Actions.tsx 4/5 New action components with custom hook for meme thumbnails and image operations
extensions/knowyourmeme/CHANGELOG.md 5/5 Added new version entry with correct template format and fixed existing entry
extensions/knowyourmeme/src/components/MemeDetailMetadata.tsx 4/5 New component for structured metadata display with proper fallbacks
extensions/knowyourmeme/package.json 4/5 Added downloadPath preference and new dependencies for image functionality
extensions/knowyourmeme/src/utils/helpers.ts 5/5 New utility functions for HTML escaping and image URL validation
extensions/knowyourmeme/src/components/MemeDetail.tsx 4/5 New detail component with complex markdown generation and action integration
extensions/knowyourmeme/src/utils/image.ts 3/5 Image handling utilities with potential error handling and efficiency issues

Confidence score: 4/5

  • This PR introduces valuable new functionality and improves code organization with relatively low risk
  • Score reflects good refactoring practices but concerns with error handling in image utilities and potential edge cases with file operations
  • Pay close attention to src/utils/image.ts for error handling improvements and src/components/Actions.tsx for the async image operations

10 files reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

icon={Icon.Download}
onAction={async () => {
if (templateImageUrl) {
const filePath = await downloadImage(templateImageUrl ?? "", downloadPath ?? "");

ghost Nov 6, 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.

style: The nullish coalescing operator ?? is redundant here since templateImageUrl is already checked for truthiness on line 105

<Detail.Metadata>
<Detail.Metadata.Label icon={Icon.Eye} title="Views" text={meme.views?.toLocaleString() || "No Data"} />
<Detail.Metadata.Separator />
<Detail.Metadata.Label icon={Icon.Box} title="Type" text={meme.type.join(", ") || "No Data"} />

ghost Nov 6, 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: Potential runtime error if meme.type is undefined - should use optional chaining: meme.type?.join(", ") || "No Data"

Suggested change
<Detail.Metadata.Label icon={Icon.Box} title="Type" text={meme.type.join(", ") || "No Data"} />
<Detail.Metadata.Label icon={Icon.Box} title="Type" text={meme.type?.join(", ") || "No Data"} />

Comment on lines +61 to +89
${data?.sections
.map(
(section) =>
`## ${section.title}

${section.contents
.map(
(content) =>
`${
typeof content === "object" && content !== null
? isValidImageUrl(content.imageUrl)
? `<img src="${content.imageUrl}" alt="${escapeHtmlAttr(content.imageAlt)}" />

***
`
: `(unsupported image) - ${content.imageAlt || "no alt text"}

***
`
: content
}

`,
)
.join("")}

`,
)
.join("")}

ghost Nov 6, 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.

style: The nested template string and map operations create complex, hard-to-read markdown generation. Consider extracting this logic into separate functions for better maintainability.

Comment on lines +29 to +30
await fs.mkdir(path.join(os.tmpdir(), "knowyourmeme-raycast"), { recursive: true });
const downloadPath = path.join(os.tmpdir(), "knowyourmeme-raycast");

ghost Nov 6, 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.

style: Directory creation and path definition can be simplified to avoid redundancy

@muhammadrizo-y
muhammadrizo-y deleted the ext/knowyourmeme branch September 2, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension fix / improvement Label for PRs with extension's fix improvements extension: knowyourmeme Issues related to the knowyourmeme extension OP is author The OP of the PR is the author of the extension platform: macOS platform: Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants