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

Update supernotes extension to enable AI tools #17475

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

Conversation

mattdelliott
Copy link

@mattdelliott mattdelliott commented Mar 1, 2025

Description

  • Enables AI Extension and allows for searching for cards, append to an existing card, or creating a new card.

Screencast

https://cln.sh/FRWgv49yw1XjNh0PX0KN

Checklist

- Added in AI Extension support and date format preference.
- Initial commit
@mattdelliott mattdelliott requested a review from peduarte as a code owner March 1, 2025 19:44
@raycastbot
Copy link
Collaborator

raycastbot commented Mar 1, 2025

Thank you for your first contribution! 🎉

🔔 @acnebs @tobeagram @peduarte 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

@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: supernotes Issues related to the supernotes extension labels Mar 1, 2025
@mattdelliott mattdelliott changed the title Update supernotes extension Update supernotes extension to enable AI tools Mar 1, 2025
@connebs
Copy link
Contributor

connebs commented Mar 2, 2025

Hey @mattdelliott, thanks for this. We were just discussing integrating the new Raycast AI features with the Supernotes extension, looks like you've beat us to it!

The only issue is that the date formatting feature unfortunately cannot work as written, as only a certain date format (ISO 8601 without a time) is accepted as the local_date property in the daily append endpoint. The good news is that we are actually already in the process of adding a standardized date format option to Supernotes itself, which will be coming in our next release.

However this would be a good time to better standardize that call so that it matches other integrations, which use two digits for month and day (this was actually an oversight when we first added local_date to the Raycast extension). So if you could remove the date formatting option feature, but leave in the formatting call with a strict date like below, that would be great.

const localDate = format(new Date(), "yyyy-MM-dd")

@mattdelliott
Copy link
Author

Hey @connebs! That is great to hear. I removed that option and hardcoded the yyyy-MM-dd format. I could remove the date-fns dependency and just use padStart on the original way it was written if you want. Let me know if you would prefer for me to do that.

As far as the AI Extension goes, I just got some basics to get started, but I am sure there will be a lot more awesome use cases to implement.

@connebs
Copy link
Contributor

connebs commented Mar 2, 2025

Good point, I think for now padStart would be better since we are otherwise not using other features of date-fns

@mattdelliott
Copy link
Author

Sounds good. I've made those changes.

@pernielsentikaer pernielsentikaer self-assigned this Mar 2, 2025
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 Extension support to Supernotes, enabling interaction with the note-taking app through Raycast's AI interface.

  • Added three new AI tools in /extensions/supernotes/src/tools/: search-cards.ts, append-card.ts, and create-card.ts for searching, appending to, and creating cards
  • Added AI configuration in package.json with instructions and example inputs for handling markdown formatting and daily cards
  • Fixed date formatting in sendToDaily function to properly zero-pad month and day values for consistent ISO-8601 format
  • Updated documentation in README.md with a new "Tools" section describing the AI capabilities
  • Added proper changelog entry with the {PR_MERGE_DATE} placeholder at the top of CHANGELOG.md

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

7 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +11 to +13
* The content markup to append to the card. If not provided then ask for it.
*/
content: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: The JSDoc comment says "If not provided then ask for it" but the content field is not marked as optional in the type definition. Either make it optional with content?: string or update the comment.

Suggested change
* The content markup to append to the card. If not provided then ask for it.
*/
content: string;
* The content markup to append to the card. If not provided then ask for it.
*/
content?: string;


type Input = {
/**
* The search term to search for when looking for a cards, optional
Copy link
Contributor

Choose a reason for hiding this comment

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

syntax: Minor typo in comment: 'a cards' should be 'cards'

Suggested change
* The search term to search for when looking for a cards, optional
* The search term to search for when looking for cards, optional

body: {
search: searchTerm,
include_membership_statuses: [1, 2],
limit: 5,
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 the limit configurable through the Input type to allow for more flexible searches

Comment on lines +39 to +41
if (!fetched.ok) {
throw new Error("There was a problem searching for cards.");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Error handling could be improved by including the error details from fetched.body in the thrown error message

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: supernotes Issues related to the supernotes extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants