Skip to content

Comments

Add --folder flag to push command for organizing notes#1

Open
signalnine wants to merge 2 commits intoshakedlokits:masterfrom
signalnine:master
Open

Add --folder flag to push command for organizing notes#1
signalnine wants to merge 2 commits intoshakedlokits:masterfrom
signalnine:master

Conversation

@signalnine
Copy link

Summary

  • Adds --folder / -f flag to the push command
  • When creating a new note, allows specifying which Apple Notes folder to place it in
  • If the folder doesn't exist, it's automatically created
  • Existing note updates are unaffected (folder only applies to new note creation)

Usage

# Create note in specific folder
stash push myfile.md --folder "Work Notes"

# Short form
stash push myfile.md -f "Personal"

Changes

  • src/bashly.yml: Added --folder flag definition
  • src/push_command.sh: Pass folder name to create_note function
  • src/lib/create_note.sh: AppleScript to find-or-create folder and place note in it

Use Case

I'm using stash in a git post-commit hook to sync markdown files to Apple Notes, organized by directory structure (e.g., data/journal/*.md → "PIM - Journal" folder). This flag enables that workflow.

🤖 Generated with Claude Code

@shakedlokits
Copy link
Owner

Hi @signalnine!
Thank you so much for the PR! And I'm glad to hear it's useful for you.
I've been thinking about having something like that. I'm wondering how we could have it in a way where it would also support people to do bulk pushes. What do you think?
Maybe we could have it as a front-matter configuration.

- Add get_folder_from_frontmatter.sh to extract folder from YAML front-matter
- Update update_frontmatter.sh to preserve/set apple_notes_folder field
- Update push_command.sh with precedence: front-matter > --folder flag > default
- Folder is saved to front-matter when creating new notes

This enables bulk push operations where each file specifies its target folder,
while still supporting the --folder CLI flag for one-off pushes.
@signalnine
Copy link
Author

Great suggestion! I've updated the PR to support folder configuration via front-matter.

New behavior:

  • Files can specify their folder in YAML front-matter: apple_notes_folder: "My Folder"
  • Precedence: front-matter > --folder flag > default location
  • When creating a new note with a folder, the folder is saved to front-matter automatically

Example front-matter:

---
apple_notes_id: x-coredata://...
apple_notes_folder: "Work Notes"
---

This enables bulk operations where each file knows its target folder, while still supporting the CLI flag for one-off pushes or initial setup.

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.

2 participants