From c85db868fdf4250cfd78cc67cdd2917867f4f633 Mon Sep 17 00:00:00 2001 From: Adolfo Reyna Date: Fri, 13 Feb 2026 13:26:50 -0500 Subject: [PATCH] Auto-sync: 2026-02-13 13:26:50 --- skills/macos-notes/SKILL.md | 12 +++++++++++ skills/macos-notes/add_note.scpt | 33 ++++++++++++++++++++++++++++++ skills/macos-notes/list_notes.scpt | 32 +++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 skills/macos-notes/SKILL.md create mode 100644 skills/macos-notes/add_note.scpt create mode 100644 skills/macos-notes/list_notes.scpt diff --git a/skills/macos-notes/SKILL.md b/skills/macos-notes/SKILL.md new file mode 100644 index 0000000..036c3fd --- /dev/null +++ b/skills/macos-notes/SKILL.md @@ -0,0 +1,12 @@ +# macOS Notes +Description: Manage Apple Notes via AppleScript. + +## Tools + +### list +Description: List recent notes or search by title. +Command: osascript skills/macos-notes/list_notes.scpt "{{query}}" + +### add +Description: Create a new note or append to an existing one. +Command: osascript skills/macos-notes/add_note.scpt "{{title}}" "{{body}}" diff --git a/skills/macos-notes/add_note.scpt b/skills/macos-notes/add_note.scpt new file mode 100644 index 0000000..5c195a0 --- /dev/null +++ b/skills/macos-notes/add_note.scpt @@ -0,0 +1,33 @@ +#!/usr/bin/osascript +on run argv + if (count of argv) < 2 then + return "Usage: add_note.scpt <body>" + end if + + set noteTitle to item 1 of argv + set noteBody to item 2 of argv + + -- Apple Notes expects HTML for the body. + -- We'll wrap the body in minimal HTML. + set htmlBody to "<div>" & noteBody & "</div>" + + -- Replace newlines with <br> + set htmlBody to do shell script "echo " & quoted form of htmlBody & " | sed 's/$/<br>/'" + + tell application "Notes" + tell default account + -- Check if note exists to append, or create new + set existingNotes to (notes whose name is noteTitle) + if (count of existingNotes) > 0 then + set currentNote to item 1 of existingNotes + set currentBody to body of currentNote + -- Append to existing body + set body of currentNote to currentBody & "<br>" & htmlBody + return "Appended to note: " & noteTitle + else + make new note with properties {name:noteTitle, body:htmlBody} + return "Created new note: " & noteTitle + end if + end tell + end tell +end run \ No newline at end of file diff --git a/skills/macos-notes/list_notes.scpt b/skills/macos-notes/list_notes.scpt new file mode 100644 index 0000000..6915b11 --- /dev/null +++ b/skills/macos-notes/list_notes.scpt @@ -0,0 +1,32 @@ +#!/usr/bin/osascript +on run argv + set searchObj to "" + if (count of argv) > 0 then + set searchObj to item 1 of argv + end if + + tell application "Notes" + if searchObj is "" then + set foundNotes to notes of default account + -- limiting to top 10 recent + set noteCount to count of foundNotes + if noteCount > 10 then set noteCount to 10 + set subNotes to items 1 thru noteCount of foundNotes + else + set subNotes to (notes of default account whose name contains searchObj) + end if + + set output to "" + repeat with aNote in subNotes + set nName to name of aNote + set nBody to body of aNote -- This is HTML + set nModDate to modification date of aNote + + -- Simple HTML cleanup for readability (very basic) + set nBodyClean to do shell script "echo " & quoted form of nBody & " | sed -e 's/<[^>]*>//g'" + + set output to output & "Note: " & nName & "\nModified: " & nModDate & "\nBody: " & nBodyClean & "\n---\n" + end repeat + return output + end tell +end run \ No newline at end of file