Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn Apple Mail into an AI Extension #17766

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

danteissaias
Copy link

@danteissaias danteissaias commented Mar 11, 2025

Description

Closes #17615

This PR turns the Apple Mail extension into an AI extension.

Supported tools:

  • Search emails
  • List addresses
  • Send email

Also added support for setting the default mail account, which is now used as the default in Compose New Message and by the AI when sending an email.

How does email searching work?

I have opted for a combination of searching the local .emlx files on the filesystem using ripgrep (which this extension downloads a copy of) and using the SQLite database for filtering by date and sender. This approach is necessary because Apple does not store the complete content of all emails within the SQLite database.

Screencast

Screenshot 2025-03-11 at 22 07 57

Checklist

- Contributor name
- Style
- Changelog
- Use default account for compose
- Evals
- Prompt engineering
- Handle no messages
- Improve prompts
- AI extension
- Initial commit
- Remove vscode ripgrep
- Fix type error
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: mail Issues related to the mail extension labels Mar 11, 2025
@raycastbot
Copy link
Collaborator

raycastbot commented Mar 11, 2025

Thank you for your contribution! 🎉

🔔 @yug2005 @ikupenov @pernielsentikaer @fengtianze @tleo19 @Luk4h @jfkisafk @StevenRCE0 @ridemountainpig @ViGeng you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

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

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.

PR Summary

This PR adds AI capabilities to the Mail extension by introducing tools for searching emails, listing addresses, and sending emails, along with support for default mail account management.

  • Critical security vulnerability: SQL injection risk in list-addresses.ts where query parameter is directly interpolated into SQL without sanitization
  • Missing error handling in getPersistenceInfo.ts for file access and parsing failures
  • Recommend wrapping file operations in ripgrep.ts with try-catch blocks and adding proper cleanup for failed downloads
  • Need input validation for email addresses and content in send-email.ts before processing
  • Consider adding rate limiting for database operations in search-messages.ts to prevent performance issues with large mailboxes

💡 (2/5) Greptile learns from your feedback when you react with 👍/👎!

13 file(s) reviewed, 16 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +161 to +162
"ai": {
"instructions": "- If you can't access the Apple Mail database, tell the user he needs to give Raycast the full disk access permission in the system settings. Be detailed about the steps.",
Copy link
Contributor

Choose a reason for hiding this comment

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

style: AI instructions use gendered language ('he needs'). Consider using gender-neutral language ('they need')

Comment on lines +8 to +11
type PersistenceInfo = {
LastUsedVersionDirectoryName: string;
VersionDirectoryIdentifiers: Record<string, string>;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider making this type readonly to prevent accidental mutations of the parsed data.

@danteissaias danteissaias changed the title Update mail extension Turn Apple Mail into an AI Extension Mar 11, 2025
danteissaias and others added 16 commits March 11, 2025 18:40
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Extension extension fix / improvement Label for PRs with extension's fix improvements extension: mail Issues related to the mail extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Apple Mail] ...
3 participants