Skip to content

Fix nested folder creation and note creation in deep folders#9

Closed
robschmitt wants to merge 1 commit intosweetrb:mainfrom
robschmitt:feat/nested-folder-support
Closed

Fix nested folder creation and note creation in deep folders#9
robschmitt wants to merge 1 commit intosweetrb:mainfrom
robschmitt:feat/nested-folder-support

Conversation

@robschmitt
Copy link
Copy Markdown
Contributor

Summary

  • createFolder now supports nested paths"Retro Tech/PC/CPUs" creates all intermediate folders, matching the /-separated convention used elsewhere in the codebase (create-note, move-note, delete-folder)
  • Checks folder existence before creating — prevents duplicate ghost folders in Apple Notes' CoreData store that caused notes to land in broken/invisible folders
  • Fixes note creation in deeply nested folders — AppleScript's set/return id pattern fails with nested of folder references (-1728); switched to implicit return which works correctly
  • Updated tool description so callers know about nested path support
  • Added tests for nested creation, existence skipping, and failure cases

Test plan

  • create-folder with nested path (e.g. "A/B/C") creates proper hierarchy
  • create-folder with already-existing path succeeds without creating duplicates
  • create-note in a deeply nested folder places the note in the correct folder
  • create-folder with single segment still works as before

…ders

createFolder now supports slash-separated paths (e.g. "Retro Tech/PC/CPUs"),
creating each intermediate folder as needed. It checks existence before
creating to prevent duplicate ghost folders in Apple Notes' CoreData store.
Also fixes note creation in deeply nested folders by using implicit AppleScript
return instead of set/return pattern which fails with nested folder refs (-1728).
sweetrb added a commit that referenced this pull request Apr 6, 2026
…ders

- createFolder now iterates path segments with existence checks to prevent
  duplicate ghost folders in CoreData
- createNote uses implicit return for folder-based creation to avoid
  AppleScript -1728 error in deeply nested contexts
- Updated create-folder tool schema to document nested path support
- Bumped to v1.4.1

Based on PR #9 by @robschmitt

Co-Authored-By: Rob Schmitt <robschmitt@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sweetrb sweetrb closed this in e9a4b20 Apr 6, 2026
@sweetrb
Copy link
Copy Markdown
Owner

sweetrb commented Apr 6, 2026

Nice catch on all three of these, Rob — the ghost folder issue from missing existence checks was a sneaky one, and the -1728 error with set newNote in nested folder contexts is exactly the kind of thing you only find by actually using it. Merged into main as v1.4.1, tests up to 313 now. Thanks again!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants